Commit dca56650 authored by LiuLin's avatar LiuLin

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

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