Commit 132c9620 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_bugfix

parents 856b8fb1 66132b3a
......@@ -17,8 +17,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -26,10 +24,15 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
/**
* 气瓶service
......@@ -48,11 +51,11 @@ public class CylinderService {
private final TmCylinderFillingRecordService cylinderFillingRecordService;
private final TmCylinderFillingService cylinderFillingService;
private final PlatformTransactionManager transactionManager;
private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final BlockingQueue<CylinderFillingMessageModel> blockingQueue = new LinkedBlockingQueue<>();
public CylinderService(RedisTemplate redisTemplate, CylinderFillingDataValidationService cylinderFillingDataValidationService, TmCylinderFillingMessageService cylinderFillingMessageService, EmqKeeper emqKeeper, TmCylinderFillingCheckService cylinderFillingCheckService, TmCylinderFillingRecordService cylinderFillingRecordService, TmCylinderFillingService cylinderFillingService, PlatformTransactionManager transactionManager) {
public CylinderService(RedisTemplate redisTemplate, CylinderFillingDataValidationService cylinderFillingDataValidationService, TmCylinderFillingMessageService cylinderFillingMessageService, EmqKeeper emqKeeper, TmCylinderFillingCheckService cylinderFillingCheckService, TmCylinderFillingRecordService cylinderFillingRecordService, TmCylinderFillingService cylinderFillingService) {
this.redisTemplate = redisTemplate;
this.cylinderFillingDataValidationService = cylinderFillingDataValidationService;
this.cylinderFillingMessageService = cylinderFillingMessageService;
......@@ -60,7 +63,6 @@ public class CylinderService {
this.cylinderFillingCheckService = cylinderFillingCheckService;
this.cylinderFillingRecordService = cylinderFillingRecordService;
this.cylinderFillingService = cylinderFillingService;
this.transactionManager = transactionManager;
}
@DSTransactional
......@@ -101,8 +103,8 @@ public class CylinderService {
emqKeeper.getMqttClient().publish("openapi/cylinder/filling", JSONObject.fromObject(cylinderFillingMessage).toString().getBytes(), 2, false);
}
@Transactional
public JSONArray validateFillingData(JSONObject jsonobject, CylinderFillingMessage cylinderFillingMessage) throws MqttException {
// @Transactional
public JSONArray validateFillingData(JSONObject jsonobject, CylinderFillingMessage cylinderFillingLogMessage) throws MqttException {
CylinderFillingDataValidationResultModel validateResult = null;
try {
......@@ -110,13 +112,13 @@ public class CylinderService {
} catch (Exception e) {
e.printStackTrace();
logger.error("液化气体气瓶充装信息上报,数据校验失败");
cylinderFillingMessage.setMessage(e.getMessage());
cylinderFillingLogMessage.setMessage(e.getMessage());
}
JSONArray errorData = new JSONArray();
if (!ObjectUtils.isEmpty(validateResult)) {
cylinderFillingMessage.setCylinderNumber(validateResult.getCylinderNumber());
cylinderFillingLogMessage.setCylinderNumber(validateResult.getCylinderNumber());
List<String> message = new ArrayList<>();
int errorNumber = 0;
JSONObject error = new JSONObject();
......@@ -144,23 +146,46 @@ public class CylinderService {
if (!ObjectUtils.isEmpty(validateResult.getSeqCodeErrorData())) {
errorNumber += validateResult.getSeqCodeErrorData().size();
error.put("气瓶信息不存在:", validateResult.getSeqCodeErrorData());
message.add("气瓶信息不存在数量:" + validateResult.getSeqCodeErrorData().size());
message.add("气瓶信息不存在数量:" + validateResult.getSeqCodeErrorData().size() + "个");
errorData.add(error);
}
if (errorNumber <= 0) {
message.add("液化气体气瓶充装信息成功数:" + validateResult.getSuccessCylinderNumber() + "条");
cylinderFillingLogMessage.setMessage("液化气体气瓶充装信息成功数:" + validateResult.getSuccessCylinderNumber() + "条");
} else {
cylinderFillingMessage.setMessage(String.join("条; ", message) + "个");
CylinderFillingMessageModel cylinderFillingMessageModel = new CylinderFillingMessageModel();
BeanUtils.copyProperties(cylinderFillingMessage, cylinderFillingMessageModel);
cylinderFillingMessageService.createWithModel(cylinderFillingMessageModel);
emqKeeper.getMqttClient().publish("openapi/cylinder/filling", JSONObject.fromObject(cylinderFillingMessage).toString().getBytes(), 2, false);
throw new BadRequest(error.toString());
cylinderFillingLogMessage.setMessage(String.join("条; ", message));
// cylinderFillingMessageService.createWithModel(cylinderFillingMessageModel);
emqKeeper.getMqttClient().publish("openapi/cylinder/filling", JSONObject.fromObject(cylinderFillingLogMessage).toString().getBytes(), 2, false);
}
CylinderFillingMessageModel cylinderFillingMessageModel = new CylinderFillingMessageModel();
BeanUtils.copyProperties(cylinderFillingLogMessage, cylinderFillingMessageModel);
// 充装信息概览放入blockingQueue
blockingQueue.add(cylinderFillingMessageModel);
} else {
errorData.add(new JSONObject().put("数据校验失败", "数据校验失败"));
}
return errorData;
}
@PostConstruct
void init() {
ExecutorService executorService = Executors.newFixedThreadPool(3);
for (int i = 0; i < 3; i++) {
executorService.execute(() -> {
try {
while (true) {
logger.info("处理气瓶对接错误信息入库~开始");
CylinderFillingMessageModel cylinderFillingMessageModel = blockingQueue.take();
cylinderFillingMessageService.createWithModel(cylinderFillingMessageModel);
logger.info("处理气瓶对接错误信息入库~完成");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
logger.error("处理气瓶对接错误信息入库异常", e);
throw new RuntimeException(e);
}
});
}
}
}
......@@ -2,10 +2,7 @@ package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.*;
@Getter
public enum IssueTypeEnum {
......@@ -83,4 +80,25 @@ public enum IssueTypeEnum {
return list;
}
public static List<String> getEnumCodeListByMainBody(String mainBody) {
List<String> list = new ArrayList<>();
for (IssueTypeEnum testEnum : EnumSet.allOf(IssueTypeEnum.class)) {
if(testEnum.getMainBody().contains(mainBody)){
list.add(testEnum.getCode());
}
}
return list;
}
public static List<Map<String, String>> getEnumListByMainBody(String mainBody) {
List<Map<String, String>> list = new ArrayList<>();
for (IssueTypeEnum testEnum : EnumSet.allOf(IssueTypeEnum.class)) {
if(testEnum.getMainBody().contains(mainBody)){
Map<String, String> map = new HashMap<>();
map.put("name",testEnum.getName());
map.put("code",testEnum.getCode());
list.add(map);
}
}
return list;
}
}
......@@ -8,18 +8,18 @@ import java.util.*;
@Getter
@AllArgsConstructor
public enum ZBGLEnum {
YJCZ("应急处置","yjcz",true,null,""),
DTGZYYZBFX("电梯故障原因占比分析","dtgzyyzbfx",false,"yjcz","dtgzyyzbfxServiceImpl"),
DTKRSJCSFX("电梯困人事件场所分布","dtkrsjcsfx",false,"yjcz","dtkrsjcsfxServiceImpl"),
KRJYYDQK("困人救援月度情况","krjyydqk",false,"yjcz","krjyydqkServiceImpl"),
JDGL("监督管理","jdgl",true,null,""),
YWBLPJSXTJ("业务办理平均时效统计","ywblpjsxtj",false,"jdgl",""),
AQZS("安全追溯","aqzs",true,null,""),
YHSLQS("隐患数量趋势(近12个月)","yhslqs",false,"aqzs",""),
AYHLXYHSLPM("按隐患类型隐患数量排名(Top10)","ayhlxyhslpm",false,"aqzs",""),
DNZTDWYHPM("当年主体单位隐患排名(Top10)","dnztdwyhpm",false,"aqzs",""),
QP("气瓶","qp",true,null,""),
QYAQZSTJ("区域安全指数统计","qyaqzstj",false,"qp",""),
YJCZ("应急处置","yjcz",true,null,"",false),
DTGZYYZBFX("电梯故障原因占比分析","dtgzyyzbfx",false,"yjcz","dtgzyyzbfxServiceImpl",false),
DTKRSJCSFX("电梯困人事件场所分布","dtkrsjcsfx",false,"yjcz","dtkrsjcsfxServiceImpl",false),
KRJYYDQK("困人救援月度情况","krjyydqk",false,"yjcz","krjyydqkServiceImpl",false),
JDGL("监督管理","jdgl",true,null,"",false),
YWBLPJSXTJ("业务办理平均时效统计","ywblpjsxtj",false,"jdgl","ywblpjsxtjServiceImpl",false),
AQZS("安全追溯","aqzs",true,null,"",false),
// YHSLQS("隐患数量趋势(近12个月)","yhslqs",false,"aqzs","",false),
AYHLXYHSLPM("按隐患类型隐患数量排名(Top10)","ayhlxyhslpm",false,"aqzs","ayhlxyhslpmServiceImpl",false),
DNZTDWYHPM("当年主体单位隐患排名(Top10)","dnztdwyhpm",false,"aqzs","dnztdwyhpmServiceImpl",true),
QP("气瓶","qp",true,null,"",false),
QYAQZSTJ("区域安全指数统计","qyaqzstj",false,"qp","qyaqzstjServiceImpl",false),
;
......@@ -28,6 +28,7 @@ public enum ZBGLEnum {
Boolean isMainBody;
String mainBody;
String className;
Boolean havePage;
public static List<Map<String,Object>> getEnumList() {
List<Map<String,Object>> result = new ArrayList<>();
......@@ -42,6 +43,7 @@ public enum ZBGLEnum {
HashMap<String,Object> childrenMap = new HashMap<>();
childrenMap.put("title",childrenEnum.name);
childrenMap.put("value",childrenEnum.code);
childrenMap.put("havePage",childrenEnum.havePage);
childrenList.add(childrenMap);
}
}
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.*;
import java.util.Date;
/**
* 三环系统-车辆信息表
*
* @author system_generator
* @date 2024-11-08
*/
@Data
@ApiModel(value = "ShCarDto", description = "三环系统-车辆信息表")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ShCarDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "seq")
@TableId("SEQUENCE_NBR")
private String sequenceNbr;
@ApiModelProperty(value = "登记机关")
@TableField("REGISTRATION_AGENCY")
private String registrationAgency;
@ApiModelProperty(value = "登记机关代码")
@TableField("REGISTRATION_AGENCY_CODE")
private String registrationAgencyCode;
@ApiModelProperty(value = "使用登记证代码")
@TableField("USE_REGISTRATION_CODE")
private String useRegistrationCode;
@ApiModelProperty(value = "气瓶安装日期")
@TableField("INSTALL_START_DATE")
private Date installStartDate;
@ApiModelProperty(value = "车辆属性 A 代表 私家车 B代表公交车 C代表快捷货运 H 代表营运车 P代表公务车 V 代表微型货运车 X代表 其他 T代表出租车 J代表教练车 ")
@TableField("VEHICLE_ATTRIBUTE")
private String vehicleAttribute;
@ApiModelProperty(value = "车牌号")
@TableField("CAR_NUMBER")
private String carNumber;
@ApiModelProperty(value = "车架号")
@TableField("FRAME_NUMBER")
private String frameNumber;
@ApiModelProperty(value = "登记日期")
@TableField("REG_DATE")
private Date regDate;
@ApiModelProperty(value = "停用日期")
@TableField("DEA_DATE")
private Date deaDate;
@ApiModelProperty(value = "发动机号")
@TableField("ENGINE_NUMBER")
private String engineNumber;
@ApiModelProperty(value = "气瓶数量")
@TableField("BATCH_QUANTITY")
private Integer batchQuantity;
@ApiModelProperty(value = "车辆品牌型号")
@TableField("VEHICLE_BRAND_MODEL")
private String vehicleBrandModel;
@ApiModelProperty(value = "证打印标识")
@TableField("CERTIFICATE_PRINT_FLAG")
private String certificatePrintFlag;
@ApiModelProperty(value = "联系人")
@TableField("CONTACT_PERSON")
private String contactPerson;
@ApiModelProperty(value = "联系电话")
@TableField("CONTACT_PHONE")
private String contactPhone;
@ApiModelProperty(value = "所有人")
@TableField("OWNER")
private String owner;
@ApiModelProperty(value = "安装单位")
@TableField("INSTALLATION_UNIT")
private String installationUnit;
@ApiModelProperty(value = "改装车是否打印备案通知单 原装车 忽略看")
@TableField("IF_FLAG")
private String ifFlag;
@ApiModelProperty(value = "第一次打印证日期")
@TableField("PRINT_DATE")
private Date printDate;
@ApiModelProperty(value = "充装介质")
@TableField("MEDIA")
private String media;
@ApiModelProperty(value = "最新检验报告编号")
@TableField("LAST_INSPECT_REPORT_NO")
private String lastInspectReportNo;
@ApiModelProperty(value = "气瓶状态 0正常 1变更 2报废 3注销 4启用 5停用 6注销")
@TableField("STATE")
private Integer state;
@ApiModelProperty(value = "登记单位")
@TableField("REG_UNIT")
private String regUnit;
@ApiModelProperty(value = "总容积")
@TableField("TOTAL_VOLUME")
private String totalVolume;
@ApiModelProperty(value = "监检/检验单位")
@TableField("INSPECTION_UNIT")
private String inspectionUnit;
@ApiModelProperty(value = "气瓶加装方式")
@TableField("CYLINDER_INSTALLATION_METHOD")
private String cylinderInstallationMethod;
@ApiModelProperty(value = "住址")
@TableField("ADDRESS")
private String address;
@ApiModelProperty(value = "上一次检验报告编号")
@TableField("PREVIOUS_INSPECTION_REPORT_NUMBER")
private String previousInspectionReportNumber;
@ApiModelProperty(value = "是否认领 1已认领 0未认领")
@TableField("CLAIMED_FLAG")
private String claimedFlag;
@ApiModelProperty(value = "登记证管理表的seq")
@TableField(exist = false)
private String certificateSeq;
@ApiModelProperty(value = "单位类型,个人、企业")
@TableField(exist = false)
private String companyType;
@ApiModelProperty(value = "使用单位名称")
@TableField(exist = false)
private String useUnitName;
@ApiModelProperty(value = "使用单位统一社会信用代码")
@TableField(exist = false)
private String useUnitCreditCode;
@ApiModelProperty(value = "使用单位地址")
@TableField(exist = false)
private String useUnitAddress;
@ApiModelProperty(value = "安全管理员")
@TableField(exist = false)
private String safetyManagerId;
@ApiModelProperty(value = "安全管理员联系电话")
@TableField(exist = false)
private String phone;
}
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.*;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2024-11-08
*/
@Data
@ApiModel(value="ShCarEquDto", description="")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ShCarEquDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "primary key")
@TableId("SEQUENCE_NBR")
private String sequenceNbr;
@ApiModelProperty(value = "tzs_sh_car表主键")
@TableField("CAR_ID")
private String carId;
@ApiModelProperty(value = "设备编号")
@TableField("SEQUENCE_CODE")
private String sequenceCode;
@ApiModelProperty(value = "设备代码")
@TableField("EQU_CODE")
private String equCode;
@ApiModelProperty(value = "制造日期")
@TableField("PRODUCE_DATE")
private Date produceDate;
@ApiModelProperty(value = "安装日期")
@TableField("EQU_INSTALLDATE")
private Date equInstalldate;
@ApiModelProperty(value = "检查日期")
@TableField("EQU_CHECKDATE")
private Date equCheckdate;
@ApiModelProperty(value = "firstDate")
@TableField("EQU_FIRSTDATE")
private Date equFirstdate;
@ApiModelProperty(value = "序号")
@TableField("SERIAL_NUMBER")
private String serialNumber;
@ApiModelProperty(value = "sub_DM 代码")
@TableField("EQU_DM")
private String equDm;
@ApiModelProperty(value = "单位编号")
@TableField("EQU_DWBH")
private String equDwbh;
@ApiModelProperty(value = "公称工作压力(MPa)")
@TableField("EQU_QPGC")
private String equQpgc;
@ApiModelProperty(value = "气瓶批号")
@TableField("BATCH_NUMBER")
private String batchNumber;
@ApiModelProperty(value = "PFZZDW PF制造单位")
@TableField("EQU_PFZZDW")
private String equPfzzdw;
@ApiModelProperty(value = "isChange")
@TableField("ISCHANGE")
private Integer ischange;
@ApiModelProperty(value = "报告编号")
@TableField("REPORTCODE")
private String reportcode;
@ApiModelProperty(value = "BFReportCode")
@TableField("BFREPORTCODE")
private String bfreportcode;
@ApiModelProperty(value = "操作方式")
@TableField("EQU_CZFS")
private String equCzfs;
@ApiModelProperty(value = "是否认领 1已认领 0未认领")
@TableField("CLAIMED_FLAG")
private String claimedFlag;
}
......@@ -3,9 +3,7 @@ package com.yeejoin.amos.boot.module.jg.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.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import java.util.Date;
......@@ -18,6 +16,9 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("tzs_jg_certificate_change_record")
public class JgCertificateChangeRecord extends BaseEntity {
......
......@@ -2,9 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
......@@ -16,6 +15,9 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("tzs_jg_certificate_change_record_eq")
public class JgCertificateChangeRecordEq extends BaseEntity {
......
......@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import java.util.Date;
......@@ -20,6 +19,9 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("tzs_jg_use_registration_manage")
public class JgUseRegistrationManage extends BaseEntity {
......@@ -208,12 +210,4 @@ public class JgUseRegistrationManage extends BaseEntity {
*/
@TableField("change_reason")
private String changeReason;
/**
*
* 登记机关名称
*/
@TableField("reg_unit_name")
private String regUnitName;
}
......@@ -3,8 +3,7 @@ package com.yeejoin.amos.boot.module.jg.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.*;
import lombok.experimental.Accessors;
import java.util.Date;
......@@ -17,6 +16,9 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("tzs_jg_vehicle_information")
public class JgVehicleInformation extends BaseEntity {
......
......@@ -3,8 +3,7 @@ package com.yeejoin.amos.boot.module.jg.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.*;
import lombok.experimental.Accessors;
import java.util.Date;
......@@ -17,6 +16,9 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("tzs_jg_vehicle_information_eq")
public class JgVehicleInformationEq extends BaseEntity {
......
package com.yeejoin.amos.boot.module.jg.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.*;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 三环系统-车辆信息表
*
* @author system_generator
* @date 2024-11-08
*/
@Data
@Accessors(chain = true)
@TableName("tzs_sh_car")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ShCar {
private static final long serialVersionUID = 1L;
/**
* seq
*/
@TableField(value = "\"SEQUENCE_NBR\"")
@TableId(
value = "\"SEQUENCE_NBR\"",
type = IdType.ID_WORKER
)
private String sequenceNbr;
/**
* 登记机关
*/
@TableField(value = "\"REGISTRATION_AGENCY\"")
private String registrationAgency;
/**
* 登记机关代码
*/
@TableField(value = "\"REGISTRATION_AGENCY_CODE\"")
private String registrationAgencyCode;
/**
* 使用登记证代码
*/
@TableField(value = "\"USE_REGISTRATION_CODE\"")
private String useRegistrationCode;
/**
* 气瓶安装日期
*/
@TableField(value = "\"INSTALL_START_DATE\"")
private Date installStartDate;
/**
* 车辆属性
* A 代表 私家车 B代表公交车 C代表快捷货运 H 代表营运车 P代表公务车 V 代表微型货运车 X代表 其他 T代表出租车 J代表教练车
*/
@TableField(value = "\"VEHICLE_ATTRIBUTE\"")
private String vehicleAttribute;
/**
* 车牌号
*/
@TableField(value = "\"CAR_NUMBER\"")
private String carNumber;
/**
* 车架号
*/
@TableField(value = "\"FRAME_NUMBER\"")
private String frameNumber;
/**
* 登记日期
*/
@TableField(value = "\"REG_DATE\"")
private Date regDate;
/**
* 停用日期
*/
@TableField(value = "\"DEA_DATE\"")
private Date deaDate;
/**
* 发动机号
*/
@TableField(value = "\"ENGINE_NUMBER\"")
private String engineNumber;
/**
* 气瓶数量
*/
@TableField(value = "\"BATCH_QUANTITY\"")
private Integer batchQuantity;
/**
* 车辆品牌型号
*/
@TableField(value = "\"VEHICLE_BRAND_MODEL\"")
private String vehicleBrandModel;
/**
* 证打印标识
*/
@TableField(value = "\"CERTIFICATE_PRINT_FLAG\"")
private String certificatePrintFlag;
/**
* 联系人
*/
@TableField(value = "\"CONTACT_PERSON\"")
private String contactPerson;
/**
* 联系电话
*/
@TableField(value = "\"CONTACT_PHONE\"")
private String contactPhone;
/**
* 所有人
*/
@TableField(value = "\"OWNER\"")
private String owner;
/**
* 安装单位
*/
@TableField(value = "\"INSTALLATION_UNIT\"")
private String installationUnit;
/**
* 改装车是否打印备案通知单
* 原装车 忽略看
*/
@TableField(value = "\"IF_FLAG\"")
private String ifFlag;
/**
* 第一次打印证日期
*/
@TableField(value = "\"PRINT_DATE\"")
private Date printDate;
/**
* 充装介质
*/
@TableField(value = "\"MEDIA\"")
private String media;
/**
* 最新检验报告编号
*/
@TableField(value = "\"LAST_INSPECT_REPORT_NO\"")
private String lastInspectReportNo;
/**
* 气瓶状态
* 0正常 1变更 2报废 3注销 4启用 5停用 6注销
*/
@TableField(value = "\"STATE\"")
private Integer state;
/**
* 登记单位
*/
@TableField(value = "\"REG_UNIT\"")
private String regUnit;
/**
* 总容积
*/
@TableField(value = "\"TOTAL_VOLUME\"")
private String totalVolume;
/**
* 监检/检验单位
*/
@TableField(value = "\"INSPECTION_UNIT\"")
private String inspectionUnit;
/**
* 气瓶加装方式
*/
@TableField(value = "\"CYLINDER_INSTALLATION_METHOD\"")
private String cylinderInstallationMethod;
/**
* 住址
*/
@TableField(value = "\"ADDRESS\"")
private String address;
/**
* 上一次检验报告编号
*/
@TableField(value = "\"PREVIOUS_INSPECTION_REPORT_NUMBER\"")
private String previousInspectionReportNumber;
/**
* 是否认领 1已认领 0未认领
*/
@TableField(value = "\"CLAIMED_FLAG\"")
private String claimedFlag;
}
package com.yeejoin.amos.boot.module.jg.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.*;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author system_generator
* @date 2024-11-08
*/
@Data
@Accessors(chain = true)
@TableName("tzs_sh_car_equ")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ShCarEqu {
private static final long serialVersionUID = 1L;
/**
* primary key
*/
@TableField(value = "\"SEQUENCE_NBR\"")
@TableId(
value = "\"SEQUENCE_NBR\"",
type = IdType.ID_WORKER
)
private String sequenceNbr;
/**
* tzs_sh_car表主键
*/
@TableField(value = "\"CAR_ID\"")
private String carId;
/**
* 设备编号
*/
@TableField(value = "\"SEQUENCE_CODE\"")
private String sequenceCode;
/**
* 设备代码
*/
@TableField(value = "\"EQU_CODE\"")
private String equCode;
/**
* 制造日期
*/
@TableField(value = "\"PRODUCE_DATE\"")
private Date produceDate;
/**
* 安装日期
*/
@TableField(value = "\"EQU_INSTALLDATE\"")
private Date equInstalldate;
/**
* 检查日期
*/
@TableField(value = "\"EQU_CHECKDATE\"")
private Date equCheckdate;
/**
* firstDate
*/
@TableField(value = "\"EQU_FIRSTDATE\"")
private Date equFirstdate;
/**
* 序号
*/
@TableField(value = "\"SERIAL_NUMBER\"")
private String serialNumber;
/**
* sub_DM 代码
*/
@TableField(value = "\"EQU_DM\"")
private String equDm;
/**
* 单位编号
*/
@TableField(value = "\"EQU_DWBH\"")
private String equDwbh;
/**
* 公称工作压力(MPa)
*/
@TableField(value = "\"EQU_QPGC\"")
private String equQpgc;
/**
* 气瓶批号
*/
@TableField(value = "\"BATCH_NUMBER\"")
private String batchNumber;
/**
* PFZZDW PF制造单位
*/
@TableField(value = "\"EQU_PFZZDW\"")
private String equPfzzdw;
/**
* isChange
*/
@TableField(value = "\"ISCHANGE\"")
private Integer ischange;
/**
* 报告编号
*/
@TableField(value = "\"REPORTCODE\"")
private String reportcode;
/**
* BFReportCode
*/
@TableField(value = "\"BFREPORTCODE\"")
private String bfreportcode;
/**
* 操作方式
*/
@TableField(value = "\"EQU_CZFS\"")
private String equCzfs;
/**
* 是否认领 1已认领 0未认领
*/
@TableField(value = "\"CLAIMED_FLAG\"")
private String claimedFlag;
@TableField(value = "\"PRODUCE_UNIT_NAME\"")
private String produceUnitName;
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper 接口
*
* @author system_generator
* @date 2024-11-08
*/
public interface ShCarEquMapper extends BaseMapper<ShCarEqu> {
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 三环系统-车辆信息表 Mapper 接口
*
* @author system_generator
* @date 2024-11-08
*/
public interface ShCarMapper extends BaseMapper<ShCar> {
Page<ShCarDto> queryForshCarPage(Page<ShCarDto> page, ShCarDto dto);
}
package com.yeejoin.amos.boot.module.jg.api.service;
/**
* 接口类
*
* @author system_generator
* @date 2024-11-08
*/
public interface IShCarEquService {}
package com.yeejoin.amos.boot.module.jg.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import java.util.Map;
/**
* 三环系统-车辆信息表接口类
*
* @author system_generator
* @date 2024-11-08
*/
public interface IShCarService {
Page<ShCarDto> queryForShCarPage(Page<ShCarDto> page, ShCarDto dto);
Boolean claim(Map<String, Object> paramMap);
}
package com.yeejoin.amos.boot.module.jg.api.vo;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
/**
* @author chang xiangyu 2024/11/12
*/
@Data
@AllArgsConstructor
public class CarAndEquVo {
private ShCarDto shCar;
private List<ShCarEquVo> shCarEquVoList;
}
package com.yeejoin.amos.boot.module.jg.api.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import lombok.Data;
import java.util.Date;
/**
* @author chang xiangyu 2024/11/12
*/
@Data
public class ShCarEquVo {
/**
* primary key
*/
private String sequenceNbr;
/**
* tzs_sh_car表主键
*/
private String carId;
/**
* 设备编号sequenceCode
*/
private String sequenceCode;
/**
* 设备代码
*/
private String equCode;
/**
* 制造日期
*/
private Date produceDate;
/**
* 安装日期
*/
private Date equInstalldate;
/**
* 检查日期
*/
private Date equCheckdate;
/**
* firstDate
*/
private Date equFirstdate;
/**
* 序号
*/
private String serialNumber;
/**
* sub_DM 代码
*/
private String equDm;
/**
* 单位编号 equDwbh
*/
private String UseInnerCode;
/**
* 公称工作压力(MPa) equQpgc
*/
private String nominalWorkingPressure;
/**
* 气瓶批号
*/
private String batchNumber;
/**
* PFZZDW PF制造单位
*/
private String equPfzzdw;
/**
* isChange
*/
private Integer ischange;
/**
* 报告编号
*/
private String reportcode;
/**
* BFReportCode
*/
private String bfreportcode;
/**
* 操作方式
*/
private String equCzfs;
/**
* 是否认领
*/
private String claimedFlag;
private String produceUnitName;
public ShCarEquVo(ShCarEqu shCarEqu) {
this.setSequenceNbr(shCarEqu.getSequenceNbr());
this.setCarId(shCarEqu.getCarId());
this.setEquCode(shCarEqu.getEquCode());
this.setUseInnerCode(shCarEqu.getEquDwbh());
this.setNominalWorkingPressure(shCarEqu.getEquQpgc());
this.setProduceUnitName(shCarEqu.getProduceUnitName());
}
}
......@@ -957,10 +957,15 @@
SELECT COUNT( 1 )
FROM idx_biz_jg_register_info jri
LEFT JOIN idx_biz_jg_other_info joi ON joi."RECORD" = jri."RECORD"
WHERE
jri."USE_ORG_CODE" = #{useRegistrationCode}
AND jri."RECORD" != #{equipId}
<where>
<if test="useRegistrationCode != null and useRegistrationCode != ''">
jri."USE_ORG_CODE" = #{useRegistrationCode}
</if>
<if test="equipId != null and equipId != ''">
AND jri."RECORD" != #{equipId}
</if>
AND joi.CLAIM_STATUS = '已认领'
</where>
</select>
<select id="queryOutOfMaintenanceRecord" resultType="java.util.Map">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.ShCarEquMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.ShCarMapper">
<select id="queryForshCarPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto">
select
*
FROM tzs_sh_car tsc
<where>
<if test="dto != null ">
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND tsc.USE_REGISTRATION_CODE LIKE CONCAT('%', #{dto.useRegistrationCode}, '%')
</if>
<if test="dto.carNumber != null and dto.carNumber != ''">
AND tsc.CAR_NUMBER LIKE CONCAT('%', #{dto.carNumber}, '%')
</if>
<if test="dto.frameNumber != null and dto.frameNumber != ''">
AND tsc.FRAME_NUMBER LIKE CONCAT('%', #{dto.frameNumber}, '%')
</if>
<if test="dto.claimedFlag != null and dto.claimedFlag != ''">
AND tsc.CLAIMED_FLAG = #{dto.claimedFlag}
</if>
</if>
</where>
ORDER BY
tsc.USE_REGISTRATION_CODE DESC
</select>
</mapper>
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.yeejoin.amos.boot.module.jg.api.service.IShCarService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationManageServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.ShCarEquServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.ShCarServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.*;
/**
* @author system_generator
* @date 2024-11-08
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/sh-car")
public class ShCarController extends BaseController {
@Autowired
ShCarServiceImpl shCarServiceImpl;
@Resource
ShCarEquServiceImpl shCarEquServiceImpl;
@Autowired
IShCarService iShCarService;
@Autowired
JgUseRegistrationManageServiceImpl jgUseRegistrationManageServiceImpl;
/**
* 新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<ShCar> save(@RequestBody ShCar shCar) {
shCar = shCarServiceImpl.createWithModel(shCar);
return ResponseHelper.buildResponse(shCar);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<ShCar> updateBySequenceNbrShCar(@RequestBody ShCar entity, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
// entity.setSequenceNbr(sequenceNbr);
entity.setSequenceNbr(String.valueOf(sequenceNbr));
return ResponseHelper.buildResponse(shCarServiceImpl.updateWithModel(entity));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(shCarServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<ShCar> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(shCarServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param size 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<ShCarDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
ShCarDto dto) {
Page<ShCarDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
Page<ShCarDto> shCarDtoPage = iShCarService.queryForShCarPage(page, dto);
shCarDtoPage.getRecords().forEach(record -> {
if ("1".equals(record.getClaimedFlag())) {
record.setClaimedFlag("是");
// 填充 证管理表的seq,用与认领后跳转证详情页
JgUseRegistrationManage manage = jgUseRegistrationManageServiceImpl.getBaseMapper().selectOne(new LambdaQueryWrapper<JgUseRegistrationManage>()
.eq(JgUseRegistrationManage::getUseRegistrationCode, record.getUseRegistrationCode()));
record.setCertificateSeq(String.valueOf(manage.getSequenceNbr()));
} else if ("0".equals(record.getClaimedFlag())) {
record.setClaimedFlag("否");
}
});
return ResponseHelper.buildResponse(shCarDtoPage);
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<ShCar>> selectForList() {
return ResponseHelper.buildResponse(shCarServiceImpl.queryForShCarList());
}
/**
* 数据查询,校验是否是三环系统数据
*
* @return 结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "数据查询,校验是否是三环系统数据", notes = "数据查询,校验是否是三环系统数据")
@GetMapping(value = "/searchForSanHan")
public ResponseModel<ShCar> searchForSanHan(@RequestParam Map<?, ?> map) {
// 检查 map 是否为空
if (map == null || map.isEmpty()) {
return ResponseHelper.buildResponse(new ShCar()); // 返回空对象
}
ShCar shCar = null;
for (Object value : map.values()) {
String sanHuanInputValue = String.valueOf(value);
// 如果值为空,直接跳过
if (ValidationUtil.isEmpty(sanHuanInputValue)) {
continue;
}
// 查询 ShCar 表
shCar = shCarServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getClaimedFlag, Boolean.FALSE)
.and(w -> w
.eq(ShCar::getCarNumber, sanHuanInputValue)
.or()
.eq(ShCar::getUseRegistrationCode, sanHuanInputValue)
.or()
.eq(ShCar::getFrameNumber, sanHuanInputValue)
)
).stream().findFirst().orElse(null);
// 如果找到符合条件的 ShCar,直接返回
if (shCar != null && !ValidationUtil.isEmpty(shCar.getSequenceNbr())) {
return ResponseHelper.buildResponse(shCar);
}
// 查询 ShCarEqu 表
Optional<ShCarEqu> carEqu = shCarEquServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCarEqu>()
.eq(ShCarEqu::getEquCode, sanHuanInputValue))
.stream().findFirst();
// 如果 ShCarEqu 存在,继续查询 ShCar
if (carEqu.isPresent()) {
shCar = shCarServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getClaimedFlag, Boolean.FALSE)
.eq(ShCar::getSequenceNbr, carEqu.get().getCarId())
).stream().findFirst().orElse(null);
// 如果找到,直接返回
if (shCar != null && !ValidationUtil.isEmpty(shCar.getSequenceNbr())) {
return ResponseHelper.buildResponse(shCar);
}
}
}
// 如果未找到,返回空对象
return ResponseHelper.buildResponse(new ShCar());
}
/**
* 认领三环系统数据
*
* @return result
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "认领三环系统数据", notes = "认领三环系统数据")
@PostMapping(value = "/claim")
public ResponseModel<Boolean> claim(@RequestBody Map<String, Object> paramMap) {
return ResponseHelper.buildResponse(shCarServiceImpl.claim(paramMap));
}
}
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.yeejoin.amos.boot.module.jg.api.vo.CarAndEquVo;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.ShCarEquServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
/**
*
* @author system_generator
* @date 2024-11-08
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/sh-car-equ")
public class ShCarEquController extends BaseController {
@Autowired
ShCarEquServiceImpl shCarEquServiceImpl;
/**
* 新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<ShCarEqu> save(@RequestBody ShCarEqu shCarEqu) {
shCarEqu = shCarEquServiceImpl.createWithModel(shCarEqu);
return ResponseHelper.buildResponse(shCarEqu);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<ShCarEqu> updateBySequenceNbrShCarEqu(@RequestBody ShCarEqu entity,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
// entity.setSequenceNbr(sequenceNbr);
entity.setSequenceNbr(String.valueOf(sequenceNbr));
return ResponseHelper.buildResponse(shCarEquServiceImpl.updateWithModel(entity));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(shCarEquServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<ShCarEqu> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<ShCarEqu>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
Page<ShCarEqu> page = new Page<ShCarEqu>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryForShCarEquPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<ShCarEqu>> selectForList() {
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryForShCarEquList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "汽车详细信息列表", notes = "汽车详细信息列表")
@GetMapping(value = "/selectByCarId")
public ResponseModel<CarAndEquVo> selectByCarId(@RequestParam String carId) {
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryByCarId(carId,reginParams));
}
}
......@@ -283,6 +283,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
@Autowired
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
private ShCarEquServiceImpl shCarEquService;
@Autowired
private ShCarServiceImpl shCarService;
/**
* 将对象的属性由驼峰转为纯大写下划线格式
......@@ -394,6 +398,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
check96333Code(equipmentInfoForm);
// 气瓶 校验制造单位统一信用代码与出场编码唯一
checkFactoryNumUniqueWithGasCylinder(equipmentInfoForm, record);
// 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
checkIsSanHanData(equipmentInfoForm);
} catch (Exception e) {
handleError(e, null);
}
......@@ -442,6 +448,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
/**
* 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
* @param equipmentInfoForm 入参
*/
private void checkIsSanHanData(LinkedHashMap<?, ?> equipmentInfoForm) {
// 是否车用气瓶
if ("2000".equals(equipmentInfoForm.get(EQU_LIST)) && "2300".equals(equipmentInfoForm.get(EQU_CATEGORY))
&& "23T0".equals(equipmentInfoForm.get(EQU_DEFINE))
&& "1".equals(equipmentInfoForm.get(WHETHER_VEHICLE_CYLINDER))) {
String carNum = (String) equipmentInfoForm.get("USE_INNER_CODE");
String equCode = (String) equipmentInfoForm.get("EQU_CODE");
// 判断 设备代码EQU_CODE 和 单位内编号(车牌号)USE_INNER_CODE
Integer carCount = shCarService.getBaseMapper()
.selectCount(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getCarNumber, carNum)
.eq(ShCar::getClaimedFlag, Boolean.FALSE));
Integer equCount = shCarEquService.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCarEqu>()
.eq(ShCarEqu::getEquCode, equCode))
.stream()
.findFirst()
.map(equ -> shCarService.getBaseMapper().selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getSequenceNbr, equ.getCarId())
.eq(ShCar::getClaimedFlag, Boolean.FALSE))
.size()
).orElse(0);
if (carCount > 0 || equCount > 0) {
throw new BadRequest("原三环系统数据,请直接认领!");
}
}
}
private void check96333Code(LinkedHashMap equipmentInfoForm) {
if (!ObjectUtils.isEmpty(equipmentInfoForm.get(CODE96333))) {
// 根据96333码检查唯一性
......
......@@ -168,6 +168,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
private WorkFlowFeignService workFlowFeignService;
@Autowired
private JgUseRegistrationManageMapper jgUseRegistrationManageMapper;
@Autowired
private ShCarServiceImpl shCarServiceImpl;
private Map<String, Object> fillingMediumMap;
......@@ -1754,6 +1756,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
if (used){
throw new BadRequest("使用登记证编号已存在!");
}
// 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
this.checkIsSanSystemHanData(map);
//使用登记证编号判断是否使用未来系统生成编号
idxBizJgRegisterInfoService.checkUseRegistrationCode(useRegistrationCode1,"vehicle");
......@@ -1996,6 +2000,32 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
/**
* 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
* @param map 入参
*/
private void checkIsSanSystemHanData(JSONObject map) {
// 使用登记证号,车牌号,车辆VIN码(车架号)
String useRegistrationCode = (String) map.get("useRegistrationCode");
String carNumber = (String) map.get("carNumber");
String identificationCode = (String) map.get("identificationCode");
ShCar shCar = shCarServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getClaimedFlag, Boolean.FALSE)
.and(w -> w
.eq(ShCar::getCarNumber, carNumber)
.or()
.eq(ShCar::getUseRegistrationCode, useRegistrationCode)
.or()
.eq(ShCar::getFrameNumber, identificationCode)
)
).stream().findFirst().orElse(new ShCar());
if (!ValidationUtil.isEmpty(shCar.getSequenceNbr())) {
throw new BadRequest("原三环系统数据,请直接认领!");
}
}
/**
* 车用气瓶保存历史数据
*
* @param map map
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.yeejoin.amos.boot.module.jg.api.mapper.ShCarEquMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IShCarEquService;
import com.yeejoin.amos.boot.module.jg.api.vo.CarAndEquVo;
import com.yeejoin.amos.boot.module.jg.api.vo.ShCarEquVo;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.stream.Collectors;
/**
* 服务实现类
*
* @author system_generator
* @date 2024-11-08
*/
@Service
public class ShCarEquServiceImpl extends BaseService<ShCarEqu, ShCarEqu, ShCarEquMapper> implements IShCarEquService {
@Autowired
ShCarServiceImpl shCarServiceImpl;
@Autowired
ICommonService commonService;
/**
* 分页查询
*/
public Page<ShCarEqu> queryForShCarEquPage(Page<ShCarEqu> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<ShCarEqu> queryForShCarEquList() {
return this.queryForList("", false);
}
public CarAndEquVo queryByCarId(String carId, ReginParams reginParams) {
// 根据carId获取Car
LambdaQueryWrapper<ShCar> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ShCar::getSequenceNbr, carId);
ShCar shCar = shCarServiceImpl.getOne(queryWrapper1);
ShCarDto shCarDto = new ShCarDto();
BeanUtil.copyProperties(shCar, shCarDto);
// 补充信息
String companyType = reginParams.getCompany().getCompanyType();
AgencyUserModel userModel = reginParams.getUserModel();
shCarDto.setCompanyType(companyType);
shCarDto.setUseUnitName(reginParams.getCompany().getCompanyName());
shCarDto.setUseUnitCreditCode(reginParams.getCompany().getCompanyCode());
String[] code = reginParams.getCompany().getCompanyCode().split("_");
String useUnitCode = code.length > 1 ? code[1] : code[0];
if ("个人主体".equals(companyType)) {
shCarDto.setUseUnitAddress((String) commonService.getEnterpriseInfo(useUnitCode).get("address"));
} else {
shCarDto.setUseUnitAddress(reginParams.getCompany().getAddress());
}
shCarDto.setSafetyManagerId("个人主体".equals(companyType) ? userModel.getRealName() : null);
shCarDto.setPhone("个人主体".equals(companyType) ? userModel.getMobile() : null);
// 根据carId获取设备列表
LambdaQueryWrapper<ShCarEqu> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShCarEqu::getCarId, carId);
List<ShCarEqu> list = this.list(queryWrapper);
// 将设备列表转换为前端可识别bean
List<ShCarEquVo> collect = list.stream().map(shCarEqu -> new ShCarEquVo(shCarEqu)).collect(Collectors.toList());
// 封装返回VO
return new CarAndEquVo(shCarDto, collect);
}
}
\ No newline at end of file
......@@ -82,4 +82,9 @@ public class JyjcInspectionResultDataModel {
*/
private String traceId;
/**
* 设备唯一标识,record--首检时需要,此时设备无监管码及设备代码
*/
private String equipId;
}
......@@ -21,6 +21,7 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionApplicationPushEven
import com.yeejoin.amos.boot.module.jyjc.biz.kafka.KafkaProducer;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationEquipServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationPushLogServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JyjcConstant;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
......@@ -28,6 +29,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
......@@ -45,6 +47,11 @@ import java.util.stream.Collectors;
@Slf4j
public class InspectionApplicationPushEventListener implements ApplicationListener<InspectionApplicationPushEvent> {
@Value("classpath:/json/companyCodeRegName.json")
private Resource regNameJson;
private Map<String, String> companyCodeRegNameMap;
private BlockingQueue<JyjcInspectionApplicationModel> queue = new LinkedBlockingQueue<>();
@Value("${inspection.push.max.deal.thread.num:2}")
......@@ -107,6 +114,8 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
@Autowired
JgUseRegistrationManageMapper jgUseRegistrationManageMapper;
@Autowired
IdxBizJgDesignInfoMapper designInfoMapper;
/**
......@@ -133,6 +142,7 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
@PostConstruct
public void init() {
companyCodeRegNameMap = JsonUtils.getResourceJson(regNameJson);
ExecutorService executorService = Executors.newFixedThreadPool(threadNum);
// 可处理的检验检测类型,目前只处理检验的,不处理检测业务
List<String> canDealInspectionTypes = getCanDealInspectionType();
......@@ -207,9 +217,11 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
// 注册信息
this.setRegisterInfo(equipData, e.getEquipUnicode());
// 制造信息
this.setProductData(equipData,e.getEquipUnicode());
this.setProductData(equipData, e.getEquipUnicode());
// 设计信息
this.setDesignInfo(equipData, e.getEquipUnicode());
// 维保单位信息
this.setMaintenanceInfo(equipData,e.getEquipUnicode());
this.setMaintenanceInfo(equipData, e.getEquipUnicode());
// 单个查询执行,原因数据量较大 in 慢
this.setOtherInfo(equipData, e.getEquipUnicode(), applicationModel.getInspectionType());
// 单个查询执行,原因数据量较大 in 慢
......@@ -218,11 +230,20 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
}).collect(Collectors.toList());
}
private void setDesignInfo(InspectionEquipData equipData, String equipUnicode) {
IdxBizJgDesignInfo designInfo = designInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgDesignInfo>()
.eq(IdxBizJgDesignInfo::getRecord, equipUnicode)
.select(IdxBizJgDesignInfo::getRecord, IdxBizJgDesignInfo::getDesignUseDate));
if (designInfo != null) {
equipData.setDesignUseDate(designInfo.getDesignUseDate());
}
}
private void setMaintenanceInfo(InspectionEquipData equipData, String equipUnicode) {
MaintenanceInfo maintenanceInfo = maintenanceInfoMapper.selectOne(new LambdaQueryWrapper<MaintenanceInfo>()
.eq(AbstractEquipBaseEntity::getRecord, equipUnicode)
.select(MaintenanceInfo::getRecord,MaintenanceInfo::getMeUnitCreditCode,MaintenanceInfo::getMeUnitName));
if(maintenanceInfo != null){
.select(MaintenanceInfo::getRecord, MaintenanceInfo::getMeUnitCreditCode, MaintenanceInfo::getMeUnitName));
if (maintenanceInfo != null) {
equipData.setMeUnitCreditCode(maintenanceInfo.getMeUnitCreditCode());
equipData.setMeUnitName(maintenanceInfo.getMeUnitName());
}
......@@ -231,7 +252,7 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
private void setUseInfo(InspectionEquipData equipData, String equipUnicode) {
IdxBizJgUseInfo idxBizJgUseInfo = useInfoMapper.selectOne(
new LambdaQueryWrapper<IdxBizJgUseInfo>()
.eq(IdxBizJgUseInfo::getRecord, equipUnicode)
.eq(IdxBizJgUseInfo::getRecord, equipUnicode)
);
equipData.setUseInnerCode(idxBizJgUseInfo.getUseInnerCode());
equipData.setAddress(getAddressByRecord(idxBizJgUseInfo));
......@@ -245,7 +266,7 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
private void setRegisterInfo(InspectionEquipData equipData, String equipUnicode) {
LambdaQueryWrapper<IdxBizJgRegisterInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(IdxBizJgRegisterInfo::getEquType,IdxBizJgRegisterInfo::getRecord);
wrapper.select(IdxBizJgRegisterInfo::getEquType, IdxBizJgRegisterInfo::getRecord);
wrapper.eq(IdxBizJgRegisterInfo::getRecord, equipUnicode);
wrapper.select(IdxBizJgRegisterInfo::getRecord,
IdxBizJgRegisterInfo::getEquType,
......@@ -259,20 +280,21 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
equipData.setUseCertFilePath(jgRegisterInfo.getLastUseCertFilePath());
}
// 登记机关
if(equipData.getUseRegistrationCode() != null){
if (equipData.getUseRegistrationCode() != null) {
LambdaQueryWrapper<JgUseRegistrationManage> queryWrapper = new LambdaQueryWrapper<JgUseRegistrationManage>()
.eq(JgUseRegistrationManage::getUseRegistrationCode, equipData.getUseRegistrationCode())
.eq(JgUseRegistrationManage::getIsDelete, 0).select(JgUseRegistrationManage::getRegUnitName,BaseEntity::getSequenceNbr);
JgUseRegistrationManage jgUseRegistrationManage = jgUseRegistrationManageMapper.selectOne(queryWrapper);
if(jgUseRegistrationManage != null){
equipData.setRegUnitName(jgUseRegistrationManage.getRegUnitName());
.eq(JgUseRegistrationManage::getIsDelete, 0)
.select(JgUseRegistrationManage::getReceiveCompanyCode, BaseEntity::getSequenceNbr);
JgUseRegistrationManage manage = jgUseRegistrationManageMapper.selectOne(queryWrapper);
if (manage != null) {
equipData.setRegUnitName(companyCodeRegNameMap.getOrDefault(manage.getReceiveCompanyCode(), manage.getReceiveOrgName()));
}
}
}
private void setProductData(InspectionEquipData equipData, String record) {
IdxBizJgFactoryInfo idxBizJgFactoryInfo = factoryInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord,record));
if(idxBizJgFactoryInfo != null) {
IdxBizJgFactoryInfo idxBizJgFactoryInfo = factoryInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, record));
if (idxBizJgFactoryInfo != null) {
equipData.setFactoryNum(idxBizJgFactoryInfo.getFactoryNum());
equipData.setProduceUnitCreditCode(idxBizJgFactoryInfo.getProduceUnitCreditCode());
equipData.setProduceUnitName(idxBizJgFactoryInfo.getProduceUnitName());
......
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -26,4 +27,13 @@ public interface ZBGLStatisticsMapper {
Map<String, Long> getKRJYYDQKChartData(@Param("dpFilterParamForDetailDto") DPFilterParamForDetailDto dpFilterParamForDetailDto, @Param("time") String time);
Map<String,Long> getAYHLXYHSLPMChartData(@Param("dpFilterParamForDetailDto") DPFilterParamForDetailDto dpFilterParamForDetailDto);
List<Map<String,Long>> getAYHLXYHSLPMPageData(@Param("dpFilterParamForDetailDto") DPFilterParamForDetailDto dpFilterParamForDetailDto);
Map<String, Long> getDNZTDWYHPMChartData(@Param("dpFilterParamForDetailDto") DPFilterParamForDetailDto dpFilterParamForDetailDto, @Param("issueTypeList") List<String> issueTypeList);
Page<Map<String,Object>> getUnitByOrgCode(@Param("page") Page page, @Param("dpFilterParamForDetailDto") DPFilterParamForDetailDto dpFilterParamForDetailDto);
List<Map<String, Object>> getDNZTDWYHPMPageData(@Param("unitCodeList") List<String> unitCodeList);
}
......@@ -82,6 +82,71 @@
supervisory_unit_org_code
LIMIT 1
</select>
<select id="getAYHLXYHSLPMChartData" resultType="java.util.Map">
SELECT COUNT
( 1 ) AS allCount,
SUM ( CASE problem_status_code WHEN '1' THEN 1 ELSE 0 END ) AS endCount
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{dpFilterParamForDetailDto.orgCode}, '%' )
</select>
<select id="getAYHLXYHSLPMPageData" resultType="java.util.Map">
SELECT COUNT
( 1 ) AS longValue,
problem_type_code AS fieldValueCode
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{dpFilterParamForDetailDto.orgCode}, '%' )
GROUP BY
problem_type_code
</select>
<select id="getDNZTDWYHPMChartData" resultType="java.util.Map">
SELECT COUNT
( 1 ) AS allCount,
SUM ( CASE problem_status_code WHEN '1' THEN 1 ELSE 0 END ) AS endCount
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{dpFilterParamForDetailDto.orgCode}, '%' )
AND problem_type_code IN
(
<foreach collection="issueTypeList" item="item" separator=",">
#{item}
</foreach>
)
</select>
<select id="getUnitByOrgCode" resultType="java.util.Map">
SELECT
principal_unit_code AS principalUnitCode
FROM
tzs_safety_problem_tracing
WHERE
source_type_code = '2'
AND governing_body_org_code LIKE concat ( #{dpFilterParamForDetailDto.orgCode}, '%' )
GROUP BY
principal_unit_code
</select>
<select id="getDNZTDWYHPMPageData" resultType="java.util.Map">
SELECT COUNT
( 1 ),
principal_unit_code AS principalUnitCode,
problem_type_code AS problemTypeCode,
principal_unit AS principalUnit
FROM
tzs_safety_problem_tracing
WHERE
principal_unit_code IN (
<foreach collection="unitCodeList" item="item" separator=",">
#{item}
</foreach>
)
AND source_type_code = '2'
GROUP BY
principal_unit_code,
problem_type_code
</select>
</mapper>
......@@ -249,8 +249,8 @@ public class JYJCDPStatisticsServiceImpl {
List<Map<String, String>> typeNameList = UnitTypeEnum.getTypeNameList();
List<Map<String,Object>> result = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
map.put("title","人员类型");
map.put("value","0");
map.put("title","人员全部类型");
map.put("value","all");
map.put("children",typeNameList);
result.add(map);
return result;
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZBGLImpl;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.IZBGLService;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZBGLStatisticsMapper;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class AyhlxyhslpmServiceImpl implements IZBGLService {
@Resource
private StCommonServiceImpl stCommonService;
@Resource
private ZBGLStatisticsMapper zbglStatisticsMapper;
@Override
public Map<String, Object> getChart(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
List<Map<String,Object>> result = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode()+"");
DPFilterParamForDetailDto dpFilterParamForDetailDtoNew = new DPFilterParamForDetailDto();
dpFilterParamForDetailDtoNew.setOrgCode(orgCode);
Map<String, Object> itemResult = new HashMap<>();
Map<String,Long> map = zbglStatisticsMapper.getAYHLXYHSLPMChartData(dpFilterParamForDetailDtoNew);
if(map.get("allCount") != 0 && map.get("endCount") != 0){
itemResult.put("rate",BigDecimal.valueOf(map.get("endCount")).divide(BigDecimal.valueOf(map.get("allCount")),2, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString());
}else{
itemResult.put("rate","0");
}
itemResult.put("count",map.get("allCount"));
itemResult.put("xdata",r.getRegionName());
return itemResult;
}).collect(Collectors.toList());
Map<String,Object> returnMap = new HashMap<>();
List<Map<String,Object>> legendData = new ArrayList<>();
for(int i = 0;i<2; i++){
Map<String,Object> map = new HashMap<>();
if(i == 0){
map.put("dataKey","count");
map.put("value","隐患总数");
map.put("chartType","bar");
}else{
map.put("dataKey","rate");
map.put("value","完结率");
map.put("chartType","line");
}
legendData.add(map);
}
returnMap.put("legendData",legendData);
List xdata = new ArrayList();
List count = new ArrayList();
List rate = new ArrayList();
Long sum = 0L;
for(int i = 0;i<result.size();i++){
sum = sum + (Long)result.get(i).get("count");
}
for(int i = 0;i<result.size();i++){
xdata.add(result.get(i).get("xdata"));
count.add(result.get(i).get("count") == null ? "0" : result.get(i).get("count")+"");
rate.add(result.get(i).get("rate") == null ? "0" : result.get(i).get("rate")+"");
}
returnMap.put("xdata",xdata);
returnMap.put("count",count);
returnMap.put("rate",rate);
return returnMap;
}
@Override
public Page<Map<String, Object>> getPage(Page page,DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
List<Map<String,Object>> result = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode()+"");
DPFilterParamForDetailDto dpFilterParamForDetailDtoNew = new DPFilterParamForDetailDto();
dpFilterParamForDetailDtoNew.setOrgCode(orgCode);
Map<String, Object> itemResult = new HashMap<>();
List<Map<String,Long>> list = zbglStatisticsMapper.getAYHLXYHSLPMPageData(dpFilterParamForDetailDtoNew);
Long sum = 0L;
for(int i = 0;i<list.size();i++){
sum = sum + (Long)list.get(i).get("longValue");
}
for(int i = 0;i<list.size();i++){
if(sum != 0 && (Long)list.get(i).get("longValue") != 0){
itemResult.put(list.get(i).get("fieldValueCode")+"",list.get(i).get("longValue")+" / "+new BigDecimal(list.get(i).get("longValue")+"").divide(BigDecimal.valueOf(sum),2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).stripTrailingZeros().toPlainString()+"%");
}
}
itemResult.put("area",r.getRegionName());
itemResult.put("sequenceNbr", UUID.fastUUID().toString());
return itemResult;
}).collect(Collectors.toList());
page.setRecords(result);
page.setTotal(result.size());
return page;
}
@Override
public List<Map<String, String>> getTitle(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<Map<String, String>> list = zbglStatisticsMapper.getTypeList("ISSUE_TYPE");
Map<String,String> map = new HashMap<>();
map.put("dataIndex","area");
map.put("title","区域");
list.add(0,map);
return list;
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZBGLImpl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum;
import com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum;
import com.yeejoin.amos.boot.module.statistcs.biz.service.IZBGLService;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZBGLStatisticsMapper;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class DnztdwyhpmServiceImpl implements IZBGLService {
@Resource
private StCommonServiceImpl stCommonService;
@Resource
private ZBGLStatisticsMapper zbglStatisticsMapper;
@Override
public Map<String, Object> getChart(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
List<String> issueTypeList = IssueTypeEnum.getEnumCodeListByMainBody(IssueMainBodyEnum.COMPANY.getCode());
List<Map<String,Object>> result = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode()+"");
DPFilterParamForDetailDto dpFilterParamForDetailDtoNew = new DPFilterParamForDetailDto();
dpFilterParamForDetailDtoNew.setOrgCode(orgCode);
Map<String, Object> itemResult = new HashMap<>();
Map<String,Long> map = zbglStatisticsMapper.getDNZTDWYHPMChartData(dpFilterParamForDetailDtoNew,issueTypeList);
if(map.get("allCount") != 0 && map.get("endCount") != 0){
itemResult.put("rate",BigDecimal.valueOf(map.get("endCount")).divide(BigDecimal.valueOf(map.get("allCount")),2, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString());
}else{
itemResult.put("rate","0");
}
itemResult.put("count",map.get("allCount"));
itemResult.put("xdata",r.getRegionName());
return itemResult;
}).collect(Collectors.toList());
Map<String,Object> returnMap = new HashMap<>();
List<Map<String,Object>> legendData = new ArrayList<>();
for(int i = 0;i<2; i++){
Map<String,Object> map = new HashMap<>();
if(i == 0){
map.put("dataKey","count");
map.put("value","隐患总数");
map.put("chartType","bar");
}else{
map.put("dataKey","rate");
map.put("value","完结率");
map.put("chartType","line");
}
legendData.add(map);
}
returnMap.put("legendData",legendData);
List xdata = new ArrayList();
List count = new ArrayList();
List rate = new ArrayList();
Long sum = 0L;
for(int i = 0;i<result.size();i++){
sum = sum + (Long)result.get(i).get("count");
}
for(int i = 0;i<result.size();i++){
xdata.add(result.get(i).get("xdata"));
count.add(result.get(i).get("count") == null ? "0" : result.get(i).get("count")+"");
rate.add(result.get(i).get("rate") == null ? "0" : result.get(i).get("rate")+"");
}
returnMap.put("xdata",xdata);
returnMap.put("count",count);
returnMap.put("rate",rate);
return returnMap;
}
@Override
public Page<Map<String, Object>> getPage(Page page,DPFilterParamForDetailDto dpFilterParamForDetailDto) {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamForDetailDto.getCityCode());
dpFilterParamForDetailDto.setOrgCode(orgCode);
Page<Map<String,Object>> returnPage = zbglStatisticsMapper.getUnitByOrgCode(page,dpFilterParamForDetailDto);
List<String> unitCodeList = new ArrayList<>();
Map<String,Map<String,Object>> unitMap = new HashMap<>();
for(int i = 0;i<returnPage.getRecords().size();i++){
unitMap.put(returnPage.getRecords().get(i).get("principalUnitCode").toString(),new HashMap<>());
unitCodeList.add(returnPage.getRecords().get(i).get("principalUnitCode").toString());
}
Map<String,Long> countMap = new HashMap<>();
if(!CollectionUtil.isEmpty(unitCodeList)) {
List<Map<String, Object>> list = zbglStatisticsMapper.getDNZTDWYHPMPageData(unitCodeList);
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = unitMap.get(list.get(i).get("principalUnitCode"));
map.put(list.get(i).get("problemTypeCode") + "", list.get(i).get("count"));
map.put("principalUnit", list.get(i).get("principalUnit"));
map.put("principalUnitCode", list.get(i).get("principalUnitCode"));
Long aLong = countMap.get(list.get(i).get("principalUnitCode"));
if (aLong == null) {
countMap.put(list.get(i).get("principalUnitCode").toString(), (Long) list.get(i).get("count"));
} else {
countMap.put(list.get(i).get("principalUnitCode").toString(), aLong + (Long) list.get(i).get("count"));
}
}
List<Map<String, Object>> resultList = new ArrayList();
unitMap.entrySet().forEach(item -> {
Map<String, Object> value = item.getValue();
value.entrySet().forEach(t -> {
if (!t.getKey().equals("principalUnit") && !t.getKey().equals("principalUnitCode")) {
t.setValue(t.getValue() + " / " + new BigDecimal(t.getValue() + "").divide(BigDecimal.valueOf(countMap.get(item.getValue().get("principalUnitCode"))), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).stripTrailingZeros().toPlainString() + "%");
}
});
resultList.add(value);
});
page.setRecords(resultList);
}
return page;
}
@Override
public List<Map<String, String>> getTitle(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<Map<String, String>> list = IssueTypeEnum.getEnumListByMainBody(IssueMainBodyEnum.COMPANY.getCode());
List<Map<String,String>> returnList = new ArrayList();
for(int i = 0;i<list.size();i++){
Map<String,String> map = new HashMap<>();
map.put("dataIndex",list.get(i).get("code"));
map.put("title",list.get(i).get("name"));
returnList.add(map);
}
Map<String,String> map = new HashMap<>();
map.put("dataIndex","principalUnit");
map.put("title","主体名称");
returnList.add(0,map);
Map<String,String> map1 = new HashMap<>();
map1.put("dataIndex","principalUnitCode");
map1.put("title","主体编码");
returnList.add(1,map1);
return returnList;
}
}
......@@ -46,20 +46,25 @@ public class KrjyydqkServiceImpl implements IZBGLService {
for(int i = 0;i<5; i++){
Map<String,Object> map = new HashMap<>();
if(i == 0){
map.put("dataIndex","lessNum");
map.put("title","30分钟内到达次数");
map.put("dataKey","lessNum");
map.put("value","30分钟内到达次数");
map.put("chartType","bar");
}else if(i == 1) {
map.put("dataIndex", "greaterNum");
map.put("title", "超过30分钟到次数");
map.put("dataKey", "greaterNum");
map.put("value", "超过30分钟到次数");
map.put("chartType","bar");
}else if(i ==2){
map.put("dataIndex","levelOne");
map.put("title","一级救援次数");
map.put("dataKey","levelOne");
map.put("value","一级救援次数");
map.put("chartType","bar");
}else if(i == 3){
map.put("dataIndex","levelTwo");
map.put("title","二级救援次数");
map.put("dataKey","levelTwo");
map.put("value","二级救援次数");
map.put("chartType","bar");
}else {
map.put("dataIndex","levelThree");
map.put("title","三级救援次数");
map.put("dataKey","levelThree");
map.put("value","三级救援次数");
map.put("chartType","bar");
}
legendData.add(map);
}
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZBGLImpl;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.IZBGLService;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.mapper.JGStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZBGLStatisticsMapper;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class YwblpjsxtjServiceImpl implements IZBGLService {
@Resource
private StCommonServiceImpl stCommonService;
@Resource
private JGStatisticsMapper jgStatisticsMapper;
@Override
public Map<String, Object> getChart(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
String orgCodeP = stCommonService.getAndSetOrgCode(dpFilterParamForDetailDto.getCityCode());
DPFilterParamDto dpFilterParamDto = new DPFilterParamDto();
//安装告知、维修告知、改造告知、移装告知
List<CountDto> noticCount = jgStatisticsMapper.queryNoticeAvgDayByReceiveCompany(dpFilterParamDto, orgCodeP);
//使用登记、车用气瓶使用登记
List<CountDto> useCount = jgStatisticsMapper.queryUseAvgDayByReceiveCompany(dpFilterParamDto, orgCodeP);
//更名变更登记、改造变更登记、移装变更登记、单位变更登记、气瓶单位变更登记
List<CountDto> changeCount = jgStatisticsMapper.queryChangeAvgDayByReceiveCompany(dpFilterParamDto, orgCodeP);
//启用停用
List<CountDto> disableCount = jgStatisticsMapper.queryDisableAvgDayByReceiveCompany(dpFilterParamDto, orgCodeP);
//注销报废
List<CountDto> cancelCount = jgStatisticsMapper.queryCancelAvgDayByReceiveCompany(dpFilterParamDto, orgCodeP);
Map<String,Object> returnMap = new HashMap<>();
List<Map<String,Object>> legendData = new ArrayList<>();
for(int i = 0;i<5; i++){
Map<String,Object> map = new HashMap<>();
if(i == 0){
map.put("dataKey","notic");
map.put("value","告知管理");
map.put("chartType","bar");
}else if(i == 1){
map.put("dataKey","use");
map.put("value","使用登记");
map.put("chartType","bar");
}else if(i == 2){
map.put("dataKey","change");
map.put("value","变更登记");
map.put("chartType","bar");
}else if(i == 3){
map.put("dataKey","disable");
map.put("value","停用启用");
map.put("chartType","bar");
}else{
map.put("dataKey","cancel");
map.put("value","注销报废");
map.put("chartType","bar");
}
legendData.add(map);
}
returnMap.put("legendData",legendData);
List xdata = new ArrayList();
List notic = new ArrayList();
List use = new ArrayList();
List change = new ArrayList();
List disable = new ArrayList();
List cancel = new ArrayList();
regionModels.forEach(r -> {
xdata.add(r.getRegionName());
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
notic.add(this.avgAndSumDealDate(noticCount.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
use.add(this.avgAndSumDealDate(useCount.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
change.add(this.avgAndSumDealDate(changeCount.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
disable.add(this.avgAndSumDealDate(disableCount.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
cancel.add(this.avgAndSumDealDate(cancelCount.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
});
returnMap.put("xdata",xdata);
returnMap.put("notic",notic);
returnMap.put("use",use);
returnMap.put("change",change);
returnMap.put("disable",disable);
returnMap.put("cancel",cancel);
return returnMap;
}
@Override
public Page<Map<String, Object>> getPage(Page page,DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
return page;
}
@Override
public List<Map<String, String>> getTitle(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<Map<String, String>> list = new ArrayList<>();
for(int i = 0; i < 6; i++){
Map<String,String> map = new HashMap<>();
if(i == 0){
map.put("dataIndex","regionName");
map.put("title","区域");
}else if(i == 1){
map.put("dataIndex","notic");
map.put("title","告知管理");
}else if(i == 2){
map.put("dataIndex","use");
map.put("title","使用登记");
}else if(i == 3){
map.put("dataIndex","change");
map.put("title","变更登记");
}else if(i == 4){
map.put("dataIndex","disable");
map.put("title","停用启用");
}else if(i == 5){
map.put("dataIndex","cancel");
map.put("title","注销报废");
}
list.add(map);
}
return list;
}
private String avgAndSumDealDate(List<CountDto> collect) {
BigDecimal sum = collect.stream().map(c -> new BigDecimal(c.getStrValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
if(collect.isEmpty()){
return "0";
}
return sum.divide(BigDecimal.valueOf(collect.size()), 1, RoundingMode.HALF_UP).toPlainString();
}
}
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