Commit f95ceb0f authored by tianyiming's avatar tianyiming

feat: 移装变更/单位变更/更名变更列表查询增加监管单位查看逻辑

parent 24ae1a93
......@@ -22,11 +22,12 @@ public interface JgChangeRegistrationTransferMapper extends BaseMapper<JgChangeR
void updatePromoter(@Param ("id")Long id);
Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page,
Page<Map<String, Object>> getListPage(@Param("page") Page<Map<String, Object>> page,
@Param("sort") SortVo sortMap,
@Param("dto") JgChangeRegistrationTransferDto dto ,
@Param("dto") JgChangeRegistrationTransferDto dto,
@Param("type") String type,
@Param("currentUserId")String currentUserId);
@Param("currentUserId") String currentUserId,
@Param("orgCode") String orgCode);
List<ChangeRegistrationTransferVo> queryChangeRegistrationTransferInIds(@Param("ids") List<String> ids);
......
......@@ -32,9 +32,10 @@ public interface JgChangeRegistrationUnitMapper extends CustomBaseMapper<JgChang
@Param("sort") SortVo sortMap,
@Param("param") JgChangeRegistrationUnitDto model,
@Param("type") String type,
@Param("orgCode") String orgCode,
@Param("companyCode") String companyCode,
@Param("roleIds") List<String> roleIds,
@Param("currentUserId") String currentUserId);
@Param("currentUserId") String currentUserId,
@Param("orgCode") String orgCode);
List<ChangeRegistrationUnitVo> queryChangeRegistrationUnitInIds(@Param("ids") List<String> ids);
......
......@@ -26,8 +26,9 @@ public interface JgScrapCancelMapper extends BaseMapper<JgScrapCancel> {
@Param("sort") SortVo sortMap,
@Param("dto") JgScrapCancelDto dto,
@Param("roleIds") List<String> roleIds,
@Param("orgCode") String orgCode,
@Param("currentUserId") String currentUserId
@Param("companyCode") String companyCode,
@Param("currentUserId") String currentUserId,
@Param("orgCode") String orgCode
);
List<ScrapCancelVo> queryScrapCancelInIds(@Param("ids") List<String> ids);
......
......@@ -29,7 +29,7 @@ public interface IJgChangeRegistrationTransferService extends IService<JgChangeR
Map<String, Map<String, Object>> getTransferDetail(String sequenceNbr, CompanyBo company);
Page<Map<String, Object>> queryListForPage(Page<Map<String, Object>> page,String sort, JgChangeRegistrationTransferDto params, String companyTypeCode, String companyType);
Page<Map<String, Object>> queryListForPage(Page<Map<String, Object>> page,String sort, JgChangeRegistrationTransferDto params, String companyTypeCode, String companyType,String orgCode);
void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, String nextTaskId);
......
......@@ -48,7 +48,8 @@ public interface IJgChangeRegistrationUnitService {
String sort,
JgChangeRegistrationUnitDto model,
String type,
ReginParams reginParams);
ReginParams reginParams,
String orgCode);
/**
* 批量删除
......
......@@ -8,14 +8,25 @@
</update>
<sql id="page_list">
WITH crteq_limited AS (
<![CDATA[/*+ set(query_dop 16)*/ ]]>
WITH equip_data as (
SELECT
equip_transfer_id,
equ_id,
group_concat(distinct si."ORG_BRANCH_CODE") as orgBranchCodes
FROM
tzs_jg_change_registration_transfer_eq crteq
LEFT JOIN idx_biz_jg_supervision_info si ON si.record = crteq.equ_id
GROUP BY equip_transfer_id
),
crteq_limited AS (
SELECT
*,
ROW_NUMBER() OVER (PARTITION BY equip_transfer_id ORDER BY rec_date desc) as rn
FROM tzs_jg_change_registration_transfer_eq
)
select
crt.sequence_nbr as sequenceNbr,
DISTINCT crt.sequence_nbr as sequenceNbr,
crt.audit_status as auditStatus,
DATE_FORMAT(crt.reg_date,'%Y-%m-%d') as regDate,
DATE_FORMAT(crt.create_date,'%Y-%m-%d') as createDate,
......@@ -42,6 +53,7 @@
LEFT JOIN crteq_limited crteq ON crt.sequence_nbr = crteq.equip_transfer_id AND crteq.rn = 1
LEFT JOIN idx_biz_jg_register_info jri on crteq.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on crteq.equ_id = use.RECORD
LEFT JOIN equip_data ed on ed.equip_transfer_id = crt.sequence_nbr
</sql>
<select id="getListPage" resultType="java.util.Map">
<include refid="page_list"/>
......@@ -107,6 +119,13 @@
<if test="dto.productName != null and dto.productName != ''">
and jri.PRODUCT_NAME like concat('%',#{dto.productName},'%')
</if>
<if test="orgCode != null and orgCode != ''">
AND crt.instance_id <![CDATA[<>]]> ''
AND EXISTS (
SELECT 1
FROM unnest(string_to_array(ed.orgBranchCodes, ',')) AS elem
WHERE elem LIKE concat(#{orgCode},'%' ) )
</if>
</where>
order by
<if test="sort != null">
......
......@@ -3,10 +3,22 @@
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationUnitMapper">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationUnit">
<![CDATA[/*+ set(query_dop 16)*/ ]]>
WITH equip_data as (
SELECT
unit_change_registration_id,
equ_id,
group_concat(distinct si."ORG_BRANCH_CODE") as orgBranchCodes
FROM
tzs_jg_change_registration_unit_eq isneq
LEFT JOIN idx_biz_jg_supervision_info si ON si.record = isneq.equ_id
GROUP BY unit_change_registration_id
)
select
isn.*
FROM
tzs_jg_change_registration_unit isn
LEFT JOIN equip_data ed on ed.unit_change_registration_id = isn.sequence_nbr
<where>
isn.is_delete = false
<if test="param != null ">
......@@ -65,6 +77,13 @@
isn.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="orgCode != null and orgCode != ''">
AND isn.instance_id <![CDATA[<>]]> ''
AND EXISTS (
SELECT 1
FROM unnest(string_to_array(ed.orgBranchCodes, ',')) AS elem
WHERE elem LIKE concat(#{orgCode},'%' ) )
</if>
</where>
ORDER BY
<if test="sort != null">
......
......@@ -19,7 +19,7 @@
GROUP BY equip_transfer_id
)
select
isn.sequence_nbr AS sequenceNbr,
DISTINCT isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
DATE_FORMAT(isn.notice_date,'%Y-%m-%d') AS noticeDate,
isn.notice_status AS noticeStatus,
......
......@@ -15,12 +15,12 @@
GROUP BY equip_transfer_id
)
select
DISTINCT isn.sequence_nbr AS sequenceNbr,
isn.province,
isn.city,
isn.county,
isn.street,
isn.promoter,
isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
isn.use_unit_name AS useUnitName,
isn.receive_org_name AS receiveOrgName,
......
......@@ -9,6 +9,17 @@
</update>
<sql id="page_list">
<![CDATA[/*+ set(query_dop 16)*/ ]]>
WITH equip_data as (
SELECT
equip_transfer_id,
equ_id,
group_concat(distinct si."ORG_BRANCH_CODE") as orgBranchCodes
FROM
tzs_jg_scrap_cancel_eq tjsceq
LEFT JOIN idx_biz_jg_supervision_info si ON si.record = tjsceq.equ_id
GROUP BY equip_transfer_id
)
select
tjsc.sequence_nbr,
tjsc.instance_id,
......@@ -36,6 +47,7 @@
tjsc.use_registration_code,
tjsc.equ_list_code
from tzs_jg_scrap_cancel tjsc
LEFT JOIN equip_data ed on ed.equip_transfer_id = tjsc.sequence_nbr
</sql>
<select id="getListPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto">
......@@ -77,6 +89,13 @@
<if test="dto.type == 'company' ">
and (tjsc.use_unit_code = #{orgCode} or tjsc.transfer_to_user_ids like concat('%',#{currentUserId},'%'))
</if>
<if test="orgCode != null and orgCode != ''">
AND tjsc.instance_id <![CDATA[<>]]> ''
AND EXISTS (
SELECT 1
FROM unnest(string_to_array(ed.orgBranchCodes, ',')) AS elem
WHERE elem LIKE concat(#{orgCode},'%' ) )
</if>
</where>
order by
<if test="sort != null">
......
......@@ -6,15 +6,13 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -122,21 +120,25 @@ public class JgChangeRegistrationTransferController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "移装变更登记登记分页查询", notes = "移装变更登记登记分页查询")
@ApiOperation(httpMethod = "GET", value = "移装变更登记登记分页查询", notes = "移装变更登记登记分页查询")
public ResponseModel<Page<Map<String, Object>>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "sort",required = false) String sort,
JgChangeRegistrationTransferDto params) {
@RequestParam(value = "size") int size,
@RequestParam(value = "sort", required = false) String sort,
JgChangeRegistrationTransferDto params,
@ApiParam(value = "客户端类型: jgAudit-监管审核;jgLook-监管查看") @RequestParam(value = "client", required = false, defaultValue = "jgAudit") String client
) {
Page<Map<String, Object>> page = new Page<>(current, size);
ReginParams reginParams = getSelectedOrgInfo();
String companyTypeCode = "";
if(reginParams.getCompany().getLevel().equals(COMPANY_TYPE_COMPANY)){
if (reginParams.getCompany().getLevel().equals(COMPANY_TYPE_COMPANY)) {
companyTypeCode = COMPANY_TYPE_COMPANY;
} else {
companyTypeCode = COMPANY_TYPE_SUPERVISION;
}
companyTypeCode = "jgLook".equals(client) ? null : companyTypeCode;
String orgCode = "jgLook".equals(client) ? reginParams.getCompany().getOrgCode() : null;
params.setUnitCode(reginParams.getCompany().getCompanyCode());
return ResponseHelper.buildResponse(jgChangeRegistrationTransferService.queryListForPage(page,sort,params, companyTypeCode, reginParams.getCompany().getCompanyType()));
return ResponseHelper.buildResponse(jgChangeRegistrationTransferService.queryListForPage(page, sort, params, companyTypeCode, reginParams.getCompany().getCompanyType(),orgCode));
}
/**
......
......@@ -150,7 +150,8 @@ public class JgChangeRegistrationUnitController extends BaseController {
@ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size,
@ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true) @RequestParam(value = "type", defaultValue = "enterprise") String type,
@ApiParam(value = "排序字段", required = false) @RequestParam(value = "sort", required = false) String sort,
@RequestBody(required = false) JgChangeRegistrationUnitDto model
@RequestBody(required = false) JgChangeRegistrationUnitDto model,
@ApiParam(value = "客户端类型: jgAudit-监管审核;jgLook-监管查看") @RequestParam(value = "client", required = false, defaultValue = "jgAudit") String client
) {
Page<JgChangeRegistrationUnit> page = new Page<>(current, size);
ReginParams reginParams = getSelectedOrgInfo();
......@@ -159,7 +160,9 @@ public class JgChangeRegistrationUnitController extends BaseController {
} else {
type = "supervision";
}
return ResponseHelper.buildResponse(jgChangeRegistrationUnitServiceImpl.queryForJgChangeRegistrationUnitPage(page, sort, model, type, reginParams));
type = "jgLook".equals(client) ? null : type;
String orgCode = "jgLook".equals(client) ? reginParams.getCompany().getOrgCode() : null;
return ResponseHelper.buildResponse(jgChangeRegistrationUnitServiceImpl.queryForJgChangeRegistrationUnitPage(page, sort, model, type, reginParams, orgCode));
}
/**
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -11,6 +10,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgScrapCancelServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -109,12 +109,14 @@ public class JgScrapCancelController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "分页查询", notes = "分页查询")
@PostMapping(value = "/getList")
public ResponseModel<Page<JgScrapCancelDto>> getList(JgScrapCancelDto dto,
@RequestParam(value = "sort",required = false) String sort,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
@RequestParam(value = "sort", required = false) String sort,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@ApiParam(value = "客户端类型: jgAudit-监管审核;jgLook-监管查看") @RequestParam(value = "client", required = false, defaultValue = "jgAudit") String client
) {
Page<JgScrapCancelDto> page = new Page<>(current, size);
dto.setType(String.valueOf(iJgInstallationNoticeService.getCompanyType().get("companyLevel")));
return ResponseHelper.buildResponse(jgScrapCancelService.getList(dto,sort, page, dto.getRoleIds()));
return ResponseHelper.buildResponse(jgScrapCancelService.getList(dto, sort, page, dto.getRoleIds(), client));
}
......
......@@ -741,9 +741,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @return
*/
@Override
public Page<Map<String, Object>> queryListForPage(Page<Map<String, Object>> page, String sort, JgChangeRegistrationTransferDto params, String companyTypeCode, String companyType) {
public Page<Map<String, Object>> queryListForPage(Page<Map<String, Object>> page, String sort, JgChangeRegistrationTransferDto params, String companyTypeCode, String companyType, String orgCode) {
SortVo sortMap = commonService.sortFieldConversion(sort);
Page<Map<String, Object>> listPage = this.baseMapper.getListPage(page, sortMap, params, companyTypeCode, RequestContext.getExeUserId());
Page<Map<String, Object>> listPage = this.baseMapper.getListPage(page, sortMap, params, companyTypeCode, RequestContext.getExeUserId(), orgCode);
listPage.getRecords().forEach(x -> x.put("companyType", companyType));
return listPage;
}
......
......@@ -28,7 +28,6 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.feign.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
......@@ -672,15 +671,16 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
String sort,
JgChangeRegistrationUnitDto model,
String type,
ReginParams reginParams) {
String orgCode = reginParams.getCompany().getCompanyCode();
ReginParams reginParams,
String orgCode) {
String companyCode = reginParams.getCompany().getCompanyCode();
if (CompanyTypeEnum.INDIVIDUAL.getName().equals(reginParams.getCompany().getCompanyType())) {
orgCode = reginParams.getCompany().getCompanyCode().split("_")[1];
companyCode = reginParams.getCompany().getCompanyCode().split("_")[1];
}
String companyType = reginParams.getCompany().getCompanyType();
String currentUserId = reginParams.getUserModel().getUserId();
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort);
Page<JgChangeRegistrationUnit> noticePage = JgChangeRegistrationUnitMapper.queryForPage(page, sortMap, model, type, orgCode, model.getRoleIds(), currentUserId);
Page<JgChangeRegistrationUnit> noticePage = JgChangeRegistrationUnitMapper.queryForPage(page, sortMap, model, type, orgCode, model.getRoleIds(), currentUserId, orgCode);
Page<JgChangeRegistrationUnitDto> noticeDtoPage = new Page<>();
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records");
......
......@@ -129,17 +129,20 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
return "1".equals(type) ? BusinessTypeEnum.JG_EQUIPMENT_CANCEL : BusinessTypeEnum.JG_EQUIPMENT_MOVE;
}
public Page<JgScrapCancelDto> getList(JgScrapCancelDto dto, String sort, Page<JgScrapCancelDto> page, List<String> roleIds) {
public Page<JgScrapCancelDto> getList(JgScrapCancelDto dto, String sort, Page<JgScrapCancelDto> page, List<String> roleIds,String client) {
ReginParams reginParams = this.getSelectedOrgInfo();
CompanyBo company = reginParams.getCompany();
String orgCode = company.getCompanyCode();
String companyCode = company.getCompanyCode();
if (CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType())) {
orgCode = company.getCompanyCode().split("_")[1];
companyCode = company.getCompanyCode().split("_")[1];
}
dto.setCreateUserId(reginParams.getUserModel().getUserId());
dto.setType("jgLook".equals(client) ? null : dto.getType());
String orgCode = "jgLook".equals(client) ? company.getOrgCode(): null;
String currentUserId = reginParams.getUserModel().getUserId();
SortVo sortMap = commonService.sortFieldConversion(sort);
Page<JgScrapCancelDto> listPage = this.baseMapper.getListPage(page, sortMap, dto, roleIds, orgCode, currentUserId);
Page<JgScrapCancelDto> listPage = this.baseMapper.getListPage(page, sortMap, dto, roleIds, companyCode, currentUserId, orgCode);
listPage.getRecords().forEach(item -> {
if (item.getCancelType() != null) {
item.setCancelTypeDesc(CancelTypeEnum.getNameByType(item.getCancelType()));
......
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