Commit ce6858a7 authored by 韩桐桐's avatar 韩桐桐

fix(jg):启用停用

parent faf4f685
...@@ -66,9 +66,6 @@ public class JgEnableDisableDto extends BaseDto { ...@@ -66,9 +66,6 @@ public class JgEnableDisableDto extends BaseDto {
@ApiModelProperty(value = "设备代码") @ApiModelProperty(value = "设备代码")
private String equCode; private String equCode;
@ApiModelProperty(value = "使用登记证编号")
private String useRegistrationCode;
@ApiModelProperty(value = "96333识别码") @ApiModelProperty(value = "96333识别码")
private String code96333; private String code96333;
...@@ -112,4 +109,16 @@ public class JgEnableDisableDto extends BaseDto { ...@@ -112,4 +109,16 @@ public class JgEnableDisableDto extends BaseDto {
@ApiModelProperty(value = "其他附件") @ApiModelProperty(value = "其他附件")
private String otherAccessories; private String otherAccessories;
@ApiModelProperty(value = "设备种类code")
private String equListCode;
@ApiModelProperty(value = "设备种类name")
private String equListName;
@ApiModelProperty(value = "使用登记证id,多个逗号分割")
private String registrationManageId;
@ApiModelProperty(value = "使用登记证编号,多个逗号分割(冗余前端检索使用)")
private String useRegistrationCode;
} }
...@@ -167,4 +167,30 @@ public class JgEnableDisable extends BaseEntity { ...@@ -167,4 +167,30 @@ public class JgEnableDisable extends BaseEntity {
*/ */
@TableField(value = "other_accessories") @TableField(value = "other_accessories")
private String otherAccessories; private String otherAccessories;
/**
* 设备种类code
*/
@TableField(value = "equ_list_code")
private String equListCode;
/**
* 设备种类名称
*/
@TableField(value = "equ_list_name")
private String equListName;
/**
* 使用登记证id,多个逗号分割
*/
@TableField("registration_manage_id")
private String registrationManageId;
/**
* 使用登记证编号,多个逗号分割(冗余前端检索使用)
*/
@TableField(value = "use_registration_code")
private String useRegistrationCode;
} }
...@@ -9,17 +9,12 @@ ...@@ -9,17 +9,12 @@
else '设备启用' end as applyType, else '设备启用' end as applyType,
jed.sequence_nbr as sequenceNbr, jed.sequence_nbr as sequenceNbr,
jed.apply_no as applyNo, jed.apply_no as applyNo,
jed.equ_list_code as equListCode,
jed.equ_list_name as equListName,
date_format(jed.apply_date, '%Y-%m-%d') as applyDate, date_format(jed.apply_date, '%Y-%m-%d') as applyDate,
date_format(jed.audit_pass_date, '%Y-%m-%d') as auditPassDate, date_format(jed.audit_pass_date, '%Y-%m-%d') as auditPassDate,
jri.USE_ORG_CODE as useOrgCode,
jri.PRODUCT_NAME as productName,
jri.EQU_CODE AS equCode,
jri.USE_ORG_CODE AS useRegistrationCode,
use.USE_UNIT_NAME as useUnitName,
jed.receive_org_name as receiveOrgName, jed.receive_org_name as receiveOrgName,
concat(use."PROVINCE_NAME", '', use."CITY_NAME", '', use."COUNTY_NAME", '', use."STREET_NAME") as address, jed.use_registration_code as useRegistrationCode,
use."ADDRESS" as detailedAddress,
use."USE_INNER_CODE" as useInnerCode,
jed.audit_status as auditStatus, jed.audit_status as auditStatus,
jed.instance_id as instanceId, jed.instance_id as instanceId,
jed.execute_sequence as executeSequence, jed.execute_sequence as executeSequence,
...@@ -27,17 +22,8 @@ ...@@ -27,17 +22,8 @@
jed.promoter, jed.promoter,
jed.next_execute_user_ids as nextExecuteUserIds, jed.next_execute_user_ids as nextExecuteUserIds,
jed.create_user_id as createUserId, jed.create_user_id as createUserId,
jed.next_task_id as nextTaskId, jed.next_task_id as nextTaskId
oi.SUPERVISORY_CODE AS supervisoryCode,
oi.CODE96333 as code96333,
(SELECT name from tz_equipment_category WHERE code = jri.EQU_LIST) AS equList,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as equDefine
FROM tzs_jg_enable_disable jed FROM tzs_jg_enable_disable jed
LEFT JOIN tzs_jg_enable_disable_eq jede on jed.sequence_nbr = jede.enable_disable_apply_id
LEFT JOIN idx_biz_jg_register_info jri on jede.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on jri.RECORD = use.RECORD
LEFT JOIN idx_biz_jg_other_info oi ON oi.RECORD = jede.equ_id
<where> <where>
jed.is_delete = 0 jed.is_delete = 0
<if test="dto.applyNo != null and dto.applyNo != '' "> <if test="dto.applyNo != null and dto.applyNo != '' ">
...@@ -63,33 +49,10 @@ ...@@ -63,33 +49,10 @@
and jed.apply_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%') and jed.apply_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%')
</if> </if>
<if test="dto.equList != null and dto.equList != ''"> <if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList} AND jed.equ_list_code = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri."equ_category" = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri."EQU_DEFINE" = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri."EQU_CODE" like concat('%',#{dto.equCode},'%')
</if> </if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND jri."USE_ORG_CODE" like concat('%',#{dto.useRegistrationCode},'%') AND jed."use_registration_code" like concat('%',#{dto.useRegistrationCode},'%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND oi.CODE96333 like concat('%',#{dto.code96333},'%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND oi.SUPERVISORY_CODE like concat('%',#{dto.supervisoryCode},'%')
</if>
<if test="dto.address != null and dto.address != ''">
AND (
use."PROVINCE_NAME" LIKE CONCAT('%', #{dto.address}, '%')
OR use."CITY_NAME" LIKE CONCAT('%', #{dto.address}, '%')
OR use."COUNTY_NAME" LIKE CONCAT('%', #{dto.address}, '%')
OR use."STREET_NAME" LIKE CONCAT('%', #{dto.address}, '%')
)
</if> </if>
</where> </where>
order by order by
......
...@@ -224,11 +224,12 @@ public class JgUseRegistrationManageController extends BaseController { ...@@ -224,11 +224,12 @@ public class JgUseRegistrationManageController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据证的sequenceNbr 批量查询证下面的所有设备", notes = "根据证的sequenceNbr 批量查询证下面的所有设备") @ApiOperation(httpMethod = "GET", value = "根据证的sequenceNbr 批量查询证下面的所有设备", notes = "根据证的sequenceNbr 批量查询证下面的所有设备")
public ResponseModel<Page<JSONObject>> queryEquByCertificateSeqList(@RequestParam(value = "current") int current, public ResponseModel<Page<JSONObject>> queryEquByCertificateSeqList(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(value = "size") int size,
@RequestParam(value = "enableType") String enableType,
@RequestParam(value = "sequenceNbrs") String sequenceNbrs) { @RequestParam(value = "sequenceNbrs") String sequenceNbrs) {
List<Long> collect = Arrays.stream(sequenceNbrs.split(",")) List<Long> collect = Arrays.stream(sequenceNbrs.split(","))
.map(Long::parseLong) .map(Long::parseLong)
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryEquForPageByCertificateSeqList(collect, current, size)); return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryEquForPageByCertificateSeqList(enableType,collect, current, size));
} }
/** /**
......
...@@ -14,12 +14,10 @@ import com.yeejoin.amos.boot.module.jg.api.dto.*; ...@@ -14,12 +14,10 @@ import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable; import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory; import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum; import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService; import com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
...@@ -29,10 +27,14 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; ...@@ -29,10 +27,14 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService; import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
...@@ -55,6 +57,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -55,6 +57,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
...@@ -109,6 +112,12 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -109,6 +112,12 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
@Autowired @Autowired
private Sequence sequence; private Sequence sequence;
@Autowired
private IdxBizJgInspectionDetectionInfoServiceImpl jgInspectionDetectionInfoService;
@Autowired
private JgUseRegistrationManageMapper jgUseRegistrationManageMapper;
/** /**
* 设备状态:启用 * 设备状态:启用
*/ */
...@@ -135,8 +144,9 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -135,8 +144,9 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
jgEnableDisable.setCreateDate(new Date()); jgEnableDisable.setCreateDate(new Date());
String submit = String.valueOf(map.get("submit")); String submit = String.valueOf(map.get("submit"));
String pageType = String.valueOf(map.get("formType")); String pageType = String.valueOf(map.get("formType"));
// 设备列表
List<Map<String, Object>> equipments = (List<Map<String, Object>>) map.get("equipments"); List<Map<String, Object>> equipments = (List<Map<String, Object>>) map.get("equipments");
if (SUBMIT_TYPE_FLOW.equals(submit)) {//校验设备不能再多个流程中 if (SUBMIT_TYPE_FLOW.equals(submit)) {// 校验设备不能再多个流程中
this.repeatUsedEquipCheck(equipments, reginParams.getCompany().getCompanyCode()); this.repeatUsedEquipCheck(equipments, reginParams.getCompany().getCompanyCode());
} }
String businessCode = ObjectUtils.isEmpty(map.get("applyType")) ? String.valueOf(map.get("businessCode")) : String.valueOf(map.get("applyType")); String businessCode = ObjectUtils.isEmpty(map.get("applyType")) ? String.valueOf(map.get("businessCode")) : String.valueOf(map.get("applyType"));
...@@ -151,18 +161,18 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -151,18 +161,18 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
if (SUBMIT_TYPE_FLOW.equals(submit)) { if (SUBMIT_TYPE_FLOW.equals(submit)) {
if (map.containsKey("instanceId") && !ObjectUtils.isEmpty(map.get("instanceId"))) { if (map.containsKey("instanceId") && !ObjectUtils.isEmpty(map.get("instanceId"))) {
// 只调用执行API,返回下个节点信息,用于填充业务字段 // 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息 // 组装信息
TaskResultDTO dto = new TaskResultDTO(); TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus"); dto.setResultCode("approvalStatus");
dto.setTaskId(jgEnableDisable.getNextTaskId()); dto.setTaskId(jgEnableDisable.getNextTaskId());
HashMap<String, Object> commMap = new HashMap<>(); HashMap<String, Object> commMap = new HashMap<>();
if (FlowStatusEnum.REJECTED.getName().equals(jgEnableDisable.getAuditStatus()) || FlowStatusEnum.ROLLBACK.getName().equals(jgEnableDisable.getAuditStatus())) { if (FlowStatusEnum.REJECTED.getName().equals(jgEnableDisable.getAuditStatus()) || FlowStatusEnum.ROLLBACK.getName().equals(jgEnableDisable.getAuditStatus())) {
commMap.put("approvalStatus", "提交"); commMap.put("approvalStatus", "提交");
//下一节点执行人单位(下节点接收机构code) // 下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(jgEnableDisable.getReceiveCompanyCode()); dto.setNextExecuteUserCompanyCode(jgEnableDisable.getReceiveCompanyCode());
} else { } else {
commMap.put("approvalStatus", submit); commMap.put("approvalStatus", submit);
//下一节点执行人单位(下节点接收机构code) // 下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(jgEnableDisable.getUseUnitCreditCode()); dto.setNextExecuteUserCompanyCode(jgEnableDisable.getUseUnitCreditCode());
} }
...@@ -207,18 +217,24 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -207,18 +217,24 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
commonService.buildTaskModel(Collections.singletonList(taskModelDto)); commonService.buildTaskModel(Collections.singletonList(taskModelDto));
} }
} else { } else {
// 启用 选择的设备中有超过定期检验有效期的设备,下次检验日期在当前时间之前的,提示:启用的设备中存在超过定期检验有效期的设备。,不能继续下一步。
if (APPLY_TYPE_QY.equals(map.getString("applyType"))) {
List<String> record = equipments.stream().map(equ -> String.valueOf(equ.get("record"))).collect(Collectors.toList());
List<IdxBizJgInspectionDetectionInfo> inspectInfos = jgInspectionDetectionInfoService.checkInspectionInfo(record);
List<Date> nextInspectDates = inspectInfos.stream().map(IdxBizJgInspectionDetectionInfo::getNextInspectDate).collect(Collectors.toList());
Date currentDate = new Date();
nextInspectDates.forEach(next -> {
// 下次检验日期在当前时间之前的
if (next.before(currentDate)) {
throw new BadRequest("启用的设备中存在超过定期检验有效期的设备");
}
});
}
// 启动工作流并返回信息 // 启动工作流并返回信息
workflowResultList = workFlowInfo(submit, jgEnableDisable, receiveOrgCode[0]); workflowResultList = workFlowInfo(submit, jgEnableDisable, receiveOrgCode[0]);
//业务数据组装等 // 业务数据组装等
businessData(submit, reginParams, jgEnableDisable, map, workflowResultList); businessData(submit, reginParams, jgEnableDisable, map, equipments, workflowResultList);
// 关联设备表
for (Map<String, Object> equipment : equipments) {
JgEnableDisableEq jgEnableDisableEq = new JgEnableDisableEq();
jgEnableDisableEq.setEquId(String.valueOf(equipment.get("SEQUENCE_NBR")));
jgEnableDisableEq.setEnableDisableApplyId(jgEnableDisable.getSequenceNbr().toString());
jgEnableDisableEqService.saveOrUpdate(jgEnableDisableEq);
}
} }
commonService.saveExecuteFlowData2Redis(jgEnableDisable.getInstanceId(), buildInstanceRuntimeData(jgEnableDisable)); commonService.saveExecuteFlowData2Redis(jgEnableDisable.getInstanceId(), buildInstanceRuntimeData(jgEnableDisable));
...@@ -271,7 +287,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -271,7 +287,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) { private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY) equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(String.valueOf(equipMap.get("record")), companyCode)); .equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
} }
/** /**
...@@ -312,19 +328,19 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -312,19 +328,19 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
List<TaskModelDto> modelDtos = new ArrayList<>(); List<TaskModelDto> modelDtos = new ArrayList<>();
TaskModelDto dto = new TaskModelDto(); TaskModelDto dto = new TaskModelDto();
//行数据 // 行数据
TaskMessageDto taskMessageDto = new TaskMessageDto(); TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(jgEnableDisable, taskMessageDto); BeanUtils.copyProperties(jgEnableDisable, taskMessageDto);
dto.setModel(taskMessageDto); dto.setModel(taskMessageDto);
//摘要 按原有规则组装 // 摘要 按原有规则组装
dto.setTaskContent( dto.setTaskContent(
String.format("来自%s【%s】的业务办理,【申请单号:%s】", String.format("来自%s【%s】的业务办理,【申请单号:%s】",
ObjectUtils.isEmpty(jgEnableDisable.getEquList()) ? "" : jgEnableDisable.getEquList(), ObjectUtils.isEmpty(jgEnableDisable.getEquList()) ? "" : jgEnableDisable.getEquList(),
ObjectUtils.isEmpty(jgEnableDisable.getSupervisoryCode()) ? "" : jgEnableDisable.getSupervisoryCode(), ObjectUtils.isEmpty(jgEnableDisable.getSupervisoryCode()) ? "" : jgEnableDisable.getSupervisoryCode(),
jgEnableDisable.getApplyNo())); jgEnableDisable.getApplyNo()));
//申请单号 // 申请单号
dto.setTaskCode(jgEnableDisable.getApplyNo()); dto.setTaskCode(jgEnableDisable.getApplyNo());
//业务类型枚举code值 // 业务类型枚举code值
dto.setTaskType(BusinessTypeEnum.JG_EQUIPMENT_START.getCode()); dto.setTaskType(BusinessTypeEnum.JG_EQUIPMENT_START.getCode());
////业务主键 ////业务主键
dto.setRelationId(jgEnableDisable.getSequenceNbr() + ""); dto.setRelationId(jgEnableDisable.getSequenceNbr() + "");
...@@ -336,7 +352,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -336,7 +352,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
/** /**
* 组装业务数据 * 组装业务数据
*/ */
private void businessData(String submitType, ReginParams reginParams, JgEnableDisable jgEnableDisable, JSONObject map, List<WorkflowResultDto> workflowResultList) { private void businessData(String submitType, ReginParams reginParams, JgEnableDisable jgEnableDisable, JSONObject map, List<Map<String, Object>> equipments, List<WorkflowResultDto> workflowResultList) {
// 接收机构 // 接收机构
String[] splitMaintenanceUnitCode = String.valueOf(map.getString("receiveOrgCode")).split("_"); String[] splitMaintenanceUnitCode = String.valueOf(map.getString("receiveOrgCode")).split("_");
jgEnableDisable.setApplyDate(new Date()); jgEnableDisable.setApplyDate(new Date());
...@@ -346,8 +362,20 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -346,8 +362,20 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
jgEnableDisable.setUseUnitName(reginParams.getCompany().getCompanyName()); jgEnableDisable.setUseUnitName(reginParams.getCompany().getCompanyName());
jgEnableDisable.setRemark(String.valueOf(map.get("remark"))); jgEnableDisable.setRemark(String.valueOf(map.get("remark")));
jgEnableDisable.setApplyType(map.getString("applyType")); jgEnableDisable.setApplyType(map.getString("applyType"));
// 设备种类
String equListCode = String.valueOf(map.getString("equListCode"));
jgEnableDisable.setEquListCode(equListCode);
jgEnableDisable.setEquListName(EquipmentClassifityEnum.getNameByCode(equListCode));
jgEnableDisable.setCreateUserCompanyName(reginParams.getCompany().getCompanyName()); jgEnableDisable.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
jgEnableDisable.setPromoter(reginParams.getUserModel().getUserId()); jgEnableDisable.setPromoter(reginParams.getUserModel().getUserId());
// 使用登记证相关
List<String> certificates = (List<String>) map.get("sequenceNbrs");
LambdaQueryWrapper<JgUseRegistrationManage> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(JgUseRegistrationManage::getSequenceNbr, certificates.stream().map(Long::parseLong).collect(Collectors.toList()));
lambdaQueryWrapper.select(JgUseRegistrationManage::getUseRegistrationCode);
List<JgUseRegistrationManage> jgUseRegistrationManageList = jgUseRegistrationManageMapper.selectList(lambdaQueryWrapper);
jgEnableDisable.setRegistrationManageId(String.join(",", certificates));
jgEnableDisable.setUseRegistrationCode(jgUseRegistrationManageList.stream().map(JgUseRegistrationManage::getUseRegistrationCode).collect(Collectors.joining(",")));
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
if (!CollectionUtils.isEmpty(workflowResultList)) { if (!CollectionUtils.isEmpty(workflowResultList)) {
jgEnableDisable.setNextExecuteUserIds(workflowResultList.get(0).getNextExecutorUserIds()); jgEnableDisable.setNextExecuteUserIds(workflowResultList.get(0).getNextExecutorUserIds());
...@@ -366,6 +394,14 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -366,6 +394,14 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
jgEnableDisable.setSupervisoryCode(String.valueOf(map.get("supervisoryCode"))); jgEnableDisable.setSupervisoryCode(String.valueOf(map.get("supervisoryCode")));
jgEnableDisable.setCreateUserName(reginParams.getUserModel().getRealName()); jgEnableDisable.setCreateUserName(reginParams.getUserModel().getRealName());
jgEnableDisable.setCreateUserId(reginParams.getUserModel().getUserId()); jgEnableDisable.setCreateUserId(reginParams.getUserModel().getUserId());
// 关联设备表
for (Map<String, Object> equipment : equipments) {
JgEnableDisableEq jgEnableDisableEq = new JgEnableDisableEq();
jgEnableDisableEq.setEquId(String.valueOf(equipment.get("SEQUENCE_NBR")));
jgEnableDisableEq.setEnableDisableApplyId(jgEnableDisable.getSequenceNbr().toString());
jgEnableDisableEqService.saveOrUpdate(jgEnableDisableEq);
}
} }
...@@ -422,13 +458,23 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -422,13 +458,23 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
String level = reginParams.getCompany().getLevel(); String level = reginParams.getCompany().getLevel();
String userId = reginParams.getUserModel().getUserId(); String userId = reginParams.getUserModel().getUserId();
SortVo sortMap = commonService.sortFieldConversion(sort); SortVo sortMap = commonService.sortFieldConversion(sort);
return this.baseMapper.pageList(page, sortMap, dto, level, userId); Page<Map<String, Object>> mapPage = this.baseMapper.pageList(page, sortMap, dto, level, userId);
List<Map<String, Object>> records = mapPage.getRecords();
// 填充 使用登记证编号 useRegistrationCodes
records.forEach(equEnable -> {
LambdaQueryWrapper<JgEnableDisableEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgEnableDisableEq::getEnableDisableApplyId, equEnable.get("sequenceNbr"));
List<JgEnableDisableEq> eqList = jgEnableDisableEqService.list(queryWrapper);
});
mapPage.setRecords(records);
return mapPage;
} }
public String startByVariable() { public String startByVariable() {
String instanceId = ""; String instanceId = "";
//启动流程 // 启动流程
try { try {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY); dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
...@@ -589,20 +635,22 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -589,20 +635,22 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
// 1.更新设备的使用信息:启用->停用,停用->启用 // 1.更新设备的使用信息:启用->停用,停用->启用
LambdaQueryWrapper<JgEnableDisableEq> lambdaEq = new QueryWrapper<JgEnableDisableEq>().lambda(); LambdaQueryWrapper<JgEnableDisableEq> lambdaEq = new QueryWrapper<JgEnableDisableEq>().lambda();
lambdaEq.eq(JgEnableDisableEq::getEnableDisableApplyId, jgEnableDisable.getSequenceNbr()); lambdaEq.eq(JgEnableDisableEq::getEnableDisableApplyId, jgEnableDisable.getSequenceNbr());
JgEnableDisableEq jgScrapCancelEq = jgEnableDisableEqMapper.selectOne(lambdaEq); List<JgEnableDisableEq> jgEnableDisableEqs = jgEnableDisableEqMapper.selectList(lambdaEq);
IdxBizJgUseInfo idxBizJgUseInfo = new IdxBizJgUseInfo(); jgEnableDisableEqs.forEach(jgEnableDisableEq -> {
if (APPLY_TYPE_QY.equals(jgEnableDisable.getApplyType())) { IdxBizJgUseInfo idxBizJgUseInfo = new IdxBizJgUseInfo();
// 1启用 if (APPLY_TYPE_QY.equals(jgEnableDisable.getApplyType())) {
idxBizJgUseInfo.setEquState(String.valueOf(EquimentEnum.ZAIYONG.getCode())); // 1启用
} else { idxBizJgUseInfo.setEquState(String.valueOf(EquimentEnum.ZAIYONG.getCode()));
// 0停用 } else {
idxBizJgUseInfo.setEquState(String.valueOf(EquimentEnum.TINGYONG.getCode())); // 0停用
} idxBizJgUseInfo.setEquState(String.valueOf(EquimentEnum.TINGYONG.getCode()));
LambdaQueryWrapper<IdxBizJgUseInfo> wrapper = new LambdaQueryWrapper<>(); }
wrapper.eq(IdxBizJgUseInfo::getRecord, jgScrapCancelEq.getEquId()); LambdaQueryWrapper<IdxBizJgUseInfo> wrapper = new LambdaQueryWrapper<>();
idxBizJgUseInfoMapper.update(idxBizJgUseInfo, wrapper); wrapper.eq(IdxBizJgUseInfo::getRecord, jgEnableDisableEq.getEquId());
// 2.更新设备的es数据的状态:启用->停用,停用->启用 idxBizJgUseInfoMapper.update(idxBizJgUseInfo, wrapper);
updateEquipEsData(jgScrapCancelEq, idxBizJgUseInfo); // 2.更新设备的es数据的状态:启用->停用,停用->启用
updateEquipEsData(jgEnableDisableEq, idxBizJgUseInfo);
});
} }
private void updateEquipEsData(JgEnableDisableEq jgScrapCancelEq, IdxBizJgUseInfo idxBizJgUseInfo) { private void updateEquipEsData(JgEnableDisableEq jgScrapCancelEq, IdxBizJgUseInfo idxBizJgUseInfo) {
...@@ -630,7 +678,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -630,7 +678,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO(); ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
WorkflowResultDto workflowResultDto = new WorkflowResultDto(); WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 只调用执行API,返回下个节点信息,用于填充业务字段 // 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息 // 组装信息
TaskResultDTO workDto = new TaskResultDTO(); TaskResultDTO workDto = new TaskResultDTO();
workDto.setResultCode("approvalStatus"); workDto.setResultCode("approvalStatus");
workDto.setTaskId(jgEnableDisable.getNextTaskId()); workDto.setTaskId(jgEnableDisable.getNextTaskId());
......
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgUseRegistrationManageServi ...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgUseRegistrationManageServi
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
...@@ -253,7 +254,7 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -253,7 +254,7 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
* @return * @return
*/ */
public Page<JSONObject> certificateEquList(int current, int size, String sequenceNbr) { public Page<JSONObject> certificateEquList(int current, int size, String sequenceNbr) {
return queryEquForPageByCertificateSeqList(Collections.singletonList(Long.parseLong(sequenceNbr)), current, size); return queryEquForPageByCertificateSeqList("",Collections.singletonList(Long.parseLong(sequenceNbr)), current, size);
} }
/** /**
...@@ -311,12 +312,13 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -311,12 +312,13 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
/** /**
* 根据证的sequenceNbr集合,批量查询证下面的所有设备 * 根据证的sequenceNbr集合,批量查询证下面的所有设备
* *
* @param enableType 启用停用业务使用 - 过滤设备状态 (1:在用 2:停用) 对应枚举:EquimentEnum
* @param sequenceNbrList 证的sequenceNbr集合 * @param sequenceNbrList 证的sequenceNbr集合
* @param current 分页-当前页 * @param current 分页-当前页
* @param size 分页-分页数 * @param size 分页-分页数
* @return 查询结果 * @return 查询结果
*/ */
public Page<JSONObject> queryEquForPageByCertificateSeqList(List<Long> sequenceNbrList, int current, int size) { public Page<JSONObject> queryEquForPageByCertificateSeqList(String enableType,List<Long> sequenceNbrList, int current, int size) {
List<JgUseRegistrationManage> jgUseRegistrationManageList = this.baseMapper.selectList(new LambdaQueryWrapper<JgUseRegistrationManage>() List<JgUseRegistrationManage> jgUseRegistrationManageList = this.baseMapper.selectList(new LambdaQueryWrapper<JgUseRegistrationManage>()
.in(JgUseRegistrationManage::getSequenceNbr, sequenceNbrList) .in(JgUseRegistrationManage::getSequenceNbr, sequenceNbrList)
.eq(JgUseRegistrationManage::getIsDelete, 0)); .eq(JgUseRegistrationManage::getIsDelete, 0));
...@@ -338,6 +340,14 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -338,6 +340,14 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
TermsQueryBuilder termsQuery = QueryBuilders.termsQuery("USE_ORG_CODE", useOrgCodes); TermsQueryBuilder termsQuery = QueryBuilders.termsQuery("USE_ORG_CODE", useOrgCodes);
boolQuery.must(termsQuery); boolQuery.must(termsQuery);
// 设备状态 对应枚举EquimentEnum
if (!ObjectUtils.isEmpty(enableType)) {
BoolQueryBuilder elcBuilder = QueryBuilders.boolQuery();
elcBuilder.must(QueryBuilders.matchPhraseQuery("EQU_STATE", QueryParser.escape(enableType)));
boolQuery.must(elcBuilder);
}
builder.query(boolQuery); builder.query(boolQuery);
builder.from((current - 1) * size); builder.from((current - 1) * size);
builder.size(size); builder.size(size);
......
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