Commit b882406d authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register_test' into develop_tzs_bugfix

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
parents ab861d05 92e355d9
......@@ -662,6 +662,9 @@ public class DateUtils {
}
public static void main(String[] args) throws Exception {
System.out.println(DateUtils.convertDateToString(new Date(), DateUtils.CHN_DATE_PATTERN));
/*System.out.println(dateTimeToDate(new Date()));
System.out.println(dateParse("2017-02-04 14:58:20", null));
System.out.println(dateTimeToDateStringIfTimeEndZero(new Date()));
......
......@@ -14,6 +14,8 @@ import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import com.yeejoin.amos.feign.privilege.util.AesUtil;
import com.yeejoin.amos.openapi.enums.SSOLoginStatusEnum;
import com.yeejoin.amos.openapi.enums.TaAccessConfigBizeEnum;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -32,12 +34,16 @@ import java.util.Map;
@Service
public class SSOServiceImpl {
private static final Logger logger = LogManager.getLogger(SSOServiceImpl.class);
@Autowired
private SSOAccountRelationServiceImpl ssoAccountRelationService;
@Autowired
AmosRequestContext amosRequestContext;
public final String ERROR_MESSAGE = "读取服务配置异常";
public Map<String, String> getPlatformUserInfo(String portalCode) {
// 获取统一门户accessToken
String accessToken = getPortalAccessToken(portalCode);
......@@ -52,26 +58,30 @@ public class SSOServiceImpl {
String userPhoneNumber = userInfo.getString("phone_number");
String userId = userInfo.getString("id");
SSOAccountRelation ssoAccountRelation = ssoAccountRelationService.lambdaQuery().eq(SSOAccountRelation::getPortalUserId, userId).one();
if (ValidationUtil.isEmpty(ssoAccountRelation)) {
// 如果用户不存在,则创建用户
ssoAccountRelation = new SSOAccountRelation();
ssoAccountRelation.setPortalUserId(userId);
ssoAccountRelation.setPortalUserPhone(userPhoneNumber);
ssoAccountRelation.setLoginStatus(SSOLoginStatusEnum.FAILED.getCode());
ssoAccountRelation.setCreateDate(new Date());
ssoAccountRelationService.save(ssoAccountRelation);
return null;
}
RequestContext.setProduct(amosRequestContext.getProduct());
RequestContext.setAppKey(amosRequestContext.getAppKey());
RequestContext.setToken(amosRequestContext.getToken());
// 1.查询监管平台用户信息
Page<AgencyUserModel> agencyUserModelList = FeignUtil.remoteCall(() -> Privilege.agencyUserClient.queryForPage(null, null, userPhoneNumber, null, 1, 100));
if (ValidationUtil.isEmpty(agencyUserModelList) || agencyUserModelList.getTotal() == 0) {
if (ValidationUtil.isEmpty(ssoAccountRelation)) {
// 如果绑定用户关系不存在,则创建
ssoAccountRelation = new SSOAccountRelation();
ssoAccountRelation.setPortalUserId(userId);
ssoAccountRelation.setPortalUserPhone(userPhoneNumber);
ssoAccountRelation.setCreateDate(new Date());
}
ssoAccountRelation.setLoginStatus(SSOLoginStatusEnum.FAILED.getCode());
ssoAccountRelationService.updateById(ssoAccountRelation);
ssoAccountRelationService.saveOrUpdate(ssoAccountRelation);
return null;
} else {
if (ValidationUtil.isEmpty(ssoAccountRelation)) {
// 如果绑定用户关系不存在,则创建
ssoAccountRelation = new SSOAccountRelation();
ssoAccountRelation.setPortalUserId(userId);
ssoAccountRelation.setPortalUserPhone(userPhoneNumber);
ssoAccountRelation.setCreateDate(new Date());
}
ssoAccountRelation.setLoginStatus(SSOLoginStatusEnum.SUCCESS.getCode());
// 2.登录监管平台
Map<String, String> agencyUserModel = (Map<String, String>) agencyUserModelList.getRecords().get(0);
......@@ -83,7 +93,7 @@ public class SSOServiceImpl {
if (loginResult.getStatus() != 200) {
return null;
}
ssoAccountRelationService.updateById(ssoAccountRelation);
ssoAccountRelationService.saveOrUpdate(ssoAccountRelation);
String amosUserId = loginResult.getResult().get("userId");
String amosToken = loginResult.getResult().get("token");
// 3.为用户授权应用
......
......@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity {
*/
@TableField("amos_user_id")
private String amosUserId;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
}
......@@ -857,7 +857,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
String number = DateUtils.stampToDate(SystemClock.now(), "yyyyMMddHHmmss");
workOrderNumber = number + seq;
} finally {
lock.unlock();
if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
return workOrderNumber;
}
......
......@@ -13,6 +13,7 @@ public enum JYJCBusinessTypeEnum {
GZJDJY("GZJDJY","改造监督检验"),
WXJDJY("WXJDJY","维修监督检验"),
ZZJDJY("ZZJDJY","制造监督检验"),
DTJC("DTJC","电梯检测");
......@@ -43,5 +44,12 @@ public enum JYJCBusinessTypeEnum {
}
return list;
}
public static JYJCBusinessTypeEnum getNameByCode(String code){
for (JYJCBusinessTypeEnum value : JYJCBusinessTypeEnum.values()) {
if (value.getCode().equals(code)){
return value;
}
}
return null;
}
}
......@@ -94,4 +94,12 @@ public enum JYJCResultEnum {
return searchMap;
}
public static JYJCResultEnum getNameByCode(String code){
for (JYJCResultEnum value : JYJCResultEnum.values()) {
if (value.getCode().equals(code)){
return value;
}
}
return null;
}
}
......@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity {
*/
@TableField("amos_user_id")
private String amosUserId;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
}
......@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity {
*/
@TableField("amos_user_id")
private String amosUserId;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
}
......@@ -165,124 +165,128 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
@DateTimeFormat("yyyy-MM-dd")
private String inspectDate;
@ApiModelProperty(value = "检验报告编号")
@ExcelProperty(value = "检验报告编号", index = 28)
private String inspectReportNo;
//技术参数
@ExcelProperty(value = "额定质量(kg)", index = 28)
@ExcelProperty(value = "额定质量(kg)", index = 29)
@ApiModelProperty(value = "额定质量(kg)")
private String ratedQuality;
@ExcelProperty(value = "使用环境温度(℃)", index = 29)
@ExcelProperty(value = "使用环境温度(℃)", index = 30)
@ApiModelProperty(value = "使用环境温度(℃)")
private String ambientTemperature;
@ExcelProperty(value = "单瓶容积(m3)", index = 30)
@ExcelProperty(value = "单瓶容积(m3)", index = 31)
@ApiModelProperty(value = "单瓶容积(m3)")
@NotBlank(message = "单瓶容积(m3)不能为空")
private String singleBottleVolume;
@ExcelProperty(value = "型号", index = 31)
@ExcelProperty(value = "型号", index = 32)
@ApiModelProperty(value = "型号")
private String modelNumber;
@ExcelProperty(value = "充装介质", index = 32)
@ExcelProperty(value = "充装介质", index = 33)
@ApiModelProperty(value = "充装介质")
@NotBlank(message = "充装介质不能为空")
private String chargingMedium;
@ExcelProperty(value = "规格", index = 33)
@ExcelProperty(value = "规格", index = 34)
@ApiModelProperty(value = "规格")
private String specification;
@ExcelProperty(value = "外径", index = 34)
@ExcelProperty(value = "外径", index = 35)
@ApiModelProperty(value = "外径")
private String outsideDiameter;
@ExcelProperty(value = "壁厚", index = 35)
@ExcelProperty(value = "壁厚", index = 36)
@ApiModelProperty(value = "壁厚")
private String wallThickness;
@ExcelProperty(value = "长度", index = 36)
@ExcelProperty(value = "长度", index = 37)
@ApiModelProperty(value = "长度")
private String length;
@ExcelProperty(value = "公称工作压力(MPa)", index = 37)
@ExcelProperty(value = "公称工作压力(MPa)", index = 38)
@ApiModelProperty(value = "公称工作压力(MPa)")
@NotBlank(message = "公称工作压力(MPa)不能为空")
private String nominalWorkingPressure;
@ExcelProperty(value = "材料(管路)", index = 38)
@ExcelProperty(value = "材料(管路)", index = 39)
@ApiModelProperty(value = "材料(管路)")
private String piping;
@ExcelProperty(value = "无损检测方法(气瓶)", index = 39, converter = NondestructConverter.class)
@ExcelProperty(value = "无损检测方法(气瓶)", index = 40, converter = NondestructConverter.class)
@ApiModelProperty(value = "无损检测方法(气瓶)")
private String qpLossless;//5988
@ExcelProperty(value = "材料(瓶体)", index = 40)
@ExcelProperty(value = "材料(瓶体)", index = 41)
@ApiModelProperty(value = "材料(瓶体)")
private String bottleBody;
@ExcelProperty(value = "材料(端塞)", index = 41)
@ExcelProperty(value = "材料(端塞)", index = 42)
@ApiModelProperty(value = "材料(端塞)")
private String endPlug;
@ExcelProperty(value = "无损检测比例(管路)(%)", index = 42)
@ExcelProperty(value = "无损检测比例(管路)(%)", index = 43)
@ApiModelProperty(value = "无损检测比例(管路)(%)")
private String glRatio;
@ExcelProperty(value = "无损检测比例(气瓶)(%)", index = 43)
@ExcelProperty(value = "无损检测比例(气瓶)(%)", index = 44)
@ApiModelProperty(value = "无损检测比例(气瓶)(%)")
private String qpRatio;
@ExcelProperty(value = "无损检测方法(管路)", index = 44, converter = NondestructConverter.class)
@ExcelProperty(value = "无损检测方法(管路)", index = 45, converter = NondestructConverter.class)
@ApiModelProperty(value = "无损检测方法(管路)")
private String glLossless;
@ExcelProperty(value = "耐压实验压力(气瓶)(Mpa)", index = 45)
@ExcelProperty(value = "耐压实验压力(气瓶)(Mpa)", index = 46)
@ApiModelProperty(value = "耐压实验压力(气瓶)(Mpa)")
private String qpPressure;
@ExcelProperty(value = "耐压实验压力(管路)(Mpa)", index = 46)
@ExcelProperty(value = "耐压实验压力(管路)(Mpa)", index = 47)
@ApiModelProperty(value = "耐压实验压力(管路)(Mpa)")
private String glPressure;
@ExcelProperty(value = "气密性试验压力(气瓶)(Mpa)", index = 47)
@ExcelProperty(value = "气密性试验压力(气瓶)(Mpa)", index = 48)
@ApiModelProperty(value = "气密性试验压力(气瓶)(Mpa)")
private String qpAirTightness;
@ExcelProperty(value = "气体置换后压力(MPa)", index = 48)
@ExcelProperty(value = "气体置换后压力(MPa)", index = 49)
@ApiModelProperty(value = "气体置换后压力(MPa)")
private String displacementPressure;
@ExcelProperty(value = "热处理方式", index = 49)
@ExcelProperty(value = "热处理方式", index = 50)
@ApiModelProperty(value = "热处理方式")
private String heatTreatmentMethod;
@ExcelProperty(value = "气密性实验压力(管路)(MPa)", index = 50)
@ExcelProperty(value = "气密性实验压力(管路)(MPa)", index = 51)
@ApiModelProperty(value = "气密性实验压力(管路)(MPa)")
private String glAirTightness;
@ExcelProperty(value = "气瓶安装位置", index = 51)
@ExcelProperty(value = "气瓶安装位置", index = 52)
@ApiModelProperty(value = "气瓶安装位置")
private String installationPosition;
@ExcelProperty(value = "瓶体内含氧量(%)", index = 52)
@ExcelProperty(value = "瓶体内含氧量(%)", index = 53)
@ApiModelProperty(value = "瓶体内含氧量(%)")
private String oxygen;
@ExcelProperty(value = "热处理温度(℃)", index = 53)
@ExcelProperty(value = "热处理温度(℃)", index = 54)
@ApiModelProperty(value = "热处理温度(℃)")
private String qpHeatTreatmentTemperature;
/**
* 信息化管理字段-信息化管理情况
*/
@ExcelProperty(value = "信息化管理情况",index = 54, converter = InformationSituationConverter.class)
@ExcelProperty(value = "信息化管理情况", index = 55, converter = InformationSituationConverter.class)
private String informationSituation;
/**
* 信息化管理字段-二维码或者电子标签编号
*/
@ExcelProperty(value = "二维码或者电子标签编号",index = 55)
@ExcelProperty(value = "二维码或者电子标签编号", index = 56)
private String informationManageCode;
@ExcelIgnore
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -183,4 +184,13 @@ public class JgUseRegistrationDto extends BaseDto {
@ApiModelProperty(value = " 监察处置机构代码")
private String supervisionOrgCode;
@ApiModelProperty(value = "属地监管机构代码")
private String orgBranchCode;
@ApiModelProperty("使用登记表url")
private String useRegistrationFormUrl;
@ApiModelProperty("使用登记表附件")
private String useRegistrationFormFile;
}
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -250,4 +251,13 @@ public class JgVehicleInformationDto extends BaseDto {
@ApiModelProperty(value = "作废原因")
private String cancelReason;
@ApiModelProperty("使用登记表url")
private String useRegistrationFormUrl;
@ApiModelProperty("使用登记表附件")
private String useRegistrationFormFile;
@ApiModelProperty("投入使用日期")
private String useDate;
}
......@@ -161,12 +161,6 @@ public class JgEquipTransfer extends BaseEntity {
private String supervisoryCode;
/**
* 设备种类
*/
@TableField(exist = false)
private String equList;
/**
* 设备类别
*/
@TableField(exist = false)
......@@ -222,4 +216,16 @@ public class JgEquipTransfer extends BaseEntity {
@TableField(value = "transfer_to_user_ids")
private String transferToUserIds;
/**
* 设备种类
*/
@TableField(value = "equ_list")
private String equList;
/**
* 设备种类Code
*/
@TableField(value = "equ_list_code")
private String equListCode;
}
......@@ -274,4 +274,15 @@ public class JgUseRegistration extends BaseEntity {
@TableField("origin_project_contraption_ids")
private String originProjectContraptionIds;
/**
* 使用登记表url
*/
@TableField("use_registration_form_url")
private String useRegistrationFormUrl;
/**
* 使用登记表附件
*/
@TableField("use_registration_form_file")
private String useRegistrationFormFile;
}
......@@ -429,4 +429,22 @@ public class JgVehicleInformation extends BaseEntity {
*/
@TableField("cancel_reason")
private String cancelReason;
/**
* 使用登记表url
*/
@TableField("use_registration_form_url")
private String useRegistrationFormUrl;
/**
* 使用登记表附件
*/
@TableField("use_registration_form_file")
private String useRegistrationFormFile;
/**
* 投入使用日期
*/
@TableField("use_date")
private String useDate;
}
package com.yeejoin.amos.boot.module.jg.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum RegistrationTypeEnum {
新设备首次启用("新设备首次启用","DJ_SY"),
历史无证设备登记("历史无证设备登记","SP_TT");
private String name;
private String code;
public static String getNameByType(String code) {
String name = null;
for (RegistrationTypeEnum enumOne : RegistrationTypeEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
}
......@@ -4,6 +4,7 @@ import lombok.Getter;
/**
* 业务类型枚举
* 枚举code需同字典表中问题类型(type=ISSUE_TYPE)code保持一致
*
* @author Administrator
*/
......@@ -17,7 +18,8 @@ public enum SafetyProblemTypeEnum {
JYBJ("21", "检验报检", "设备报检", "safetyProblemTracing/jy/bj", null),
WBCQ("1", "维保超期", "设备维保超期", "safetyProblemTracing/wb/cq", "outOfMaintenanceRecords"),
WBBA("11", "维保合同备案", "设备维保合同备案", "safetyProblemTracing/wb/ba", null),
XKCQ("3", "许可超期", "企业许可超期", "safetyProblemTracing/xk/cq", null);
XKCQ("3", "许可超期", "企业许可超期", "safetyProblemTracing/xk/cq", null),
ZZCQ("9", "资质超期", "人员资质超期", "safetyProblemTracing/zz/cq", null);
private final String code;
......
......@@ -146,7 +146,10 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
* 查询许可超期的企业
* */
List<Map<String, Object>> queryOutOfQualificationRecord();
/**
* 查询资质超期的证书
**/
List<Map<String, Object>> queryOutOfCertificationRecord();
/**
* 大屏业务全过程统计已经完成的单据
*
......@@ -233,5 +236,7 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
void updateEnterpriseSafetyStatus(@Param("useUnitCodeList") Set<String> useUnitCodeList);
List<EquipmentClassifyDto> getEquClassifyByCode(@Param("parentCode") String parentCode);
}
......@@ -92,6 +92,8 @@ public interface JgUseRegistrationMapper extends BaseMapper<JgUseRegistration> {
List<Map<String,Object>> getUseRegisterCount(@Param("orgCode")String orgCode);
List<Map<String,Object>> getUseRegisterCountTotal();
List<Map<String, Object>> getElevatorModeList(@Param("equIds") List<String> equIds);
List<Map<String, Object>> getCylinderInfoList(@Param("records") List<String> records);
......
......@@ -34,4 +34,6 @@ public interface SafetyProblemTracingMapper extends BaseMapper<SafetyProblemTrac
List<Map<String, Object>> countEquOverdue(@Param("typeList") List<String> typeList,@Param("orgCode") String orgCode);
List<String> getSourceId(@Param("orgCode") String orgCode, @Param("typeList") List<String> typeList);
Page<Map<String, Object>> queryUserListProblemById(Page<Map<String, Object>> page, String problemId);
}
......@@ -269,4 +269,16 @@ public class JgVehicleInformationVo implements Serializable {
@ApiModelProperty(value = "是否有权限")
private Boolean havingPermission;
@ApiModelProperty("使用登记表url")
private String useRegistrationFormUrl;
@ApiModelProperty("使用登记表附件")
private JSONArray useRegistrationFormFile;
@ApiModelProperty(value = "创建人名称")
private String createUserName;
@ApiModelProperty(value = "投用日期")
private String useDate;
}
......@@ -2561,7 +2561,7 @@
ei.unit_type unitType,
ei.supervise_org_code superviseOrgCode,
ei.supervise_org_name superviseOrgName,
ul.sequence_nbr licenceSeq,
ul.sequence_nbr problemSourceId,
ul.cert_no certNo,
ul.expiry_date expiryDate,
ul.item_code itemCode,
......@@ -2618,4 +2618,24 @@
)
SELECT * FROM category_tree ORDER BY level;
</select>
<select id="queryOutOfCertificationRecord" resultType="java.util.Map">
SELECT
ei.use_unit_code useUnitCode,
ei.use_unit useUnit,
ei.unit_type unitType,
ei.supervise_org_code superviseOrgCode,
ei.supervise_org_name superviseOrgName,
tup.sequence_nbr problemSourceId,
tup.cert_no certNo,
tup.expiry_date expiryDate,
tui.name userName,
tui.sequence_nbr userSeq
FROM
tzs_user_permission tup
LEFT JOIN tzs_user_info tui ON tup.user_seq = tui.sequence_nbr
LEFT JOIN tz_base_enterprise_info ei ON ei.use_unit_code = tui.unit_code
WHERE
tup.expiry_date <![CDATA[<]]> CURRENT_DATE AND tup.permission_post IN ('permissionData66151', 'permissionData66152', 'permissionData6552');
</select>
</mapper>
......@@ -73,6 +73,16 @@
<if test="param.useUnitCreditCode != null and param.useUnitCreditCode != ''">
AND isn.use_unit_credit_code = #{param.useUnitCreditCode}
</if>
<if test="param.orgBranchCode != null and param.orgBranchCode != ''">
<choose>
<when test="client == 'jgLook'">
AND isn.org_branch_code LIKE concat(#{param.orgBranchCode},'%')
</when>
<otherwise>
AND isn.org_branch_code= #{param.orgBranchCode}
</otherwise>
</choose>
</if>
</if>
<if test="type == 'supervision'">
<choose>
......@@ -236,7 +246,7 @@
ri."EQU_CODE_TYPE" equCodeType,
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
pp."DEVICE_NAME" deviceName,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type in ('GYGDHIS','8100','8200','8300')) deviceLevel,
pp."PIPE_NAME" pipeName,
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
......
......@@ -55,6 +55,7 @@
ur.audit_status as auditStatus,
date_format(ur.reg_date,'%Y-%m-%d') as regDate,
ur.use_unit_name as useUnitName,
ur.supervision_org_code as supervisionOrgCode,
ur.status,
ur.receive_org_name as receiveOrgName,
ur.use_address as place,
......@@ -138,6 +139,7 @@
ur.audit_status as auditStatus,
date_format(ur.reg_date,'%Y-%m-%d') as regDate,
ur.use_unit_name as useUnitName,
ur.supervision_org_code as supervisionOrgCode,
ur.status,
ur.receive_org_name as receiveOrgName,
ur.use_address as place,
......@@ -263,6 +265,16 @@
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
AND use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
<choose>
<when test="client == 'jgLook'">
and supervisionOrgCode like concat(#{dto.orgBranchCode},'%')
</when>
<otherwise>
and supervisionOrgCode = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
......@@ -334,6 +346,16 @@
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
<choose>
<when test="client == 'jgLook'">
and supervisionOrgCode like concat(#{dto.orgBranchCode},'%')
</when>
<otherwise>
and supervisionOrgCode = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if test="dto.dataType == 'supervision' ">
<choose>
<when test="client == 'jgAudit'">
......@@ -500,6 +522,7 @@
NEXT_INSPECT_DATE as nextInspectDate,
INSPECT_REPORT as inspectReport,
INSPECT_ORG_CODE as inspectOrgCode,
INSPECT_REPORT_NO as inspectReportNo,
SEQUENCE_NBR as jySeq
from idx_biz_jg_inspection_detection_info
where
......@@ -582,7 +605,8 @@
INSPECT_DATE as inspectDate,
INSPECT_STAFF as inspectStaff,
NEXT_INSPECT_DATE as nextInspectDate,
INSPECT_REPORT as inspectReport
INSPECT_REPORT as inspectReport,
INSPECT_REPORT_NO as inspectReportNo
FROM "idx_biz_jg_inspection_detection_info"
where
RECORD = #{id}
......@@ -780,7 +804,7 @@
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
ri."USE_ORG_CODE" useOrgCode,
pp."DEVICE_NAME" deviceName,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type in ('GYGDHIS','8100','8200','8300')) deviceLevel,
pp."PIPE_NAME" pipeName,
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
......@@ -1274,4 +1298,20 @@
)
</update>
<select id="getUseRegisterCountTotal" resultType="java.util.Map">
SELECT
date_format(A.audit_pass_date, '%Y-%m') AS time,
A.supervision_org_code AS supervisionOrgCode
FROM
"tzs_jg_use_registration_eq" ae
JOIN tzs_jg_use_registration A ON A.sequence_nbr = ae.equip_transfer_id
JOIN "idx_biz_jg_use_info" u ON ae.equ_id = u."RECORD"
JOIN idx_biz_jg_register_info ri ON u."RECORD" = ri."RECORD"
WHERE
ae.equ_id = u."RECORD"
AND ri.EQU_CATEGORY = '2300'
AND A.status = '已完成'
AND A.is_delete = 0
AND A.supervision_org_code is not null
</select>
</mapper>
......@@ -35,19 +35,21 @@
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and tjvi.use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.dataType == 'supervision' ">
<choose>
<when test="client == 'jgAudit'">
AND tjvi.receive_company_code = #{dto.useUnitCreditCode}
</when>
<otherwise>
and tjvi.org_branch_code like concat(#{dto.orgBranchCode}, '%')
</otherwise>
</choose>
<if test="dto.dataType == 'supervision' and client == 'jgAudit' ">
AND tjvi.receive_company_code = #{dto.useUnitCreditCode}
AND tjvi.status <![CDATA[<>]]> '使用单位待提交'
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
and tjvi.org_branch_code = #{dto.orgBranchCode}
</if>
</if>
<if test="dto.dataType == 'company' ">
<if test="dto.dataType == 'supervision' and client != 'jgAudit' ">
AND tjvi.org_branch_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
</if>
<if test="dto.dataType == 'company'">
and tjvi.use_unit_credit_code = #{dto.useUnitCreditCode}
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
and tjvi.org_branch_code = #{dto.orgBranchCode}
</if>
</if>
</where>
order by
......@@ -98,7 +100,8 @@
tjvi.gas_num as gasNum,
date_format(tjvi.create_date,'%Y-%m-%d') as createDate,
tjvi.cancel_reason as cancelReason,
tjvi.reg_type as regType
tjvi.reg_type as regType,
tjvi.org_branch_code as orgBranchCode
from tzs_jg_vehicle_information tjvi
</sql>
......
......@@ -55,7 +55,7 @@
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
</if>
<if test="problemModel.principalUnitType != null and problemModel.principalUnitType != ''">
and spt.principal_unit_type = #{problemModel.principalUnitType}
and spt.principal_unit_type = like CONCAT('%', #{problemModel.principalUnitType}, '%')
</if>
<if test="problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''">
and spt.problem_status_code = #{problemModel.hiddenDangersLevel}
......@@ -102,6 +102,27 @@
<select id="queryPrincipalUnitByProblemId" resultType="java.util.Map">
SELECT * FROM (
SELECT
'1' sourceTypeCode,
spt.sequence_nbr problemSeq,
ei.sequence_nbr sequenceNbr,
ei.use_unit unitName,
ei.use_unit_code useUnitCode,
ei.unit_type unitType,
ei.governing_body governingBody,
ei.use_contact useContact,
ei.contact_phone contactPhone,
ei.status,
case when ei.status = '0' then '异常'
else '正常' end problemStatusName,
case when ei.status = '0' then 'red'
else 'green' end problemStatusColor
FROM
tzs_safety_problem_tracing spt
LEFT JOIN tz_base_enterprise_info ei on ei.use_unit_code = spt.principal_unit_code
WHERE
spt.sequence_nbr = #{problemId}
UNION
SELECT
'2' sourceTypeCode,
spt.sequence_nbr problemSeq,
ei.sequence_nbr sequenceNbr,
......@@ -240,4 +261,23 @@
and source_type_code = '3'
</select>
<select id="queryUserListProblemById" resultType="java.util.Map">
SELECT
tui.sequence_nbr sequenceNbr,
tui.name,
tui.certificate_num certificateNum,
tui.phone,
tui.post_name postName,
case when tui.qr_code_state = '0' then '异常'
else '正常' end problemStatusName,
case when tui.qr_code_state = '0' then 'red'
else 'green' end problemStatusColor
FROM
tzs_user_info tui
LEFT JOIN tzs_user_permission tup on tup.user_seq = tui.sequence_nbr
LEFT JOIN tzs_safety_problem_tracing tspt on tspt.source_id = tup.sequence_nbr
WHERE
tspt.is_delete = '0' and tspt.sequence_nbr = #{problemId}
</select>
</mapper>
......@@ -198,6 +198,33 @@ public class CommonController extends BaseController {
}
/**
* 设备管道品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentPipeType3ByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备管道品种", notes = "设备管道品种")
public ResponseModel<List<EquipmentCategoryDto>> equipmentPipeType3ByParentCode(@RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentPipeType3ByParentCode(parentCode));
}
/**
* 设备分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassificationByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种")
public ResponseModel<List<EquipmentCategoryDto>> equipmentClassificationByParentCode(@RequestParam(value = "type") String type, @RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentClassificationByParentCode(type, parentCode));
}
/**
* 设备分类 去掉管道分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种
......@@ -211,6 +238,18 @@ public class CommonController extends BaseController {
}
/**
* 根据设备种类code获取设备类别
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassificationNoPipelineByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种")
public ResponseModel<List<EquipmentCategoryDto>> equipmentClassificationNoPipelineByParentCode(@RequestParam(value = "type") String type, @RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentClassificationNoPipelineByParentCode(type, parentCode));
}
/**
* 设备品种
*
* @param parentId 父级ID
......@@ -392,6 +431,19 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse(commonService.getCreatTree());
}
/**
* 获取当前登录人单位及以下管辖分局树
*
* @return result
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/loginUnitAndBelow/getCreatTree")
@ApiOperation(httpMethod = "GET", value = "获取当前登录人单位及以下管辖分局树", notes = "获取当前登录人单位及以下管辖分局树")
public ResponseModel<Object> loginUnitAndBelowGetTree() {
String orgCode = getSelectedOrgInfo().getCompany().getOrgCode();
return ResponseHelper.buildResponse(commonService.loginUnitAndBelowGetTree(orgCode));
}
/**
* 获取管辖分局树
......@@ -695,4 +747,27 @@ public class CommonController extends BaseController {
public ResponseModel<List<EquipmentClassifyDto>> getEquClassifyByCode(@RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.getEquClassifyByCode(parentCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "使用登记表生成", notes = "使用登记表生成")
@PostMapping(value = "/getRegistrationFormUrl")
public ResponseModel<Map<String,Object>> getRegistrationFormUrl(@RequestBody JSONObject map) {
JSONObject formData = JSONObject.parseObject(JSONObject.toJSONString(map.get("formData")));
String manageType = String.valueOf(map.get("manageType"));
ReginParams selectedOrgInfo = getSelectedOrgInfo();
formData.put("userName",selectedOrgInfo.getUserModel().getRealName());
return ResponseHelper.buildResponse(commonService.getRegistrationFormUrl(manageType, formData));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "pdf流生成", notes = "pdf流生成")
@PostMapping(value = "/getRegistrationFormStream")
public void getRegistrationFormStream(@RequestBody JSONObject map,HttpServletResponse response) {
JSONObject formData = JSONObject.parseObject(JSONObject.toJSONString(map.get("formData")));
String manageType = String.valueOf(map.get("manageType"));
ReginParams selectedOrgInfo = getSelectedOrgInfo();
formData.put("userName",selectedOrgInfo.getUserModel().getRealName());
commonService.getRegistrationFormStream(formData,manageType,response);
}
}
......@@ -5,10 +5,9 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiParam;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -147,4 +146,34 @@ public class DataHandlerController extends BaseController {
public ResponseModel<String> ordinaryGasCylinderWriteEquState() {
return ResponseHelper.buildResponse(dataHandlerService.ordinaryGasCylinderWriteEquState());
}
/**
* 使用登记、车用气瓶登记历史单据使用登记表生成
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "使用登记、车用气瓶登记历史单据使用登记表生成", notes = "使用登记、车用气瓶登记历史单据使用登记表生成")
@GetMapping(value = "/initFormUrl")
public ResponseModel<Boolean> initFormUrl() {
dataHandlerService.initFormUrl();
return ResponseHelper.buildResponse(Boolean.TRUE);
}
/**
* 同步设备信息到ES
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "同步设备信息到ES", notes = "同步设备信息到ES")
@PostMapping(value = "/synchronizeEqData2ES")
public ResponseModel<String> synchronizeEqData2ES(@ApiParam(value = "设备的record,多个设备使用英文逗号分割", required = true)
@RequestParam(value = "records") String records,
@ApiParam(value = "是否安改维单位,默认值'false'", required = true, defaultValue = "false")
@RequestParam(value = "isAgw", defaultValue = "false") Boolean isAgw,
@ApiParam(value = "是否纳管,默认值'true'", required = true, defaultValue = "true")
@RequestParam(value = "isIntoManagement", defaultValue = "true") Boolean isIntoManagement) {
StopWatch watch = new StopWatch();
watch.start();
dataHandlerService.synchronizeEqData2ES(records, isAgw, isIntoManagement);
watch.stop();
return ResponseHelper.buildResponse(String.format("同步成功,耗时:%s", watch.getTotalTimeSeconds()));
}
}
......@@ -144,7 +144,9 @@ public class JgVehicleInformationController extends BaseController {
dto.setDataType(BaseController.COMPANY_TYPE_COMPANY);
} else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
dto.setOrgBranchCode(info.getCompany().getOrgCode());
if(client.equals("jgLook")){
dto.setOrgBranchCode(dto.getOrgBranchCode() != null ? dto.getOrgBranchCode() : info.getCompany().getOrgCode());
}
}
Page<Map<String, Object>> list = jgVehicleInformationServiceImpl.getPageList(dto,sort, page, dto.getRoleIds(), client);
list.getRecords().forEach(x -> {
......
......@@ -181,6 +181,22 @@ public class SafetyProblemTracingController extends BaseController {
}
/**
* 根据问题ID及问题类型查询关联设备列表
*
* @param problemId 问题Id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "根据问题ID及问题类型查询关联人员列表", notes = "根据问题ID及问题类型查询关联人员列表")
@GetMapping(value = "/user/list")
public ResponseModel<Page<Map<String, Object>>> queryUserListProblemById(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size, @RequestParam(value = "sequenceNbr") String problemId) {
Page<Map<String, Object>> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(safetyProblemTracingServiceImpl.queryUserListProblemById(page, problemId));
}
/**
* 根据问题ID及问题类型查询关联企业
*
* @param problemId 问题Id
......@@ -236,7 +252,18 @@ public class SafetyProblemTracingController extends BaseController {
return ResponseHelper.buildResponse("success");
}
/**
* test3
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "生成人员资质超期数据", notes = "生成人员资质超期数据")
@GetMapping(value = "/gen/test4")
public ResponseModel<String> test4() {
safetyProblemTracingGenService.executePersonnalCertificationCheck();
return ResponseHelper.buildResponse("success");
}
/**
* update3 -- 修复
*
......
......@@ -30,6 +30,8 @@ public class SafetyProblemEventHandlerFactory {
return new JYBJEventHandler(safetyProblemTracingService, idxBizJgOtherInfoService, esEquipmentCategory);
} else if (topic.startsWith(SafetyProblemTypeEnum.XKCQ.getTopic())) {
return new XKCQEventHandler(safetyProblemTracingService);
}else if (topic.startsWith(SafetyProblemTypeEnum.ZZCQ.getTopic())) {
return new ZZCQEventHandler(safetyProblemTracingService);
} else {
// 其他策略类的创建
throw new IllegalArgumentException("Unsupported topic: " + topic);
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.handler;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemSourceTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent;
import com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler;
......@@ -38,6 +39,12 @@ public class XKCQEventHandler implements SafetyProblemEventHandler {
}
private void generateProblem(JSONArray jsonArray) {
jsonArray.forEach(item -> {
JSONObject problemObj = (JSONObject) item;
problemObj.put("sourceType", SafetyProblemSourceTypeEnum.UNIT.getName());
problemObj.put("sourceTypeCode", SafetyProblemSourceTypeEnum.UNIT.getCode());
problemObj.put("problemDesc", "证书编号:" + problemObj.get("certNo") + SafetyProblemTypeEnum.XKCQ.getName());
});
SafetyProblemTopicMessage.generateUnitProblem(jsonArray, SafetyProblemTypeEnum.XKCQ, safetyProblemTracingService);
}
}
......
package com.yeejoin.amos.boot.module.jg.biz.handler;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemSourceTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent;
import com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler;
import com.yeejoin.amos.boot.module.jg.biz.listener.SafetyProblemTopicMessage;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* ZZCQEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理人员资质超期安全问题事件。
*/
@Component
public class ZZCQEventHandler implements SafetyProblemEventHandler {
SafetyProblemTracingServiceImpl safetyProblemTracingService;
@Autowired
public ZZCQEventHandler(SafetyProblemTracingServiceImpl safetyProblemTracingService) {
this.safetyProblemTracingService = safetyProblemTracingService;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public void handle(SafetyProblemEvent event) {
// 此处为处理安全问题事件的逻辑代码
JSONArray jsonArray = JSONObject.parseArray(event.getMessage().toString());
generateProblem(jsonArray);
}
private void generateProblem(JSONArray jsonArray) {
jsonArray.forEach(item -> {
JSONObject problemObj = (JSONObject) item;
problemObj.put("sourceType", SafetyProblemSourceTypeEnum.PERSONNEL.getName());
problemObj.put("sourceTypeCode", SafetyProblemSourceTypeEnum.PERSONNEL.getCode());
problemObj.put("problemDesc", "证书编号:" + problemObj.getOrDefault("certNo", "") + SafetyProblemTypeEnum.ZZCQ.getName());
});
SafetyProblemTopicMessage.generatePersonnelProblem(jsonArray, SafetyProblemTypeEnum.ZZCQ, safetyProblemTracingService);
}
}
......@@ -151,6 +151,10 @@ public class SafetyProblemTopicMessage extends EmqxListener {
}
public static void generateUnitProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) {
generateProblem2(jsonArray, problemTypeEnum, safetyProblemTracingService);
}
private static void generateProblem2(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) {
if (jsonArray == null || problemTypeEnum == null) {
throw new IllegalArgumentException("jsonObject and problemTypeEnum must not be null.");
}
......@@ -163,10 +167,10 @@ public class SafetyProblemTopicMessage extends EmqxListener {
SafetyProblemTracing safetyProblemTracing = new SafetyProblemTracing();
safetyProblemTracing.setProblemType(problemTypeEnum.getName());
safetyProblemTracing.setProblemTypeCode(problemTypeEnum.getCode());
safetyProblemTracing.setProblemDesc(problemTypeEnum.getDesc() + "-" + json.getOrDefault("itemName", "") + "-" + json.getOrDefault("subItemName", ""));
safetyProblemTracing.setSourceType(SafetyProblemSourceTypeEnum.UNIT.getName());
safetyProblemTracing.setSourceTypeCode(SafetyProblemSourceTypeEnum.UNIT.getCode());
safetyProblemTracing.setSourceId(json.getOrDefault("licenceSeq", "").toString());
safetyProblemTracing.setProblemDesc(json.getString("problemDesc"));
safetyProblemTracing.setSourceType(json.getString("sourceType"));
safetyProblemTracing.setSourceTypeCode(json.getString("sourceTypeCode"));
safetyProblemTracing.setSourceId(json.getString("problemSourceId"));
safetyProblemTracing.setProblemTime(new Date());
safetyProblemTracing.setPrincipalUnit(json.getOrDefault("useUnit", "").toString());
safetyProblemTracing.setPrincipalUnitCode(json.getOrDefault("useUnitCode", "").toString());
......@@ -186,6 +190,10 @@ public class SafetyProblemTopicMessage extends EmqxListener {
.eq("problem_status_code", SafetyProblemStatusEnum.UNHANDLED.getCode()));}
}
public static void generatePersonnelProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) {
generateProblem2(jsonArray, problemTypeEnum, safetyProblemTracingService);
}
public String buildTopic(String topic) {
String topicPrefix = "$share/" + applicationName;
return String.format("%s/%s", topicPrefix, topic);
......
......@@ -80,6 +80,8 @@ public interface ICommonService {
List<LinkedHashMap> getCreatTree();
List<LinkedHashMap> loginUnitAndBelowGetTree(String orgCode);
List<LinkedHashMap> getCreatTreeByInstallation();
List<LinkedHashMap> getCreatTreeByInstallationTree();
......@@ -188,6 +190,10 @@ public interface ICommonService {
*/
List<EquipmentCategoryDto> equipmentClassification(String type);
List<EquipmentCategoryDto> equipmentPipeType3ByParentCode(String parentCode);
List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode);
/**
* 套打使用标志生成
*
......@@ -241,7 +247,13 @@ public interface ICommonService {
List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type);
List<EquipmentCategoryDto> equipmentClassificationNoPipelineByParentCode(String type, String parentCode);
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode);
Map<String, Object> getRegistrationFormUrl(String manageType, JSONObject formData);
void getRegistrationFormStream(JSONObject formData,String manageType,HttpServletResponse response);
}
......@@ -2586,6 +2586,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if(companyLevel.equals(BaseController.COMPANY_TYPE_SUPERVISION)){
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(company.getString("orgCode")) + "*"));
}
// 增加监管端查询, 查询规则看到本级及之下的设备
if(!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))){
boolMust.must(QueryBuilders.termQuery("ORG_BRANCH_CODE.keyword", map.getString("ORG_BRANCH_CODE")));
}
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageNumber - 1) * size);
......@@ -4259,6 +4263,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构
checkNotBlank(data.getInspectStaff(), "检测人员名称不能为空;", result);
checkNotBlank(data.getInspectDate(), "检测日期不能为空;", result);
checkNotBlank(data.getInspectReportNo(), "检验报告编号不能为空;", result);
checkDateFormatCorrect(data.getInspectDate(), "检测日期格式不正确;", result);
checkNotBlank(data.getSingleBottleVolume(), "单瓶容积不能为空;", result);
checkNotBlank(data.getChargingMedium(), "充装介质不能为空;", result);
......
......@@ -316,11 +316,15 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
*/
private void delRepeatUseEquipData(JgChangeRegistrationName notice) {
if (NOT_FLOWING_STATE.contains(notice.getAuditStatus())) {
LambdaQueryWrapper<JgChangeRegistrationNameEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgChangeRegistrationNameEq::getNameChangeRegistrationId, notice.getSequenceNbr());
List<JgChangeRegistrationNameEq> noticeEqList = jgChangeRegistrationNameEqMapper.selectList(queryWrapper);
noticeEqList.forEach(noticeEq -> EquipUsedCheckStrategyContext.getUsedStrategy(CHANGE_NAME_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getCertificateSeq()), notice.getUseUnitCreditCode())
final String creditCode = notice.getUseUnitCreditCode().contains("_")
? notice.getUseUnitCreditCode().substring(notice.getUseUnitCreditCode().indexOf("_") + 1)
: notice.getUseUnitCreditCode();
jgChangeRegistrationNameEqMapper.selectList(
new LambdaQueryWrapper<JgChangeRegistrationNameEq>()
.eq(JgChangeRegistrationNameEq::getNameChangeRegistrationId, notice.getSequenceNbr())
).forEach(noticeEq ->
EquipUsedCheckStrategyContext.getUsedStrategy(CHANGE_NAME_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getCertificateSeq()), creditCode)
);
}
}
......
......@@ -140,6 +140,7 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
JgEquipTransfer transfer = buildJgEquipTransfer(model, applyNo, reginParams, submitType, workflowResultList, i);
transfer.setSupervisoryCode(String.valueOf(obj.get("SUPERVISORY_CODE")));
transfer.setEquList(Objects.toString(obj.get("EQU_LIST"), ""));
transfer.setEquListCode(Objects.toString(obj.get("EQU_LIST_CODE"), ""));
transfer.setEquDefine(Objects.toString(obj.get("EQU_DEFINE"), ""));
transfer.setEquCategory(Objects.toString(obj.get("EQU_CATEGORY"), ""));
transfer.setProductName(Objects.toString(obj.get("PRODUCT_NAME"), ""));
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
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.entity.SafetyProblemTracing;
......@@ -11,7 +14,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
......@@ -54,15 +59,30 @@ public class SafetyProblemTracingGenServiceImpl{
@Autowired
TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
@Autowired
TzsUserInfoMapper tzsUserInfoMapper;
@Scheduled(cron = "0 0 1 * * ?")
@SchedulerLock(name = "executeSafetyProblemCheck", lockAtMostFor = "PT5H", lockAtLeastFor = "PT10M")
public void executeSafetyProblemCheck() {
executeMaintenanceCheck();
executeInspectionCheck();
executeEnterpriseQualificationCheck();
}
@Scheduled(cron = "0 0 1 * * ?")
@SchedulerLock(name = "executePersonnalCertification", lockAtMostFor = "PT5H", lockAtLeastFor = "PT10M")
public void executePersonnalCertification() {
executePersonnalCertificationCheck();
}
public void executePersonnalCertificationCheck() {
logger.info("开始人员资质超期检查");
List<Map<String, Object>> certificationRecords = commonMapper.queryOutOfCertificationRecord();
updateUserInfoAndSendMessage(certificationRecords);
logger.info("人员资质超期检查结束");
}
public void executeInspectionCheck() {
logger.info("开始检验检测超期检查");
// 查询当天检验超期的设备
......@@ -149,6 +169,18 @@ public class SafetyProblemTracingGenServiceImpl{
sendSafetyProblemMessage(mapList, SafetyProblemTypeEnum.XKCQ);
}
private void updateUserInfoAndSendMessage(List<Map<String, Object>> certificationRecords) {
Set<String> outOfUnitLicenseList = certificationRecords.stream().map(m -> m.get("userSeq").toString()).collect(Collectors.toSet());
if (!ValidationUtil.isEmpty(outOfUnitLicenseList)) {
LambdaUpdateWrapper<TzsUserInfo> up = new LambdaUpdateWrapper();
up.in(BaseEntity::getSequenceNbr,outOfUnitLicenseList);
up.set(TzsUserInfo::getQrCodeState,0);
tzsUserInfoMapper.update(null,up);
}
sendSafetyProblemMessage(certificationRecords, SafetyProblemTypeEnum.ZZCQ);
}
/**
* 发送安全问题
* @param mapList
......@@ -156,11 +188,13 @@ public class SafetyProblemTracingGenServiceImpl{
*/
private void sendSafetyProblemMessage(List<Map<String, Object>> mapList, SafetyProblemTypeEnum safetyProblemTypeEnum) {
JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(mapList));
try {
emqKeeper.getMqttClient().publish(safetyProblemTypeEnum.getTopic(), jsonArray.toString().getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
logger.error("发送安全追溯问题设备信息消息失败---->{}", e.getMessage());
throw new RuntimeException(e);
if (CollectionUtil.isNotEmpty(jsonArray)){
try {
emqKeeper.getMqttClient().publish(safetyProblemTypeEnum.getTopic(), jsonArray.toString().getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
logger.error("发送安全追溯问题设备信息消息失败---->{}", e.getMessage());
throw new RuntimeException(e);
}
}
}
}
\ No newline at end of file
......@@ -210,4 +210,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
return true;
}
public Page<Map<String, Object>> queryUserListProblemById(Page<Map<String, Object>> page, String problemId) {
return this.baseMapper.queryUserListProblemById(page, problemId);
}
}
\ No newline at end of file
......@@ -6,11 +6,11 @@ eureka.client.service-url.defaultZone=http://172.16.10.243:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.68:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.health-check-url=http://172.16.3.6:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.68:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.68:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.68
eureka.instance.status-page-url=http://172.16.3.6:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.6:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.6
## ES properties:
elasticsearch.username=elastic
elasticsearch.password=a123456
......
......@@ -3,12 +3,12 @@
{
"dictDataKey": "0",
"dictDataValue": "按设备种类",
"dictDataDesc": "upload/tzs/common/image/按照设备种类选择.png"
"dictDataDesc": "upload/tzs/common/image/业务场景-设备.png"
},
{
"dictDataKey": "1",
"dictDataValue": "按应用场景",
"dictDataDesc": "upload/tzs/common/image/按照应用场景选择.png"
"dictDataDesc": "upload/tzs/common/image/业务场景-应用.png"
}
],
"SGGZ": [
......@@ -110,7 +110,7 @@
{
"name": "批量导入",
"code": "PL_DR",
"image": "upload/tzs/common/image/新增设备.png"
"image": "upload/tzs/common/image/新增设备(批量).png"
}
]
}
\ No newline at end of file
......@@ -1812,8 +1812,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber1?length > 18)>20<#elseif (pipelineNumber1?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber1?length > 18)>20<#elseif (pipelineNumber1?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber1?length > 18)>10<#elseif (pipelineNumber1?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber1?length > 18)>10<#elseif (pipelineNumber1?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber1}</w:t>
</w:r>
......@@ -2209,8 +2209,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber2?length > 18)>20<#elseif (pipelineNumber2?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber2?length > 18)>20<#elseif (pipelineNumber2?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber2?length > 18)>10<#elseif (pipelineNumber2?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber2?length > 18)>10<#elseif (pipelineNumber2?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber2}</w:t>
</w:r>
......@@ -2606,8 +2606,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber3?length > 18)>20<#elseif (pipelineNumber3?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber3?length > 18)>20<#elseif (pipelineNumber3?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber3?length > 18)>10<#elseif (pipelineNumber3?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber3?length > 18)>10<#elseif (pipelineNumber3?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber3}</w:t>
</w:r>
......@@ -3003,8 +3003,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber4?length > 18)>20<#elseif (pipelineNumber4?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber4?length > 18)>20<#elseif (pipelineNumber4?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber4?length > 18)>10<#elseif (pipelineNumber4?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber4?length > 18)>10<#elseif (pipelineNumber4?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber4}</w:t>
</w:r>
......@@ -3400,8 +3400,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber5?length > 18)>20<#elseif (pipelineNumber5?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber5?length > 18)>20<#elseif (pipelineNumber5?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber5?length > 18)>10<#elseif (pipelineNumber5?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber5?length > 18)>10<#elseif (pipelineNumber5?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber5}</w:t>
</w:r>
......@@ -3797,8 +3797,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber6?length > 18)>20<#elseif (pipelineNumber6?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber6?length > 18)>20<#elseif (pipelineNumber6?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber6?length > 18)>10<#elseif (pipelineNumber6?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber6?length > 18)>10<#elseif (pipelineNumber6?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber6}</w:t>
</w:r>
......@@ -4194,8 +4194,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber7?length > 18)>20<#elseif (pipelineNumber7?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber7?length > 18)>20<#elseif (pipelineNumber7?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber7?length > 18)>10<#elseif (pipelineNumber7?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber7?length > 18)>10<#elseif (pipelineNumber7?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber7}</w:t>
</w:r>
......@@ -4591,8 +4591,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber8?length > 18)>20<#elseif (pipelineNumber8?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber8?length > 18)>20<#elseif (pipelineNumber8?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber8?length > 18)>10<#elseif (pipelineNumber8?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber8?length > 18)>10<#elseif (pipelineNumber8?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber8}</w:t>
</w:r>
......@@ -4988,8 +4988,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber9?length > 18)>20<#elseif (pipelineNumber9?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber9?length > 18)>20<#elseif (pipelineNumber9?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber9?length > 18)>10<#elseif (pipelineNumber9?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber9?length > 18)>10<#elseif (pipelineNumber9?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber9}</w:t>
</w:r>
......@@ -5385,8 +5385,8 @@
</w:pPr>
<w:r w:rsidRPr="008E6947">
<w:rPr>
<w:sz w:val="<#if (pipelineNumber10?length > 18)>20<#elseif (pipelineNumber10?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber10?length > 18)>20<#elseif (pipelineNumber10?length > 15)>12<#else>14</#if>"/>
<w:sz w:val="<#if (pipelineNumber10?length > 18)>10<#elseif (pipelineNumber10?length > 15)>12<#else>14</#if>"/>
<w:szCs w:val="<#if (pipelineNumber10?length > 18)>10<#elseif (pipelineNumber10?length > 15)>12<#else>14</#if>"/>
</w:rPr>
<w:t>${pipelineNumber10}</w:t>
</w:r>
......
......@@ -661,7 +661,7 @@
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
ri."USE_ORG_CODE" useOrgCode,
pp."DEVICE_NAME" deviceName,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type in ('GYGDHIS','8100','8200','8300')) deviceLevel,
pp."PIPE_NAME" pipeName,
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
......@@ -708,7 +708,7 @@
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
ri."USE_ORG_CODE" useOrgCode,
pp."DEVICE_NAME" deviceName,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type in ('GYGDHIS','8100','8200','8300')) deviceLevel,
pp."PIPE_NAME" pipeName,
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
......
......@@ -1344,7 +1344,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
String test = QueryParser.escape(map.getString("USE_INNER_CODE"));
boolMust.must(QueryBuilders.matchPhraseQuery("USE_INNER_CODE", test));
}
this.setFilterOfInFlowing(boolMust, map.getString("EQU_LIST_CODE"), map.getString("inspectionType"));
this.setFilterOfInFlowing(boolMust, map.getString("EQU_LIST_CODE"), map.getString("inspectionType"), map.getString("EQU_CATEGORY_CODE"));
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageNumber - 1) * size);
......@@ -1382,14 +1382,16 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
/**
* 过滤条件去掉流程中的设备,
*
* @param boolMust 条件
* @param boolMust 条件
* @param equCategoryCode
*/
private void setFilterOfInFlowing(BoolQueryBuilder boolMust, String equListCode, String inspectionType) {
private void setFilterOfInFlowing(BoolQueryBuilder boolMust, String equListCode, String inspectionType, String equCategoryCode) {
Set<String> records = this.getEquipInFlowing();
if (records != null && !records.isEmpty()) {
boolMust.mustNot(QueryBuilders.termsQuery("SEQUENCE_NBR.keyword", records));
}
if ("5000".equals(equListCode) && JYJCBusinessTypeEnum.SCJY.getCode().equals(inspectionType)) {
// 流动时起重机械及厂车可直接做首检
if (("5000".equals(equListCode) || "4400".equals(equCategoryCode)) && JYJCBusinessTypeEnum.SCJY.getCode().equals(inspectionType)) {
boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", false));
} else {
BoolQueryBuilder shouldBuilder = QueryBuilders.boolQuery();
......
package com.yeejoin.amos.boot.module.statistics.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author system_generator
* @date 2025-02-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="CylinderBusinessStatisticsDto", description="")
public class CylinderBusinessStatisticsDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "年月")
private String time;
@ApiModelProperty(value = "总数")
private Long num;
@ApiModelProperty(value = "机构代码")
private String supervisionOrgCode;
}
package com.yeejoin.amos.boot.module.statistics.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
*
*
* @author system_generator
* @date 2025-02-21
*/
@Data
@Accessors(chain = true)
@TableName("tzs_cylinder_business_statistics")
public class CylinderBusinessStatistics implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(
value = "SEQUENCE_NBR",
type = IdType.ID_WORKER
)
protected Long sequenceNbr;
/**
* 年月
*/
@TableField("time")
private String time;
/**
* 总数
*/
@TableField("num")
private Long num;
/**
* 机构代码
*/
@TableField("supervision_org_code")
private String supervisionOrgCode;
public CylinderBusinessStatistics(String time, String supervisionOrgCode) {
this.time = time;
this.supervisionOrgCode = supervisionOrgCode;
}
}
......@@ -195,4 +195,10 @@ public class TzsUserInfo extends BaseEntity {
@TableField(value = "job_title")
private String jobTitle;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
}
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.yeejoin.amos.boot.module.statistics.api.entity.CylinderBusinessStatistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
*
* @author system_generator
* @date 2025-02-21
*/
public interface CylinderBusinessStatisticsMapper extends BaseMapper<CylinderBusinessStatistics> {
void deleteAll();
void insertBatch(@Param("list") List<CylinderBusinessStatistics> cylinderBusinessStatisticsList);
List<Map<String,Object>> getUseRegisterCount(@Param("orgCode")String orgCode);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderBusinessStatisticsMapper">
<insert id="insertBatch" parameterType="com.yeejoin.amos.boot.module.statistics.api.entity.CylinderBusinessStatistics">
insert into tzs_cylinder_business_statistics
(sequence_nbr, time, supervision_org_code, update_time) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.sequenceNbr},
#{item.time},
#{item.supervisionOrgCode},
CURRENT_TIMESTAMP
)
</foreach>
</insert>
<delete id="deleteAll">
delete from tzs_cylinder_business_statistics
</delete>
<select id="getUseRegisterCount" resultType="java.util.Map">
SELECT
C.time, -- 月份
COUNT(1) AS num -- 每月的记录数
FROM
tzs_cylinder_business_statistics C
WHERE
C.supervision_org_code LIKE '50%' -- 仅过滤 '50%' 开头的监管机构代码
GROUP BY
C.time -- 按月份分组
</select>
</mapper>
package com.yeejoin.amos.boot.module.statistcs.biz.job;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.statistics.api.entity.CylinderBusinessStatistics;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderBusinessStatisticsMapper;
import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 定时任务统计
*
* @author LiuLin
*/
@EnableScheduling
@Component
@Slf4j
public class MonthCylinderBusinessStatisticsJob {
private final JgUseRegistrationMapper useRegistrationMapper;
private final CylinderBusinessStatisticsMapper businessStatisticsMapper;
public MonthCylinderBusinessStatisticsJob(JgUseRegistrationMapper useRegistrationMapper,
CylinderBusinessStatisticsMapper businessStatisticsMapper) {
this.useRegistrationMapper = useRegistrationMapper;
this.businessStatisticsMapper = businessStatisticsMapper;
}
@Scheduled(cron = "0 */5 * * * ?")
@SchedulerLock(name = "cylinderBusinessStatisticsJob", lockAtMostFor = "PT1H")
public void cylinderBusinessStatisticsJob() {
List<Map<String, Object>> useRegisterCountList = useRegistrationMapper.getUseRegisterCountTotal();
if (!CollectionUtils.isEmpty(useRegisterCountList)) {
businessStatisticsMapper.deleteAll();
List<CylinderBusinessStatistics> statisticsList = useRegisterCountList.stream()
.map(item -> new CylinderBusinessStatistics(
(String) item.get("time"),
(String) item.get("supervisionOrgCode")
))
.collect(Collectors.toList());
businessStatisticsMapper.insertBatch(statisticsList);
}
}
}
......@@ -306,11 +306,11 @@ public class CylinderDPStatisticsServiceImpl {
public Map<String, Object> getCylinderStatisticsDataByCityForTotal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
getCylinderMapCount(orgCode, result);
getCylinderMapCount(orgCode, result, dpFilterParamDto.getCityCode());
return result;
}
private Map<String, Object> getCylinderMapCount(String orgCode, Map<String, Object> result) {
private void getCylinderMapCount(String orgCode, Map<String, Object> result, String cityCode) {
if (StringUtils.isNotEmpty(orgCode)) {
Long cylindersCount = this.countForCylinderNum(orgCode);
Long automotiveGasCount = this.countForCylinderNumForVehicleUsed(orgCode);
......@@ -330,15 +330,38 @@ public class CylinderDPStatisticsServiceImpl {
// 检验超期气瓶数
result.put("jycqsbCount", this.countForCylinderOverdueInspect(orgCode));
// 充气量
Long fillingVolumeCount = cylinderStatisticsMapper.countFillingVolumeCount(orgCode);
result.put("fillingVolumeCount", fillingVolumeCount == null ? 0L : new BigDecimal(fillingVolumeCount).divide(new BigDecimal("10000000")).setScale(3,RoundingMode.HALF_UP).toString());
// Long fillingVolumeCount = cylinderStatisticsMapper.countFillingVolumeCount(orgCode);
Double fillingVolumeCount = this.countFillingVolumeCount(cityCode);
BigDecimal value = new BigDecimal(fillingVolumeCount);
value = value.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP);
String unit = (fillingVolumeCount == 0) ? "吨" : (fillingVolumeCount > 10000 ? "万吨" : "吨");
BigDecimal resultValue = (fillingVolumeCount > 10000000) ? value.divide(new BigDecimal("10000000"), 3, RoundingMode.HALF_UP) : value;
result.put("fillingVolumeCount", resultValue );
// 卸液量
Long dischargeVolumeCount = cylinderStatisticsMapper.countDischargeVolumeCount(orgCode);
result.put("dischargeVolumeCount", dischargeVolumeCount == null ? 0L : new BigDecimal(dischargeVolumeCount).divide(new BigDecimal("10000000")).setScale(3,RoundingMode.HALF_UP).toString());
} else {
this.setDefaultValueIfNoData(result, "cylindersCount", "stationCount", "operatorCount", "liquefiedGasCount", "automotiveGasCount", "industrialGasCount", "useRegistrationQuantityCount", "jylqsbCount", "jycqsbCount","fillingVolumeCount","dischargeVolumeCount");
}
return result;
}
/**
* 从ES查询总量
* @param cityCode
* @return
*/
private Double countFillingVolumeCount(String cityCode) {
DPFilterParamForDetailDto dpFilterParamForDetailDto = new DPFilterParamForDetailDto();
dpFilterParamForDetailDto.setCityCode(cityCode);
List<Map<String, Object>> list = this.getFillingQuantity(dpFilterParamForDetailDto, null, null);
return list.isEmpty()
? 0L
: list.stream()
.mapToDouble(e -> Optional.ofNullable(e.get("fillingQuantity"))
.map(f -> Double.parseDouble(f.toString()))
.orElse(0.0))
.sum();
}
/**
......@@ -422,7 +445,7 @@ public class CylinderDPStatisticsServiceImpl {
Map<String, Object> item = new HashMap<>();
item.put("regionCode", r.getRegionCode());
item.put("regionName", r.getRegionName());
getCylinderMapCount(orgCode, item);
getCylinderMapCount(orgCode, item, dpFilterParamDto.getCityCode());
return item;
}).collect(Collectors.toList());
}
......
......@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderBusinessStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.JGStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
......@@ -180,6 +181,8 @@ public class JGDPStatisticsServiceImpl {
private JgUseRegistrationMapper useRegistrationMapper;
private CylinderBusinessStatisticsMapper businessStatisticsMapper;
private JgEnableDisableMapper enableDisableMapper;
private JgScrapCancelMapper scrapCancelMapper;
......@@ -277,8 +280,10 @@ public class JGDPStatisticsServiceImpl {
IdxBizJgTechParamsPipelineMapper idxBizJgTechParamsPipelineMapper,
IdxBizJgTechParamsElevatorMapper idxBizJgTechParamsElevatorMapper,
DataDictionaryServiceImpl iDataDictionaryService,
SafetyProblemTracingMapper safetyProblemTracingMapper) {
SafetyProblemTracingMapper safetyProblemTracingMapper,
CylinderBusinessStatisticsMapper businessStatisticsMapper) {
this.useRegistrationMapper = useRegistrationMapper;
this.businessStatisticsMapper = businessStatisticsMapper;
this.enableDisableMapper = enableDisableMapper;
this.scrapCancelMapper = scrapCancelMapper;
this.restHighLevelClient = restHighLevelClient;
......@@ -512,7 +517,7 @@ public class JGDPStatisticsServiceImpl {
List<Object> scrappedDeviceList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM");
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<Map<String,Object>> useRegisterCountList = useRegistrationMapper.getUseRegisterCount(orgCode);
List<Map<String,Object>> useRegisterCountList = businessStatisticsMapper.getUseRegisterCount(orgCode);
List<Map<String,Object>> scrappedDeviceCountList = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
Map<String,Object> useRegisterCount = new HashMap<>();
Map<String,Object> scrappedDeviceCount = new HashMap<>();
......
package com.yeejoin.amos.boot.module.tcm.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.Map;
/**
* 安全追溯问题
*
* @author system_generator
* @date 2024-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SafetyProblemTracingDto", description = "安全追溯问题")
public class SafetyProblemTracingDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "问题编号")
private String problemNum;
@ApiModelProperty(value = "问题类型(维保超期、检验超期、资质超期等)")
private String problemType;
@ApiModelProperty(value = "问题类型图片")
private String problemTypePic;
@ApiModelProperty(value = "问题来源类型(1个人、2设备、3企业)")
private String sourceType;
@ApiModelProperty(value = "问题来源ID(个人ID、设备ID、企业ID)")
private String sourceId;
@ApiModelProperty(value = "问题描述")
private String problemDesc;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "问题产生查询开始时间")
private Date problemTimeStart;
@ApiModelProperty(value = "问题产生时间")
private Date problemTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "问题产生查询结束时间")
private Date problemTimeEnd;
@ApiModelProperty(value = "主体单位名称")
private String principalUnit;
@ApiModelProperty(value = "主体单位统一代码")
private String principalUnitCode;
@ApiModelProperty(value = "主体单位类型(使用、安改维、检验检测等)")
private String principalUnitType;
@ApiModelProperty(value = "管辖机构名称")
private String governingBody;
@ApiModelProperty(value = "管辖机构单位代码")
private String governingBodyCode;
@ApiModelProperty(value = "管辖机构组织机构代码(例如50*60*70)")
private String governingBodyOrgCode;
@ApiModelProperty(value = "主体单位所属区域名称(陕西省/西安市/莲湖区)")
private String regionName;
@ApiModelProperty(value = "所属区域代码(6100000/6100010/6100011)")
private String regionCode;
@ApiModelProperty(value = "所属区域代码(6100000/6100010/6100011)")
private String cityCode;
@ApiModelProperty(value = "问题状态(0未处理、1已处理)")
private String problemStatus;
@ApiModelProperty(value = "问题状态代码(0未处理、1已处理)")
private String problemStatusCode;
@ApiModelProperty(value = "问题状态对象")
private Map<String, String> problemStatusObj;
@ApiModelProperty(value = "更新人员")
private String recUser;
@ApiModelProperty(value = "创建人ID")
private String createUserId;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "创建人")
private String createUser;
@ApiModelProperty(value = "企业负责人")
private String unitCharger;
@ApiModelProperty(value = "企业负责人联系电话")
private String unitChargerPhone;
@ApiModelProperty(value = "设备监管码")
private String equipSuperviseCode;
@ApiModelProperty(value = "设备种类")
private String equipList;
@ApiModelProperty(value = "人员名称")
private String userName;
@ApiModelProperty(value = "人员电话")
private String userPhone;
@ApiModelProperty(value = "人员岗位")
private String userPost;
@ApiModelProperty(value = "扩展信息")
private String extraInfo;
@ApiModelProperty(value = "设备种类代码")
private String equipListCode;
@ApiModelProperty(value = "问题类型代码(维保超期、检验超期、资质超期等)")
private String problemTypeCode;
@ApiModelProperty(value = "问题来源类型code(1个人、2设备、3企业)")
private String sourceTypeCode;
@ApiModelProperty(value = "问题等级(一级、二级、三级)")
private String problemLevel;
@ApiModelProperty(value = "问题等级code")
private String problemLevelCode;
@ApiModelProperty(value = "隐患等级(红:隐患状态为未处理、黄:暂无、绿:隐患状态为已处理、灰:暂无)")
private String hiddenDangersLevel;
@ApiModelProperty(value = "设备类别code")
private String equCategoryCode;
@ApiModelProperty(value = "设备类别")
private String equCategory;
}
......@@ -117,4 +117,8 @@ public class TzsUserInfoDto extends BaseDto {
@ApiModelProperty(value = "菜单类型下的所有人员类型")
private List<String> menuTypeUnderPost;
@ApiModelProperty("二维码状态0异常1正常")
private String qrCodeState;
}
package com.yeejoin.amos.boot.module.tcm.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 安全追溯问题
*
* @author system_generator
* @date 2024-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tzs_safety_problem_tracing")
public class SafetyProblemTracing extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 问题编号
*/
@TableField("problem_num")
private String problemNum;
/**
* 问题类型(维保超期、检验超期、资质超期等)
*/
@TableField("problem_type")
private String problemType;
/**
* 问题来源类型(1个人、2企业、3设备)
*/
@TableField("source_type")
private String sourceType;
/**
* 问题来源ID(个人ID、设备ID、企业ID)
*/
@TableField("source_id")
private String sourceId;
/**
* 问题描述
*/
@TableField("problem_desc")
private String problemDesc;
/**
* 问题产生时间
*/
@TableField("problem_time")
private Date problemTime;
/**
* 主体单位名称
*/
@TableField("principal_unit")
private String principalUnit;
/**
* 主体单位统一代码
*/
@TableField("principal_unit_code")
private String principalUnitCode;
/**
* 主体单位类型(使用、安改维、检验检测等)
*/
@TableField("principal_unit_type")
private String principalUnitType;
/**
* 管辖机构名称
*/
@TableField("governing_body")
private String governingBody;
/**
* 管辖机构单位代码
*/
@TableField("governing_body_code")
private String governingBodyCode;
/**
* 管辖机构组织机构代码(例如50*60*70)
*/
@TableField("governing_body_org_code")
private String governingBodyOrgCode;
/**
* 主体单位所属区域名称(陕西省/西安市/莲湖区)
*/
@TableField("region_name")
private String regionName;
/**
* 所属区域代码(6100000/6100010/6100011)
*/
@TableField("region_code")
private String regionCode;
/**
* 问题状态(0未处理、1已处理)
*/
@TableField("problem_status")
private String problemStatus;
/**
* 问题状态代码(0未处理、1已处理)
*/
@TableField("problem_status_code")
private String problemStatusCode;
/**
* 更新人员
*/
@TableField("rec_user")
private String recUser;
/**
* 创建人ID
*/
@TableField("create_user_id")
private String createUserId;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
/**
* 创建人
*/
@TableField("create_user")
private String createUser;
/**
* 企业负责人
*/
@TableField("unit_charger")
private String unitCharger;
/**
* 企业负责人联系电话
*/
@TableField("unit_charger_phone")
private String unitChargerPhone;
/**
* 设备监管码
*/
@TableField("equip_supervise_code")
private String equipSuperviseCode;
/**
* 设备种类
*/
@TableField("equip_list")
private String equipList;
/**
* 人员名称
*/
@TableField("user_name")
private String userName;
/**
* 人员电话
*/
@TableField("user_phone")
private String userPhone;
/**
* 人员岗位
*/
@TableField("user_post")
private String userPost;
/**
* 扩展信息
*/
@TableField("extraInfo")
private String extraInfo;
/**
* 设备种类代码
*/
@TableField("equip_list_code")
private String equipListCode;
/**
* 问题类型代码(维保超期、检验超期、资质超期等)
*/
@TableField("problem_type_code")
private String problemTypeCode;
/**
* 问题来源类型code(1个人、2企业、3设备)
*/
@TableField("source_type_code")
private String sourceTypeCode;
/**
* 问题等级(一级、二级、三级)
*/
@TableField("problem_level")
private String problemLevel;
/**
* 问题等级code
*/
@TableField("problem_level_code")
private String problemLevelCode;
}
......@@ -195,4 +195,9 @@ public class TzsUserInfo extends BaseEntity {
@TableField(value = "job_title")
private String jobTitle;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
}
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.Getter;
/**
* 业务类型枚举
*
* @author Administrator
*/
@Getter
public enum SafetyProblemSourceTypeEnum {
/**
* 问题主体类型
*/
UNIT("2", "企业"),
EQUIP("3", "设备"),
PERSONNEL("1", "个人");
private final String code;
private final String name;
SafetyProblemSourceTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByType(String code) {
String name = null;
for (SafetyProblemSourceTypeEnum enumOne : SafetyProblemSourceTypeEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
}
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.Getter;
/**
* 业务类型枚举
*
* @author Administrator
*/
@Getter
public enum SafetyProblemStatusEnum {
/**
* 问题主体类型
*/
UNHANDLED("0", "未处理", "red"),
HANDLED("1", "已处理", "green");
private final String code;
private final String name;
private final String color;
SafetyProblemStatusEnum(String code, String name, String color) {
this.code = code;
this.name = name;
this.color = color;
}
public static String getNameByType(String code) {
String name = null;
for (SafetyProblemStatusEnum enumOne : SafetyProblemStatusEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
}
package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tcm.api.entity.SafetyProblemTracing;
/**
* 安全追溯问题 Mapper 接口
*
* @author system_generator
* @date 2024-05-21
*/
public interface SafetyProblemTracingMapper extends BaseMapper<SafetyProblemTracing> {
}
package com.yeejoin.amos.boot.module.tcm.api.service;
/**
* 安全追溯问题接口类
*
* @author system_generator
* @date 2024-05-21
*/
public interface ISafetyProblemTracingService {}
......@@ -134,6 +134,9 @@ public class TzsUserInfoVo {
@ApiModelProperty(value = "设备类型")
private JSONArray equipType;
@ApiModelProperty(value = "设备类型名称")
private String equipTypeName;
/**
* 内部人员编码
*/
......@@ -156,4 +159,6 @@ public class TzsUserInfoVo {
*/
private String jobTitle;
@ApiModelProperty(value = "人员类型名称")
private String postName;
}
package com.yeejoin.amos.boot.module.tcm.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
......@@ -83,7 +84,12 @@ public class TzsTwoStaffingController extends BaseController {
ArrayList<LinkedHashMap> result = new ArrayList<>();
List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr);
Page<TzsTwoStaffing> tzsTwoStaffingPage = new Page<>();
tzsTwoStaffingPage.setRecords(tzsTwoStaffingService.getStatisticsMessage(list, type));
List<TzsTwoStaffing> statisticsMessage = tzsTwoStaffingService.getStatisticsMessage(list, type);
tzsTwoStaffingPage.setRecords(statisticsMessage);
if(CollUtil.isNotEmpty(statisticsMessage)){
tzsTwoStaffingPage.setPages(1);
tzsTwoStaffingPage.setTotal(statisticsMessage.size());
}
return ResponseHelper.buildResponse(tzsTwoStaffingPage);
}
......
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import com.yeejoin.amos.boot.module.tcm.api.dto.SafetyProblemTracingDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.tcm.api.mapper.SafetyProblemTracingMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ISafetyProblemTracingService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/**
* 安全追溯问题服务实现类
*
* @author system_generator
* @date 2024-05-21
*/
@Service
public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTracingDto, SafetyProblemTracing, SafetyProblemTracingMapper> implements ISafetyProblemTracingService {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -279,7 +280,20 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
tzsUserInfoVo.setNewPost(JSON.parseArray(tzsUserInfo.getNewPost()));
}
if (!ObjectUtils.isEmpty(tzsUserInfo.getEquipType())) {
tzsUserInfoVo.setEquipType(JSON.parseArray(tzsUserInfo.getEquipType()));
JSONArray equipTypeJSONArray = JSON.parseArray(tzsUserInfo.getEquipType());
tzsUserInfoVo.setEquipType(equipTypeJSONArray);
if(CollUtil.isNotEmpty(equipTypeJSONArray)){
StringBuilder equipTypeName = new StringBuilder();
for (Object o : equipTypeJSONArray) {
String s = EquipmentClassifityEnum.getName.get(o);
if(StringUtils.isEmpty(s)){
s = String.valueOf(o);
}
equipTypeName.append(s);
equipTypeName.append(",");
}
tzsUserInfoVo.setEquipTypeName(equipTypeName.substring(0,equipTypeName.length()-1));
}
}
tzsUserInfoVo.setIdentification(ObjectUtils.isEmpty(tzsUserInfo.getIdentification()) ? null : JSON.parseArray(tzsUserInfo.getIdentification()));
tzsUserInfoVo.setProfile(ObjectUtils.isEmpty(tzsUserInfo.getProfile()) ? null : JSON.parseArray(tzsUserInfo.getProfile()));
......@@ -944,6 +958,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
// 更新资质
tzsUserPermissionServiceImpl.updatePermissionData(tzsUserInfoDto);
tzsUserInfoDto.setQrCodeState("1");
this.updateWithModel(tzsUserInfoDto);
return tzsUserInfoDto;
}
......
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.TzsUserPermissionDto;
import com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.tcm.api.enums.SafetyProblemSourceTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserPermissionMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsUserPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
......@@ -66,6 +72,8 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD
public List<TzsUserPermissionDto> queryForTzsUserPermissionList() {
return this.queryForList("", false);
}
@Autowired
private SafetyProblemTracingServiceImpl safetyProblemTracingService;
/**
* 更新资质权限数据
......@@ -151,12 +159,35 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD
.parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
.toFormatter();
Object sequenceNbr = permissionData.get("sequenceNbr");
if(Objects.nonNull(sequenceNbr)){
permission.setSequenceNbr(Long.valueOf(String.valueOf(sequenceNbr)));
}
String expiryDateString = String.valueOf(Optional.ofNullable(permissionData.get("expiryDate")).orElse(""));
if (!ValidationUtil.isEmpty(expiryDateString)) {
LocalDate localDate1 = LocalDate.parse(expiryDateString, formatter);
LocalDateTime localDateTime1 = localDate1.atStartOfDay();
Date expiryDate = Date.from(localDateTime1.atZone(ZoneId.systemDefault()).toInstant());
permission.setExpiryDate(expiryDate);
//如果有效期大于当前日期,同时问题列表有未处理的问题,则修改成已处理
LocalDate now = LocalDate.now();
if(!localDate1.isBefore(now) && Objects.nonNull(sequenceNbr)){
LambdaQueryWrapper<SafetyProblemTracing> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SafetyProblemTracing::getSourceId,sequenceNbr)
.eq(SafetyProblemTracing::getSourceTypeCode, SafetyProblemSourceTypeEnum.PERSONNEL.getCode())
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode());
List<SafetyProblemTracing> safetyProblemTracingList = safetyProblemTracingService.list(wrapper);
if(CollUtil.isNotEmpty(safetyProblemTracingList)){
LambdaUpdateWrapper<SafetyProblemTracing> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.HANDLED.getCode())
.set(SafetyProblemTracing::getProblemStatus, SafetyProblemStatusEnum.HANDLED.getName())
.set(SafetyProblemTracing::getRecDate,new Date())
.eq(SafetyProblemTracing::getSourceId,sequenceNbr)
.eq(SafetyProblemTracing::getSourceTypeCode, SafetyProblemSourceTypeEnum.PERSONNEL.getCode());
safetyProblemTracingService.update(updateWrapper);
}
}
}
String issueDateString = String.valueOf(Optional.ofNullable(permissionData.get("issueDate")).orElse(""));
......@@ -166,7 +197,6 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD
Date issueDate = Date.from(localDateTime2.atZone(ZoneId.systemDefault()).toInstant());
permission.setIssueDate(issueDate);
}
permission.setApprovedOrgan((String) permissionData.get("approvedOrgan"));
permission.setCertAttachment(JSONArray.toJSONString(permissionData.get("certAttachment")));
permission.setCertType(ZYRY_TYPE.equals(type) ? String.valueOf(permissionData.get("certType")) : null);
......
......@@ -228,6 +228,7 @@ public class CheckController extends AbstractBaseController {
return CommonResponseUtil.success(list);
}
@Deprecated
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "一键提交巡检任务", notes = "一键提交巡检任务<font color='blue'>手机app</font>")
@RequestMapping(value = "/saveRecordAll2", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
......@@ -292,7 +293,7 @@ public class CheckController extends AbstractBaseController {
Date endTime = DateUtil.getLongDate(planTask.getEndTime());
int beginCompareTo = checkTime.compareTo(beginTime);
int endCompareTo = checkTime.compareTo(endTime);
if(beginCompareTo == -1 || endCompareTo == 1){
if(beginCompareTo < 0 || endCompareTo > 0){
return ResponseHelper.buildResponse("请在计划时间内完成任务!");
}
}
......@@ -301,9 +302,9 @@ public class CheckController extends AbstractBaseController {
//准备es数据
ESTaskDetailDto esTaskDetailDto = checkService.buildEsDetailData(requestParam, planTask);
ESPlanTaskListDto esPlanTaskListDto = checkService.buildEsTaskData(requestParam.getPlanTaskId(),esTaskDetailDto);
//更新必须数据
// 更新 es 数据
checkService.saveMustData(esTaskDetailDto, esPlanTaskListDto, planTask);
// 更新数据库巡检数据及es的统计汇总信息
CheckDto checkDto = checkService.saveCheckRecordNew(requestParam, planTask);
return ResponseHelper.buildResponse("ok");
} else {
......@@ -598,7 +599,7 @@ public class CheckController extends AbstractBaseController {
@GetMapping(value = "/checkCalendarForWx", produces = "application/json;charset=UTF-8")
public ResponseModel<Object> checkCalendarForWx(
@RequestParam(required = false) String checkTime,
@RequestParam(required = true) String type) {
@RequestParam String type) {
try {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
......@@ -609,7 +610,7 @@ public class CheckController extends AbstractBaseController {
stopWatch.stop();
log.info("获取巡检日历数据=====> loginOrgCode time: {}", stopWatch.getTotalTimeSeconds());
if(StringUtils.isBlank(checkTime)) {
if(type.equals(String.valueOf(PlanTaskTypeStatusEnum.month.getValue()))) {
if(type.equals(String.valueOf(PlanTaskTypeStatusEnum.month.getName()))) {
checkTime = DateUtils.dateFormat(new Date(), DateUtils.YEAR_PATTERN);
} else {
checkTime = DateUtils.dateFormat(new Date(), DateUtils.MONTH_PATTERN);
......
......@@ -536,7 +536,7 @@ public class CheckServiceImpl implements ICheckService {
StringBuffer deptName = new StringBuffer();
if(planTask.getUserDept().indexOf(",") > 0) {
List<String> depts = Arrays.asList(planTask.getUserDept().split(","));
depts.stream().forEach(dept -> {
depts.forEach(dept -> {
deptName.append(dept.split("@")[2]).append(",");
});
......@@ -705,10 +705,30 @@ public class CheckServiceImpl implements ICheckService {
}
if (check.getPlanTaskId() > 0) {
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), requestParam.getPointId(), requestParam.getPlanTaskId(), requestParam.getUserId());
// es 操作:更新检查点的状态(完成状态、检查状态)
Long planTaskId = planTask.getId();
Optional<ESPlanTaskListDto> op = esPlanTaskList.findById(String.valueOf(planTaskId));
if(check.getIsOk().equals(CheckStatusEnum.UNQUALIFIED.getCode())){
// 结果不合格时 更新统计不合格数量,小程序任务详情 环形图上方统计使用
op.ifPresent(esPlanTaskListDto->{
String ids = String.format("(%d)",planTaskId);
List<PlanTaskDetail> maps = planTaskMapper.selectTaskDetails(ids);
int unqualified = Integer.parseInt(esPlanTaskListDto.getUnqualified()) + 1;
esPlanTaskListDto.setUnqualified( unqualified + "");
esPlanTaskListDto.setPoints(maps);
esPlanTaskList.save(esPlanTaskListDto);
});
} else {
// 结果合格时 更新点的状态
op.ifPresent(esPlanTaskListDto->{
String ids = String.format("(%d)",planTaskId);
List<PlanTaskDetail> maps = planTaskMapper.selectTaskDetails(ids);
esPlanTaskListDto.setPoints(maps);
esPlanTaskList.save(esPlanTaskListDto);
});
}
}
CheckDto checkDto= new CheckDto(check.getId(), unqualifiedcheckItemList);
CheckDto checkDto= new CheckDto(check.getId(), unqualifiedcheckItemList);
return checkDto;
} catch (Exception e) {
e.printStackTrace();
......@@ -2129,22 +2149,15 @@ public class CheckServiceImpl implements ICheckService {
@Override
public ESPlanTaskListDto buildEsTaskData(Long planTaskId,ESTaskDetailDto esTaskDetailDto) {
ESPlanTaskListDto esPlanTaskListDto = esPlanTaskList.findById(String.valueOf(planTaskId)).get();
String finishNum = String.valueOf(Integer.valueOf(esPlanTaskListDto.getFinshNum()) + 1);
String unPlan = String.valueOf(Integer.valueOf(esPlanTaskListDto.getUnplan()) - 1);
String finishNum = String.valueOf(Integer.parseInt(esPlanTaskListDto.getFinshNum()) + 1);
String unPlan = String.valueOf(Integer.parseInt(esPlanTaskListDto.getUnplan()) - 1);
esPlanTaskListDto.setFinshNum(finishNum);
esPlanTaskListDto.setOmission(esPlanTaskListDto.getOmission());
esPlanTaskListDto.setUnqualified(esPlanTaskListDto.getUnqualified());
esPlanTaskListDto.setUnplan(unPlan);
esPlanTaskListDto.setTaskPlanNum(esPlanTaskListDto.getTaskPlanNum());
List<PlanTaskDetail> points = esPlanTaskListDto.getPoints();
PlanTaskDetail planTaskDetail = points.stream().filter(x -> x.getId() == Long.valueOf(esTaskDetailDto.getId())).collect(Collectors.toList()).get(0);
points.remove(planTaskDetail);
planTaskDetail.setIsFinish(PlanTaskDetailIsFinishEnum.FINISHED.getValue());
planTaskDetail.setStatus(esTaskDetailDto.getIsRisk());
points.add(planTaskDetail);
String status = unPlan.equals("0") ? String.valueOf(PlanTaskFinishStatusEnum.FINISHED.getValue()) : esPlanTaskListDto.getFinishStatus();
esPlanTaskListDto.setFinishStatus(status);
esPlanTaskListDto.setPoints(points);
return esPlanTaskListDto;
}
......
......@@ -1697,6 +1697,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Deprecated
@Override
@Transactional(rollbackFor = Exception.class)
public void handleAllBatch(String planTaskIds, String userId) {
......@@ -1770,7 +1771,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
List<ESPlanTaskListDto> esPlanTaskListDtos = esPlanTaskListDtosFuture.join();
buildESTaskDetailDtoData2(esTaskDetailDtos, planTaskDetails);
finishPlanTask(planTasks, planTaskDetails);
buildESPlanTaskListDtoData2(esPlanTaskListDtos, esTaskDetailDtos, planTaskDetails);
buildESPlanTaskListDtoData2(esPlanTaskListDtos, planTaskDetails);
saveMustData(esTaskDetailDtos, esPlanTaskListDtos, planTasks);
this.sendInsertMessage(planTasks, planTaskDetails);
}
......@@ -1794,6 +1795,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private void finishPlanTask(List<PlanTask> planTasks, List<PlanTaskDetail> planTaskDetails) {
planTasks.forEach(planTask -> {
planTask.setFinishStatus(XJConstant.TASK_STATUS_FINISH);
planTask.setFinishNum(planTask.getPointNum());
if (planTask.getRiskStatus() != 1) {
planTask.setRiskStatus(XJConstant.NORISK_NUM);
}
......@@ -1994,14 +1996,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return esPlanTaskListDtos;
}
private void buildESPlanTaskListDtoData2(List<ESPlanTaskListDto> esPlanTaskListDtos, List<ESTaskDetailDto> esTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
private void buildESPlanTaskListDtoData2(List<ESPlanTaskListDto> esPlanTaskListDtos, List<PlanTaskDetail> planTaskDetails) {
esPlanTaskListDtos.forEach(esPlanTaskListDto -> {
esPlanTaskListDto.setFinishStatus(String.valueOf(PlanTaskFinishStatusEnum.FINISHED.getValue()));
esPlanTaskListDto.setFinshNum(this.filterByStatus("1", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
esPlanTaskListDto.setOmission(this.filterByStatus("3", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
esPlanTaskListDto.setUnqualified(this.filterByStatus("2", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
esPlanTaskListDto.setUnplan(this.filterByStatus("0", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
esPlanTaskListDto.setTaskPlanNum(this.filterByStatus("1", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
esPlanTaskListDto.setFinshNum(esPlanTaskListDto.getPoints().size() + "");
esPlanTaskListDto.setUnplan("0");
esPlanTaskListDto.setPoints(this.buildPlanTaskPoint(esPlanTaskListDto.getPlanTaskId(), planTaskDetails));
});
}
......
......@@ -210,6 +210,7 @@ public interface IPlanTaskService {
void backPatrolInfo();
@Deprecated
void handleAllBatch(String ids, String userId);
void handleAllBatch2(String ids, String userId);
......
......@@ -22,7 +22,7 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml
mybatis-plus.mapper-locations=classpath:db/mapper/*.xml
mybatis.type-aliases-package = com.yeejoin.amos.patrol.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase=true
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.nologging.NoLoggingImpl
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.global-config.db-config.update-strategy=ignored
spring.liquibase.change-log=classpath:/db/changelog/changelog-master.xml
......@@ -80,4 +80,5 @@ spring.security.user.password=a1234560
#\u96EA\u82B1\u7B97\u6CD5\u53C2\u6570 \u7EC8\u7AEFID
generator.worker_id=1
#\u96EA\u82B1\u7B97\u6CD5\u53C2\u6570 \u6570\u636E\u4E2D\u5FC3id
generator.datacenter_id=1
\ No newline at end of file
generator.datacenter_id=1
spring.main.allow-bean-definition-overriding=true
\ No newline at end of file
......@@ -2301,13 +2301,13 @@
) stime
from ${table} tb
<where>
<if test="type=='1'">
<if test='type=="1"'>
DATE_FORMAT(tb.check_time, '%Y-%m') = #{checkTime}
</if>
<if test="type=='2'">
<if test='type=="2"'>
AND tb.check_time between #{startTime} and #{endTime}
</if>
<if test="type=='3'">
<if test='type=="3"'>
AND DATE_FORMAT(tb.check_time, '%Y') = #{checkTime}
</if>
<if test="orgCode!=null">AND tb.org_code = #{orgCode} </if>
......
......@@ -142,5 +142,12 @@ public class TzsUserInfo extends BaseEntity {
@TableField("new_post")
private String newPost;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
@TableField("post_name")
private String postName;
}
......@@ -26,9 +26,15 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' ORDER BY parent_id")
List<EquipmentCategoryDto> selectClassifyNoStart7();
List<EquipmentCategoryDto> equipmentPipeType3ByParentCode(@Param("parentCode") String parentCode);
List<EquipmentCategoryDto> selectClassifyNoStart7ByParentCode(@Param("parentCode") String parentCode);
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' AND code NOT LIKE '8%' ORDER BY parent_id")
List<EquipmentCategoryDto> selectClassifyNoStart7And8();
List<EquipmentCategoryDto> selectClassifyNoStart7And8ByParentCode(@Param("parentCode") String parentCode);
@Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')")
List<EquipmentCategoryDto> selectClassify();
......
package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectConstruction;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 管道工程装置表 Mapper 接口
......@@ -27,17 +24,37 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
/**
* 统计工程装置的引用次数(非待提交、非已撤回、非已驳回)
*
* @param projectContraptionId 工程装置唯一标识
* @param projectContraptionIdList 工程装置唯一标识
* @return 被引用次数 > 0 则设备不可编辑
*/
Integer countContraptionInUseTimesForEdit(@Param("projectContraptionId") Long projectContraptionId);
List<Map<String, Integer>> countContraptionInUseTimesForEdit(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 统计设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionIdList 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
List<Map<String, Integer>> countContraptionInUseTimesForDelete(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 获取管道信息总数
*
* @param projectContraptionIdList
* @return
*/
List<Map<String, Integer>> selectEquipCount(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 获取不为空的检验信息个数
*/
List<Map<String, Integer>> selectCheckCountByNotNull(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 统计已纳管设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionId 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer countContraptionInUseTimesForDelete(@Param("projectContraptionId") Long projectContraptionId);
Integer countContraptionInUseTimesForDeleteByIntoManagement(@Param("projectContraptionId")Long projectContraptionId);
List<IdxBizJgProjectContraption> selectErrorManagementProject();
......@@ -62,13 +79,6 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
List<Map<String, Object>> selectEquipListPage(@Param("sequenceNbr") String sequenceNbr, @Param("current") int current, @Param("size") int size);
/**
* 获取管道信息总数
* @param sequenceNbr
* @return
*/
long selectEquipCount(@Param("sequenceNbr") String sequenceNbr);
/**
* 获取导出传输/公共管道的信息
* @param sequenceNbr
* @return
......@@ -76,14 +86,9 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
List<Map<String, Object>> selectEquipListByExport(@Param("sequenceNbr") String sequenceNbr);
/**
* 获取不为空的检验信息个数
*/
int selectCheckCountByNotNull(@Param("sequenceNbr") String sequenceNbr);
/**
* 统计已纳管设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionId 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer countContraptionInUseTimesForDeleteByIntoManagement(@Param("projectContraptionId")Long projectContraptionId);
List<Map<String, Integer>> countContraptionInUseTimesForDeleteByIntoManagementBatch(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
}
......@@ -123,4 +123,5 @@ public class TzsUserInfoVo {
* 证件照片
*/
private JSONArray appointDoc;
private String postName;
}
......@@ -682,4 +682,37 @@
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND "CLAIM_STATUS" = '已认领';
</select>
<select id="equipmentPipeType3ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code like '8%' and code NOT LIKE '%00'
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
</where>
ORDER BY parent_id
</select>
<select id="selectClassifyNoStart7ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%'
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
</where>
ORDER BY parent_id
</select>
<select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%' AND code NOT LIKE '8%'
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
</where>
ORDER BY parent_id
</select>
</mapper>
......@@ -27,7 +27,7 @@
register.EQU_CODE,
register.EQU_LIST,
supervision.ORG_BRANCH_CODE,
(select date_format(di.NEXT_INSPECT_DATE, 'yyyy-mm-dd') from idx_biz_jg_inspection_detection_info di where di."RECORD" = register."RECORD" and di.NEXT_INSPECT_DATE is not null and di."INSPECT_TYPE" <![CDATA[<>]]> '' order by di.REC_DATE desc limit 1) as NEXT_INSPECT_DATE
(select date_format(di.NEXT_INSPECT_DATE, 'yyyy-mm-dd') from idx_biz_jg_inspection_detection_info di where di."RECORD" = register."RECORD" and di.NEXT_INSPECT_DATE is not null and di."INSPECT_TYPE" <![CDATA[<>]]> '' order by di.INSPECT_DATE desc limit 1) as NEXT_INSPECT_DATE
FROM
idx_biz_jg_use_info use
LEFT JOIN idx_biz_jg_register_info register on register.RECORD = use.RECORD
......
......@@ -2538,60 +2538,112 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*
* @param paramMap 更新的参数
*/
@Override
// @Override
// public Map<String, Object> commonUpdateEsDataByIds(Map<String, Map<String, Object>> paramMap) {
// if (paramMap.isEmpty()) {
// return null;
// }
// String oldUscUnitCreditCode = "";
// String oldUscUnitName = "";
// Map<String, Object> resultMap = new HashMap<>();
// for (Map.Entry<String, Map<String, Object>> entry : paramMap.entrySet()) {
// String record = entry.getKey();
// Map<String, Object> childMap = entry.getValue();
// if (!childMap.isEmpty()) {
// ESEquipmentCategoryDto oldData = null;
// // 获取Es中旧的数据
// Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
// if (!ObjectUtils.isEmpty(optional)) {
// oldData = optional.get();
// oldUscUnitCreditCode = oldData.getUSC_UNIT_CREDIT_CODE();
// oldUscUnitName = oldData.getUSC_UNIT_NAME();
// }
// // 获取Es中新的参数
// ESEquipmentCategoryDto newData = JSON.parseObject(toJSONString(childMap), ESEquipmentCategoryDto.class);
// String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
// String newUscUnitName = newData.getUSC_UNIT_NAME();
//
// // 删除Es中旧的数据
// if (!ObjectUtils.isEmpty(oldData)) {
// esEquipmentCategory.deleteById(record);
// // 整合新旧数据
// Bean.copyExistPropertis(newData, oldData);
// // 处理施工单位信息[去重]
// if (!ValidationUtil.isEmpty(newUscUnitCreditCode)) {
// // if (!ValidationUtil.isEmpty(oldUscUnitCreditCode)) {
// // if (!oldUscUnitCreditCode.contains(newUscUnitCreditCode)) {
// // oldData.setUSC_UNIT_CREDIT_CODE(oldUscUnitCreditCode + "," + newUscUnitCreditCode);
// // oldData.setUSC_UNIT_NAME(oldUscUnitName + "," + newUscUnitName);
// // }
// // } else {
// oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
// oldData.setUSC_UNIT_NAME(newUscUnitName);
// // }
// }
//
// }
// if (!ObjectUtils.isEmpty(oldData)) {
// oldData.setREC_DATE(System.currentTimeMillis());
// ESEquipmentCategoryDto saveData = esEquipmentCategory.save(oldData);
//
// // 组装返回数据
// resultMap.put(record, saveData);
// }
// }
//
// }
// return resultMap;
// }
@Override
public Map<String, Object> commonUpdateEsDataByIds(Map<String, Map<String, Object>> paramMap) {
if (paramMap.isEmpty()) {
return null;
}
String oldUscUnitCreditCode = "";
String oldUscUnitName = "";
Map<String, Object> resultMap = new HashMap<>();
Map<String, ESEquipmentCategoryDto> oldDataMap = new HashMap<>();
List<ESEquipmentCategoryDto> saveList = new ArrayList<>();
// 批量获取旧数据
for (String record : paramMap.keySet()) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
optional.ifPresent(dto -> oldDataMap.put(record, dto));
}
for (Map.Entry<String, Map<String, Object>> entry : paramMap.entrySet()) {
String record = entry.getKey();
Map<String, Object> childMap = entry.getValue();
if (!childMap.isEmpty()) {
ESEquipmentCategoryDto oldData = null;
// 获取Es中旧的数据
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (!ObjectUtils.isEmpty(optional)) {
oldData = optional.get();
oldUscUnitCreditCode = oldData.getUSC_UNIT_CREDIT_CODE();
oldUscUnitName = oldData.getUSC_UNIT_NAME();
}
// 获取Es中新的参数
ESEquipmentCategoryDto newData = JSON.parseObject(toJSONString(childMap), ESEquipmentCategoryDto.class);
String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
String newUscUnitName = newData.getUSC_UNIT_NAME();
// 删除Es中旧的数据
if (!ObjectUtils.isEmpty(oldData)) {
esEquipmentCategory.deleteById(record);
// 整合新旧数据
ESEquipmentCategoryDto oldData = oldDataMap.get(record);
ESEquipmentCategoryDto newData = JSON.parseObject(JSON.toJSONString(childMap), ESEquipmentCategoryDto.class);
if (oldData != null) {
Bean.copyExistPropertis(newData, oldData);
// 处理施工单位信息[去重]
String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
String newUscUnitName = newData.getUSC_UNIT_NAME();
if (!ValidationUtil.isEmpty(newUscUnitCreditCode)) {
// if (!ValidationUtil.isEmpty(oldUscUnitCreditCode)) {
// if (!oldUscUnitCreditCode.contains(newUscUnitCreditCode)) {
// oldData.setUSC_UNIT_CREDIT_CODE(oldUscUnitCreditCode + "," + newUscUnitCreditCode);
// oldData.setUSC_UNIT_NAME(oldUscUnitName + "," + newUscUnitName);
// }
// } else {
oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
oldData.setUSC_UNIT_NAME(newUscUnitName);
// }
oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
oldData.setUSC_UNIT_NAME(newUscUnitName);
}
}
if (!ObjectUtils.isEmpty(oldData)) {
oldData.setREC_DATE(System.currentTimeMillis());
ESEquipmentCategoryDto saveData = esEquipmentCategory.save(oldData);
// 组装返回数据
resultMap.put(record, saveData);
saveList.add(oldData);
}
}
}
// 批量删除旧数据
esEquipmentCategory.deleteAll(oldDataMap.values());
// 批量保存新数据
Iterable<ESEquipmentCategoryDto> savedData = esEquipmentCategory.saveAll(saveList);
// 组装返回数据
Map<String, Object> resultMap = new HashMap<>();
savedData.forEach(dto -> resultMap.put(dto.getSEQUENCE_NBR(), dto));
return resultMap;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment