Commit 4beebf55 authored by helinlin's avatar helinlin

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

parents 0fc3341d 1bae6a02
......@@ -845,4 +845,14 @@ public class DateUtils {
time = String.format(time, h, m, s);
return time;
}
public static Date getTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
}
......@@ -31,8 +31,8 @@ public class DutyFirstAidExcleDto implements Serializable{
@ExcelIgnore
@ApiModelProperty(value = "用户id")
private String userId;
@ExcelProperty(value = "用户名称", index = 2)
@ApiModelProperty(value = "用户名称")
@ExcelProperty(value = "值班人员", index = 2)
@ApiModelProperty(value = "值班人员")
private String userName;
@ExcelIgnore
......
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 设备告警月统计
*
* @author system_generator
* @date 2022-01-16
*/
@Data
@Accessors(chain = true)
@TableName("wl_analysis_report_month")
public class AnalysisReportMonth {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@TableField("system_id")
private Long systemId;
/**
* 总数量
*/
@TableField("num")
private Integer num;
/**
* 装备定义编码
*/
@TableField("equipment_code")
private String equipmentCode;
/**
*
*/
@TableField("equipment_name")
private String equipmentName;
/**
* 报告所在年月
*/
@TableField("report_month")
private String reportMonth;
/**
* 故障设备数量
*/
@TableField("fault_equip_num")
private Integer faultEquipNum;
/**
* 故障信息条数
*/
@TableField("fault_info_num")
private Integer faultInfoNum;
/**
* 告警设备数量
*/
@TableField("alarm_equip_num")
private Integer alarmEquipNum;
/**
* 告警信息条数
*/
@TableField("alarm_info_num")
private Integer alarmInfoNum;
/**
* 总信息数量
*/
@TableField("total_info_num")
private Integer totalInfoNum;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 总结报告
*
* @author system_generator
* @date 2022-01-16
*/
@Data
@Accessors(chain = true)
@TableName("wl_analysis_report_summary")
public class AnalysisReportSummary {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@TableField("system_id")
private Long systemId;
/**
* 系统名称
*/
@TableField("system_name")
private String systemName;
/**
* 报告类型
*/
@TableField("report_type")
private String reportType;
/**
* 报告日期
*/
@TableField("report_date")
private Date reportDate;
/**
* 总结信息
*/
@TableField("summary_info")
private String summaryInfo;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
}
......@@ -122,4 +122,7 @@ public class FireFightingSystemEntity {
@ApiModelProperty("系统类型编码")
private String systemTypeCode;
@ApiModelProperty(value = "分析报告统计用参数(为空不统计) ")
private String analysisIndexKey;
}
......@@ -124,27 +124,33 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
List< Map<String, Object>> result = new ArrayList<Map<String, Object>>();
List<String> userNameList= new ArrayList<String>();
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companyNameList = new ArrayList<String>();
String firstAidCompanyId = dutyPersonShiftMapper.getFirstAidCompanyId();
if (firstAidCompanyId != "" && firstAidCompanyId != null){
ids.add(firstAidCompanyId);
OrgUsr companyDetail = orgUsrServiceImpl.getDetailById(Long.parseLong(firstAidCompanyId));
String companyNameString = companyDetail.getBizOrgName()+ "@" +companyDetail.getSequenceNbr();
companyNameList.add(companyNameString);
}
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companyNameList = new ArrayList<String>();
String typeString = "JJZ";
ids.stream().forEach(i->{
Map<String, Object> detailMap = new HashMap<String, Object>();
if (!i.equals(firstAidCompanyId)){
List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentId(Long.parseLong(i));
personList.stream().forEach(m -> {
String userNameString =m.getBizOrgName()+ "@" +m.getSequenceNbr();
userNameList.add(userNameString);
});
detailMap.put("userName", userNameList);
OrgUsr companyDetail = orgUsrServiceImpl.getDetailById(Long.parseLong(i));
String companyNameString = companyDetail.getBizOrgName()+ "@" +companyDetail.getSequenceNbr();
companyNameList.add(companyNameString);
}
//单位默认为 消防救援保障部,不可编辑。
detailMap.put("companyName", companyNameList);
List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString);
List<String> dataDicSimpleList = new ArrayList<String>();
dataDicList.stream().forEach(l->{
......
......@@ -180,8 +180,6 @@ public class CarController extends AbstractBaseController {
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
@Value("${fileserver_domain}")
private String fileServer;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
......@@ -572,7 +570,7 @@ public class CarController extends AbstractBaseController {
for (Map<String, Object> map : list) {
String img = (String) map.get("img");
if (img != null && !"".equals(img)) {
map.put("img", fileServer + img);
map.put("img", img);
}
}
}
......@@ -828,7 +826,7 @@ public class CarController extends AbstractBaseController {
mape.put("brand", brand);
listdate = equipmentCategoryMapper.getEquipmentCount(mape);
for (Map<String, Object> map : listdate) {
map.put("img", fileServer + map.get("img"));
map.put("img", map.get("img"));
Object amount = map.get("amount");
String unit = map.get("unit").toString();
if (ercode.substring(0, 1).equals("4")) {
......@@ -872,7 +870,7 @@ public class CarController extends AbstractBaseController {
amount = amount + utname;
}
map.put("amount", amount);
map.put("img", fileServer + map.get("img"));
map.put("img", map.get("img"));
}
return listdate;
} catch (Exception e) {
......
......@@ -181,7 +181,7 @@ public class FireFightingSystemController extends AbstractBaseController {
@ApiOperation(httpMethod = "GET", value = "通过装备定义id查找性能指标")
public Map<String, Object> getPrefList(Long equipmentId, Long specificId) {
HashMap<String, List> map = new HashMap<>();
ConcurrentHashMap map1 = new ConcurrentHashMap();
List<EquProperty> properALlList = new ArrayList<>();
List<String> list = equipmentIndexService.getGruopName(equipmentId);
list.forEach(x -> {
QueryWrapper<EquipmentIndex> wrapper = new QueryWrapper<>();
......@@ -201,6 +201,7 @@ public class FireFightingSystemController extends AbstractBaseController {
equProperty.setEquipmentIndexKey(y.getPerfQuotaDefinitionId());
properList.add(equProperty);
});
properALlList.addAll(properList);
map.put(x, properList);
});
QueryWrapper<EquipmentIndex> wrappernull = new QueryWrapper<>();
......@@ -220,7 +221,8 @@ public class FireFightingSystemController extends AbstractBaseController {
equProperty.setEquipmentIndexKey(y.getPerfQuotaDefinitionId());
properList.add(equProperty);
});
properList.forEach(e -> {
properALlList.addAll(properList);
properALlList.forEach(e -> {
List<EquipmentIndexVO> equipmentIndexList = equipmentSpecificIndexMapper.getEquipIndexByIndexId(e.getEquipmentIndexId(), specificId);
if (equipmentIndexList.size() > 0) {
if (StringUtil.isNotEmpty(equipmentIndexList.get(0).getValue())) {
......
......@@ -11,6 +11,8 @@ import com.yeejoin.equipmanage.common.entity.Industry;
import com.yeejoin.equipmanage.service.IIndustryService;
import io.swagger.annotations.Api;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
@RestController
@Api(tags = "行业分类Industry")
......@@ -20,6 +22,7 @@ public class IndustryController {
IIndustryService industryService;
@GetMapping(value = "/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public List<Industry> listAll() {
return industryService.list();
}
......
......@@ -53,9 +53,6 @@ public class ManufacturerInfoController {
@Autowired
ISystemDicService iSystemDicService;
@Value("${fileserver_domain}")
private String fileServer;
/**
* 新增
*
......@@ -66,9 +63,6 @@ public class ManufacturerInfoController {
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ManufacturerInfo saveManufacturerInfo(HttpServletRequest request,
@RequestBody ManufacturerInfo manufacturerInfo) {
if (!ObjectUtils.isEmpty(manufacturerInfo.getImg()) && manufacturerInfo.getImg().contains(fileServer)) {
manufacturerInfo.setImg(manufacturerInfo.getImg().replace(fileServer, ""));
}
if (!ObjectUtils.isEmpty(manufacturerInfo.getCountryId())) {
SystemDic byId = iSystemDicService.getByIdforAll(manufacturerInfo.getCountryId());
manufacturerInfo.setCountry(byId.getName());
......@@ -113,9 +107,6 @@ public class ManufacturerInfoController {
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdManufacturerInfo(HttpServletRequest request,
@RequestBody ManufacturerInfo manufacturerInfo) {
if (!ObjectUtils.isEmpty(manufacturerInfo.getImg()) && manufacturerInfo.getImg().contains(fileServer)) {
manufacturerInfo.setImg(manufacturerInfo.getImg().replace(fileServer, ""));
}
if (!ObjectUtils.isEmpty(manufacturerInfo.getCountryId())) {
SystemDic byId = iSystemDicService.getByIdforAll(manufacturerInfo.getCountryId());
manufacturerInfo.setCountryId(manufacturerInfo.getCountryId());
......@@ -150,9 +141,6 @@ public class ManufacturerInfoController {
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ManufacturerInfo selectById(HttpServletRequest request, @PathVariable Long id) {
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(id);
if (!ObjectUtils.isEmpty(manufacturerInfo.getImg())) {
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
}
return manufacturerInfo;
}
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportMonth;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 设备告警月统计 Mapper 接口
*
* @author system_generator
* @date 2022-01-16
*/
public interface AnalysisReportMonthMapper extends BaseMapper<AnalysisReportMonth> {
/**
* 插入月分析列表数据
* @param suffix 指标信息
* @param beginDate 开始日期
* @param endDate 结束日期
* @param systemId 系统id
*/
void insertSystemMonthData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
}
package com.yeejoin.equipmanage.mapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportSummary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 总结报告 Mapper 接口
*
* @author system_generator
* @date 2022-01-16
*/
public interface AnalysisReportSummaryMapper extends BaseMapper<AnalysisReportSummary> {
/**
* 插入月总结信息
* @param suffix 指标参数
* @param beginDate 开始日期
* @param endDate 结束日期
* @param systemId 系统id
*/
void insertSystemMonthSummaryData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
}
......@@ -50,6 +50,6 @@ public class AnalysisReportSchedulerJob {
Date yestDay = DateUtils.dateAdd(new Date(),-1,false);
Date beginDate = DateUtils.getFirstDayOfMonth(yestDay);
Date endDate = DateUtils.getLastDayOfMonth(yestDay);
iAnalysisReportLogService.generateReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
iAnalysisReportLogService.generateMonthReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import java.text.ParseException;
import java.util.Date;
/**
......@@ -27,4 +28,11 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> {
* @param endDate 结束日期
*/
void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate);
/** 月报表生成
* @param monthReport 报告类型
* @param beginDate 开始日期
* @param endDate 结束日期
*/
void generateMonthReport(AnalysisReportEnum monthReport, Date beginDate, Date endDate) throws ParseException;
}
......@@ -5,14 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.AnalysisReportLogMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.text.ParseException;
import java.util.*;
/**
* 报告流水表 服务实现类
......@@ -23,6 +30,16 @@ import java.util.Date;
@Service
public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogMapper, AnalysisReportLog> implements IAnalysisReportLogService {
@Autowired
IFireFightingSystemService fireFightingSystemService;
@Autowired
AnalysisReportMonthMapper analysisReportMonthMapper;
@Autowired
AnalysisReportSummaryMapper analysisReportSummaryMapper;
@Override
public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) {
......@@ -39,12 +56,35 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Override
public void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void generateMonthReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) throws ParseException {
// 0.保存日志
this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
// 创建月分析统计报告数据
// 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔
List<FireFightingSystemEntity> fightingSystemEntityList = fireFightingSystemService.getBaseMapper().selectList(
new LambdaQueryWrapper<FireFightingSystemEntity>()
.isNotNull(FireFightingSystemEntity::getAnalysisIndexKey));
// 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary
String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN);
String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN);
fightingSystemEntityList.forEach(f -> {
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId());
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId());
});
}
private void saveAnalysisReportLog(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
AnalysisReportLog reportLog = new AnalysisReportLog();
reportLog.setName(reportEnum.getName());
reportLog.setReportType(reportEnum.getType());
reportLog.setStartDate(beginDate);
reportLog.setEndDate(endDate);
reportLog.setReportDateDesc(buildReportDateDesc(reportEnum,beginDate,endDate));
reportLog.setReportDateDesc(buildReportDateDesc(reportEnum, beginDate, endDate));
this.save(reportLog);
}
......@@ -52,7 +92,7 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
StringBuilder desc = new StringBuilder();
Calendar calendar = Calendar.getInstance();
calendar.setTime(beginDate);
switch (reportEnum){
switch (reportEnum) {
case DAY_REPORT:
desc.append(calendar.get(Calendar.YEAR));
desc.append("年");
......
......@@ -188,8 +188,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Autowired
@Lazy
private IEquipmentIndexService equipmentIndexService;
@Value("${fileserver_domain}")
private String fileServer;
@Autowired
private IManufacturerInfoService iManufacturerInfoService;
@Autowired
......@@ -1147,7 +1145,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Equipment equipment = iEquipmentService.getById(carOne.getEquipmentId());
String utilName = carMapper.getUtilName(equipment.getUnitId());
carOne.setUnitName(utilName);
equipment.setImg(fileServer + equipment.getImg());
equipment.setImg(equipment.getImg());
carOne.setEquipment(equipment);
carOne.setCarState(CarStatusEnum.getEnum(carOne.getCarState().toString()).getName());
}
......@@ -1285,9 +1283,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return new ArrayList<UploadFile>();
}
list.forEach(item -> {
if (item.getUrl().contains(fileServer)) {
item.setUrl(item.getUrl().replace(fileServer, ""));
}
item.setUrl(item.getUrl());
item.setFileType(type);
item.setObjectType(BillContentEnum.CL.getKey());
item.setObjectId(id);
......@@ -1388,7 +1384,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
car.setCarPropertyList(carPropertyList);
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(car.getManufacturerId());
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
car.setManufacturerInfo(manufacturerInfo);
car.setImg(getCarFileList(id, FileTypeEnum.image.toString()));
car.setVideo(getCarFileList(id, FileTypeEnum.video.toString()));
......@@ -1417,7 +1413,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Map<String, List<CarIndexVo>> map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getName()));
car.setExt(JSONObject.toJSONString(map));
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(car.getManufacturerId());
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
car.setManufacturerInfo(manufacturerInfo);
car.setImg(getCarFileList(id, FileTypeEnum.image.toString()));
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
......@@ -1444,7 +1440,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Map<String, List<CarIndexVo>> map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getName()));
car.setExt(JSONObject.toJSONString(map));
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(car.getManufacturerId());
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
car.setManufacturerInfo(manufacturerInfo);
car.setImg(getCarFileList(car.getId(), FileTypeEnum.image.toString()));
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
......@@ -1463,7 +1459,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
List<UploadFile> list = iUploadFileService.list(new QueryWrapper<UploadFile>().eq("object_id", id)
.eq("object_type", BillContentEnum.CL.getKey()).eq("file_type", type));
list.forEach(item -> {
item.setUrl(fileServer + item.getUrl());
item.setUrl(item.getUrl());
});
return list;
}
......
......@@ -64,9 +64,6 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
@Autowired
private IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Value("${fileserver_domain}")
private String fileServer;
@Autowired
private ISystemDicService iSystemDicService;
......@@ -84,9 +81,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
return new ArrayList<UploadFile>();
}
list.forEach(item -> {
if (item.getUrl().contains(fileServer)) {
item.setUrl(item.getUrl().replace(fileServer, ""));
}
item.setUrl(item.getUrl());
item.setFileType(type);
item.setObjectType(BillContentEnum.ZB.getKey());
item.setObjectId(id);
......@@ -137,7 +132,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
List<UploadFile> list = iUploadFileService.list(new QueryWrapper<UploadFile>().eq("object_id", id)
.eq("object_type", BillContentEnum.ZB.getKey()).eq("file_type", type));
list.forEach(item -> {
item.setUrl(fileServer + item.getUrl());
item.setUrl(item.getUrl());
});
return list;
}
......
......@@ -46,13 +46,6 @@ import java.util.zip.ZipOutputStream;
@Service
public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMapper, EquipmentManageEntity> implements EquipmentManageService {
/**
* 文件服务器地址
*/
@Value("${fileserver_domain}")
private String ipUrl;
@Autowired
EquipmentManageMapper equipmentManageMapper;
......@@ -281,7 +274,7 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
response.setHeader("Access-Control-Allow-Origin", "*");
response.setContentType("multipart/form-data");
try {
InputStream inputStream = getInputStreamFromURL(ipUrl + vo.getUrl());
InputStream inputStream = getInputStreamFromURL(vo.getUrl());
//3.通过response获取ServletOutputStream对象(out)
out = response.getOutputStream();
......
......@@ -57,13 +57,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private PatrolFeign patrolFeign;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${fileserver_domain}")
private String fileServer;
@Autowired
private IEquipmentDetailService iEquipmentDetailService;
@Value("${fileserver_domain}")
private String fileUrl;
// 装备分类code长度
private static final int CATECODELEN = 8;
private String proviceCode = "44";
......@@ -339,7 +335,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
imgQueryWrapper.eq("file_type", "image");
List<UploadFile> uploadFiles = uploadFileMapper.selectList(imgQueryWrapper);
for (UploadFile s : uploadFiles) {
s.setUrl(fileServer + s.getUrl());
s.setUrl(s.getUrl());
}
equipmentBaseApp.setImg(uploadFiles);
equipmentApp.setEquipmentBase(equipmentBaseApp);
......@@ -349,7 +345,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
excelQueryWrapper.eq("file_type", "instruction");
List<UploadFile> uploadFiles1 = uploadFileMapper.selectList(excelQueryWrapper);
for (UploadFile s : uploadFiles1) {
s.setUrl(fileServer + s.getUrl());
s.setUrl(s.getUrl());
}
equipmentApp.setExcel(uploadFiles1);
//性能指标,带指标值
......@@ -424,7 +420,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
images.forEach(a -> {
String picture = a.getPicture();
if (StringUtils.isNotEmpty(picture)) {
a.setPicture(fileUrl + picture);
a.setPicture(picture);
}
});
}
......
......@@ -89,9 +89,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
@Autowired
private IVideoService videoService;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public void handleExport(HttpServletResponse response, List<Long> ids, String alarmType) {
CommonPageInfoParam param = new CommonPageInfoParam();
......@@ -469,7 +466,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
alarmDataVO5.setKey(EquipmentDataEnum.XT.getName());
alarmDataVO5.setValue(StringUtil.isNotEmpty(sourceData.get("systemName")) ? sourceData.get("systemName").toString() : null);
lists.add(alarmDataVO5);
alarmEquipMockDataVO.setPic(StringUtil.isNotEmpty(sourceData.get("imgUrl")) ? fileServer + sourceData.get("imgUrl") : null);
alarmEquipMockDataVO.setPic(StringUtil.isNotEmpty(sourceData.get("imgUrl")) ? sourceData.get("imgUrl").toString() : null);
alarmEquipMockDataVO.setAlarmCount(count);
alarmEquipMockDataVO.setQrcode(StringUtil.isNotEmpty(sourceData.get("qrCode")) ? sourceData.get("qrCode").toString() : null);
alarmEquipMockDataVO.setDetailUrl(null);
......
......@@ -117,9 +117,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Value("${fileserver_domain}")
private String fileServer;
@Value("${equipment.filter.code}")
private String codes;
......@@ -380,9 +377,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return new ArrayList<UploadFile>();
}
list.forEach(item -> {
if (item.getUrl().contains(fileServer)) {
item.setUrl(item.getUrl().replace(fileServer, ""));
}
item.setUrl(item.getUrl());
item.setId(sequence.nextId());
item.setFileType(type);
item.setObjectType(BillContentEnum.ZB.getKey());
......
......@@ -205,6 +205,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${systemctl.amos.switch}")
private Boolean amosSwitch;
@Value("${isSendApp}")
private Boolean isSendApp;
private static final String A = "A";
private final static Map staticMap = new HashMap();
......@@ -301,6 +304,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
BeanUtils.copyProperties(equipmentSpecificIndex, equipmentSpeIndex);
String value = iotDataVO.getValue().toString();
equipmentSpeIndex.setValue(value);
equipmentSpeIndex.setUpdateDate(new Date());
equipmentSpecificIndex.setValue(value);
String enumStr = equipmentSpecificIndex.getValueEnum();
if (!ObjectUtils.isEmpty(enumStr)) {
......@@ -753,15 +757,20 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
DateUtils.date2LongStr(equipmentSpecificAlarmLog.getCreateDate()));
model.setBody(body);
model.setMsgType("iotMonitor");
if (isSendApp){
model.setIsSendApp(true);
model.setIsSendWeb(true);
model.setTerminal("APP/WEB");
} else {
model.setIsSendApp(false);
model.setTerminal("WEB");
}
model.setIsSendWeb(true);
model.setCategory(1);
model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId()));
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
} catch (InnerInvokException e) {
} catch (Exception e) {
// e.printStackTrace();
log.error("告警消息同步平台失败:syncSystemctlMsg,===>>>" + e.getMessage());
}
......
......@@ -94,8 +94,6 @@ public class QREquipmentDefServiceImpl implements IQRCodeService<ScanResult<QREq
private IStockDetailService stockDetailService;
@Autowired
private UploadFileMapper uploadFileMapper;
@Value("${fileserver_domain}")
private String fileUrl;
@Autowired
IEquipmentService iEquipmentService;
......@@ -269,7 +267,7 @@ public class QREquipmentDefServiceImpl implements IQRCodeService<ScanResult<QREq
ParsePropertyUtil.setting(info::setCarNum, car::getCarNum);
ParsePropertyUtil.setting(info::setEquipmentId, car::getEquipmentId);
ParsePropertyUtil.setting(info::setEquipName, equipment::getName);
info.setImg(fileUrl+img);
info.setImg(img);
// ParsePropertyUtil.setting(info::setImg, () -> {
// if(car.getImg().size()>0){
// if (StringUtil.isNotEmpty(car.getImg().get(0).getUrl())) {
......
......@@ -127,9 +127,6 @@ public class QREquipmentKnowledgeServiceImpl implements IQRCodeService<ScanResul
@Autowired
private IStockDetailService iStockDetailService;
@Value("${fileserver_domain}")
private String fileUrl;
public ScanResult<QREquipResponse> scan(QRCodeRequest request) throws RuntimeException {
try {
String qrCode = StringUtil.splitQRCode(request)[1];
......@@ -377,7 +374,7 @@ public class QREquipmentKnowledgeServiceImpl implements IQRCodeService<ScanResul
}
});
String img = iEquipmentService.getById(equipmentDetail.getEquipmentId()).getImg();
info.setImg(fileUrl+img);
info.setImg(img);
// ParsePropertyUtil.setting(info::setImg, () -> {
// if(equipmentDetail.getVideo()!=null && equipmentDetail.getVideo().size() != 0){
// if (null != equipmentDetail.getImg().get(0).getUrl()) {
......
......@@ -31,7 +31,7 @@ public class RuleConfirmAlarmService {
* 警情确认
*/
public Boolean confirmAlam(IotSystemAlarmRo iotSystemAlarmRo, String appKey, String product, String token) throws Exception {
iotSystemAlarmRo.setCategory(1);
iotSystemAlarmRo.setCategory(2); // 系统消息
iotSystemAlarmRo.setRelationId(String.valueOf(iotSystemAlarmRo.getId()));
iotSystemAlarmRo.setTerminal("WEB");
iotSystemAlarmRo.setMsgType(msgType);
......
......@@ -43,9 +43,6 @@ public class ScrapDetailServiceImpl extends ServiceImpl<ScrapDetailMapper, Scrap
@Autowired
private ScrapMapper scrapMapper;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public ScrapDetail getOneById(Long id) {
ScrapDetail scrapDetail = getById(id);
......@@ -68,14 +65,14 @@ public class ScrapDetailServiceImpl extends ServiceImpl<ScrapDetailMapper, Scrap
scrapDetail.setStockDetail(stockDetail);
String img = equipmentDetail.getEquipment().getImg();
if (img !=null && !"".equals(img)){
scrapDetail.setImg(fileServer+img);
scrapDetail.setImg(img);
}
} else if (scrapDetail.getCarId() != null) {
Car car = iCarService.getById(scrapDetail.getCarId());
scrapDetail.setCar(car);
String img = scrapMapper.getImgById(scrapDetail.getScrapId(), "2");
if (img != null && !"".equals(img)) {
scrapDetail.setImg(fileServer+img);
scrapDetail.setImg(img);
}
}
......
......@@ -61,9 +61,6 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
@Autowired
private EquipmentOnCarMapper equipmentOnCarMapper;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public Scrap create(List<ScrapDetail> list, String type, AgencyUserModel agencyUserModel) {
this.scrapCheck(type, list);
......@@ -267,7 +264,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
String type = scrap.getBillType();
String img = scrapMapper.getImgById(scrap.getId(), type);
if (img != null && !"".equals(img)) {
scrap.setImg(fileServer + img);
scrap.setImg(img);
}
List<Map<String, Object>> list = scrapDetailService.geteqTypeAndAmount(scrap.getId());
if (0 < list().size()) {
......
......@@ -51,9 +51,6 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
@Autowired
private StockDetailMapper stockDetailMapper;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public Page<StockDetail> pageCategoryStock(Page<EquipmentDetail> pageBean, String category,
Long warehouseStructureId) {
......@@ -73,7 +70,7 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
stockDetail.setEquipmentDetail(equipmentDetail);
String img = equipmentDetail.getEquipment().getImg();
if (img != null && !"".equals(img)) {
stockDetail.setImg(fileServer + img);
stockDetail.setImg(img);
}
stockDetailList.add(stockDetail);
}
......@@ -122,7 +119,7 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
stockDetail.setEquipmentDetail(equipmentDetail);
String img = equipmentDetail.getEquipment().getImg();
if (img != null && !"".equals(img)) {
stockDetail.setImg(fileServer + img);
stockDetail.setImg(img);
}
}
return page;
......
......@@ -1545,7 +1545,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObjectListSub.add(alertSubmittedObjectSub);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectListSub);
// 调用短信发送接口
alertCalledAction.sendAlertCalleCmd(sCode, mobile, smsParams);
alertCalledAction.sendAlertCalleCmd(smsCode, mobile, smsParams);
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
......@@ -1568,7 +1568,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
userList.add(i.get("amosId").toString());
}
});
smsParams.put("resourcesNum", resourcesNumStr.substring(resourcesNumStr.length() - 2));
smsParams.put("resourcesNum", resourcesNumStr);
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
......
......@@ -40,6 +40,6 @@ public interface JcsFeignClient {
/**
* 根据id获取单位人员列表
*/
@GetMapping(value = "/company/{ids}/person")
@GetMapping(value = "/org-usr/company/{ids}/person")
FeignClientResult<List<CompanyPerson>> selectCompanyPerson(@PathVariable List<Long> ids);
}
......@@ -37,7 +37,7 @@ public class LatentDangerDto {
/**
* 创建隐患的业务id(p_check_input)
*/
private Long bizId = 0L;
private Long bizId;
/**
* 建筑id
......
......@@ -14,7 +14,9 @@ import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -242,7 +244,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (ValidationUtil.isEmpty(dangerTypeEnum)) {
throw new Exception("检查类型参数有误");
}
Date endTime = this.GetTargetEndTime(param.getReformLimitDate());
Date endTime = DateUtils.getTargetEndTime(param.getReformLimitDate());
param.setReformLimitDate(endTime);
// 保存隐患
LatentDanger latentDanger = saveLatentDanger(param, userId, departmentId, businessKey, orgCode,
......@@ -318,16 +320,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// riskFactorMapper.updateControlStatus(riskFactorBo);
// }
public static Date GetTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
// TODO 使用远程调用替换
private void updateCheckInputDangerState(Long id, int code) {
latentDangerMapper.updateCheckInputDangerState(id, code);
......@@ -1200,6 +1192,13 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
JSONObject body = new JSONObject();
body.put("businessKey", latentDanger.getBusinessKey());
body.put("processDefinitionKey", workflowProcessDefinitionKey);
/* 修改现场确认的工作流流程的节点执行条件分支------strat by chenhao 2022-01-18*/
String startCondition = "inner";
if("1".equals(bizInfo.getString("isOuter")) ) startCondition = "outer";
HashMap<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put(WorkFlowEnum.CONDITION.getCode(), startCondition);
body.put("variables", conditionMap);
/* 修改现场确认的工作流流程的节点执行条件分支------end by chenhao 2022-01-18*/
JSONObject result = workflowFeignService.startByVariable(body);
if (result == null || ValidationUtil.isEmpty(result.get("data"))) {
executeSubmitDto.setIsOk(false);
......@@ -2206,10 +2205,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
throw new Exception("隐患不存");
}
latentDangerDto.setDangerPosition(null);
//以下方法存在bug会将数值类型的默认值0拷贝到对象上造成数据覆盖
//Bean.copyExistPropertis(latentDangerDto, latentDanger);
latentDanger.setId(latentDangerDto.getId());
latentDanger.setFlowJson(latentDangerDto.getFlowJson());
Bean.copyExistPropertis(latentDangerDto, latentDanger);
if (!ValidationUtil.isEmpty(latentDangerDto.getPhotoUrl())) {
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
......@@ -2235,9 +2231,13 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
sendSubmitMessage(executeType, latentDanger, executeSubmitDto);
return executeSubmitDto;
}
public void sendSubmitMessage(Integer executeType, LatentDanger latentDanger, DangerExecuteSubmitDto executeSubmitDto) throws Exception {
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(), executeSubmitDto.getCheckLeaderId());
ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(), ExecuteTypeEnum.getNameByCode(executeType));
return executeSubmitDto;
}
@Override
......
......@@ -17,6 +17,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -87,6 +88,9 @@ public class RuleDangerService {
latentDangerRo.setIsSendWeb(true);
latentDangerRo.setRecivers(userIds);
latentDangerRo.setTerminal(RuleConstant.APP_WEB);
if (ValidationUtil.isEmpty(userIds)) {
return false;
}
//触发规则
ruleTrigger.publish(latentDangerRo, packageId, new String[0]);
return true;
......
......@@ -16,6 +16,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@RestController
@RequestMapping(value = "/api/planAudit")
@Api(tags = "计划审核api")
......@@ -45,4 +47,13 @@ public class PlanAuditController extends AbstractBaseController {
return ResponseHelper.buildResponse(planAuditService.listByPlanId(planId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PersonIdentify
@ApiOperation(value = "查询登陆人有没有计划执行权限")
@GetMapping(value = "/checkTaskAuth")
public ResponseModel checkTaskAuth(@RequestParam("planId") Long planId) {
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(planAuditService.checkTaskAuth(planId, reginParams));
}
}
package com.yeejoin.amos.supervision.business.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
......@@ -64,4 +66,13 @@ public interface JCSFeignClient {
*/
@RequestMapping(value = "jcs/org-usr/{companyId}/person/list", method = RequestMethod.GET)
FeignClientResult<List<OrgUsrFormDto>> getPersonListByCompanyId(@PathVariable("companyId") String companyId);
/**
* 根据机场人员id获取amos平台人员id
*
* @param orgUserId 机场单位人员id
* @return AgencyUserModel 平台人员信息
**/
@RequestMapping(value = "jcs/org-usr/amos/{orgUserId}", method = RequestMethod.GET)
ResponseModel<AgencyUserModel> getAmosIdByUserId(@PathVariable String orgUserId);
}
......@@ -300,6 +300,9 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("makerUserName", plan.getMakerUserName()); // 计划制定人名称
result.put("userId", plan.getUserId()); // 检查参与人id
result.put("userIdName", plan.getUserName()); // 检查参与人名称
// 放入标识隐患是外部导入还是非外部,1为外部导入
String isOuter = DangerCheckTypeLevelEnum.EXTERNAL.getCode().equals(plan.getCheckLevel()) ? "1" : "0";
result.put("isOuter", isOuter);
// 将机场单位bizOrgCode保存起来用于按机场单位数据过滤
FeignClientResult<Map<String, Object>> companyResult = jcsFeignClient.getCompanyById(point.getOriginalId());
if (!ValidationUtil.isEmpty(companyResult)) {
......
......@@ -3,9 +3,11 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditLogDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanDao;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
......@@ -14,11 +16,13 @@ import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum;
import com.yeejoin.amos.supervision.dao.entity.Plan;
import com.yeejoin.amos.supervision.dao.entity.PlanAudit;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import com.yeejoin.amos.supervision.exception.YeeException;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.List;
......@@ -45,6 +49,9 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Autowired
private PlanServiceImpl planService;
@Autowired
JCSFeignClient jcsFeignClient;
@Override
@Transactional
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception {
......@@ -58,11 +65,13 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
String taskId = taskAuthMap.get("taskId") == null ? null : taskAuthMap.get("taskId").toString();
String name = taskAuthMap.get("name") == null ? null : taskAuthMap.get("name").toString();
String roleName = reginParams.getRole().getRoleName();
workflowExcuteService.CompleteTask(instanceId, condition, reginParams);
// 获取审核最后一步所需条件
String conditionValue = getConditionValue(plan, condition);
workflowExcuteService.CompleteTask(instanceId, conditionValue, reginParams);
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String userId = reginParams.getUserModel().getUserId();
// 更新计划状态,指定执行人
updatePlanStatus(condition,plan,instanceId,userId);
updatePlanStatus(condition,plan,instanceId, conditionValue);
// 更新流水表
planAuditLog.setPlanId(planAudit.getPlanId());
planAuditLog.setPlanAuditId(planAudit.getId());
......@@ -81,35 +90,89 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
}
/**
* 获取最后一步审核通过下一步条件
* @param plan 计划
* @param condition 前端传的是否通过
* @return 下一步条件
*/
private String getConditionValue(Plan plan, String condition) throws Exception {
String fail = "1";
String nextCondition = "outer";
// 前端传递为0表示通过,通过才区分下一步
if (!fail.equals(condition) && DangerCheckTypeLevelEnum.EXTERNAL.getCode().equals(plan.getCheckLevel())) {
String workFlowBranch = getWorkFlowBranch(plan);
if (workFlowBranch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) {
if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) {
return nextCondition;
}
} else {
if (PlanStatusEnum.EXAMINE_ONE.getValue() == plan.getStatus()) {
return nextCondition;
}
}
return fail;
}
return condition;
}
/**
* 更新计划id
* @param condition 同意0 不同意1
* @param plan 当前计划对象
*/
private void updatePlanStatus (String condition, Plan plan, String instanceId, String userId) throws Exception {
private void updatePlanStatus (String condition, Plan plan, String instanceId, String conditionValue) throws Exception {
String fail = "1";
String nextCondition = "outer";
if (fail.equals(condition)) {
planDao.updatePlanStatus(PlanStatusEnum.DRAFT.getValue(), plan.getId());
} else {
//检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
//检查类型
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
String branch = PlanServiceImpl.workFlowExcuteBranch(dangerCheckTypeLevelEnum.getCondition(), checkTypeSuEnum.getCondition());
if (branch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) {
if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, plan.getLeadPeopleIds());
// 获取检查组长
AgencyUserModel userModel = jcsFeignClient.getAmosIdByUserId(plan.getLeadPeopleIds()).getResult();
if (ValidationUtil.isEmpty(userModel)) {
throw new YeeException("业务信息错误");
}
// 工作流中使用平台用户名称,因此这里取userName
String checkLeaderId = userModel.getUserName();
String workFlowBranch = getWorkFlowBranch(plan);
PlanStatusEnum statusEnum = PlanStatusEnum.getEnum(plan.getStatus());
planDao.updatePlanStatus(statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue(), plan.getId());
if (workFlowBranch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) {
if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, checkLeaderId);
}
int status = statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue();
if (nextCondition.equals(conditionValue) && PlanStatusEnum.EXAMINE_THREE.getValue() == status) {
status = PlanStatusEnum.IN_EXECUTION.getValue();
}
planDao.updatePlanStatus(status, plan.getId());
} else {
int status = PlanStatusEnum.EXAMINE_FORMULATE.getValue();
if (PlanStatusEnum.EXAMINE_ONE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, plan.getLeadPeopleIds());
workflowExcuteService.setTaskAssign(instanceId, checkLeaderId);
} else {
status = statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue();
}
if (nextCondition.equals(conditionValue)) {
status = PlanStatusEnum.IN_EXECUTION.getValue();
}
planDao.updatePlanStatus(PlanStatusEnum.EXAMINE_FORMULATE.getValue(), plan.getId());
planDao.updatePlanStatus(status, plan.getId());
}
}
}
/**
* 获取当前流程分支
* @param plan 计划对象
* @return 流程分支
*/
private String getWorkFlowBranch(Plan plan) throws Exception {
//检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
//检查类型
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
return PlanServiceImpl.workFlowExcuteBranch(dangerCheckTypeLevelEnum.getCondition(), checkTypeSuEnum.getCondition());
}
@Override
public List<PlanAuditLog> listByPlanId(Long planId) {
Sort.Order idOrder = new Sort.Order(Sort.Direction.ASC, "createDate");
......@@ -119,6 +182,17 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
return planAuditLogDao.findAllByPlanId(planId, sort);
}
@Override
public Map<String, Object> checkTaskAuth(Long planId, ReginParams reginParams) {
PlanAudit planAudit = planAuditDao.findByPlanId(planId);
if (ObjectUtils.isNotEmpty(planAudit)) {
String instanceId = planAudit.getProcessInstanceId();
return workflowExcuteService.checkTaskAuthMap(instanceId, reginParams);
} else {
throw new YeeException("该计划暂无流程实例!");
}
}
// @Override
// @Transactional
// public Boolean auditWorkFlow(PlanAuditLog planAuditLog, String condition, ReginParams reginParams) {
......
......@@ -58,7 +58,6 @@ public class RulePlanService {
@Autowired
private PointServiceImpl pointService;
@Async
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, pointId);
//触发规则
......@@ -66,7 +65,6 @@ public class RulePlanService {
return true;
}
@Async
public Boolean addPlanAuditRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, String excuteStateName) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, null);
planRo.setExcuteStateName(excuteStateName);
......@@ -77,12 +75,12 @@ public class RulePlanService {
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) {
// 设置token
if (ValidationUtil.isEmpty(RequestContext.getToken())) {
Toke tokenObj = remoteSecurityService.getServerToken();
RequestContext.setProduct(tokenObj.getProduct());
RequestContext.setAppKey(tokenObj.getAppKey());
RequestContext.setToken(tokenObj.getToke());
}
// if (ValidationUtil.isEmpty(RequestContext.getToken())) {
// Toke tokenObj = remoteSecurityService.getServerToken();
// RequestContext.setProduct(tokenObj.getProduct());
// RequestContext.setAppKey(tokenObj.getAppKey());
// RequestContext.setToken(tokenObj.getToke());
// }
PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo);
......@@ -116,7 +114,6 @@ public class RulePlanService {
userIds = (List<String>) jcsFeignClient.getAmosIdListByUserIds(leadPeopleIds).getResult();
// pointId是被检查单位id
if (!ValidationUtil.isEmpty(pointId)) {
List<String> userIdList = Lists.newArrayList();
Point point = pointService.queryPointById(pointId);
List<OrgUsrFormDto> personList =
jcsFeignClient.getPersonListByCompanyId(point.getOriginalId()).getResult();
......
......@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import java.util.List;
import java.util.Map;
public interface IPlanAuditService {
Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception;
......@@ -14,4 +15,12 @@ public interface IPlanAuditService {
* @return List<PlanAuditLog>
*/
List<PlanAuditLog> listByPlanId(Long planId);
/**
* 登陆人是否有该计划执行权限
* @param planId 计划id
* @param reginParams 登陆人信息
* @return 权限标识
*/
Map<String, Object> checkTaskAuth(Long planId, ReginParams reginParams);
}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.10.85:3306/autosys_business_v3.0.0.2?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url = jdbc:mysql://172.16.3.20:3307/autosys_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=Amos2019Mysql8
spring.datasource.password=123456
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1
# \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......@@ -54,6 +51,7 @@ systemctl.sync.switch=false
systemctl.jcs.switch=false
#平台数据开关
systemctl.amos.switch=false
isSendApp=false
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
......
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......@@ -54,6 +51,7 @@ systemctl.sync.switch=false
systemctl.jcs.switch=false
#平台数据开关
systemctl.amos.switch=false
isSendApp=false
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
......
......@@ -17,8 +17,6 @@ fdfs.connect-timeout=601
fdfs.thumb-image.height=200
fdfs.thumb-image.width=200
fdfs.tracker-list[0]=39.98.246.31:22122
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.10.72
eureka.instance.prefer-ip-address = true
......@@ -60,6 +58,7 @@ systemctl.sync.switch=false
systemctl.jcs.switch=true
#平台数据开关
systemctl.amos.switch=true
isSendApp=true
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
......
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......
......@@ -2071,4 +2071,73 @@
ALTER TABLE wl_equipment ADD COLUMN clean_type varchar(50) DEFAULT NULL COMMENT '警情消除方式(0:收到复位信号自动消除;1:警情处理确认后消除)';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_analysis_report_month"/>
</not>
</preConditions>
<comment>create table wl_analysis_report_month 分析报告用</comment>
<sql>
CREATE TABLE `wl_analysis_report_month` (
`system_id` bigint DEFAULT NULL COMMENT '系统id',
`num` int DEFAULT NULL COMMENT '总数量',
`equipment_code` varchar(255) DEFAULT NULL COMMENT '装备定义编码',
`equipment_name` varchar(255) DEFAULT NULL,
`report_month` varchar(255) DEFAULT NULL COMMENT '报告所在年月',
`fault_equip_num` int DEFAULT NULL COMMENT '故障设备数量',
`fault_info_num` int DEFAULT NULL COMMENT '故障信息条数',
`alarm_equip_num` int DEFAULT NULL COMMENT '告警设备数量',
`alarm_info_num` int DEFAULT NULL COMMENT '告警信息条数',
`total_info_num` int DEFAULT NULL COMMENT '总信息数量',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
UNIQUE KEY `uk_system_id_report_month_equipment_code` (`system_id`,`equipment_code`,`report_month`) USING BTREE,
KEY `idx_report_month` (`report_month`) USING BTREE
) ENGINE=InnoDB COMMENT='设备告警月统计';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-2">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_analysis_report_summary"/>
</not>
</preConditions>
<comment>create table wl_analysis_report_summary 分析报告用</comment>
<sql>
CREATE TABLE `wl_analysis_report_summary` (
`system_id` bigint DEFAULT NULL COMMENT '系统id',
`system_name` varchar(255) DEFAULT NULL COMMENT '系统名称',
`report_type` varchar(255) DEFAULT NULL COMMENT '报告类型',
`report_date` date DEFAULT NULL COMMENT '报告日期',
`summary_info` varchar(500) DEFAULT NULL COMMENT '总结信息',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
UNIQUE KEY `uk_system_id_report_type_report_date` (`system_id`,`report_type`,`report_date`),
KEY `idx_systemid_report_type` (`system_id`,`report_type`) USING BTREE
) ENGINE=InnoDB COMMENT='总结报告';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
</not>
</preConditions>
<comment>f_fire_fighting_system add column analysis_index_key 分析报告用</comment>
<sql>
ALTER TABLE f_fire_fighting_system ADD COLUMN `analysis_index_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分析报告统计用参数(为空不统计)';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-4">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
</preConditions>
<comment>f_fire_fighting_system 更新 analysis_index_key 分析报告统计用</comment>
<sql>
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Open,OilLeak' WHERE (`code`='029026401813010000000030');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield' WHERE (`code`='029026401813010000000016');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Alarm,Abnormal' WHERE (`code`='029026401813010000000023');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Shield,FireAlarm' WHERE (`code`='029026401813010000000047');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield,State' WHERE (`code`='029026401813010000000054');
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?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.equipmanage.mapper.AnalysisReportMonthMapper">
<insert id="insertSystemMonthData">
insert into wl_analysis_report_month
(
system_id,
num,
equipment_name,
equipment_code,
fault_equip_num,
fault_info_num,
alarm_equip_num,
alarm_info_num,
total_info_num,
report_month
)
select
a1.*,
DATE_FORMAT(NOW(),'%Y-%m')
from
(SELECT
system_id,
num,
name,
code,
(SELECT
count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultInfoNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmInfoNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as totalInfoNum
FROM(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id <![CDATA[<>]]> '' and s.id = #{systemId}
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1
</insert>
</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.equipmanage.mapper.AnalysisReportSummaryMapper">
<insert id="insertSystemMonthSummaryData">
insert into
wl_analysis_report_summary (
system_id,
summary_info,
system_name,
report_type,
report_date
)
select
s.id,
CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10),
CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(IFNULL(f1.normalEquipNumPercent,0)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(ROUND(IFNULL(f1.faultEquipPercent,0),2)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,',
'同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,',
'同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(round(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1,2)* 100,'%'))
,'。')) as content,
s.`name`,
3 as report_type,
#{endDate} as report_date
from
f_fire_fighting_system s
LEFT JOIN
(select
s1.*,
IFNULL(s2.totalAlarmEquipNum,0) as lastMonthTotalAlarmEquipNum,
IFNULL(s2.totalAlarmInfoNum,0) as lastMonthTotalAlarmInfoNum,
IFNULL(s2.totalNormalEquipNum,0) as lastMonthTotalNormalEquipNum,
IFNULL(s2.totalEquipNum,0) as lastMonthTotalEquipNum,
IFNULL(s2.totalFaultEquipNum,0) as lastMonthTotalFaultEquipNum
from
(SELECT
u1.system_id,
IFNULL(sum(num),0) as totalEquipNum,
IFNULL(sum(normalEquipNum),0) as totalNormalEquipNum,
IFNULL(sum(faultEquipNum),0) as totalFaultEquipNum,
IFNULL(sum(alarmEquipNum),0) as totalAlarmEquipNum,
IFNULL(sum(alarmInfoNum),0) as totalAlarmInfoNum,
if(sum(num) > 0,ROUND(sum(normalEquipNum)/sum(num),2), '-') as normalEquipNumPercent,
if(sum(num) > 0,ROUND(sum(faultEquipNum)/sum(num),2), '-') as faultEquipPercent
from
(select
a1.*,
(a1.num - a1.alarmEquipNum) as normalEquipNum
from
(SELECT
system_id,
num,
name,
code,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultEquipNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.index_true_num >0
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmInfoNum
FROM
(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id <![CDATA[<>]]> ''
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1) u1
GROUP BY u1.system_id) s1
LEFT JOIN
(SELECT
u1.system_id,
sum(num) as totalEquipNum,
sum(normalEquipNum) as totalNormalEquipNum,
sum(faultEquipNum) as totalFaultEquipNum,
sum(alarmEquipNum) as totalAlarmEquipNum,
sum(alarmInfoNum) as totalAlarmInfoNum
from
(select
a1.*,
(a1.num - a1.alarmEquipNum) as normalEquipNum
from
(SELECT
system_id,
num,
name,
code,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.index_true_num >0
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date <![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as faultEquipNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.index_true_num >0
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date <![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date<![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as alarmInfoNum
FROM
(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where
spec.system_id <![CDATA[<>]]> ''
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1) u1
GROUP BY u1.system_id) s2 ON s1.system_id = s2.system_id
) f1 on s.id = f1.system_id
where s.id = #{systemId}
</insert>
</mapper>
......@@ -640,15 +640,11 @@
<if test='dto.createDate != null and dto.createDate == "1"'>
AND wlesa.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' )
</if>
<if test='dto.createDate != null and dto.createDate == "7"'>
AND wlesa.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 7 DAY ),
'00:00:00' )
AND CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), '%', '23:59:59' )
<if test='createDate != null and createDate == "7"'>
AND wlesal.create_date > CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 7 DAY ), ' 23:59:59' )
</if>
<if test='dto.createDate != null and dto.createDate == "30"'>
AND wlesa.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 30 DAY ),
'00:00:00' )
AND CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), '%', '23:59:59' )
<if test='createDate != null and createDate == "30"'>
AND wlesal.create_date > CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 30 DAY ),' 23:59:59' )
</if>
<if test="dto.createDate != null and dto.createDate.length() > 7">
AND wlesa.create_date LIKE CONCAT( #{dto.createDate}, '%' )
......
......@@ -1444,7 +1444,7 @@
select
we.clean_type
from
wl_Equipment we
wl_equipment we
LEFT JOIN `wl_equipment_detail` wed ON wed.equipment_id = we.id
LEFT JOIN `wl_equipment_specific` wes ON wes.equipment_detail_id = wed.id
where
......
......@@ -530,12 +530,10 @@
AND wlesal.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' )
</if>
<if test='createDate != null and createDate == "7"'>
AND wlesal.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 7 DAY ), '00:00:00' )
AND CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), '%', '23:59:59' )
AND wlesal.create_date > CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 7 DAY ), ' 23:59:59' )
</if>
<if test='createDate != null and createDate == "30"'>
AND wlesal.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 30 DAY ), '00:00:00' )
AND CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), '%', '23:59:59' )
AND wlesal.create_date > CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 30 DAY ),' 23:59:59' )
</if>
<if test='confirmType != null and confirmType == 0'>
and wlesal.confirm_type IS NULL
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -959,7 +959,15 @@
pld.business_key = #{businessKey}
</select>
<select id="selectPageByParam" resultType="com.yeejoin.amos.latentdanger.dao.entity.LatentDanger">
select * from p_latent_danger a
select
*,
CASE
WHEN a.reform_limit_date <![CDATA[ < ]]> NOW() THEN
1
ELSE
0
END as overtimeState
from p_latent_danger a
<where>
deleted = 0
<foreach collection="paramMap" index="key" item="value">
......
......@@ -118,6 +118,7 @@
p_route b
WHERE
a.route_Id = b.id and a.is_delete = 0
and (a.status > 0 or a.maker_user_id = #{loginUserId})
<if test="planName!=null">and a.name like concat(concat("%",#{planName}),"%")</if>
<if test="checkTypeId!=null and checkTypeId != '' ">and a.check_type_id = #{checkTypeId}</if>
<if test="leadPerson!=null and leadPerson != '' ">and a.lead_people_ids = #{leadPerson}</if>
......@@ -167,6 +168,7 @@
p_route b
WHERE
a.route_Id = b.id and a.is_delete = 0
and (a.status > 0 or a.maker_user_id = #{loginUserId})
<if test="planName!=null"> and a.name like concat(concat("%",#{planName}),"%")</if>
<if test="checkTypeId!=null and checkTypeId != '' "> and a.check_type_id = #{checkTypeId}</if>
<if test="leadPerson!=null and leadPerson != '' "> and a.lead_people_ids = #{leadPerson}</if>
......
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