package com.mandi.fendan.service.impl;
|
|
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.annotation.Resource;
|
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import com.google.gson.JsonObject;
|
import com.google.gson.JsonParser;
|
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.mapper.Fd_BsheetMapper;
|
import com.mandi.fendan.mapper.Fd_ComVehicleMapper;
|
import com.mandi.fendan.mapper.Fd_VehicleMapper;
|
import com.mandi.fendan.mapper.Fd_XSTDMXMapper;
|
import com.mandi.fendan.mapper.Fd_XSTDMapper;
|
import com.mandi.fendan.mapper.VehicleXSTDMapper;
|
import com.mandi.fendan.persist.Fd_Bsheet;
|
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.VehicleStatus;
|
import com.mandi.fendan.persist.VehicleType;
|
import com.mandi.fendan.util.Contants;
|
import com.mandi.fendan.util.FdtoNc;
|
import com.mandi.system.persist.Login;
|
|
/**
|
* 业务事务处理类
|
*
|
*/
|
@Service
|
public class BsTransService {
|
@Resource
|
private FdtoNc fdtonc;
|
@Resource
|
private Fd_BsheetMapper fdbper;
|
@Resource
|
private Fd_VehicleMapper fdvper;
|
@Resource
|
private Fd_ComVehicleMapper fdcvper;
|
@Resource
|
private Fd_XSTDMapper tdper;
|
@Resource
|
private Fd_XSTDMXMapper tdmxper;
|
@Resource
|
private VehicleXSTDMapper vxper;
|
|
|
//业务单取消事务
|
@Transactional(rollbackFor = Exception.class)
|
public ObjectResult<Boolean> cancelBs(Fd_Bsheet fdb,Login lg,boolean delBs,List<Fd_XSTD> xstdlist,Fd_Vehicle fdv,Map<String, List<Fd_XSTDMX>> mxMap
|
)throws Exception{
|
ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
|
// 发送NC系统删除分单信息 这一块建议用线程执行
|
String bsNo=fdb.getBsNo();
|
String vehicleId=fdb.getVehicleId();
|
String sdepartNo=fdb.getSdepartNo();
|
if (xstdlist != null && xstdlist.size() > 0) {
|
|
}
|
|
if (delBs) {
|
if (fdv.getType() == VehicleType.临时车) {
|
this.fdvper.delByVehicleId(vehicleId);
|
} else {
|
fdv.setStatus(VehicleStatus.未配车);
|
this.fdvper.update(fdv);
|
}
|
this.fdbper.delbybsNo(bsNo);
|
|
// 发送一卡通服务删除表头信息
|
JsonObject jo = new JsonObject();
|
jo.addProperty("bussinessNo", bsNo);
|
jo.addProperty("sdepartNo", sdepartNo);
|
JsonObject pfob = Wxhtmethod.postJsonStr(Contants.YKTdelYwd_url, jo.toString());
|
int code = JSONobj.getint(pfob, "code");
|
if (code != 0) {
|
throw new Exception(JSONobj.getstring(pfob, "errmsg"));
|
}
|
|
}
|
this.fdcvper.del(vehicleId, lg.getDepartno(), sdepartNo);
|
if (xstdlist != null && xstdlist.size() > 0) {
|
for (Fd_XSTD fd_XSTD : xstdlist) {
|
this.tdmxper.cancelFDBatch(fd_XSTD.getTd_tdls(), bsNo);
|
this.vxper.delbyIDs(vehicleId, fd_XSTD.getTd_tdbh(),lg.getSdepartNo());
|
this.tdper.updateFD(fd_XSTD);
|
}
|
}
|
orr.setCode(0);
|
orr.setItem(true);
|
return orr;
|
}
|
|
}
|