Commit e55cb9bf authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register_to_0715' of…

Merge branch 'develop_tzs_register_to_0715' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_tzs_register_to_0715
parents 0af2db3d 312e56b6
......@@ -26,4 +26,9 @@ public class DPFilterParamDto {
* 数据统计的结束日期
*/
private String endDate;
/**
* 业务类型0告知管理,1使用登记,2变更登记,3停用启用,4注销报废
*/
private String businessKey;
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface DPStatisticsMapper {
List<Map<String, Object>> maintenanceCountTopTen(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<Map<String, Object>> maintenanceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<Map<String, Object>> installCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> maintenanceNoticeCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> reformCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> transferCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> useCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> vehicleCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> changeNameCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> changeReformCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> changeTransferCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> changeUnitCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> changeVehicleCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> disableCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> cancelCount(@Param("cityCode") String cityCode);
List<Map<String, Object>> installEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> maintenanceEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> reformEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> transferEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> useEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> changeReformEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> changeTransferEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> changeUnitEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> vehicleEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
}
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.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgMaintainNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
......@@ -44,4 +45,5 @@ public interface JgMaintainNoticeMapper extends CustomBaseMapper<JgMaintainNotic
Map<String, Object> getEquipInfoByRecord(String record);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
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.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgReformNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
......@@ -40,4 +41,6 @@ public interface JgReformNoticeMapper extends CustomBaseMapper<JgReformNotice> {
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
void updatePromoter(@Param("id") Long id);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
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.CompanyEquipCountDto;
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;
......@@ -26,4 +27,6 @@ public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotic
@MapKey("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
<?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.jg.api.mapper.DPStatisticsMapper">
<select id="maintenanceCountTopTen" resultType="java.util.Map">
SELECT
COUNT(1),
pc.company_name AS companyName,
sr.region_name AS regionName
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN ( SELECT DISTINCT record, ME_UNIT_CREDIT_CODE FROM idx_biz_jg_maintenance_record_info ) AS jri ON jri.ME_UNIT_CREDIT_CODE = bi.use_unit_code
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{dpFilterParamDto.cityCode} )
GROUP BY
sr.region_code
ORDER BY
COUNT DESC
LIMIT 10;
</select>
<select id="maintenanceCount" resultType="java.util.Map">
SELECT
COUNT(1),
pc.company_name AS companyName,
sr.region_name AS regionName
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN ( SELECT DISTINCT record, ME_UNIT_CREDIT_CODE FROM idx_biz_jg_maintenance_record_info ) AS jri ON jri.ME_UNIT_CREDIT_CODE = bi.use_unit_code
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{dpFilterParamDto.cityCode} )
GROUP BY
sr.region_code
</select>
<select id="installCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code AS regionCode
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_installation_notice T ON T.use_unit_credit_code = bi.use_unit_code and T.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="maintenanceNoticeCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_maintain_notice mn ON mn.use_unit_credit_code = bi.use_unit_code
AND mn.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="reformCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_reform_notice rm ON rm.use_unit_credit_code = bi.use_unit_code
AND rm.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="transferCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_transfer_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="useCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_use_registration ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="vehicleCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information vi ON vi.use_unit_credit_code = bi.use_unit_code
AND vi.status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="changeNameCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_name crn ON crn.use_unit_credit_code = bi.use_unit_code
AND crn.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="changeReformCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_reform t ON t.use_unit_credit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="changeTransferCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_transfer t ON t.use_unit_credit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="changeUnitCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_unit t ON t.use_unit_credit_code = bi.use_unit_code
AND t.status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="changeVehicleCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_unit t ON t.use_unit_credit_code = bi.use_unit_code
AND t.status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="disableCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_enable_disable t ON t.use_unit_credit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="cancelCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_scrap_cancel t ON t.use_unit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select id="installEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_installation_notice T ON T.use_unit_credit_code = bi.use_unit_code
AND T.notice_status = 6616
INNER JOIN tzs_jg_installation_notice_eq te ON te.equip_transfer_id = T.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and T.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="maintenanceEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_maintain_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN tzs_jg_maintain_notice_eq te ON te.equip_transfer_id = tn.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and tn.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="reformEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_reform_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN tzs_jg_reform_notice_eq te ON te.equip_transfer_id = tn.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and tn.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="transferEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_transfer_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN tzs_jg_transfer_notice_eq te ON te.equip_transfer_id = tn.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and tn.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="useEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_use_registration ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_use_registration_eq te ON te.equip_transfer_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="changeReformEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_reform ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_change_registration_reform_eq te ON te.equip_transfer_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="changeTransferEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_transfer ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_change_registration_transfer_eq te ON te.equip_transfer_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="changeUnitEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_unit ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.status = '已完成'
INNER JOIN tzs_jg_change_registration_unit_eq te ON te.unit_change_registration_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
<select id="vehicleEquCount" resultType="java.util.Map">
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_vehicle_information_eq te ON te.vehicle_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date &gt;= #{startTime}
GROUP BY
jri.equ_category
</select>
</mapper>
......@@ -274,5 +274,16 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = oi.record
WHERE oi.record = #{record} ORDER BY oi."rec_date" DESC LIMIT 1
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_maintain_notice a,
tzs_jg_maintain_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</select>
</mapper>
......@@ -203,4 +203,16 @@
set promoter = null
where sequence_nbr = #{id}
</update>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_reform_notice a,
tzs_jg_reform_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</select>
</mapper>
......@@ -217,4 +217,16 @@
tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_transfer_notice a,
tzs_jg_transfer_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</select>
</mapper>
......@@ -115,4 +115,91 @@ public class DPStatisticsController {
}
return ResponseHelper.buildResponse(statisticsService.queryBizCycleData(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-左侧设备状态情况统计", notes = "监管大屏-左侧设备状态情况统计")
@PostMapping(value = "/equStateCount")
public ResponseModel<List<Map<String,Object>>> equStateCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.equStateCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-右侧停用、注销、报废设备状态情况统计", notes = "监管大屏-右侧停用、注销、报废设备状态情况统计")
@PostMapping(value = "/equStopStateCount")
public ResponseModel<Map<String,Object>> equStopStateCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.equStopStateCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-维保电梯数量TOP10", notes = "监管大屏-维保电梯数量TOP10")
@PostMapping(value = "/maintenanceCountTopTen")
public ResponseModel<List<Map<String,Object>>> maintenanceCountTopTen(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.maintenanceCountTopTen(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-维保电梯数量", notes = "监管大屏-维保电梯数量")
@PostMapping(value = "/maintenanceCount")
public ResponseModel<Map<String,Object>> maintenanceCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.maintenanceCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-左侧各地市业务办理平均时效", notes = "监管大屏-左侧各地市业务办理平均时效")
@PostMapping(value = "/cityBusinessCount")
public ResponseModel<Map<String,Object>> cityBusinessCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.cityBusinessCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-左侧获取业务类型", notes = "监管大屏-左侧获取业务类型")
@PostMapping(value = "/getBusinessKey")
public ResponseModel<List<Map<String,Object>>> getBusinessKey(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.getBusinessKey(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-右侧施工告知的设备数办理情况统计", notes = "监管大屏-右侧施工告知的设备数办理情况统计")
@PostMapping(value = "/getNoticeEquCount")
public ResponseModel<Map<String,Object>> getNoticeEquCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.getNoticeEquCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-右侧使用办理的设备数量情况统计", notes = "监管大屏-右侧使用办理的设备数量情况统计")
@PostMapping(value = "/getRegEquCount")
public ResponseModel<Map<String,Object>> getRegEquCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.getRegEquCount(dpFilterParamDto));
}
}
......@@ -10,10 +10,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.FourColorCountItemEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.FourColorEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgScrapCancelMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
......@@ -36,8 +33,11 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -114,6 +114,9 @@ public class DPStatisticsServiceImpl {
private static List<RegionModel> regionModels = new ArrayList<>();
@Resource
private DPStatisticsMapper dpStatisticsMapper;
public DPStatisticsServiceImpl(EquipmentCategoryMapper equipmentCategoryMapper, JgUseRegistrationMapper useRegistrationMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, JgEnableDisableMapper enableDisableMapper, JgScrapCancelMapper scrapCancelMapper, RestHighLevelClient restHighLevelClient, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, CommonMapper commonMapper, TzsUserInfoMapper userInfoMapper) {
this.equipmentCategoryMapper = equipmentCategoryMapper;
......@@ -668,4 +671,608 @@ public class DPStatisticsServiceImpl {
}
return orgCode;
}
public List<Map<String,Object>> equStateCount(DPFilterParamDto dpFilterParamDto) {
List<Map<String,Object>> resultList = new ArrayList<>();
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + dpFilterParamDto.getCityCode() + "*"));
// 纳管状态为已纳管
boolMust.must(QueryBuilders.termsQuery("IS_INTO_MANAGEMENT", true));
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.query(boolMust);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("EQU_STATE_COUNT").field("EQU_STATE");
builder.aggregation(aggregationBuilder);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
Terms terms = response.getAggregations().get("EQU_STATE_COUNT");
Map<String, Long> dataMap = new HashMap<>();
Long total = terms.getBuckets().stream().mapToLong(Terms.Bucket::getDocCount).sum();
for (Terms.Bucket bucket : terms.getBuckets()) {
String category = bucket.getKeyAsString(); // 或者使用 bucket.getKey() 对于非字符串类型
long docCount = bucket.getDocCount();
dataMap.put(category, docCount);
}
/**
* 3 报废
* 1 在用
* 2 停用
* 4 注销
* 0 未登记
*/
for(int i = 0; i < 5; i++){
Map<String,Object> map = new HashMap();
if(i == 0){
map.put("name", "未登记");
}else if(i == 1){
map.put("name", "在用");
}else if(i == 2){
map.put("name", "停用");
}else if(i == 3){
map.put("name", "报废");
}else if(i == 4){
map.put("name", "注销");
}
map.put("value", dataMap.getOrDefault(String.valueOf(i), 0L));
resultList.add(map);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return resultList;
}
public Map<String,Object> equStopStateCount(DPFilterParamDto dpFilterParamDto) {
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + dpFilterParamDto.getCityCode() + "*"));
// 纳管状态为已纳管
boolMust.must(QueryBuilders.termsQuery("IS_INTO_MANAGEMENT", true));
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.query(boolMust);
// 设备状态
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("EQU_STATE_COUNT").field("EQU_STATE")
//设备类型
.subAggregation(AggregationBuilders.terms("EQU_LIST_CODE_COUNT").field("EQU_LIST_CODE"));
builder.aggregation(aggregationBuilder);
request.source(builder);
try{
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
Terms terms = response.getAggregations().get("EQU_STATE_COUNT");
Map<String, Long> dataMap = new HashMap<>();
for (Terms.Bucket bucket : terms.getBuckets()) {
String category = bucket.getKeyAsString(); // 或者使用 bucket.getKey() 对于非字符串类型
Terms subTerms = bucket.getAggregations().get("EQU_LIST_CODE_COUNT");
for(Terms.Bucket subBucket :subTerms.getBuckets()){
String subCategory = subBucket.getKeyAsString();
long docCount = subBucket.getDocCount();
dataMap.put(category+"#"+subCategory, docCount);
}
}
/**
* 2300 气瓶
* 3000 电梯
* 4000 起重机械
* 2000 压力容器
* 5000 场(厂)内专用机动车辆
* 1000 锅炉
* 8000 压力管道
* F000 安全附件
* 7000 压力管道元件
* 9000 客运索道
* 6000 大型游乐设施
*/
/**
* 2 停用
* 4 注销
* 3 报废
*/
List<Map<String,Object>> legendDataList = new ArrayList<>();
for(int i = 0; i < 3; i++){
Map<String,Object> map = new HashMap();
if(i == 0){
map.put("dataKey","stop");
map.put("name","停用");
}else if(i == 1){
map.put("dataKey","logout");
map.put("name","注销");
}else if(i == 2){
map.put("dataKey","scrap");
map.put("name","报废");
}
legendDataList.add(map);
}
List<String> xDataList = Arrays.asList("气瓶", "电梯", "压力容器", "锅炉", "起重机械", "场(厂)内专用", "大型游乐设施", "压力管道", "客运索道");
List<Object> stop = new ArrayList<>();
List<Object> logout = new ArrayList<>();
List<Object> scrap = new ArrayList<>();
for(int i = 0; i < 9; i++){
if(i == 0){
stop.add(dataMap.getOrDefault("2#2300", 0L));
logout.add(dataMap.getOrDefault("4#2300", 0L));
scrap.add(dataMap.getOrDefault("3#2300", 0L));
}else if(i == 1){
stop.add(dataMap.getOrDefault("2#3000", 0L));
logout.add(dataMap.getOrDefault("4#3000", 0L));
scrap.add(dataMap.getOrDefault("3#3000", 0L));
}else if(i == 2){
stop.add(dataMap.getOrDefault("2#2000", 0L)-dataMap.getOrDefault("2#2300", 0L));
logout.add(dataMap.getOrDefault("4#2000", 0L)-dataMap.getOrDefault("4#2300", 0L));
scrap.add(dataMap.getOrDefault("3#2000", 0L)-dataMap.getOrDefault("3#2300", 0L));
}else if(i == 3){
stop.add(dataMap.getOrDefault("2#1000", 0L));
logout.add(dataMap.getOrDefault("4#1000", 0L));
scrap.add(dataMap.getOrDefault("3#1000", 0L));
}else if(i == 4){
stop.add(dataMap.getOrDefault("2#4000", 0L));
logout.add(dataMap.getOrDefault("4#4000", 0L));
scrap.add(dataMap.getOrDefault("3#4000", 0L));
}else if(i == 5){
stop.add(dataMap.getOrDefault("2#5000", 0L));
logout.add(dataMap.getOrDefault("4#5000", 0L));
scrap.add(dataMap.getOrDefault("3#5000", 0L));
}else if(i == 6){
stop.add(dataMap.getOrDefault("2#6000", 0L));
logout.add(dataMap.getOrDefault("4#6000", 0L));
scrap.add(dataMap.getOrDefault("3#6000", 0L));
}else if(i == 7){
stop.add(dataMap.getOrDefault("2#8000", 0L));
logout.add(dataMap.getOrDefault("4#8000", 0L));
scrap.add(dataMap.getOrDefault("3#8000", 0L));
}else if(i == 8){
stop.add(dataMap.getOrDefault("2#9000", 0L));
logout.add(dataMap.getOrDefault("4#9000", 0L));
scrap.add(dataMap.getOrDefault("3#9000", 0L));
}
}
Map<String,Object> returnMap = new HashMap<>();
returnMap.put("legendData", legendDataList);
returnMap.put("xdata", xDataList);
returnMap.put("stop",stop);
returnMap.put("logout",logout);
returnMap.put("scrap",scrap);
return returnMap;
}catch (Exception e){
throw new RuntimeException(e);
}
}
public List<Map<String,Object>> maintenanceCountTopTen(DPFilterParamDto dpFilterParamDto) {
List<Map<String,Object>> list = dpStatisticsMapper.maintenanceCountTopTen(dpFilterParamDto);
List<Map<String,Object>> resultList = new ArrayList<>();
for(int i = 0; i < list.size(); i++){
Map<String,Object> result = new HashMap<>();
result.put("key",i);
result.put("city",list.get(i).get("regionName"));
result.put("count",list.get(i).get("count"));
result.put("name",list.get(i).get("companyName"));
resultList.add(result);
}
return resultList;
}
public Map<String,Object> maintenanceCount(DPFilterParamDto dpFilterParamDto) {
List<Map<String,Object>> list = dpStatisticsMapper.maintenanceCount(dpFilterParamDto);
Map<String,Object> resultMap = new HashMap<>();
List xList = new ArrayList();
List yList = new ArrayList();
for(int i = 0; i < list.size(); i++){
xList.add(list.get(i).get("regionName"));
yList.add(list.get(i).get("count"));
}
resultMap.put("xdata",xList);
resultMap.put("ydata",yList);
return resultMap;
}
public Map<String,Object> cityBusinessCount(DPFilterParamDto dpFilterParamDto) {
Map<String,Object> resultMap = new HashMap<>();
/**
* 业务类型0告知管理,1使用登记,2变更登记,3停用启用,4注销报废
*/
if("0".equals(dpFilterParamDto.getBusinessKey())){
resultMap = noticeCount(resultMap,dpFilterParamDto.getCityCode());
}else if("1".equals(dpFilterParamDto.getBusinessKey())){
resultMap = useCount(resultMap,dpFilterParamDto.getCityCode());
}else if("2".equals(dpFilterParamDto.getBusinessKey())){
resultMap = changeCount(resultMap,dpFilterParamDto.getCityCode());
}else if("3".equals(dpFilterParamDto.getBusinessKey())){
resultMap = disableCount(resultMap,dpFilterParamDto.getCityCode());
}else if("4".equals(dpFilterParamDto.getBusinessKey())){
resultMap = cancelCount(resultMap,dpFilterParamDto.getCityCode());
}
return resultMap;
}
private Map<String, Object> cancelCount(Map<String, Object> resultMap, String cityCode) {
Map<String,Integer> countMap = new HashMap<>();
//注销报废
List<Map<String,Object>> cancelList = dpStatisticsMapper.cancelCount(cityCode);
countByMap(countMap,cancelList);
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
countMap.forEach((k,v)->{
xDataList.add(k);
yDataList.add(v);
});
resultMap.put("xdata",xDataList);
resultMap.put("ydata",yDataList);
return resultMap;
}
private Map<String, Object> disableCount(Map<String, Object> resultMap, String cityCode) {
Map<String,Integer> countMap = new HashMap<>();
//启用停用
List<Map<String,Object>> disableList = dpStatisticsMapper.disableCount(cityCode);
countByMap(countMap,disableList);
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
countMap.forEach((k,v)->{
xDataList.add(k);
yDataList.add(v);
});
resultMap.put("xdata",xDataList);
resultMap.put("ydata",yDataList);
return resultMap;
}
private Map<String, Object> changeCount(Map<String, Object> resultMap, String cityCode) {
Map<String,Integer> countMap = new HashMap<>();
//更名变更登记
List<Map<String,Object>>changeNameList = dpStatisticsMapper.changeNameCount(cityCode);
countByMap(countMap,changeNameList);
//改造变更登记
List<Map<String,Object>> reformList = dpStatisticsMapper.changeReformCount(cityCode);
countByMap(countMap,reformList);
//移装变更登记
List<Map<String,Object>> transferList = dpStatisticsMapper.changeTransferCount(cityCode);
countByMap(countMap,transferList);
//单位变更登记
List<Map<String,Object>> unitList = dpStatisticsMapper.changeUnitCount(cityCode);
countByMap(countMap,unitList);
//单位变更登记
List<Map<String,Object>> vehicleList = dpStatisticsMapper.changeVehicleCount(cityCode);
countByMap(countMap,vehicleList);
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
countMap.forEach((k,v)->{
xDataList.add(k);
yDataList.add(v);
});
resultMap.put("xdata",xDataList);
resultMap.put("ydata",yDataList);
return resultMap;
}
private Map<String, Object> useCount(Map<String, Object> resultMap, String cityCode) {
Map<String,Integer> countMap = new HashMap<>();
//使用登记
List<Map<String,Object>> useList = dpStatisticsMapper.useCount(cityCode);
countByMap(countMap,useList);
//气瓶登记
List<Map<String,Object>> vehicleList = dpStatisticsMapper.vehicleCount(cityCode);
countByMap(countMap,vehicleList);
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
countMap.forEach((k,v)->{
xDataList.add(k);
yDataList.add(v);
});
resultMap.put("xdata",xDataList);
resultMap.put("ydata",yDataList);
return resultMap;
}
private Map<String, Object> noticeCount(Map<String, Object> resultMap, String cityCode) {
Map<String,Integer> countMap = new HashMap<>();
//安装告知
List<Map<String,Object>> installlist = dpStatisticsMapper.installCount(cityCode);
countByMap(countMap,installlist);
//维修告知
List<Map<String,Object>> maintenancelist = dpStatisticsMapper.maintenanceNoticeCount(cityCode);
countByMap(countMap,maintenancelist);
//改造告知
List<Map<String,Object>> reformlist = dpStatisticsMapper.reformCount(cityCode);
countByMap(countMap,reformlist);
//移装告知
List<Map<String,Object>> transferlist = dpStatisticsMapper.transferCount(cityCode);
countByMap(countMap,transferlist);
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
countMap.forEach((k,v)->{
xDataList.add(k);
yDataList.add(v);
});
resultMap.put("xdata",xDataList);
resultMap.put("ydata",yDataList);
return resultMap;
}
private void countByMap(Map<String,Integer> countMap, List<Map<String,Object>> list){
for(int i = 0; i < list.size(); i++){
if(null == countMap.get(list.get(i).get("regionName"))){
countMap.put(list.get(i).get("regionName").toString(),Integer.valueOf(list.get(i).get("count")+""));
}else{
countMap.put(list.get(i).get("regionName").toString(),countMap.get(list.get(i).get("regionName").toString())+Integer.valueOf(list.get(i).get("count")+""));
}
}
}
public List<Map<String,Object>> getBusinessKey(DPFilterParamDto dpFilterParamDto) {
List<Map<String,Object>> resultList = new ArrayList<>();
/**
* 告知管理、使用登记、变更登记、停用启用、注销报废
*/
for(int i = 0; i < 5; i++){
Map<String,Object> result = new HashMap<>();
if(i == 0){
result.put("key",i+"");
result.put("name","告知管理");
}else if(i == 1){
result.put("key",i+"");
result.put("name","使用登记");
}else if(i == 2){
result.put("key",i+"");
result.put("name","变更登记");
}else if(i == 3){
result.put("key",i+"");
result.put("name","停用启用");
}else if(i == 4){
result.put("key",i+"");
result.put("name","注销报废");
}
resultList.add(result);
}
return resultList;
}
public Map<String,Object> getNoticeEquCount(DPFilterParamDto dpFilterParamDto) {
String startTime = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
//安装告知
List<Map<String,Object>> installlist = dpStatisticsMapper.installEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> installCountMap = new HashMap<>();
countNoticEquList(installCountMap,installlist);
//维修告知
List<Map<String,Object>> maintenancelist = dpStatisticsMapper.maintenanceEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> maintenanceCountMap = new HashMap<>();
countNoticEquList(maintenanceCountMap,maintenancelist);
//改造告知
List<Map<String,Object>> reformlist = dpStatisticsMapper.reformEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> reformCountMap = new HashMap<>();
countNoticEquList(reformCountMap,reformlist);
//移装告知
List<Map<String,Object>> transferlist = dpStatisticsMapper.transferEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> transferCountMap = new HashMap<>();
countNoticEquList(transferCountMap,transferlist);
Map<String,Object> resultMap = new HashMap<>();
List legendData = new ArrayList<>();
for(int i = 0; i < 4; i++){
Map<String,String> map = new HashMap<>();
if(i == 0){
map.put("dataKey","installNotify");
map.put("value","安装告知");
}else if(i == 1){
map.put("dataKey","transformNotify");
map.put("value","改造告知");
}else if(i == 2){
map.put("dataKey","maintainNotify");
map.put("value","维修告知");
}else if(i == 3){
map.put("dataKey","transloadingNotify");
map.put("value","移装告知");
}
legendData.add(map);
}
resultMap.put("legendData",legendData);
List<String> xDataList = Arrays.asList("气瓶", "电梯", "压力容器", "锅炉", "起重机械", "场(厂)内专用", "大型游乐设施", "压力管道", "客运索道");
resultMap.put("xdata",xDataList);
List installNotify = new ArrayList<>();
List transformNotify = new ArrayList<>();
List maintainNotify = new ArrayList<>();
List transloadingNotify = new ArrayList<>();
/**
* 2300 气瓶
* 3000 电梯
* 2000 压力容器
* 1000 锅炉
* 4000 起重机械
* 5000 场(厂)内专用机动车辆
* 6000 大型游乐设施
* 8000 压力管道
* 9000 客运索道
*/
for(int i = 0; i < xDataList.size(); i++){
if(i == 0){
installNotify.add(installCountMap.getOrDefault("2300",0));
transformNotify.add(reformCountMap.getOrDefault("2300",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("2300",0));
transloadingNotify.add(transferCountMap.getOrDefault("2300",0));
}else if(i == 1){
installNotify.add(installCountMap.getOrDefault("3000",0));
transformNotify.add(reformCountMap.getOrDefault("3000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("3000",0));
transloadingNotify.add(transferCountMap.getOrDefault("3000",0));
}else if(i == 2){
installNotify.add(installCountMap.getOrDefault("2000",0));
transformNotify.add(reformCountMap.getOrDefault("2000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("2000",0));
transloadingNotify.add(transferCountMap.getOrDefault("2000",0));
}else if(i == 3){
installNotify.add(installCountMap.getOrDefault("1000",0));
transformNotify.add(reformCountMap.getOrDefault("1000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("1000",0));
transloadingNotify.add(transferCountMap.getOrDefault("1000",0));
}else if(i == 4){
installNotify.add(installCountMap.getOrDefault("4000",0));
transformNotify.add(reformCountMap.getOrDefault("4000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("4000",0));
transloadingNotify.add(transferCountMap.getOrDefault("4000",0));
}else if(i == 5){
installNotify.add(installCountMap.getOrDefault("5000",0));
transformNotify.add(reformCountMap.getOrDefault("5000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("5000",0));
transloadingNotify.add(transferCountMap.getOrDefault("5000",0));
}else if(i == 6){
installNotify.add(installCountMap.getOrDefault("6000",0));
transformNotify.add(reformCountMap.getOrDefault("6000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("6000",0));
transloadingNotify.add(transferCountMap.getOrDefault("6000",0));
}else if(i == 7){
installNotify.add(installCountMap.getOrDefault("8000",0));
transformNotify.add(reformCountMap.getOrDefault("8000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("8000",0));
transloadingNotify.add(transferCountMap.getOrDefault("8000",0));
}else if(i == 8){
installNotify.add(installCountMap.getOrDefault("9000",0));
transformNotify.add(reformCountMap.getOrDefault("9000",0));
maintainNotify.add(maintenanceCountMap.getOrDefault("9000",0));
transloadingNotify.add(transferCountMap.getOrDefault("9000",0));
}
}
resultMap.put("installNotify",installNotify);
resultMap.put("transformNotify",transformNotify);
resultMap.put("maintainNotify",maintainNotify);
resultMap.put("transloadingNotify",transloadingNotify);
return resultMap;
}
private void countNoticEquList(Map<String, Integer> countMap, List<Map<String, Object>> list) {
for(int i = 0; i < list.size(); i++){
if("2300".equals(list.get(i).get("equCategory"))){
if(null == countMap.get("2300")){
countMap.put("2300",Integer.valueOf(list.get(i).get("count")+""));
}else{
countMap.put("2300",countMap.get("2300")+Integer.valueOf(list.get(i).get("count")+""));
}
}else {
if(null == countMap.get(list.get(i).get("equList").toString())){
countMap.put(list.get(i).get("equList").toString(),Integer.valueOf(list.get(i).get("count")+""));
}else{
countMap.put(list.get(i).get("equList").toString(),countMap.get(list.get(i).get("equList").toString())+Integer.valueOf(list.get(i).get("count")+""));
}
}
}
}
public Map<String,Object> getRegEquCount(DPFilterParamDto dpFilterParamDto) {
Map<String,Object> resultMap = new HashMap<>();
String startTime = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
//使用登记
List<Map<String,Object>> uselist = dpStatisticsMapper.useEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> useCountMap = new HashMap<>();
countNoticEquList(useCountMap,uselist);
//气瓶使用登记
List<Map<String,Object>> vehicleList = dpStatisticsMapper.vehicleEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> vehicleCountMap = new HashMap<>();
countNoticEquList(vehicleCountMap,vehicleList);
//改造变更登记
List<Map<String,Object>> changeReformList = dpStatisticsMapper.changeReformEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> changeReformCountMap = new HashMap<>();
countNoticEquList(changeReformCountMap,changeReformList);
//移装变更登记
List<Map<String,Object>> changeTransferList = dpStatisticsMapper.changeTransferEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> changeTransferCountMap = new HashMap<>();
countNoticEquList(changeTransferCountMap,changeTransferList);
//单位变更登记
List<Map<String,Object>> changeUnitList = dpStatisticsMapper.changeUnitEquCount(dpFilterParamDto.getCityCode(),startTime);
Map<String,Integer> changeUnitCountMap = new HashMap<>();
countNoticEquList(changeUnitCountMap,changeUnitList);
List legendData = new ArrayList<>();
for(int i = 0; i < 4; i++){
Map<String,String> map = new HashMap<>();
if(i == 0){
map.put("dataKey","useRegistration");
map.put("value","使用登记");
}else if(i == 1){
map.put("dataKey","modificateModifyRegistration");
map.put("value","改造变更登记");
}else if(i == 2){
map.put("dataKey","transloadingModifyRegistration");
map.put("value","移装变更登记");
}else if(i == 3){
map.put("dataKey","unitModifyRegistration");
map.put("value","单位变更登记");
}
legendData.add(map);
}
resultMap.put("legendData",legendData);
List<String> xDataList = Arrays.asList("气瓶", "电梯", "压力容器", "锅炉", "起重机械", "场(厂)内专用", "大型游乐设施", "压力管道", "客运索道");
resultMap.put("xdata",xDataList);
List useRegistration = new ArrayList<>();
List modificateModifyRegistration = new ArrayList<>();
List transloadingModifyRegistration = new ArrayList<>();
List unitModifyRegistration = new ArrayList<>();
for(int i = 0; i < xDataList.size(); i++){
if(i == 0){
useRegistration.add(vehicleCountMap.getOrDefault("2300",0));
modificateModifyRegistration.add(changeReformCountMap.getOrDefault("2300",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("2300",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("2300",0));
}else if(i == 1){
useRegistration.add(useCountMap.getOrDefault("3000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("3000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("3000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("3000",0));
}else if(i == 2){
useRegistration.add(useCountMap.getOrDefault("2000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("2000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("2000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("2000",0));
}else if(i == 3){
useRegistration.add(useCountMap.getOrDefault("1000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("1000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("1000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("1000",0));
}else if(i == 4){
useRegistration.add(useCountMap.getOrDefault("4000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("4000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("4000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("4000",0));
}else if(i == 5){
useRegistration.add(useCountMap.getOrDefault("5000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("5000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("5000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("5000",0));
}else if(i == 6){
useRegistration.add(useCountMap.getOrDefault("6000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("6000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("6000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("6000",0));
}else if(i == 7){
useRegistration.add(useCountMap.getOrDefault("8000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("8000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("8000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("8000",0));
}else if(i == 8){
useRegistration.add(useCountMap.getOrDefault("9000",0));
modificateModifyRegistration.add(changeTransferCountMap.getOrDefault("9000",0));
transloadingModifyRegistration.add(changeTransferCountMap.getOrDefault("9000",0));
unitModifyRegistration.add(changeUnitCountMap.getOrDefault("9000",0));
}
}
resultMap.put("useRegistration",useRegistration);
resultMap.put("modificateModifyRegistration",modificateModifyRegistration);
resultMap.put("transloadingModifyRegistration",transloadingModifyRegistration);
resultMap.put("unitModifyRegistration",unitModifyRegistration);
return resultMap;
}
}
......@@ -96,6 +96,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private static final String SUBMIT_TYPE_FLOW = "1";
private static final String PROCESS_DEFINITION_KEY = "installationNotificationNew";
private static final String PROCESS_INSTALL_NOTICE_KEY = "installNotice";
private static final String TABLE_PAGE_ID = "1734141426742095873";
private static final String CONSTRUCTION_TYPE = "SGLX";
private static final String CONSTRUCTION_TYPE_NAME = "安装";
......@@ -431,7 +433,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr());
JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy("installNotice").equipRepeatUsedCheck(jgRelationEquip.getEquId(), jgInstallationNotice.getInstallUnitCreditCode());
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_INSTALL_NOTICE_KEY).equipRepeatUsedCheck(jgRelationEquip.getEquId(), jgInstallationNotice.getInstallUnitCreditCode());
}
}
......@@ -648,12 +650,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy("installNotice").delDataForCheckWithKey(e.getData(), e.getRedisKey());
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_INSTALL_NOTICE_KEY).delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy("installNotice").equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_INSTALL_NOTICE_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
}
private void updateRedisBatch(List<JgInstallationNotice> jgInstallationNotices) {
......@@ -955,7 +957,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr());
JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy("installNotice").delDataForCheckEquipRepeatUsed(Collections.singletonList(jgRelationEquip.getEquId()), jgInstallationNotice.getInstallUnitCreditCode());
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_INSTALL_NOTICE_KEY).delDataForCheckEquipRepeatUsed(Collections.singletonList(jgRelationEquip.getEquId()), jgInstallationNotice.getInstallUnitCreditCode());
}
@GlobalTransactional(rollbackFor = Exception.class)
......
......@@ -25,6 +25,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgMaintainNoticeService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
......@@ -156,11 +159,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (!ValidationUtil.isEmpty(notice.getStreet()) && !ValidationUtil.isEmpty(notice.getStreetName())) {
maintainInfo.put("street", notice.getStreet() + "_" + notice.getStreetName());
}
if(Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()){
if (Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()) {
// 完成时显示历史数据
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
// 兼容老数据
if(hisData == null){
if (hisData == null) {
// 老数据逻辑
setNewEquipInfo(sequenceNbr, maintainInfo);
return new HashMap<String, Map<String, Object>>() {{
......@@ -182,6 +185,38 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
}
private void checkRepeatUsed(String submitType, JgMaintainNotice notice) {
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 流程中校验
LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgMaintainNoticeEq noticeEq = jgMaintainNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(noticeEq.getEquId(), notice.getInstallUnitCreditCode());
}
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgMaintainNotice notice) {
LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgMaintainNoticeEq noticeEq = jgMaintainNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getEquId()), notice.getInstallUnitCreditCode());
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
private void setNewEquipInfo(Long sequenceNbr, Map<String, Object> maintainInfo) {
JgMaintainNoticeEq jgMaintainNoticeEq = jgMaintainNoticeEqMapper.selectOne(new LambdaQueryWrapper<JgMaintainNoticeEq>().eq(JgMaintainNoticeEq::getEquipTransferId, sequenceNbr));
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(jgMaintainNoticeEq.getEquId());
......@@ -201,12 +236,15 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings({"rawtypes", "Duplicates"})
@Transactional
public JgMaintainNoticeDto updateMaintainNotice(String submitType, JgMaintainNoticeDto noticeDto, String op) {
try {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
// 字段转换
this.convertField(noticeDto);
JgMaintainNotice notice = jgMaintainNoticeMapper.selectById(noticeDto.getSequenceNbr());
this.checkRepeatUsed(submitType, notice);
// submitType=1为流程提交否则仅为保存业务数据
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
......@@ -301,13 +339,24 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
}
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(),this.buildInstanceRuntimeData(notice));
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(), this.buildInstanceRuntimeData(notice));
} else {
JgMaintainNotice bean = new JgMaintainNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgMaintainNoticeMapper.updateById(bean);
}
return noticeDto;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
......@@ -319,13 +368,13 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
* @return 维修告知列表
*/
@Override
public Page<Map<String,Object>> queryForJgMaintainNoticePage(Page<JgMaintainNotice> page, String sort, JgMaintainNoticeDto model, ReginParams reginParams) {
public Page<Map<String, Object>> queryForJgMaintainNoticePage(Page<JgMaintainNotice> page, String sort, JgMaintainNoticeDto model, ReginParams reginParams) {
String orgCode = reginParams.getCompany().getCompanyCode();
String type = reginParams.getCompany().getLevel();
String userId = reginParams.getUserModel().getUserId();
SortVo sortMap = commonService.sortFieldConversion(sort);
List<DataDictionary> dictionaries = dataDictionaryService.getByType("WXLX");
Page<Map<String,Object>> noticePage = jgMaintainNoticeMapper.queryForPage(page,sortMap, model, type, orgCode, userId);
Page<Map<String, Object>> noticePage = jgMaintainNoticeMapper.queryForPage(page, sortMap, model, type, orgCode, userId);
List<Map<String, Object>> mappedRecords = noticePage.getRecords().stream().peek(notice -> {
Optional<Long> noticeStatusOpt = Optional.ofNullable((String) notice.get("noticeStatus")).map(Long::valueOf);
......@@ -364,7 +413,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (Objects.isNull(JgMaintainNotice) || CollectionUtils.isEmpty(informationList)) {
throw new IllegalArgumentException("维修告知单不存在");
}
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName().substring(0,2));
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName().substring(0, 2));
String tempFileName = "维修告知单_" + System.currentTimeMillis() + "_temp";
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
......@@ -380,7 +429,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
for (Long sequenceNbr : sequenceNbrs) {
JgMaintainNotice jgMaintainNotice = this.baseMapper.selectById(sequenceNbr);
// 删除待办 + 中止流程
commonService.deleteTaskModel(sequenceNbr + "",jgMaintainNotice.getInstanceId());
commonService.deleteTaskModel(sequenceNbr + "", jgMaintainNotice.getInstanceId());
// 删除业务单
this.baseMapper.deleteById(sequenceNbr);
// 删除对应equ
......@@ -397,7 +446,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
public List<JgMaintainNotice> saveNotice(String submitType, Map<String, Object> jgMaintainNoticeDtoMap, ReginParams reginParams) {
try {
JgMaintainNoticeDto model = JSON.parseObject(JSONObject.toJSONString(jgMaintainNoticeDtoMap.get(TABLE_PAGE_ID)), JgMaintainNoticeDto.class);
// 字段转换
......@@ -408,6 +457,10 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
throw new BadRequest("请选择设备");
}
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
}
// 获取告知单号
ResponseModel<List<String>> applyNoResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.WXGZ.getCode(), deviceList.size());
......@@ -478,6 +531,17 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
jgMaintainNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
this.updateRedisBatch(list);
return list;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
private void updateRedisBatch(List<JgMaintainNotice> jgMaintainNotices) {
......@@ -722,6 +786,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
commonService.rollbackTask(jgMaintainNotice.getInstanceId(), jsonObject);
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgMaintainNotice));
this.delRepeatUseEquipData(jgMaintainNotice);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -864,10 +929,10 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorRoleIds());
taskModelDto.setPageType("edit");
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
jgMaintainNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
jgMaintainNotice.setNextTaskId(workflowResultDto.getNextTaskId());
jgMaintainNoticeMapper.updateById(jgMaintainNotice);
this.delRepeatUseEquipData(jgMaintainNotice);
}
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgMaintainNotice));
} catch (InterruptedException e) {
......
......@@ -13,22 +13,26 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgReformNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgReformNoticeService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -175,12 +179,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
*/
@SuppressWarnings({"rawtypes", "Duplicates"})
public JgReformNoticeDto updateInstallationNotice(String submitType, JgReformNoticeDto noticeDto, String op) {
try {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
// 字段转换
this.convertField(noticeDto);
JgReformNotice notice = this.getById(noticeDto.getSequenceNbr());
this.checkRepeatUsed(submitType, notice);
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) {
......@@ -255,6 +261,17 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
jgReformNoticeMapper.updateById(bean);
}
return noticeDto;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
......@@ -307,7 +324,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
Collection<JgReformNotice> JgReformNotices = this.listByIds(Arrays.asList(sequenceNbrs));
JgReformNotices.forEach(notice -> {
// 删除代办 + 中止流程
commonService.deleteTaskModel(String.valueOf(notice.getSequenceNbr()),notice.getInstanceId());
commonService.deleteTaskModel(String.valueOf(notice.getSequenceNbr()), notice.getInstanceId());
// 删除单子
this.baseMapper.deleteById(notice.getSequenceNbr());
// 删除对应eq
......@@ -354,6 +371,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
public List<JgReformNotice> saveNotice(String submitType, Map<String, Object> JgReformNoticeDtoMap, ReginParams reginParams) {
try {
JgReformNoticeDto model = JSON.parseObject(JSONObject.toJSONString(JgReformNoticeDtoMap.get(TABLE_PAGE_ID)), JgReformNoticeDto.class);
convertField(model);
// 获取告知设备列表
......@@ -361,6 +379,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!");
}
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请) todo 回滚异常未写
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
}
// 获取告知单号
ResponseModel<List<String>> codeResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GZGZ.getCode(), deviceList.size());
List<String> applyNoList = null;
......@@ -442,6 +464,46 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
jgReformNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
this.updateRedisBatch(list);
return list;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
}
private void checkRepeatUsed(String submitType, JgReformNotice jgReformNotice) {
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 流程中校验
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, jgReformNotice.getSequenceNbr());
JgReformNoticeEq jgRelationEquip = jgReformNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(jgRelationEquip.getEquId(), jgReformNotice.getInstallUnitCreditCode());
}
}
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgReformNotice notice) {
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgReformNoticeEq jgRelationEquip = jgReformNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(jgRelationEquip.getEquId()), notice.getInstallUnitCreditCode());
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
private void updateRedisBatch(List<JgReformNotice> jgReformNotices) {
......@@ -680,6 +742,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
jsonObject.put("flowStatusLabel", FlowStatusEnum.ROLLBACK.getName());
commonService.rollbackTask(notice.getInstanceId(), jsonObject);
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(notice));
this.delRepeatUseEquipData(notice);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -788,6 +851,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
taskV2Model = this.updateLastTodo(jgReformNotice, FlowStatusEnum.REJECTED);
this.createNewTodo(jgReformNotice, workflowResultDto, taskV2Model, FlowStatusEnum.REJECTED);
jgReformNoticeMapper.updateById(jgReformNotice);
this.delRepeatUseEquipData(jgReformNotice);
}
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgReformNotice));
} catch (InterruptedException e) {
......
......@@ -24,6 +24,9 @@ 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.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
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;
......@@ -141,7 +144,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
transferNotice.put("constructionContractList", ObjectUtils.isEmpty(transferNotice.get(s)) ? new JSONArray() : JSON.parseArray(transferNotice.get(s).toString()));
} else if ("otherAccessories".equalsIgnoreCase(s)) {
transferNotice.put("otherAccessoriesList", ObjectUtils.isEmpty(transferNotice.get(s)) ? new JSONArray() : JSON.parseArray(transferNotice.get(s).toString()));
}else {
} else {
transferNotice.put(s, ObjectUtils.isEmpty(transferNotice.get(s)) ? new JSONArray() : JSON.parseArray(transferNotice.get(s).toString()));
}
}
......@@ -172,6 +175,39 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
private void checkRepeatUsed(String submitType, JgTransferNotice notice) {
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 流程中校验
LambdaQueryWrapper<JgTransferNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgTransferNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgTransferNoticeEq noticeEq = jgTransferNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(noticeEq.getEquId(), notice.getInstallUnitCreditCode());
}
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgTransferNotice notice) {
LambdaQueryWrapper<JgTransferNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgTransferNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgTransferNoticeEq noticeEq = jgTransferNoticeEqMapper.selectOne(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getEquId()), notice.getInstallUnitCreditCode());
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
private Map<String, Object> getEquipInfoNew(String companyLevel, Map<String, Object> transferNotice, List<Map<String, Object>> equipmentInfos) {
Map<String, Object> detail = equipmentInfos.get(0);
Map<String, Object> equInfo = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(detail.get("equId").toString());
......@@ -199,7 +235,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
for (Long sequenceNbr : sequenceNbrs) {
// 删除待办 及 中止流程
JgTransferNotice jgTransferNotice = this.getBaseMapper().selectById(sequenceNbr);
commonService.deleteTaskModel(String.valueOf(sequenceNbr),jgTransferNotice.getInstanceId());
commonService.deleteTaskModel(String.valueOf(sequenceNbr), jgTransferNotice.getInstanceId());
// 删除业务单
this.getBaseMapper().deleteById(sequenceNbr);
// 删除对应eq
......@@ -251,6 +287,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings({"rawtypes", "Duplicates"})
@Transactional
public JgTransferNoticeDto updateTransferNotice(String submitType, JgTransferNoticeDto noticeDto, String op) {
try {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
......@@ -258,8 +295,8 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
// 字段转换
this.convertField(noticeDto);
noticeDto.setPromoter(reginParams.getUserModel().getUserId());
JgTransferNotice notice = this.getById(noticeDto.getSequenceNbr());
this.checkRepeatUsed(submitType, notice);//校验设备是否在流程中
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
if (!StringUtils.hasText(noticeDto.getInstanceId())) {
// 发起流程
......@@ -360,17 +397,28 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jgTransferNoticeMapper.updateById(bean);
}
return noticeDto;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
/**
* 分页查询
*/
@Override
public Page<Map<String,Object>> queryForJgTransferNoticePage(Page<JgTransferNotice> page,String sort, 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<Map<String,Object>> noticePage = jgTransferNoticeMapper.queryForPage(page,sortMap, model, type, orgCode);
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);
......@@ -388,6 +436,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
public List<JgTransferNotice> saveNotice(String submitType, Map<String, Object> jgTransferNoticeDtoMap, ReginParams reginParams) {
try {
JgTransferNoticeDto model = JSON.parseObject(JSONObject.toJSONString(jgTransferNoticeDtoMap.get(TABLE_PAGE_ID)), JgTransferNoticeDto.class);
// 字段转换
convertField(model);
......@@ -396,6 +445,10 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
if (CollectionUtils.isEmpty(deviceList)) {
return new ArrayList<>();
}
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
}
// 获取告知单号
ResponseModel<List<String>> responseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.YZGZ.getCode(), deviceList.size());
if (CollectionUtils.isEmpty(responseModel.getResult())) {
......@@ -423,6 +476,17 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jgTransferNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
this.updateRedisBatch(list);
return list;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
private void updateRedisBatch(List<JgTransferNotice> jgTransferNotices) {
......@@ -685,6 +749,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jsonObject.put("nextTaskId", jgTransferNotice.getNextTaskId());
commonService.rollbackTask(jgTransferNotice.getInstanceId(), jsonObject);
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgTransferNotice));
this.delRepeatUseEquipData(jgTransferNotice);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class MaintainNoticeEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "maintainNotice";
private JgMaintainNoticeMapper maintainNoticeMapper;
public MaintainNoticeEquipUsedCheckImpl(RedissonClient redissonClient, JgMaintainNoticeMapper maintainNoticeMapper) {
this.redissonClient = redissonClient;
this.maintainNoticeMapper = maintainNoticeMapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化已经完成或者在流程中安装告知的设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = maintainNoticeMapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class ReformNoticeEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "renovationNoticeNew";
private JgReformNoticeMapper reformNoticeMapper;
public ReformNoticeEquipUsedCheckImpl(RedissonClient redissonClient, JgReformNoticeMapper reformNoticeMapper) {
this.redissonClient = redissonClient;
this.reformNoticeMapper = reformNoticeMapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化已经完成或者在流程中安装告知的设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = reformNoticeMapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class TransferNoticeEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "transferNotice";
private JgTransferNoticeMapper noticeMapper;
public TransferNoticeEquipUsedCheckImpl(RedissonClient redissonClient, JgTransferNoticeMapper noticeMapper) {
this.redissonClient = redissonClient;
this.noticeMapper = noticeMapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化已经完成或者在流程中安装告知的设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = noticeMapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
......@@ -31,7 +31,7 @@
"name": "移装告知",
"code": "GZ_YZ",
"image": "upload/tzs/common/image/移装告知.png",
"disabled": true
"disabled": false
}
],
"DJGL": [
......@@ -49,7 +49,7 @@
"name": "移装变更登记",
"code": "DJ_YZ",
"image": "upload/tzs/common/image/移装变更登记.png",
"disabled": true
"disabled": false
},
{
"name": "单位变更登记",
......@@ -88,16 +88,16 @@
"image": "upload/tzs/common/image/注销报废.png"
},
{
"name": "设备启用",
"name": "启用",
"code": "SB_QY",
"image": "upload/tzs/common/image/设备启用.png",
"disabled": true
"disabled": false
},
{
"name": "设备停用",
"name": "停用",
"code": "SB_TY",
"image": "upload/tzs/common/image/设备停用.png",
"disabled": true
"disabled": false
}
],
"XZSB": [
......
......@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -108,6 +109,7 @@ public class DPSubServiceImpl {
map = new JSONObject();
map.put("columns", JsonValueUtils.getValueByKey(yObj, "visualParams", "visualParams.modelTableColumns"));
map.put("dataList", apiResult);
map.put("showPage", true);
content.put(tab.getString("key"), map);
}
}
......@@ -261,12 +263,26 @@ public class DPSubServiceImpl {
public JSONObject buildContentData(JSONObject map, List<Object> mergedArray, JSONObject apiResult){
JSONArray datas = new JSONArray();
// 二维码
// 处理二维码
mergedArray.stream().filter(x -> "QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).findFirst().ifPresent(x -> {
JSONObject qrcode = map.getJSONObject("qrcode");
qrcode.put("text", apiResult.get("problemTime"));
qrcode.put("value", !ValidationUtil.isEmpty(apiResult.get("userCode")) ? apiResult.get("userCode") : apiResult.get("USE_ORG_CODE"));
qrcode.put("status", apiResult.get("problemStatus"));
String problemTime = apiResult.getString("problemTime");
String problemStatus = apiResult.getString("problemStatus");
if (!ValidationUtil.isEmpty(problemTime)){
try {
qrcode.put("text", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "yyyy-MM-dd"));
qrcode.put("subtext", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "HH:mm:ss"));
} catch (Exception e) {
e.printStackTrace();
}
}
if ("正常".equals(problemStatus)){
problemStatus = "green";
} else if("异常".equals(problemStatus)){
problemStatus = "red";
}
qrcode.put("value", !ValidationUtil.isEmpty(apiResult.get("useCode")) ? apiResult.get("useCode") : apiResult.get("USE_ORG_CODE"));
qrcode.put("status", problemStatus);
});
mergedArray = mergedArray.stream().filter(x -> !"QRCode".equals(JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.componentKey"))).collect(Collectors.toList());
......@@ -380,6 +396,7 @@ public class DPSubServiceImpl {
return jsonObject;
}).collect(Collectors.toList());
subObj.put("showPage", false);
subObj.put("columns", columns);
subObj.put("dataList", apiResult.get(JsonValueUtils.getValueByKey(yObj, "visualParams", "visualParams.fieldKey")));
......
......@@ -275,8 +275,11 @@ public class TzBaseEnterpriseInfoServiceImpl
resultMap.remove("regUnitInfoDto");
resultMap.remove("tzsBaseInstitution");
resultMap.put("problemTime", problemInfo.get("problem_time"));
resultMap.put("problemStatus", ProblemStatusEnum.getName.get(resultMap.get("status")));
resultMap.put("unitAddress", resultMap.get("province") + "/" + resultMap.get("city") + "/" + resultMap.get("district"));
resultMap.put("longitudeLatitude", resultMap.get("address"));
resultMap.put("problemTime", ObjectUtils.isEmpty(problemInfo) ? null : problemInfo.get("problem_time"));
resultMap.put("problemStatus", (ObjectUtils.isEmpty(resultMap.get("status")) || "null".equals(resultMap.get("status"))) ? ProblemStatusEnum.NORMAL.getName() : ProblemStatusEnum.getName.get(resultMap.get("status")));
return resultMap;
}
......
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