Administrator
2023-03-10 1c4e40639d73faae3ba87156e0e4478c50b8ee33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
package com.mandi.fendan.service.impl;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
 
import javax.annotation.Resource;
 
import com.mandi.basicconfig.mapper.NczsjMapper;
import com.mandi.basicconfig.persist.Nckh;
import com.mandi.fendan.mapper.*;
import com.mandi.fendan.util.ConvertTool;
import com.mandi.servlet.file.impl.FileLoadImpl;
import com.mandi.springmvc.logs.OpLogs;
import com.mandi.system.persist.ModuleEnum;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.poi.ss.usermodel.charts.ScatterChartSeries;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mandi.basicconfig.penum.PrefixEnum;
import com.mandi.common.BigDecimalfiter;
import com.mandi.common.JSONobj;
import com.mandi.common.Jacksonmethod;
import com.mandi.common.Wxhtmethod;
import com.mandi.common.ParamFileter.Fileoperation;
import com.mandi.dao.common.ObjectResult;
import com.mandi.fendan.persist.Fd_Bsheet;
import com.mandi.fendan.persist.Fd_Company;
import com.mandi.fendan.persist.Fd_Company_Vehicle;
import com.mandi.fendan.persist.Fd_Vehicle;
import com.mandi.fendan.persist.Fd_XSTD;
import com.mandi.fendan.persist.Fd_XSTDMX;
import com.mandi.fendan.persist.Fd_wlgs_fhdq;
import com.mandi.fendan.persist.VehicleStatus;
import com.mandi.fendan.persist.VehicleType;
import com.mandi.fendan.persist.Vehicle_XSTD;
import com.mandi.fendan.service.Ifd_bsheetService;
import com.mandi.fendan.util.Contants;
import com.mandi.fendan.util.FdtoNc;
import com.mandi.fendan.util.persist.Serviceenum;
import com.mandi.fendan.util.persist.WaitXSTD;
import com.mandi.fendan.util.persist.YktBsheet;
import com.mandi.system.persist.Login;
import com.mandi.system.persist.UserType;
 
import static com.mandi.fendan.util.Contants.*;
 
@Service
public class Fd_BsheetService implements Ifd_bsheetService {
    private Logger log= Logger.getLogger(Fd_BsheetService.class);
 
    @Resource
    private Fd_BsheetMapper bsper;
    @Resource
    private Fd_VehicleMapper fdvper;
    @Resource
    private Fd_BsheetitemMapper bsiper;
    @Resource
    private VehicleXSTDMapper vhxper;
    @Resource
    private Fd_CompanyMapper fdcper;
    @Resource
    private Fd_ComVehicleMapper cvper;
    @Resource
    private Fd_XSTDMXMapper mxper;
    @Resource
    private Fd_XSTDMapper tdper;
    @Resource
    private Fd_fhdqMapper dqper;
    @Resource
    private FdtoNc fdtonc;
    @Resource
    private Fd_YKTMapper yktmper;
    @Resource
    private FdMxWlgsMapper fdMxWlgsMapper;
 
    @Resource
    private NczsjMapper zsjper;
 
