|
|
@ -29,8 +29,14 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.VehicleGression; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.*; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModel; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModelDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModelFeign; |
|
|
|
import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApplyDto; |
|
|
|
import com.yxt.anrui.base.common.enums.BillTypeEnum; |
|
|
|
import com.yxt.anrui.base.common.utils.Rule; |
|
|
|
import com.yxt.anrui.base.common.utils.domain.BillNo; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
@ -39,6 +45,9 @@ import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonFeign; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonVo; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganization; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
@ -105,6 +114,12 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
@Autowired |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BaseVehicleModelFeign baseVehicleModelFeign; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
|
|
|
|
private QueryWrapper<ScmVehicleGression> createQueryWrapper(ScmVehicleGressionQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
@ -279,18 +294,23 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
String userSid = dto.getUserSid(); |
|
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(userSid).getData(); |
|
|
|
AppUserOrgInfoVo data = sysUserFeign.getUserOrgInfoByUserSid(userSid).getData(); |
|
|
|
String vehicleSid = baseVehicleFeign.selVehicleByVinNo(dto.getVinNo()).getData().getSid(); |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
ScmVehicleGression scmVehicleGression = null; |
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
|
scmVehicleGression = new ScmVehicleGression(); |
|
|
|
BeanUtil.copyProperties(dto, scmVehicleGression, "sid"); |
|
|
|
scmVehicleGression.setHandleState("1"); |
|
|
|
scmVehicleGression.setVehicleSid(vehicleSid); |
|
|
|
scmVehicleGression.setApplicantName(data.getStaffName()); |
|
|
|
scmVehicleGression.setApplicantDate(simpleDateFormat.format(new Date())); |
|
|
|
scmVehicleGression.setOrgSid(data.getOrgSid()); |
|
|
|
scmVehicleGression.setUseOrgSid(useOrgSid); |
|
|
|
Map<String, String> stringStringMap = generateBillNo(userSid); |
|
|
|
scmVehicleGression.setApplicantNo(stringStringMap.get("billNo_Num")); |
|
|
|
//申请编号规则:单据名称大写首字母+分公司编码+年份+月份+4位顺序号
|
|
|
|
//获取单据名称大写首字母+分公司编码+年份+月份
|
|
|
|
// Map<String, String> stringStringMap = generateBillNo(userSid);
|
|
|
|
String billNo = getApplyCode(dto); |
|
|
|
scmVehicleGression.setApplicantNo(billNo); |
|
|
|
save(scmVehicleGression); |
|
|
|
if ("1".equals(dto.getInsuranceStateKey())) { // 如果保单状态为否 不保存保单照片
|
|
|
|
List<String> factoryImage = dto.getPolicyImage(); |
|
|
@ -456,48 +476,63 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
return rb.success().setMsg("保存成功"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 移位单生成编号 |
|
|
|
* |
|
|
|
* @param userSid 用户sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public Map<String, String> generateBillNo(String userSid) { |
|
|
|
List<DictCommonVo> commonVoList = dictCommonFeign.getTypeValues(DictCommonType.BILLSTYPE, "0").getData(); |
|
|
|
String billsType = ""; |
|
|
|
if (commonVoList.size() > 0) { |
|
|
|
for (int i = 0; i < commonVoList.size(); i++) { |
|
|
|
if (commonVoList.get(i).getDictValue().contains("移位单")) { |
|
|
|
billsType = commonVoList.get(i).getDictKey(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
AppUserOrgInfoVo userOrgInfo = null; |
|
|
|
String orgCode = ""; |
|
|
|
String orgSid = ""; |
|
|
|
String orgName = ""; |
|
|
|
ResultBean<AppUserOrgInfoVo> resultBean = sysUserFeign.getUserOrgInfoByUserSid(userSid); |
|
|
|
if (resultBean.getSuccess() && resultBean.getData() != null) { |
|
|
|
userOrgInfo = resultBean.getData(); |
|
|
|
orgSid = userOrgInfo.getOrgSid(); |
|
|
|
orgName = userOrgInfo.getOrgName(); |
|
|
|
orgCode = userOrgInfo.getOrgCode(); |
|
|
|
} |
|
|
|
String date = DateUtils.dateConvertStr(new Date(), "yyyy-MM-dd"); |
|
|
|
// 流水号
|
|
|
|
int i = selectCountByOrgSid(billsType, date, orgSid); |
|
|
|
String num = String.format("%04d", i + 1); // 不足4位补0
|
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
map.put("billNo_Num", billsType + orgCode + date.replaceAll("-", "") + num); |
|
|
|
map.put("billNo", billsType + orgCode + date.replaceAll("-", "")); |
|
|
|
map.put("staffSid", userOrgInfo.getStaffSid()); |
|
|
|
map.put("staffName", userOrgInfo.getStaffName()); |
|
|
|
map.put("orgSid", orgSid); |
|
|
|
map.put("orgName", orgName); |
|
|
|
|
|
|
|
return map; |
|
|
|
public String getApplyCode(AppScmVehicleGressionDto dto) { |
|
|
|
String userSid = dto.getUserSid(); |
|
|
|
//获取分公司sid
|
|
|
|
ResultBean<String> resultBean = sysStaffOrgFeign.getPathSidByUserSid(userSid); |
|
|
|
ResultBean<SysOrganizationVo> resultBean1 = sysOrganizationFeign.fetchBySid(resultBean.getData()); |
|
|
|
String orgCode = resultBean1.getData().getOrgCode(); |
|
|
|
BillNo b = new BillNo(); |
|
|
|
b.setOrgCode(orgCode); |
|
|
|
b.setBillType(BillTypeEnum.KCDDBGSQ.getBillType()); |
|
|
|
String bill = Rule.getBill(b); |
|
|
|
int i = baseMapper.selectNum(bill); |
|
|
|
String billNo = Rule.getBillNo(bill, i); |
|
|
|
return billNo; |
|
|
|
} |
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 移位单生成编号
|
|
|
|
// *
|
|
|
|
// * @param userSid 用户sid
|
|
|
|
// * @return
|
|
|
|
// */
|
|
|
|
// public Map<String, String> generateBillNo(String userSid) {
|
|
|
|
// List<DictCommonVo> commonVoList = dictCommonFeign.getTypeValues(DictCommonType.BILLSTYPE, "0").getData();
|
|
|
|
// String billsType = "";
|
|
|
|
// if (commonVoList.size() > 0) {
|
|
|
|
// for (int i = 0; i < commonVoList.size(); i++) {
|
|
|
|
// if (commonVoList.get(i).getDictValue().contains("移位单")) {
|
|
|
|
// billsType = commonVoList.get(i).getDictKey();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// AppUserOrgInfoVo userOrgInfo = null;
|
|
|
|
// String orgCode = "";
|
|
|
|
// String orgSid = "";
|
|
|
|
// String orgName = "";
|
|
|
|
// ResultBean<AppUserOrgInfoVo> resultBean = sysUserFeign.getUserOrgInfoByUserSid(userSid);
|
|
|
|
// if (resultBean.getSuccess() && resultBean.getData() != null) {
|
|
|
|
// userOrgInfo = resultBean.getData();
|
|
|
|
// orgSid = userOrgInfo.getOrgSid();
|
|
|
|
// orgName = userOrgInfo.getOrgName();
|
|
|
|
// orgCode = userOrgInfo.getOrgCode();
|
|
|
|
// }
|
|
|
|
// String date = DateUtils.dateConvertStr(new Date(), "yyyy-MM-dd");
|
|
|
|
// // 流水号
|
|
|
|
// int i = selectCountByOrgSid(billsType, date, orgSid);
|
|
|
|
// String num = String.format("%04d", i + 1); // 不足4位补0
|
|
|
|
// Map<String, String> map = new HashMap<>();
|
|
|
|
// map.put("billNo_Num", billsType + orgCode + date.replaceAll("-", "") + num);
|
|
|
|
// map.put("billNo", billsType + orgCode + date.replaceAll("-", ""));
|
|
|
|
// map.put("staffSid", userOrgInfo.getStaffSid());
|
|
|
|
// map.put("staffName", userOrgInfo.getStaffName());
|
|
|
|
// map.put("orgSid", orgSid);
|
|
|
|
// map.put("orgName", orgName);
|
|
|
|
//
|
|
|
|
// return map;
|
|
|
|
// }
|
|
|
|
|
|
|
|
public int selectCountByOrgSid(String billsType, String date, String orgSid) { |
|
|
|
return baseMapper.selectCountByOrgSid(billsType, date, orgSid); |
|
|
|
} |
|
|
@ -535,9 +570,9 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
String state = "2"; |
|
|
|
baseMapper.updateStateBySid(dto.getSid(), state); |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
String state = "2"; |
|
|
|
baseMapper.updateStateBySid(businessSid, state); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
//流程中的参数赋值
|
|
|
@ -625,19 +660,19 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
ScmVehicleGression scmVehicleGression = fetchBySid(bv.getBusinessSid()); |
|
|
|
if (bv.getTaskId().equals(scmVehicleGression.getTaskId())) { |
|
|
|
boolean isTrue = false; |
|
|
|
if (StringUtils.isNotBlank(scmVehicleGression.getApplicantFunds())) { |
|
|
|
if ("0".equals(scmVehicleGression.getApplicantFunds())) { |
|
|
|
isTrue = false; |
|
|
|
} else { |
|
|
|
isTrue = true; |
|
|
|
} |
|
|
|
} else { |
|
|
|
isTrue = false; |
|
|
|
} |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("isTrue", isTrue); |
|
|
|
bv.setFormVariables(map); |
|
|
|
// boolean isTrue = false;
|
|
|
|
// if (StringUtils.isNotBlank(scmVehicleGression.getApplicantFunds())) {
|
|
|
|
// if ("0".equals(scmVehicleGression.getApplicantFunds())) {
|
|
|
|
// isTrue = false;
|
|
|
|
// } else {
|
|
|
|
// isTrue = true;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// isTrue = false;
|
|
|
|
// }
|
|
|
|
// Map<String, Object> map = new HashMap<>();
|
|
|
|
// map.put("isTrue", isTrue);
|
|
|
|
// bv.setFormVariables(map);
|
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
@ -667,10 +702,10 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
ResultBean<List<GetNodeVo>> rb = new ResultBean<>(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
Map<String, Object> formVariables = query.getFormVariables(); |
|
|
|
// Map<String, Object> formVariables = query.getFormVariables();
|
|
|
|
//判断流程分支
|
|
|
|
Map<String, Object> map = IsTrue(formVariables.get("businessSid")); |
|
|
|
bv.setFormVariables(map); |
|
|
|
// Map<String, Object> map = IsTrue(formVariables.get("businessSid"));
|
|
|
|
// bv.setFormVariables(map);
|
|
|
|
bv.setModelId(ProcDefEnum.SCMCARTRANSFER.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
@ -688,10 +723,10 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
ResultBean<List<GetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
Map<String, Object> formVariables = query.getFormVariables(); |
|
|
|
// Map<String, Object> formVariables = query.getFormVariables();
|
|
|
|
//判断流程分支
|
|
|
|
Map<String, Object> map = IsTrue(formVariables.get("businessSid")); |
|
|
|
bv.setFormVariables(map); |
|
|
|
// Map<String, Object> map = IsTrue(formVariables.get("businessSid"));
|
|
|
|
// bv.setFormVariables(map);
|
|
|
|
bv.setModelId(ProcDefEnum.SCMCARTRANSFER.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
@ -816,7 +851,7 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据业务sid查询,判断流程分支 |
|
|
|
* 根据业务sid查询,判断流程分支(“暂时不用”) |
|
|
|
* |
|
|
|
* @param businessSid |
|
|
|
* @return |
|
|
@ -837,4 +872,24 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
map.put("isTrue", isTrue); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<TemporaryExitPermitInfo> temporaryExitPermitInfo(String sid, String userSid) { |
|
|
|
ResultBean<TemporaryExitPermitInfo> rb = ResultBean.fireFail(); |
|
|
|
TemporaryExitPermitInfo temporaryExitPermitInfo = new TemporaryExitPermitInfo(); |
|
|
|
ScmVehicleGression scmVehicleGression = fetchBySid(sid); |
|
|
|
SysOrganization sysOrganization = sysOrganizationFeign.selectBySid(scmVehicleGression.getUseOrgSid()).getData(); |
|
|
|
temporaryExitPermitInfo.setCustomerName("-"); |
|
|
|
temporaryExitPermitInfo.setOrgName(sysOrganization.getName()); |
|
|
|
temporaryExitPermitInfo.setDate(new Date()); |
|
|
|
temporaryExitPermitInfo.setContractNo("-"); |
|
|
|
BaseVehicleSelectVo data = baseVehicleFeign.details(scmVehicleGression.getVehicleSid()).getData(); |
|
|
|
ExiCarConfigDetailVo exiCarConfigDetailVo = baseVehicleFeign.selectExiCarConfig(data.getModelSid(), data.getModelConfigSid(), userSid).getData(); |
|
|
|
temporaryExitPermitInfo.setModelName(exiCarConfigDetailVo.getVehicleAlias() + exiCarConfigDetailVo.getCarColor()); |
|
|
|
temporaryExitPermitInfo.setNum("1"); |
|
|
|
temporaryExitPermitInfo.setVinNo(scmVehicleGression.getVinNo()); |
|
|
|
temporaryExitPermitInfo.setReason("存放地点变更"); |
|
|
|
temporaryExitPermitInfo.setCreatName(scmVehicleGression.getOperator()); |
|
|
|
temporaryExitPermitInfo.setCarryCarName("-"); |
|
|
|
return rb.success().setData(temporaryExitPermitInfo); |
|
|
|
} |
|
|
|
} |