|
|
@ -33,6 +33,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.base.common.utils.Rule; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapply.*; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.AppCarListVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.BusDeliveredApplyDetails; |
|
|
@ -267,7 +268,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
* @param dto 数据传输对象 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean submit(BusDeliveredApplyDto dto) { |
|
|
|
/* public ResultBean submit(BusDeliveredApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
ResultBean resultBean = saveOrUpdateDto(dto); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
@ -278,7 +279,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.success().setMsg("提交成功"); |
|
|
|
} |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 出库申请列表的提交 |
|
|
@ -286,7 +287,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
* @param sid 出库申请sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean submitBySid(String sid) { |
|
|
|
/* public ResultBean submitBySid(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(sid); |
|
|
|
if (busDeliveredApply == null) { |
|
|
@ -295,7 +296,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
//状态:1待提交,2待审核,3已通过,4未通过
|
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
return rb.success().setMsg("提交成功"); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 出库申请管理列表的撤回 |
|
|
@ -303,7 +304,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
* @param sid 出库申请sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean revokeBySid(String sid) { |
|
|
|
/* public ResultBean revokeBySid(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(sid); |
|
|
|
if (busDeliveredApply == null) { |
|
|
@ -315,7 +316,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(1, sid); |
|
|
|
return rb.success().setMsg("撤回成功"); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除 |
|
|
@ -789,6 +790,18 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
busDeliveredApply.setStaffDeptSid(deptSid); |
|
|
|
busDeliveredApply.setStaffUserSid(userSid); |
|
|
|
busDeliveredApply.setStaffName(userVoResultBean.getData().getName()); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(sysStaffOrgFeign.getOrgSidByPath(orgPath).getData()).getData(); |
|
|
|
//出库申请单号
|
|
|
|
String billNo = ""; |
|
|
|
String date = DateUtil.format(DateUtil.date(), "yyyyMM"); |
|
|
|
billNo = "XSCKD" + sysOrganizationVo.getOrgCode() + date; |
|
|
|
String v = baseMapper.selectNum(billNo); |
|
|
|
if (StringUtils.isNotBlank(v)) { |
|
|
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(v).intValue()); |
|
|
|
} else { |
|
|
|
billNo = Rule.getBillNo(billNo, 0); |
|
|
|
} |
|
|
|
busDeliveredApply.setBillNo(billNo); |
|
|
|
//根据合同编号查询销售订单的信息
|
|
|
|
ResultBean<AppOrderDetailsVo> resultBean = busSalesOrderService.getSaleOrderDetailsByContractNo(contractNo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
@ -877,6 +890,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
busDeliveredApplyDetailsService.insert(busDeliveredApplyDetails); |
|
|
|
} |
|
|
|
baseMapper.insert(busDeliveredApply); |
|
|
|
sid = busDeliveredApply.getSid(); |
|
|
|
|
|
|
|
} else { |
|
|
|
//根据出库申请sid查询出库申请是否存在
|
|
|
@ -884,7 +898,14 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (busDeliveredApply == null) { |
|
|
|
return rb.setMsg("该出库申请不存在"); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(dto.getStaffDeptSid())){ |
|
|
|
dto.setStaffDeptSid(busDeliveredApply.getStaffDeptSid()); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(dto.getStaffUserSid())){ |
|
|
|
dto.setStaffUserSid(busDeliveredApply.getStaffUserSid()); |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(dto, busDeliveredApply, "sid"); |
|
|
|
|
|
|
|
//根据合同编号查询销售订单的信息
|
|
|
|
ResultBean<AppOrderDetailsVo> resultBean = busSalesOrderService.getSaleOrderDetailsByContractNo(contractNo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
@ -1023,7 +1044,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
updateById(busDeliveredApply); |
|
|
|
return rb.success().setData(busDeliveredApply.getSid()); |
|
|
|
}*/ |
|
|
|
return rb.success(); |
|
|
|
return rb.success().setData(sid); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<AppDeliveredApplyInfoVo> getRetrievalApplyInfoBySid(String sid) { |
|
|
@ -1050,7 +1071,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
|
List<AppCarListVo> voList = busDeliveredApplyDetailsService.appDetailsList(sid); |
|
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
|
/* BusDeliveredUseMessage busDeliveredUseMessage = busDeliveredUseMessageService.fetchBySid(voList.get(i).getUseMessageSid()); |
|
|
|
/* BusDeliveredUseMessage busDeliveredUseMessage = busDeliveredUseMessageService.fetchBySid(voList.get(i).getUseMessageSid()); |
|
|
|
AppUseInfoVo appUseInfoVo = new AppUseInfoVo(); |
|
|
|
appUseInfoVo.setMobile(busDeliveredUseMessage.getMobile()); |
|
|
|
appUseInfoVo.setCustomer(busDeliveredUseMessage.getName()); |
|
|
@ -1067,20 +1088,49 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean submitAppDeliveredApply(AppSubmitDeliveredApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//根据用户sid获取staffSid
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
|
//判断选择的优惠是否超出
|
|
|
|
List<AppCarListVo> carList = dto.getCarList(); |
|
|
|
if (!carList.isEmpty()) { |
|
|
|
//判断已经选择的车辆是否已经提交
|
|
|
|
List<String> vinSid = carList.stream().map(AppCarListVo::getVinSid).collect(Collectors.toList()); |
|
|
|
List<String> vinNoList = baseMapper.selectVinNo(dto.getContractId(), vinSid); |
|
|
|
if (!vinNoList.isEmpty()) { |
|
|
|
return rb.setMsg(String.join(",", vinNoList) + "已提交或已出库"); |
|
|
|
} |
|
|
|
//判断是否存在优惠包超出的情况
|
|
|
|
for (int i = 0; i < carList.size(); i++) { |
|
|
|
AppCarListVo appCarListVo = carList.get(i); |
|
|
|
List<BusDeliveredDetailsDiscountsVo> discountUse = appCarListVo.getDiscountUse(); |
|
|
|
for (int j = 0; j < discountUse.size(); j++) { |
|
|
|
BusDeliveredDetailsDiscountsVo busDeliveredDetailsDiscountsVo = discountUse.get(j); |
|
|
|
//根据discountSid查询已通过或已提交的申请的赠送套餐的数量
|
|
|
|
int count = busDeliveredDetailsDiscountService.selectGiveNumBySid(busDeliveredDetailsDiscountsVo.getDiscountSid()); |
|
|
|
int giveNum = count + busDeliveredDetailsDiscountsVo.getDiscountNum(); |
|
|
|
if (busDeliveredDetailsDiscountsVo.getTotalNum() < giveNum) { |
|
|
|
return rb.setMsg("车辆赠送的优惠包已超出"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|
|
|
if (!staffOrgResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(staffOrgResultBean.getMsg()); |
|
|
|
String orgSidPath = ""; |
|
|
|
if (StringUtils.isNotBlank(dto.getOrgPath())) { |
|
|
|
orgSidPath = dto.getOrgPath(); |
|
|
|
} else { |
|
|
|
//根据用户sid获取staffSid
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
|
} |
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|
|
|
if (!staffOrgResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(staffOrgResultBean.getMsg()); |
|
|
|
} |
|
|
|
orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|
|
|
} |
|
|
|
//用户的组织全路径
|
|
|
|
String orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(dto.getSid()); |
|
|
|
int r = submitAppBusinessData(dto, busDeliveredApply); |
|
|
|
if (r == 3) { |
|
|
@ -1095,12 +1145,11 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
String sid = resultBean.getData(); |
|
|
|
//更改状态
|
|
|
|
List<String> stringList = busDeliveredApplyDetailsService.selectVinByApplySid(sid); |
|
|
|
for (int i = 0; i < stringList.size(); i++) { |
|
|
|
String vinNo = stringList.get(i); |
|
|
|
busDeliveredService.updateState(vinNo, 0); |
|
|
|
} |
|
|
|
//将该申请的车架号的待出库中的状态修改为出库中
|
|
|
|
List<String> vinSidList = busDeliveredApplyDetailsService.selectVinSidByApplySid(sid); |
|
|
|
//更新该合同的该车架号的状态为0
|
|
|
|
busDeliveredService.updateStateByContractNo(busDeliveredApply.getContractNo(), vinSidList, 0); |
|
|
|
//更新出库申请的状态为待审核2
|
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
@ -1146,7 +1195,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
bv.setTaskId(busDeliveredApply.getTaskId()); |
|
|
|
bv.setTaskDefKey(busDeliveredApply.getTaskDefKey()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|