    @Override
    @Transactional(rollbackFor=Exception.class)
    public ObjectResult<Map<String, Object>> saveFd_Bsheet(String vehicleInfo,String xstdNo, String bsitemlistStr, Login lg) throws Exception {
        ObjectResult<Map<String, Object>> orr=new ObjectResult<Map<String,Object>>();
        if(StringUtils.isEmpty(bsitemlistStr)){
            orr.setCode(1);
            orr.setErrmsg("业务参数为空,不能保存!");
            return orr;
        }
        if(lg==null){
            orr.setCode(1);
            orr.setErrmsg("请登录账号!");
            return orr;
        }
        if(StringUtils.isBlank(xstdNo)){
            orr.setCode(1);
            orr.setErrmsg("提单编号为空!");
            return orr;
        }
        if(UserType.admin.toString().equals(lg.getWorkerno())){
            orr.setCode(1);
            orr.setErrmsg("管理员账号没有分单权限!");
            return orr;
        }
        Fd_Company fdc=fdcper.getByCompanyNo(lg.getDepartno());
        if(fdc==null){
            orr.setCode(1);
            orr.setErrmsg("账号没有配置物流公司,请联系管理员进行配置!");
            return orr;
        }
 
        Fd_XSTD xstd=this.tdper.getbyttdbh(xstdNo);
        if(xstd==null){
            orr.setCode(1);
            orr.setErrmsg("提单编号:"+xstdNo+" 不正确,未查询到该提单!");
            return orr;
        }
        if(xstd.isTd_zcwcbz()){
            orr.setCode(1);
            orr.setErrmsg("该提单已经完成装车,不能分单!");
            return orr;
        }
        if(xstd.getTd_wfdsl()<=0){
            orr.setCode(1);
            orr.setErrmsg("该提单已经分单完成,不能分单!");
            return orr;
        }
        //送货
        if(xstd.getTd_ztbz()==2){
            if(fdc!=null){
                if(!fdc.isHasSPR()){
                    orr.setCode(1);
                    orr.setErrmsg("该账号没有自提权限!");
                    return orr;
                }
            }
        }else{
            Fd_wlgs_fhdq wldq = this.dqper.getbyNos(lg.getDepartno(),xstd.getTd_shddbh(), ConvertTool.ncGetDefault(xstd.getTd_ywdybh()));
            int total = fdMxWlgsMapper.selectCountByTdTdls(xstd.getTd_tdls());
            if(wldq==null && total == 0){
                orr.setCode(1);
                orr.setErrmsg("该账号没有配置该地区的分单权限!");
                return orr;
            }
        }
        String Rcompany="";
        Map<String, Object> mm=this.dqper.getKH(xstd.getTd_khbh());
        if(StringUtils.isBlank(xstd.getTd_fpbh())){
            if(mm!=null)
                Rcompany=mm.get("name")==null?"":mm.get("name").toString();
            // 判断是否存在客户
            if(mm == null || mm.size() == 0) { // 客户必须存在,否则无法分单
                orr.setCode(1);
                orr.setErrmsg("该提单客户不存在,请检查数据!");
                return orr;
            }
        }else{
            Rcompany = ConvertTool.covertToCustoms(xstd.getTd_ywdybh());
        }
 
        List<Fd_XSTD> tdl= new ArrayList<Fd_XSTD>();
        Map<String, List<Fd_XSTDMX>> mxMp=new HashMap<String, List<Fd_XSTDMX>>();
        List<Fd_XSTDMX> mxl=new ArrayList<Fd_XSTDMX>();
        //是否保存一卡通业务单表头信息
        boolean saveBT=false;
        String bsDE = ConvertTool.ncCovertToYkt(xstd.getTd_cqNo());
        String bbsNo="";
        String ziti="";//是否自提
        // 系统部门未找到
        if (StringUtils.isBlank(bsDE)) {
            orr.setCode(1);
            orr.setErrmsg("提单未找到系统部门字段,请重新操作!");
            return orr;
        }
        try {
            JsonParser jp=new JsonParser();
            JsonObject vjo=jp.parse(vehicleInfo).getAsJsonObject();
            Fd_Vehicle fdv=new Fd_Vehicle();
            fdv=JSONobj.getobj(vjo, fdv);
            String driver=JSONobj.getstring(vjo, "driver");
            String phone=JSONobj.getstring(vjo, "phone");
            String vehicleId=JSONobj.getstring(vjo, "vehicleId").toUpperCase();
//            String IDNum=JSONobj.getstring(vjo, "IDNum");
            fdv.setVehicleId(vehicleId);
            if(StringUtils.isEmpty(fdv.getVehicleId())||StringUtils.isEmpty(fdv.getDriver())||StringUtils.isEmpty(fdv.getIDNum())||StringUtils.isEmpty(fdv.getPhone())){
                orr.setCode(1);
                orr.setErrmsg("车辆必填项不能为空!");
                return orr;
            }
            Fd_Vehicle fdv1=this.fdvper.getByVehicleId(fdv.getVehicleId());
            if(fdv1==null){
                fdv.setCompanyNo(lg.getDepartno());
                fdv.setId(UUID.randomUUID()+"");
                fdv.setNote("");
                fdv.setState(true);
                fdv.setStatus(VehicleStatus.已配车);
                fdv.setType(VehicleType.临时车);
                fdvper.insert(fdv);
            }else{
                if(fdv1.getType()==VehicleType.临时车){
                    fdv.setDriver(fdv.getDriver());
                    fdv.setPhone(fdv.getPhone());
                    fdv.setIDNum(fdv.getIDNum());
                    fdvper.update(fdv1);
                }
            }
 
//            xstd.getTd_ywdybh().equals(Contants.zzywdyNo)?Contants.zzSdepartNo:Contants.kjSdepartNo
            Fd_Bsheet fb=this.bsper.getbyVehicleId(fdv.getVehicleId(), Serviceenum.在办,bsDE);
            if(fb==null){
                JsonObject pfob=Wxhtmethod.postJsonStr(Contants.YKTgetPrefix_url,PrefixEnum.productsale.toString());
                ObjectResult<String> pfor=new ObjectResult<String>();
                String bsNo=JSONobj.getstring(pfob, "item");
                int code=JSONobj.getint(pfob, "code");
                String errmsg=JSONobj.getstring(pfob, "errmsg");
                pfor.setCode(code);
                pfor.setErrmsg(errmsg);
                pfor.setItem(bsNo);
                if(pfor==null||pfor.getCode()!=0){
                    throw new Exception(pfor.getErrmsg());
                }
                fb=new Fd_Bsheet();
                fb.setBsNo(pfor.getItem());
                fb.setCompanyName(lg.getDepartname());
                fb.setCompanyNo(lg.getDepartno());
                fb.setCreateid(lg.getUserid());
                fb.setCreateName(lg.getWorkername());
                fb.setCtime(new Date());
                fb.setDriver(driver);
                fb.setFdsheetNo(pfor.getItem());
                fb.setId(UUID.randomUUID()+"");
                fb.setPhone(phone);
                fb.setSendmsg(false);
                fb.setStatus(Serviceenum.在办);
                fb.setVehicleId(fdv.getVehicleId());
                fb.setSdepartNo(bsDE);
                fb.setUpdateTime(new Date());
                this.bsper.insert(fb);
                saveBT=true;
            }else{
                fb.setDriver(driver);
                fb.setPhone(phone);
                fb.setUpdateTime(new Date());
                this.bsper.update(fb);
            }
            Fd_Company_Vehicle fdcv=cvper.getbyIDs(fdv.getVehicleId(), lg.getDepartno(),bsDE);
            if(fdcv==null){
                fdcv=new Fd_Company_Vehicle();
                fdcv.setCompanyNo(lg.getDepartno());
                fdcv.setVehicleId(fdv.getVehicleId());
                fdcv.setSdepartNo(bsDE);
                cvper.insertIDs(fdcv);
            }
//            if(StringUtils.isBlank(fb.getSdepartNo())){
//                if(xstd.getTd_ywdybh().equals(Contants.zzywdyNo)){
//                    this.bsper.updatesdepartNo(fb.getId(), Contants.zzSdepartNo);
//                    fb.setSdepartNo(Contants.zzSdepartNo);
//                    Fd_Company_Vehicle fdcv=cvper.getbyIDs(fdv.getVehicleId(), lg.getDepartno(),Contants.zzSdepartNo);
//                    if(fdcv==null){
//                        fdcv=new Fd_Company_Vehicle();
//                        fdcv.setCompanyNo(lg.getDepartno());
//                        fdcv.setVehicleId(fdv.getVehicleId());
//                        fdcv.setSdepartNo(Contants.zzSdepartNo);
//                        cvper.insertIDs(fdcv);
//                    }
//                }else{
//                    this.bsper.updatesdepartNo(fb.getId(), Contants.kjSdepartNo);
//                    fb.setSdepartNo(Contants.kjSdepartNo);
//                    Fd_Company_Vehicle fdcv=cvper.getbyIDs(fdv.getVehicleId(), lg.getDepartno(),Contants.kjSdepartNo);
//                    if(fdcv==null){
//                        fdcv=new Fd_Company_Vehicle();
//                        fdcv.setCompanyNo(lg.getDepartno());
//                        fdcv.setVehicleId(fdv.getVehicleId());
//                        fdcv.setSdepartNo(Contants.kjSdepartNo);
//                        cvper.insertIDs(fdcv);
//                    }
//                }
//            }
            if(StringUtils.isBlank(ziti)){
                ziti=xstd.getTd_ztbz()==2?"自提":"非自提";
            }
//            if(StringUtils.isBlank(fb.getSdepartNo())){
//                throw new Exception("生成的分单业务单:"+fb.getFdsheetNo()+"厂区未找到!");
//            }
            //郑州
//            if(fb.getSdepartNo().equals(Contants.zzSdepartNo)){
//                if(!xstd.getTd_ywdybh().equals(Contants.zzywdyNo)){
////                    throw new Exception("车辆生成的是郑州厂区一卡通业务单,科技提单:"+xstd.getTd_tdbh()+"不能配车!");
//                    if(saveBT){
//                        throw new Exception("科技厂区提单和郑州厂区提单不能同时使用同一辆车!");
//                    }else{
//                        throw new Exception(fb.getVehicleId()+" 有郑州厂区一卡通销售业务单,科技提单:"+xstd.getTd_tdbh()+"不能使用该车!");
//                    }
//                }
//            }else{
//                if(xstd.getTd_ywdybh().equals(Contants.zzywdyNo)){
////                    throw new Exception("车辆生成的是科技厂区一卡通业务单,郑州提单:"+xstd.getTd_tdbh()+"不能配车!");
//                    if(saveBT){
//                        throw new Exception("科技厂区提单和郑州厂区提单不能同时使用同一辆车!");
//                    }else{
//                        throw new Exception(fb.getVehicleId()+" 有科技厂区一卡通销售业务单,郑州提单:"+xstd.getTd_tdbh()+"不能使用该车!");
//                    }
//                }
//            }
 
            JsonArray ja=jp.parse(bsitemlistStr).getAsJsonArray();
            //分单数量和毛重
            int fdsl=0;
            double fdmz=0;
            for (JsonElement je: ja) {
                JsonObject itemJo=je.getAsJsonObject();
                //主键
                String tdmx_tdfl=JSONobj.getstring(itemJo, "tdfl");
                Fd_XSTDMX tdmx=this.mxper.get(tdmx_tdfl);
                //未找到的过滤掉  已分单的过滤掉  已装车的不处理
                if(tdmx==null||tdmx.getTdmx_fdbz()!=0||tdmx.getTdmx_zcbz()!=0){
                    continue;
                }
                //关闭标志不为0不做处理
                if(tdmx.getTdmx_gbbz()!=0){
                    continue;
                }
                fdsl++;
                fdmz=BigDecimalfiter.addscal(fdmz, tdmx.getTdmx_mz(), Contants.scale);
 
                tdmx.setTdmx_fdbz(1);
                tdmx.setTdmx_fdcph(fdv.getVehicleId());
                tdmx.setTdmx_fdywbh(fb.getBsNo());
                tdmx.setTdmx_fdwlgsbh(lg.getDepartno());
                this.mxper.updateFD(tdmx);
                mxl.add(tdmx);
 
            }
            Vehicle_XSTD vhxstd=this.vhxper.getbyIDs(fdv.getVehicleId(), xstdNo,lg.getDepartno());
            if(vhxstd==null){
                vhxstd=new Vehicle_XSTD();
                vhxstd.setBsNo(fb.getBsNo());
                vhxstd.setCompanyNo(lg.getDepartno());
                vhxstd.setFd_num(fdsl);
                vhxstd.setFd_weight(fdmz);
                vhxstd.setVehicleId(fdv.getVehicleId());
                vhxstd.setXstdNo(xstdNo);
                this.vhxper.insert(vhxstd);
            }else{
                vhxstd.setBsNo(fb.getBsNo());
                vhxstd.setCompanyNo(lg.getDepartno());
                vhxstd.setFd_num(vhxstd.getFd_num()+fdsl);
                vhxstd.setFd_weight(BigDecimalfiter.add(vhxstd.getFd_weight(),fdmz));
                vhxstd.setVehicleId(fdv.getVehicleId());
                vhxstd.setXstdNo(xstdNo);
                this.vhxper.updatewithIDs(vhxstd);
            }
            xstd.setTd_wfdsl(xstd.getTd_wfdsl()-fdsl);
            xstd.setTd_wfdzl(BigDecimalfiter.subscal(xstd.getTd_wfdzl(), fdmz, Contants.scale));
            this.tdper.updateFD(xstd);
            if(saveBT){
                YktBsheet bs=new YktBsheet();
//                if(iskj==1){
//                    bs.setSdepartNo(Contants.kjSdepartNo);
//                    bs.setDcompany("明泰科技");
//                }else{
//                    bs.setSdepartNo(Contants.zzSdepartNo);
//                    bs.setDcompany("郑州眀泰");
//                }
                bs.setSdepartNo(fb.getSdepartNo());
                /*bs.setDcompany(fb.getSdepartNo().equals(Contants.kjSdepartNo)?"明泰科技":
                    fb.getSdepartNo().equals(Contants.msSdepartNo)?"河南明晟新材料":
                    "郑州眀泰"
                    );*/
                bs.setDcompany(ConvertTool.covertToFactoryName(fb.getSdepartNo()));
                bs.setDriver(fdv.getDriver());
                bs.setNumberplates(StringUtils.upperCase(fdv.getVehicleId()));
                bs.setPhone(fdv.getPhone());
                bs.setRcompany(Rcompany);
                bs.setBussinessNo(fb.getBsNo());
                bs.setNote(ziti+";"+lg.getDepartname()+":"+lg.getWorkername()+"; 分单系统自动生成");
                String bsStr=Jacksonmethod.tojson(bs, false);
                bsDE=bs.getSdepartNo();
                bbsNo=bs.getBussinessNo();
                JsonObject joADDYWD=Wxhtmethod.postJsonStr(Contants.YKTaddYwd_url,bsStr);
                ObjectResult<String> ors=new ObjectResult<String>();
                String bsNo=JSONobj.getstring(joADDYWD, "item");
                int code=JSONobj.getint(joADDYWD, "code");
                String errmsg=JSONobj.getstring(joADDYWD, "errmsg");
                ors.setItem(bsNo);
                ors.setCode(code);
                ors.setErrmsg(errmsg);
                if(ors.getCode()!=0){
                    throw new Exception(ors.getErrmsg());
                }
                this.bsper.updateShdw(fb.getId(), StringUtils.isBlank(Rcompany)?"未知发货单位":Rcompany);
            }else {
                List<WaitXSTD> l=this.bsper.getAllKH(fb.getBsNo(), fb.getId());
                if(l!=null) {
                    boolean iscz=false;//收货单位在明细中是否存在
                    WaitXSTD wt=null;
                    for (WaitXSTD waitXSTD : l) {
                        if(fb.getShdw().equals(waitXSTD.getTd_khmc())) {
                            iscz=true;
                            break;
                        }else {
                            if(wt==null&&StringUtils.isNotBlank(waitXSTD.getTd_khmc())) {
                                wt=waitXSTD;
                            }
                        }
                    }
                    if(!iscz&&wt!=null) {
                        fb.setShdw(wt.getTd_khmc());
                        this.yktmper.updateshcompany(fb.getBsNo(), wt.getTd_khmc(),wt.getTd_shdd());
                    }
                }
 
            }
            tdl.add(xstd);
            mxMp.put(xstdNo, mxl);
            //分单推送NC系统
            if(tdl!=null&&tdl.size()>0){
                String fdhx=this.fdtonc.getNcdata(tdl, mxMp);
                Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "明细配车 请求参数 ::"+fdhx);
                //todo 先注释掉NC部分,接口不通
                JsonObject joADDYWD=Wxhtmethod.postJsonStr(Contants.NCfdhx_url,fdhx);
                Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "明细配车 url返回值 ::"+joADDYWD);
                if(joADDYWD==null||JSONobj.getint(joADDYWD, "code")!=0){
                    throw new Exception(StringUtils.isEmpty(joADDYWD.get("msg").getAsString())?"分单回写NC系统出错!":joADDYWD.get("msg").getAsString());
                }else{
                    String restult=joADDYWD.get("result").getAsString();
                    JsonObject jr=jp.parse(restult).getAsJsonObject();
                    if(jr==null||JSONobj.getint(jr, "respcode")!=111){
                        throw new Exception(jr.get("respmsg").getAsString());
                    }
                }
            }
        }catch(Exception e){
            e.printStackTrace();
            if(saveBT){
                JsonObject jo=new JsonObject();
                jo.addProperty("bussinessNo", bbsNo);
                jo.addProperty("sdepartNo",bsDE);
                Wxhtmethod.postJsonStr(Contants.YKTdelYwd_url,jo.toString());
            }
            throw new Exception(StringUtils.isEmpty(e.getMessage())?"提单明细分单出错!":e.getMessage());
        }
 
        orr.setCode(0);
        orr.setItem(null);
        return orr;
    }
 
    @Override
    @Transactional(rollbackFor=Exception.class)
    public ObjectResult<String> sendMsg(Login lg, String bussinessNo)throws Exception {
        ObjectResult<String> orr=new ObjectResult<String>();
        if(lg==null){
            orr.setCode(1);
            orr.setErrmsg("请登录账号!");
            return orr;
        }
        if(UserType.admin.toString().equals(lg.getWorkerno())){
            orr.setCode(1);
            orr.setErrmsg("管理员账号没有分单权限!");
            return orr;
        }
        if(StringUtils.isEmpty(bussinessNo)){
            orr.setCode(1);
            orr.setErrmsg("业务单参数为空!");
            return orr;
        }
        Fd_Bsheet fdb=bsper.getbybsNo(bussinessNo);
        if(fdb==null){
            orr.setCode(1);
            orr.setErrmsg("业务单未找到!");
            return orr;
        }
        if(fdb.getStatus()!=Serviceenum.在办){
            orr.setCode(1);
            orr.setErrmsg("业务单不是在办状态!");
            return orr;
        }
        JsonObject jos=new JsonObject();
        jos.addProperty("bussinessNo", bussinessNo);
        JsonObject jo=Wxhtmethod.postJsonStr(Contants.YKTsendMsg_url,jos.toString());
        if(jo==null||jo.get("code").getAsInt()!=0){
            throw new Exception(jo.get("errmsg").getAsString());
        }
        fdb.setSendmsg(true);
        fdb.setInvitecode(jo.get("item").getAsString());
        bsper.updateInvitaCode(fdb);
 
        orr.setCode(0);
        return orr;
    }
 
}