Commit b4a4c845 authored by limei's avatar limei

Merge branch 'develop_dl_plan6' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6

# Conflicts: # amos-boot-system-tdc/amos-boot-module-tdc-api/src/main/java/com/yeejoin/amos/boot/module/tdc/api/entity/CheckResult.java # amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/service/impl/CheckModelImpl.java
parents c946c006 5c1aa910
package com.yeejoin.equipmanage.common.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author keyong
* @title: IdxBizDefectVo
* <pre>
* @description: TODO
* </pre>
* @date 2022/9/27 18:44
*/
@Data
public class IdxBizDefectVo {
private String id;
@ApiModelProperty(value = "缺陷等级1-一般 2-严重 3-危急")
private Integer defectLevel;
@ApiModelProperty(value = "缺陷设备ids")
private String defectEquipmentIds;
@ApiModelProperty(value = "缺陷设备名称")
private String defectEquipmentName;
@ApiModelProperty(value = "缺陷设备类型1-装备2-系统3-水源")
private Integer defectEquipmentType;
@ApiModelProperty(value = "缺陷描述")
private String defectDescribe;
@ApiModelProperty(value = "缺陷来源 1-巡查 2-维保 3-消防检测 4-其他")
private Integer defectResource;
@ApiModelProperty(value = "缺陷类型")
private String defectType;
@ApiModelProperty(value = "缺陷图片")
private String defectImg;
@ApiModelProperty(value = "发现日期")
private Date defectDiscoverDate;
@ApiModelProperty(value = "发现人")
private String defectDiscover;
@ApiModelProperty(value = "计划消缺日期")
private Date planClearDate;
@ApiModelProperty(value = "责任人")
private String defectResponsible;
@ApiModelProperty(value = "处理状态(0:未处理,1:已处理,2:处理中)")
private Integer defectStatus;
@ApiModelProperty(value = "是否需要停电处理(0:不需要,1:需要)")
private Integer isPowerCut;
@ApiModelProperty(value = "换流站名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "公司编码")
private String orgCode;
@ApiModelProperty(value = "添加时间")
private Date addTime;
@ApiModelProperty(value = "处理措施/处理情况")
private String handleSituation;
@ApiModelProperty(value = "处理-图片")
private String handleImg;
@ApiModelProperty(value = "工作票号")
private String handleWorkTicketNum;
@ApiModelProperty(value = "工作负责人")
private String handleWorkLeader;
@ApiModelProperty(value = "工作票是否已消号 1-已消号 0 -未消号")
private Integer handleWorkIdTicket;
@ApiModelProperty(value = "负责人检查日期")
private String handleLeaderDate;
@ApiModelProperty(value = "负责人")
private String handleLeader;
@ApiModelProperty(value = "消缺日期")
private Date handleClearDate;
@ApiModelProperty(value = "消缺人")
private String handleClearPerson;
@ApiModelProperty(value = "缺陷编号")
private String defectNum;
@ApiModelProperty(value = "超期提醒")
private String expiredWarning;
@ApiModelProperty(value = "缺陷状态【装备用】")
private String defectStatusName;
@ApiModelProperty(value = "告警id")
private String specificAlarmLogId;
}
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog; import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.MonitorEvent; import com.yeejoin.equipmanage.common.entity.MonitorEvent;
import com.yeejoin.equipmanage.common.entity.vo.IdxBizDefectVo;
import com.yeejoin.equipmanage.fegin.IdxFeign;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper; import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.service.IConfirmAlarmService; import com.yeejoin.equipmanage.service.IConfirmAlarmService;
import com.yeejoin.equipmanage.service.impl.MonitorEventService; import com.yeejoin.equipmanage.service.impl.MonitorEventService;
...@@ -14,6 +18,7 @@ import org.springframework.http.MediaType; ...@@ -14,6 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
...@@ -34,6 +39,8 @@ public class ConfirmAlarmController extends AbstractBaseController { ...@@ -34,6 +39,8 @@ public class ConfirmAlarmController extends AbstractBaseController {
EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper; EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired @Autowired
private MonitorEventService monitorEventService; private MonitorEventService monitorEventService;
@Autowired
private IdxFeign idxFeign;
@GetMapping(value = "/getDetailsById") @GetMapping(value = "/getDetailsById")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -98,4 +105,14 @@ public class ConfirmAlarmController extends AbstractBaseController { ...@@ -98,4 +105,14 @@ public class ConfirmAlarmController extends AbstractBaseController {
public Map<String, Object> getEquipSceneAndRelationVideo(@PathVariable Long equipmentSpecificId) { public Map<String, Object> getEquipSceneAndRelationVideo(@PathVariable Long equipmentSpecificId) {
return iConfirmAlarmService.getEquipSceneAndRelationVideo(equipmentSpecificId); return iConfirmAlarmService.getEquipSceneAndRelationVideo(equipmentSpecificId);
} }
@GetMapping(value = "/defect/status/{id}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "缺陷处理状态")
public IdxBizDefectVo getDefectStatus(@PathVariable String id) {
ResponseModel<JSONObject> responseModel = idxFeign.queryDefectByAlarmLogId(id);
JSONObject result = responseModel.getResult();
IdxBizDefectVo vo = JSON.parseObject(JSON.toJSONString(result), IdxBizDefectVo.class);
return vo;
}
} }
package com.yeejoin.equipmanage.fegin;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* @author DELL
*/
@FeignClient(name = "${idx.feign.name}", path = "idx", configuration = {FeignConfiguration.class})
public interface IdxFeign {
/***
* <pre>
* @Description: 根据告警id查询缺陷治理情况
* </pre>
*
* @MethodName:
* @Param:
* @Return: null
* @Throws
* @Author keyong
* @Date 2022/9/27 17:46
*/
@RequestMapping(value = "/defect/alarm/{alarmLogId}", method = RequestMethod.GET)
ResponseModel<JSONObject> queryDefectByAlarmLogId(@PathVariable String alarmLogId);
}
...@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo; import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.*; import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO; import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.enums.*; import com.yeejoin.equipmanage.common.enums.*;
...@@ -23,6 +22,7 @@ import com.yeejoin.equipmanage.remote.WebMqttHandler; ...@@ -23,6 +22,7 @@ import com.yeejoin.equipmanage.remote.WebMqttHandler;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
...@@ -39,16 +39,24 @@ import java.util.*; ...@@ -39,16 +39,24 @@ import java.util.*;
@Service @Service
public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, EquipmentSpecificAlarm> implements IConfirmAlarmService { public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, EquipmentSpecificAlarm> implements IConfirmAlarmService {
private static final org.slf4j.Logger log = LoggerFactory.getLogger(ConfirmAlarmServiceImpl.class);
private final static String FIELD_NAME = "longitude,latitude"; private final static String FIELD_NAME = "longitude,latitude";
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
static ConfirmAlarmMapper confirmAlarmMapper;
@Autowired @Autowired
ConfirmAlarmMapper confirmAlarmMapper; public void setConfirmAlarmMapper(ConfirmAlarmMapper confirmAlarmMapper){
ConfirmAlarmServiceImpl.confirmAlarmMapper = confirmAlarmMapper;
}
private static JcsFeign jcsFeign;
@Autowired @Autowired
private JcsFeign jcsFeign; public void setJcsFeign(JcsFeign jcsFeign){
ConfirmAlarmServiceImpl.jcsFeign = jcsFeign;
}
@Autowired @Autowired
VideoMapper videoMapper; VideoMapper videoMapper;
...@@ -66,9 +74,12 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -66,9 +74,12 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired @Autowired
private IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService; private IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService;
private static IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Autowired @Autowired
@Lazy @Lazy
private IEquipmentSpecificSerivce equipmentSpecificSerivce; public void setIEquipmentSpecificIndexSerivce(IEquipmentSpecificSerivce equipmentSpecificSerivce){
ConfirmAlarmServiceImpl.equipmentSpecificSerivce = equipmentSpecificSerivce;
}
@Autowired @Autowired
private IEquipmentSpecificIndexSerivce iEquipmentSpecificIndexSerivce; private IEquipmentSpecificIndexSerivce iEquipmentSpecificIndexSerivce;
...@@ -88,8 +99,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -88,8 +99,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired @Autowired
private SystemctlFeign systemctlFeign; private SystemctlFeign systemctlFeign;
private static RuleConfirmAlarmService ruleConfirmAlamService;
@Autowired @Autowired
private RuleConfirmAlarmService ruleConfirmAlamService; public void setRuleConfirmAlamService(RuleConfirmAlarmService ruleConfirmAlamService){
ConfirmAlarmServiceImpl.ruleConfirmAlamService = ruleConfirmAlamService;
}
@Autowired @Autowired
private EquipmentSpecificMapper equipmentSpecificMapper; private EquipmentSpecificMapper equipmentSpecificMapper;
...@@ -103,8 +117,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -103,8 +117,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired @Autowired
private ISignalClassifyService signalClassifyService; private ISignalClassifyService signalClassifyService;
private static IFormInstanceService instanceService;
@Autowired @Autowired
private IFormInstanceService instanceService; public void setInstanceService(IFormInstanceService instanceService){
ConfirmAlarmServiceImpl.instanceService = instanceService;
}
@Autowired @Autowired
private SourceSceneMapper sourceSceneMapper; private SourceSceneMapper sourceSceneMapper;
...@@ -373,7 +390,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -373,7 +390,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
//查询当前建筑是否是 最顶级建筑 //查询当前建筑是否是 最顶级建筑
public List<FormInstance> selectBuildingById(List<FormInstance> formInstances){ public static List<FormInstance> selectBuildingById(List<FormInstance> formInstances){
if (formInstances.get(0).getGroupType().equals("building")){ if (formInstances.get(0).getGroupType().equals("building")){
return formInstances; return formInstances;
} }
...@@ -390,7 +407,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -390,7 +407,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
} }
public void sendIotSystemAlarm(EquipmentSpecificAlarmLog ent, String userId, String appKey, String product, String token){ public static void sendIotSystemAlarm(EquipmentSpecificAlarmLog ent, String userId, String appKey, String product, String token){
// Token serverToken = remoteSecurityService.getServerToken(); // Token serverToken = remoteSecurityService.getServerToken();
IotSystemAlarmRo confirmAlamVo = new IotSystemAlarmRo(); IotSystemAlarmRo confirmAlamVo = new IotSystemAlarmRo();
confirmAlamVo.setId(ent.getId()); confirmAlamVo.setId(ent.getId());
......
...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; ...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mchange.v2.beans.swing.TestBean;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm; import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
...@@ -86,8 +85,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -86,8 +85,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired @Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
static EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
EquipmentSpecificMapper equipmentSpecificMapper; public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper){
MqttReceiveServiceImpl.equipmentSpecificMapper = equipmentSpecificMapper;
}
@Autowired @Autowired
FireFightingSystemMapper FireFightingSystemMapper; FireFightingSystemMapper FireFightingSystemMapper;
...@@ -129,8 +131,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -129,8 +131,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired @Autowired
private SystemctlFeign systemctlFeign; private SystemctlFeign systemctlFeign;
private static RemoteSecurityService remoteSecurityService;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; public void setRemoteSecurityService(RemoteSecurityService remoteSecurityService){
MqttReceiveServiceImpl.remoteSecurityService = remoteSecurityService;
}
@Autowired @Autowired
private TopographyService topographyService; private TopographyService topographyService;
...@@ -168,6 +173,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -168,6 +173,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${isSendIot:false}") @Value("${isSendIot:false}")
private Boolean isSendIot; private Boolean isSendIot;
private static Boolean jcsSwitch;
@Value("${systemctl.jcs.switch}")
public void setJcsSwitch(Boolean jcsSwitch){
MqttReceiveServiceImpl.jcsSwitch = jcsSwitch;
}
private static Boolean bool = Boolean.FALSE; private static Boolean bool = Boolean.FALSE;
@Override @Override
...@@ -407,13 +418,52 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -407,13 +418,52 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode()); queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper() List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper()
.selectList(queryWrapper); .selectList(queryWrapper);
EquipmentSpecificAlarmLog log = logs.get(0);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(log.getEquipmentSpecificId());
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
logs.forEach(x -> { logs.forEach(x -> {
x.setCleanTime(new Date()); x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode()); x.setStatus(AlarmStatusEnum.HF.getCode());
if (!StringUtils.isEmpty(traceId)) { if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId); x.setTraceId(traceId);
} }
// 自动确警处理
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.ZDXC.getCode().equals(cleanType)){
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
x.setResolveResult(date + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
}); });
Token token = remoteSecurityService.getServerToken();
String toke = token.getToke();
String appKey = token.getAppKey();
String product = token.getProduct();
String userId = remoteSecurityService.getAgencyUser().getUserId();
if (jcsSwitch && AlarmTypeEnum.HZGJ.getCode().equals(log.getType())) {
// 确警消息发送
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
new Thread(new Runnable() {
@Override
public void run() {
try {
ConfirmAlarmServiceImpl.sendIotSystemAlarm(log, userId, appKey, product, toke);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
if (!logs.isEmpty()) { if (!logs.isEmpty()) {
equipmentSpecificAlarmLogService.updateBatchById(logs); equipmentSpecificAlarmLogService.updateBatchById(logs);
} }
......
...@@ -39,6 +39,7 @@ equipManage.name=AMOS-EQUIPMANAGE ...@@ -39,6 +39,7 @@ equipManage.name=AMOS-EQUIPMANAGE
iot.vehicle.track=AMOS-API-IOT iot.vehicle.track=AMOS-API-IOT
jcs.fegin.name=JCS jcs.fegin.name=JCS
video.fegin.name=VIDEO video.fegin.name=VIDEO
idx.feign.name=AMOS-IDX
#项目初始化画布id #项目初始化画布id
morphic.projectSeq=1390314016458514433 morphic.projectSeq=1390314016458514433
#wl_equipment_category 表id (取火灾报警系统id) #wl_equipment_category 表id (取火灾报警系统id)
......
...@@ -2998,4 +2998,19 @@ ...@@ -2998,4 +2998,19 @@
ADD COLUMN `design_org_telephone` varchar(32) NULL COMMENT '设计单位联系方式'; ADD COLUMN `design_org_telephone` varchar(32) NULL COMMENT '设计单位联系方式';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1664185585-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="wl_equipment_specific_alarm" columnName="confirm_type"/>
</preConditions>
<comment>删除不需要的属性字段</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_type`;
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `alam_reason`;
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `resolve_result`;
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_user`;
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_user_name`;
ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_date`;
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
f_fire_fighting_system as sys f_fire_fighting_system as sys
left join wl_warehouse_structure wws on wws.id = sys.contro_box_build left join wl_warehouse_structure wws on wws.id = sys.contro_box_build
where 1=1 where 1=1
<if test="equimentName != null and equimentName !='' "> <if test="equimentName != null and equimentName !='' and equimentCode !='null' ">
AND sys.NAME like CONCAT('%',#{equimentName},'%') AND sys.NAME like CONCAT('%',#{equimentName},'%')
</if> </if>
<if test="equimentCode != null and equimentCode !='' "> <if test="equimentCode != null and equimentCode !='' and equimentCode !='null' ">
AND sys.CODE like CONCAT('%',#{equimentCode},'%') AND sys.CODE like CONCAT('%',#{equimentCode},'%')
</if> </if>
<if test="nameOrCode != null and nameOrCode != ''"> <if test="nameOrCode != null and nameOrCode != ''">
......
...@@ -19,5 +19,9 @@ public class ModelTreeDto { ...@@ -19,5 +19,9 @@ public class ModelTreeDto {
private String tableName; private String tableName;
private String amosOrgName;
private String modelId;
private List<Map<String, Object>> children; private List<Map<String, Object>> children;
} }
...@@ -46,4 +46,17 @@ public class CheckModel { ...@@ -46,4 +46,17 @@ public class CheckModel {
@ApiModelProperty(value = "模型图片地址") @ApiModelProperty(value = "模型图片地址")
private String modelPictureUrl; private String modelPictureUrl;
@ApiModelProperty(value = "模型规则知识包")
private String modelRule;
@ApiModelProperty(value = "指标模型所属项目id")
private String projectId;
@ApiModelProperty(value = "指标模型表id")
private String tableId;
@ApiModelProperty(value = "模型校验项数量")
private int checkItemAmount;
} }
...@@ -34,7 +34,6 @@ public class CheckResult { ...@@ -34,7 +34,6 @@ public class CheckResult {
@ApiModelProperty(value="检查项值") @ApiModelProperty(value="检查项值")
private String checkItemValue; private String checkItemValue;
@ApiModelProperty(value="检查项结果") @ApiModelProperty(value="检查项结果")
private String checkItemResult; private String checkItemResult;
...@@ -48,7 +47,7 @@ public class CheckResult { ...@@ -48,7 +47,7 @@ public class CheckResult {
private String checkExplain; private String checkExplain;
@ApiModelProperty(value="校验类型") @ApiModelProperty(value="校验类型")
private String checkType; private Integer checkType;
@ApiModelProperty(value="模型所属机构") @ApiModelProperty(value="模型所属机构")
private String amosOrgCode; private String amosOrgCode;
......
...@@ -22,7 +22,7 @@ public interface IdxFeignService { ...@@ -22,7 +22,7 @@ public interface IdxFeignService {
* @param tableId * @param tableId
* @return * @return
*/ */
@RequestMapping(value = "/v1/table/{tableId}", method = RequestMethod.GET) @RequestMapping(value = "/table/{tableId}", method = RequestMethod.GET)
ResponseModel<JSONObject> queryByTableId(@PathVariable String tableId); ResponseModel<JSONObject> queryByTableId(@PathVariable String tableId);
/** /**
......
...@@ -17,9 +17,9 @@ public interface CheckResultMapper extends BaseMapper<CheckResult> { ...@@ -17,9 +17,9 @@ public interface CheckResultMapper extends BaseMapper<CheckResult> {
IPage<CheckResultDto> selectResult(IPage<CheckResultDto> page,String code); IPage<CheckResultDto> selectResult(IPage<CheckResultDto> page,String code);
List<CheckResultDto> selectTotal(String modelId, String amosOrgCode); List<CheckResultDto> selectTotal(String modelId, String batchNo);
Map getTable(String tableName); Map<String, Object> getTables(String tableName, String amosOrgCode);
List<CheckResultDto> selectStatistion(String batchNo,String amosOrgCode); List<CheckResultDto> selectStatistion(String batchNo,String amosOrgCode);
......
...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author xxz * @author xxz
*/ */
...@@ -19,9 +21,31 @@ public interface CheckModelService extends IService<CheckModel> { ...@@ -19,9 +21,31 @@ public interface CheckModelService extends IService<CheckModel> {
// List<CheckModel> selectByOrgCode(String amosOrgCode); // List<CheckModel> selectByOrgCode(String amosOrgCode);
IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode); IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode);
List<CheckModel> selectByOrgCode(String amosOrgCode);
/** /**
* 查询最后一次校验模型 * 查询最后一次校验模型
* @return 模型obj * @return 模型obj
*/ */
CheckModel selectOneByDate(String amosOrgCode); CheckModel selectOneByDate(String amosOrgCode);
/**
* 校验机构下全部模型
* @param amosOrgCode 机构code
*/
void checkAllMode(String amosOrgCode);
/**
* 校验单个模型
* @param modelId 模型id
*/
void checkSingleMode(String modelId);
/**
* 根据机构code和模型名称查询模型对象
* @param modelName 模型名称
* @param amosOrgCode 机构code
* @return 模型对象
*/
CheckModel selectCheckModelByNameCode(String modelName, String amosOrgCode);
} }
...@@ -16,21 +16,35 @@ public interface CheckResultService extends IService<CheckResult> { ...@@ -16,21 +16,35 @@ public interface CheckResultService extends IService<CheckResult> {
IPage<CheckResultDto> selectResult(int current,int size,String code); IPage<CheckResultDto> selectResult(int current,int size,String code);
List<CheckResult> selectCheckResult(String modelId,String amosOrgCode); List<CheckResult> selectCheckResult(String modelId,String batchNo);
List<CheckResultDto> selectTotal(String modelId, String amosOrgCode); List<CheckResultDto> selectTotal(String modelId, String batchNo);
List<ModelTreeDto> test();
ModelTreeDto treeTwo(String tableId);
List<CheckResultDto> selectStatistion(String batchNo,String amosOrgCode); List<CheckResultDto> selectStatistion(String batchNo,String amosOrgCode);
List<CheckResultDto> selectDetails(String batchNo,Integer modelId); List<CheckResultDto> selectDetails(String batchNo,Integer modelId);
String select(String amosOrgCode); String select(String amosOrgCode,String userName);
/**
* 根据机构code获取模型数据树
* @param amosOrgCode 机构code
* @return 树
*/
List<ModelTreeDto> getAllModelDataTree(String amosOrgCode);
/**
* 根据模型id获取模型数据树
* @param modelId 模型id
* @return 树
*/
List<ModelTreeDto> getModelDataTree(String modelId);
/**
* 根据批次号查询存储属性个数
* @param batchNo 批次号
* @return 属性个数
*/
Integer selectItemCount(String batchNo);
} }
...@@ -20,6 +20,6 @@ public class SubjectTreeVo { ...@@ -20,6 +20,6 @@ public class SubjectTreeVo {
private String key; private String key;
private List<TableColumnsVo> columns; private List<TableColumnsVo> tableCols;
} }
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
<select id="selectTotal" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto"> <select id="selectTotal" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto">
SELECT count(1) as total, COUNT(CASE WHEN (check_item_result=1) THEN check_item_result END) AS aaa SELECT count(1) as total, COUNT(CASE WHEN (check_item_result=1) THEN check_item_result END) AS aaa
FROM tdc_check_result WHERE model_id = #{modelId} and amos_org_code = #{amosOrgCode} FROM tdc_check_result WHERE model_id = #{modelId} and batch_no = #{batchNo}
</select> </select>
<select id="getTable" resultType="Map" > <select id="getTables" resultType="java.util.Map" >
SELECT a.* FROM ${tableName} AS a ORDER BY a.date DESC LIMIT 1 SELECT a.* FROM ${tableName} AS a where a.org_code = #{amosOrgCode} ORDER BY a.date DESC LIMIT 1
</select> </select>
<select id="selectStatistion" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto"> <select id="selectStatistion" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</select> </select>
<select id="getOne" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto"> <select id="getOne" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto">
select batch_no,model_id from tdc_check_result where amos_org_code = #{amosOrgCode} group by model_name ORDER BY check_date desc limit 0,1; select amos_org_name,amos_org_code,batch_no,model_id from tdc_check_result where amos_org_code = #{amosOrgCode} group by model_name ORDER BY check_date desc limit 0,1;
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -58,24 +58,4 @@ public class AmosTdcApplication { ...@@ -58,24 +58,4 @@ public class AmosTdcApplication {
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------"); + path + "/doc.html\n" + "----------------------------------------------------------");
} }
// /**
// * 初始化MQTT
// *
// * @throws MqttException
// */
// @Bean
// public void initMqtt() throws MqttException {
// emqKeeper.getMqttClient().subscribe("/idx/idx_biz_carcyl_unit_inspect", 1, carcylUnitInspectMqTtlListener);
// emqKeeper.getMqttClient().subscribe("/tm/tz_base_enterprise_info", 1, baseEnterpriseMqTtlListener);
// emqKeeper.getMqttClient().subscribe("/tz/privilege_company_add_update",1, privilegeCompanyUpdateAddListener);
// emqKeeper.getMqttClient().subscribe("/tz/privilege_company_delete",1, privilegeCompanyDeleteListener);
//// emqKeeper.getMqttClient().subscribe("topic_mqtt_exam", 1, examMqTtlListener);
//// emqKeeper.getMqttClient().subscribe("topic_mqtt_exam_record", 1, examMqTtRecordListener);
// }
// @Bean
// public void initToken() {
// startPlatformTokenService.getToken();
// }
} }
package com.yeejoin.amos.boot.module.tdc.biz.action;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckModelService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo;
import com.yeejoin.amos.boot.module.tdc.biz.action.model.IdxProjectModel;
import com.yeejoin.amos.component.rule.MethodParam;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author DELL
*/
@Component
@RuleActionBean(beanLabel = "动态预案")
public class CheckModelAction {
@Autowired
CheckReportService checkReportService;
@Autowired
CheckModelService checkModelService;
@Autowired
CheckResultService checkResultService;
@Autowired
IdxFeignService idxFeignService;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.check.complete}")
private String checkComplete;
@RuleMethod(methodLabel = "更新检查项结果", project = "保存模型检查项结果")
public void saveCheckItemResult(@MethodParam(paramLabel = "结果") String result,
@MethodParam(paramLabel = "规范标签内容") String checkExplain,
@MethodParam(paramLabel = "校验项") String checkItem,
@MethodParam(paramLabel = "校验项值") String checkItemValue,
@MethodParam(paramLabel = "校验项标准值") String checkItemRealValue,
@MethodParam(paramLabel = "对象") IdxProjectModel idxProjectModel) {
// 1. 检验结果入库
CheckResult checkResult = new CheckResult();
Map propertyValues = idxProjectModel.getPropertyValues();
String batchNo = String.valueOf(propertyValues.get("batch_no"));
Integer checkType = Integer.valueOf(String.valueOf(propertyValues.get("checkType")));
String orgCode = String.valueOf(propertyValues.get("org_code"));
String itemName = idxProjectModel.getItemName();
// 获取模型
CheckModel checkModel = checkModelService.selectCheckModelByNameCode(itemName, orgCode);
if (ObjectUtils.isEmpty(checkModel)) {
return;
}
if (!CollectionUtils.isEmpty(idxProjectModel.getPropertys()) && StringUtils.isNotEmpty(checkItem)) {
Map<String, Object> item = idxProjectModel.getPropertys().stream().filter(map -> checkItem.equals(map.get("name"))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(item)) {
checkResult.setCheckItemLabel(String.valueOf(item.get("title")));
}
}
checkResult.setBatchNo(StringUtils.isNotEmpty(batchNo) ? batchNo : String.valueOf(propertyValues.get("id")));
checkResult.setCheckItemResult(result);
checkResult.setCheckExplain(checkExplain);
checkResult.setCheckItem(checkItem);
checkResult.setCheckItemValue(checkItemValue);
checkResult.setModelId(String.valueOf(checkModel.getSequenceNbr()));
checkResult.setAmosOrgCode(checkModel.getAmosOrgCode());
checkResult.setAmosOrgName(checkModel.getAmosOrgName());
checkResult.setCheckDate(new Date());
checkResult.setCheckType(ObjectUtils.isNotEmpty(checkType) ? checkType : 1);
checkResult.setModelName(checkModel.getModelName());
checkResultService.save(checkResult);
// 2. 判断是否检验结束
if (ObjectUtils.isNotEmpty(checkType)) {
if (checkType == 1) {
// 2.2 单独模型校验,根据批次号查询已经入库的属性
sendWebMessage(batchNo, checkModel.getCheckItemAmount());
} else if (checkType == 0) {
// 2.1 全站校验
List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode);
int sum = checkModels.stream().mapToInt(CheckModel::getCheckItemAmount).sum();
sendWebMessage(batchNo, sum);
}
}
// else {
// // 指标填报完自动调用,暂时不需要推送前端
// String number = ObjectUtils.isNotEmpty(checkType) ? batchNo : String.valueOf(propertyValues.get("id"));
// Integer itemCount = checkResultService.selectItemCount(number);
// List property = projectModel.getPropertys();
// if (itemCount == property.size()) {
// // 所有属性已全部入库,给前端发送消息
// }
// }
}
private void sendWebMessage(String batchNo, Integer itemSize) {
Integer itemCount = checkResultService.selectItemCount(batchNo);
if (itemCount.equals(itemSize)) {
// 所有属性已全部入库,给前端发送消息
HashMap<String, Object> map = new HashMap<>();
map.put("itemCount", itemCount);
map.put("batchNo", batchNo);
String json=JSONObject.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue);
try {
emqKeeper.getMqttClient().publish(checkComplete, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
} catch (MqttException e) {
e.printStackTrace();
}
// 全站校验生成报告
}
}
}
package com.yeejoin.amos.boot.module.tdc.biz.action.model; package com.yeejoin.amos.boot.module.tdc.biz.action.model;
import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact; import com.yeejoin.amos.component.rule.RuleFact;
import liquibase.pro.packaged.L;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author DELL * @author DELL
*/ */
@RuleFact(value = "指标",project = "三维校验") @RuleFact(value = "指标",project = "三维校验cs")
@Data @Data
public class IdxProjectModel { public class IdxProjectModel implements Serializable {
/**
* 规则项目id
*/
private String projectSeq;
private static final long serialVersionUID = -8955054152867167436L;
/** /**
* 规则id * 规则项目id
*/
private String ruleSeq;
/**
* 知识包id
*/ */
private String packageId; // private String projectSeq;
//
// /**
// * 规则id
// */
// private String ruleSeq;
//
// /**
// * 知识包id
// */
// private String packageId;
/** /**
* 项目名称 * 项目名称
*/ */
private String projectName; // private String projectName;
/** /**
* 主题名称 * 主题名称
*/ */
@Label("主题名称")
private String itemName; private String itemName;
/** /**
* 属性集合 * 属性集合
*/ */
private List propertys; @Label("属性集合")
private List<Map<String, Object>> propertys;
/** /**
* 变量属性值 * 变量属性值
*/ */
private Map propertyValues; @Label("变量属性值")
Map<String, Object> propertyValues;
} }
...@@ -47,4 +47,23 @@ public class CheckModelController { ...@@ -47,4 +47,23 @@ public class CheckModelController {
return ResponseHelper.buildResponse(checkModelService.selectOneByDate(amosOrgCode)); return ResponseHelper.buildResponse(checkModelService.selectOneByDate(amosOrgCode));
} }
/**
* 点击全站校验
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/CheckAllModel/{amosOrgCode}")
@ApiOperation(httpMethod = "GET",value = "点击全站校验", notes = "根据机构code校验模型")
public void CheckAllModel(@PathVariable(value = "amosOrgCode") String amosOrgCode) {
checkModelService.checkAllMode(amosOrgCode);
}
/**
* 点击单独模型校验
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/checkSingleMode/{modelId}")
@ApiOperation(httpMethod = "GET",value = "点击单独模型校验", notes = "根据modelId校验模型")
public void checkSingleMode(@PathVariable(value = "modelId") String modelId) {
checkModelService.checkSingleMode(modelId);
}
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -51,37 +52,30 @@ public class CheckResultController extends BaseController { ...@@ -51,37 +52,30 @@ public class CheckResultController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectCheckResult") @GetMapping(value = "/selectCheckResult")
@ApiOperation(httpMethod = "GET",value = "查询最后一次校验模型", notes = "查询最后一次校验模型") @ApiOperation(httpMethod = "GET",value = "查询最后一次校验模型", notes = "查询最后一次校验模型")
public ResponseModel<List<CheckResult>> selectCheckResult( String modelId, String amosOrgCode) { public ResponseModel<List<CheckResult>> selectCheckResult(String modelId, String batchNo) {
return ResponseHelper.buildResponse(checkResultService.selectCheckResult(modelId,amosOrgCode)); return ResponseHelper.buildResponse(checkResultService.selectCheckResult(modelId,batchNo));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectTotal") @GetMapping(value = "/selectTotal")
@ApiOperation(httpMethod = "GET", value = "result", notes = "result") @ApiOperation(httpMethod = "GET", value = "result", notes = "result")
public ResponseModel<List<CheckResultDto>> selectTotal(String modelId, String amosOrgCode) { public ResponseModel<List<CheckResultDto>> selectTotal(String modelId, String batchNo) {
return ResponseHelper.buildResponse(checkResultService.selectTotal(modelId, amosOrgCode)); return ResponseHelper.buildResponse(checkResultService.selectTotal(modelId, batchNo));
} }
/**
* 根据amosOrgCode、modelId查询不合格项
* return
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectCheckResult/test") @GetMapping(value = "/getAllModelDataTree/{amosOrgCode}")
@ApiOperation(httpMethod = "GET",value = "查询最后一次校验模型", notes = "查询最后一次校验模型") @ApiOperation(httpMethod = "GET",value = "获取机构下模型树", notes = "根据机构code获取模型树")
public ResponseModel<List<ModelTreeDto>> test() { public ResponseModel<List<ModelTreeDto>> getAllModelDataTree(@PathVariable(value = "amosOrgCode") String amosOrgCode) {
return ResponseHelper.buildResponse(checkResultService.test()); return ResponseHelper.buildResponse(checkResultService.getAllModelDataTree(amosOrgCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectCheckResult/TreeTwo") @GetMapping(value = "/getModelDataTree/{modelId}")
@ApiOperation(httpMethod = "GET",value = "查询最后一次校验模型", notes = "查询最后一次校验模型") @ApiOperation(httpMethod = "GET",value = "获取单独模型树", notes = "根据模型id获取模型树")
public ResponseModel<ModelTreeDto> treeTwo(String tableId) { public ResponseModel<List<ModelTreeDto>> getModelDataTree(@PathVariable(value = "modelId") String modelId) {
return ResponseHelper.buildResponse(checkResultService.getModelDataTree(modelId));
return ResponseHelper.buildResponse(checkResultService.treeTwo(tableId));
} }
...@@ -102,7 +96,8 @@ public class CheckResultController extends BaseController { ...@@ -102,7 +96,8 @@ public class CheckResultController extends BaseController {
@GetMapping(value = "/select") @GetMapping(value = "/select")
@ApiOperation(httpMethod = "GET", value = "result", notes = "result") @ApiOperation(httpMethod = "GET", value = "result", notes = "result")
public ResponseModel<String> select(String amosOrgCode) { public ResponseModel<String> select(String amosOrgCode) {
return ResponseHelper.buildResponse(checkResultService.select(amosOrgCode)); AgencyUserModel user = getUserInfo();
return ResponseHelper.buildResponse(checkResultService.select(amosOrgCode,user.getUserName()));
} }
......
package com.yeejoin.amos.boot.module.tdc.biz.service.impl; package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckModelMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckModelMapper;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckResultMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckModelService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckModelService;
import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo;
import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo;
import com.yeejoin.amos.boot.module.tdc.biz.action.model.IdxProjectModel;
import com.yeejoin.amos.component.rule.RuleTrigger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
/** /**
* @author xxz * @author xxz
*/ */
@Service @Service
public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> implements CheckModelService { public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> implements CheckModelService {
@Autowired
CheckResultMapper checkResultMapper;
@Autowired
IdxFeignService idxFeignService;
@Autowired
RuleTrigger ruleTrigger;
@Override @Override
public IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode) { public IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode) {
Page page = new Page(current,size); Page page = new Page(current,size);
...@@ -35,6 +61,13 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im ...@@ -35,6 +61,13 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
} }
@Override @Override
public List<CheckModel> selectByOrgCode(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckModel::getAmosOrgCode, amosOrgCode);
return baseMapper.selectList(wrapper);
}
@Override
public CheckModel selectOneByDate(String amosOrgCode) { public CheckModel selectOneByDate(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper wrapper
...@@ -44,5 +77,78 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im ...@@ -44,5 +77,78 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
.last("limit 1"); .last("limit 1");
return baseMapper.selectOne(wrapper); return baseMapper.selectOne(wrapper);
} }
@Override
public void checkAllMode(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckModel::getAmosOrgCode, amosOrgCode);
List<CheckModel> checkModels = this.baseMapper.selectList(wrapper);
String batchNo = UUID.randomUUID().toString();
if (!CollectionUtils.isEmpty(checkModels)) {
checkModels.forEach(checkModel -> {
checkModelRule(checkModel, 0, batchNo, amosOrgCode);
});
}
}
@Override
public void checkSingleMode(String modelId) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckModel::getSequenceNbr, modelId);
CheckModel checkModel = this.baseMapper.selectOne(wrapper);
if (!ObjectUtils.isEmpty(checkModel)) {
// 调用规则校验模型
String batchNo = UUID.randomUUID().toString();
checkModelRule(checkModel, 1, batchNo, checkModel.getAmosOrgCode());
}
}
@Override
public CheckModel selectCheckModelByNameCode(String modelName, String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckModel::getAmosOrgCode, amosOrgCode);
wrapper.eq(CheckModel::getModelName, modelName);
return this.baseMapper.selectOne(wrapper);
}
private void checkModelRule(CheckModel checkModel, int checkType, String batchNo, String amosOrgCode) {
IdxProjectModel idxProjectModel = new IdxProjectModel();
// 查询表最新一条数据
String idxTableName = checkModel.getIdxTableName();
Map<String, Object> map = checkResultMapper.getTables(idxTableName, amosOrgCode);
// Map<String, Object> map = new HashMap<>();
if (ObjectUtils.isEmpty(map)) {
new RuntimeException("暂无填报数据");
}
map.put("batch_no", batchNo);
map.put("checkType", checkType);
// 查询表所有字段
ResponseModel<JSONObject> model = idxFeignService.queryByTableId(checkModel.getTableId());
JSONObject result = model.getResult();
SubjectTreeVo subjectTreeVo = JSON.parseObject(JSON.toJSONString(result), SubjectTreeVo.class);
List<TableColumnsVo> columns = subjectTreeVo.getTableCols();
List<Map<String, Object>> list = new ArrayList<>();
columns.forEach(tableColumnsVo -> {
Map<String, Object> itemMap = new HashMap<>(3);
itemMap.put("name", tableColumnsVo.getColumnName());
itemMap.put("title", tableColumnsVo.getName());
itemMap.put("type", tableColumnsVo.getColumnType());
list.add(itemMap);
});
idxProjectModel.setPropertys(list);
idxProjectModel.setItemName(checkModel.getModelName());
idxProjectModel.setPropertyValues(map);
// 调用规则校验模型
try {
// 没有配决策流,processIds传null即可
ruleTrigger.publish(idxProjectModel, checkModel.getModelRule(), null);
} catch (Exception e) {
e.printStackTrace();
}
}
} }
...@@ -22,7 +22,7 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport> ...@@ -22,7 +22,7 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport>
@Override @Override
public IPage<CheckReport> selectAll(int current,int size,String amosOrgCode) { public IPage<CheckReport> selectAll(int current,int size,String amosOrgCode) {
Page page = new Page(current,size); Page<CheckReport> page = new Page<>(current,size);
if(ValidationUtil.isEmpty(amosOrgCode)){ if(ValidationUtil.isEmpty(amosOrgCode)){
return this.page(page); return this.page(page);
...@@ -33,6 +33,4 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport> ...@@ -33,6 +33,4 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport>
} }
} }
} }
...@@ -3,11 +3,15 @@ package com.yeejoin.amos.boot.module.tdc.biz.service.impl; ...@@ -3,11 +3,15 @@ package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mysql.cj.xdevapi.JsonArray; import com.mysql.cj.xdevapi.JsonArray;
import com.mysql.cj.xdevapi.Result;
import com.stoyanr.evictor.queue.NavigableMapEvictionQueue;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
...@@ -16,12 +20,16 @@ import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; ...@@ -16,12 +20,16 @@ import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.entity.PowerReportFile; import com.yeejoin.amos.boot.module.tdc.api.entity.PowerReportFile;
import com.yeejoin.amos.boot.module.tdc.api.enums.WordPowerTypeEum; import com.yeejoin.amos.boot.module.tdc.api.enums.WordPowerTypeEum;
import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService; import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckModelMapper;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckReportMapper;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckResultMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckResultMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.boot.module.tdc.api.utils.WordPowerUtils; import com.yeejoin.amos.boot.module.tdc.api.utils.WordPowerUtils;
import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo; import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo;
import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo; import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.codehaus.jettison.json.JSONString; import org.codehaus.jettison.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,6 +53,15 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -45,6 +53,15 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
@Autowired @Autowired
IdxFeignService idxFeignService; IdxFeignService idxFeignService;
@Autowired
CheckReportService checkReportService;
@Autowired
CheckReportMapper checkReportMappere;
@Autowired
CheckModelMapper checkModelMapper;
@Override @Override
public IPage<CheckResultDto> selectResult(int current,int size,String code) { public IPage<CheckResultDto> selectResult(int current,int size,String code) {
...@@ -56,43 +73,72 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -56,43 +73,72 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
@Override @Override
public List<CheckResult> selectCheckResult(String modelId,String amosOrgCode) { public List<CheckResult> selectCheckResult(String modelId,String batchNo) {
LambdaQueryWrapper<CheckResult> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CheckResult> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckResult::getCheckItemResult, "1") wrapper.eq(CheckResult::getCheckItemResult, "1")
.eq(CheckResult::getAmosOrgCode, amosOrgCode) .eq(CheckResult::getBatchNo, batchNo)
.eq(CheckResult::getModelId, modelId); .eq(CheckResult::getModelId, modelId);
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
} }
@Override @Override
public List<CheckResultDto> selectTotal(String modelId, String amosOrgCode) { public List<CheckResultDto> selectTotal(String modelId, String batchNo) {
return checkResultMapper.selectTotal(modelId, amosOrgCode); return checkResultMapper.selectTotal(modelId, batchNo);
}
@Override
public List<CheckResultDto> selectStatistion(String batchNo, String amosOrgCode) {
return checkResultMapper.selectStatistion(batchNo, amosOrgCode);
}
@Override
public List<CheckResultDto> selectDetails(String batchNo, Integer modelId) {
return checkResultMapper.selectDetails(batchNo, modelId);
} }
@Override @Override
public List<ModelTreeDto> test() { public List<ModelTreeDto> getAllModelDataTree(String amosOrgCode) {
ResponseModel<List<JSONObject>> listResponseModel = idxFeignService.subjectTree("d2528788-b8d5-4170-ae62-edf153fddc59");
List<JSONObject> result = listResponseModel.getResult();
List<ModelTreeDto> modelTreeDtoList = new ArrayList<>(); List<ModelTreeDto> modelTreeDtoList = new ArrayList<>();
result.forEach(obj ->{ LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
JSONArray tables = (obj).getJSONArray("tables"); wrapper.eq(CheckModel::getAmosOrgCode, amosOrgCode);
tables.forEach(table -> { List<CheckModel> checkModels = checkModelMapper.selectList(wrapper);
ModelTreeDto modelTreeDto = new ModelTreeDto(); checkModels.forEach(checkModel -> {
SubjectTreeVo subjectTreeVo = JSON.parseObject(JSON.toJSONString(table), SubjectTreeVo.class); ModelTreeDto modelTreeDto = selectDataTree(String.valueOf(checkModel.getSequenceNbr()));
select(modelTreeDto, subjectTreeVo); modelTreeDtoList.add(modelTreeDto);
modelTreeDtoList.add(modelTreeDto);
});
}); });
// ResponseModel<List<JSONObject>> listResponseModel = idxFeignService.subjectTree("d2528788-b8d5-4170-ae62-edf153fddc59");
// List<JSONObject> result = listResponseModel.getResult();
// result.forEach(obj ->{
// JSONArray tables = (obj).getJSONArray("tables");
// tables.forEach(table -> {
// ModelTreeDto modelTreeDto = new ModelTreeDto();
// SubjectTreeVo subjectTreeVo = JSON.parseObject(JSON.toJSONString(table), SubjectTreeVo.class);
// select(modelTreeDto, subjectTreeVo);
// modelTreeDtoList.add(modelTreeDto);
// });
// });
return modelTreeDtoList; return modelTreeDtoList;
} }
private void select(ModelTreeDto modelTreeDto, SubjectTreeVo subjectTreeVo) { private ModelTreeDto selectDataTree(String modelId) {
modelTreeDto.setId(subjectTreeVo.getTableId()); ModelTreeDto modelTreeDto = new ModelTreeDto();
modelTreeDto.setName(subjectTreeVo.getTopicName()); LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
modelTreeDto.setTableName(subjectTreeVo.getTableName()); wrapper.eq(CheckModel::getSequenceNbr, modelId);
List<TableColumnsVo> columns = subjectTreeVo.getColumns(); CheckModel checkModel = checkModelMapper.selectOne(wrapper);
Map tableMap = checkResultMapper.getTable(subjectTreeVo.getTableName()); if (ObjectUtils.isEmpty(checkModel)) {
return modelTreeDto;
}
ResponseModel<JSONObject> listResponseModel = idxFeignService.queryByTableId(checkModel.getTableId());
JSONObject result = listResponseModel.getResult();
SubjectTreeVo subjectTreeVo = JSON.parseObject(JSON.toJSONString(result), SubjectTreeVo.class);
modelTreeDto.setId(checkModel.getTableId());
modelTreeDto.setName(checkModel.getModelName());
modelTreeDto.setTableName(checkModel.getIdxTableName());
modelTreeDto.setModelId(String.valueOf(checkModel.getSequenceNbr()));
modelTreeDto.setAmosOrgName(checkModel.getAmosOrgName());
List<TableColumnsVo> columns = subjectTreeVo.getTableCols();
Map tableMap = checkResultMapper.getTables(subjectTreeVo.getTableName(), checkModel.getAmosOrgCode());
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
columns.forEach(tableColumnsVo -> { columns.forEach(tableColumnsVo -> {
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
...@@ -102,57 +148,34 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -102,57 +148,34 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
list.add(map); list.add(map);
}); });
modelTreeDto.setChildren(list); modelTreeDto.setChildren(list);
return modelTreeDto;
} }
@Override @Override
public ModelTreeDto treeTwo(String tableId) { public List<ModelTreeDto> getModelDataTree(String modelId) {
List<ModelTreeDto> modelTreeDtoList = new ArrayList<>();
ResponseModel<JSONObject> listResponseModel = idxFeignService.queryByTableId(tableId); ModelTreeDto modelTreeDto = selectDataTree(modelId);
JSONObject result = listResponseModel.getResult(); modelTreeDtoList.add(modelTreeDto);
ModelTreeDto modelTreeDto = new ModelTreeDto(); return modelTreeDtoList;
SubjectTreeVo subjectTreeVo = JSON.parseObject(JSON.toJSONString(result), SubjectTreeVo.class);
// List<TableColumnsVo> list = result.getJSONArray("tableCols").toJavaList(TableColumnsVo.class);
// subjectTreeVo.setColumns(list);
select(modelTreeDto, subjectTreeVo);
return modelTreeDto;
} }
@Override @Override
public String select(String amosOrgCode) { public Integer selectItemCount(String batchNo) {
Map<String, Object> dataMap = getData(amosOrgCode); LambdaQueryWrapper<CheckResult> wrapper = new LambdaQueryWrapper<>();
WordPowerUtils instance = WordPowerUtils.getInstance(); wrapper.eq(CheckResult::getBatchNo, batchNo);
String pdfUrlString = ""; return this.baseMapper.selectCount(wrapper);
File filepdf = null;
try {
filepdf = instance.getWordFileItem(dataMap, null, WordPowerTypeEum.select.getTemplateFile());
filepdf.getAbsolutePath();
MultipartFile multipartFile = new PowerReportFile("file", "file.pdf", "application/pdf", file2byte(filepdf));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
if (result != null) {
Iterator<String> it = result.getResult().keySet().iterator();
while (it.hasNext()) {
pdfUrlString = it.next();
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (filepdf != null) {
filepdf.delete();
}
}
return pdfUrlString;
} }
/**
* 获取报告数据
* @param amosOrgCode
* @return
*/
private Map<String,Object> getData(String amosOrgCode) { private Map<String,Object> getData(String amosOrgCode) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
// JSONObject map=new JSONObject();
//3.统计 //获取统计表信息
ArrayList<Map<String, Object>> list = new ArrayList<>(); ArrayList<Map<String, Object>> list = new ArrayList<>();
List<CheckResultDto> selectBatch = checkResultMapper.getOne(amosOrgCode); List<CheckResultDto> selectBatch = checkResultMapper.getOne(amosOrgCode);
for(CheckResultDto checkResultDto1 : selectBatch){ for(CheckResultDto checkResultDto1 : selectBatch){
...@@ -160,28 +183,22 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -160,28 +183,22 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
for (CheckResultDto system : systemList) { for (CheckResultDto system : systemList) {
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
/*List<Map> collect = (List<Map>) indicatorConfiguration.stream().
filter(item -> item.get("code").equals(String.valueOf(system.getAmosOrgCode())));*/
map.put("station",system.getAmosOrgName()); map.put("station",system.getAmosOrgName());
data.put("modelName",system.getModelName()); data.put("modelName",system.getModelName());
System.out.println(system.getModelName()+"----------------------------------------------------------------"); System.out.println(system.getModelName()+"----------------------------------------------------------------");
data.put("allTotal",system.getAllTotal()); data.put("allTotal",system.getAllTotal());
data.put("failTotal",system.getFailTotal()); data.put("failTotal",system.getFailTotal());
list.add(data); list.add(data);
/*for(int i = 0;i<list.size();i++){
map.put(String.valueOf(i),list.get(i));
}*/
map.put("list",list); map.put("list",list);
} }
//1.站名 // 获取时间
// List<Map> indicatorConfiguration = JSONObject.parseArray(json, Map.class);
// 2.时间
String date = new SimpleDateFormat("yyyy-MM-dd ").format(Calendar.getInstance().getTime()); String date = new SimpleDateFormat("yyyy-MM-dd ").format(Calendar.getInstance().getTime());
map.put("time", date); map.put("time", date);
//4.校验明细 //获取校验明细信息
ArrayList<Map<String,Object>> list2 = new ArrayList<>(); ArrayList<Map<String,Object>> list2 = new ArrayList<>();
systemList.forEach(checkResultDto -> { systemList.forEach(checkResultDto -> {
List<CheckResultDto> systemList2 = selectDetails( checkResultDto.getBatchNo(), checkResultDto.getModelId()); List<CheckResultDto> systemList2 = selectDetails( checkResultDto.getBatchNo(), checkResultDto.getModelId());
...@@ -211,8 +228,81 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -211,8 +228,81 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
return map; return map;
} }
/**
* 调用方法获取报告的返回地址
* @param amosOrgCode
* @return
*/
public String getUrl(String amosOrgCode) {
Map<String, Object> dataMap = getData(amosOrgCode);
WordPowerUtils instance = WordPowerUtils.getInstance();
String pdfUrlString = "";
File filepdf = null;
try {
filepdf = instance.getWordFileItem(dataMap, null, WordPowerTypeEum.select.getTemplateFile());
filepdf.getAbsolutePath();
MultipartFile multipartFile = new PowerReportFile("file", "file.pdf", "application/pdf", file2byte(filepdf));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
if (result != null) {
Iterator<String> it = result.getResult().keySet().iterator();
while (it.hasNext()) {
pdfUrlString = it.next();
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (filepdf != null) {
filepdf.delete();
}
}
return pdfUrlString;
}
/**
* 通过amosOrgCode查询name,放入数据库
* @param amosOrgCode
* @return
*/
public String searchName(String amosOrgCode){
String name = null;
List<CheckResultDto> result = checkResultMapper.getOne(amosOrgCode);
for(CheckResultDto results : result){
name = results.getAmosOrgName();
}
return name;
}
/**
* 拿到getUrl的url存储到数据库
* @param amosOrgCode
* @return
*/
@Override
public String select(String amosOrgCode,String userName){
String url = getUrl(amosOrgCode);
CheckReport checkReport = new CheckReport();
checkReport.setReportUrl(url);
checkReport.setCreateDate(new Date());
checkReport.setAmosOrgCode(amosOrgCode);
String name = searchName(amosOrgCode);
checkReport.setAmosOrgName(name);
checkReport.setName(name.concat(""+"三维校验"));
checkReport.setCheckPeopleName(userName);
checkReportService.save(checkReport);
return null;
}
/**
* 转换成流的形式读取
* @param file
* @return
*/
private static byte[] file2byte(File file) { private static byte[] file2byte(File file) {
try { try {
FileInputStream in = new FileInputStream(file); FileInputStream in = new FileInputStream(file);
...@@ -226,14 +316,6 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -226,14 +316,6 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
} }
} }
@Override
public List<CheckResultDto> selectStatistion(String batchNo, String amosOrgCode) {
return checkResultMapper.selectStatistion(batchNo, amosOrgCode);
}
@Override
public List<CheckResultDto> selectDetails(String batchNo, Integer modelId) {
return checkResultMapper.selectDetails(batchNo, modelId);
}
} }
spring.application.name=TDC-LM spring.application.name=AMOS-TDC
server.servlet.context-path=/tdc server.servlet.context-path=/tdc
server.port=13000 server.port=13000
...@@ -40,3 +40,6 @@ spring.redis.lettuce.pool.max-idle=10 ...@@ -40,3 +40,6 @@ spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
## redis失效时间 ## redis失效时间
redis.cache.failure.time=10800 redis.cache.failure.time=10800
#校验完成发送消息
mqtt.topic.check.complete=/tdc/check/complete
...@@ -25,4 +25,5 @@ public interface IdxFeignService { ...@@ -25,4 +25,5 @@ public interface IdxFeignService {
*/ */
@RequestMapping(value = "/table/{tableId}", method = RequestMethod.GET) @RequestMapping(value = "/table/{tableId}", method = RequestMethod.GET)
ResponseModel<JSONObject> queryByTableId(@PathVariable String tableId); ResponseModel<JSONObject> queryByTableId(@PathVariable String tableId);
} }
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