267 lines
9.9 KiB
Java
267 lines
9.9 KiB
Java
package com.zcloud.service.firemanager.impl;
|
|
|
|
import com.zcloud.entity.Page;
|
|
import com.zcloud.entity.PageData;
|
|
import com.zcloud.mapper.datasource.firemanager.FireCheckStandardMapper;
|
|
import com.zcloud.service.bus.SysDateService;
|
|
import com.zcloud.service.firemanager.FireCheckStandardService;
|
|
import com.zcloud.service.firemanager.FirePointService;
|
|
import com.zcloud.service.firemanager.FirePreparedCheckListService;
|
|
import com.zcloud.service.firemanager.FireRecordService;
|
|
import com.zcloud.util.DateUtil;
|
|
import com.zcloud.util.PeriodDateUtil;
|
|
import com.zcloud.util.UuidUtil;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @ClassName 点检标准
|
|
* @Description 点检标准
|
|
* @Author Dear lin
|
|
* @Date 13:53 2023/2/12
|
|
* @Version 1.0
|
|
**/
|
|
@Service
|
|
public class FireCheckStandardServiceImpl implements FireCheckStandardService {
|
|
@Resource
|
|
private FireCheckStandardMapper fireCheckStandardMapper;
|
|
|
|
@Resource
|
|
private FirePreparedCheckListService firePreparedCheckListService;
|
|
@Resource
|
|
private FirePointService firePointService;
|
|
@Resource
|
|
private SysDateService sysDateService;
|
|
@Resource
|
|
private FireRecordService fireRecordService;
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void saveImportCheckStandard(List<PageData> listPd) {
|
|
fireCheckStandardMapper.saveImportCheckStandard(listPd);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> list(Page page) {
|
|
return fireCheckStandardMapper.datalistPage(page);
|
|
}
|
|
|
|
@Override
|
|
public PageData findById(PageData pd) {
|
|
return fireCheckStandardMapper.getInfo(pd);
|
|
}
|
|
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void updCheckStandardById(PageData pd) {
|
|
fireCheckStandardMapper.updById(pd);
|
|
}
|
|
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean delCheckStandardByIds(PageData pd) {
|
|
PageData data = fireCheckStandardMapper.tryDel(pd);
|
|
String data_ids = pd.getString("DATA_IDS");
|
|
String[] ArrayDATA_IDS = data_ids.split(",");
|
|
/*String newIds = "";
|
|
for (int i = 0 ; i < split.length ; i++) {
|
|
if (i == 0) {
|
|
newIds = split[i]+"',";
|
|
}else if (i == split.length-1) {
|
|
newIds = newIds + "'"+split[i];
|
|
}else {
|
|
newIds = newIds + "'"+split[i]+"',";
|
|
}
|
|
}
|
|
pd.put("DATA_IDS",newIds);*/
|
|
if ("0".equals(String.valueOf(data.get("sum")))) {
|
|
fireCheckStandardMapper.delByIds(ArrayDATA_IDS);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void saveInfo(PageData pd) {
|
|
fireCheckStandardMapper.saveInfo(pd);
|
|
}
|
|
@Override
|
|
public List<PageData> getRiskByApp(PageData pageData) {
|
|
String fireRecordId = (String) pageData.get("FIRE_RECORD_ID");
|
|
String FIRE_CHECK_ID = (String) pageData.get("FIRE_CHECK_ID");
|
|
String FIRE_CHECK_TYPE = (String) pageData.get("FIRE_CHECK_TYPE");
|
|
String PHONE_REPEAT = (String) pageData.get("PHONE_REPEAT");
|
|
String USER_ID = (String) pageData.get("USER_ID");
|
|
PageData sysdate = new PageData();
|
|
sysdate.put("DATE", DateUtil.date2Str(new Date()));
|
|
try {
|
|
sysdate = sysDateService.findByDate(sysdate);
|
|
} catch (Exception e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
PageData data = fireRecordService.hasBeenAdded(pageData);
|
|
if (data != null && "0".equals(String.valueOf(data.get("sum")))) {
|
|
// 添加记录
|
|
PageData recordPd = new PageData();
|
|
if ("0".equals(PHONE_REPEAT)) {
|
|
// 已经完成再完成的情况
|
|
// "REPEATCHECK", 2
|
|
recordPd.put("REPEATCHECK", 2);
|
|
}
|
|
String[] periodDate = PeriodDateUtil.getPeriodDate(sysdate, FIRE_CHECK_TYPE);
|
|
recordPd.put("FIRE_CHECK_ID", FIRE_CHECK_ID);
|
|
recordPd.put("FIRE_RECORD_ID", fireRecordId);
|
|
recordPd.put("PERIODSTART", periodDate[0]);
|
|
recordPd.put("PERIODEND", periodDate[1]);
|
|
recordPd.put("PHONE_REPEAT", 1);
|
|
recordPd.put("CREATOR", USER_ID);
|
|
recordPd.put("OPERATOR", USER_ID);
|
|
recordPd.put("CREATTIME", DateUtil.date2Str(new Date()));
|
|
recordPd.put("OPERATTIME", DateUtil.date2Str(new Date()));
|
|
fireRecordService.additionRecord(Collections.singletonList(recordPd));
|
|
// 添加设备记录
|
|
List<PageData> dataList = fireCheckStandardMapper.getStandardByApp(pageData);
|
|
dataList.forEach(x -> {
|
|
x.put("EQUIPMENT_RECORD_ID", UuidUtil.get32UUID());
|
|
x.put("FIRE_RECORD_ID", fireRecordId);
|
|
x.put("CREATTIME", DateUtil.date2Str(new Date()));
|
|
x.put("OPERATTIME", DateUtil.date2Str(new Date()));
|
|
x.put("CREATOR", USER_ID);
|
|
x.put("OPERATOR", USER_ID);
|
|
if ("".equals(x.get("HIDDEN_ID").toString())) {
|
|
x.put("HIDDEN_ID", null);
|
|
x.put("ISNORMAL",2);
|
|
}else {
|
|
//控制手机端一开始检查的时候针对有隐患的设备的选中。
|
|
x.put("ISNORMAL",3);
|
|
}
|
|
});
|
|
fireRecordService.additionRecordDeviceByApp(dataList);
|
|
}
|
|
return fireRecordService.goCheckByApp(pageData);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getList(Page page) {
|
|
return fireCheckStandardMapper.getdatalistPage(page);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getStandardByDeviceId(Page page) {
|
|
return fireCheckStandardMapper.getStandardByDeviceId(page);
|
|
}
|
|
|
|
@Override
|
|
public PageData getTypeName(PageData pageData) {
|
|
return fireCheckStandardMapper.getTypeNameByDeviceType(pageData);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getStandardByRidAndHAShidden(PageData pageData) {
|
|
PageData data = fireRecordService.hasBeenAdded(pageData);
|
|
String fireRecordId = (String) pageData.get("FIRE_RECORD_ID");
|
|
String USER_ID = (String) pageData.get("USER_ID");
|
|
if (data != null && "0".equals(String.valueOf(data.get("sum")))) {
|
|
// 添加记录为空 添加此信息
|
|
List<PageData> dataList = fireCheckStandardMapper.getStandardByRidAndHAShidden(pageData);
|
|
dataList.forEach(x -> {
|
|
x.put("EQUIPMENT_RECORD_ID", UuidUtil.get32UUID());
|
|
x.put("FIRE_RECORD_ID", fireRecordId);
|
|
x.put("CREATTIME", DateUtil.date2Str(new Date()));
|
|
x.put("OPERATTIME", DateUtil.date2Str(new Date()));
|
|
x.put("CREATOR", USER_ID);
|
|
x.put("OPERATOR", USER_ID);
|
|
});
|
|
return dataList;
|
|
}
|
|
return fireRecordService.goCheckByApp(pageData);
|
|
}
|
|
|
|
/**
|
|
* @Description: app=》 具体详情
|
|
* @Author: dearLin
|
|
* @Date: 2023/2/21/021 17:29
|
|
* @Param: [com.zcloud.entity.PageData] [pageData]
|
|
* @Return: java.util.List<com.zcloud.entity.PageData>
|
|
*/
|
|
@Override
|
|
public PageData goCheckByApp(PageData pageData) {
|
|
return fireRecordService.goCheckInfoByApp(pageData);
|
|
}
|
|
|
|
public List<PageData> getListAll(PageData pd) throws Exception{
|
|
return fireCheckStandardMapper.getListAll(pd);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getStandardByCheckId(PageData pageData) {
|
|
return firePreparedCheckListService.getPreparedCheckItem(pageData);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getAppRiskByPoint(PageData pageData) {
|
|
return fireRecordService.getAppRiskByPoint(pageData);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getPcStandardByCheckId(PageData pageData) {
|
|
return firePreparedCheckListService.getPcStandardByCheckId(pageData);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getPcStandard4Edit(PageData pageData) {
|
|
return firePreparedCheckListService.getPcStandard4Edit(pageData);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getAppRiskByDevice(PageData pageData) {
|
|
List<PageData> appRiskByDevice = firePreparedCheckListService.getAppRiskByDevice(pageData);
|
|
appRiskByDevice.forEach(item ->{
|
|
String[] fireCheckStandardItems = item.getString("FIRE_CHECK_STANDARD_ITEM").split("@@");
|
|
item.put("fireDeviceTypeList",fireCheckStandardItems);
|
|
});
|
|
return appRiskByDevice;
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getStandardByDeviceIds(List<PageData> deviceListByPointId) {
|
|
return firePreparedCheckListService.getStandardByDeviceIds(deviceListByPointId);
|
|
}
|
|
|
|
@Override
|
|
public List<PageData> getStandardListByDeviceType(PageData pd) {
|
|
return fireCheckStandardMapper.getStandardListByDeviceType(pd);
|
|
}
|
|
@Override
|
|
public List<PageData> goRecordDeviceByPid(PageData pd){
|
|
List<PageData> list = fireRecordService.goRecordDeviceByPid(pd);
|
|
list.forEach(item ->{
|
|
String[] fireCheckStandardItems = item.getString("FIRE_CHECK_STANDARD_ITEM").split("@@");
|
|
item.put("fireDeviceTypeList",fireCheckStandardItems);
|
|
});
|
|
return list;
|
|
}
|
|
|
|
|
|
@Override
|
|
public List<PageData> getPointListByUserId(PageData pageData) {
|
|
List<PageData> pointListByUserId = fireCheckStandardMapper.getPointListByUserId(pageData);
|
|
List<String> pointIds = new ArrayList<>();
|
|
List<PageData> dataList = new ArrayList<>();
|
|
if (pointListByUserId.size() > 0) {
|
|
for (PageData data : pointListByUserId) {
|
|
pointIds.add(data.getString("FIRE_POINT_ID"));
|
|
}
|
|
dataList = firePointService.findByIds(pointIds);
|
|
}
|
|
return dataList;
|
|
}
|
|
|
|
}
|