Commit 4f029726 authored by 韩桐桐's avatar 韩桐桐

feat(jg):移装告知列表字段调整,搜索条件调整,列表日期字段支持排序

parent 63b14cae
......@@ -221,9 +221,24 @@ public class JgTransferNoticeDto extends BaseDto {
private String supervisoryCode;
@ApiModelProperty (value = "设备种类")
private String equList;
@ApiModelProperty (value = "设备类别")
private String equCategory;
@ApiModelProperty (value = "设备品种")
private String equDefine;
@ApiModelProperty (value = "设备代码")
private String equCode;
@ApiModelProperty (value = "告知书编号")
private String informNumber;
@ApiModelProperty (value = "96333码")
private String code96333;
@ApiModelProperty (value = "下一节点可执行人")
private String nextExecuteUserIds;
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
......@@ -17,7 +18,11 @@ import java.util.Map;
*/
public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotice> {
Page<JgTransferNotice> queryForPage(Page<JgTransferNotice> page, @Param("param") JgTransferNoticeDto model, @Param("type") String type, @Param("orgCode") String orgCode);
Page<Map<String,Object>> queryForPage(Page<JgTransferNotice> page,
@Param("sort") SortVo sortMap,
@Param("param") JgTransferNoticeDto model,
@Param("type") String type,
@Param("orgCode") String orgCode);
@MapKey("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
......
......@@ -23,7 +23,7 @@ public interface IJgTransferNoticeService extends IService<JgTransferNotice> {
JgTransferNoticeDto updateTransferNotice(String submitType, JgTransferNoticeDto noticeDto, String op);
Page<JgTransferNoticeDto> queryForJgTransferNoticePage(Page<JgTransferNotice> page, JgTransferNoticeDto model, String type, ReginParams reginParams);
Page<Map<String,Object>> queryForJgTransferNoticePage(Page<JgTransferNotice> page,String sort, JgTransferNoticeDto model, String type, ReginParams reginParams);
Boolean deleteForBatch(Long[] sequenceNbrs);
......
......@@ -31,7 +31,7 @@
isn.next_execute_ids as nextExecuteIds,
isn.inform_number AS informNumber,
isn.equ_category AS equCategory,
isn.next_task_id as nextTaskId
isn.next_task_id as nextTaskId,
ri.EQU_CODE AS equCode,
oi.SUPERVISORY_CODE AS supervisoryCode,
oi.CODE96333 as code96333,
......
......@@ -2,11 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice">
<select id="queryForPage" resultType="java.util.Map">
select
tjtn.sequence_nbr AS sequenceNbr,
tjtn.apply_no AS applyNo,
tjtn.notice_date AS noticeDate,
tjtn.use_unit_name AS useUnitName,
tjtn.receive_org_name AS receiveOrgName,
tjtn.address AS address,
......@@ -18,25 +17,31 @@
tjtn.street_name AS streetName,
tjtn.instance_id AS instanceId,
tjtn.transfer_type AS transferType,
tjtn.plan_date AS planDate,
tjtn.promoter AS promoter,
tjtn.next_execute_ids AS nextExecuteIds,
tjtn.instance_status AS instanceStatus,
tjtn.notice_report_url AS noticeReportUrl,
(select ec."name" from tz_equipment_category ec WHERE ec.code = ri.equ_category) AS equipCateName,
tjtn.handle_date AS handleDate,
tjtn.inform_number AS informNumber,
tjtn.create_user_id as createUserId,
tjtn.next_execute_user_ids as nextExecuteUserIds,
(select oi.SUPERVISORY_CODE from idx_biz_jg_other_info oi WHERE oi.RECORD = re.equ_id) as supervisoryCode,
tjtn.next_task_id AS nextTaskId,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME", '', ibjui."ADDRESS") as equAddress,
ei.address as useUnitLeaderAddress
ibjui."ADDRESS" as detailedAddress,
ri.EQU_CODE AS equCode,
oi.CODE96333 as code96333,
oi.SUPERVISORY_CODE AS supervisoryCode,
DATE_FORMAT(tjtn.notice_date,'%Y-%m-%d') AS noticeDate,
DATE_FORMAT(tjtn.handle_date,'%Y-%m-%d') AS handleDate,
DATE_FORMAT(tjtn.plan_date,'%Y-%m-%d') AS planDate,
(SELECT name from tz_equipment_category ec WHERE ec.code = ri.EQU_LIST) AS equList,
(select name from tz_equipment_category ec WHERE ec.code = ri.EQU_DEFINE) AS equDefine,
(select ec."name" from tz_equipment_category ec WHERE ec.code = ri.equ_category) AS equipCateName,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME") as equAddress
FROM
tzs_jg_transfer_notice tjtn
LEFT JOIN tzs_jg_transfer_notice_eq re ON re.equip_transfer_id = tjtn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ibjui on re.equ_id = ibjui.RECORD
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = tjtn.use_unit_credit_code
LEFT JOIN idx_biz_jg_use_info ibjui on ibjui.RECORD = re.equ_id
LEFT JOIN idx_biz_jg_other_info oi ON oi.RECORD = re.equ_id
<where>
tjtn.is_delete = false
<if test="param != null ">
......@@ -61,19 +66,61 @@
<if test="param.transferType != null and param.transferType != '' and param.transferType == '10003'">
AND tjtn.transfer_type = '跨区移装'
</if>
<if test="param.equList != null and param.equList != ''">
AND ri."EQU_LIST" = #{param.equList}
</if>
<if test="param.equCategory != null and param.equCategory != ''">
AND ri."equ_category" = #{param.equCategory}
</if>
<if test="param.equDefine != null and param.equDefine != ''">
AND ri."EQU_DEFINE" = #{param.equDefine}
</if>
<if test="param.equCode != null and param.equCode != ''">
AND ri."EQU_CODE" like concat('%',#{param.equCode},'%')
</if>
<if test="param.informNumber != null and param.informNumber != ''">
AND tjtn.inform_number like concat('%',#{param.informNumber},'%')
</if>
<if test="param.code96333 != null and param.code96333 != ''">
AND oi.CODE96333 like concat('%',#{param.code96333},'%')
</if>
<if test="param.supervisoryCode != null and param.supervisoryCode != ''">
AND oi.SUPERVISORY_CODE like concat('%',#{param.supervisoryCode},'%')
</if>
<if test="param.noticeDate != null">
AND tjtn.notice_date LIKE CONCAT('%', DATE_FORMAT(#{param.noticeDate},'%Y-%m-%d'), '%')
</if>
<if test="param.equAddress != null and param.equAddress != ''">
AND (
ibjui."PROVINCE_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
OR ibjui."CITY_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
OR ibjui."COUNTY_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
OR ibjui."STREET_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
)
</if>
<if test="param.useUnitCreditCode != null and param.useUnitCreditCode != ''">
AND tjtn."use_unit_credit_code" = #{param.useUnitCreditCode}
</if>
<if test="param.installUnitCreditCode != null and param.installUnitCreditCode != ''">
AND tjtn."install_unit_credit_code" = #{param.installUnitCreditCode}
</if>
<if test="param.receiveCompanyCode != null and param.receiveCompanyCode != ''">
AND tjtn.receive_company_code = #{param.receiveCompanyCode}
</if>
</if>
<if test="param.roleIds != null and type == 'supervision'">
<foreach collection='param.roleIds' item='role' open='and (' close=')' separator='or'>
tjtn.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="type == 'supervision'">
AND (tjtn.receive_company_code = #{orgCode} or tjtn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%'))
AND (tjtn.receive_company_code = #{orgCode} or tjtn.transfer_to_user_ids like
concat('%',#{param.transferToUserIds},'%'))
AND tjtn.instance_id <![CDATA[<>]]> ''
</if>
<if test="type == 'company'">
AND (tjtn.install_unit_credit_code = #{orgCode} or tjtn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%'))
AND (tjtn.install_unit_credit_code = #{orgCode} or tjtn.transfer_to_user_ids like
concat('%',#{param.transferToUserIds},'%'))
</if>
<if test="type == 'testAdmin'">
((AND tjtn.receive_company_code = #{orgCode}
......@@ -83,6 +130,9 @@
</if>
</where>
ORDER BY
<if test="sort != null">
tjtn.${sort.field} ${sort.sortType},
</if>
tjtn.apply_no DESC
</select>
......
......@@ -146,16 +146,17 @@ public class JgTransferNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST", value = "移装造告知分页查询", notes = "移装造告知分页查询")
public ResponseModel<Page<JgTransferNoticeDto>> queryForPage(
public ResponseModel<Page<Map<String,Object>>> queryForPage(
@ApiParam(value = "当前页码", required = true) @RequestParam(value = "current", defaultValue = "1") int current,
@ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size,
@ApiParam(value = "排序字段",required = false) @RequestParam(value = "sort",required = false) String sort,
@ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true) @RequestParam(value = "type", defaultValue = "enterprise") String type,
@RequestBody(required = false) JgTransferNoticeDto model
) {
Page<JgTransferNotice> page = new Page<>(current, size);
ReginParams reginParams = getSelectedOrgInfo();
type = (String) iJgInstallationNoticeService.getCompanyType().get("companyLevel");
return ResponseHelper.buildResponse(jgTransferNoticeService.queryForJgTransferNoticePage(page, model, type, reginParams));
return ResponseHelper.buildResponse(jgTransferNoticeService.queryForJgTransferNoticePage(page,sort, model, type, reginParams));
}
/**
......
......@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
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.utils.WordTemplateUtils;
......@@ -354,26 +355,22 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
* 分页查询
*/
@Override
public Page<JgTransferNoticeDto> queryForJgTransferNoticePage(Page<JgTransferNotice> page, JgTransferNoticeDto model, String type, ReginParams reginParams) {
public Page<Map<String,Object>> queryForJgTransferNoticePage(Page<JgTransferNotice> page,String sort, JgTransferNoticeDto model, String type, ReginParams reginParams) {
String orgCode = reginParams.getCompany().getCompanyCode();
SortVo sortMap = commonService.sortFieldConversion(sort);
model.setTransferToUserIds(reginParams.getUserModel().getUserId());
Page<JgTransferNotice> noticePage = jgTransferNoticeMapper.queryForPage(page, model, type, orgCode);
// 将Page<JgTransferNotice>转化为Page<JgTransferNoticeDto>
Page<JgTransferNoticeDto> noticeDtoPage = new Page<>();
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records");
List<JgTransferNoticeDto> records = noticePage.getRecords().stream().map(notice -> {
JgTransferNoticeDto noticeDto = new JgTransferNoticeDto();
BeanUtils.copyProperties(notice, noticeDto);
if (Objects.nonNull(notice.getNoticeStatus())) {
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf(notice.getNoticeStatus()));
noticeDto.setNoticeStatusDesc(noticeStatusDesc);
}
return noticeDto;
}).collect(java.util.stream.Collectors.toList());
noticeDtoPage.setRecords(records);
Page<Map<String,Object>> noticePage = jgTransferNoticeMapper.queryForPage(page,sortMap, model, type, orgCode);
List<Map<String, Object>> mappedRecords = noticePage.getRecords().stream().peek(notice -> {
Optional<Long> noticeStatusOpt = Optional.ofNullable((String) notice.get("noticeStatus")).map(Long::valueOf);
noticeStatusOpt.ifPresent(status -> {
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf((String) notice.get("noticeStatus")));
notice.put("noticeStatusDesc", noticeStatusDesc);
});
}).collect(Collectors.toList());
return noticeDtoPage;
noticePage.setRecords(mappedRecords);
return noticePage;
}
@Override
......
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