Commit 2546631b authored by suhuiguang's avatar suhuiguang

1.维保任务提交接口

2.配置连接修改为20
parent 1a8ff43c
......@@ -20,15 +20,25 @@ public class ReginParams implements Serializable {
public static class PersonIdentity {
private String identityType;
private String personSeq;
private String personName;
private String companyId;
public PersonIdentity(String identityType,String personName,String companyId){
public PersonIdentity(String identityType, String personSeq, String personName,String companyId){
this.identityType = identityType;
this.personSeq = personSeq;
this.personName = personName;
this.companyId = companyId;
}
public String getPersonSeq() {
return personSeq;
}
public void setPersonSeq(String personSeq) {
this.personSeq = personSeq;
}
public String getIdentityType() {
return identityType;
}
......
......@@ -179,8 +179,6 @@ public class Check extends BasicEntity {
@Column(name="error_classify")
private String errorClassify;
private List<CheckInput> checkInput;
private List<CheckShot> checkShot;
public Check() {
......@@ -372,14 +370,6 @@ public class Check extends BasicEntity {
}
@OneToMany(mappedBy = "check", cascade = {CascadeType.REMOVE,CascadeType.MERGE,CascadeType.PERSIST })
public List<CheckInput> getCheckInput() {
return checkInput;
}
public void setCheckInput(List<CheckInput > checkInput) {
this.checkInput = checkInput;
}
@OneToMany(mappedBy = "check", cascade = {CascadeType.REMOVE,CascadeType.MERGE,CascadeType.PERSIST })
public List<CheckShot> getCheckShot() {
return checkShot;
}
......
package com.yeejoin.amos.maintenance.dao.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.*;
import java.util.List;
/**
* The persistent class for the p_check_input database table.
*
*/
@Entity
@Table(name="p_check_input")
@NamedQuery(name="CheckInput.findAll", query="SELECT c FROM CheckInput c")
@Table(name = "p_check_input")
@NamedQuery(name = "CheckInput.findAll", query = "SELECT c FROM CheckInput c")
public class CheckInput extends BasicEntity {
private static final long serialVersionUID = 1L;
/**
* 巡检记录id
*/
@Column(name="check_id")
@Column(name = "check_id")
private Long checkId;
/**
* 检查项id
*/
@Column(name="input_id")
@Column(name = "input_id")
private Long inputId;
/**
* 检查项名称
*/
@Column(name="input_name")
@Column(name = "input_name")
private String inputName;
/**
* 巡检点检查项
*/
@Column(name="route_point_item_id")
@Column(name = "route_point_item_id")
private Long routePointItemId;
/**
* 输入值
*/
@Column(name="input_value")
@Column(name = "input_value")
private String inputValue;
/**
* 是否合格
*/
@Column(name="is_ok")
@Column(name = "is_ok")
private String isOk;
/**
* 序号
*/
@Column(name="order_no")
@Column(name = "order_no")
private int orderNo;
/**
* 权限系统org code
*/
@Column(name="org_code")
@Column(name = "org_code")
private String orgCode;
/**
* 检查点分类id
*/
@Column(name="point_classify_id")
@Column(name = "point_classify_id")
private Long pointClassifyId;
/**
* 检查点分类名称
*/
@Column(name="point_classify_name")
@Column(name = "point_classify_name")
private String pointClassifyName;
/**
......@@ -89,6 +84,17 @@ public class CheckInput extends BasicEntity {
*/
private String remark;
@Transient
public List<CheckShot> getCheckShotList() {
return checkShotList;
}
public void setCheckShotList(List<CheckShot> checkShotList) {
this.checkShotList = checkShotList;
}
private List<CheckShot> checkShotList;
public String getRemark() {
return remark;
}
......@@ -100,8 +106,6 @@ public class CheckInput extends BasicEntity {
public CheckInput() {
}
private Check check;
public Long getCheckId() {
return this.checkId;
......@@ -159,16 +163,6 @@ public class CheckInput extends BasicEntity {
this.score = score;
}
@ManyToOne
@JoinColumn(name = "checkId", referencedColumnName = "id", updatable = false, insertable = false)
public Check getCheck() {
return check;
}
public void setCheck(Check check) {
this.check = check;
}
public String getInputName() {
return inputName;
}
......
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.springframework.cglib.beans.BeanMap;
import com.google.common.collect.Lists;
......@@ -653,4 +654,8 @@ public abstract class AbstractBaseController extends BaseController{
return map;
}
public ReginParams.PersonIdentity opIdentifyInfo(){
return getSelectedOrgInfo().getPersonIdentity();
}
}
package com.yeejoin.amos.maintenance.business.controller;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.BooleanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dto.CheckDto;
import com.yeejoin.amos.maintenance.business.param.CheckInfoPageParam;
import com.yeejoin.amos.maintenance.business.param.CheckRecordParam;
import com.yeejoin.amos.maintenance.business.param.CheckStatisticalParam;
import com.yeejoin.amos.maintenance.business.service.intfc.ICheckService;
import com.yeejoin.amos.maintenance.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.maintenance.business.service.intfc.ISafety3DDataSendService;
import com.yeejoin.amos.maintenance.business.util.CheckPageParamUtil;
import com.yeejoin.amos.maintenance.business.util.CheckParamUtil;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.business.util.DaoCriteria;
import com.yeejoin.amos.maintenance.business.util.FileHelper;
import com.yeejoin.amos.maintenance.business.util.Toke;
import com.yeejoin.amos.maintenance.business.util.ToolUtils;
import com.yeejoin.amos.maintenance.business.util.*;
import com.yeejoin.amos.maintenance.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.maintenance.business.vo.CheckInfoVo;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.maintenance.core.async.AsyncTask;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import com.yeejoin.amos.maintenance.core.common.request.CommonRequest;
import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.maintenance.core.util.StringUtil;
import com.yeejoin.amos.maintenance.dao.entity.PlanTask;
import com.yeejoin.amos.maintenance.mqtt.WebMqttComponent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.BooleanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/api/check")
......@@ -85,9 +54,6 @@ public class CheckController extends AbstractBaseController {
private AsyncTask asyncTask;
@Autowired
private IPlanTaskService planTaskService;
@Autowired
private ISafety3DDataSendService is;
@Value("${windows.img.path}")
......@@ -96,18 +62,11 @@ public class CheckController extends AbstractBaseController {
@Value("${linux.img.path}")
private String linuxImgPath;
// @Value("${file.ip}")
// private String fileIp;
//
// @Value("${file.port}")
// private String filePort;
@Value("${file.url}")
private String fileUrl;
@Value("${amosRefresh.patrol.topic}")
private String patrolTopic;
@Autowired
private WebMqttComponent webMqttComponent;
/**
* 巡检计划查询
......@@ -132,7 +91,6 @@ public class CheckController extends AbstractBaseController {
hasOrgCode = Boolean.FALSE;
}
}
;
}
HashMap<String, Object> paramMap;
if (hasOrgCode) {
......@@ -177,21 +135,13 @@ public class CheckController extends AbstractBaseController {
List<CheckInfoVo> list = checkService.getCheckInfoList(getToken(), getProduct(), getAppKey(), param);
String fileName = "巡检记录" + new Date().getTime();
FileHelper.exportExcel(list, "维保记录", "维保记录", CheckInfoVo.class, fileName + ".xls", response);
// List<Long> idsList = checkService.getAllIdsByConditions(param);
// if (!CollectionUtils.isEmpty(idsList)) {
// List<CheckInfoVo> list = checkService.getSelectedCheckInfoList(idsList.toArray(new Long[idsList.size()]));
// this.userDeptNameConver(list);
// String fileName = "巡检记录" + System.currentTimeMillis();
// FileHelper.exportExcel(list, "巡检记录", "巡检记录", CheckInfoVo.class, fileName + ".xls", response);
// }
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出巡检记录", notes = "导出巡检记录")
@RequestMapping(value = "/exportSelectRecord", method = RequestMethod.GET)
public void exportSelectCheckRecord(
@ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids,
@ApiParam(value = "查询条件") @RequestParam(required = false) Long[] ids,
HttpServletResponse response) {
List<CheckInfoVo> list = checkService.getSelectedCheckInfoList(getToken(), getProduct(), getAppKey(), ids);
String fileName = "巡检记录" + new Date().getTime();
......@@ -202,7 +152,7 @@ public class CheckController extends AbstractBaseController {
@ApiOperation(value = "导出巡检记录图片", notes = "导出巡检记录图片")
@RequestMapping(value = "/exportImgs", method = RequestMethod.POST)
public void exportCheckImgs(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
HttpServletResponse response) {
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
......@@ -225,7 +175,6 @@ public class CheckController extends AbstractBaseController {
CheckInfoPageParam param = CheckPageParamUtil.fillCheckInfoParam(queryRequests, null, paramMap);
List<Map<String, Object>> list = checkService.getCheckInfoImgsList(param);
String fileName = "巡检记录图片" + new Date().getTime() + ".zip";
// String rootPath = "http://" + fileIp + ":" + filePort + "/";
for (Map<String, Object> map : list) {
map.put("photoData", fileUrl + map.get("photoData").toString());
}
......@@ -239,7 +188,6 @@ public class CheckController extends AbstractBaseController {
HttpServletResponse response) {
List<Map<String, Object>> list = checkService.getCheckInfoImgsList(ids);
String fileName = "巡检记录图片" + new Date().getTime() + ".zip";
// String rootPath = "http://" + fileIp + ":" + filePort + "/";
for (Map<String, Object> map : list) {
map.put("photoData", fileUrl + map.get("photoData").toString());
}
......@@ -247,86 +195,17 @@ public class CheckController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "保存巡检记录<font color='blue'>手机app</font>", notes = "保存巡检记录<font color='blue'>手机app</font>")
@ApiOperation(value = "保存巡检记录-mobile", notes = "保存巡检记录-mobile")
@RequestMapping(value = "/saveRecord", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse saveCheckRecord(
@ApiParam(value = "检查信息", required = false) @RequestBody(required = true) CheckRecordParam requestParam) {
Toke token = new Toke();
token.setProduct(request.getHeader("product"));
token.setToke(request.getHeader("X-Access-Token"));
token.setAppKey(request.getHeader("appKey"));
int statu = -1;
PlanTask planTask = null;
if (requestParam.getPlanTaskId() != null && requestParam.getPlanTaskId() != 0) {
planTask = planTaskService.selectPlanTaskStatus(requestParam.getPlanTaskId());
}
AgencyUserModel user = getUserInfo();
String userId = user.getUserId();
String realName = user.getRealName();
requestParam.setIsOffline(requestParam.getIsOffline() == null ? false : requestParam.getIsOffline());
@ApiParam(value = "检查信息") @RequestBody() CheckRecordParam requestParam) {
try {
if (planTask != null) {
if (!ToolUtils.transBeanList(planTask.getUserId()).contains(userId.toString())) {
return CommonResponseUtil.failure("无权执行该任务");
}
statu = planTask.getFinishStatus();
if (!requestParam.getIsOffline() && statu == PlanTaskFinishStatusEnum.OVERTIME.getValue()) {
return CommonResponseUtil.failure("任务已超时,上传失败!");
} else if (statu == PlanTaskFinishStatusEnum.FINISHED.getValue()) {
return CommonResponseUtil.failure("任务已完成!");
}
Date checkTime = requestParam.getIsOffline() ? com.yeejoin.amos.maintenance.core.util.DateUtil.getLongDate(requestParam.getCheckTime()) : new Date();
Date beginTime = com.yeejoin.amos.maintenance.core.util.DateUtil.getLongDate(planTask.getBeginTime());
Date endTime = com.yeejoin.amos.maintenance.core.util.DateUtil.getLongDate(planTask.getEndTime());
int beginCompareTo = checkTime.compareTo(beginTime);
int endCompareTo = checkTime.compareTo(endTime);
if (beginCompareTo == -1 || endCompareTo == 1) {
return CommonResponseUtil.failure("请在计划时间内完成任务!");
}
}
int count = checkService.checkHasRecord(requestParam);
if (count < 1 || requestParam.getPlanTaskId() < 1) {
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
String departmentId = getDepartmentId(reginParams);
requestParam.setOrgCode(orgCode);
requestParam.setUserId(getUserId());
requestParam.setCheckDepartmentId(departmentId);
CheckDto checkDto = checkService.saveCheckRecord(requestParam, getUserInfo(), reginParams.getDepartment(), token);
if (com.yeejoin.amos.maintenance.core.util.StringUtil.isNotEmpty(checkDto)) {
asyncTaskf(checkDto.getCheckId());
}
is.pointCheckInfoPushToB(checkDto.getCheckId());
//数字换流站页面刷新
try {
webMqttComponent.publish(patrolTopic, "");
} catch (Exception e) {
log.error("数字换流站页面推送失败-----------" + e.getMessage());
}
CheckDto checkDto = checkService.saveCheckRecord(requestParam, getSelectedOrgInfo());
return CommonResponseUtil.success(checkDto);
} else {
return CommonResponseUtil.success("无需重新巡检");
}
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
log.error(e.getMessage());
return CommonResponseUtil.failure("数据提交失败");
}
}
@Async
public void asyncTaskf(Long id) {
try {
asyncTask.pushCheckInfoTo3D(id);
asyncTask.pushCheckMessage(id);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure(e.getMessage());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -36,7 +36,7 @@ public interface CheckMapper extends BaseMapper {
List<PointCheckDetailBo> findCheckPointInputItem(@Param(value="checkId") long checkId);
int checkHasRecord(CheckRecordParam requestParam);
int checkHasRecord(@Param(value = "planTaskId") Long planTaskId, @Param(value = "checkId") Long pointId);
List<Map<String, Object>> queryCheckPointImgs(@Param(value="planTaskId") int planTaskId, @Param(value="pointId") int pointId);
......
package com.yeejoin.amos.maintenance.business.dto;
import lombok.Data;
/**
* @author DELL
*/
@Data
public class CheckShotDto {
private String shotType;
private String fileUrl;
}
package com.yeejoin.amos.maintenance.business.param;
import com.yeejoin.amos.maintenance.business.dto.CheckShotDto;
import lombok.Data;
import java.util.List;
/**
* @author DELL
*/
@Data
public class CheckInputParam {
private long inputItemId;
private String inputValue;
private String selectName;
private boolean isCheck;
private String remark;
private Long classifyIds;
private Long routePointItemId;
private List<String> checkInputImg;
public List<String> getCheckInputImg() {
return checkInputImg;
}
public CheckInputParam(String inputValue){
this.inputValue = inputValue;
}
public void setCheckInputImg(List<String> checkInputImg) {
this.checkInputImg = checkInputImg;
}
private List<CheckShotDto> checkInputShot;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public long getInputItemId() {
return inputItemId;
}
public void setInputItemId(long inputItemId) {
this.inputItemId = inputItemId;
}
public String getInputValue() {
return inputValue;
}
public void setInputValue(String inputValue) {
public CheckInputParam(String inputValue) {
this.inputValue = inputValue;
}
public String getSelectName() {
return selectName;
}
public void setSelectName(String selectName) {
this.selectName = selectName;
}
public boolean getIsCheck() {
return isCheck;
}
public void setIsCheck(boolean isCheck) {
this.isCheck = isCheck;
}
public Long getClassifyIds() {
return classifyIds;
}
public void setClassifyIds(Long classifyIds) {
this.classifyIds = classifyIds;
}
public Long getRoutePointItemId() {
return routePointItemId;
}
public void setRoutePointItemId(Long routePointItemId) {
this.routePointItemId = routePointItemId;
}
}
package com.yeejoin.amos.maintenance.business.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
public class CheckRecordParam {
private Long planTaskId;
private Long pointId;
private String pointName;
private Long checkId;
private String remark;
private String userId;
private String orgCode;
private String checkDepartmentId;
private List<String> checkRecordImg;
/**
* 检查项分类
*/
private Long classId;
/**
* 路线id
*/
private Long routeId;
/**
* 检查时间
/**
* @author DELL
*/
private String checkTime;
private String checkMode;
/**
* 是否离线提交
*/
private Boolean isOffline = false;
private List<CheckInputParam> checkItems;
public Long getPointId() {
return pointId;
}
public void setPointId(Long pointId) {
this.pointId = pointId;
}
public Long getCheckId() {
return checkId;
}
public void setCheckId(Long checkId) {
this.checkId = checkId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public List<CheckInputParam> getCheckItems() {
return checkItems;
}
public void setCheckItems(List<CheckInputParam> checkItems) {
this.checkItems = checkItems;
}
public Long getPlanTaskId() {
return planTaskId;
}
public void setPlanTaskId(Long planTaskId) {
this.planTaskId = planTaskId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getCheckTime() {
return checkTime;
}
public String getCheckMode() {
return checkMode;
}
public void setCheckTime(String checkTime) {
this.checkTime = checkTime;
}
public Long getRouteId() {
return routeId;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}
@Data
@ApiModel(value = "任务提交")
public class CheckRecordParam {
public String getPointName() {
return pointName;
}
@ApiModelProperty(value = "任务id",required = true)
private Long planTaskId;
public void setPointName(String pointName) {
this.pointName = pointName;
}
@ApiModelProperty(value = "点id",required = true)
private Long pointId;
public void setCheckMode(String checkMode) {
this.checkMode = checkMode;
}
@ApiModelProperty(value = "点名称")
private String pointName;
public Long getClassId() {
return classId;
}
@ApiModelProperty(value = "检查记录id")
private Long checkId;
public void setClassId(Long classId) {
this.classId = classId;
}
@ApiModelProperty(value = "执行人id")
private String userId;
public Boolean getIsOffline() {
return isOffline;
}
@ApiModelProperty(value = "任务id")
private String orgCode;
public void setIsOffline(Boolean isOffline) {
this.isOffline = isOffline;
}
@ApiModelProperty(value = "备注")
private String remark;
public String getCheckDepartmentId() {
return checkDepartmentId;
}
public void setCheckDepartmentId(String checkDepartmentId) {
this.checkDepartmentId = checkDepartmentId;
}
@ApiModelProperty(value = "路线id")
private Long routeId;
public List<String> getCheckRecordImg() {
return checkRecordImg;
}
@ApiModelProperty(value = "检查时间")
private String checkTime;
public void setCheckRecordImg(List<String> checkRecordImg) {
this.checkRecordImg = checkRecordImg;
}
/**
* 检查项
*/
@ApiModelProperty(value = "检查项",required = true)
private List<CheckInputParam> checkItems;
}
package com.yeejoin.amos.maintenance.business.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.CollectionUtils;
import org.assertj.core.util.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
......@@ -42,64 +16,45 @@ import com.yeejoin.amos.maintenance.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper;
import com.yeejoin.amos.maintenance.business.dao.repository.ICatalogTreeDao;
import com.yeejoin.amos.maintenance.business.dao.repository.ICheckDao;
import com.yeejoin.amos.maintenance.business.dao.repository.ICheckInputDao;
import com.yeejoin.amos.maintenance.business.dao.repository.ICheckShotDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IInputItemDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IPointClassifyDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IPointDao;
import com.yeejoin.amos.maintenance.business.dao.repository.*;
import com.yeejoin.amos.maintenance.business.dto.CheckDto;
import com.yeejoin.amos.maintenance.business.dto.CheckRecordDto;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckDetailBo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckInfoBo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckInputBo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckTraListBo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckUserBo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.EquipmentInputItemRo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.PlanRoutePointBo;
import com.yeejoin.amos.maintenance.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.maintenance.business.dto.CheckShotDto;
import com.yeejoin.amos.maintenance.business.entity.mybatis.*;
import com.yeejoin.amos.maintenance.business.feign.EquipFeign;
import com.yeejoin.amos.maintenance.business.param.CheckInfoListPageParam;
import com.yeejoin.amos.maintenance.business.param.CheckInfoPageParam;
import com.yeejoin.amos.maintenance.business.param.CheckInputParam;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
import com.yeejoin.amos.maintenance.business.param.CheckRecordParam;
import com.yeejoin.amos.maintenance.business.param.CheckStatisticalParam;
import com.yeejoin.amos.maintenance.business.param.*;
import com.yeejoin.amos.maintenance.business.service.intfc.ICheckService;
import com.yeejoin.amos.maintenance.business.service.intfc.IEquipmentHandlerService;
import com.yeejoin.amos.maintenance.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.maintenance.business.service.intfc.IPointService;
import com.yeejoin.amos.maintenance.business.util.CheckDetailInputPageParam;
import com.yeejoin.amos.maintenance.business.util.Toke;
import com.yeejoin.amos.maintenance.business.util.ToolUtils;
import com.yeejoin.amos.maintenance.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.maintenance.business.vo.CheckInfoVo;
import com.yeejoin.amos.maintenance.common.enums.CheckStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.PointLevelEnum;
import com.yeejoin.amos.maintenance.common.enums.PointStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.RuleTypeEnum;
import com.yeejoin.amos.maintenance.core.common.response.AppCheckInputRespone;
import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.maintenance.core.common.response.CalendarStatusCountRespone;
import com.yeejoin.amos.maintenance.core.common.response.CommonPage;
import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.maintenance.core.common.response.PatrolUserRespone;
import com.yeejoin.amos.maintenance.core.common.response.PointInfoResponse;
import com.yeejoin.amos.maintenance.core.common.response.PointPositionInfoSyn3DRespone;
import com.yeejoin.amos.maintenance.core.common.response.QueryCriteriaRespone;
import com.yeejoin.amos.maintenance.core.common.response.RouteResponse;
import com.yeejoin.amos.maintenance.core.common.response.*;
import com.yeejoin.amos.maintenance.core.util.DateUtil;
import com.yeejoin.amos.maintenance.core.util.StringUtil;
import com.yeejoin.amos.maintenance.dao.entity.Check;
import com.yeejoin.amos.maintenance.dao.entity.CheckInput;
import com.yeejoin.amos.maintenance.dao.entity.CheckShot;
import com.yeejoin.amos.maintenance.dao.entity.InputItem;
import com.yeejoin.amos.maintenance.dao.entity.PlanTask;
import com.yeejoin.amos.maintenance.dao.entity.PlanTaskDetail;
import com.yeejoin.amos.maintenance.dao.entity.Point;
import com.yeejoin.amos.maintenance.dao.entity.PointClassify;
import com.yeejoin.amos.maintenance.dao.entity.*;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.CollectionUtils;
import org.assertj.core.util.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import javax.transaction.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@Service("checkService")
public class CheckServiceImpl implements ICheckService {
......@@ -114,12 +69,14 @@ public class CheckServiceImpl implements ICheckService {
private IPointService iPointService;
@Autowired
private IPlanTaskService planTaskService;
@Autowired
private ICatalogTreeDao catalogTreeDao;
@Resource
@Autowired
ICheckShotDao checkShotDao;
@Resource
IPlanTaskDao planTaskDao;
@Autowired
PlanTaskMapper planTaskMapper;
......@@ -141,16 +98,8 @@ public class CheckServiceImpl implements ICheckService {
IEquipmentHandlerService equipmentHandlerService;
@Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
IPointDao iPointDao;
// @Value("${file.ip}")
// private String fileIp;
//
// @Value("${file.port}")
// private String filePort;
@Value("${file.url}")
private String fileUrl;
......@@ -165,236 +114,161 @@ public class CheckServiceImpl implements ICheckService {
return new PageImpl<>(content, param, total);
}
@Override
@Transactional
public void saveCheckImg(List<CheckShot> imgList) {
Check check = checkDao.findById(imgList.get(0).getCheckId()).get();
check.setShotNumber(check.getShotNumber() + imgList.size());
checkDao.save(check);
checkShotDao.saveAll(imgList);
}
@Override
@Transactional
public CheckDto saveCheckRecord(CheckRecordParam requestParam, AgencyUserModel user, DepartmentBo departmentModel, Toke token) {
PlanTaskDetail taskDetail = null;
PlanTask planTask = null;
public CheckDto saveCheckRecord(CheckRecordParam recordParam, ReginParams reginParams) throws Exception {
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
//执行人-维保人员,非amos 账号
String mtUserSeq = personIdentity.getPersonSeq();
PlanTask planTask = planTaskService.selectPlanTaskStatus(recordParam.getPlanTaskId());
Map detail = planTaskDetailMapper.findPlanTaskByTaskIdAndPointId(recordParam.getPlanTaskId(), recordParam.getPointId());
//1.前置校验
this.checkCanFinishTask(mtUserSeq, planTask, recordParam.getPointId());
Point point = iPointService.queryPointById(recordParam.getPointId());
Check check = new Check();
HashMap<String, Object> routeParam = new HashMap<String, Object>();
Map detail = null;
Boolean isOffline = requestParam.getIsOffline();
Point point = iPointService.queryPointById(requestParam.getPointId());
try {
if (!ObjectUtils.isEmpty(requestParam) && !ObjectUtils.isEmpty(requestParam.getPlanTaskId()) && requestParam.getPlanTaskId() > 0) {
detail = planTaskDetailMapper.findPlanTaskByTaskIdAndPointId(requestParam.getPlanTaskId(), requestParam.getPointId());
if (!ObjectUtils.isEmpty(detail)) {
check = checkDao.findByPlanTaskIdAndPointId(requestParam.getPlanTaskId(), requestParam.getPointId());
planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get();
routeParam.put("routeId", planTask.getRouteId());
routeParam.put("pointId", requestParam.getPointId());
if (ObjectUtils.isEmpty(check)) {
check = new Check();
if (ObjectUtils.isEmpty(point) || ObjectUtils.isEmpty(detail)) {
throw new Exception("前置校验不通过");
}
//2.加工准备的数据
try {
check.setPlanTaskDetailId(Long.parseLong(detail.get("planTaskDetailId").toString()));
check.setRouteId(Long.parseLong(detail.get("routeId").toString()));
check.setRouteName(detail.get("routeName").toString());
check.setPlanTaskId(requestParam.getPlanTaskId());
check.setPlanTaskId(recordParam.getPlanTaskId());
check.setPlanId(planTask.getPlanId());
check.setPlanName(detail.get("planName").toString());
check.setPointName(detail.get("pointName").toString());
requestParam.setPointName(detail.get("pointName").toString());
}
} else {
taskDetail = new PlanTaskDetail();
planTask = new PlanTask();
check.setPlanTaskDetailId(0);
check.setRouteId(0);
check.setPlanTaskId(0);
check.setPlanId(0);
}
check.setPointId(requestParam.getPointId());
if (ObjectUtils.isEmpty(requestParam.getPointName())) {
check.setPointName(point == null ? "" : point.getName());
}
check.setRemark(requestParam.getRemark());
check.setCheckTime(DateUtil.getLongDate(requestParam.getCheckTime()));
recordParam.setPointName(detail.get("pointName").toString());
check.setPointId(recordParam.getPointId());
check.setRemark(recordParam.getRemark());
check.setCheckTime(DateUtil.getLongDate(recordParam.getCheckTime()));
check.setUploadTime(new Date());
check.setOrgCode(requestParam.getOrgCode());
check.setUserId(user.getUserId().toString());
check.setUserName(user.getRealName());
// Department dep = user.getDepartment();
if (departmentModel != null) {
check.setDepId(departmentModel.getSequenceNbr().toString());
check.setDepName(departmentModel.getDepartmentName());
}
check.setCheckMode(requestParam.getCheckMode());
List<CheckInputParam> list = requestParam.getCheckItems();
check.setOrgCode(recordParam.getOrgCode());
check.setUserId(mtUserSeq);
check.setUserName(personIdentity.getPersonName());
List<CheckInputParam> list = recordParam.getCheckItems();
List<CheckInput> checkItemList = new ArrayList<>();
List<Map<String, Object>> unqualifiedcheckItemList = Lists.newArrayList();
String error = "";
HashMap<String, String> errorClassifyNames = new HashMap<>();
List<EquipmentInputItemRo> equipmentInputItemRoList = new ArrayList<>();
List<Map<String, Object>> unqualifiedCheckItemList = Lists.newArrayList();
StringBuilder error = new StringBuilder();
int score = 0;
for (CheckInputParam item : list) {
String pointClassifyName = null;
PointClassify pointClassify = null;
if (StringUtil.isNotEmpty(item.getClassifyIds()) && iPointClassifyDao.existsById(item.getClassifyIds())) {
pointClassify = iPointClassifyDao.findById(item.getClassifyIds()).get();
pointClassifyName = pointClassify.getName();
}
List<CheckShot> checkShots = new ArrayList<>();
InputItem inputItem = inputItemDao.findById(item.getInputItemId()).get();
CheckInput checkInput = new CheckInput();
if (isOffline && check.getId() != 0) {
checkInput = checkInputDao.findByCheckIdAndInputIdAndPointClassifyId(check.getId(), inputItem.getId(), item.getClassifyIds());
}
checkInput.setCreateDate(new Date());
checkInput.setOrgCode(requestParam.getOrgCode());
checkInput.setOrgCode(recordParam.getOrgCode());
checkInput.setInputId(Long.valueOf(item.getInputItemId() + ""));
checkInput.setInputName(inputItem.getName());
checkInput.setOrderNo(inputItem.getOrderNo());
checkInput.setRemark(item.getRemark());
//1.校验结果
if (XJConstant.INPUT_ITEM_SELECT.equals(inputItem.getItemType())) {
checkInput = paraseSelect(checkInput, inputItem.getDataJson(), item, inputItem.getIsScore());
paraseSelect(checkInput, inputItem.getDataJson(), item, inputItem.getIsScore());
} else if (XJConstant.INPUT_ITEM_NUMBER.equals(inputItem.getItemType())) {
checkInput = paraseNumber(checkInput, inputItem.getDataJson(), item, inputItem.getIsScore());
paraseNumber(checkInput, inputItem.getDataJson(), item, inputItem.getIsScore());
} else if (XJConstant.INPUT_ITEM_TEXT.equals(inputItem.getItemType())) {
checkInput = paraseText(checkInput, inputItem.getDataJson(), item, inputItem.getIsScore());
paraseText(checkInput, inputItem.getDataJson(), item, inputItem.getIsScore());
}
if (XJConstant.NO.equals(checkInput.getIsOk())) {
String classifyName = pointClassifyName != null ? pointClassifyName + "-" : "";
error += (classifyName + inputItem.getName() + "=" + (ObjectUtils.isEmpty(item.getInputValue()) ? "" : item.getInputValue()) + ";");
errorClassifyNames.put(pointClassifyName != null ? pointClassifyName : "", "");
error.append(inputItem.getName()).append("=").append(ObjectUtils.isEmpty(item.getInputValue()) ? "" : item.getInputValue()).append(";");
checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
Map<String, Object> unCheckMap = Maps.newHashMap();
unCheckMap.put("itemId", item.getInputItemId());
unCheckMap.put("routeId", check.getRouteId());
unCheckMap.put("pointId", requestParam.getPointId());
unCheckMap.put("pointId", recordParam.getPointId());
unCheckMap.put("name", inputItem.getName());
unCheckMap.put("inputValue", item.getInputValue());
unqualifiedcheckItemList.add(unCheckMap);
unqualifiedCheckItemList.add(unCheckMap);
} else {
checkInput.setIsOk(CheckStatusEnum.QUALIFIED.getCode());
}
checkInput.setRoutePointItemId(item.getRoutePointItemId());
checkInput.setInputValue(item.getInputValue());
checkInput.setPointClassifyId(item.getClassifyIds());
checkInput.setPointClassifyName(pointClassifyName);
score += checkInput.getScore();
checkItemList.add(checkInput);
EquipmentInputItemRo equipmentInputItemRo = new EquipmentInputItemRo();
if (!StringUtils.isBlank(pointClassify.getName())) {
equipmentInputItemRo.setEquipmentName(pointClassify.getName());
}
equipmentInputItemRo.setCheckResult(item.getInputValue());
equipmentInputItemRo.setRuleType(RuleTypeEnum.CHECKRESULT.getCode());
equipmentInputItemRo.setCheckContent(inputItem.getItemNo());
if (!StringUtils.isBlank(pointClassify.getEquipmentId())) {
equipmentInputItemRoList.add(equipmentInputItemRo);
for (CheckShotDto shotDto : item.getCheckInputShot()) {
CheckShot img = new CheckShot();
img.setCreateDate(new Date());
img.setPointName(check.getPointName());
img.setShotType(shotDto.getShotType());
img.setPhotoData(shotDto.getFileUrl());
checkShots.add(img);
}
checkInput.setCheckShotList(checkShots);
checkItemList.add(checkInput);
}
if (!ObjectUtils.isEmpty(error) && error.endsWith(";")) {
if (!ObjectUtils.isEmpty(error.toString()) && error.toString().endsWith(";")) {
error.substring(0, error.length() - 1);
check.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
} else {
check.setIsOk(CheckStatusEnum.QUALIFIED.getCode());
}
check.setError(error);
check.setErrorClassify(StringUtils.join(errorClassifyNames.keySet(), ","));
check.setError(error.toString());
//计划外巡检是否计分 ,计划内默认都是计分
if (XJConstant.POINT_OK_SCORE.equals(point.getIsScore()) || requestParam.getPlanTaskId() != null) {
if (XJConstant.POINT_OK_SCORE.equals(point.getIsScore()) || recordParam.getPlanTaskId() != null) {
check.setScore(score);
} else {
check.setScore(Integer.parseInt(XJConstant.POINT_NOT_SCORE));
}
//3.主表入库
check = checkDao.save(check);
if (point != null) {
//冗余记录最新一次检查记录,方便其他业务查询
//冗余记录最新一次检查记录,方便其他业务查询--当前为维保到期时间用到
point.setLastCheckId(String.valueOf(check.getId()));
iPointDao.save(point);
}
List<CheckShot> imgList = new ArrayList<>();
for (CheckInput item : checkItemList) {
item.setCheckId(check.getId());
//检查点图片保存 checkInputId
Check finalCheck = check;
list.forEach(x -> {
if (x.getInputItemId() == item.getInputId() && (x.getClassifyIds() == item.getPointClassifyId() || x.getClassifyIds() == null)) {
if (x.getCheckInputImg() != null && x.getCheckInputImg().size() > 0) {
for (int i = 0; i < x.getCheckInputImg().size(); i++) {
CheckShot img = new CheckShot();
img.setCheckId(finalCheck.getId());
img.setOrgCode(finalCheck.getOrgCode());
img.setCreateDate(new Date());
img.setPointName(finalCheck.getPointName());
img.setShotType("1".equals(point.getIsFixed()) ? "定点" : "普通");
img.setPhotoData(x.getCheckInputImg().get(i));
img.setCheckInputId(x.getInputItemId());
if (item.getPointClassifyId() == null) {
img.setClassifyId(0);
} else {
img.setClassifyId(item.getPointClassifyId());
}
imgList.add(img);
}
}
}
//4.检查项入库
checkItemList.forEach(checkInput -> checkInput.setCheckId(finalCheck.getId()));
if(!checkItemList.isEmpty()){
checkInputDao.saveAll(checkItemList);
}
List<CheckShot> allShot = new ArrayList<>();
checkItemList.forEach(c -> {
c.getCheckShotList().forEach(s -> {
s.setCheckId(c.getCheckId());
s.setCheckInputId(c.getId());
});
allShot.addAll(c.getCheckShotList());
});
//5.图片入库
if (!allShot.isEmpty()) {
checkShotDao.saveAll(allShot);
}
//现场图片保存
if (requestParam.getCheckRecordImg() != null && requestParam.getCheckRecordImg().size() > 0) {
for (int i = 0; i < requestParam.getCheckRecordImg().size(); i++) {
CheckShot img = new CheckShot();
img.setCheckId(check.getId());
img.setOrgCode(check.getOrgCode());
img.setCreateDate(new Date());
img.setPointName(check.getPointName());
img.setCheckInputId(0);
img.setShotType("1".equals(point.getIsFixed()) ? "定点" : "普通");
img.setPhotoData(requestParam.getCheckRecordImg().get(i));
img.setClassifyId(0);
imgList.add(img);
}
}
List<CheckInput> checkInputList = checkInputDao.saveAll(checkItemList);
//规则请求结果
checkInputList.forEach(checkInput -> {
InputItem inputItem = inputItemDao.findById(checkInput.getInputId()).get();
for (int i = 0; i < equipmentInputItemRoList.size(); i++) {
if (inputItem.getItemNo().equals(equipmentInputItemRoList.get(i).getCheckContent())) {
equipmentInputItemRoList.get(i).setCheckInputId(Long.valueOf(checkInput.getId()).toString());
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(), recordParam.getPlanTaskId(), mtUserSeq);
//6.返回不合格记录
return new CheckDto(check.getId(), unqualifiedCheckItemList);
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
});
equipmentHandlerService.getRulesCheckResult(equipmentInputItemRoList, token);
if (imgList.size() > 0) {
checkService.saveCheckImg(imgList);
private void checkCanFinishTask(String mtUserSeq, PlanTask planTask, Long pointId) throws Exception {
int status;
int count = checkService.checkHasRecord(planTask.getId(), pointId);
if(count > 0){
throw new RuntimeException("任务已执行,不能重复执行");
}
if (check.getPlanTaskId() > 0) {
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), requestParam.getPointId(), requestParam.getPlanTaskId(), user.getUserId());
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
planTaskMapper.reformStatistics(user.getUserId(), sdf.format(new Date()), requestParam.getOrgCode());
if (!ToolUtils.transBeanList(planTask.getUserId()).contains(mtUserSeq)) {
throw new RuntimeException("无权执行该任务");
}
return new CheckDto(check.getId(), unqualifiedcheckItemList);
} catch (Exception e) {
e.printStackTrace();
return null;
status = planTask.getFinishStatus();
if (status == PlanTaskFinishStatusEnum.OVERTIME.getValue()) {
throw new RuntimeException("任务已超时,上传失败!");
} else if (status == PlanTaskFinishStatusEnum.FINISHED.getValue()) {
throw new RuntimeException("任务已完成!");
}
Date checkTime = new Date();
Date beginTime = DateUtil.getLongDate(planTask.getBeginTime());
Date endTime = DateUtil.getLongDate(planTask.getEndTime());
int beginCompareTo = checkTime.compareTo(beginTime);
int endCompareTo = checkTime.compareTo(endTime);
if (beginCompareTo < 0 || endCompareTo > 0) {
throw new RuntimeException("请在计划时间内完成任务!");
}
}
@Override
public void delCheckById(List<Long> list) {
// List<Long> pointIdList = checkDao.getPointIdList(list);
checkDao.deleteBatch(list);
}
......@@ -507,8 +381,8 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public int checkHasRecord(CheckRecordParam requestParam) {
return checkMapper.checkHasRecord(requestParam);
public int checkHasRecord(Long planTaskId, Long pointId) {
return checkMapper.checkHasRecord(planTaskId, pointId);
}
@Override
......@@ -596,7 +470,8 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId) {
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey,
long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
......@@ -748,9 +623,9 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public Map<String, Object> checkCalendar(CheckRecordParam requestParam) {
Map<String, Object> charData = checkMapper.pieChartData(requestParam);
List<Map<String, Object>> calendarData = checkMapper.calendarData(requestParam);
public Map<String, Object> checkCalendar(CheckRecordParam recordParam) {
Map<String, Object> charData = checkMapper.pieChartData(recordParam);
List<Map<String, Object>> calendarData = checkMapper.calendarData(recordParam);
Map<String, Object> result = new HashMap<>();
Map<String, List<CalendarStatusCountRespone>> calendarMap = new HashMap<>();
if (!calendarData.isEmpty()) {
......@@ -857,7 +732,8 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public List<HashMap<String, Object>> getCountMonthChkByRole(HashMap<String, Object> paramMap, String dateMonth) {
public List<HashMap<String, Object>> getCountMonthChkByRole(HashMap<String, Object> paramMap, String
dateMonth) {
// if (dateMonth == null) {
// Date date = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
......@@ -881,7 +757,8 @@ public class CheckServiceImpl implements ICheckService {
@SuppressWarnings("unchecked")
@Override
public QueryCriteriaRespone getQueryCriteriaInit(String toke, String product, String appKey, String loginOrgCode, String roleTypeName, String departmentId, String companyId) {
public QueryCriteriaRespone getQueryCriteriaInit(String toke, String product, String appKey, String
loginOrgCode, String roleTypeName, String departmentId, String companyId) {
QueryCriteriaRespone pointQueryCriteriaRespone = new QueryCriteriaRespone();
......@@ -905,7 +782,8 @@ public class CheckServiceImpl implements ICheckService {
}
public List<Map<String, Object>> getDepartmentMap(List<DepartmentModel> departmentModels, CompanyModel companyModel) {
public List<Map<String, Object>> getDepartmentMap(List<DepartmentModel> departmentModels, CompanyModel
companyModel) {
List<Map<String, Object>> res = new ArrayList<>();
List<DepartmentBo> departmentBos = ModelToBo(departmentModels);
for (DepartmentBo d : departmentBos) {
......@@ -1207,7 +1085,8 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public QueryCriteriaRespone findCheckSystemInit(String toke, String product, String appKey, String type, String orgCode, String roleTypeName, String departmentId, String companyId) {
public QueryCriteriaRespone findCheckSystemInit(String toke, String product, String appKey, String type, String
orgCode, String roleTypeName, String departmentId, String companyId) {
QueryCriteriaRespone pointQueryCriteriaRespone = new QueryCriteriaRespone();
......@@ -1280,7 +1159,8 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public Page<Map<String, Object>> getCheckInfoList1(String toke, String product, String appKey, CheckInfoListPageParam params) {
public Page<Map<String, Object>> getCheckInfoList1(String toke, String product, String
appKey, CheckInfoListPageParam params) {
long total = checkMapper.countCheckInfoListData1(params);
List<Map<String, Object>> content = checkMapper.getCheckInfoList1(params);
......@@ -1442,7 +1322,8 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public List<CheckAnalysisVo> getCheckStatisticalAnalysis(String toke, String product, String appKey, CheckStatisticalParam param) {
public List<CheckAnalysisVo> getCheckStatisticalAnalysis(String toke, String product, String
appKey, CheckStatisticalParam param) {
List<CheckAnalysisVo> checkAnalysisVos = checkMapper.getCheckStatisticalAnalysis(param);
if (param.getStatisticsTyle() == 3) {
......
......@@ -1037,7 +1037,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String,Object> facility = new LinkedHashMap<>();
facility.put("name",point.getName());
facility.put("pointId",point.getId());
facility.put("point_no",point.getPointNo());
facility.put("pointNo",point.getPointNo());
facility.put("position",point.getBuildingName() + point.getAddress());
facility.put("userName",planTask.getUserName());
facility.put("riskAndManage",point.getRemark());
......
......@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
......@@ -43,9 +44,13 @@ public interface ICheckService {
*/
Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param);
void saveCheckImg(List<CheckShot> imgList);
CheckDto saveCheckRecord(CheckRecordParam requestParam, AgencyUserModel user, DepartmentBo departmentModel, Toke token);
/**
* 保存检查记录
* @param recordParam 填写记录
* @param reginParams 权限信息
* @return CheckDto
*/
CheckDto saveCheckRecord(CheckRecordParam recordParam, ReginParams reginParams) throws Exception;
/**
* 巡检记录删除
......@@ -64,14 +69,6 @@ public interface ICheckService {
List<Map> queryUnqualifiedInputItem(int checkId);
/**
* 检查该店时候已经巡检完成
*
* @param requestParam
* @return
*/
int checkHasRecord(CheckRecordParam requestParam);
AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId);
AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId);
......@@ -271,4 +268,12 @@ public interface ICheckService {
* @return CheckRecordDto
*/
Map<String,CheckRecordDto> obtainLastCheckRecord(String[] relationId);
/**
* 校验是否已经填写过
* @param planTaskId
* @param pointId
* @return
*/
int checkHasRecord(Long planTaskId, Long pointId);
}
#DB properties:
spring.datasource.url = jdbc:mysql://172.16.6.60:3306/amos-maintenance?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url = jdbc:mysql://172.16.11.20:3306/amos_maintenance_v1.0?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root
spring.datasource.password= root_123
## eureka properties:
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eeureka.client.serviceUrl.defaultZone=http://172.16.11.20:10001/eureka/
security.password=a1234560
security.loginId=jc_wjk006
......@@ -12,10 +12,10 @@ security.productApp=STUDIO_APP_MOBILE
security.appKey=studio_normalapp_3168830
#redis 配置
spring.redis.database=0
spring.redis.host=172.16.10.85
spring.redis.database=1
spring.redis.host=172.16.11.20
spring.redis.port=6379
spring.redis.password=amos2019Redis
spring.redis.password=1234560
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
......
......@@ -5,5 +5,25 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="suhuiguang" id="1628836692856-1" runOnChange="true">
<createProcedure procedureName="updatePlanTask" >
DROP PROCEDURE IF EXISTS `updatePlanTask`;
CREATE PROCEDURE `updatePlanTask`(IN `planTaskId` int,IN `pointId` int,IN `planTaskDetailId` int,IN `executorId` int)
BEGIN
declare num int ;
declare orgCode VARCHAR(50) ;
declare currentTaskNum int ;
update p_plan_task_detail set is_finish = 1 where id=planTaskDetailId;
select finish_num, org_code from p_plan_task where id = planTaskId into num, orgCode;
select count(1) into currentTaskNum from p_plan_task_detail where task_no = planTaskId and is_finish in(0,2);
UPDATE p_plan_task_detail SET executor_id = executorId,executor_date = current_timestamp where id = planTaskDetailId;
if currentTaskNum > 0 THEN
update p_plan_task set finish_num = (num + 1) where id = planTaskId;
ELSE
update p_plan_task set finish_num = (num + 1), finish_status = 2 where id = planTaskId;
end if;
END
</createProcedure>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -256,8 +256,7 @@
FROM
p_check c
WHERE
is_ok in (1,2)
and c.point_id = #{pointId}
c.point_id = #{pointId}
and c.plan_task_id = #{planTaskId}
</select>
......
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