Commit 6682bc4c authored by yangyang's avatar yangyang

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 223af8e0 2f9265fc
......@@ -100,7 +100,7 @@ public class JgChangeRegistrationReformDto extends BaseDto {
private String receiveCompanyCode;
@ApiModelProperty(value = "下一执行节点ids")
private String nextExecuteIds;
private String nextExecutorIds;
@ApiModelProperty(value = "改造告知申请id")
private String reformNoticeId;
......
......@@ -192,8 +192,8 @@ public class JgChangeRegistrationReform extends BaseEntity {
/**
* 下一执行节点ids
*/
@TableField("next_execute_ids")
private String nextExecuteIds;
@TableField("next_executor_ids")
private String nextExecutorIds;
/**
* 任务发起人id
......
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* Mapper 接口
......@@ -10,5 +12,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2023-12-20
*/
public interface JgRegistrationHistoryMapper extends BaseMapper<JgRegistrationHistory> {
@Select("select sequence_nbr from jg_registration_history where equ_id = #{equid} and current_document_id = #{documentId}")
Long getSequenceNbrByEquidAndDocumentId(@Param("equid") String equid, @Param("documentId") String documentId);
}
......@@ -12,20 +12,17 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.UseStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationReformEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationReformMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationTransferEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationReformService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationReformDto;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsElevator;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.boot.module.ymt.api.service.ICreateCodeService;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -38,11 +35,13 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
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.utils.ResponseModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 改造变更登记服务实现类
......@@ -51,7 +50,14 @@ import java.util.Map;
* @date 2023-12-20
*/
@Service
public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeRegistrationReformDto,JgChangeRegistrationReform,JgChangeRegistrationReformMapper> implements IJgChangeRegistrationReformService {
public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeRegistrationReformDto, JgChangeRegistrationReform, JgChangeRegistrationReformMapper> implements IJgChangeRegistrationReformService {
@Autowired
WorkFlowFeignService workFlowFeginService;
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
RedisUtils redisUtils;
@Autowired
private UseInfoMapper useInfoMapper;
@Autowired
......@@ -66,22 +72,26 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
//移装登记关系表
@Autowired
private JgChangeRegistrationTransferEqMapper jgChangeRegistrationTransferEqMapper;
@Autowired
private IdxBizJgTechParamsElevatorMapper idxBizJgTechParamsElevatorMapper;
@Autowired
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
//使用登记关系表mapper
@Autowired
private JgUseRegistrationEqMapper jgUseRegistrationEqMapper;
@Autowired
WorkFlowFeignService workFlowFeginService;
private IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
@Autowired
private ICreateCodeService iCreateCodeService;
@Autowired
RedisUtils redisUtils;
private IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
/**
* 分页查询
*/
public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, Page<Map<String, Object>> page , List<String> roleIds) {
public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, Page<Map<String, Object>> page, List<String> roleIds) {
Page<Map<String, Object>> listPage = this.baseMapper.getListPage(page, dto, roleIds);
return listPage;
}
......@@ -89,6 +99,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
public Page<Map<String, Object>> getEquipList(Page<Map<String, Object>> page, String factoryNum, String equList, String equCategory) {
return this.baseMapper.getEquipListPage(page, factoryNum, equList, equCategory);
}
@Transactional
public void save(JSONObject map) {
UseInfo useInfo = new UseInfo();
......@@ -114,12 +125,25 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform.setUseUnitCreditCode(useInfo.getUseUnitCreditCode());
jgChangeRegistrationReform.setInspectUnitCreditCode(map.get("inspectUnitCreditCode").toString());
jgChangeRegistrationReform.setInspectUnitName(map.get("inspectOrgName").toString());
JgRegistrationHistory jgRegistrationHistory =new JgRegistrationHistory();
//使用登记编号
jgRegistrationHistory.setUseRegistrationCode(idxBizJgRegisterInfoMapper.getUseOrgCodeByEquip(map.get("equipId").toString()));
//登记类别
jgRegistrationHistory.setRegistrationClass("改造登记");
//设备id
jgRegistrationHistory.setEquId(map.get("equipId").toString());
//修改数据
jgRegistrationHistory.setChangeData(JSONObject.toJSONString(map));
//设备监管码
jgRegistrationHistory.setSupervisoryCode(supervisoryCode);
//数据状态
jgRegistrationHistory.setStatus("new");
if (map.containsKey("type") && "edit".equals(String.valueOf(map.get("type")))) {
jgChangeRegistrationReform.setUseUnitCreditCode(null);
jgChangeRegistrationReform.setSequenceNbr(Long.valueOf(String.valueOf(map.get("sequenceNbr"))));
this.getBaseMapper().updateById(jgChangeRegistrationReform);
jgRegistrationHistory.setSequenceNbr(jgRegistrationHistoryMapper.getSequenceNbrByEquidAndDocumentId(map.get("equipId").toString(),String.valueOf(map.get("sequenceNbr"))));
jgRegistrationHistoryMapper.updateById(jgRegistrationHistory);
} else {
// 业务管理设备信息保存
......@@ -133,6 +157,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
this.save(jgChangeRegistrationReform);
jgChangeRegistrationReformEq.setEquipTransferId(jgChangeRegistrationReform.getSequenceNbr().toString());
jgChangeRegistrationReformEqMapper.insert(jgChangeRegistrationReformEq);
//当前单据id
jgRegistrationHistory.setCurrentDocumentId(jgChangeRegistrationReform.getSequenceNbr().toString());
jgRegistrationHistoryMapper.insert(jgRegistrationHistory);
}
if (!ObjectUtils.isEmpty(map.get("submit"))) {
......@@ -156,6 +183,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform.setInstanceId(instanceId);
this.getBaseMapper().updateById(jgChangeRegistrationReform);
}
}
......@@ -223,12 +251,13 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
lambda.eq(JgChangeRegistrationReform::getSequenceNbr, id);
JgChangeRegistrationReform jgChangeRegistrationReform = this.getBaseMapper().selectOne(lambda);
if ("流程结束".equals(taskName)) {
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqMapper.selectOne(new QueryWrapper<JgChangeRegistrationReformEq>().eq("equip_transfer_id",jgChangeRegistrationReform.getSequenceNbr()));
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqMapper.selectOne(new QueryWrapper<JgChangeRegistrationReformEq>().eq("equip_transfer_id", jgChangeRegistrationReform.getSequenceNbr()));
jgChangeRegistrationReform.setStatus(taskName);
jgChangeRegistrationReform.setAuditStatus("已完成");
makeEquipmentsInvalid(jgChangeRegistrationReformEq.getEquId(),jgChangeRegistrationReform.getSequenceNbr().toString());
//交换历史数据与新增数据
updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString());
} else {
jgChangeRegistrationReform.setNextExecuteIds(role);
jgChangeRegistrationReform.setNextExecutorIds(role);
jgChangeRegistrationReform.setPromoter(reginParams.getUserModel().getUserId());
if (!ObjectUtils.isEmpty(jgChangeRegistrationReform.getInstanceStatus())) {
jgChangeRegistrationReform.setInstanceStatus(jgChangeRegistrationReform.getInstanceStatus() + "," + role);
......@@ -286,11 +315,20 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
LambdaQueryWrapper<JgChangeRegistrationReform> lambda = new QueryWrapper<JgChangeRegistrationReform>().lambda();
lambda.in(JgChangeRegistrationReform::getSequenceNbr, ids);
this.update(jgChangeRegistrationReform, lambda);
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = new JgChangeRegistrationReformEq();
jgChangeRegistrationReformEq.setIsDelete(true);
LambdaQueryWrapper<JgChangeRegistrationReformEq> lambda1 = new QueryWrapper<JgChangeRegistrationReformEq>().lambda();
lambda1.in(JgChangeRegistrationReformEq::getEquipTransferId, ids);
jgChangeRegistrationReformEqMapper.update(jgChangeRegistrationReformEq, lambda1);
}
public Map<String, Object> getDetail(String id) {
Map<String, Object> detail = this.baseMapper.getDetail(id);
Map<String, Object> inspectDetail = this.baseMapper.getInspectDetail(id);
Map<String, Object> useDetail = this.baseMapper.getUseDetail(id);
if(detail.get("").equals("已完成")){
}
detail.putAll(inspectDetail);
detail.putAll(useDetail);
detail.putAll(useDetail);
......@@ -305,12 +343,66 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
/**
* 批量设置设备无效(使用登记、移装登记、改造登记)
*
* @param equipmentId 装备id
* @param currentDocumentId 当前文档id
*/
public void makeEquipmentsInvalid(String equipmentId,String currentDocumentId){
jgChangeRegistrationReformEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId,currentDocumentId);
jgChangeRegistrationTransferEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId,currentDocumentId);
jgUseRegistrationEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId,currentDocumentId);
public void makeEquipmentsInvalid(String equipmentId, String currentDocumentId) {
jgChangeRegistrationReformEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
jgChangeRegistrationTransferEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
jgUseRegistrationEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
}
/**
* 流程完成之后互换数据并更新设备状态
* @param equipId
* @param currentDocumentId
*/
public void updateTechparamsByEquIdAndCurrentDoucumentId(String equipId, String currentDocumentId){
ResponseModel<String> responseModel = tzsServiceFeignClient.useRegistrationCode(idxBizJgOtherInfoMapper.getSupervisoryCodeByEquipmentCode(equipId));
String newUseRegistrationCertificateNumber=responseModel.getResult().split("-")[0];
IdxBizJgTechParamsElevator idxBizJgTechParamsElevator =idxBizJgTechParamsElevatorMapper.selectOne(new QueryWrapper<IdxBizJgTechParamsElevator>().eq("RECORD",equipId));
JgRegistrationHistory jgRegistrationHistory=jgRegistrationHistoryMapper.selectOne(new QueryWrapper<JgRegistrationHistory>()
.eq("equ_id",equipId)
.eq("current_document_id",currentDocumentId)
.eq("registration_class","改造登记"));
if(!ObjectUtils.isEmpty(idxBizJgTechParamsElevator)&&!ObjectUtils.isEmpty(jgRegistrationHistory)){
//历史数据
String historyData = JSONObject.toJSONString(idxBizJgTechParamsElevator);
//当前数据
String newData = jgRegistrationHistory.getChangeData();
//将历史数据更新到技术参数表中
IdxBizJgTechParamsElevator idxBizJgTechParamsElevatorNew = JSONObject.parseObject(newData,IdxBizJgTechParamsElevator.class);
BeanUtil.copyProperties(idxBizJgTechParamsElevatorNew,idxBizJgTechParamsElevator,new String[]{"SEQUENCE_NBR","RECORD"});
idxBizJgTechParamsElevatorMapper.updateById(idxBizJgTechParamsElevator);
//将历史数据回填到历史记录表中
jgRegistrationHistory.setChangeData(historyData);
jgRegistrationHistory.setStatus("history");
jgRegistrationHistoryMapper.updateById(jgRegistrationHistory);
makeEquipmentsInvalid(equipId,currentDocumentId);
//更新使用注册登记证编号
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(equipId,newUseRegistrationCertificateNumber);
//es中的编号信息
Map<String,Map<String,Object>> resultMap = new HashMap<>();
Map<String,Object> map1 =new HashMap<>();
map1.put("USE_ORG_CODE",newUseRegistrationCertificateNumber );
resultMap.put(equipId,map1);
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
}
}
/*
* 获取电梯的原始技术参数
* @param equipId
*/
public Map<String,Object> getOriginalTechParams(String equipId){
Map<String,Object> result = new HashMap<>();
IdxBizJgTechParamsElevator idxBizJgTechParamsElevator =idxBizJgTechParamsElevatorMapper.selectOne(new QueryWrapper<IdxBizJgTechParamsElevator>().eq("RECORD",equipId));
if(!ObjectUtils.isEmpty(idxBizJgTechParamsElevator)){
result = JSONObject.parseObject(JSONObject.toJSONString(idxBizJgTechParamsElevator),Map.class);
result.remove("sequenceNbr");
}
return result;
}
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 安全追溯-其他信息表 Mapper 接口
......@@ -10,5 +12,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2023-08-17
*/
public interface IdxBizJgOtherInfoMapper extends BaseMapper<IdxBizJgOtherInfo> {
@Select("select SUPERVISORY_CODE from idx_biz_jg_other_info where record = #{equipmentCode}")
String getSupervisoryCodeByEquipmentCode(@Param("equipmentCode") String equipmentCode);
}
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 注册登记信息表 Mapper 接口
......@@ -11,4 +13,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface IdxBizJgRegisterInfoMapper extends BaseMapper<IdxBizJgRegisterInfo> {
@Select("select use_org_code from idx_biz_jg_register_info where record = #{equipCode}")
String getUseOrgCodeByEquip(@Param("equipCode") String equipCode);
@Select("updateidx_biz_jg_register_info set use_org_code = #{useOrgCode} where record = #{equipCode}")
Boolean updateUseOrgCodeByEquip(@Param("equipCode") String equipCode,@Param("useOrgCode") String useOrgCode);
}
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