Commit dca56650 authored by LiuLin's avatar LiuLin

fix(JG):设备移交代码列表合并代码提交

parent 36701af0
......@@ -118,4 +118,10 @@ public class JgEquipTransferDto extends BaseDto {
@ApiModelProperty(value = "流程建议")
private String processAdvice;
@ApiModelProperty(value = "使用单位统一信用代码-数据隔离使用")
private String useUnitCodeFilter;
@ApiModelProperty(value = "施工单位统一信用代码-数据隔离使用")
private String installUnitCodeFilter;
}
......@@ -165,4 +165,10 @@ public class JgEquipTransfer extends BaseEntity {
*/
@TableField(exist = false)
private String equList;
/**
* 下一节点可执行人逗号分割
*/
@TableField(value = "next_execute_user_ids")
private String nextExecuteUserIds;
}
......@@ -15,7 +15,7 @@ import java.util.Map;
* @date 2023-12-20
*/
public interface JgEquipTransferMapper extends CustomBaseMapper<JgEquipTransfer> {
Page<JgEquipTransferDto> queryForPage(Page<JgEquipTransferDto> page, @Param("param") JgEquipTransferDto model, @Param("type") String type, @Param("companyCode") String companyCode);
Page<JgEquipTransferDto> queryForPage(Page<JgEquipTransferDto> page, @Param("param") JgEquipTransferDto model);
@MapKey("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(Long sequenceNbr);
......
......@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEquipTransferDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEquipTransfer;
import java.util.Map;
/**
......@@ -22,10 +21,9 @@ public interface IJgEquipTransferService extends IService<JgEquipTransfer> {
*
* @param page 分页对象
* @param dto 查询参数
* @param type 类型:enterprise-企业端、supervision-监管端
* @return 设备移交分页列表
*/
Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransferDto> page, JgEquipTransferDto dto, String type, ReginParams reginParams);
Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransferDto> page, JgEquipTransferDto dto, ReginParams reginParams);
/**
* 根据sequenceNbr查询
......
......@@ -81,13 +81,24 @@
AND date_format(jet.apply_date, '%Y-%m-%d') = #{param.applyDate}
</if>
</if>
<if test="type == 'useUnit'">
AND jet.use_unit_credit_code = #{companyCode}
</if>
<if test="type == 'installUnit'">
AND jet.install_unit_credit_code = #{companyCode}
AND jet.instance_id is not null
</if>
<choose>
<when test="param.useUnitCodeFilter != '' and param.useUnitCodeFilter != null and
param.installUnitCodeFilter != '' and param.installUnitCodeFilter != null">
-- 同时有使用单位和施工单位
and (jet.use_unit_credit_code = #{param.useUnitCodeFilter}
or jet.install_unit_credit_code = #{param.installUnitCodeFilter})
</when>
<otherwise >
-- 只有使用单位或者施工单位
<if test="param.useUnitCodeFilter != '' and param.useUnitCodeFilter != null">
and jet.use_unit_credit_code = #{param.useUnitCodeFilter}
</if>
<if test="param.installUnitCodeFilter != '' and param.installUnitCodeFilter != null">
and jet.install_unit_credit_code = #{param.installUnitCodeFilter}
AND jet.instance_id is not null
</if>
</otherwise>
</choose>
</where>
ORDER BY jet.apply_date DESC
</select>
......
......@@ -113,10 +113,9 @@ public class JgEquipTransferController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "设备移交分页查询", notes = "设备移交分页查询")
public ResponseModel<Page<JgEquipTransferDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@ApiParam(value = "类型:useUnit-使用单位、installUnit-施工单位", required = true) @RequestParam(value = "type", defaultValue = "useUnit") String type,
@RequestBody(required = false) JgEquipTransferDto dto) {
Page<JgEquipTransferDto> page = new Page<>(current, size);
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.queryForJgEquipTransferPage(page, dto, type, getSelectedOrgInfo()));
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.queryForJgEquipTransferPage(page, dto, getSelectedOrgInfo()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
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.RedisUtils;
......@@ -14,14 +15,14 @@ import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEquipTransferEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEquipTransferMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgEquipTransferService;
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.ymt.api.common.BaseException;
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.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.util.StringUtils;
......@@ -49,25 +50,16 @@ import java.util.stream.Stream;
*/
@Slf4j
@Service
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto, JgEquipTransfer, JgEquipTransferMapper> implements IJgEquipTransferService {
private static final String EQUIP_TRANSFER_PROCESS_KEY = "equipmentHandover";
private static final String SUBMIT_TYPE_FLOW = "1";
@Autowired
JgEquipTransferEqMapper jgEquipTransferEqMapper;
@Autowired
OtherInfoMapper tzsJgOtherInfoMapper;
@Autowired
RegistrationInfoMapper tzsJgRegistrationInfoMapper;
@Autowired
RedisUtils redisUtils;
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
CmWorkflowServiceImpl workflowService;
@Autowired
CommonServiceImpl commonService;
@Autowired
CmWorkflowServiceImpl cmWorkflowService;
private final JgEquipTransferEqMapper jgEquipTransferEqMapper;
private final RedisUtils redisUtils;
private final TzsServiceFeignClient tzsServiceFeignClient;
private final CommonServiceImpl commonService;
private final CmWorkflowServiceImpl cmWorkflowService;
private final IJgInstallationNoticeService jrmInstallationNoticeService;
/**
* 保存和保存并提交
......@@ -383,10 +375,27 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
.build()));
}
}
private String getStringFromMap(Map<String, Object> map, String key) {
return map.getOrDefault(key, "").toString();
}
@Override
public Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransferDto> page, JgEquipTransferDto dto, String type, ReginParams reginParams) {
Page<JgEquipTransferDto> equipTransferPage = this.baseMapper.queryForPage(page, dto, type, reginParams.getCompany().getCompanyCode());
public Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransferDto> page, JgEquipTransferDto dto, ReginParams reginParams) {
CompanyBo company = reginParams.getCompany();
Map<String, Object> companyTypeMap = jrmInstallationNoticeService.getCompanyType();
String companyLevel = getStringFromMap(companyTypeMap, "companyLevel");
String companyType = getStringFromMap(companyTypeMap, "companyType");
if ("company".equals(companyLevel) && companyType != null) {
if (companyType.contains("use")) {
dto.setUseUnitCodeFilter(company.getCompanyCode());
}
if (companyType.contains("construction")) {
dto.setInstallUnitCodeFilter(company.getCompanyCode());
}
}
Page<JgEquipTransferDto> equipTransferPage = this.baseMapper.queryForPage(page, dto);
Page<JgEquipTransferDto> equipTransferDtoPage = new Page<>();
BeanUtils.copyProperties(equipTransferPage, equipTransferDtoPage, "records");
List<JgEquipTransferDto> records = equipTransferPage.getRecords().stream().map(transfer -> {
......@@ -496,6 +505,7 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
dto.setInstanceStatus(workflowResult.getNextExecutorRoleIds() + "," + workflowResult.getExecutorRoleIds());
dto.setPromoter(reginParams.getUserModel().getUserId());
dto.setNextTaskId(workflowResult.getNextTaskId());
dto.setNextExecuteUserIds(workflowResult.getNextExecutorUserIds());
}
if (!CollectionUtils.isEmpty(workflowResultList)) {
dto.setInstanceId(workflowResultList.get(i).getInstanceId());
......@@ -538,5 +548,4 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
equipTransferInfo.put("installUnitCreditCode", equipTransfer.getInstallUnitCreditCode() + "_" + equipTransfer.getInstallUnitName());
return equipTransferInfo;
}
}
\ No newline at end of file
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