Commit 37872db0 authored by KeYong's avatar KeYong

巡查报表提交

parent 3c763c09
......@@ -217,16 +217,23 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
String iotCode = pumpInfoList.get(0).get("iotCode").toString();
if (iotCode.length() > 8) {
String prefix = iotCode.substring(0, 8);
List<Map<String, String>> iotDataList = getIotTopSingleField(top, prefix, null, null, nameKey);
List<Map<String, String>> iotDataList = new ArrayList<>();
try {
iotDataList = getIotTopSingleField(top, prefix, null, null, nameKey);
} catch (Exception e) {
e.printStackTrace();
}
//将iot的List<Map<String, String>>转化为List<IotDataVO>类型
iotDataList.forEach(e -> {
try {
IotDataVO iotDataVO = (IotDataVO) mapToObject(e, IotDataVO.class, nameKey);
dataList.add(iotDataVO);
} catch (Exception el) {
throw new BadRequest("IOT数据类型转换失败");
}
});
if (0 < iotDataList.size()) {
iotDataList.forEach(e -> {
try {
IotDataVO iotDataVO = (IotDataVO) mapToObject(e, IotDataVO.class, nameKey);
dataList.add(iotDataVO);
} catch (Exception el) {
throw new BadRequest("IOT数据类型转换失败");
}
});
}
}
} else {
throw new BadRequest("装备物联编码错误,请确认!");
......@@ -400,7 +407,12 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
@Override
public List<Map<String, String>> getIotTopSingleField(String top, String productKey, String deviceName, String key, String fieldKey) {
ResponseModel responseModel = iotFeign.topSingleField(top, productKey, deviceName, key, fieldKey);
ResponseModel responseModel = null;
try {
responseModel = iotFeign.topSingleField(top, productKey, deviceName, key, fieldKey);
} catch (Exception e) {
e.printStackTrace();
}
if (responseModel != null && 200 == responseModel.getStatus()) {
String json = JSON.toJSONString(responseModel.getResult());
return (List<Map<String, String>>) JSONArray.parse(json);
......@@ -410,7 +422,12 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
@Override
public List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey) {
ResponseModel responseModel = iotFeign.selectListNew(prefix, suffix, startTime, endTime, key, fieldKey);
ResponseModel responseModel = null;
try {
responseModel = iotFeign.selectListNew(prefix, suffix, startTime, endTime, key, fieldKey);
} catch (Exception e) {
e.printStackTrace();
}
if (responseModel != null && 200 == responseModel.getStatus()) {
String json = JSON.toJSONString(responseModel.getResult());
return (List<Map<String, String>>) JSONArray.parse(json);
......
......@@ -146,6 +146,12 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<classifier>jdk16</classifier>
</dependency>
</dependencies>
</project>
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.param.PlanInfoPageParam;
import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
......@@ -17,6 +18,7 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.request.ToJson;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.dao.entity.Point;
import com.yeejoin.amos.patrol.dao.entity.PointClassify;
......@@ -29,15 +31,19 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -115,29 +121,6 @@ public class PlanTaskController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "计划执行重做", notes = "计划执行重做")
@RequestMapping(value = "/regenPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
......@@ -166,23 +149,6 @@ public class PlanTaskController extends AbstractBaseController {
/**
* 计划执行删除
*
......@@ -204,8 +170,6 @@ public class PlanTaskController extends AbstractBaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出巡检记录", notes = "导出巡检记录")
@RequestMapping(value = "/exportSelectPlanTaskNew", method = RequestMethod.GET)
......@@ -242,7 +206,6 @@ public class PlanTaskController extends AbstractBaseController {
}
/**
* 计划执行查询
*
......@@ -1071,4 +1034,40 @@ public class PlanTaskController extends AbstractBaseController {
return CommonResponseUtil.failure(e.getMessage());
}
}
/**
* 巡检任务列表
* @param queryRequests
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡查任务分页列表", notes = "巡查任务分页列表")
@RequestMapping(value = "/page", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse getPlanTaskPageList(@ApiParam(value = "查询条件", required = false)
@RequestBody(required = false) PlanTaskPageParam queryRequests) {
ReginParams reginParams = getSelectedOrgInfo();
queryRequests.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
Page<HashMap<String, Object>> list = planTaskService.getPlanTaskPageList(queryRequests);
Object ob = list.getContent().size() > 0 ? ToJson.tojson(list) : null;
return CommonResponseUtil.success(ob);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "预览巡查报表", notes = "预览巡查报表")
@RequestMapping(value = "/preview", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse preview(@ApiParam(value = "任务id", required = true) @RequestParam String taskDetailId) {
RequestContext.setProduct(getProduct());
RequestContext.setAppKey(getAppKey());
RequestContext.setToken(getToken());
return CommonResponseUtil.success(planTaskService.preview(taskDetailId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载巡查报表", notes = "下载巡查报表")
@RequestMapping(value = "/download", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public void download(HttpServletRequest request, HttpServletResponse response, @ApiParam(value = "任务id", required = true) @RequestParam String taskDetailId) throws UnsupportedEncodingException {
planTaskService.download(request, response, taskDetailId);
}
}
......@@ -196,4 +196,22 @@ public interface PlanTaskMapper extends BaseMapper {
* @return 消防巡检信息统计
*/
List<Map<String, Object>> firePatrolStatics(@Param("bizOrgCode") String bizOrgCode);
long countData(@Param(value="param") PlanTaskPageParam param);
List<HashMap<String, Object>> planTaskPage(@Param(value="param") PlanTaskPageParam param);
Map<String, Object> getPlanTaskBasicInfo(@Param(value="taskDetailId") String taskDetailId);
Map<String, Object> getPlanTaskExecuteInfo(@Param(value="taskDetailId") String taskDetailId);
List<String> getDefinitionObjCode(@Param(value="taskDetailId") String taskDetailId);
Map<String, Object> getDefectEquipInfo(@Param(value="id") String id);
List<Map<String, Object>> getCheckMissedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
List<Map<String, Object>> getCheckQualifiedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
List<Map<String, Object>> getCheckNotQualifiedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
}
package com.yeejoin.amos.patrol.business.feign;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author DELL
*/
@FeignClient(name = "${idx.feign.name}", path = "idx", configuration = {FeignConfiguration.class})
public interface IdxFeign {
/***
* <pre>
* @Description: 根据巡检转缺陷code查询缺陷列表
* </pre>
*
* @MethodName:
* @Param:
* @Return: null
* @Throws
* @Author keyong
* @Date 2023/04/22 17:46
*/
@PostMapping(value = "/defect/check/list")
FeignClientResult queryDefectByCodes(@RequestBody List<String> codes);
}
......@@ -32,7 +32,27 @@ public class PlanTaskPageParam extends CommonPageable {
* 所属计划
*/
private String planId;
private String beginTime;
private String endTime;
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getBeginTime() {
return beginTime;
}
public String getEndTime() {
return endTime;
}
/**
* 所属路线
*/
......@@ -56,6 +76,16 @@ public class PlanTaskPageParam extends CommonPageable {
private String searchDay;
private String taskName;
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskName() {
return taskName;
}
public String getSearchDay() {
return searchDay;
}
......
......@@ -11,6 +11,9 @@ import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.dao.entity.PlanTask;
import org.springframework.data.domain.Page;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
......@@ -183,4 +186,13 @@ public interface IPlanTaskService {
* @return 消防巡检信息统计
*/
List<Map<String,Object>> firePatrolStatics(String bizOrgCode);
/**
* 计划执行查询
*/
Page<HashMap<String, Object>> getPlanTaskPageList(PlanTaskPageParam params);
Map<String, String> preview(String taskDetailId);
void download(HttpServletRequest request, HttpServletResponse response, String taskDetailId) throws UnsupportedEncodingException;
}
package com.yeejoin.amos.patrol.business.util;
import lombok.NonNull;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
/**
* @author keyong
* @title: MyByteArrayMultipartFile
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/21 16:47
*/
public class MyByteArrayMultipartFile implements MultipartFile {
private String name;
private String originalFilename;
private String contentType;
public MyByteArrayMultipartFile(String name, String originalFilename, String contentType, @NonNull byte[] bytes) {
super();
this.name = name;
this.originalFilename = originalFilename;
this.contentType = contentType;
this.bytes = bytes;
}
public MyByteArrayMultipartFile() {
super();
// TODO Auto-generated constructor stub
}
public String getName() {
return name;
}
public String getOriginalFilename() {
return originalFilename;
}
public String getContentType() {
return contentType;
}
public byte[] getBytes() {
return bytes;
}
@NonNull
byte[] bytes;
@Override
public boolean isEmpty() {
return bytes.length == 0;
}
@Override
public long getSize() {
return bytes.length;
}
@Override
public InputStream getInputStream() {
return new ByteArrayInputStream(bytes);
}
@Override
public void transferTo(File destination) throws IOException {
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(destination);
outputStream.write(bytes);
} finally {
if (outputStream != null) {
outputStream.close();
}
}
}
}
package com.yeejoin.amos.patrol.business.util;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import sun.misc.BASE64Encoder;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
/**
* @author keyong
* @title: WordTemplateUtils
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/21 16:35
*/
public class WordTemplateUtils {
private static String fileUploadDir;
private Configuration configuration;
private static WordTemplateUtils wordTemplateUtils;
private WordTemplateUtils() {
configuration = new Configuration();
configuration.setDefaultEncoding("utf-8");
}
public static synchronized WordTemplateUtils getInstance() {
if (wordTemplateUtils == null) {
//添加你的内容
Properties props;
try {
props = PropertiesLoaderUtils.loadAllProperties("application-dev.properties");
fileUploadDir = (String) props.get("file.uploadUrl");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wordTemplateUtils = new WordTemplateUtils();
}
return wordTemplateUtils;
}
public void exportMillCertificateWord(HttpServletRequest request, HttpServletResponse response, Map map,
String title, String ftlFile) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null;
InputStream fin = null;
ServletOutputStream out = null;
try {
// 调用工具类的createDoc方法生成Word文档
file = createDoc(map, freemarkerTemplate);
fin = new FileInputStream(file);
response.setCharacterEncoding("utf-8");
response.setContentType("application/msword");
// 设置浏览器以下载的方式处理该文件名
String fileName = (StringUtils.isNotEmpty(title) ? title : getUUID()) + ".doc";
response.setHeader("Content-Disposition",
"attachment;filename=".concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
out = response.getOutputStream();
// 缓冲区
byte[] buffer = new byte[512];
int bytesToRead = -1;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = fin.read(buffer)) != -1) {
out.write(buffer, 0, bytesToRead);
}
} finally {
if (fin != null) {
fin.close();
}
if (out != null) {
out.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
}
}
/**
* 生成文件名
*
* @param * @param
* @return
*/
public static String getUUID() {
return UUID.randomUUID().toString().replace("-", "");
}
public File getWordFileItem(Map map, String title, String ftlFile,String type) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null;
File filepdf = new File("sellPlan.pdf");
InputStream fin = null;
OutputStream os = null;
try {
// 调用工具类的createDoc方法生成Word文档
file = createDoc(map, freemarkerTemplate);
fin = new FileInputStream(file);
os = new FileOutputStream(filepdf);
wordTopdfByAspose(fin, os,type);
return filepdf;
} finally {
if (fin != null) {
fin.close();
}
if (os != null) {
os.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
}
}
private static File createDoc(Map<?, ?> dataMap, Template template) {
String name = "sellPlan.doc";
File f = new File(name);
Template t = template;
try {
// 这个地方不能使用FileWriter因为需要指定编码类型否则生成的Word文档会因为有无法识别的编码而无法打开
Writer w = new OutputStreamWriter(new FileOutputStream(f), "utf-8");
t.process(dataMap, w);
w.close();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
return f;
}
public boolean wordTopdfByAspose(InputStream inputStream, OutputStream outputStream,String type) {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!getLicense()) {
return false;
}
try {
// 将源文件保存在com.aspose.words.Document中,具体的转换格式依靠里面的save方法
com.aspose.words.Document doc = new com.aspose.words.Document(inputStream);
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
if("pdf".equals(type)){
doc.save(outputStream, SaveFormat.PDF);
}else {
doc.save(outputStream, SaveFormat.DOCX);
}
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (outputStream != null) {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return true;
}
// 官方文档的要求 无需理会
public static boolean getLicense() {
boolean result = false;
try {
String s = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 获得图片的base64码
*
* @param src 图片路径
* @return String
*/
@SuppressWarnings("deprecation")
public String getImageBase(String src) {
if (StringUtils.isEmpty(src)) {
return "";
}
src = src.replaceAll("\\.\\.", "");
String fileName = fileUploadDir + src;
File file = new File(fileName);
if (!file.exists()) {
return "";
}
InputStream in = null;
byte[] data = null;
try {
in = new FileInputStream(file);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
try {
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}
}
package com.yeejoin.amos.patrol.business.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author keyong
* @title: DefectVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/22 22:30
*/
@Data
public class DefectVo {
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 batchId;
@ApiModelProperty(value = "设备code")
private String defectEquipmentCode;
}
package com.yeejoin.amos.patrol.core.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: DefectLevelEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/23 8:30
*/
@AllArgsConstructor
@Getter
public enum DefectLevelEnum {
GENERAL(1, "一般"),
SEVERITY(2, "严重"),
URGENT(3, "危急");
private Integer key;
private String value;
public static DefectLevelEnum getByKey(Integer key) {
for (DefectLevelEnum enums : DefectLevelEnum.values())
{
if (enums.getKey() == key)
{
return enums;
}
}
return null;
}
}
package com.yeejoin.amos.patrol.core.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: 模板分类
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/21 16:28
*/
@AllArgsConstructor
@Getter
public enum WordTemplateEnum {
firePatrolPlanTaskReport("消防巡查报表", "firePatrolPlanTaskReport.ftl");
private String label;
private String templateFile;
}
......@@ -588,11 +588,6 @@
</choose>
</select>
<!-- 巡检执行情况查询 -->
<select id="getChkExListNew" resultMap="ChkExResultMap">
select
......@@ -626,20 +621,6 @@
</choose>
</select>
<select id="getPlanTaskStatisticsForApp" resultType="Map">
SELECT
count(1) total,
......@@ -1173,4 +1154,201 @@
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</select>
<select id="countData" resultType="long">
SELECT
count(1)
FROM
`p_plan_task` ppk
LEFT JOIN p_plan pp ON pp.id = ppk.plan_id
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
LEFT JOIN p_route pr ON pr.id = ppk.route_id
<where>
<if test="param.userId != null "> find_in_set(#{param.userId}, ppk.user_id) </if>
<if test="param.beginTime != null and param.beginTime != '' "> and ppk.begin_time <![CDATA[>=]]> #{param.beginTime} </if>
<if test="param.endTime != null and param.endTime != ''"> and ppk.end_time <![CDATA[<=]]> #{param.endTime} </if>
<if test="param.taskName != null"> and pp.name like concat(concat("%", #{param.taskName}), "%") </if>
<if test="param.routeId!=null"> and ppk.route_id = #{param.routeId} </if>
</where>
ORDER BY
ppk.begin_time DESC
</select>
<select id="planTaskPage" resultType="java.util.HashMap">
SELECT
ppk.id AS planTaskId,
pptd.id AS taskDetailId,
pp.NAME AS taskName,
pr.`name` AS routeName,
DATE_FORMAT(ppk.begin_time, '%Y-%m-%d %H:%i:%s') AS beginTime,
DATE_FORMAT(ppk.end_time, '%Y-%m-%d %H:%i:%s') AS endTime,
ppk.point_num AS checkedNum,
ppk.finish_num AS finishedNum,
( CASE pptd.STATUS WHEN 0 THEN '未执行' WHEN 1 THEN '正常' WHEN 2 THEN '异常' WHEN 3 THEN '漏检' END ) AS execution,
ppk.user_id AS userId,
ppk.user_name AS executor
FROM
`p_plan_task` ppk
LEFT JOIN p_plan pp ON pp.id = ppk.plan_id
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
LEFT JOIN p_route pr ON pr.id = ppk.route_id
<where>
<if test="param.beginTime != null and param.beginTime != '' "> ppk.begin_time <![CDATA[>=]]> #{param.beginTime} </if>
<if test="param.endTime != null and param.endTime != ''"> and ppk.end_time <![CDATA[<=]]> #{param.endTime} </if>
<if test="param.taskName != null and param.taskName != ''"> and pp.name like concat(concat("%", #{param.taskName}), "%") </if>
<if test="param.status != null"> and pptd.STATUS = #{param.status} </if>
<if test="param.routeId != null"> and ppk.route_id = #{param.routeId} </if>
</where>
ORDER BY
ppk.begin_time DESC
<choose>
<when test="param.pageSize==-1"></when>
<when test="param.pageSize!=-1">limit #{param.offset}, #{param.pageSize}</when>
</choose>
</select>
<select id="getPlanTaskBasicInfo" resultType="Map">
SELECT
DISTINCT
ppk.id AS planTaskId,
pp.NAME AS taskName,
pp.biz_org_name AS stationName,
ppk.begin_time AS beginTime,
ppk.end_time AS endTime,
SEC_TO_TIME(UNIX_TIMESTAMP(ppk.end_time) - UNIX_TIMESTAMP(ppk.begin_time)) AS difSecond,
( CASE pptd.is_finish WHEN 0 THEN '未完成' WHEN 1 THEN '已完成' WHEN 2 THEN '超时漏检' END ) AS taskStatus
FROM
`p_plan_task` ppk
LEFT JOIN p_plan pp ON pp.id = ppk.plan_id
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
<where>
pptd.id = #{taskDetailId}
</where>
</select>
<select id="getPlanTaskExecuteInfo" resultType="Map">
SELECT
(SELECT
count(DISTINCT cl.id)
FROM
p_plan_task_detail de
LEFT JOIN p_point_classify cl ON cl.point_id = de.point_id
LEFT JOIN p_plan_task task ON task.id = de.task_no
WHERE
de.id = #{taskDetailId}) AS 'should_check_equip_num',
(SELECT
count(DISTINCT cl.id)
FROM
p_check pc
LEFT JOIN p_point_classify cl ON cl.point_id = pc.point_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.plan_task_detail_id = #{taskDetailId}
) AS 'real_check_equip_num',
(SELECT
count(DISTINCT cl.id)
FROM
p_check pc
LEFT JOIN p_point_classify cl ON cl.point_id = pc.point_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.is_ok = 1 AND pc.plan_task_detail_id = #{taskDetailId}
) AS 'qualified_equip_num',
(SELECT
count(DISTINCT cl.id)
FROM
p_check pc
LEFT JOIN p_point_classify cl ON cl.point_id = pc.point_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.is_ok = 2 AND pc.plan_task_detail_id = #{taskDetailId}
) AS 'not_qualified_equip_num',
(SELECT
count(DISTINCT cl.id)
FROM
p_check pc
LEFT JOIN p_point_classify cl ON cl.point_id = pc.point_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.is_ok = 3 AND pc.plan_task_detail_id = #{taskDetailId}
) AS 'missed_equip_num'
</select>
<select id="getDefinitionObjCode" resultType="String">
SELECT
cl.`code`
FROM
p_plan_task_detail de
LEFT JOIN p_point_classify cl ON cl.point_id = de.point_id
LEFT JOIN p_plan_task task ON task.id = de.task_no
WHERE
de.id = #{taskDetailId} AND cl.`code` IS NOT NULL
</select>
<select id="getDefectEquipInfo" resultType="Map">
SELECT
es.position AS equipLocation
FROM
wl_equipment_specific es
<where>
<if test="id != null">
es.id = #{id}
</if>
</where>
</select>
<select id="getCheckMissedEquipInfo" resultType="Map">
SELECT
cl.category_name AS equipName,
cl.building_name AS equipPosition,
'漏检' AS result,
cl.data_source_name AS remark
FROM
p_point_classify cl
LEFT JOIN p_check_input pci ON pci.point_classify_id = cl.id
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.is_ok = 3 AND pc.plan_task_detail_id = #{taskDetailId}
GROUP BY cl.id;
</select>
<select id="getCheckQualifiedEquipInfo" resultType="Map">
SELECT
cl.category_name AS equipName,
cl.building_name AS equipPosition,
pii.name AS checkItem,
'合格' AS result,
pc.check_time AS checkDate,
pc.user_name AS checkUserName
FROM
p_point_classify cl
LEFT JOIN p_check_input pci ON pci.point_classify_id = cl.id
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_input_item pii ON pii.id = pci.input_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.is_ok = 1 AND pc.plan_task_detail_id = #{taskDetailId}
GROUP BY cl.id;
</select>
<select id="getCheckNotQualifiedEquipInfo" resultType="Map">
SELECT
cl.category_name AS equipName,
cl.building_name AS equipPosition,
pii.name AS checkItem,
'不合格' AS result,
pc.check_time AS checkDate,
pc.user_name AS checkUserName,
cl.`code` AS objCode
FROM
p_point_classify cl
LEFT JOIN p_check_input pci ON pci.point_classify_id = cl.id
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_input_item pii ON pii.id = pci.input_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pc.is_ok = 2 AND pc.plan_task_detail_id = #{taskDetailId}
GROUP BY cl.id;
</select>
</mapper>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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