Commit 6987374a authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_bugfix' into develop_tzs_register

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/useRegister/UseRegisterUpdateService.java
parents 8997fb5f 1b54a6f5
...@@ -84,12 +84,12 @@ public class DictParamsConverter implements Converter<String> { ...@@ -84,12 +84,12 @@ public class DictParamsConverter implements Converter<String> {
dictMap.put("直接顶升", "1"); dictMap.put("直接顶升", "1");
dictMap.put("间接顶升", "2"); dictMap.put("间接顶升", "2");
// HashMap<String, String> controlModeMap = new HashMap<>(); HashMap<String, String> controlModeMap = new HashMap<>();
// controlModeMap.put("集选", "1"); controlModeMap.put("集选", "1");
// controlModeMap.put("并联", "2"); controlModeMap.put("并联", "2");
// controlModeMap.put("按钮", "3"); controlModeMap.put("按钮", "3");
// controlModeMap.put("其他", "4"); controlModeMap.put("其他", "4");
// feildDictMap.put("controlMode", controlModeMap); feildDictMap.put("controlMode", controlModeMap);
HashMap<String, String> nonDestructiveTestingMethodsForPressurePartsMap = new HashMap<>(); HashMap<String, String> nonDestructiveTestingMethodsForPressurePartsMap = new HashMap<>();
nonDestructiveTestingMethodsForPressurePartsMap.put("磁粉", "5988"); nonDestructiveTestingMethodsForPressurePartsMap.put("磁粉", "5988");
......
...@@ -438,6 +438,10 @@ public class XiAnElevatorExcelDto extends BaseDto { ...@@ -438,6 +438,10 @@ public class XiAnElevatorExcelDto extends BaseDto {
@ExcelProperty(value = "市场监管所代码") @ExcelProperty(value = "市场监管所代码")
private String supervisionOfficeCode; private String supervisionOfficeCode;
@ApiModelProperty(value = "数据来源")
@ExcelIgnore
private String dataSource;
public void setoRegUnit(String oRegUnit) { public void setoRegUnit(String oRegUnit) {
this.oRegUnit = oRegUnit; this.oRegUnit = oRegUnit;
} }
......
...@@ -565,7 +565,7 @@ public class XiAnDataDockServiceImpl { ...@@ -565,7 +565,7 @@ public class XiAnDataDockServiceImpl {
return ResponseHelper.buildFailureResponse(e.getMessage(), "参数校验失败,详细请看返回信息", HttpStatus.BAD_REQUEST); return ResponseHelper.buildFailureResponse(e.getMessage(), "参数校验失败,详细请看返回信息", HttpStatus.BAD_REQUEST);
} }
return ResponseHelper.buildResponse(this.batchSaveElevatorData(elevatorExcelDtos)); return ResponseHelper.buildResponse(this.batchSaveElevatorData(elevatorExcelDtos, isRegistration));
} }
/** /**
...@@ -774,12 +774,13 @@ public class XiAnDataDockServiceImpl { ...@@ -774,12 +774,13 @@ public class XiAnDataDockServiceImpl {
* 批量异步保存设备数据 * 批量异步保存设备数据
* *
* @param elevatorExcelDtos * @param elevatorExcelDtos
* @param isRegistration
*/ */
public Map<String, String> batchSaveElevatorData(List<XiAnElevatorExcelDto> elevatorExcelDtos) { public Map<String, Object> batchSaveElevatorData(List<XiAnElevatorExcelDto> elevatorExcelDtos, Boolean isRegistration) {
log.info("解析成功,准备上传数据,条数:{}", elevatorExcelDtos.size()); log.info("解析成功,准备上传数据,条数:{}", elevatorExcelDtos.size());
int batchSize = 1000; int batchSize = 1000;
int totalSize = elevatorExcelDtos.size(); int totalSize = elevatorExcelDtos.size();
Map<String, String> rMap = new HashMap<>(); Map<String, Object> rMap = new HashMap<>();
// 主线程中获取登录信息传递到异步线程中 // 主线程中获取登录信息传递到异步线程中
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
Set<String> importResult = ConcurrentHashMap.newKeySet(); // 使用线程安全的Set Set<String> importResult = ConcurrentHashMap.newKeySet(); // 使用线程安全的Set
...@@ -793,6 +794,17 @@ public class XiAnDataDockServiceImpl { ...@@ -793,6 +794,17 @@ public class XiAnDataDockServiceImpl {
try { try {
semaphore.acquire(); // 获取许可 semaphore.acquire(); // 获取许可
contextWrapper.apply(); contextWrapper.apply();
batch.forEach(equ -> {
if (isRegistration) {
// 已登记的设备作为历史设备
equ.setDataSource("jg_his_xa");
} else {
// 未做过登记的新设备
equ.setDataSource("jg_xa");
}
});
Object result = jgServiceFeignClient.saveElevatorData(batch); Object result = jgServiceFeignClient.saveElevatorData(batch);
LinkedHashMap<String, Object> resultMap = (LinkedHashMap<String, Object>) result; LinkedHashMap<String, Object> resultMap = (LinkedHashMap<String, Object>) result;
...@@ -802,7 +814,7 @@ public class XiAnDataDockServiceImpl { ...@@ -802,7 +814,7 @@ public class XiAnDataDockServiceImpl {
.filter(item -> item instanceof String) .filter(item -> item instanceof String)
.forEach(item -> importResult.add((String) item)); .forEach(item -> importResult.add((String) item));
} }
if (resultMap.containsKey("status") && resultMap.get("status") != "200") { if (resultMap.containsKey("status") && Integer.parseInt(resultMap.get("status").toString()) != 200) {
throw new RuntimeException(resultMap.get("message").toString()); throw new RuntimeException(resultMap.get("message").toString());
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -817,8 +829,8 @@ public class XiAnDataDockServiceImpl { ...@@ -817,8 +829,8 @@ public class XiAnDataDockServiceImpl {
// 等待所有异步任务完成 // 等待所有异步任务完成
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
if (!ValidationUtil.isEmpty(importResult)) { if (!ValidationUtil.isEmpty(importResult)) {
rMap.put("message", "设备已做过后续业务或被编辑,更新失败:[" + String.join(",", importResult) + "]"); rMap.put("message", importResult);
log.info("设备已做过后续业务或被编辑,更新失败:[{}", String.join(",", importResult) + "]"); log.info("更新失败:{}", importResult);
return rMap; return rMap;
} }
log.info("设备保存成功"); log.info("设备保存成功");
......
...@@ -34,18 +34,33 @@ public class MaintenanceInfoModel extends BaseDto { ...@@ -34,18 +34,33 @@ public class MaintenanceInfoModel extends BaseDto {
private Date informStart; private Date informStart;
@ApiModelProperty(value = "维保合同结束日期") @ApiModelProperty(value = "维保合同结束日期")
private Date informEnd; private Date informEnd;
@ApiModelProperty(value = "维保负责人姓名") @ApiModelProperty(value = "维保人员一")
private String meMaster; private String meMaster;
@ApiModelProperty(value = "维保负责人身份证") //@ApiModelProperty(value = "维保负责人身份证")
private String meMasterId; //private String meMasterId;
@ApiModelProperty(value = "紧急救援电话") //@ApiModelProperty(value = "紧急救援电话")
private String emergencycall; //private String emergencycall;
@ApiModelProperty(value = "维保周期") //@ApiModelProperty(value = "维保周期")
private String meCycle; //private String meCycle;
@ApiModelProperty(value = "大修周期") //@ApiModelProperty(value = "大修周期")
private String overhaulCycle; private String overhaulCycle;
@ApiModelProperty(value = "24小时维保电话") // @ApiModelProperty(value = "24小时维保电话")
private String me24Telephone; //private String me24Telephone;
/**
*维保负责人1电话
*/
@ApiModelProperty(value = "维保人员一电话")
private String meMasterPhone;
/**
*维保负责人2姓名
*/
@ApiModelProperty(value = "维保人员二")
private String meMaster1;
/**
*维保负责人2电话
*/
@ApiModelProperty(value = "维保人员二电话")
private String meMaster1Phone;
} }
package com.yeejoin.amos.boot.module.app.api.dto; package com.yeejoin.amos.boot.module.app.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -20,7 +21,27 @@ public class MaintenanceInfoModelForWX { ...@@ -20,7 +21,27 @@ public class MaintenanceInfoModelForWX {
@ApiModelProperty(value = "维保单位") @ApiModelProperty(value = "维保单位")
private String meUnitName; private String meUnitName;
@ApiModelProperty(value = "维保电话") //@ApiModelProperty(value = "维保电话")
private String me24Telephone; //private String me24Telephone;
/**
* * 维保负责人姓名
* */
@ApiModelProperty(value = "维保人员一")
private String meMaster;
/**
*维保负责人1电话
*/
@ApiModelProperty(value = "维保人员一电话")
private String meMasterPhone;
/**
*维保负责人2姓名
*/
@ApiModelProperty(value = "维保人员二")
private String meMaster1;
/**
*维保负责人2电话
*/
@ApiModelProperty(value = "维保人员二电话")
private String meMaster1Phone;
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.app.api.entity; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.app.api.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -80,6 +81,32 @@ public class MaintenanceInfo extends AbstractEquipBaseEntity { ...@@ -80,6 +81,32 @@ public class MaintenanceInfo extends AbstractEquipBaseEntity {
@TableField(value ="\"ME_MASTER_ID\"") @TableField(value ="\"ME_MASTER_ID\"")
private String meMasterId; private String meMasterId;
/** /**
*维保负责人1电话
*/
@TableField("\"ME_MASTER_PHONE\"")
private String meMasterPhone;
/**
*维保负责人2姓名
*/
@TableField("\"ME_MASTER1\"")
private String meMaster1;
/**
*维保负责人2身份证
*/
@TableField("\"ME_MASTER1_ID\"")
private String meMaster1Id;
/**
*维保负责人2电话
*/
@TableField("\"ME_MASTER1_PHONE\"")
private String meMaster1Phone;
/**
* * 紧急救援电话 * * 紧急救援电话
* */ * */
...@@ -104,5 +131,4 @@ public class MaintenanceInfo extends AbstractEquipBaseEntity { ...@@ -104,5 +131,4 @@ public class MaintenanceInfo extends AbstractEquipBaseEntity {
@TableField(value ="\"ME24_TELEPHONE\"") @TableField(value ="\"ME24_TELEPHONE\"")
private String me24Telephone; private String me24Telephone;
} }
...@@ -3,10 +3,13 @@ package com.yeejoin.amos.boot.module.common.api.dto; ...@@ -3,10 +3,13 @@ package com.yeejoin.amos.boot.module.common.api.dto;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.Date;
/** /**
* @author Administrator * @author Administrator
* Excel导入错误日志 * Excel导入错误日志
...@@ -18,12 +21,18 @@ public class ExcelImportErrorLogDto { ...@@ -18,12 +21,18 @@ public class ExcelImportErrorLogDto {
@Id @Id
private Long sequenceNbr; private Long sequenceNbr;
@Field(type = FieldType.Text) @Field(type = FieldType.Keyword)
private String xaSerial; private String xaSerial;
@Field(type = FieldType.Text) @Field(type = FieldType.Keyword)
private String record; private String record;
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String errorInfo; private String errorInfo;
@Field(type = FieldType.Text)
private String traceInfo;
@Field(type = FieldType.Date, format = DateFormat.date_hour_minute)
private Date createTime;
} }
...@@ -3332,7 +3332,10 @@ ...@@ -3332,7 +3332,10 @@
from from
tzs_jg_resume_info tzs_jg_resume_info
where where
equ_id = #{record} and change_content = '设备编辑' equ_id = #{record}
AND business_type <![CDATA[ <> ]]> '历史设备登记'
AND change_content <![CDATA[ <> ]]> '新增设备业务办理'
AND data_source <![CDATA[ <> ]]> 1
) a ) a
</select> </select>
<select id="countEquipInUseTimesWithOutZFBatch" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto"> <select id="countEquipInUseTimesWithOutZFBatch" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
SELECT SELECT
* *
FROM tzs_jg_resume_info FROM tzs_jg_resume_info
WHERE WHERE is_delete = '0' and
<foreach collection="equIds" item="id" open="(" separator="or" close=")"> <foreach collection="equIds" item="id" open="(" separator="or" close=")">
equ_id like concat('%',#{id}, '%') equ_id like concat('%',#{id}, '%')
</foreach> </foreach>
......
...@@ -101,15 +101,12 @@ ...@@ -101,15 +101,12 @@
<if test="dto.equDefineCode != null and dto.equDefineCode != ''"> <if test="dto.equDefineCode != null and dto.equDefineCode != ''">
and tjurm.equ_define_code = #{dto.equDefineCode} and tjurm.equ_define_code = #{dto.equDefineCode}
</if> </if>
-- 使用登记证编号
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%') and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if> </if>
-- 申请单号
<if test="dto.applyNo != null and dto.applyNo != ''"> <if test="dto.applyNo != null and dto.applyNo != ''">
and tjurm.apply_no like concat('%',#{dto.applyNo},'%') and tjurm.apply_no like concat('%',#{dto.applyNo},'%')
</if> </if>
-- 登记证书唯一码
<if test="dto.certificateNo != null and dto.certificateNo != ''"> <if test="dto.certificateNo != null and dto.certificateNo != ''">
and tjurm.certificate_no = #{dto.certificateNo} and tjurm.certificate_no = #{dto.certificateNo}
</if> </if>
...@@ -129,15 +126,12 @@ ...@@ -129,15 +126,12 @@
and (tjurm.receive_company_code = #{dto.receiveCompanyCode} and (tjurm.receive_company_code = #{dto.receiveCompanyCode}
or tjurm.receive_company_code is null or tjurm.receive_company_code = '') or tjurm.receive_company_code is null or tjurm.receive_company_code = '')
</if> </if>
-- 企业根据企业统一信用代码匹配
<if test="dto.dataType == 'company' "> <if test="dto.dataType == 'company' ">
AND tjurm.use_unit_credit_code = #{dto.useUnitCreditCode} AND tjurm.use_unit_credit_code = #{dto.useUnitCreditCode}
</if> </if>
-- 监管单位根据接受机构匹配
<if test="dto.dataType == 'supervision' "> <if test="dto.dataType == 'supervision' ">
AND tjurm.receive_company_code = #{dto.receiveCompanyCode} AND tjurm.receive_company_code = #{dto.receiveCompanyCode}
</if> </if>
-- 是否车用气瓶(whetherVehicleCylinder)= 1 ,过滤出车用气瓶使用登记证数据
<if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 "> <if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 ">
AND tjurm.reg_type = '车用气瓶登记' AND tjurm.reg_type = '车用气瓶登记'
</if> </if>
...@@ -186,15 +180,12 @@ ...@@ -186,15 +180,12 @@
<if test="dto.equDefineCode != null and dto.equDefineCode != ''"> <if test="dto.equDefineCode != null and dto.equDefineCode != ''">
and tjurm.equ_define_code = #{dto.equDefineCode} and tjurm.equ_define_code = #{dto.equDefineCode}
</if> </if>
-- 使用登记证编号
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%') and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if> </if>
-- 申请单号
<if test="dto.applyNo != null and dto.applyNo != ''"> <if test="dto.applyNo != null and dto.applyNo != ''">
and tjurm.apply_no like concat('%',#{dto.applyNo},'%') and tjurm.apply_no like concat('%',#{dto.applyNo},'%')
</if> </if>
-- 登记证书唯一码
<if test="dto.certificateNo != null and dto.certificateNo != ''"> <if test="dto.certificateNo != null and dto.certificateNo != ''">
and tjurm.certificate_no = #{dto.certificateNo} and tjurm.certificate_no = #{dto.certificateNo}
</if> </if>
...@@ -213,7 +204,6 @@ ...@@ -213,7 +204,6 @@
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''"> <if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
and tjurm.receive_company_code = #{dto.receiveCompanyCode} and tjurm.receive_company_code = #{dto.receiveCompanyCode}
</if> </if>
-- 是否车用气瓶(whetherVehicleCylinder)= 1 ,过滤出车用气瓶使用登记证数据
<if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 "> <if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 ">
AND tjurm.reg_type = '车用气瓶登记' AND tjurm.reg_type = '车用气瓶登记'
</if> </if>
...@@ -247,7 +237,6 @@ ...@@ -247,7 +237,6 @@
from tzs_jg_use_registration_manage tjurm from tzs_jg_use_registration_manage tjurm
where where
tjurm.is_delete = 0 tjurm.is_delete = 0
-- 使用登记证编号
<if test="useRegistrationCode != null and useRegistrationCode != ''"> <if test="useRegistrationCode != null and useRegistrationCode != ''">
and tjurm.use_registration_code = #{useRegistrationCode} and tjurm.use_registration_code = #{useRegistrationCode}
</if> </if>
...@@ -551,7 +540,6 @@ ...@@ -551,7 +540,6 @@
<if test="dto.equDefineCode != null and dto.equDefineCode != ''"> <if test="dto.equDefineCode != null and dto.equDefineCode != ''">
and tjurm.equ_define_code = #{dto.equDefineCode} and tjurm.equ_define_code = #{dto.equDefineCode}
</if> </if>
-- 使用登记证编号
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%') and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if> </if>
...@@ -622,15 +610,12 @@ ...@@ -622,15 +610,12 @@
<if test="dto.equDefineCode != null and dto.equDefineCode != ''"> <if test="dto.equDefineCode != null and dto.equDefineCode != ''">
and tjurm.equ_define_code = #{dto.equDefineCode} and tjurm.equ_define_code = #{dto.equDefineCode}
</if> </if>
-- 使用登记证编号
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%') and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if> </if>
-- 申请单号
<if test="dto.applyNo != null and dto.applyNo != ''"> <if test="dto.applyNo != null and dto.applyNo != ''">
and tjurm.apply_no like concat('%',#{dto.applyNo},'%') and tjurm.apply_no like concat('%',#{dto.applyNo},'%')
</if> </if>
-- 登记证书唯一码
<if test="dto.certificateNo != null and dto.certificateNo != ''"> <if test="dto.certificateNo != null and dto.certificateNo != ''">
and tjurm.certificate_no = #{dto.certificateNo} and tjurm.certificate_no = #{dto.certificateNo}
</if> </if>
...@@ -650,15 +635,12 @@ ...@@ -650,15 +635,12 @@
and (tjurm.receive_company_code = #{dto.receiveCompanyCode} and (tjurm.receive_company_code = #{dto.receiveCompanyCode}
or tjurm.receive_company_code is null or tjurm.receive_company_code = '') or tjurm.receive_company_code is null or tjurm.receive_company_code = '')
</if> </if>
-- 企业根据企业统一信用代码匹配
<if test="dto.dataType == 'company' "> <if test="dto.dataType == 'company' ">
AND tjurm.use_unit_credit_code = #{dto.useUnitCreditCode} AND tjurm.use_unit_credit_code = #{dto.useUnitCreditCode}
</if> </if>
-- 监管单位根据接受机构匹配
<if test="dto.dataType == 'supervision' "> <if test="dto.dataType == 'supervision' ">
AND tjurm.receive_company_code = #{dto.receiveCompanyCode} AND tjurm.receive_company_code = #{dto.receiveCompanyCode}
</if> </if>
-- 是否车用气瓶(whetherVehicleCylinder)= 1 ,过滤出车用气瓶使用登记证数据
<if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 "> <if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 ">
AND tjurm.reg_type = '车用气瓶登记' AND tjurm.reg_type = '车用气瓶登记'
</if> </if>
......
...@@ -101,7 +101,7 @@ public class BizDataChangeController extends BaseController { ...@@ -101,7 +101,7 @@ public class BizDataChangeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/{bizType}/change-logs") @GetMapping(value = "/v2/{bizType}/change-logs")
@ApiOperation(value = "编辑一级页面详情查询--通用", httpMethod = "GET") @ApiOperation(value = "编辑一级页面详情查询--通用", httpMethod = "GET")
public ResponseModel<IPage<?>> getChangeLogPage(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId, public ResponseModel<IPage<?>> getChangeLogPage(@ApiParam(value = "设备或者装置唯一标识") @RequestParam(value = "bizId", required = false) String bizId,
@ApiParam(required = true, value = "业务类型") @PathVariable String bizType, @ApiParam(required = true, value = "业务类型") @PathVariable String bizType,
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size) {
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.edit; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.edit;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping; import com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData; import com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData;
...@@ -52,8 +53,10 @@ public class BizDataChangeServiceImpl { ...@@ -52,8 +53,10 @@ public class BizDataChangeServiceImpl {
} }
public IPage<?> getChangeLogPage(String bizId, String bizType, int current, int size) { public IPage<?> getChangeLogPage(String bizId, String bizType, int current, int size) {
if (bizId == null || bizId.isEmpty()) {
return new Page<>(current, size);
}
IBizDataChangeHandleStrategy handleStrategy = BizDataHandleStrategyContext.getStrategy(bizType); IBizDataChangeHandleStrategy handleStrategy = BizDataHandleStrategyContext.getStrategy(bizType);
return handleStrategy.getChangeLogs(bizId, current, size); return handleStrategy.getChangeLogs(bizId, current, size);
} }
} }
...@@ -31,10 +31,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -31,10 +31,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Collections; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -106,6 +103,9 @@ public class UseRegisterUpdateService { ...@@ -106,6 +103,9 @@ public class UseRegisterUpdateService {
*/ */
public void updateUseRegistrationInfo(String bizId, List<FieldChangeMeta> allChangeColumns) { public void updateUseRegistrationInfo(String bizId, List<FieldChangeMeta> allChangeColumns) {
Map<String, Object> useRegistrationMap = jgUseRegistrationService.getJgUseRegistrationMapper().getUseRegistrationDetail(bizId); Map<String, Object> useRegistrationMap = jgUseRegistrationService.getJgUseRegistrationMapper().getUseRegistrationDetail(bizId);
if (ValidationUtil.isEmpty(useRegistrationMap)) {
return;
}
JgUseRegistration jgUseRegistration = jgUseRegistrationService.getById(MapUtils.getString(useRegistrationMap, "UseRegistratSequenceNbr")); JgUseRegistration jgUseRegistration = jgUseRegistrationService.getById(MapUtils.getString(useRegistrationMap, "UseRegistratSequenceNbr"));
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getDteailByRecord(bizId, MapUtils.getString(useRegistrationMap, "UseRegistratSequenceNbr")); JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getDteailByRecord(bizId, MapUtils.getString(useRegistrationMap, "UseRegistratSequenceNbr"));
allChangeColumns.forEach(meta -> { allChangeColumns.forEach(meta -> {
......
...@@ -123,7 +123,6 @@ public class CommonEquipDataProcessService { ...@@ -123,7 +123,6 @@ public class CommonEquipDataProcessService {
private final RestHighLevelClient restHighLevelClient; private final RestHighLevelClient restHighLevelClient;
@Lazy
private final JgUseRegistrationServiceImpl jgUseRegistrationService; private final JgUseRegistrationServiceImpl jgUseRegistrationService;
private final CommonServiceImpl commonService; private final CommonServiceImpl commonService;
...@@ -827,6 +826,7 @@ public class CommonEquipDataProcessService { ...@@ -827,6 +826,7 @@ public class CommonEquipDataProcessService {
if (!ValidationUtil.isEmpty(registerInfo.getUseOrgCode())) { if (!ValidationUtil.isEmpty(registerInfo.getUseOrgCode())) {
JgUseRegistrationManage jgUseRegistrationManage = jgUseRegistrationManageService.lambdaQuery() JgUseRegistrationManage jgUseRegistrationManage = jgUseRegistrationManageService.lambdaQuery()
.eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfo.getUseOrgCode()) .eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfo.getUseOrgCode())
.eq(JgUseRegistrationManage::getIsDelete, 0)
.select(JgUseRegistrationManage::getSequenceNbr, JgUseRegistrationManage::getReceiveCompanyCode).one(); .select(JgUseRegistrationManage::getSequenceNbr, JgUseRegistrationManage::getReceiveCompanyCode).one();
result.put("receiveCompanyCode", jgUseRegistrationManage.getReceiveCompanyCode()); result.put("receiveCompanyCode", jgUseRegistrationManage.getReceiveCompanyCode());
} }
......
...@@ -74,7 +74,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -74,7 +74,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
CommonEquipDataProcessService.castMap2Bean(changeJson, registerInfoNew); CommonEquipDataProcessService.castMap2Bean(changeJson, registerInfoNew);
registerInfoNew.setSequenceNbr(registerInfoOld.getSequenceNbr()); registerInfoNew.setSequenceNbr(registerInfoOld.getSequenceNbr());
if (registerInfoOld.getUseOrgCode() != null) { if (!ValidationUtil.isEmpty(registerInfoOld.getUseOrgCode())) {
JgUseRegistrationManage jgUseRegistrationManage = commonEquipDataProcessService.getJgUseRegistrationManageService().lambdaQuery() JgUseRegistrationManage jgUseRegistrationManage = commonEquipDataProcessService.getJgUseRegistrationManageService().lambdaQuery()
.eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfoOld.getUseOrgCode()) .eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfoOld.getUseOrgCode())
.select(JgUseRegistrationManage::getSequenceNbr, JgUseRegistrationManage::getReceiveCompanyCode).one(); .select(JgUseRegistrationManage::getSequenceNbr, JgUseRegistrationManage::getReceiveCompanyCode).one();
......
...@@ -20,10 +20,14 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes ...@@ -20,10 +20,14 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy; import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.PieLineLevelTypeHandler; import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.PieLineLevelTypeHandler;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
...@@ -37,6 +41,7 @@ import java.util.stream.Collectors; ...@@ -37,6 +41,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessStrategy { public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessStrategy {
@Lazy
private final CommonEquipDataProcessService commonEquipDataProcessService; private final CommonEquipDataProcessService commonEquipDataProcessService;
private final PieLineDataChangeServiceImpl pieLineDataChangeService; private final PieLineDataChangeServiceImpl pieLineDataChangeService;
......
...@@ -1322,7 +1322,9 @@ public class EquipClaimServiceImpl { ...@@ -1322,7 +1322,9 @@ public class EquipClaimServiceImpl {
useInfo.setRecord(record); useInfo.setRecord(record);
useInfo.setSequenceNbr(null); useInfo.setSequenceNbr(null);
useInfo.setRecDate(nowDate); useInfo.setRecDate(nowDate);
if (!hasRecord) {
useInfo.setCreateDate(nowDate); useInfo.setCreateDate(nowDate);
}
useInfo.setDataSource(JG_HIS_XA_CLAIM); useInfo.setDataSource(JG_HIS_XA_CLAIM);
useInfo.setIsIntoManagement(isIntoManagement); useInfo.setIsIntoManagement(isIntoManagement);
useInfo.setUseUnitCreditCode(company.getCompanyCode()); useInfo.setUseUnitCreditCode(company.getCompanyCode());
...@@ -1436,7 +1438,16 @@ public class EquipClaimServiceImpl { ...@@ -1436,7 +1438,16 @@ public class EquipClaimServiceImpl {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime()); esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
} }
esEquipmentDto.setREC_DATE(System.currentTimeMillis()); esEquipmentDto.setREC_DATE(System.currentTimeMillis());
if (!hasRecord) {
esEquipmentDto.setCREATE_DATE(System.currentTimeMillis());
} else {
IdxBizJgUseInfo existUseInfo = idxBizJgUseInfoService.lambdaQuery().eq(IdxBizJgUseInfo::getRecord, record).one();
if (ValidationUtil.isEmpty(existUseInfo)) {
esEquipmentDto.setCREATE_DATE(System.currentTimeMillis()); esEquipmentDto.setCREATE_DATE(System.currentTimeMillis());
} else {
esEquipmentDto.setCREATE_DATE(existUseInfo.getCreateDate().getTime());
}
}
esEquipmentDto.setSEQUENCE_NBR(record); esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setIS_INTO_MANAGEMENT(false); esEquipmentDto.setIS_INTO_MANAGEMENT(false);
esEquipmentDto.setEQU_CATEGORY_CODE(registerInfo.getEquCategory()); esEquipmentDto.setEQU_CATEGORY_CODE(registerInfo.getEquCategory());
......
...@@ -3996,8 +3996,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3996,8 +3996,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String equipSource = String.valueOf(equipmentInfoForm.get(DATA_SOURCE)); String equipSource = String.valueOf(equipmentInfoForm.get(DATA_SOURCE));
return "new".equals(equipSource) ? "jg" return "new".equals(equipSource) ? "jg"
: "his".equals(equipSource) ? "jg_his" : "his".equals(equipSource) ? "jg_his"
: "jg_pl".equals(equipSource) ? "jg_pl" : "black".equals(equipSource) ? "jg_his_black"
: "jg_his_black"; : equipSource;
} }
public void checkEsData(String id) { public void checkEsData(String id) {
...@@ -4009,14 +4009,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4009,14 +4009,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentCategory.deleteById(id); esEquipmentCategory.deleteById(id);
} }
if (!ObjectUtils.isEmpty(dto)) { if (!ObjectUtils.isEmpty(dto)) {
long time = Timestamp.valueOf(map.get("REC_DATE").toString().substring(0, 19)).getTime(); long recTime;
long createTime; long createTime;
if (map.get("CREATE_DATE") == null) { if (ValidationUtil.isEmpty(map.get("CREATE_DATE"))) {
createTime = time; createTime = System.currentTimeMillis();
} else { } else {
createTime = Timestamp.valueOf(map.get("CREATE_DATE").toString().substring(0, 19)).getTime(); createTime = Timestamp.valueOf(map.get("CREATE_DATE").toString().substring(0, 19)).getTime();
} }
dto.setREC_DATE(time); if (ValidationUtil.isEmpty(map.get("REC_DATE"))) {
recTime = System.currentTimeMillis();
} else {
recTime = Timestamp.valueOf(map.get("REC_DATE").toString().substring(0, 19)).getTime();
}
dto.setREC_DATE(recTime);
dto.setCREATE_DATE(createTime); dto.setCREATE_DATE(createTime);
// 需要安装的设备 安装告知审批通过 清除设备的USC_UNIT_CREDIT_CODE安装单位信息 // 需要安装的设备 安装告知审批通过 清除设备的USC_UNIT_CREDIT_CODE安装单位信息
// 使用单位编辑 防止更新设备时将安改维单位信息更新到es中 // 使用单位编辑 防止更新设备时将安改维单位信息更新到es中
......
...@@ -63,6 +63,7 @@ import org.redisson.api.RLock; ...@@ -63,6 +63,7 @@ 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;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -200,6 +201,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -200,6 +201,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired @Autowired
JgResumeInfoServiceImpl jgResumeInfoService; JgResumeInfoServiceImpl jgResumeInfoService;
@Lazy
@Autowired @Autowired
private PieLineDataChangeServiceImpl pieLineDataChangeService; private PieLineDataChangeServiceImpl pieLineDataChangeService;
......
...@@ -101,7 +101,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -101,7 +101,7 @@ public class AQZSDPStatisticsServiceImpl {
private StCommonServiceImpl stCommonService; private StCommonServiceImpl stCommonService;
private TZSCommonServiceImpl tstCommonService; private TZSCommonServiceImpl tzsCommonService;
private JGDPStatisticsServiceImpl jgDPStatisticsService; private JGDPStatisticsServiceImpl jgDPStatisticsService;
...@@ -119,7 +119,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -119,7 +119,7 @@ public class AQZSDPStatisticsServiceImpl {
StCommonServiceImpl stCommonService, StCommonServiceImpl stCommonService,
DataDictionaryMapper dataDictionaryMapper, DataDictionaryMapper dataDictionaryMapper,
JGDPStatisticsServiceImpl jgDPStatisticsService, JGDPStatisticsServiceImpl jgDPStatisticsService,
TZSCommonServiceImpl tstCommonService) { TZSCommonServiceImpl tzsCommonService) {
this.restHighLevelClient = restHighLevelClient; this.restHighLevelClient = restHighLevelClient;
this.statisticsMapper = statisticsMapper; this.statisticsMapper = statisticsMapper;
this.enterpriseInfoMapper = enterpriseInfoMapper; this.enterpriseInfoMapper = enterpriseInfoMapper;
...@@ -128,7 +128,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -128,7 +128,7 @@ public class AQZSDPStatisticsServiceImpl {
this.stCommonService = stCommonService; this.stCommonService = stCommonService;
this.dataDictionaryMapper = dataDictionaryMapper; this.dataDictionaryMapper = dataDictionaryMapper;
this.jgDPStatisticsService = jgDPStatisticsService; this.jgDPStatisticsService = jgDPStatisticsService;
this.tstCommonService = tstCommonService; this.tzsCommonService = tzsCommonService;
} }
...@@ -512,14 +512,24 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -512,14 +512,24 @@ public class AQZSDPStatisticsServiceImpl {
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("1"); List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("1");
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (orgCode != null) { if (orgCode != null) {
// BoolQueryBuilder overdueQuery = new BoolQueryBuilder();
// statisticalAnalysisService.personOrgCodeBoolMust(orgCode, overdueQuery, StatisticalAnalysisEnum.person.getCode());
// tstCommonService.buildExpiryDateQueryBuilder(overdueQuery, "overdue", "licenses", "licenses.expiryDate");
// Long overNumber = statisticalAnalysisService.getStatisticCount(overdueQuery, StatisticalAnalysisEnum.person.getKey());
// BoolQueryBuilder nearQuery = new BoolQueryBuilder();
// statisticalAnalysisService.personOrgCodeBoolMust(orgCode, nearQuery, StatisticalAnalysisEnum.person.getCode());
// tstCommonService.buildExpiryDateQueryBuilder(nearQuery, "near", "licenses", "licenses.expiryDate");
// Long nearNumber = statisticalAnalysisService.getStatisticCount(nearQuery, StatisticalAnalysisEnum.person.getKey());
// dataMap.put(IssueTypeEnum.LICENSE_OVERDUE_PERSON.getName(), overNumber);
// dataMap.put(IssueTypeEnum.LICENSE_EXPIRY_PERSON.getName(), nearNumber);
BoolQueryBuilder overdueQuery = new BoolQueryBuilder(); BoolQueryBuilder overdueQuery = new BoolQueryBuilder();
overdueQuery.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode)); // overdueQuery.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode));
tstCommonService.buildExpiryDateQueryBuilder(overdueQuery, "overdue", "licenses", "licenses.expiryDate"); // tstCommonService.buildExpiryDateQueryBuilder(overdueQuery, "overdue", "licenses", "licenses.expiryDate");
Long overNumber = stCommonService.getNestedQueryStatisticCount(overdueQuery, StatisticalAnalysisEnum.person.getKey(), "licenses", "expiryDate"); Long overNumber = stCommonService.getNestedQueryStatisticCount(overdueQuery, StatisticalAnalysisEnum.person.getKey(), "licenses", "expiryDate", tzsCommonService.overdue);
BoolQueryBuilder nearQuery = new BoolQueryBuilder(); BoolQueryBuilder nearQuery = new BoolQueryBuilder();
nearQuery.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode)); statisticalAnalysisService.personOrgCodeBoolMust(orgCode, nearQuery, StatisticalAnalysisEnum.person.getCode());
tstCommonService.buildExpiryDateQueryBuilder(nearQuery, "near", "licenses", "licenses.expiryDate"); Long nearNumber = stCommonService.getNestedQueryStatisticCount(nearQuery, StatisticalAnalysisEnum.person.getKey(), "licenses", "expiryDate", tzsCommonService.near);
Long nearNumber = stCommonService.getNestedQueryStatisticCount(nearQuery, StatisticalAnalysisEnum.person.getKey(), "licenses", "expiryDate");
dataMap.put(IssueTypeEnum.LICENSE_OVERDUE_PERSON.getName(), overNumber); dataMap.put(IssueTypeEnum.LICENSE_OVERDUE_PERSON.getName(), overNumber);
dataMap.put(IssueTypeEnum.LICENSE_EXPIRY_PERSON.getName(), nearNumber); dataMap.put(IssueTypeEnum.LICENSE_EXPIRY_PERSON.getName(), nearNumber);
} }
......
...@@ -403,7 +403,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -403,7 +403,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return result; return result;
} }
private void personOrgCodeBoolMust(String orgCode, BoolQueryBuilder boolMust, String type) { public void personOrgCodeBoolMust(String orgCode, BoolQueryBuilder boolMust, String type) {
String superviseOrgCodeKey = type.equals(StatisticalAnalysisEnum.person.getCode()) ? "superviseOrgCode" : "superviseOrgCode.keyword"; String superviseOrgCodeKey = type.equals(StatisticalAnalysisEnum.person.getCode()) ? "superviseOrgCode" : "superviseOrgCode.keyword";
String officeRegion = commonMapper.getCompanyCodeByOrgCode(orgCode); String officeRegion = commonMapper.getCompanyCodeByOrgCode(orgCode);
BoolQueryBuilder queryBuilder1 = QueryBuilders.boolQuery(); BoolQueryBuilder queryBuilder1 = QueryBuilders.boolQuery();
......
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto; ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum; import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.common.api.enums.StatisticalAnalysisEnum; import com.yeejoin.amos.boot.module.common.api.enums.StatisticalAnalysisEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.TZSCommonServiceImpl;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum; import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CommonBaseMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.CommonBaseMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
...@@ -23,6 +24,7 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -23,6 +24,7 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
...@@ -30,6 +32,8 @@ import org.elasticsearch.client.RestHighLevelClient; ...@@ -30,6 +32,8 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.CountRequest; import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse; import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.NestedQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.filter.Filter; import org.elasticsearch.search.aggregations.bucket.filter.Filter;
...@@ -44,18 +48,24 @@ import org.springframework.util.ObjectUtils; ...@@ -44,18 +48,24 @@ import org.springframework.util.ObjectUtils;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.elasticsearch.index.query.QueryBuilders.existsQuery;
/** /**
* @author Administrator * @author Administrator
*/ */
@Service @Service
public class StCommonServiceImpl { public class StCommonServiceImpl {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
/** /**
* 气瓶设备类别 * 气瓶设备类别
*/ */
...@@ -71,6 +81,8 @@ public class StCommonServiceImpl { ...@@ -71,6 +81,8 @@ public class StCommonServiceImpl {
private RestHighLevelClient restHighLevelClient; private RestHighLevelClient restHighLevelClient;
private TZSCommonServiceImpl tzsCommonService;
private EquipTechParamPipelineMapper techParamsPipelineMapper; private EquipTechParamPipelineMapper techParamsPipelineMapper;
private EquipmentCategoryMapper equipmentCategoryMapper; private EquipmentCategoryMapper equipmentCategoryMapper;
...@@ -85,12 +97,18 @@ public class StCommonServiceImpl { ...@@ -85,12 +97,18 @@ public class StCommonServiceImpl {
private static List<EquipmentCategoryDto> equipmentCategoryDtos; private static List<EquipmentCategoryDto> equipmentCategoryDtos;
public StCommonServiceImpl(CommonBaseMapper commonMapper, RestHighLevelClient restHighLevelClient, EquipTechParamPipelineMapper techParamsPipelineMapper, EquipmentCategoryMapper equipmentCategoryMapper, ZLStatisticsMapper zlStatisticsMapper) { public StCommonServiceImpl(CommonBaseMapper commonMapper,
RestHighLevelClient restHighLevelClient,
EquipTechParamPipelineMapper techParamsPipelineMapper,
EquipmentCategoryMapper equipmentCategoryMapper,
ZLStatisticsMapper zlStatisticsMapper,
TZSCommonServiceImpl tzsCommonService) {
this.commonMapper = commonMapper; this.commonMapper = commonMapper;
this.restHighLevelClient = restHighLevelClient; this.restHighLevelClient = restHighLevelClient;
this.techParamsPipelineMapper = techParamsPipelineMapper; this.techParamsPipelineMapper = techParamsPipelineMapper;
this.equipmentCategoryMapper = equipmentCategoryMapper; this.equipmentCategoryMapper = equipmentCategoryMapper;
this.zlStatisticsMapper = zlStatisticsMapper; this.zlStatisticsMapper = zlStatisticsMapper;
this.tzsCommonService = tzsCommonService;
} }
public static Map<String, String> getRegionCodeOrgCodeMap() { public static Map<String, String> getRegionCodeOrgCodeMap() {
...@@ -338,16 +356,27 @@ public class StCommonServiceImpl { ...@@ -338,16 +356,27 @@ public class StCommonServiceImpl {
} }
public Long getNestedQueryStatisticCount(BoolQueryBuilder builder, String index, String nestedFiled, String filterFiled) { public Long getNestedQueryStatisticCount(BoolQueryBuilder builder, String index, String nestedFiled, String filterFiled, String type) {
SearchRequest searchRequest = new SearchRequest(index); SearchRequest searchRequest = new SearchRequest(index);
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
// 构建嵌套聚合 BoolQueryBuilder notNeedLicensesQueryBuilder = tzsCommonService.getNotLicencesBuilderWithPerson();
NestedQueryBuilder nestedQuery = QueryBuilders.nestedQuery(
nestedFiled,
existsQuery(nestedFiled + "." + "certNo"),
ScoreMode.None
);
builder.must(notNeedLicensesQueryBuilder);
builder.must(nestedQuery);
// 根据类型动态获取日期范围查询
QueryBuilder dateRangeQuery = getRangeDateByType(nestedFiled, filterFiled, type);
NestedAggregationBuilder nestedAgg = AggregationBuilders.nested(nestedFiled, nestedFiled) NestedAggregationBuilder nestedAgg = AggregationBuilders.nested(nestedFiled, nestedFiled)
.subAggregation( .subAggregation(
AggregationBuilders.filter(filterFiled + "_count", builder) AggregationBuilders.filter(filterFiled + "_count", dateRangeQuery)
); );
sourceBuilder.aggregation(nestedAgg); sourceBuilder.aggregation(nestedAgg);
sourceBuilder.size(0); // 只要聚合结果,不要文档 sourceBuilder.size(0); // 只要聚合结果,不要文档
sourceBuilder.query(builder);
searchRequest.source(sourceBuilder); searchRequest.source(sourceBuilder);
long count = 0; long count = 0;
try { try {
...@@ -362,6 +391,19 @@ public class StCommonServiceImpl { ...@@ -362,6 +391,19 @@ public class StCommonServiceImpl {
return count; return count;
} }
private QueryBuilder getRangeDateByType(String nestedFiled, String filterFiled, String type) {
QueryBuilder dateRangeQuery = null;
if (tzsCommonService.overdue.equals(type)) {
dateRangeQuery = QueryBuilders.rangeQuery(nestedFiled + "." + filterFiled)
.lt(LocalDate.now().format(formatter));
} else if (tzsCommonService.near.equals(type)) {
dateRangeQuery = QueryBuilders.rangeQuery(nestedFiled + "." + filterFiled)
.gte(LocalDate.now().format(formatter))
.lte(LocalDate.now().plusDays(30).format(formatter));
}
return dateRangeQuery;
}
/** /**
* 统计已赋码设备数量 * 统计已赋码设备数量
* @param orgCode * @param orgCode
......
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