Administrator
2023-03-10 8676413693275fa7c8ba77263fb413198d3e56e7
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.service.impl;
A 2
3
4 import java.util.List;
5 import java.util.Map;
6
7 import javax.annotation.Resource;
8
9 import org.apache.commons.lang3.StringUtils;
10 import org.springframework.stereotype.Service;
11 import org.springframework.transaction.annotation.Transactional;
12
13 import com.google.gson.JsonObject;
14 import com.google.gson.JsonParser;
15 import com.mandi.common.JSONobj;
16 import com.mandi.common.Jacksonmethod;
17 import com.mandi.common.Wxhtmethod;
18 import com.mandi.common.ParamFileter.Fileoperation;
19 import com.mandi.dao.common.ObjectResult;
20 import com.mandi.fendan.mapper.Fd_BsheetMapper;
21 import com.mandi.fendan.mapper.Fd_ComVehicleMapper;
22 import com.mandi.fendan.mapper.Fd_VehicleMapper;
23 import com.mandi.fendan.mapper.Fd_XSTDMXMapper;
24 import com.mandi.fendan.mapper.Fd_XSTDMapper;
25 import com.mandi.fendan.mapper.VehicleXSTDMapper;
26 import com.mandi.fendan.persist.Fd_Bsheet;
27 import com.mandi.fendan.persist.Fd_Vehicle;
28 import com.mandi.fendan.persist.Fd_XSTD;
29 import com.mandi.fendan.persist.Fd_XSTDMX;
30 import com.mandi.fendan.persist.VehicleStatus;
31 import com.mandi.fendan.persist.VehicleType;
32 import com.mandi.fendan.util.Contants;
33 import com.mandi.fendan.util.FdtoNc;
34 import com.mandi.system.persist.Login;
35
36 /**
37  * 业务事务处理类
38  *
39  */
40 @Service
41 public class BsTransService {
42     @Resource
43     private FdtoNc fdtonc;
44     @Resource
45     private Fd_BsheetMapper fdbper;
46     @Resource
47     private Fd_VehicleMapper fdvper;
48     @Resource
49     private Fd_ComVehicleMapper fdcvper;
50     @Resource
51     private Fd_XSTDMapper tdper;
52     @Resource
53     private Fd_XSTDMXMapper tdmxper;
54     @Resource
55     private VehicleXSTDMapper vxper;
56     
57     
58     //业务单取消事务
59     @Transactional(rollbackFor = Exception.class)
60     public ObjectResult<Boolean> cancelBs(Fd_Bsheet fdb,Login lg,boolean delBs,List<Fd_XSTD> xstdlist,Fd_Vehicle fdv,Map<String, List<Fd_XSTDMX>> mxMap
61             )throws Exception{
62         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
63         // 发送NC系统删除分单信息  这一块建议用线程执行
64         String bsNo=fdb.getBsNo();
65         String vehicleId=fdb.getVehicleId();
66         String sdepartNo=fdb.getSdepartNo();
67         if (xstdlist != null && xstdlist.size() > 0) {
68             
69         }
70         
71         if (delBs) {
72             if (fdv.getType() == VehicleType.临时车) {
73                 this.fdvper.delByVehicleId(vehicleId);
74             } else {
75                 fdv.setStatus(VehicleStatus.未配车);
76                 this.fdvper.update(fdv);
77             }
78             this.fdbper.delbybsNo(bsNo);
79             
80             // 发送一卡通服务删除表头信息
81             JsonObject jo = new JsonObject();
82             jo.addProperty("bussinessNo", bsNo);
83             jo.addProperty("sdepartNo", sdepartNo);
84             JsonObject pfob = Wxhtmethod.postJsonStr(Contants.YKTdelYwd_url, jo.toString());
85             int code = JSONobj.getint(pfob, "code");
86             if (code != 0) {
87                 throw new Exception(JSONobj.getstring(pfob, "errmsg"));
88             }
89             
90         }
91         this.fdcvper.del(vehicleId, lg.getDepartno(), sdepartNo);
92         if (xstdlist != null && xstdlist.size() > 0) {
93             for (Fd_XSTD fd_XSTD : xstdlist) {
94                 this.tdmxper.cancelFDBatch(fd_XSTD.getTd_tdls(), bsNo);
95                 this.vxper.delbyIDs(vehicleId, fd_XSTD.getTd_tdbh(),lg.getSdepartNo());
96                 this.tdper.updateFD(fd_XSTD);
97             }
98         }
99         orr.setCode(0);
100         orr.setItem(true);
101         return orr;
102     }
103
104 }