Commit 50a721af authored by zhangsen's avatar zhangsen

更名变更API开发

业务补充
parent c29b4da7
...@@ -22,5 +22,7 @@ public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegis ...@@ -22,5 +22,7 @@ public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegis
void deleteByChangeRegistrationId(@Param("changeRegistrationId") Long changeRegistrationId); void deleteByChangeRegistrationId(@Param("changeRegistrationId") Long changeRegistrationId);
void deleteHistoryInfoById(@Param("code") String code);
Page<Map<String, Object>> getListPage(Page<Map<String, Object>> page, JgChangeRegistrationNameDto dto, List<String> roleIds, String orgCode); Page<Map<String, Object>> getListPage(Page<Map<String, Object>> page, JgChangeRegistrationNameDto dto, List<String> roleIds, String orgCode);
} }
...@@ -57,4 +57,8 @@ ...@@ -57,4 +57,8 @@
</where> </where>
order by ur.rec_date desc order by ur.rec_date desc
</select> </select>
<delete id="deleteHistoryInfoById">
delete from tzs_jg_change_registration_name_eq where current_document_id = #{code}
</delete>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.CancelTypeEnum;
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.JgChangeRegistrationNameMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationNameService; import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationNameService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; 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.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
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.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.AccessFeignService; import com.yeejoin.amos.boot.module.ymt.flc.api.feign.AccessFeignService;
import com.yeejoin.amos.boot.module.ymt.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
...@@ -31,6 +35,7 @@ import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; ...@@ -31,6 +35,7 @@ import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -38,11 +43,10 @@ import org.springframework.util.StringUtils; ...@@ -38,11 +43,10 @@ import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; 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 org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 更名变更登记服务实现类 * 更名变更登记服务实现类
...@@ -57,6 +61,9 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -57,6 +61,9 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
private JgChangeRegistrationNameEqServiceImpl jgChangeRegistrationNameEqService; private JgChangeRegistrationNameEqServiceImpl jgChangeRegistrationNameEqService;
@Autowired @Autowired
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
...@@ -68,6 +75,26 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -68,6 +75,26 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
@Autowired @Autowired
WorkFlowFeignService workFlowFeignService; WorkFlowFeignService workFlowFeignService;
@Autowired
private JgChangeRegistrationReformEqMapper jgChangeRegistrationReformEqMapper;
@Autowired
private JgChangeRegistrationTransferEqMapper jgChangeRegistrationTransferEqMapper;
@Autowired
private JgUseRegistrationEqMapper jgUseRegistrationEqMapper;
@Autowired
private JgChangeRegistrationUnitEqMapper jgChangeRegistrationUnitEqMapper;
@Autowired
private JgChangeRegistrationNameEqMapper jgChangeRegistrationNameEqMapper;
@Autowired
private RegUnitInfoMapper regUnitInfoMapper;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired @Autowired
AccessFeignService accessFeignService; AccessFeignService accessFeignService;
...@@ -170,6 +197,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -170,6 +197,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
this.save(dto); this.save(dto);
List<JgChangeRegistrationNameEq> equipList = new ArrayList<>(); List<JgChangeRegistrationNameEq> equipList = new ArrayList<>();
List<JgRegistrationHistory> list = new ArrayList<>();
deviceList.forEach(obj -> { deviceList.forEach(obj -> {
JgChangeRegistrationNameEq jgRelationEquip = new JgChangeRegistrationNameEq(); JgChangeRegistrationNameEq jgRelationEquip = new JgChangeRegistrationNameEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("equipId"))); jgRelationEquip.setEquId(String.valueOf(obj.get("equipId")));
...@@ -183,11 +211,18 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -183,11 +211,18 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
JgRegistrationHistory jgRegistrationHistory = new JgRegistrationHistory(); JgRegistrationHistory jgRegistrationHistory = new JgRegistrationHistory();
jgRegistrationHistory.setCreateUserId(reginParams.getUserModel().getUserId()); jgRegistrationHistory.setCreateUserId(reginParams.getUserModel().getUserId());
jgRegistrationHistory.setCreateDate(dto.getCreateDate()); jgRegistrationHistory.setCreateDate(dto.getCreateDate());
// jgRegistrationHistory.setUseRegistrationCode(); jgRegistrationHistory.setChangeData(JSON.toJSONString(dto));
// jgRegistrationHistory.setRegistrationClass(); jgRegistrationHistory.setOldData(JSON.toJSONString(dto));
jgRegistrationHistory.setRegistrationClass("使用单位名称变更登记");
jgRegistrationHistory.setStatus("new");
jgRegistrationHistory.setEquId(String.valueOf(obj.get("equipId")));
jgRegistrationHistory.setSupervisoryCode(String.valueOf(obj.get("supervisoryCode")));
jgRegistrationHistory.setUseRegistrationCode(String.valueOf(obj.get("useOrgCode")));
jgRegistrationHistory.setCurrentDocumentId(dto.getApplyNo());
list.add(jgRegistrationHistory);
}); });
jgChangeRegistrationNameEqService.saveBatch(equipList); jgChangeRegistrationNameEqService.saveBatch(equipList);
jgRegistrationHistoryService.saveBatch(list);
} }
public JgChangeRegistrationNameDto updateInfo(String submitType, JgChangeRegistrationNameDto jgChangeRegistrationNameDto, String op) { public JgChangeRegistrationNameDto updateInfo(String submitType, JgChangeRegistrationNameDto jgChangeRegistrationNameDto, String op) {
...@@ -223,10 +258,16 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -223,10 +258,16 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
boolean submit = submit(jgChangeRegistrationName, op); boolean submit = submit(jgChangeRegistrationName, op);
//删除重新生成 eq表数据 //删除重新生成 eq表数据
if (!Objects.isNull(jgChangeRegistrationName.getSequenceNbr())) {
jgChangeRegistrationNameMapper.deleteByChangeRegistrationId(jgChangeRegistrationName.getSequenceNbr()); jgChangeRegistrationNameMapper.deleteByChangeRegistrationId(jgChangeRegistrationName.getSequenceNbr());
}
if (!Objects.isNull(jgChangeRegistrationName.getApplyNo())) {
jgChangeRegistrationNameMapper.deleteHistoryInfoById(jgChangeRegistrationName.getApplyNo());
}
List<Map<String, Object>> deviceList = jgChangeRegistrationNameMapper.getEquipInfoByOrgCode(reginParams.getCompany().getCompanyCode());
List<Map<String, Object>> deviceList = jgChangeRegistrationNameMapper.getEquipInfoByOrgCode(reginParams.getCompany().getCompanyCode());
List<JgRegistrationHistory> list = new ArrayList<>();
List<JgChangeRegistrationNameEq> equipList = new ArrayList<>(); List<JgChangeRegistrationNameEq> equipList = new ArrayList<>();
deviceList.forEach(obj -> { deviceList.forEach(obj -> {
JgChangeRegistrationNameEq jgRelationEquip = new JgChangeRegistrationNameEq(); JgChangeRegistrationNameEq jgRelationEquip = new JgChangeRegistrationNameEq();
...@@ -237,9 +278,23 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -237,9 +278,23 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
jgRelationEquip.setCreateUserId(reginParams.getUserModel().getUserId()); jgRelationEquip.setCreateUserId(reginParams.getUserModel().getUserId());
jgRelationEquip.setCreateUserName(reginParams.getUserModel().getRealName()); jgRelationEquip.setCreateUserName(reginParams.getUserModel().getRealName());
equipList.add(jgRelationEquip); equipList.add(jgRelationEquip);
JgRegistrationHistory jgRegistrationHistory = new JgRegistrationHistory();
jgRegistrationHistory.setCreateUserId(reginParams.getUserModel().getUserId());
jgRegistrationHistory.setCreateDate(jgChangeRegistrationName.getCreateDate());
jgRegistrationHistory.setChangeData(JSON.toJSONString(jgChangeRegistrationName));
jgRegistrationHistory.setOldData(JSON.toJSONString(jgChangeRegistrationName));
jgRegistrationHistory.setRegistrationClass("使用单位名称变更登记");
jgRegistrationHistory.setStatus("new");
jgRegistrationHistory.setEquId(String.valueOf(obj.get("equipId")));
jgRegistrationHistory.setSupervisoryCode(String.valueOf(obj.get("supervisoryCode")));
jgRegistrationHistory.setUseRegistrationCode(String.valueOf(obj.get("useOrgCode")));
jgRegistrationHistory.setCurrentDocumentId(jgChangeRegistrationName.getApplyNo());
list.add(jgRegistrationHistory);
}); });
jgChangeRegistrationNameEqService.saveBatch(equipList); jgChangeRegistrationNameEqService.saveBatch(equipList);
jgRegistrationHistoryService.saveBatch(list);
if (submit) { if (submit) {
// 查询下节点任务 // 查询下节点任务
getNext(roleListSecond, jgChangeRegistrationName.getInstanceId(), taskName); getNext(roleListSecond, jgChangeRegistrationName.getInstanceId(), taskName);
...@@ -332,8 +387,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -332,8 +387,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
} }
public void revocation(String instanceId) { public void revocation(String instanceId) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName(); String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
...@@ -441,14 +494,72 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -441,14 +494,72 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
jgChangeRegistrationName.setPromoter(null); jgChangeRegistrationName.setPromoter(null);
} }
} else { } else {
// TODO: 2023/12/25 流程完成后业务开发
jgChangeRegistrationName.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName()); jgChangeRegistrationName.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName());
jgChangeRegistrationName.setAuditPassDate(new Date()); jgChangeRegistrationName.setAuditPassDate(new Date());
// 修改业务信息
updateInfoOther(jgChangeRegistrationName);
} }
this.getBaseMapper().updateById(jgChangeRegistrationName); this.getBaseMapper().updateById(jgChangeRegistrationName);
} }
public void updateInfoOther(JgChangeRegistrationName jgChangeRegistrationName) {
LambdaQueryWrapper<JgChangeRegistrationNameEq> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(JgChangeRegistrationNameEq::getNameChangeRegistrationId, jgChangeRegistrationName.getSequenceNbr());
List<String> collect = jgChangeRegistrationNameEqService.list(wrapper).stream().map(JgChangeRegistrationNameEq::getEquId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
LambdaUpdateWrapper<JgChangeRegistrationReformEq> updateWrapper1 = new LambdaUpdateWrapper<>();
updateWrapper1.in(JgChangeRegistrationReformEq::getEquId, collect);
updateWrapper1.ne(JgChangeRegistrationReformEq::getEquipTransferId, jgChangeRegistrationName.getSequenceNbr());
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = new JgChangeRegistrationReformEq();
jgChangeRegistrationReformEq.setIsInvalid(Boolean.TRUE);
jgChangeRegistrationReformEqMapper.update(jgChangeRegistrationReformEq, updateWrapper1);
LambdaUpdateWrapper<JgChangeRegistrationTransferEq> updateWrapper2 = new LambdaUpdateWrapper<>();
updateWrapper2.in(JgChangeRegistrationTransferEq::getEquId, collect);
updateWrapper2.ne(JgChangeRegistrationTransferEq::getEquipTransferId, jgChangeRegistrationName.getSequenceNbr());
JgChangeRegistrationTransferEq jgChangeRegistrationTransferEq = new JgChangeRegistrationTransferEq();
jgChangeRegistrationReformEq.setIsInvalid(Boolean.TRUE);
jgChangeRegistrationTransferEqMapper.update(jgChangeRegistrationTransferEq, updateWrapper2);
LambdaUpdateWrapper<JgUseRegistrationEq> updateWrapper3 = new LambdaUpdateWrapper<>();
updateWrapper3.in(JgUseRegistrationEq::getEquId, collect);
updateWrapper3.ne(JgUseRegistrationEq::getEquipTransferId, jgChangeRegistrationName.getSequenceNbr());
JgUseRegistrationEq jgUseRegistrationEq = new JgUseRegistrationEq();
jgUseRegistrationEq.setIsInvalid(Boolean.TRUE);
jgUseRegistrationEqMapper.update(jgUseRegistrationEq, updateWrapper3);
LambdaUpdateWrapper<JgChangeRegistrationUnitEq> updateWrapper4 = new LambdaUpdateWrapper<>();
updateWrapper4.in(JgChangeRegistrationUnitEq::getEquId, collect);
updateWrapper4.ne(JgChangeRegistrationUnitEq::getUnitChangeRegistrationId, jgChangeRegistrationName.getSequenceNbr());
JgChangeRegistrationUnitEq jgChangeRegistrationUnitEq = new JgChangeRegistrationUnitEq();
jgChangeRegistrationUnitEq.setIsInvalid("1");
jgChangeRegistrationUnitEqMapper.update(jgChangeRegistrationUnitEq, updateWrapper4);
LambdaUpdateWrapper<JgChangeRegistrationNameEq> updateWrapper5 = new LambdaUpdateWrapper<>();
updateWrapper5.in(JgChangeRegistrationNameEq::getEquId, collect);
updateWrapper5.ne(JgChangeRegistrationNameEq::getNameChangeRegistrationId, jgChangeRegistrationName.getSequenceNbr());
JgChangeRegistrationNameEq jgChangeRegistrationNameEq = new JgChangeRegistrationNameEq();
jgChangeRegistrationNameEq.setIsInvalid("1");
jgChangeRegistrationNameEqMapper.update(jgChangeRegistrationNameEq, updateWrapper5);
}
LambdaUpdateWrapper<RegUnitInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(RegUnitInfo::getUnitCode, jgChangeRegistrationName.getUseUnitCreditCode());
RegUnitInfo regUnitInfo = new RegUnitInfo();
regUnitInfo.setName(jgChangeRegistrationName.getNewUseUnitName());
regUnitInfoMapper.update(regUnitInfo, updateWrapper);
LambdaUpdateWrapper<TzBaseEnterpriseInfo> updateWrapper2 = new LambdaUpdateWrapper<>();
updateWrapper2.eq(TzBaseEnterpriseInfo::getUseCode, jgChangeRegistrationName.getUseUnitCreditCode());
TzBaseEnterpriseInfo tzBaseEnterpriseInfo = new TzBaseEnterpriseInfo();
regUnitInfo.setName(jgChangeRegistrationName.getNewUseUnitName());
tzBaseEnterpriseInfoMapper.update(tzBaseEnterpriseInfo, updateWrapper2);
// TODO: 2023/12/25 修改平台机构名称
}
public Map<String, Object> queryBySequenceNbr(Long sequenceNbr) { public Map<String, Object> queryBySequenceNbr(Long sequenceNbr) {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// Map<String, Object> resultMap = accessFeignService.getData(reginParams.getCompany().getCompanyCode()).getResult(); // Map<String, Object> resultMap = accessFeignService.getData(reginParams.getCompany().getCompanyCode()).getResult();
......
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