package bill.controller;
import bill.dao.TicketTransferDao;
import bill.dao.impl.TicketTransferDaoImpl;
import bill.entity.Enterprise;
import bill.entity.Transfer;
import bill.entity.Voucher;
import bill.pojo.TicketTransfer;
import bill.pojo.TranSers;
import bill.seivice.EnterpriseService;
import bill.seivice.TicketTransferService;
import bill.seivice.TransferService;
import bill.seivice.VoucherService;
import bill.seivice.impl.EnterpriseServiceImpl;
import bill.seivice.impl.TicketTransferServiceImpl;
import bill.seivice.impl.TransferServiceImpl;
import bill.seivice.impl.VoucherServiceImpl;
import com.google.gson.Gson;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.UUID;
@WebServlet("/tictran/*")
public class TicketTranServlet extends HttpServlet {
private static int sequence = 0; // 序列号
private static final int SEQUENCE_LENGTH = 6; // 序列号的长度
private static final int NUMBER_LENGTH = 15; // 编号的总长度
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//处理乱码
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
//获得请求路径
String url = request.getRequestURI();
String methodName = url.substring(url.lastIndexOf("/") + 1);
Class cla = TicketTranServlet.class;
try {
Method method = cla.getMethod(methodName, HttpServletRequest.class, HttpServletResponse.class);
method.invoke(cla.newInstance(), request, response);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
//查询凭证基本信息
public void ticTranQuery(HttpServletRequest request, HttpServletResponse response) throws IOException {
String vNo = request.getParameter("vNo");
HttpSession session=request.getSession();
session.setAttribute("vNo",vNo);
TicketTransferDao tic = new TicketTransferDaoImpl();
ArrayList<TicketTransfer> ticketTransfers = tic.selectAll(vNo);
Gson gson = new Gson();
response.getWriter().println(gson.toJson(ticketTransfers));
}
//查询收单企业的社会信用代码
public void ticTranQuerySD(HttpServletRequest request, HttpServletResponse response) throws IOException {
String ename = request.getParameter("receiveName");
TicketTransferService tts = new TicketTransferServiceImpl();
System.out.println(ename);
if (!"".equals(ename) && !ename.equals(null) && !"0".equals(ename)) {
String rsCode = tts.queryRsCode(ename);
Gson gson = new Gson();
response.getWriter().println(gson.toJson(rsCode));
}
}
//提交功能
public void tickSubmit(HttpServletRequest request, HttpServletResponse response) throws IOException {
Transfer transfer = new Transfer();
Voucher voucher = new Voucher();
String vNo = (String) request.getSession().getAttribute("vNo");
double money = Double.parseDouble(request.getParameter("money"));
String sdname = request.getParameter("sdname");//收单企业
String textarea = request.getParameter("textarea");
TicketTransferDao tic = new TicketTransferDaoImpl();
ArrayList<TicketTransfer> ticketTransfers = tic.selectAll(vNo);
EnterpriseService enterpriseService = new EnterpriseServiceImpl();
//A公司的转让表
transfer.settNo(generateVoucherNumber1());//编号
ArrayList<Enterprise> select1 = enterpriseService.select(ticketTransfers.get(0).geteName());//获得转单企业id
for (Enterprise i : select1) {
transfer.setTransferId(i.geteId());
}
ArrayList<Enterprise> select2 = enterpriseService.select(ticketTransfers.get(0).getoName());//获得开单企业id
for (Enterprise i : select2) {
transfer.setOpenId(i.geteId());
}
transfer.setiId(ticketTransfers.get(0).getiId());//获得金融机构id
transfer.setReceiveId(enterpriseService.select(sdname).get(0).geteId());//获得收单企业id
transfer.settAmount(ticketTransfers.get(0).getvAmount());//转单金额
transfer.setoTime(ticketTransfers.get(0).getoTime());//开单日期
transfer.setdTime(ticketTransfers.get(0).getdTime());//过期日期
transfer.setUpAddress(UUID.randomUUID().toString().substring(20));//上链地址
transfer.setStatus("A");//处理状态
transfer.setProgressStatus("A");//进度状态
transfer.setvId(ticketTransfers.get(0).getvId());//凭证id
transfer.setPayType(ticketTransfers.get(0).getPayType());//付息方式
transfer.setRemark(textarea);//备注
TransferService transferService = new TransferServiceImpl();
boolean b = transferService.insertTransfer(transfer);
//B公司的凭证表
voucher.setvNo(generateVoucherNumber());//凭证编号
voucher.setvAmount(money);//B公司凭证金额
voucher.seteId(enterpriseService.select(sdname).get(0).geteId());//B公司id
voucher.setOpenId(enterpriseService.select(ticketTransfers.get(0).getoName()).get(0).geteId());//获得开单企业id
voucher.setiId(ticketTransfers.get(0).getiId());//获得金融机构id
voucher.setoTime(ticketTransfers.get(0).getoTime());//获得开单时间
voucher.setdTime(ticketTransfers.get(0).getdTime());//获得到期时间
voucher.setUpAddress(UUID.randomUUID().toString().substring(20));//上链地址
voucher.setSource("A");//凭证来源
voucher.setStatus("A");//处理状态
//voucher.setSourceId();//凭证来源id(不要)
voucher.setPayType(ticketTransfers.get(0).getPayType());//付息方式
voucher.setvRemark(ticketTransfers.get(0).geteName()+"转让给"+sdname+money+"元");//凭证表备注
VoucherService voucherService = new VoucherServiceImpl();
voucherService.insertVoucher(voucher);
//修改功能
voucherService.updateVoucher(ticketTransfers.get(0).getvId());
//A公司的凭证表
if (ticketTransfers.get(0).getvAmount() > money) {
voucher.setvNo(generateVoucherNumber());//凭证编号
voucher.setvAmount(ticketTransfers.get(0).getvAmount() - money);//A公司凭证金额
voucher.seteId(enterpriseService.select(ticketTransfers.get(0).geteName()).get(0).geteId());//A公司id
voucher.setOpenId(enterpriseService.select(ticketTransfers.get(0).getoName()).get(0).geteId());//获得开单企业id
voucher.setiId(ticketTransfers.get(0).getiId());//获得金融机构id
voucher.setoTime(ticketTransfers.get(0).getoTime());//获得开单时间
voucher.setdTime(ticketTransfers.get(0).getdTime());//获得到期时间
voucher.setUpAddress(UUID.randomUUID().toString().substring(20));//上链地址
voucher.setSource("B");//凭证来源
voucher.setStatus("A");//处理状态
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
供应链金融项目的一个小功能 (873个子文件)
008127361dec7a10ceab47886519762dc86f0e 308B
0081d1318531b6c30eaf0d748bf80a0b2e042a 181B
0138812eac201eae475188c6dae1f5fa77ca01 187B
020cdbea886bf43fc6d18bc9d0aa71dc26f8e4 111B
0255167e88c393af08848b6ec152fee2457d32 308B
02c4a749f48fa7a92902cc3ea681a4a2e417b2 771B
02e441dd6615cb55fdc33f18e8d92eff096011 222B
039beba9ccf2e2e433c6bbcc3e9d06930a9632 243B
03d5f2460bb83b6163bd0bcb7ce70031bc6ecf 249B
043470d1a85b00726f5bf7f724545ada482a9a 361B
0446df35c3cb4afb585e5ab9a1c7f503e14c2a 198B
04b291710cf114cc9ee05eeb2204490b69ce53 857B
05568b79046679bf533525a6f72f85eea1a977 87B
056e121158dbdd63bde656b3099bdbf03b3c31 91B
05861464747fd6c03f21c1402f0e345a60f3ed 112B
068f62aae407c58764c34bdd32f266e51fe230 363B
070616e12649980ef22e3c703d2aa7f3eed71c 289B
079d8d3aa0772d709021bb560d9938374553a6 335B
07cd112e59599e9e135458321a8e9110aa94ca 208B
085a8b855ef2d13602b754bc5dce0855247c95 197B
0864bbd2d97ce14cf0896366ac63fdb22658f6 251B
0a5d9ef02183ffc7eb59203082e0801f9aa28b 51B
0a88453b37b93057834eb78bce3d3bb4675284 119B
0ab4ad19570b83491cf67a5bd755e12928f3d1 197B
0adb77637fef688ed3124778a8916afa7a156d 161B
0bbb521ce7c5ce21f8d986d82a2aa0ed7ceac4 308B
0bdac1338e1dad1fc3dcdd79aafe193f99a996 106B
0c0f543a5af9b28879433a79e6ee04174165e6 184B
0d0fc72b0028ff277b30c160d35ba4753039ad 251B
0d3707e70f71d1ead848191004fb6136daa308 49B
0e3ed6d36b8afa78e0a9e5e9b79ebbd8af9f33 2KB
0e87e1cd49fc7a8c44d5df2be097ee320fd1b0 838B
0ea8b008740fe19b315773d85f1466f7e45130 255B
0ec208d725638937f503ce1b9abeac97f19c50 1KB
0f6f52e12fc0ccc007bb0412381223178fef1b 196B
10c2e4fc3a1711b459e2b4e0a4213f7b8c5a5e 324B
112ae8f39f3d3e90a486e8c025cc753fd24307 202B
1192d8b3de8949ebbaf65dc4be0b835410572e 258B
11dbe0eee67dc986323b51bef1293ed8b74431 225B
1213cd34ab1b83479631d6156530907322690c 4KB
12606a5488cc2891e76871da95346aca9b20c9 227B
12c2d82995a147f43d527b3ae08a2a2216f442 194B
13c35125c544adb9c5cccaa8cf69c424db55d7 3KB
1449235ec734293520b44de3df6e6008b32988 111B
1490e41666e015b2d0b3b3c0871e70dc40f1d6 1KB
14e44e0cf7e03ab97f4f09a5cb39ffb6f27d2a 717B
157051fa8aa9c841069a16bb4ff5f86530d129 290B
15824fabdfc1a48fbece9a6fa12f23627795ad 197B
160d7490a5b7a39d01db5988395f640ed0f3f0 871B
162b1c1130572b10194292e20995da62940a38 234B
163d569c1f5a80295cd68eca5aa5860f57fa65 127B
175a99829f6a4c8491f27967c0b0e471922d56 194B
186b913a5fc6190f4294cd48389c8c35939df2 702B
18f237072b9b2d859c5ca8973281b55f4fb494 252B
1967093ff4135f1f743fc84e0a707355f18a29 198B
1c5665615a0fc5404332f1563ad5efe2b75ce5 229B
1cd2e096fb761d91b9bcdb378dd29410ef439e 3KB
1cdbae2bb7990403d2966cb1cca5b2fc907339 3KB
1d130e956ba389aafc947c96ce676ed5e368f5 215B
1e8715d5a54c4753bc71bdead27e06a257e292 62B
1f2940d8ab2ab2da7ffacd6f44590af8536674 538B
200ef6b9996b091e7e90fc867e6cff1bf1d920 197B
204a45c1f33ce0d65723530bc6e1ad3d54ffdc 197B
212e8e27cd9e01437d28917cc95be7fff85d4d 362B
213a6996759dda2b40cc321acd1d71f59aaa29 216B
218f18da7321fa03d45b0e9b0074ceb0e8da2d 197B
225ec9b8c8a328d23f4762f8c4b25f3bfaeaf8 244B
227fdea43165102d5842403efdbfd3951877cf 123B
23a601ea30e317e78f02072974dc389fc60185 1KB
24a27d6178ba2a925108fec618545440b9259e 91B
24dff38a3cbd46af3748eaa5e9cffc7aa5d8fa 1KB
24ffc610d6f5de6ffa9c992030800249612b9c 94KB
253bbd8b4ec0807b397d62f32ea95f00cae99d 4KB
25872a5fcf3aa1a9b695e1ceff593807f58ea2 112B
25962decf99609e8ab42cf05b4cfa7b8137888 308B
2672addf98ce8bccd7a104699251b302f50e0c 170B
26746082c6d491928aab95f7b6dd12488f923a 197B
2746bdcda721c4826ee32084e9a3257ed64899 221B
27d9526cef39704670848c0531524770d85499 228B
27ded1d72a61ab9daa4b2af0e0292ff6024f53 222B
283da5bce4011f59bbe7f5509d9e1dd802ea82 175B
283ddfc845d6ea95c6032ab893e0599b857781 196B
288964cdba815051a9033648020b8a6f72657b 197B
2930cc703c17a33786e50181e3271bb4e5f5a6 498B
29bf21fe885c3081eb07094ec1c77a1e5666f3 202B
29d503d74dd8d8cba5273f68e1cf948b88ffc0 684B
29edae1a698aadbd17c166f678aa1e24efc68b 198B
2a5a3e634432deeda44d09d395876ab0c6737e 427B
2a88969284f441b3b3b95f3d2d0e6aea8aab52 949B
2ab425de128c2946d9326f294ad40390b9390a 220B
2ae1d39bc4e41e6540e987be5646dd88e0bf54 221B
2ae420feed40b7f5e8475912d4b84f3e6a82c6 207B
2b0ba726efb6a632fe8f15df38b00932cdf712 77B
2c4ad0234c99b9adcb294ab80474faca4a2649 110B
2c97092d33e97f1005fd766de598d06d1d8d55 879B
2d5448040626de56f72346f072df7c61a13099 58B
2de9b7246de109f68283d4eb821b11acb21d8a 316B
2dee746fbca8149d958d07e786a7e4abefdf06 5KB
2df43c5e4a2b69d305af17441cf1857e31966b 197B
2e0c660bab07a61b38cc536a5f80133f6b8a36 91B
共 873 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
wang_san_sui_
- 粉丝: 644
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 冷拉墙板制袋机(含工程图)sw20可编辑全套技术资料100%好用.zip
- 基于小程序的农业电商服务系统源码(小程序毕业设计完整源码+LW).zip
- 可调角度切割机sw18可编辑全套技术资料100%好用.zip
- 基于小程序的农产品自主供销小程序源码(小程序毕业设计完整源码+LW).zip
- 仓储系统web端 vue
- 基于JavaScript的签到管理系统设计源码
- 基于小程序的医笙小程序设计与前端开发源码(小程序毕业设计完整源码).zip
- 仓储系统APP端,uniapp
- 螺旋输送机sw17全套技术资料100%好用.zip
- 基于小程序的医院核酸检测预约挂号源码(小程序毕业设计完整源码+LW).zip
- 密封圈安装机sw18可编辑全套技术资料100%好用.zip
- 基于小程序的医院预约挂号系统小程序源码(小程序毕业设计完整源码+LW).zip
- 基于小程序的同城交易小程序源码(小程序毕业设计完整源码).zip
- 基于小程序的在线办公小程序源码(小程序毕业设计完整源码+LW).zip
- 面板自动上料热熔机(含DFM,BOM)sw17可编辑全套技术资料100%好用.zip
- 奶瓶灌装线step全套技术资料100%好用.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功