Commit e10c5f93 authored by yangyang's avatar yangyang

fix(改造告知):开通业务

parent 90494db1
......@@ -26,7 +26,8 @@
isn.receive_org_name AS receiveOrgName,
isn.next_execute_ids as nextExecuteIds,
isn.promoter,
isn.notice_report_url
isn.notice_report_url,
isn.accept_date
FROM
tzs_jg_reform_notice isn
<where>
......@@ -49,16 +50,15 @@
</if>
</if>
<if test="type == 'supervision'">
AND isn.notice_status in ('6612', '6613', '6614')
AND (isn.notice_status in ('6612', '6613', '6614', '6616') )
AND isn.receive_org_code = #{orgCode}
<!-- AND (isn.notice_status in ('6612', '6613', '6614') or isn.status in('6614') )-->
</if>
<if test="type == 'enterprise'">
AND isn.install_unit_credit_code = #{orgCode}
</if>
</where>
ORDER BY
isn.notice_date DESC
isn.rec_date DESC
</select>
<select id="queryEquipInformation" resultType="java.util.Map">
......@@ -82,10 +82,16 @@
isn.next_execute_ids as nextExecuteIds,
isn.promoter,
isn.notice_status AS noticeStatus,
<!-- isn.install_start_date AS installLicenseExpirationDate,-->
<!-- isn.install_license_no AS installLicenseNo,-->
isn.plan_date AS installStartDate,
isn.construction_manager AS installLeaderName,
isn.construction_manager_phone AS installLeaderPhone,
ri.equ_code AS equRegisterCode,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
fi.FACTORY_NUM AS produceCode,
ri.product_name AS productName,
ri.brand_name AS brandName,
ri.equ_type AS equType,
......@@ -112,11 +118,11 @@
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ui.safety_manager AS safetyManager,
ui.phone AS safetyManagerPhone,
ui.PROVINCE_NAME AS useUnitProvinceName,
ei.legal_person AS safetyManager,
ei.legal_phone AS safetyManagerPhone,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
ui.ADDRESS AS useUnitAddress
ei.ADDRESS AS useUnitAddress
FROM
tzs_jg_reform_notice isn
LEFT JOIN tzs_jg_reform_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
......@@ -125,6 +131,7 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = isn.use_unit_credit_code
WHERE
isn.sequence_nbr = #{sequenceNbr}
LIMIT 1
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -88,10 +89,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
JgReformNoticeEqMapper JgReformNoticeEqMapper;
JgReformNoticeEqMapper jgReformNoticeEqMapper;
@Autowired
private JgReformNoticeMapper JgReformNoticeMapper;
private JgReformNoticeMapper jgReformNoticeMapper;
@Autowired
private ICreateCodeService iCreateCodeService;
// @Autowired
......@@ -130,7 +131,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@Override
public Map<String, Map<String, Object>> queryBySequenceNbr(Long sequenceNbr) {
// 改造告知信息
JgReformNotice notice = JgReformNoticeMapper.selectById(sequenceNbr);
JgReformNotice notice = jgReformNoticeMapper.selectById(sequenceNbr);
if (Objects.isNull(notice)) {
return null;
}
......@@ -152,7 +153,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport",
"proxyStatementAttachment", "installContractAttachment"};
// 设备信息
List<Map<String, Object>> equipmentInfos = JgReformNoticeMapper.queryEquipInformation(sequenceNbr);
List<Map<String, Object>> equipmentInfos = jgReformNoticeMapper.queryEquipInformation(sequenceNbr);
for (String s : fields) {
if (installationInfo.containsKey(s)) {
installationInfo.put(s, JSON.parseArray(installationInfo.get(s).toString()));
......@@ -161,6 +162,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
equipmentInfos.get(0).put(s, JSON.parseArray(equipmentInfos.get(0).get(s).toString()));
}
}
installationInfo.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
return new HashMap<String, Map<String, Object>>() {{
this.put("reformInfo", installationInfo);
this.put("equipmentInfo", equipmentInfos.get(0));
......@@ -177,8 +179,11 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
String[] taskName = new String[]{"流程结束"};
// 字段转换
this.convertField(noticeDto);
ArrayList<String> roleListFirst = new ArrayList<>();
ArrayList<String> roleListSecond = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
AjaxResult ajaxResult;
// 发起流程
......@@ -190,45 +195,38 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId);
// 查询下节点任务
getNext(roleListFirst, instanceId, taskName);
noticeDto.setInstanceStatus(String.join(",", roleListFirst));
} catch (Exception e) {
log.error("提交失败:{}", e);
}
}
ajaxResult = Workflow.taskClient.getTask(noticeDto.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
// 组装信息
TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setResultCode("approvalStatus");
taskResultDTO.setTaskId(taskId);
taskResultDTO.setComment("提交流程");
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
taskResultDTO.setVariable(map);
// 执行流程
AjaxResult ajaxResult1;
try {
ajaxResult1 = Workflow.taskClient.completeByTask(taskId, taskResultDTO);
if (ajaxResult1.get("code").equals(200)) {
noticeDto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
JgReformNotice bean = new JgReformNotice();
BeanUtils.copyProperties(noticeDto, bean);
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
bean.setPromoter(reginParams.getUserModel().getUserId());
JgReformNoticeMapper.updateById(bean);
Boolean rollBack = "1".equals(op) ? true : false;
if (rollBack) {
JgReformNoticeMapper.updatePromoter(noticeDto.getSequenceNbr());
}
JgReformNotice notice = new JgReformNotice();
BeanUtils.copyProperties(noticeDto, notice);
boolean submit = submit(notice, op);
if (submit) {
// 查询下节点任务
getNext(roleListSecond, notice.getInstanceId(), taskName);
notice.setStatus(taskName[0]);
if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
notice.setInstanceStatus(notice.getInstanceStatus() + "," + roleListSecond);
} else {
notice.setInstanceStatus(String.join(",", roleListSecond));
}
} catch (Exception e) {
log.error("提交失败:{}", e);
notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", roleListSecond));
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
jgReformNoticeMapper.updateById(notice);
}
} else {
JgReformNotice bean = new JgReformNotice();
BeanUtils.copyProperties(noticeDto, bean);
JgReformNoticeMapper.updateById(bean);
jgReformNoticeMapper.updateById(bean);
}
return noticeDto;
}
......@@ -246,7 +244,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
public Page<JgReformNoticeDto> queryForJgReformNoticePage(Page<JgReformNotice> page, JgReformNoticeDto model, String type, ReginParams reginParams) {
String orgCode = reginParams.getCompany().getCompanyCode();
Page<JgReformNotice> noticePage = JgReformNoticeMapper.queryForPage(page, model, type, orgCode);
Page<JgReformNotice> noticePage = jgReformNoticeMapper.queryForPage(page, model, type, orgCode);
// 将Page<JgReformNotice>转化为Page<JgReformNoticeDto>
Page<JgReformNoticeDto> noticeDtoPage = new Page<>();
......@@ -307,7 +305,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
JgReformNotice JgReformNotice = this.getById(sequenceNbr);
List<Map<String, Object>> informationList = JgReformNoticeMapper.queryEquipInformation(sequenceNbr);
List<Map<String, Object>> informationList = jgReformNoticeMapper.queryEquipInformation(sequenceNbr);
if (Objects.isNull(JgReformNotice) || CollectionUtils.isEmpty(informationList)) {
throw new IllegalArgumentException("改造告知单不存在");
}
......@@ -323,17 +321,17 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipType", getValue.apply("equType"));
placeholders.put("equipCode", getValue.apply("equRegisterCode"));
placeholders.put("produceCode", ""); // TODO: 制造编号
placeholders.put("produceCode", getValue.apply("produceCode")); // TODO: 制造编号 - 设备出厂编号
placeholders.put("produceUnitName", getValue.apply("produceUnitName"));
placeholders.put("produceLicenseNum", getValue.apply("produceLicenseNum"));
placeholders.put("fullAddress", getValue.apply("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("address"));
placeholders.put("installStartDate", "");
placeholders.put("installType", ""); // TODO: 施工类别
placeholders.put("installStartDate", getValue.apply("installStartDate"));
placeholders.put("installType", "改造"); // TODO: 施工类别
placeholders.put("installLicenseNo", "");
placeholders.put("installLicenseExpirationDate", "");
placeholders.put("installLeaderName", "");
placeholders.put("installLeaderPhone", "");
placeholders.put("installUnitAddress", ""); // TODO: 施工单位地址
placeholders.put("installLeaderName", getValue.apply("installLeaderName"));// 施工负责人
placeholders.put("installLeaderPhone", getValue.apply("installLeaderPhone"));// 施工负责人手机
placeholders.put("installUnitAddress", getValue.apply("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("address")); // TODO: 施工单位地址
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
......@@ -405,6 +403,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@SuppressWarnings ({"Duplicates", "rawtypes"})
@Transactional (rollbackFor = Exception.class)
public void saveNotice(String submitType, Map<String, JgReformNoticeDto> JgReformNoticeDtoMap, ReginParams reginParams) {
String[] taskName = new String[]{"流程结束"};
JgReformNoticeDto model = JgReformNoticeDtoMap.get(TABLE_PAGE_ID);
// 字段转换
convertField(model);
......@@ -421,6 +421,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return;
}
ArrayList<String> roleListFirst = new ArrayList<>();
ArrayList<String> roleListSecond = new ArrayList<>();
// 判断当前是否为提交
List<String> instanceIdList = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
......@@ -433,7 +435,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey(String.valueOf(i));
dto.setCompleteFirstTask(true);
// dto.setCompleteFirstTask(true);
list.add(dto);
}
actWorkflowBatchDTO.setProcess(list);
......@@ -444,14 +446,42 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
for (Object obj : returnList
) {
JSONObject jsonObject = JSON.parseObject(JSONObject.toJSONString(obj));
instanceIdList.add(jsonObject.getString("id"));
String instanceId = jsonObject.getString("id");
instanceIdList.add(instanceId);
// 查询下节点任务
if (returnList.get(0).equals(obj)) {
getNext(roleListFirst, instanceId, taskName);
}
// 推动下一个节点
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
// 组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
dto.setComment("提交流程");
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", "0");
dto.setVariable(map);
// 执行流程
AjaxResult ajaxResult1 = null;
try {
ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
if (ajaxResult1.get("code").equals(200)) {
getNext(roleListSecond, instanceId, taskName);
} else {
log.error("提交失败");
}
} catch (Exception e) {
log.error("提交失败:{}", e);
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("提交失败:{}", e);
}
}
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<JgReformNotice> list = new ArrayList<>();
List<JgReformNoticeEq> equipList = new ArrayList<>();
deviceList.forEach(obj -> {
......@@ -462,6 +492,12 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
String applyNo = applyNoList.get(i);
dto.setApplyNo(applyNo);
dto.setNoticeDate(new Date());
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
dto.setNextExecuteIds(String.join(",", roleListSecond));
dto.setInstanceStatus(String.join(",", roleListFirst));
dto.setPromoter(reginParams.getUserModel().getUserId());
dto.setStatus(taskName[0]);
}
dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
......@@ -469,7 +505,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
if (!CollectionUtils.isEmpty(instanceIdList)) {
dto.setInstanceId(instanceIdList.get(i));
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
dto.setPromoter(reginParams.getUserModel().getUserId());
} else {
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
}
......@@ -477,7 +512,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
equipList.add(jgRelationEquip);
});
JgReformNoticeMapper.insertBatchSomeColumn(list);
jgReformNoticeMapper.insertBatchSomeColumn(list);
List<JgReformNoticeEq> jgRelationEquipList = equipList.stream().map(jgRelationEquip -> {
List<JgReformNotice> collect = list.stream().filter(JgReformNotice -> jgRelationEquip.getEquipTransferId().equals(JgReformNotice.getApplyNo())).collect(Collectors.toList());
......@@ -485,10 +520,26 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
}).collect(Collectors.toList());
JgReformNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
jgReformNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
}
void getNext(ArrayList<String> roleListFirst, String instanceId, String[] taskName) {
AjaxResult aj = Workflow.taskClient.getTaskNoAuth(instanceId);
JSONObject taskNoAuth = JSON.parseObject(JSON.toJSONString(aj.get("data")));
if (!ObjectUtils.isEmpty(taskNoAuth)) {
String nextTaskId = taskNoAuth.getString("id");
AjaxResult taskGroupName = Workflow.taskClient.getTaskGroupName(nextTaskId);
taskName[0] = taskNoAuth.getString("name");
JSONArray data = JSON.parseArray(JSON.toJSONString(taskGroupName.get("data")));
for (Object datum : data) {
if (((Map) datum).containsKey("groupId")) {
roleListFirst.add(((Map) datum).get("groupId").toString());
}
}
}
}
private void convertField(JgReformNoticeDto model) {
// 处理图片
// if (!ValidationUtil.isEmpty(model.getProxyStatementAttachmentList())) {
......@@ -554,7 +605,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
model.setReceiveOrgName(receiveOrgIdList[1]);
}
}
String constructionManagerId = model.getConstructionManagerId();
if (!ObjectUtils.isEmpty(constructionManagerId)) {
String[] constructionManagerIdList = constructionManagerId.split("_");
if (constructionManagerIdList.length > 1) {
model.setConstructionManagerId(constructionManagerIdList[0]);
model.setConstructionManager(constructionManagerIdList[1]);
}
}
// String inspectUnitId = model.getInspectUnitId();
// if (!ObjectUtils.isEmpty(inspectUnitId)) {
// String[] inspectUnitIdList = inspectUnitId.split("_");
......@@ -602,20 +660,24 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
public void cancel(JgReformNoticeDto noticeDto) {
String[] taskName = new String[]{"流程结束"};
FeignClientResult ajaxResult = Workflow.taskV2Client.rollBack(noticeDto.getInstanceId());
JgReformNotice JgReformNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
JgReformNotice jgReformNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
ArrayList<String> roleList = new ArrayList<>();
if (ajaxResult.getStatus() == 200) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgReformNotice.setPromoter(reginParams.getUserModel().getUserId());
JgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
JgReformNoticeMapper.updateById(JgReformNotice);
JgReformNoticeMapper.updatePromoter(JgReformNotice.getSequenceNbr());
getNext(roleList, noticeDto.getInstanceId(), taskName);
jgReformNotice.setStatus(taskName[0]);
jgReformNotice.setPromoter("");
jgReformNotice.setNextExecuteIds(String.join(",", roleList));
jgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()));
jgReformNoticeMapper.updateById(jgReformNotice);
}
}
public void accept(JgReformNoticeDto dto, String op) {
JgReformNotice JgReformNotice = this.JgReformNoticeMapper.selectById(dto.getSequenceNbr());
String[] taskName = new String[]{"流程结束"};
String userId = RequestContext.getExeUserId();
JgReformNotice jgReformNotice = this.jgReformNoticeMapper.selectById(dto.getSequenceNbr());
// 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer();
String ym = null;
......@@ -625,83 +687,81 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
log.error("日期转换失败:{}", e);
}
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgReformNoticeEq jgRelationEquip = JgReformNoticeEqMapper.selectOne(queryWrapper);
// LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
// queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
// OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(JgReformNotice.getCity()).append(ym);
// String equCode = stringBuffer.toString();
// 只有安装设备需要
// String deviceRegistrationCode = iCreateCodeService.createDeviceRegistrationCode(equCode);
Map<String, Object> map = new HashMap<>();
map.put("cityCode", JgReformNotice.getCity());
map.put("countyCode", JgReformNotice.getCounty());
map.put("equCategory", tzsJgRegistrationInfo.getEquCategory());
map.put("isXiXian", JgReformNotice.getIsXixian() == null ? "0" : JgReformNotice.getIsXixian());
// Map<String, Object> mapCode;
// ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
// mapCode = code.getResult();
//
// LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
// queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode, mapCode.get("superviseCode").toString());
// SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
// supervisoryCodeInfo.setStatus("1");
// supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
boolean submit = submit(JgReformNotice, op);
ArrayList<String> roleList = new ArrayList<>();
boolean submit = submit(jgReformNotice, op);
if (submit) {
getNext(roleList, dto.getInstanceId(), taskName);
jgReformNotice.setStatus(taskName[0]);
if ("0".equals(op)) {
JgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
this.generateInstallationNoticeReport(JgReformNotice.getSequenceNbr());
// 更新其他业务表
// tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
// tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
// tzsJgRegistrationInfo.setEquCode(deviceRegistrationCode);
// JgReformNotice.setEquRegisterCode(deviceRegistrationCode);
// JgReformNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
// tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// tzsJgRegistrationInfoMapper.updateById(tzsJgRegistrationInfo);
if (roleList.size() == 0) {
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgReformNoticeEq jgRelationEquip = jgReformNoticeEqMapper.selectOne(queryWrapper);
// LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
// queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
// OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgReformNotice.getCity()).append(ym);
// String equCode = stringBuffer.toString();
// 只有安装设备需要
// String deviceRegistrationCode = iCreateCodeService.createDeviceRegistrationCode(equCode);
Map<String, Object> map = new HashMap<>();
map.put("cityCode", jgReformNotice.getCity());
map.put("countyCode", jgReformNotice.getCounty());
map.put("equCategory", tzsJgRegistrationInfo.getEquCategory());
map.put("isXiXian", jgReformNotice.getIsXixian() == null ? "0" : jgReformNotice.getIsXixian());
// Map<String, Object> mapCode;
// ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
// mapCode = code.getResult();
//
// LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
// queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode, mapCode.get("superviseCode").toString());
// SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
// supervisoryCodeInfo.setStatus("1");
// supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
jgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
this.generateInstallationNoticeReport(jgReformNotice.getSequenceNbr());
// 更新其他业务表
// tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
// tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
// tzsJgRegistrationInfo.setEquCode(deviceRegistrationCode);
// jgInstallationNotice.setEquRegisterCode(deviceRegistrationCode);
// jgInstallationNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
// Map<String,Map<String,Object>> objMap = new HashMap<>();
// Map<String,Object> map1 =new HashMap<>();
// map1.put("CODE96333",tzsJgOtherInfo.getCode96333() );
// map1.put("EQU_CODE",tzsJgRegistrationInfo.getEquCode() );
// map1.put("SUPERVISORY_CODE",tzsJgOtherInfo.getSupervisoryCode());
// objMap.put(tzsJgOtherInfo.getRecord(),map1);
jgReformNotice.setPromoter("");
// tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
// tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// tzsJgRegistrationInfoMapper.updateById(tzsJgRegistrationInfo);
} else {
jgReformNotice.setNextExecuteIds(String.join(",", roleList));
if (!ObjectUtils.isEmpty(jgReformNotice.getInstanceStatus())) {
jgReformNotice.setInstanceStatus(jgReformNotice.getInstanceStatus() + "," + String.join(",", roleList));
} else {
jgReformNotice.setInstanceStatus(String.join(",", roleList));
}
jgReformNotice.setPromoter(userId);
jgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
}
} else {
JgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
// JgReformNotice.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
}
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgReformNotice.setPromoter(reginParams.getUserModel().getUserId());
JgReformNoticeMapper.updateById(JgReformNotice);
Boolean rollBack = "1".equals(op) ? true : false;
if (rollBack) {
JgReformNoticeMapper.updatePromoter(JgReformNotice.getSequenceNbr());
jgReformNotice.setPromoter("");
jgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
}
jgReformNoticeMapper.updateById(jgReformNotice);
}
// // 组装监管码
// String division = "";
// if (((XIAN.equals(dto.getCity()) || XIAN_YANG.equals(dto.getCity())) && "1".equals(dto.getIsXixian()))) {
// division = "X";
// } else {
// //生成监管码前缀
// Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), dto.getCounty());
// division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), dto.getCity()).get("code").toString() : divisionMap.get("code").toString();
// }
//
// // 组装96333码
// String prefix = "";
// if (((XIAN.equals(dto.getCity()) || XIAN_YANG.equals(dto.getCity())) && "1".equals(dto.getIsXixian()))) {
// prefix = EquipmentCategoryEnum.XXCSM.getValue();
// } else {
// Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), dto.getCounty());
// prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), dto.getCity()).get("code").toString() : elevatorMap.get("code").toString();
// }
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.feign;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@FeignClient(name = "TZS-YMT", path = "/ymt", configuration =
{FeignConfiguration.class})
public interface TzsServiceFeignClient {
/**
* 创建监管码及96333
*
* @param map 请求体
* @return
*/
@RequestMapping(value = "/equipment-category/createSupervisorCode", method = RequestMethod.POST)
ResponseModel<Map<String, Object>> createCode(@RequestBody Map<String, Object> map);
/**
* 创建监管码及96333
*
* @param paramMap 请求体
* @return
*/
@RequestMapping(value = "/equipment-category/commonUpdateEsData", method = RequestMethod.POST)
ResponseModel<Map<String, Object>> commonUpdateEsDataByIds(@RequestBody Map<String, Map<String, Object>> paramMap);
/**
* 申请单编号生成
* @param type 参考ApplicationFormTypeEnum中的枚举
* @param batchSize batchSize
* @return List
*/
@RequestMapping(value = "/generate-code/applicationFormCode", method = RequestMethod.POST)
ResponseModel<Map<String, Object>> applicationFormCode(@RequestParam("type") String type,
@RequestParam("batchSize") int batchSize);
/**
* 生成设备注册编码
* @param key 16位
* @return 生成设备注册编码(20位)
*/
@RequestMapping(value = "/generate-code/deviceRegistrationCode", method = RequestMethod.POST)
ResponseModel<String> deviceRegistrationCode(@RequestParam("key") String key);
/**
* 使用登记证生成
* @param key 起11陕C
* @return 生成使用登记证编号(13位,起11陕C00001(23))
*/
@RequestMapping(value = "/generate-code/useRegistrationCode", method = RequestMethod.POST)
ResponseModel<String> useRegistrationCode(@RequestParam("key") String key);
}
......@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstD
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcOpeningApplicationService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
......@@ -48,6 +49,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.*;
......@@ -69,6 +71,8 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
@Autowired
private ICreateCodeService createCodeService;
@Autowired
private TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
JyjcOpeningApplicationMapper jyjcOpeningApplicationMapper;
@Resource(type = JyjcBaseMapper.class)
......@@ -141,6 +145,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
CompanyBo companyBo = commonserviceImpl.getReginParamsOfCurrentUser().getCompany();
model.setUnitCode(companyBo.getCompanyCode());
model.setUnitCodeName(companyBo.getCompanyName());
ResponseModel<Map<String, Object>> result = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.JY.getCode(), 1);
List<String> codes = createCodeService.createApplicationFormCode(ApplicationFormTypeEnum.JY.getCode(), 1);
model.setApplicationSeq(codes.get(0));
model.setCreateUserId(reginParams.getUserModel().getUserId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment