Commit 58831fa6 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 4b0ef580 05fd6a35
...@@ -55,6 +55,12 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -55,6 +55,12 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
*/ */
List<Map<String, Object>> queryListByLocation(@Param("regionCode") String regionCode, @Param("dto") DPFilterParamDto filterParamDto); List<Map<String, Object>> queryListByLocation(@Param("regionCode") String regionCode, @Param("dto") DPFilterParamDto filterParamDto);
/** /**
* 接警情况统计(故障原因)
*
* @return
*/
List<Map<String, Object>> faultCauseRatio(@Param("regionCode") String regionCode);
/**
* 接警情况统计 * 接警情况统计
* *
* @param beginDate * @param beginDate
......
...@@ -160,6 +160,28 @@ ...@@ -160,6 +160,28 @@
ORDER BY ibjuj.USE_PLACE ASC ORDER BY ibjuj.USE_PLACE ASC
</select> </select>
<select id="faultCauseRatio" resultType="java.util.Map">
SELECT
tafv.field_value AS errorResult,
ifnull ( SUM ( CASE WHEN tac.father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) AS majorAlertCount
FROM
tz_alert_called tac
LEFT JOIN tz_dispatch_task tdt ON tac.sequence_nbr = tdt.alert_id
LEFT JOIN tz_alert_form_value tafv ON tac.sequence_nbr = tafv.alert_called_id
LEFT JOIN cb_data_dictionary cdd ON cdd.NAME = tafv.field_value
WHERE
tac.biz_org_code LIKE concat(#{regionCode}, '%')
AND tac.alarm_type_code = '961'
AND cdd.TYPE = 'GZYY'
AND tafv.field_code = 'error_result'
AND tafv.field_value IS NOT NULL
GROUP BY
tafv.field_value
ORDER BY
majorAlertCount ASC
LIMIT 5
</select>
<select id="queryAlertListByQueryDto" resultType="java.util.Map"> <select id="queryAlertListByQueryDto" resultType="java.util.Map">
SELECT SELECT
a.sequence_nbr AS sequenceNbr, a.sequence_nbr AS sequenceNbr,
......
...@@ -76,6 +76,17 @@ public class DPStatisticsController { ...@@ -76,6 +76,17 @@ public class DPStatisticsController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-故障原因占比", notes = "大屏-应急-故障原因占比")
@PostMapping(value = "/yj/faultCauseRatio")
public ResponseModel<JSONObject> faultCauseRatio(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.faultCauseRatio(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-困人救援月度情况", notes = "大屏-应急-困人救援月度情况") @ApiOperation(httpMethod = "POST", value = "大屏-应急-困人救援月度情况", notes = "大屏-应急-困人救援月度情况")
@PostMapping(value = "/yj/trappedUserCount") @PostMapping(value = "/yj/trappedUserCount")
public ResponseModel<JSONObject> trappedUserCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception { public ResponseModel<JSONObject> trappedUserCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
......
...@@ -146,6 +146,19 @@ public class DPStatisticsServiceImpl { ...@@ -146,6 +146,19 @@ public class DPStatisticsServiceImpl {
return jsonObject; return jsonObject;
} }
public JSONObject faultCauseRatio(DPFilterParamDto dpFilterParamDto) throws Exception {
String orgCode = this.getAndSetOrgCode(dpFilterParamDto);
List<Map<String, Object>> maps = alertCalledMapper.faultCauseRatio(orgCode);
List<Object> xdata = maps.stream().map(item -> item.get("errorResult")).collect(Collectors.toList());
List<Object> ydata = maps.stream().map(item -> item.get("majorAlertCount")).collect(Collectors.toList());
JSONObject jsonObject = new JSONObject();
jsonObject.put("xdata", xdata);
jsonObject.put("ydata", ydata);
return jsonObject;
}
public List<AlertPaperInfoDto> instantAlert(DPFilterParamDto dpFilterParamDto) throws Exception { public List<AlertPaperInfoDto> instantAlert(DPFilterParamDto dpFilterParamDto) throws Exception {
List<String> regionCodes = new ArrayList<>(); List<String> regionCodes = new ArrayList<>();
regionCodes.add(dpFilterParamDto.getCityCode()); regionCodes.add(dpFilterParamDto.getCityCode());
......
...@@ -334,6 +334,9 @@ public class JgMaintainNotice extends BaseEntity { ...@@ -334,6 +334,9 @@ public class JgMaintainNotice extends BaseEntity {
private String equList; private String equList;
@TableField(exist = false) @TableField(exist = false)
private String equCategoryDesc;
@TableField(exist = false)
private String supervisoryCode; private String supervisoryCode;
/** /**
* 维修类型名称 * 维修类型名称
......
...@@ -6,7 +6,6 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; ...@@ -6,7 +6,6 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date;
/** /**
* 维修告知设备关系表 * 维修告知设备关系表
...@@ -34,4 +33,29 @@ public class JgMaintainNoticeEq extends BaseEntity { ...@@ -34,4 +33,29 @@ public class JgMaintainNoticeEq extends BaseEntity {
@TableField("equ_id") @TableField("equ_id")
private String equId; private String equId;
/**
* 设备代码
*/
@TableField("equ_code")
private String equCode;
/**
* 告知书编号
*/
@TableField(value = "inform_number")
private String informNumber;
/**
* 设备类别
*/
@TableField(value = "equ_list_code")
private String equListCode;
/**
* 设备类别名称
*/
@TableField(value = "equ_category_code")
private String equCategoryCode;
} }
...@@ -133,6 +133,6 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -133,6 +133,6 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
*/ */
List<Long> countAllInFlowingForDPNoFinishedBizData(@Param("orgCode")String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto); List<Long> countAllInFlowingForDPNoFinishedBizData(@Param("orgCode")String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
List<Map<String, String>> getOrgCodeByCompanyCodes(@Param("regionCodes") List<Integer> regionCodes); List<Map<String, String>> getOrgCodesByCompanyCodes(@Param("regionCodes") List<Integer> regionCodes);
} }
...@@ -8,8 +8,8 @@ import java.util.Map; ...@@ -8,8 +8,8 @@ import java.util.Map;
public interface DPStatisticsMapper { public interface DPStatisticsMapper {
List<Map<String, Object>> maintenanceCountTopTen(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto); List<Map<String, Object>> maintenanceCountTopTen(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto, @Param("regionCodeList") List<Integer> regionCodeList);
List<Map<String, Object>> maintenanceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto); List<Map<String, Object>> maintenanceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto, @Param("regionCodeList") List<Integer> regionCodeList);
List<Map<String, Object>> installEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime); List<Map<String, Object>> installEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
......
...@@ -1036,9 +1036,8 @@ ...@@ -1036,9 +1036,8 @@
union all union all
select count(1) from tzs_jg_scrap_cancel a, privilege_company b where a.receive_org_code= b.company_code and b.org_code like CONCAT(#{orgCode}, '%') and a.audit_status != '使用单位待提交' and a.audit_status != '使用单位已撤回' and a.audit_status != '已作废' and a.audit_status != '已完成' and date_ge(CAST(a.create_date as date),#{dto.beginDate}) and date_le(CAST(a.create_date as date),#{dto.endDate}) select count(1) from tzs_jg_scrap_cancel a, privilege_company b where a.receive_org_code= b.company_code and b.org_code like CONCAT(#{orgCode}, '%') and a.audit_status != '使用单位待提交' and a.audit_status != '使用单位已撤回' and a.audit_status != '已作废' and a.audit_status != '已完成' and date_ge(CAST(a.create_date as date),#{dto.beginDate}) and date_le(CAST(a.create_date as date),#{dto.endDate})
</select> </select>
<select id="getOrgCodeByCompanyCodes" resultType="java.util.Map"> <select id="getOrgCodesByCompanyCodes" resultType="java.util.Map">
select P.org_code AS orgCode,R.region_name AS regionName from privilege_company P select P.org_code AS orgCode,P.company_code AS companyCode from privilege_company P
INNER JOIN systemctl_region R ON P.company_code = R.region_code
where P.company_code in where P.company_code in
<foreach collection="regionCodes" item="regionCode" separator="," open="(" close=")"> <foreach collection="regionCodes" item="regionCode" separator="," open="(" close=")">
#{regionCode} :: VARCHAR #{regionCode} :: VARCHAR
......
...@@ -6,16 +6,18 @@ ...@@ -6,16 +6,18 @@
SELECT SELECT
COUNT(1), COUNT(1),
pc.company_name AS companyName, pc.company_name AS companyName,
sr.region_name AS regionName pc.company_code AS companyCode
FROM FROM
privilege_company pc privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' ) 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 ( 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 WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{dpFilterParamDto.cityCode} ) pc.company_code IN
<foreach collection="regionCodeList" item="item" open="(" separator="," close=")">
#{item} :: VARCHAR
</foreach>
GROUP BY GROUP BY
sr.region_code pc.company_code
ORDER BY ORDER BY
COUNT DESC COUNT DESC
LIMIT 10; LIMIT 10;
...@@ -25,16 +27,18 @@ ...@@ -25,16 +27,18 @@
SELECT SELECT
COUNT(1), COUNT(1),
pc.company_name AS companyName, pc.company_name AS companyName,
sr.region_name AS regionName pc.company_code AS companyCode
FROM FROM
privilege_company pc privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' ) 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 ( 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 WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{dpFilterParamDto.cityCode} ) pc.company_code IN
<foreach collection="regionCodeList" item="item" open="(" separator="," close=")">
#{item} :: VARCHAR
</foreach>
GROUP BY GROUP BY
sr.region_code pc.company_code
</select> </select>
<select id="installEquCount" resultType="java.util.Map"> <select id="installEquCount" resultType="java.util.Map">
SELECT COUNT SELECT COUNT
......
...@@ -67,20 +67,9 @@ ...@@ -67,20 +67,9 @@
isn.create_user_company_name AS createUserCompanyName, isn.create_user_company_name AS createUserCompanyName,
isn.next_execute_user_ids AS nextExecuteUserIds, isn.next_execute_user_ids AS nextExecuteUserIds,
isn.transfer_to_user_ids AS transferToUserIds, isn.transfer_to_user_ids AS transferToUserIds,
isn.inform_number AS informNumber, (SELECT name from tz_equipment_category ec WHERE ec.code = isn.equ_list_code) AS equListName,
ri.EQU_CODE AS equCode, (select name from tz_equipment_category ec WHERE ec.code = isn.equ_category) AS equCategoryName
(SELECT name from tz_equipment_category ec WHERE ec.code = ri.EQU_LIST) AS equListName,
(select name from tz_equipment_category ec WHERE ec.code = ri.EQU_DEFINE) AS equDefineName,
(select name from tz_equipment_category ec WHERE ec.code = ri.EQU_CATEGORY) AS equCategoryName,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME") as fullAddress,
ibjui."ADDRESS" as detailedAddress,
ibjoi.SUPERVISORY_CODE as supervisoryCode,
ibjoi.CODE96333 as code96333
FROM tzs_jg_maintain_notice isn FROM tzs_jg_maintain_notice isn
left join tzs_jg_maintain_notice_eq isneq on isn.sequence_nbr = isneq.equip_transfer_id
LEFT JOIN idx_biz_jg_use_info ibjui on isneq.equ_id = ibjui.RECORD
LEFT JOIN idx_biz_jg_register_info ri ON isneq.equ_id = ri.record
LEFT JOIN idx_biz_jg_other_info ibjoi ON isneq.equ_id = ibjoi.RECORD
<where> <where>
isn.is_delete = 0 isn.is_delete = 0
<if test="param != null "> <if test="param != null ">
...@@ -108,37 +97,17 @@ ...@@ -108,37 +97,17 @@
<if test="param.informNumber != null and param.informNumber != ''"> <if test="param.informNumber != null and param.informNumber != ''">
AND isn.inform_number like concat('%',#{param.informNumber},'%') AND isn.inform_number like concat('%',#{param.informNumber},'%')
</if> </if>
<if test="param.supervisoryCode != null and param.supervisoryCode != ''">
AND ibjoi.supervisory_code like concat('%',#{param.supervisoryCode},'%')
</if>
<if test="param.installUnitCreditCode != null and param.installUnitCreditCode != ''"> <if test="param.installUnitCreditCode != null and param.installUnitCreditCode != ''">
AND isn.install_unit_credit_code like concat('%',#{param.installUnitCreditCode},'%') AND isn.install_unit_credit_code like concat('%',#{param.installUnitCreditCode},'%')
</if> </if>
<if test="param.code96333 != null and param.code96333 != ''">
AND ibjoi.code96333 like concat('%',#{param.code96333},'%')
</if>
<if test="param.equCode != null and param.equCode != ''">
AND ri.EQU_CODE like concat('%',#{param.equCode},'%')
</if>
<if test="param.noticeDate != null"> <if test="param.noticeDate != null">
AND isn.notice_date like concat('%',DATE_FORMAT(#{param.noticeDate},'%Y-%m-%d'),'%') AND isn.notice_date like concat('%',DATE_FORMAT(#{param.noticeDate},'%Y-%m-%d'),'%')
</if> </if>
<if test="param.equListCode != null and param.equListCode != ''"> <if test="param.equListCode != null and param.equListCode != ''">
AND ri."EQU_LIST" = #{param.equListCode} AND isn."equ_list_code" = #{param.equListCode}
</if> </if>
<if test="param.equCategory != null and param.equCategory != ''"> <if test="param.equCategory != null and param.equCategory != ''">
AND ri."equ_category" = #{param.equCategory} AND isn."equ_category" = #{param.equCategory}
</if>
<if test="param.equDefine != null and param.equDefine != ''">
AND ri."EQU_DEFINE" = #{param.equDefine}
</if>
<if test="param.fullAddress != null and param.fullAddress != ''">
AND (
ibjui."PROVINCE_NAME" LIKE CONCAT('%', #{param.fullAddress}, '%')
OR ibjui."CITY_NAME" LIKE CONCAT('%', #{param.fullAddress}, '%')
OR ibjui."COUNTY_NAME" LIKE CONCAT('%', #{param.fullAddress}, '%')
OR ibjui."STREET_NAME" LIKE CONCAT('%', #{param.fullAddress}, '%')
)
</if> </if>
</if> </if>
<if test="type != 'company'"> <if test="type != 'company'">
......
...@@ -80,7 +80,7 @@ public class JgMaintainByWorkFlowController { ...@@ -80,7 +80,7 @@ public class JgMaintainByWorkFlowController {
LinkedHashMap maintainInfo = (LinkedHashMap) model1.get(TABLE_PAGE_ID); LinkedHashMap maintainInfo = (LinkedHashMap) model1.get(TABLE_PAGE_ID);
String opinion = model.get("opinion").toString(); String opinion = model.get("opinion").toString();
JgMaintainNoticeDto jgMaintainNoticeDto = JSON.parseObject(JSON.toJSONString(maintainInfo), JgMaintainNoticeDto.class); JgMaintainNoticeDto jgMaintainNoticeDto = JSON.parseObject(JSON.toJSONString(maintainInfo), JgMaintainNoticeDto.class);
jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op,opinion); jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op, opinion, model1);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
} }
...@@ -50,6 +50,7 @@ import java.time.temporal.TemporalAdjusters; ...@@ -50,6 +50,7 @@ import java.time.temporal.TemporalAdjusters;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -866,12 +867,15 @@ public class DPStatisticsServiceImpl { ...@@ -866,12 +867,15 @@ public class DPStatisticsServiceImpl {
} }
public List<Map<String, Object>> maintenanceCountTopTen(DPFilterParamDto dpFilterParamDto) { public List<Map<String, Object>> maintenanceCountTopTen(DPFilterParamDto dpFilterParamDto) {
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCountTopTen(dpFilterParamDto); List<RegionModel> regionModels = setRegionIfRootParent(dpFilterParamDto);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
Map<Integer,RegionModel> regionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity()));
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCountTopTen(dpFilterParamDto,regionCodeList);
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("key", i); result.put("key", i);
result.put("city", list.get(i).get("regionName")); result.put("city", regionMap.get(Integer.valueOf(list.get(i).get("companyCode")+"")).getRegionName());
result.put("count", list.get(i).get("count")); result.put("count", list.get(i).get("count"));
result.put("name", list.get(i).get("companyName")); result.put("name", list.get(i).get("companyName"));
resultList.add(result); resultList.add(result);
...@@ -880,12 +884,15 @@ public class DPStatisticsServiceImpl { ...@@ -880,12 +884,15 @@ public class DPStatisticsServiceImpl {
} }
public Map<String, Object> maintenanceCount(DPFilterParamDto dpFilterParamDto) { public Map<String, Object> maintenanceCount(DPFilterParamDto dpFilterParamDto) {
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCount(dpFilterParamDto); List<RegionModel> regionModels = setRegionIfRootParent(dpFilterParamDto);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
Map<Integer,RegionModel> regionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity()));
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCount(dpFilterParamDto,regionCodeList);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List xList = new ArrayList(); List xList = new ArrayList();
List yList = new ArrayList(); List yList = new ArrayList();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
xList.add(list.get(i).get("regionName")); xList.add(regionMap.get(Integer.valueOf(list.get(i).get("companyCode")+"")).getRegionName());
yList.add(list.get(i).get("count")); yList.add(list.get(i).get("count"));
} }
resultMap.put("xdata", xList); resultMap.put("xdata", xList);
...@@ -920,11 +927,11 @@ public class DPStatisticsServiceImpl { ...@@ -920,11 +927,11 @@ public class DPStatisticsServiceImpl {
List<Object> xDataList = new ArrayList<>(); List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>(); List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList()); List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodeByCompanyCodes(regionCodeList); List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>(); Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>(); List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{ orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("regionName")+"",t.get("orgCode")); companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) { if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode")); orgCodes.add(t.get("orgCode"));
} }
...@@ -936,10 +943,10 @@ public class DPStatisticsServiceImpl { ...@@ -936,10 +943,10 @@ public class DPStatisticsServiceImpl {
for(int i = 0; i < regionModelList.size(); i++){ for(int i = 0; i < regionModelList.size(); i++){
AtomicInteger count = new AtomicInteger(); AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName()); xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionName()))){ if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
int finalI = i; int finalI = i;
countMap.forEach((k, v)->{ countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionName()))){ if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){ if(null != v){
count.addAndGet(v); count.addAndGet(v);
} }
...@@ -960,11 +967,11 @@ public class DPStatisticsServiceImpl { ...@@ -960,11 +967,11 @@ public class DPStatisticsServiceImpl {
List<Object> xDataList = new ArrayList<>(); List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>(); List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList()); List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodeByCompanyCodes(regionCodeList); List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>(); Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>(); List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{ orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("regionName")+"",t.get("orgCode")); companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) { if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode")); orgCodes.add(t.get("orgCode"));
} }
...@@ -976,10 +983,10 @@ public class DPStatisticsServiceImpl { ...@@ -976,10 +983,10 @@ public class DPStatisticsServiceImpl {
for(int i = 0; i < regionModelList.size(); i++){ for(int i = 0; i < regionModelList.size(); i++){
AtomicInteger count = new AtomicInteger(); AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName()); xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionName()))){ if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
int finalI = i; int finalI = i;
countMap.forEach((k, v)->{ countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionName()))){ if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){ if(null != v){
count.addAndGet(v); count.addAndGet(v);
} }
...@@ -1000,11 +1007,11 @@ public class DPStatisticsServiceImpl { ...@@ -1000,11 +1007,11 @@ public class DPStatisticsServiceImpl {
List<Object> xDataList = new ArrayList<>(); List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>(); List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList()); List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodeByCompanyCodes(regionCodeList); List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>(); Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>(); List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{ orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("regionName")+"",t.get("orgCode")); companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) { if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode")); orgCodes.add(t.get("orgCode"));
} }
...@@ -1029,10 +1036,10 @@ public class DPStatisticsServiceImpl { ...@@ -1029,10 +1036,10 @@ public class DPStatisticsServiceImpl {
for(int i = 0; i < regionModelList.size(); i++){ for(int i = 0; i < regionModelList.size(); i++){
AtomicInteger count = new AtomicInteger(); AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName()); xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionName()))){ if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
int finalI = i; int finalI = i;
countMap.forEach((k, v)->{ countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionName()))){ if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){ if(null != v){
count.addAndGet(v); count.addAndGet(v);
} }
...@@ -1054,11 +1061,11 @@ public class DPStatisticsServiceImpl { ...@@ -1054,11 +1061,11 @@ public class DPStatisticsServiceImpl {
List<Object> xDataList = new ArrayList<>(); List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>(); List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList()); List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodeByCompanyCodes(regionCodeList); List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>(); Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>(); List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{ orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("regionName")+"",t.get("orgCode")); companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) { if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode")); orgCodes.add(t.get("orgCode"));
} }
...@@ -1072,10 +1079,10 @@ public class DPStatisticsServiceImpl { ...@@ -1072,10 +1079,10 @@ public class DPStatisticsServiceImpl {
for(int i = 0; i < regionModelList.size(); i++){ for(int i = 0; i < regionModelList.size(); i++){
AtomicInteger count = new AtomicInteger(); AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName()); xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionName()))){ if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
int finalI = i; int finalI = i;
countMap.forEach((k, v)->{ countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionName()))){ if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){ if(null != v){
count.addAndGet(v); count.addAndGet(v);
} }
...@@ -1096,11 +1103,11 @@ public class DPStatisticsServiceImpl { ...@@ -1096,11 +1103,11 @@ public class DPStatisticsServiceImpl {
List<Object> xDataList = new ArrayList<>(); List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>(); List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList()); List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodeByCompanyCodes(regionCodeList); List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>(); Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>(); List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{ orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("regionName")+"",t.get("orgCode")); companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) { if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode")); orgCodes.add(t.get("orgCode"));
} }
...@@ -1120,10 +1127,10 @@ public class DPStatisticsServiceImpl { ...@@ -1120,10 +1127,10 @@ public class DPStatisticsServiceImpl {
for(int i = 0; i < regionModelList.size(); i++){ for(int i = 0; i < regionModelList.size(); i++){
AtomicInteger count = new AtomicInteger(); AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName()); xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionName()))){ if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
int finalI = i; int finalI = i;
countMap.forEach((k, v)->{ countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionName()))){ if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){ if(null != v){
count.addAndGet(v); count.addAndGet(v);
} }
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.util.StringUtil; import com.github.pagehelper.util.StringUtil;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
...@@ -13,11 +14,12 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; ...@@ -13,11 +14,12 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService; import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; 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.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper;
...@@ -39,6 +41,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*; ...@@ -39,6 +41,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.*; import com.yeejoin.amos.feign.workflow.model.*;
import io.seata.spring.annotation.GlobalTransactional;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -81,6 +84,9 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -81,6 +84,9 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired @Autowired
JgMaintainNoticeEqMapper jgMaintainNoticeEqMapper; JgMaintainNoticeEqMapper jgMaintainNoticeEqMapper;
@Autowired
JgMaintainNoticeEqServiceImpl jgMaintainNoticeEqService;
@Autowired @Autowired
private JgMaintainNoticeMapper jgMaintainNoticeMapper; private JgMaintainNoticeMapper jgMaintainNoticeMapper;
...@@ -93,6 +99,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -93,6 +99,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
OtherInfoMapper tzsJgOtherInfoMapper; OtherInfoMapper tzsJgOtherInfoMapper;
@Autowired @Autowired
ESEquipmentCategory esEquipmentCategory;
@Autowired
private Sequence sequence;
@Autowired
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper; SupervisoryCodeInfoMapper supervisoryCodeInfoMapper;
@Autowired @Autowired
...@@ -123,6 +135,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -123,6 +135,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Autowired @Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper; private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired
private JgCertificateChangeRecordServiceImpl certificateChangeRecordService;
@Autowired
private JgCertificateChangeRecordEqServiceImpl jgCertificateChangeRecordEqServiceImpl;
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
...@@ -174,6 +191,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -174,6 +191,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
// 新数据逻辑 // 新数据逻辑
hisData.putAll(maintainInfo); hisData.putAll(maintainInfo);
CommonServiceImpl.formatTime2StrDateForEquip(hisData); CommonServiceImpl.formatTime2StrDateForEquip(hisData);
setNewEquipInfo(sequenceNbr, maintainInfo);
hisData.put("deviceList", maintainInfo.get("deviceList"));
return new HashMap<String, Map<String, Object>>() {{ return new HashMap<String, Map<String, Object>>() {{
this.put(TABLE_PAGE_ID, hisData); this.put(TABLE_PAGE_ID, hisData);
}}; }};
...@@ -209,9 +228,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -209,9 +228,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, notice.getSequenceNbr()); queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgMaintainNoticeEq noticeEq = jgMaintainNoticeEqMapper.selectOne(queryWrapper); List<JgMaintainNoticeEq> noticeEq = jgMaintainNoticeEqMapper.selectList(queryWrapper);
for (JgMaintainNoticeEq jgMaintainNoticeEq : noticeEq) {
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY) EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getEquId()), notice.getInstallUnitCreditCode()); .delDataForCheckEquipRepeatUsed(Collections.singletonList(jgMaintainNoticeEq.getEquId()), notice.getInstallUnitCreditCode());
}
} }
} }
...@@ -223,13 +244,32 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -223,13 +244,32 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} }
private void setNewEquipInfo(Long sequenceNbr, Map<String, Object> maintainInfo) { private void setNewEquipInfo(Long sequenceNbr, Map<String, Object> maintainInfo) {
JgMaintainNoticeEq jgMaintainNoticeEq = jgMaintainNoticeEqMapper.selectOne(new LambdaQueryWrapper<JgMaintainNoticeEq>().eq(JgMaintainNoticeEq::getEquipTransferId, sequenceNbr)); List<JgMaintainNoticeEq> jgMaintainNoticeEq = jgMaintainNoticeEqMapper.selectList(new LambdaQueryWrapper<JgMaintainNoticeEq>().eq(JgMaintainNoticeEq::getEquipTransferId, sequenceNbr));
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(jgMaintainNoticeEq.getEquId()); List<String> ids = jgMaintainNoticeEq.stream().map(JgMaintainNoticeEq::getEquId).collect(Collectors.toList());
map.put("uuseUnitCreditCode", map.get("useUnitCreditCode"));
map.remove("useUnitCreditCode"); Iterable<ESEquipmentCategoryDto> esEquipmentCategoryDtos = esEquipmentCategory.findAllById(ids);
map.remove("address"); List<Map<String, Object>> deviceList = getEquipListMaps(esEquipmentCategoryDtos);
map.remove("sequenceNbr"); maintainInfo.put("deviceList", deviceList);
maintainInfo.putAll(map); }
private List<Map<String, Object>> getEquipListMaps(Iterable<ESEquipmentCategoryDto> equips) {
List<Map<String, Object>> arrayList = new ArrayList<>();
equips.forEach(equip -> {
Map<String, Object> objectHashMap = new HashMap<>();
BeanUtil.beanToMap(equip, objectHashMap, false, false);
objectHashMap.put("record", equip.getSEQUENCE_NBR());
objectHashMap.put("ADDRESS", concatDetailAddress(equip));
arrayList.add(objectHashMap);
});
return arrayList;
}
private String concatDetailAddress(ESEquipmentCategoryDto esEquipmentCategoryDto) {
// 省、市、区
String usePlace = esEquipmentCategoryDto.getUSE_PLACE();
// 详细地址
String address = esEquipmentCategoryDto.getADDRESS();
return String.format("%s%s", usePlace, address);
} }
/** /**
...@@ -467,58 +507,59 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -467,58 +507,59 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode()); this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
} }
// 获取告知单号 // 获取告知单号
ResponseModel<List<String>> applyNoResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.WXGZ.getCode(), deviceList.size()); ResponseModel<List<String>> applyNoResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.WXGZ.getCode(), 1);
if (CollectionUtils.isEmpty(applyNoResult.getResult())) { if (CollectionUtils.isEmpty(applyNoResult.getResult())) {
log.error(" 获取告知单号失败"); log.error(" 获取告知单号失败");
throw new RuntimeException(); throw new RuntimeException();
} }
List<String> applyNoList = applyNoResult.getResult(); String applyNo = applyNoResult.getResult().get(0);
List<WorkflowResultDto> workflowResultDtoList = workFlowInfo(submitType, deviceList, model.getReceiveCompanyCode()); List<WorkflowResultDto> workflowResultDtoList = workFlowInfo(submitType, deviceList, model.getReceiveCompanyCode());
List<JgMaintainNotice> list = new ArrayList<>(); List<JgMaintainNotice> list = new ArrayList<>();
List<JgMaintainNoticeEq> equipList = new ArrayList<>(); List<JgMaintainNoticeEq> equipList = new ArrayList<>();
CompanyBo companyBo = commonService.getOneCompany(model.getReceiveCompanyCode()); CompanyBo companyBo = commonService.getOneCompany(model.getReceiveCompanyCode());
deviceList.forEach(obj -> { // 维修告知表添加数据
JgMaintainNoticeEq jgRelationEquip = new JgMaintainNoticeEq();
JgMaintainNotice dto = new JgMaintainNotice(); JgMaintainNotice dto = new JgMaintainNotice();
BeanUtils.copyProperties(model, dto); BeanUtils.copyProperties(model, dto);
int i = deviceList.indexOf(obj);
String applyNo = applyNoList.get(i);
dto.setApplyNo(applyNo); dto.setApplyNo(applyNo);
// 统计使用 // 统计使用
dto.setReceiveCompanyOrgCode(companyBo.getOrgCode()); dto.setReceiveCompanyOrgCode(companyBo.getOrgCode());
dto.setNoticeDate(new Date()); dto.setNoticeDate(new Date());
dto.setEquCategory(String.valueOf(obj.get("EQU_CATEGORY"))); dto.setEquListCode(model.getEquListCode());
dto.setEquListCode(String.valueOf(obj.get("EQU_LIST_CODE")));
dto.setCreateUserCompanyName(reginParams.getCompany().getCompanyName()); dto.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
dto.setNextExecuteIds(workflowResultDtoList.get(i).getNextExecutorRoleIds()); dto.setNextExecuteIds(workflowResultDtoList.get(0).getNextExecutorRoleIds());
dto.setInstanceStatus(workflowResultDtoList.get(i).getNextExecutorRoleIds() + "," + workflowResultDtoList.get(i).getExecutorRoleIds()); dto.setInstanceStatus(workflowResultDtoList.get(0).getNextExecutorRoleIds() + "," + workflowResultDtoList.get(0).getExecutorRoleIds());
dto.setPromoter(reginParams.getUserModel().getUserId()); dto.setPromoter(reginParams.getUserModel().getUserId());
dto.setNextExecuteUserIds(workflowResultDtoList.get(i).getNextExecutorUserIds()); dto.setNextExecuteUserIds(workflowResultDtoList.get(0).getNextExecutorUserIds());
dto.setNextTaskId(workflowResultDtoList.get(i).getNextTaskId()); dto.setNextTaskId(workflowResultDtoList.get(0).getNextTaskId());
dto.setInstanceId(workflowResultDtoList.get(i).getInstanceId()); dto.setInstanceId(workflowResultDtoList.get(0).getInstanceId());
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode())); dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
} else { } else {
dto.setNextExecuteUserIds(reginParams.getUserModel().getUserId()); dto.setNextExecuteUserIds(reginParams.getUserModel().getUserId());
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode())); dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
} }
dto.setEquList(String.valueOf(obj.get("EQU_LIST"))); dto.setEquListCode(String.valueOf(deviceList.get(0).get("EQU_LIST_CODE")));
dto.setSupervisoryCode(String.valueOf(obj.get("SUPERVISORY_CODE"))); dto.setEquCategory(String.valueOf(deviceList.get(0).get("EQU_CATEGORY_CODE")));
dto.setInstallUnitName(reginParams.getCompany().getCompanyName()); dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode()); dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(applyNo);
dto.setCreateUserName(reginParams.getUserModel().getRealName()); dto.setCreateUserName(reginParams.getUserModel().getRealName());
dto.setCreateUserId(reginParams.getUserModel().getUserId()); dto.setCreateUserId(reginParams.getUserModel().getUserId());
DataDictionary dictionary = iDataDictionaryService.getByCode(dto.getMaintainType(), "WXLX"); DataDictionary dictionary = iDataDictionaryService.getByCode(dto.getMaintainType(), "WXLX");
dto.setMaintainTypeDesc(dictionary.getName()); dto.setMaintainTypeDesc(dictionary.getName());
dto.setFullAddress(dto.getProvinceName() + dto.getCityName() + dto.getCountyName() + dto.getStreetName() + dto.getAddress()); dto.setFullAddress(dto.getProvinceName() + dto.getCityName() + dto.getCountyName() + dto.getStreetName() + dto.getAddress());
dto.setEquCategoryDesc(String.valueOf(deviceList.get(0).get("EQU_CATEGORY")));
dto.setEquList(String.valueOf(deviceList.get(0).get("EQU_LIST")));
list.add(dto); list.add(dto);
deviceList.forEach(obj -> {
JgMaintainNoticeEq jgRelationEquip = new JgMaintainNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(applyNo);
jgRelationEquip.setEquCode(ObjectUtils.isEmpty(obj.get("EQU_CODE"))?null:String.valueOf(obj.get("EQU_CODE")));
jgRelationEquip.setEquListCode(String.valueOf(obj.get("EQU_LIST_CODE")));
jgRelationEquip.setEquCategoryCode(String.valueOf(obj.get("EQU_CATEGORY_CODE")));
equipList.add(jgRelationEquip); equipList.add(jgRelationEquip);
}); });
jgMaintainNoticeMapper.insertBatchSomeColumn(list); jgMaintainNoticeMapper.insertBatchSomeColumn(list);
...@@ -611,7 +652,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -611,7 +652,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
taskMessageDto.setNextTaskId(item.getNextTaskId()); taskMessageDto.setNextTaskId(item.getNextTaskId());
taskModelDto.setModel(taskMessageDto); taskModelDto.setModel(taskMessageDto);
taskModelDto.setNextExecuteUser(item.getNextExecuteIds()); taskModelDto.setNextExecuteUser(item.getNextExecuteIds());
taskModelDto.setTaskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), StringUtils.isEmpty(item.getSupervisoryCode()) ? "" : item.getSupervisoryCode(), item.getApplyNo())); taskModelDto.setTaskContent(String.format("%s发起%s维修告知业务申请,【申请单号%s】", item.getCreateUserName(), item.getEquList(), item.getApplyNo()));
taskModelDtoList.add(taskModelDto); taskModelDtoList.add(taskModelDto);
if (bool) { if (bool) {
// 删除暂存时生成的待办 // 删除暂存时生成的待办
...@@ -627,15 +668,13 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -627,15 +668,13 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
// 发起流程 // 发起流程
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO(); ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>(); List<ActWorkflowStartDTO> list = new ArrayList<>();
deviceList.forEach(item -> {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY); dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey(item.get("SEQUENCE_NBR").toString());
//下一节点执行人单位(下节点接收机构code) //下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(receiveCompanyCode); dto.setNextExecuteUserCompanyCode(receiveCompanyCode);
dto.setCompleteFirstTask(Boolean.TRUE); dto.setCompleteFirstTask(Boolean.TRUE);
list.add(dto); list.add(dto);
});
actWorkflowBatchDTO.setProcess(list); actWorkflowBatchDTO.setProcess(list);
List<ProcessTaskDTO> processTaskDTOS = cmWorkflowService.startBatch(actWorkflowBatchDTO); List<ProcessTaskDTO> processTaskDTOS = cmWorkflowService.startBatch(actWorkflowBatchDTO);
...@@ -759,6 +798,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -759,6 +798,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public void cancel(JgMaintainNoticeDto noticeDto) { public void cancel(JgMaintainNoticeDto noticeDto) {
String instanceId = noticeDto.getInstanceId(); String instanceId = noticeDto.getInstanceId();
String nextTaskId = noticeDto.getNextTaskId(); String nextTaskId = noticeDto.getNextTaskId();
...@@ -810,7 +850,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -810,7 +850,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void accept(JgMaintainNoticeDto dto, String op, String opinion) { @GlobalTransactional(rollbackFor = Exception.class)
public void accept(JgMaintainNoticeDto dto, String op, String opinion,Map<String, Object> model) {
String instanceId = dto.getInstanceId(); String instanceId = dto.getInstanceId();
String nextTaskId = dto.getNextTaskId(); String nextTaskId = dto.getNextTaskId();
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId); String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
...@@ -843,17 +884,21 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -843,17 +884,21 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) { if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) {
LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, dto.getSequenceNbr()); queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgMaintainNoticeEq jgRelationEquip = jgMaintainNoticeEqMapper.selectOne(queryWrapper); List<JgMaintainNoticeEq> jgRelationEquip = jgMaintainNoticeEqMapper.selectList(queryWrapper);
this.saveHisDataBeforeUpdate(jgMaintainNotice, jgRelationEquip.getEquId()); for (JgMaintainNoticeEq jgMaintainNoticeEq : jgRelationEquip) {
this.saveHisDataBeforeUpdate(jgMaintainNotice, jgMaintainNoticeEq.getEquId());
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId()); queryWrapper2.eq(RegistrationInfo::getRecord, jgMaintainNoticeEq.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2); RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
String equCode = Optional.ofNullable(tzsJgRegistrationInfo.getEquDefine()) String equCode = Optional.ofNullable(tzsJgRegistrationInfo.getEquDefine())
.orElse(tzsJgRegistrationInfo.getEquCategory()); .orElse(tzsJgRegistrationInfo.getEquCategory());
String registrationCode = equCode + jgMaintainNotice.getReceiveCompanyCode() + ym; String registrationCode = equCode + jgMaintainNotice.getReceiveCompanyCode() + ym;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode); ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
String deviceRegistrationCode = responseModel.getResult(); jgMaintainNoticeEq.setInformNumber(responseModel.getResult());
jgMaintainNotice.setInformNumber(deviceRegistrationCode); }
jgMaintainNoticeEqService.saveOrUpdateBatch(jgRelationEquip);
jgMaintainNotice.setAcceptDate(new Date()); jgMaintainNotice.setAcceptDate(new Date());
jgMaintainNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())); jgMaintainNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
jgMaintainNotice.setPromoter(""); jgMaintainNotice.setPromoter("");
...@@ -869,11 +914,17 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -869,11 +914,17 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
TaskMessageDto taskMessageDto = new TaskMessageDto(); TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(jgMaintainNotice, taskMessageDto); BeanUtils.copyProperties(jgMaintainNotice, taskMessageDto);
taskMap.put("model", taskMessageDto); taskMap.put("model", taskMessageDto);
commonService.updateTaskModel(taskMap); TaskV2Model taskV2Model1 = commonService.updateTaskModel(taskMap);
jgMaintainNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); jgMaintainNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
jgMaintainNotice.setNextTaskId(workflowResultDto.getNextTaskId()); jgMaintainNotice.setNextTaskId(workflowResultDto.getNextTaskId());
jgMaintainNoticeMapper.updateById(jgMaintainNotice); jgMaintainNoticeMapper.updateById(jgMaintainNotice);
// 保存历史表
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(model));
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName(), jsonObject, "", jgMaintainNotice.getSequenceNbr().toString());
// 保存流水表
saveRecord(jgMaintainNotice, jgRelationEquip, taskV2Model1.getRoutePath());
} else { } else {
jgMaintainNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds()); jgMaintainNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
if (!ObjectUtils.isEmpty(jgMaintainNotice.getInstanceStatus())) { if (!ObjectUtils.isEmpty(jgMaintainNotice.getInstanceStatus())) {
...@@ -950,9 +1001,49 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -950,9 +1001,49 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} }
private void saveRecord(JgMaintainNotice jgMaintainNotice, List<JgMaintainNoticeEq> jgMaintainNoticeEqList, String routePath) {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String content = jgMaintainNotice.getCreateUserName() + "办理了【维修告知】" +
"单号【" + jgMaintainNotice.getApplyNo() + "】,办理日期" + DateUtils.getDateNowShortStr();
List<JgCertificateChangeRecord> certificateChangeRecords = new ArrayList<>();
List<JgCertificateChangeRecordEq> changeRecordEqList = new ArrayList<>();
long seq = sequence.nextId();
JgCertificateChangeRecord changeRecord = new JgCertificateChangeRecord();
changeRecord.setSequenceNbr(seq);
changeRecord.setApplyNo(jgMaintainNotice.getApplyNo());
changeRecord.setReceiveOrgName(jgMaintainNotice.getReceiveOrgName());
changeRecord.setAuditPassDate(new Date());
changeRecord.setRegType("维修告知");
changeRecord.setRegDate(jgMaintainNotice.getCreateDate());
changeRecord.setChangeContent(content);
changeRecord.setReceiveCompanyCode(jgMaintainNotice.getReceiveOrgCode());
changeRecord.setUseUnitCreditCode(jgMaintainNotice.getUseUnitCreditCode());
changeRecord.setUseUnitName(jgMaintainNotice.getUseUnitName());
changeRecord.setCreateDate(new Date());
changeRecord.setCreateUserId(reginParams.getUserModel().getUserId());
changeRecord.setRoutePath(routePath);
certificateChangeRecords.add(changeRecord);
jgMaintainNoticeEqList.stream().forEach(e -> {
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(changeRecord.getSequenceNbr().toString()); //登记证记录主键
changeRecordEq.setEquId(e.getEquId()); //设备主键
changeRecordEq.setProductCode(e.getEquCode()); //设备代码
changeRecordEqList.add(changeRecordEq);
});
if (certificateChangeRecords.size() > 0) {
certificateChangeRecordService.saveBatch(certificateChangeRecords);
}
if (changeRecordEqList.size() > 0) {
jgCertificateChangeRecordEqServiceImpl.saveBatch(changeRecordEqList);
}
}
private void saveHisDataBeforeUpdate(JgMaintainNotice jgMaintainNotice, String equId) { private void saveHisDataBeforeUpdate(JgMaintainNotice jgMaintainNotice, String equId) {
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId); Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName(), new JSONObject(map), equId, jgMaintainNotice.getSequenceNbr().toString()); commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName(), new JSONObject(map), null, jgMaintainNotice.getSequenceNbr().toString());
} }
......
...@@ -269,7 +269,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -269,7 +269,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(noticeParams)); JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(noticeParams));
commonService.saveExecuteFlowData2Redis(instanceId, buildInstanceRuntimeData(jgScrapCancel)); commonService.saveExecuteFlowData2Redis(instanceId, buildInstanceRuntimeData(jgScrapCancel));
String equListName = EquipmentClassifityEnum.getNameByCode(jsonObject.get("equListCode").toString()); String equListName = EquipmentClassifityEnum.getNameByCode(jsonObject.get("equListCode").toString());
save2HisData(jsonObject, jgScrapCancel.getSequenceNbr().toString()); save2HisData(jsonObject, jgScrapCancel.getSequenceNbr().toString(),jgScrapCancel.getCancelTypeDesc());
JgScrapCancelDto dto = new JgScrapCancelDto(); JgScrapCancelDto dto = new JgScrapCancelDto();
BeanUtil.copyProperties(jgScrapCancel, dto); BeanUtil.copyProperties(jgScrapCancel, dto);
dto.setEquListName(equListName); dto.setEquListName(equListName);
...@@ -419,8 +419,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -419,8 +419,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
} }
private void save2HisData(JSONObject jsonObject, String currentDocumentId) { private void save2HisData(JSONObject jsonObject, String currentDocumentId,String cancelTypeDesc) {
commonService.saveOrUpdateHistory("", jsonObject, null, currentDocumentId); commonService.saveOrUpdateHistory(cancelTypeDesc, jsonObject, null, currentDocumentId);
} }
private void createTaskModel(JgScrapCancel scrapCancel, String taskName, String submitType, String nextUserIds) { private void createTaskModel(JgScrapCancel scrapCancel, String taskName, String submitType, String nextUserIds) {
......
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