Commit 5974e866 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_feat/xzspj' into develop_tzs_register

parents c2df9072 c4ab4bb2
......@@ -57,7 +57,7 @@ public class TmCylinderFillingCheckService extends MyBaseServiceImpl<TmCylinderF
entity -> new MultiFieldKey(entity.getAppId(), entity.getSequenceCode(), entity.getFillingBeforeId()),
"appId",
"sequenceCode",
"fillBeforeId");
"fillingBeforeId");
}
private void syncCylinderFillingAfter(List<TmCylinderFillingCheckModel> model) {
......
......@@ -66,7 +66,7 @@ public class TmCylinderFillingRecordService extends MyBaseServiceImpl<TmCylinder
entity -> new MultiFieldKey(entity.getAppId(), entity.getSequenceCode(), entity.getFillingBeforeId()),
"appId",
"sequenceCode",
"fillingRecordId"
"fillingBeforeId"
);
}
......
......@@ -103,4 +103,9 @@ public class DPFilterParamDto {
* 监管机构组织机构代码
*/
private String superviseOrgCode;
/**
* 区域下的所有单位监管、行政审批(地市、区县级)
*/
private List<String> companyCodes;
}
......@@ -10,7 +10,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.FeedbackSuggestions;
* @date 2025-05-15
*/
public interface FeedbackSuggestionsMapper extends BaseMapper<FeedbackSuggestions> {
String getCompanyNameByOrgCode(String orgCode);
String getCompanySeqByCompanyCode(String companyCode);
......
<?xml version="1.0" encoding="UTF-8"?>
<!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.common.api.mapper.FeedbackSuggestionsMapper">
<select id="getCompanyNameByOrgCode" resultType="java.lang.String">
select company_name
from privilege_company
where org_code = #{orgCode}
limit 1
</select>
<select id="getCompanySeqByCompanyCode" resultType="java.lang.String">
SELECT sequence_nbr as sequenceNbr
FROM "amos_tzs_biz"."tz_base_enterprise_info"
......
......@@ -14,7 +14,9 @@ import com.yeejoin.amos.boot.module.common.api.enums.ProblemTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.FeedbackSuggestionsMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFeedbackSuggestionsService;
import com.yeejoin.amos.boot.module.common.api.vo.FeedbackSuggestionsVo;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -72,8 +74,11 @@ public class FeedbackSuggestionsServiceImpl extends BaseService<FeedbackSuggesti
suggestions.setCreateUserName(userModel.getRealName());
suggestions.setCreateDate(new Date());
suggestions.setIsDelete(Boolean.FALSE);
suggestions.setSuperviseOrgCode(company.getOrgCode());
suggestions.setSuperviseOrgName(feedbackSuggestionsMapper.getCompanyNameByOrgCode(company.getOrgCode()));
CompanyModel parentCompany = Privilege.companyClient.seleteOne(company.getParentId()).getResult();
if (!ValidationUtil.isEmpty(parentCompany)) {
suggestions.setSuperviseOrgCode(parentCompany.getOrgCode());
suggestions.setSuperviseOrgName(parentCompany.getCompanyName());
}
suggestions.setCompanyCode(company.getCompanyCode());
suggestions.setCompanyName(company.getCompanyName());
suggestions.setReporterUserId(Objects.toString(userModel.getUserId()));
......
......@@ -19,6 +19,9 @@ public enum CompanyTypeEnum {
/**
* 单位类型枚举
*/
APPROVAL("supervision","approval", "行政审批局"),
SUPERVISION("supervision","supervision", "监管机构"),
USE("company","use", "使用单位"),
......
......@@ -108,6 +108,14 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
/**
* 按照 地市或者区县查询对应行政区划seq
*
* @param receiveCompanyCode 地市或者区县companyCode
* @return 地市对应行政区划seq
*/
String selectCompanyRegionSeq(@Param("receiveCompanyCode") String receiveCompanyCode);
/**
* 告知业务统计
*
* @param reportAnalysisSearchDTO 条件
......@@ -380,5 +388,7 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
List<Map<String, Object>> queryInMaintenanceRecord();
List<Map<String, Object>> queryInInspectionRecord();
List<String> querySupervisionCompanyCode();
}
......@@ -28,6 +28,10 @@ public interface JgUseRegistrationManageMapper extends BaseMapper<JgUseRegistrat
@Param("dto") JgUseRegistrationManageDto dto,
@Param("sort") SortVo sortMap);
Page<JgUseRegistrationManageDto> queryForUnitChangePage(@Param("page") Page<JgUseRegistrationManageDto> page,
@Param("dto") JgUseRegistrationManageDto dto,
@Param("sort") SortVo sortMap);
Page<JgUseRegistrationManageDto> queryForPageForJG(@Param("page") Page<JgUseRegistrationManageDto> page,
@Param("dto") JgUseRegistrationManageDto dto,
@Param("sort") SortVo sortMap, @Param("orgCode") String orgCode);
......
......@@ -3553,4 +3553,20 @@
AND oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领')
AND tt."NEXT_INSPECT_DATE" is not null
</select>
<select id="selectCompanyRegionSeq" resultType="java.lang.String">
select
region_seq
from
privilege_company
where
company_code = #{receiveCompanyCode} and is_deleted = false
</select>
<select id="querySupervisionCompanyCode" resultType="java.lang.String">
select
supervision_company_code as supervisionCompanyCode
from
tz_supervision_approval_mapping
</select>
</mapper>
......@@ -82,6 +82,85 @@
</select>
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto">
<include refid="page_list"/>
FROM tzs_jg_use_registration_manage tjurm
<where>
tjurm.is_delete = 0
<if test="dto.equList != null and dto.equList != ''">
and tjurm.equ_list = #{dto.equList}
</if>
<if test="dto.equListCode != null and dto.equListCode != ''">
and tjurm.equ_list_code = #{dto.equListCode}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
and tjurm.equ_category = #{dto.equCategory}
</if>
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and tjurm.equ_category_code = #{dto.equCategoryCode}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
and tjurm.equ_define = #{dto.equDefine}
</if>
<if test="dto.equDefineCode != null and dto.equDefineCode != ''">
and tjurm.equ_define_code = #{dto.equDefineCode}
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and tjurm.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.certificateNo != null and dto.certificateNo != ''">
and tjurm.certificate_no = #{dto.certificateNo}
</if>
<if test="dto.auditPassDate != null and dto.auditPassDate != ''">
and tjurm.audit_pass_date like concat('%',DATE_FORMAT(#{dto.auditPassDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.certificateStatus != null and dto.certificateStatus != ''">
and tjurm.certificate_status = #{dto.certificateStatus}
</if>
<if test="dto.useUnitCreditCodeForSearch != null and dto.useUnitCreditCodeForSearch != ''">
and tjurm.use_unit_credit_code = #{dto.useUnitCreditCodeForSearch}
</if>
<if test="dto.useUnitCreditNameForSearch != null and dto.useUnitCreditNameForSearch != ''">
and tjurm.use_unit_name like concat ('%',#{dto.useUnitCreditNameForSearch},'%')
</if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
and (tjurm.receive_company_code = #{dto.receiveCompanyCode}
or tjurm.receive_company_code is null or tjurm.receive_company_code = '')
</if>
<if test="dto.dataType == 'company' ">
AND tjurm.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
<if test="dto.dataType == 'supervision' ">
AND tjurm.receive_company_code = #{dto.receiveCompanyCode}
</if>
<if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 ">
AND tjurm.reg_type = '车用气瓶登记'
</if>
<if test="dto.isScrap != null and dto.isScrap != ''">
and tjurm.is_scrap = #{dto.isScrap}
</if>
<if test="dto.isDoBusiness != null and dto.isDoBusiness != ''">
and tjurm.is_do_business = #{dto.isDoBusiness}
</if>
<if test="dto.cityName != null and dto.cityName != ''">
and tjurm.equ_use_address LIKE CONCAT('%', #{dto.cityName}, '%')
</if>
<if test="dto.carNumber != null and dto.carNumber != ''">
and tjurm.car_number LIKE CONCAT('%', #{dto.carNumber}, '%')
</if>
<if test="dto.certInBusinessFlag != null and dto.certInBusinessFlag != '' and dto.certInBusinessFlag == 'false'">
and NOT EXISTS ( <include refid="useRegCertInBusiness"/> )
</if>
ORDER BY
<if test="sort != null">
tjurm.${sort.field} ${sort.sortType},
</if>
tjurm.create_date DESC
</where>
</select>
<select id="queryForUnitChangePage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto">
<include refid="page_list"/>
,estate.sequence_nbr AS estateUnitName
FROM tzs_jg_use_registration_manage tjurm
LEFT JOIN (
......
......@@ -73,11 +73,6 @@ public class CommonController extends BaseController {
private final CodeUtil codeUtil;
private final DataDictionaryServiceImpl iDataDictionaryService;
/**
* 监管机构
*/
public static final String COMPANY_TYPE_SUPERVISION_NAME = "监管机构";
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/currentLoginInfo")
@ApiOperation(httpMethod = "GET", value = "当前登录人信息", notes = "当前登录人信息")
......@@ -165,15 +160,15 @@ public class CommonController extends BaseController {
@GetMapping(value = "/getUseUnitListByCurrentLoginUser")
@ApiOperation(httpMethod = "GET", value = "根据当前登录人获取使用单位列表(用作设备列表查询)", notes = "根据当前登录人获取使用单位列表(用作设备列表查询)")
public ResponseModel<List<Map<String, Object>>> getUseUnitListByCurrentLoginUser() {
String companyType = getSelectedOrgInfo().getCompany().getCompanyType();
String companyLevel = getSelectedOrgInfo().getCompany().getLevel();
List<Map<String, Object>> result = new ArrayList<>();
if (COMPANY_TYPE_SUPERVISION_NAME.equals(companyType)) {
result = commonService.getUnitListByType("use", null, false);
}else {
if (BaseController.COMPANY_TYPE_COMPANY.equals(companyLevel)) {
result.add(MapBuilder.<String, Object>create()
.put("useCode", getSelectedOrgInfo().getCompany().getCompanyCode())
.put("useUnit", getSelectedOrgInfo().getCompany().getCompanyName())
.build());
} else {
result = commonService.getUnitListByType("use", null, false);
}
return ResponseHelper.buildResponse(result);
}
......
......@@ -341,7 +341,7 @@ public class JgUseRegistrationManageController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/unitChange/page")
@ApiOperation(httpMethod = "GET", value = "单位变更分页查询", notes = "单位变更分页查询")
@ApiOperation(httpMethod = "GET", value = "单位变更分页查询-带产权单位", notes = "单位变更分页查询-带产权单位")
@FieldMapping({@FieldMapping.FieldMap(sourceField = "useUnitSeq", targetField = "originalUseUnitCreditCode", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitCreditInfoBySeq")})
public ResponseModel<Page<JgUseRegistrationManageDto>> queryForUnitChangePage(JgUseRegistrationManageDto dto,
@RequestParam(value = "sort", required = false) String sort,
......@@ -361,7 +361,7 @@ public class JgUseRegistrationManageController extends BaseController {
return ResponseHelper.buildResponse(page);
}
dto.setIsDoBusiness("1");
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(page, dto, sort));
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForUnitChangePage(page, dto, sort));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -79,8 +79,9 @@ public class PlatformUserTopicMessage extends EmqxListener {
private void processDataResult(JSONObject dataResultObject) {
try {
String companyType = "监管机构";
String companyType2 = "行政审批局";
String companyTypeValue = dataResultObject.getString("companyType");
if (StringUtils.isNotEmpty(companyTypeValue) && companyTypeValue.contains(companyType)) {
if (StringUtils.isNotEmpty(companyTypeValue) && (companyTypeValue.contains(companyType) || companyTypeValue.contains(companyType2))) {
commonService.creatApproveTree();
}
} catch (Exception e) {
......
......@@ -57,10 +57,7 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.reminder.service.RemindServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.*;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.*;
......@@ -215,6 +212,11 @@ public class CommonServiceImpl implements ICommonService {
private static final String UNIT = "unit";
private static final String SET = "set";
private static final String OVER_DESIGN = "overDesign";
private static final String COMPANY_TYPE_KEY = "companyType";
private static final String CHILDREN_KEY = "children";
private static final String COMPANY_TYPE_DELIMITER = "/";
@Autowired
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
......@@ -319,6 +321,9 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
private RestHighLevelClient restHighLevelClient;
@Autowired
CodeUtil codeUtil;
public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE";
public static byte[] file2byte(File file) {
......@@ -502,7 +507,7 @@ public class CommonServiceImpl implements ICommonService {
public List<LinkedHashMap> getCreatTreeByInstallationTree() {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteData(result, REGULATOR_UNIT);
List<LinkedHashMap> treeData = deleteData(result, Collections.singletonList(REGULATOR_UNIT));
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE_ALL, resultTree);
......@@ -644,7 +649,8 @@ public class CommonServiceImpl implements ICommonService {
// 日期设置
setNextDate(useFlagParamDto, paramMap);
// 登记机关调整为H列内容(原因目前公司结构无行政审批局)
setRegName(useFlagParamDto, paramMap);
// 20251203行政审批局调整:直接使用单据选择的接收机构
// setRegName(useFlagParamDto, paramMap);
String ftlPath = this.getFtlPathByBiz(useFlagParamDto);
if (StringUtils.isEmpty(ftlPath)) {
throw new BadRequest("无法找到使用标志模板!");
......@@ -769,7 +775,7 @@ public class CommonServiceImpl implements ICommonService {
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteTreeData(result, REGULATOR_UNIT);
List<LinkedHashMap> treeData = deleteData(result, Lists.newArrayList(REGULATOR_UNIT));
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE, resultTree);
......@@ -779,7 +785,7 @@ public class CommonServiceImpl implements ICommonService {
public List<LinkedHashMap> creatlLoginUnitAndBelowGetTree(String orgCode) {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteTreeData(result, REGULATOR_UNIT);
List<LinkedHashMap> treeData = deleteData(result, Lists.newArrayList(REGULATOR_UNIT));
List<LinkedHashMap> supervisionTree = orgCodeAndBelowGetTree(treeData, orgCode);
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE + "_" + orgCode, resultTree);
......@@ -807,8 +813,8 @@ public class CommonServiceImpl implements ICommonService {
private List<LinkedHashMap> creatReceiveUnitTree(String bizType) {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
// 删除非监管机构的单位
deleteData(result, REGULATOR_UNIT);
// 删除非监管机构、非审批局的单位
deleteData(result, Lists.newArrayList(REGULATOR_UNIT, ADMINISTRATION_UNIT));
// 过滤符合指定业务的监管单位
filterTreeDataByType(result, bizType);
List<LinkedHashMap> supervisionTree = result.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
......@@ -840,7 +846,7 @@ public class CommonServiceImpl implements ICommonService {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> children = (List<LinkedHashMap>) result.get(0).get("children");
List<LinkedHashMap> treeData = deleteTreeData(children, REGULATOR_UNIT);
List<LinkedHashMap> treeData = deleteData(children, Lists.newArrayList(REGULATOR_UNIT, ADMINISTRATION_UNIT));
List<LinkedHashMap> resultTree = updateNullChildren(treeData);
redisUtils.set(ADMINISTRATION_UNIT_TREE, resultTree);
return resultTree;
......@@ -887,22 +893,6 @@ public class CommonServiceImpl implements ICommonService {
}
private List<LinkedHashMap> deleteTreeData(List<LinkedHashMap> result, String companyType) {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
// 删除非监管机构
Object companyTypeObj = e.get("companyType");
if (companyTypeObj == null || !companyTypeObj.toString().contains(companyType)) {
it.remove();
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
deleteTreeData((List<LinkedHashMap>) e.get("children"), companyType);
}
}
return result;
}
private List<LinkedHashMap> filterTreeDataByType(List<LinkedHashMap> result, String type) {
Iterator<LinkedHashMap> it = result.iterator();
while (it.hasNext()) {
......@@ -918,24 +908,44 @@ public class CommonServiceImpl implements ICommonService {
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
filterTreeDataByType((List<LinkedHashMap>) e.get("children"), type);
}
}
return result;
}
private List<LinkedHashMap> deleteData(List<LinkedHashMap> result, String companyType) {
Iterator it = result.iterator();
private List<LinkedHashMap> deleteData(List<LinkedHashMap> result, List<String> companyTypes) {
if (result == null || companyTypes == null || companyTypes.isEmpty()) {
return result;
}
// 使用迭代器遍历并删除元素
Iterator<LinkedHashMap> it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
LinkedHashMap<String, Object> e = it.next();
Object companyTypeObj = e.get(COMPANY_TYPE_KEY);
Object childrenObj = e.get(CHILDREN_KEY);
// 删除非指定的单位类型
if (e.get("companyType") != null && !e.get("companyType").toString().contains(companyType)) {
it.remove();
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
deleteData((List<LinkedHashMap>) e.get("children"), companyType);
}
if (companyTypeObj != null) {
String companyType = companyTypeObj.toString();
String[] companyTypeArray = companyType.split(COMPANY_TYPE_DELIMITER);
boolean matches = false;
for (String type : companyTypeArray) {
if (companyTypes.contains(type)) {
matches = true;
break;
}
}
if (!matches) {
it.remove();
} else if (childrenObj instanceof List) {
@SuppressWarnings("unchecked")
List<LinkedHashMap> children = (List<LinkedHashMap>) childrenObj;
deleteData(children, companyTypes);
}}
}
return result;
}
......@@ -2097,6 +2107,8 @@ public class CommonServiceImpl implements ICommonService {
// 登记机关代号,特殊区域用特殊区域如韩城-Y、杨凌-V、西咸-U
String city = "";
if (!ValidationUtil.isEmpty(supervisoryCompanyCode)) {
// 根据接收机构动态获取接收机构对应行政区划code
supervisoryCompanyCode = codeUtil.getCityRegionCode(supervisoryCompanyCode);
DataDictionary specialRegionCode = dataDictionaryService.getByCode(supervisoryCompanyCode, SPECIAL_REGION_CODE);
if (!ValidationUtil.isEmpty(specialRegionCode)) { // 特殊的区域
city = specialRegionCode.getName();
......@@ -3049,7 +3061,7 @@ public class CommonServiceImpl implements ICommonService {
Map<String, Object> paramMap = Bean.BeantoMap(useFlagParamDto);
setNextDate(useFlagParamDto, paramMap);
setRegName(useFlagParamDto, paramMap);
// setRegName(useFlagParamDto, paramMap);
// 生成二维码,之前为设备监管码,调整为证编号
String qrCode = ImageUtils.generateQRCode(getEncodeQrCode(useFlagParamDto.getCertificateNo(), "useFlag", useFlagParamDto.getVersion() + ""), 100, 100);
paramMap.put("supervisoryCode", qrCode);
......
......@@ -1965,7 +1965,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
StringBuilder businessBuilder = new StringBuilder(business);
if (!ObjectUtils.isEmpty(useRegistrationCode)) {
List<JgUseRegistrationManage> regs = jgUseRegistrationManageService.lambdaQuery()
.select(JgUseRegistrationManage::getReceiveOrgName,
.select(JgUseRegistrationManage::getSequenceNbr,
JgUseRegistrationManage::getReceiveOrgName,
JgUseRegistrationManage::getReceiveCompanyCode)
.eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode)
.eq(JgUseRegistrationManage::getIsDelete, false)
......
......@@ -92,6 +92,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
public static final String EQU_LISTS = "equLists";
public static final String EQU_LIST_CODE = "equListCode";
public static final String RECEIVE_ORG_CODE = "receiveOrgCode";
public static final String RECEIVE_ORG_NAME = "receiveOrgName";
public static final String APPLICATION_FORM_FILE = "applicationFormFile";
public static final String OTHER_ACCESSORIES = "otherAccessories";
public static final String SAFETY_MANAGER_ID = "safetyManagerId";
......@@ -963,6 +964,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
jsonObject.put(APPLY_STATUS, FlowStatusEnum.TO_BE_FINISHED.getCode());
ATTACHMENT_FIELD.forEach(item -> jsonObject.put(item, JSONObject.parse(jsonObject.getString(item))));
jsonObject.put(APPLICATION_FORM_FILE_URL, certRep.getApplicationFormFileUrl());
jsonObject.put(RECEIVE_ORG_CODE, certRep.getReceiveOrgCode());
jsonObject.put(RECEIVE_ORG_NAME, certRep.getReceiveOrgName());
return jsonObject;
} else {
ObjectMapper mapper = new ObjectMapper();
......
......@@ -978,6 +978,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
// todo 注意顺序3
object.put("companyType2", CommonServiceImpl.getCompanyType(selectedOrgInfo.getCompany()));
object.put("havingPermission", registrationUnit.getNextExecuteUserIds() != null && registrationUnit.getNextExecuteUserIds().contains(RequestContext.getExeUserId()));
object.put("receiveCompanyCode", registrationUnit.getReceiveCompanyCode() + "_" + registrationUnit.getReceiveOrgName());
object.put("receiveOrgCode", registrationUnit.getReceiveOrgCode() + "_" + registrationUnit.getReceiveOrgName());
return object;
} else {
return new HashMap<>();
......
......@@ -837,6 +837,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
resultMap.putAll(jsonObject);
}
resultMap.put("receiveOrgCode", enableDisable.getReceiveCompanyCode() + '_' + enableDisable.getReceiveOrgName());
resultMap.put("receiveCompanyCode", enableDisable.getReceiveCompanyCode());
resultMap.put("sequenceNbr", enableDisable.getSequenceNbr());
resultMap.put("applyNo", enableDisable.getApplyNo());
resultMap.put("auditStatus", enableDisable.getAuditStatus());
......
......@@ -335,6 +335,20 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
}
/**
* 单位变更证-查询
*/
public Page<JgUseRegistrationManageDto> queryForUnitChangePage(Page<JgUseRegistrationManageDto> page,
JgUseRegistrationManageDto dto,
String sort) {
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort);
if (ApplicationFormTypeEnum.BF.getBusinessCode().equals(dto.getApplyType()) && (!CylinderTypeEnum.CYLINDER.getCode().equals(dto.getEquCategoryCode()) || dto.getRegType().equals(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()))){
dto.setCertificateStatus(null);
dto.setIsScrap("0");
}
return jgUseRegistrationManageMapper.queryForUnitChangePage(page, dto, sortMap);
}
/**
* 分页查询证管理表-选择证使用,添加产权单位id
*/
public Page<JgUseRegistrationManageDto> queryUseRegistrationManagePage(Page<JgUseRegistrationManageDto> page,
......
......@@ -161,6 +161,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
private static final String DEFINITION_KEY = "useRegistration";
private static final String JIAN_CHA_ROLE_ID = "1864242478501093377";
private static final int ONCE_MAX_SUBMIT = 5000;
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");;
private static final int BATCH_SIZE = 1000;
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废");
......@@ -940,6 +941,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (!ObjectUtils.isEmpty(map.get("submit")) && hasExistingCertificate && map.get("isAddEquip").equals("0")) {
throw new BadRequest("该企业已存在气瓶证书,请选择增补功能进行登记!");
}
if (equipmentLists.size() > ONCE_MAX_SUBMIT) {
throw new BadRequest("单次提交最多允许 " + ONCE_MAX_SUBMIT + " 条数据,请分批提交!");
}
}
// 压力管道逻辑(如果是合并到已有证的工程装置,需要去除已完成设备)
......@@ -2490,6 +2494,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jsonObject.put("manageType", jgUseRegistration.getManageType());
jsonObject.put("createUserId", jgUseRegistration.getCreateUserId());
jsonObject.put("receiveOrgCode", jgUseRegistration.getReceiveCompanyCode() + "_" + jgUseRegistration.getReceiveOrgName());
jsonObject.put("receiveCompanyCode", jgUseRegistration.getReceiveCompanyCode() + "_" + jgUseRegistration.getReceiveOrgName());
jsonObject.put("status", jgUseRegistration.getStatus());
jsonObject.put("applyNo", jgUseRegistration.getApplyNo());
jsonObject.put("installLeaderName", jsonObject.getString("installLeaderId"));
......@@ -3271,9 +3276,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
*/
void fillHistoryDataWithNewEquip(JSONObject jsonObject, JgUseRegistration jgUseRegistration, String record) {
// 非已完成、非作废时显示设备最新信息。前置需求:一个设备只能同时发起一个流程
// 流程中的新设备处理逻辑(历史有证已完成不执行、历史黑设备在使用登记编辑维保、安装信息,所以详情从json取)
if (!(FlowStatusEnum.TO_BE_FINISHED.getName().equals(jgUseRegistration.getStatus())
|| FlowStatusEnum.TO_BE_DISCARD.getName().equals(jgUseRegistration.getStatus()))
|| "1".equals(jgUseRegistration.getRegType())) {
&& !"2".equals(jgUseRegistration.getRegType())) {
fillLastEquipDetail(jsonObject, record);
}
}
......@@ -3282,16 +3288,16 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 基本信息 + 制造信息 + 设计信息
fillLastEquipBaseInfo(jsonObject, record);
// 安装信息
if (!jsonObject.containsKey("installationIsComplete")) {
Map<String, Object> installDetail = this.baseMapper.getInstallDetail(record);
// 历史设备登记来的数据没有安装业务信息 从一码通数据拿
if (ValidationUtil.isEmpty(installDetail)) {
installDetail = this.baseMapper.getiInstallDetailByIdx(record);
}
if (!ObjectUtils.isEmpty(installDetail)) {
jsonObject.putAll(installDetail);
}
Map<String, Object> installDetail = this.baseMapper.getInstallDetail(record);
// 历史设备登记来的数据没有安装业务信息 从一码通数据拿
if (ValidationUtil.isEmpty(installDetail)) {
installDetail = this.baseMapper.getiInstallDetailByIdx(record);
}
if (!ObjectUtils.isEmpty(installDetail)) {
jsonObject.putAll(installDetail);
}
// 维保信息
Map<String, Object> maintenanceDetail = this.baseMapper.getMaintenanceDetail(record);
// 历史设备登记来的数据没有维保业务信息 从一码通数据拿
......@@ -4499,9 +4505,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
useInfo.setStreetName(useStreetName);
useInfo.setAddress(String.valueOf(map.get("address")));
useInfo.setIsNotXiXian(String.valueOf(map.get("isXixian")));
Map<String, String> propertyUnitInfo = commonServiceImpl.queryTcmUnitInfoBySeq(MapUtil.getStr(map, "estateUnitName"), TcmUnitTypeEnum.CQ.getCode());
useInfo.setEstateUnitCreditCode(MapUtil.getStr(propertyUnitInfo, "unitCode"));
useInfo.setEstateUnitName(MapUtil.getStr(propertyUnitInfo, "unitName"));
if (!ValidationUtil.isEmpty(MapUtil.getStr(map, "estateUnitName")) && MapUtil.getStr(map, "estateUnitName").split("_").length == 2) {
useInfo.setEstateUnitCreditCode(MapUtil.getStr(map, "estateUnitName").split("_")[0]);
useInfo.setEstateUnitName(MapUtil.getStr(map, "estateUnitName").split("_")[1]);
} else {
Map<String, String> propertyUnitInfo = commonServiceImpl.queryTcmUnitInfoBySeq(MapUtil.getStr(map, "estateUnitName"), TcmUnitTypeEnum.CQ.getCode());
useInfo.setEstateUnitCreditCode(MapUtil.getStr(propertyUnitInfo, "unitCode"));
useInfo.setEstateUnitName(MapUtil.getStr(propertyUnitInfo, "unitName"));
}
useInfo.setPhone(String.valueOf(map.get("phone")));
useInfo.setSafetyManager(map.getString("safetyManagerName"));
useInfo.setSafetyManagerId(map.getString("safetyManagerId"));
......
package com.yeejoin.amos.boot.module.jg.biz.utils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.CodeGenerateDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Arrays;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Administrator
*/
@Component
@Slf4j
public class CodeUtil {
......@@ -25,10 +32,16 @@ public class CodeUtil {
*/
private static String[] EXCLUSION_CITY_REGIONS = {"610403", "610581"};
private final RedisUtils redisUtils;
public CodeUtil(RedissonClient redissonClient, CommonMapper commonMapper) {
private final Map<String, String> REGIONSEQ_CODE_MAP = new ConcurrentHashMap<>();
private static final String REGION_SEQ_MAP_KEY = "region:seq_map";
public CodeUtil(RedissonClient redissonClient, CommonMapper commonMapper, RedisUtils redisUtils) {
this.redissonClient = redissonClient;
this.commonMapper = commonMapper;
this.redisUtils = redisUtils;
}
......@@ -88,7 +101,104 @@ public class CodeUtil {
if (Arrays.asList(EXCLUSION_CITY_REGIONS).contains(receiveCompanyCode)) {
return receiveCompanyCode;
} else {
return commonMapper.selectCityCompanyCode(receiveCompanyCode, EXCLUSION_CITY_REGIONS);
if (!ValidationUtil.isEmpty(receiveCompanyCode)) {
String regionSeq = commonMapper.selectCompanyRegionSeq(receiveCompanyCode);
return this.getRegionCodeByRegionSeq(regionSeq);
// return commonMapper.selectCityCompanyCode(this.getRegionCodeByRegionSeq(regionSeq), EXCLUSION_CITY_REGIONS);
}
return null;
}
}
public String getRegionCodeByRegionSeq(String regionSeq) {
return REGIONSEQ_CODE_MAP.computeIfAbsent(regionSeq, (k) -> getRegionCodeFromRedisOrRemote(regionSeq));
}
/**
* 从 Redis 或远程接口获取 regionCode
*/
private String getRegionCodeFromRedisOrRemote(String regionSeq) {
// 1. 先从 Redis 获取整个 seqToCodeMap
Map<String, RegionModel> seqToCodeMap = getRegionSeqToCodeMapFromRedis();
// 2. 如果在 Redis Map 中找到,直接返回
RegionModel regionModel = seqToCodeMap.get(regionSeq);
if (!ValidationUtil.isEmpty(regionModel)) {
return regionModel.getRegionCode().toString();
}
// 3. Redis 中没有,调用远程接口获取最新数据
return getRegionCodeFromRemoteAndRefreshCache(regionSeq);
}
/**
* 从 Redis 获取 seqToCodeMap
*/
@SuppressWarnings("unchecked")
private Map<String, RegionModel> getRegionSeqToCodeMapFromRedis() {
try {
Object cachedMap = redisUtils.get(REGION_SEQ_MAP_KEY);
if (cachedMap instanceof Map) {
return (Map<String, RegionModel>) cachedMap;
}
} catch (Exception e) {
log.warn("从 Redis 获取 seqToCodeMap 失败,将重新加载", e);
}
return new HashMap<>();
}
/**
* 调用远程接口获取数据,并刷新 Redis 缓存
*/
private String getRegionCodeFromRemoteAndRefreshCache(String regionSeq) {
// 1. 调用远程接口获取完整的树结构数据
Collection<RegionModel> regionTree = Systemctl.regionClient.queryForTreeByAgencyCodeRightLike(null).getResult();
// 2. 将树结构转换为 seqToCodeMap
Map<String, RegionModel> seqToCodeMap = convertRegionTreeToMap(regionTree);
// 3. 将转换后的 Map 写入 Redis
try {
redisUtils.set(REGION_SEQ_MAP_KEY, seqToCodeMap);
log.info("已更新 Redis 中的 region seqToCodeMap,包含 {} 条记录", seqToCodeMap.size());
} catch (Exception e) {
log.error("更新 Redis seqToCodeMap 失败", e);
}
// 4. 从新生成的 Map 中查找需要的值
return Optional.ofNullable(seqToCodeMap.get(regionSeq)).map(RegionModel::getRegionCode).map(String::valueOf).orElse(null);
}
/**
* 将 RegionModel 树结构转换为 Map<sequenceNbr, regionCode>
*/
private Map<String, RegionModel> convertRegionTreeToMap(Collection<RegionModel> regionTree) {
Map<String, RegionModel> seqToCodeMap = new HashMap<>();
for (RegionModel region : regionTree) {
traverseAndAddToMap(region, seqToCodeMap);
}
return seqToCodeMap;
}
/**
* 递归遍历 RegionModel 树,将每个节点的 sequenceNbr 和 regionCode 存入 Map
*/
private void traverseAndAddToMap(RegionModel region, Map<String, RegionModel> seqToCodeMap) {
if (region == null) {
return;
}
// 将当前节点存入 Map
if (region.getSequenceNbr() != null && region.getRegionCode() != null) {
seqToCodeMap.put(String.valueOf(region.getSequenceNbr()), region);
}
// 递归处理子节点
Collection<RegionModel> children = region.getChildren();
if (children != null && !children.isEmpty()) {
for (RegionModel child : children) {
traverseAndAddToMap(child, seqToCodeMap);
}
}
}
......
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper 接口
......@@ -14,4 +15,13 @@ public interface CommonBaseMapper {
String getOrgCodeByCompanyCode(String companyCode);
String getCompanyCodeByOrgCode(String orgCode);
/**
* 按照 地市或者区县查询对应行政区划seq
*
* @param receiveCompanyCode 地市或者区县companyCode
* @return 地市对应行政区划seq
*/
String selectCompanyRegionSeq(@Param("receiveCompanyCode") String receiveCompanyCode);
}
......@@ -72,6 +72,12 @@ public interface JGStatisticsMapper {
List<Map<String, Object>> selectNoticeCountTopTen(@Param("orgCode") String orgCode, @Param("time") String time);
/**
* 告知类业务平均办理时效,统计维度:接收机构所在的行政区域;
* @param dpFilterParamDto 过滤条件
* @param orgCode 登录人或者选择区域转换后的orgCode
* @return 告知类业务平均办理时效
*/
List<CountDto> queryNoticeAvgDayByReceiveCompany(@Param("dto") DPFilterParamDto dpFilterParamDto, @Param("orgCode") String orgCode);
List<CountDto> queryUseAvgDayByReceiveCompany(@Param("dto") DPFilterParamDto dpFilterParamDto, @Param("orgCode") String orgCode);
......
......@@ -9,4 +9,13 @@
<select id="getCompanyCodeByOrgCode" resultType="java.lang.String">
select company_code from privilege_company where org_code = #{orgCode} limit 1
</select>
<select id="selectCompanyRegionSeq" resultType="java.lang.String">
select
region_seq
from
privilege_company
where
company_code = #{receiveCompanyCode} and is_deleted = false
</select>
</mapper>
......@@ -665,212 +665,360 @@
COUNT DESC
limit 10
</select>
<select id="queryNoticeAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.handle_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_org_credit_code AS keyStr
FROM
tzs_jg_installation_notice T
WHERE
T.notice_status = 6616
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_org_credit_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_org_credit_code
union all
SELECT
round(avg(T.accept_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_maintain_notice T
WHERE
T.notice_status = 6616
T.notice_status = 6616
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.accept_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_reform_notice T
WHERE
T.notice_status = 6616
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.handle_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_transfer_notice T
WHERE
T.notice_status = 6616
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
</select>
<select id="queryUseAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.audit_pass_date::date - T.reg_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_use_registration T
WHERE
T.audit_status = '已完成' and T.is_delete = 0
and T.receive_company_org_code like concat(#{orgCode}, '%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.reg_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.reg_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY bi.supervise_org_code
union all
SELECT
round(avg(T.audit_pass_date::date - T.reg_date::date + 1),1) as strValue,
pc.org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_vehicle_information T,
privilege_company pc
tzs_jg_vehicle_information T
WHERE
T.status = '已完成'
and t.receive_company_code = pc.company_code
and pc.org_code like concat(#{orgCode}, '%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.reg_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.reg_date as date),#{dto.endDate})
</if>
GROUP BY pc.org_code
GROUP BY bi.supervise_org_code
</select>
<select id="queryChangeAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.audit_pass_date::date - T.apply_date::date + 1),1) as strValue,
T.org_code AS keyStr
round(avg(crn.audit_pass_date::date - crn.apply_date::date + 1),1) as strValue,
crn.receive_company_code AS keyStr
FROM
(
SELECT
pc.org_code,
crn.apply_date,
crn.audit_pass_date
FROM
tzs_jg_change_registration_name crn,
privilege_company pc
WHERE
crn.receive_org_code = pc.company_code
AND crn.audit_status = '已完成'
and pc.org_code like concat(#{orgCode}, '%')
and crn.apply_date is not null
and crn.audit_pass_date is not null
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(crn.apply_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(crn.apply_date as date),#{dto.endDate})
</if>
) T
GROUP BY T.org_code
tzs_jg_change_registration_name crn
WHERE
crn.audit_status = '已完成'
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and crn.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
and crn.apply_date is not null
and crn.audit_pass_date is not null
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(crn.apply_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(crn.apply_date as date),#{dto.endDate})
</if>
GROUP BY crn.receive_company_code
union all
SELECT
round(avg(T.audit_pass_date::date - T.reg_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_change_registration_reform T
WHERE
T.audit_status = '已完成'
and T.receive_company_org_code like concat(#{orgCode},'%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.reg_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.reg_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.audit_pass_date::date - T.reg_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_change_registration_transfer T
WHERE
T.audit_status = '已完成'
and T.receive_company_org_code like concat(#{orgCode},'%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.reg_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.reg_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.audit_pass_date::date - T.apply_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_org_code AS keyStr
FROM
tzs_jg_change_registration_unit T
WHERE
T.status = '已完成'
and T.receive_company_org_code like concat(#{orgCode},'%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_org_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.apply_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.apply_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_org_code
union all
SELECT
round(avg(T.audit_pass_date::date - T.apply_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_org_code AS keyStr
FROM
tzs_jg_change_vehicle_registration_unit T
WHERE
T.status = '已完成'
and T.receive_company_org_code like concat(#{orgCode},'%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_org_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.apply_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.apply_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_org_code
</select>
<select id="queryDisableAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.audit_pass_date::date - T.apply_date::date + 1),1) as strValue,
T.org_code AS keyStr
T.receive_company_code AS keyStr
FROM
(
SELECT
crn.sequence_nbr,
pc.org_code,
crn.receive_company_code,
crn.audit_pass_date,
crn.apply_date
FROM
tzs_jg_enable_disable crn,
privilege_company pc
tzs_jg_enable_disable crn
WHERE
crn.receive_company_code = pc.company_code
AND crn.audit_status = '已完成'
and pc.org_code like concat(#{orgCode}, '%')
crn.audit_status = '已完成'
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and crn.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.apply_date as date),#{dto.beginDate})
</if>
......@@ -879,26 +1027,37 @@
</if>
) T
GROUP BY
T.org_code
T.receive_company_code
</select>
<select id="queryCancelAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.audit_pass_date::date - T.create_date::date + 1),1) as strValue,
T.org_code AS keyStr
T.receive_org_code AS keyStr
FROM
(
SELECT
crn.sequence_nbr,
pc.org_code,
crn.receive_org_code,
crn.audit_pass_date,
crn.create_date
FROM
tzs_jg_scrap_cancel crn,
privilege_company pc
tzs_jg_scrap_cancel crn
WHERE
crn.receive_org_code = pc.company_code
AND crn.audit_status = '已完成'
and pc.org_code like concat(#{orgCode}, '%')
crn.audit_status = '已完成'
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and crn.receive_org_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.create_date as date),#{dto.beginDate})
</if>
......@@ -906,7 +1065,7 @@
and date_le(CAST(T.create_date as date),#{dto.endDate})
</if>
) T
GROUP BY T.org_code
GROUP BY T.receive_org_code
</select>
<select id="selectAZNoticeDetailList" resultType="java.util.Map">
SELECT
......
......@@ -1313,9 +1313,9 @@ public class JGDPStatisticsServiceImpl {
List<String> yData = new ArrayList<>();
regionModels.forEach(r -> {
xData.add(r.getRegionName());
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
if (!ValidationUtil.isEmpty(orgCode)) {
yData.add(this.avgAndSumDealDate(countDtos.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
String selfAndChildRegion = stCommonService.getSelfAndChildRegion(r);
if (!ValidationUtil.isEmpty(selfAndChildRegion)) {
yData.add(this.avgAndSumDealDate(countDtos.stream().filter(c -> selfAndChildRegion.contains(stCommonService.castCompanyCode2RegionCode(c.getKeyStr()))).collect(Collectors.toList())));
} else {
yData.add("0");
}
......
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.join.ScoreMode;
......@@ -77,23 +78,24 @@ public class StCommonServiceImpl {
*/
public final static String REGION_LEVEL_THIRD = "3";
private CommonBaseMapper commonMapper;
private final CommonBaseMapper commonMapper;
private RestHighLevelClient restHighLevelClient;
private final RestHighLevelClient restHighLevelClient;
private TZSCommonServiceImpl tzsCommonService;
private final TZSCommonServiceImpl tzsCommonService;
private EquipTechParamPipelineMapper techParamsPipelineMapper;
private final EquipTechParamPipelineMapper techParamsPipelineMapper;
private EquipmentCategoryMapper equipmentCategoryMapper;
private final EquipmentCategoryMapper equipmentCategoryMapper;
private ZLStatisticsMapper zlStatisticsMapper;
private final ZLStatisticsMapper zlStatisticsMapper;
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
@Getter
private static final Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
private static Map<Integer, RegionModel> regionCodeRegionMap = new ConcurrentHashMap<>();
private static List<RegionModel> regionModels = new ArrayList<>();
private static final List<RegionModel> regionModels = new ArrayList<>();
private static List<EquipmentCategoryDto> equipmentCategoryDtos;
......@@ -111,10 +113,6 @@ public class StCommonServiceImpl {
this.tzsCommonService = tzsCommonService;
}
public static Map<String, String> getRegionCodeOrgCodeMap() {
return regionCodeOrgCodeMap;
}
public static List<EquipmentCategoryDto> getEquipmentCategory() {
return equipmentCategoryDtos;
}
......@@ -156,9 +154,18 @@ public class StCommonServiceImpl {
public String getAndSetOrgCode(DPFilterParamDto dpFilterParamDto) {
String cityCode = dpFilterParamDto.getCityCode();
this.setChildCompanyCodeByRegion(cityCode, dpFilterParamDto);
return getAndSetOrgCode(cityCode);
}
/**
* 按照regionCode查询区域下的公司
* @param cityCode 区域
* @param dpFilterParamDto 过滤条件
*/
private void setChildCompanyCodeByRegion(String cityCode, DPFilterParamDto dpFilterParamDto) {
}
public String getAndSetOrgCode(String cityCode) {
String orgCode = regionCodeOrgCodeMap.get(cityCode);
if (orgCode == null) {
......@@ -551,4 +558,25 @@ public class StCommonServiceImpl {
children.forEach(child -> buildSubtree(child, parentCodeMap));
}
}
/**
* 获取本级及子级区域code
* @param region 区域
* @return 本级及子级区域code
*/
public String getSelfAndChildRegion(RegionModel region) {
return null;
}
/**
* 将单位code转行政区划
* @param companyCode 单位code
* @return 单位所在行政区划
*/
public CharSequence castCompanyCode2RegionCode(String companyCode) {
String regionSeq = commonMapper.selectCompanyRegionSeq(companyCode);
Optional<RegionModel> optionalRegionModel = regionModels.stream().filter(r-> String.valueOf(r.getSequenceNbr()).equals(regionSeq)).findFirst();
optionalRegionModel.orElseThrow(()->new RuntimeException(""));
return null;
}
}
......@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -383,6 +384,7 @@ public class TzBaseEnterpriseInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除企业", notes = "批量删除企业")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Boolean> deleteBatch(@RequestParam String ids) {
return ResponseHelper.buildResponse(enterpriseManageService.delete(Arrays.asList(ids.split(","))));
}
......@@ -390,6 +392,7 @@ public class TzBaseEnterpriseInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/enableBatch")
@ApiOperation(httpMethod = "PUT", value = "企业启用", notes = "企业启用")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Boolean> enableBatch(@RequestParam String ids) {
return ResponseHelper.buildResponse(enterpriseManageService.enable(Arrays.asList(ids.split(","))));
}
......@@ -397,6 +400,7 @@ public class TzBaseEnterpriseInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/disableBatch")
@ApiOperation(httpMethod = "PUT", value = "企业停用", notes = "企业停用")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Boolean> disableBatch(@RequestParam String ids) {
return ResponseHelper.buildResponse(enterpriseManageService.disable(Arrays.asList(ids.split(","))));
}
......
......@@ -117,7 +117,7 @@ public class PlatformUserTopicMessage extends EmqxListener {
}
if (!ValidationUtil.isEmpty(dataResult) && StringUtils.isNotEmpty(path)) {
if (path.contains("company")) {
if ("监管机构".equals(dataResult.get("companyType"))) {
if ("监管机构".equals(dataResult.get("companyType")) || "行政审批局".equals(dataResult.get("companyType"))) {
equipmentCategoryService.deleteAllRegulatorUnitTree();
}
tzBaseEnterpriseInfoService.refreshCompanyInfo(dataResult, method);
......
......@@ -369,7 +369,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
// 一行数据可能 满足几个remove,所以需要删除后,继续下一循环
continue;
}
if (e.get("companyName").toString().contains("行政审批局")) {
if (e.get("companyType").toString().contains("行政审批局")) {
it.remove();
// 一行数据可能 满足几个remove,所以需要删除后,继续下一循环
continue;
......
......@@ -1484,10 +1484,10 @@ public class TzBaseEnterpriseInfoServiceImpl
log.error("平台获取子单位失败");
return;
}
List<CompanyModel> companyModels = result.getResult().stream().filter(i -> !i.getCompanyType().equals("监管机构")).collect(Collectors.toList());
List<CompanyModel> companyModels = result.getResult().stream().filter(i -> !i.getCompanyType().equals("监管机构") && !i.getCompanyType().equals("行政审批局")).collect(Collectors.toList());
// 如果消息中的单位是企业
if (!companyBo.getCompanyType().equals("监管机构")) {
if (!companyBo.getCompanyType().equals("监管机构") && !companyBo.getCompanyType().equals("行政审批局")) {
switch (Objects.requireNonNull(PlatformOpMethodTypeEnum.getEnumByCode(method))) {
case CREATE:
case INSERT:
......
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