Commit af234dc4 authored by litengwei's avatar litengwei

删除旧得关联关系表代码

parent ef246a05
......@@ -9,6 +9,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author system_generator
* @date 2023-12-18
*/
public interface JgInstallationNoticeEqMapper extends BaseMapper<JgInstallationNoticeEq> {
public interface JgInstallationNoticeEqMapper extends CustomBaseMapper<JgInstallationNoticeEq> {
}
......@@ -79,8 +79,7 @@ public class JgInstallationByWorkFlowController {
public ResponseModel<JgInstallationNoticeDto> accept(@RequestBody Map<String, Object> model, String op) {
// TODO 受理安装告知流程
LinkedHashMap model1 = (LinkedHashMap)model.get("model");
LinkedHashMap form = (LinkedHashMap)model1.get("form");
LinkedHashMap installationInfo = (LinkedHashMap)form.get("installationInfo");
LinkedHashMap installationInfo = (LinkedHashMap)model1.get("installationInfo");
JgInstallationNoticeDto jgInstallationNoticeDto = JSON.parseObject(JSON.toJSONString(installationInfo), JgInstallationNoticeDto.class);
jgInstallationNoticeServiceImpl.accept(jgInstallationNoticeDto,op);
return ResponseHelper.buildResponse(null);
......
......@@ -10,13 +10,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRelationEquip;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRelationEquipMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
......@@ -28,6 +27,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsJgOtherInfo;
......@@ -82,7 +82,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
JgRelationEquipMapper jgRelationEquipMapper;
JgInstallationNoticeEqMapper jgInstallationNoticeEqMapper;
@Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper;
......@@ -209,16 +209,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
log.error("提交失败:{}", e);
}
// 生成告知单
JgInstallationNotice jgInstallationNotice = this.getById(noticeDto.getSequenceNbr());
if (String.valueOf(FlowStatusEnum.SUBMITTED.getCode()).equals(jgInstallationNotice.getNoticeStatus())) {
String reportUrl = this.generateInstallationNoticeReport(jgInstallationNotice.getSequenceNbr());
if (StringUtils.hasText(reportUrl)) {
jgInstallationNotice.setNoticeReportUrl(reportUrl);
jgInstallationNoticeMapper.updateById(jgInstallationNotice);
}
}
return noticeDto;
}
......@@ -413,66 +403,44 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
List<String> instanceIdList = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
// String[] strIds = new String[deviceList.size()];
// String[] strKeys = new String[deviceList.size()];
//
// for (int i = 0; i<deviceList.size() ; i++
// ) {
// strIds[i] = PROCESS_DEFINITION_KEY;
// strKeys[i] = String.valueOf(i);
// }
// dto.setProcessDefinitionIds(String.join(",", strIds));
// dto.setProcessDefinitionKeys(String.join(",", strKeys));
// dto.setCompleteFirstTask(true);
//
// try {
// FeignClientResult result = Workflow.taskV2Client.startByVariable(dto);
// } catch (Exception e) {
// e.printStackTrace();
// }
for (int i = 0; i < deviceList.size(); i++) {
// ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
for (int i = 0; i<deviceList.size() ; i++
) {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey("1");
AjaxResult ajaxResult = null;
try {
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
instanceIdList.add(instanceId);
ajaxResult = Workflow.taskClient.getTask(instanceId);
// 执行一步
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", "0");
taskResultDTO.setVariable(map);
//执行流程
Workflow.taskClient.completeByTask(taskId, taskResultDTO);
} catch (Exception e) {
log.error("流程启动失败:{}", e);
dto.setBusinessKey(String.valueOf(i));
dto.setCompleteFirstTask(true);
list.add(dto);
}
actWorkflowBatchDTO.setProcess(list);
try {
FeignClientResult result = Workflow.taskV2Client.startByVariableBatch(actWorkflowBatchDTO);
List<Object> returnList = (List<Object>) result.getResult();
for (Object obj :returnList
) {
JSONObject jsonObject = JSON.parseObject(JSONObject.toJSONString(obj));
instanceIdList.add(jsonObject.getString("id"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
List<JgInstallationNotice> list = new ArrayList<>();
List<JgRelationEquip> equipList = new ArrayList<>();
List<JgInstallationNoticeEq> equipList = new ArrayList<>();
deviceList.forEach(obj -> {
JgRelationEquip jgRelationEquip = new JgRelationEquip();
JgInstallationNoticeEq jgRelationEquip = new JgInstallationNoticeEq();
JgInstallationNotice dto = new JgInstallationNotice();
BeanUtils.copyProperties(model, dto);
int i = deviceList.indexOf(obj);
String applyNo = applyNoList.get(i);
dto.setApplyNo(applyNo);
dto.setEquList(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setApplyNo(applyNo);
jgRelationEquip.setBusinessType(ApplicationFormTypeEnum.AZGZ.getCode());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
if (!CollectionUtils.isEmpty(instanceIdList)) {
dto.setInstanceId(instanceIdList.get(i));
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
......@@ -485,13 +453,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
jgInstallationNoticeMapper.insertBatchSomeColumn(list);
List<JgRelationEquip> jgRelationEquipList = equipList.stream().map(jgRelationEquip -> {
List<JgInstallationNotice> collect = list.stream().filter(jgInstallationNotice -> jgRelationEquip.getApplyNo().equals(jgInstallationNotice.getApplyNo())).collect(Collectors.toList());
List<JgInstallationNoticeEq> jgRelationEquipList = equipList.stream().map(jgRelationEquip -> {
List<JgInstallationNotice> collect = list.stream().filter(jgInstallationNotice -> jgRelationEquip.getEquipTransferId().equals(jgInstallationNotice.getSequenceNbr())).collect(Collectors.toList());
Long sequenceNbr = collect.get(0).getSequenceNbr();
return jgRelationEquip.setBusinessId(String.valueOf(sequenceNbr));
return jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
}).collect(Collectors.toList());
jgRelationEquipMapper.insertBatchSomeColumn(jgRelationEquipList);
jgInstallationNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
}
......@@ -615,16 +583,16 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
log.error("日期转换失败:{}", e);
}
LambdaQueryWrapper<JgRelationEquip> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgRelationEquip::getBusinessId,dto.getSequenceNbr());
JgRelationEquip jgRelationEquip = jgRelationEquipMapper.selectOne(queryWrapper);
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId,dto.getSequenceNbr());
JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper);
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord,jgRelationEquip.getEquipId());
queryWrapper1.eq(OtherInfo::getRecord,jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord,jgRelationEquip.getEquipId());
queryWrapper2.eq(RegistrationInfo::getRecord,jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(dto.getCity()).append(ym);
......@@ -644,6 +612,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if(submit) {
if("0".equals(op)) {
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.HAVE_PROCESSED.getCode()));
this.generateInstallationNoticeReport(dto.getSequenceNbr());
} else {
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
dto.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
......
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