Commit 2546631b authored by suhuiguang's avatar suhuiguang

1.维保任务提交接口

2.配置连接修改为20
parent 1a8ff43c
...@@ -20,15 +20,25 @@ public class ReginParams implements Serializable { ...@@ -20,15 +20,25 @@ public class ReginParams implements Serializable {
public static class PersonIdentity { public static class PersonIdentity {
private String identityType; private String identityType;
private String personSeq;
private String personName; private String personName;
private String companyId; 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.identityType = identityType;
this.personSeq = personSeq;
this.personName = personName; this.personName = personName;
this.companyId = companyId; this.companyId = companyId;
} }
public String getPersonSeq() {
return personSeq;
}
public void setPersonSeq(String personSeq) {
this.personSeq = personSeq;
}
public String getIdentityType() { public String getIdentityType() {
return identityType; return identityType;
} }
......
...@@ -178,8 +178,6 @@ public class Check extends BasicEntity { ...@@ -178,8 +178,6 @@ public class Check extends BasicEntity {
@Column(name="error_classify") @Column(name="error_classify")
private String errorClassify; private String errorClassify;
private List<CheckInput> checkInput;
private List<CheckShot> checkShot; private List<CheckShot> checkShot;
...@@ -372,14 +370,6 @@ public class Check extends BasicEntity { ...@@ -372,14 +370,6 @@ public class Check extends BasicEntity {
} }
@OneToMany(mappedBy = "check", cascade = {CascadeType.REMOVE,CascadeType.MERGE,CascadeType.PERSIST }) @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() { public List<CheckShot> getCheckShot() {
return checkShot; return checkShot;
} }
......
package com.yeejoin.amos.maintenance.dao.entity; package com.yeejoin.amos.maintenance.dao.entity;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity; import java.util.List;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/** /**
* The persistent class for the p_check_input database table. * The persistent class for the p_check_input database table.
*
*/ */
@Entity @Entity
@Table(name="p_check_input") @Table(name = "p_check_input")
@NamedQuery(name="CheckInput.findAll", query="SELECT c FROM CheckInput c") @NamedQuery(name = "CheckInput.findAll", query = "SELECT c FROM CheckInput c")
public class CheckInput extends BasicEntity { public class CheckInput extends BasicEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 巡检记录id * 巡检记录id
*/ */
@Column(name="check_id") @Column(name = "check_id")
private Long checkId; private Long checkId;
/** /**
* 检查项id * 检查项id
*/ */
@Column(name="input_id") @Column(name = "input_id")
private Long inputId; private Long inputId;
/** /**
* 检查项名称 * 检查项名称
*/ */
@Column(name="input_name") @Column(name = "input_name")
private String inputName; private String inputName;
/** /**
* 巡检点检查项 * 巡检点检查项
*/ */
@Column(name="route_point_item_id") @Column(name = "route_point_item_id")
private Long routePointItemId; private Long routePointItemId;
/** /**
* 输入值 * 输入值
*/ */
@Column(name="input_value") @Column(name = "input_value")
private String inputValue; private String inputValue;
/** /**
* 是否合格 * 是否合格
*/ */
@Column(name="is_ok") @Column(name = "is_ok")
private String isOk; private String isOk;
/** /**
* 序号 * 序号
*/ */
@Column(name="order_no") @Column(name = "order_no")
private int orderNo; private int orderNo;
/** /**
* 权限系统org code * 权限系统org code
*/ */
@Column(name="org_code") @Column(name = "org_code")
private String orgCode; private String orgCode;
/** /**
* 检查点分类id * 检查点分类id
*/ */
@Column(name="point_classify_id") @Column(name = "point_classify_id")
private Long pointClassifyId; private Long pointClassifyId;
/** /**
* 检查点分类名称 * 检查点分类名称
*/ */
@Column(name="point_classify_name") @Column(name = "point_classify_name")
private String pointClassifyName; private String pointClassifyName;
/** /**
* 评分 * 评分
*/ */
private int score; private int score;
/** /**
* 备注 * 备注
*/ */
private String remark; private String remark;
public String getRemark() { @Transient
return remark; public List<CheckShot> getCheckShotList() {
} return checkShotList;
}
public void setRemark(String remark) {
this.remark = remark; public void setCheckShotList(List<CheckShot> checkShotList) {
} this.checkShotList = checkShotList;
}
public CheckInput() {
} private List<CheckShot> checkShotList;
private Check check; public String getRemark() {
return remark;
}
public Long getCheckId() {
return this.checkId; public void setRemark(String remark) {
} this.remark = remark;
}
public CheckInput() {
}
public Long getCheckId() {
return this.checkId;
}
public void setCheckId(Long checkId) {
this.checkId = checkId;
}
public Long getInputId() {
return this.inputId;
}
public void setInputId(Long inputId) {
this.inputId = inputId;
}
public String getInputValue() {
return this.inputValue;
}
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
}
public String getIsOk() {
return this.isOk;
}
public void setIsOk(String isOk) {
this.isOk = isOk;
}
public int getOrderNo() {
return this.orderNo;
}
public void setCheckId(Long checkId) { public void setOrderNo(int orderNo) {
this.checkId = checkId; this.orderNo = orderNo;
} }
public Long getInputId() { public String getOrgCode() {
return this.inputId; return this.orgCode;
} }
public void setInputId(Long inputId) {
this.inputId = inputId;
}
public String getInputValue() { public void setOrgCode(String orgCode) {
return this.inputValue; this.orgCode = orgCode;
} }
public void setInputValue(String inputValue) { public int getScore() {
this.inputValue = inputValue; return this.score;
} }
public String getIsOk() { public void setScore(int score) {
return this.isOk; this.score = score;
} }
public void setIsOk(String isOk) { public String getInputName() {
this.isOk = isOk; return inputName;
} }
public int getOrderNo() { public void setInputName(String inputName) {
return this.orderNo; this.inputName = inputName;
} }
public void setOrderNo(int orderNo) { public Long getRoutePointItemId() {
this.orderNo = orderNo; return routePointItemId;
} }
public String getOrgCode() { public void setRoutePointItemId(Long routePointItemId) {
return this.orgCode; this.routePointItemId = routePointItemId;
} }
public void setOrgCode(String orgCode) { public Long getPointClassifyId() {
this.orgCode = orgCode; return pointClassifyId;
} }
public int getScore() { public void setPointClassifyId(Long pointClassifyId) {
return this.score; this.pointClassifyId = pointClassifyId;
} }
public void setScore(int score) { public String getPointClassifyName() {
this.score = score; return pointClassifyName;
} }
@ManyToOne public void setPointClassifyName(String pointClassifyName) {
@JoinColumn(name = "checkId", referencedColumnName = "id", updatable = false, insertable = false) this.pointClassifyName = pointClassifyName;
public Check getCheck() { }
return check;
}
public void setCheck(Check check) {
this.check = check;
}
public String getInputName() {
return inputName;
}
public void setInputName(String inputName) {
this.inputName = inputName;
}
public Long getRoutePointItemId() {
return routePointItemId;
}
public void setRoutePointItemId(Long routePointItemId) {
this.routePointItemId = routePointItemId;
}
public Long getPointClassifyId() {
return pointClassifyId;
}
public void setPointClassifyId(Long pointClassifyId) {
this.pointClassifyId = pointClassifyId;
}
public String getPointClassifyName() {
return pointClassifyName;
}
public void setPointClassifyName(String pointClassifyName) {
this.pointClassifyName = pointClassifyName;
}
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import java.util.List; ...@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.springframework.cglib.beans.BeanMap; import org.springframework.cglib.beans.BeanMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -653,4 +654,8 @@ public abstract class AbstractBaseController extends BaseController{ ...@@ -653,4 +654,8 @@ public abstract class AbstractBaseController extends BaseController{
return map; return map;
} }
public ReginParams.PersonIdentity opIdentifyInfo(){
return getSelectedOrgInfo().getPersonIdentity();
}
} }
package com.yeejoin.amos.maintenance.business.controller; 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.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.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dto.CheckDto; import com.yeejoin.amos.maintenance.business.dto.CheckDto;
import com.yeejoin.amos.maintenance.business.param.CheckInfoPageParam; import com.yeejoin.amos.maintenance.business.param.CheckInfoPageParam;
import com.yeejoin.amos.maintenance.business.param.CheckRecordParam; import com.yeejoin.amos.maintenance.business.param.CheckRecordParam;
import com.yeejoin.amos.maintenance.business.param.CheckStatisticalParam; 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.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.service.intfc.ISafety3DDataSendService;
import com.yeejoin.amos.maintenance.business.util.CheckPageParamUtil; import com.yeejoin.amos.maintenance.business.util.*;
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.vo.CheckAnalysisVo; import com.yeejoin.amos.maintenance.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.maintenance.business.vo.CheckInfoVo; 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.async.AsyncTask;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable; 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.request.CommonRequest;
import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone; import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse; import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.maintenance.core.util.StringUtil; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; 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 @RestController
@RequestMapping(value = "/api/check") @RequestMapping(value = "/api/check")
...@@ -85,9 +54,6 @@ public class CheckController extends AbstractBaseController { ...@@ -85,9 +54,6 @@ public class CheckController extends AbstractBaseController {
private AsyncTask asyncTask; private AsyncTask asyncTask;
@Autowired @Autowired
private IPlanTaskService planTaskService;
@Autowired
private ISafety3DDataSendService is; private ISafety3DDataSendService is;
@Value("${windows.img.path}") @Value("${windows.img.path}")
...@@ -96,18 +62,11 @@ public class CheckController extends AbstractBaseController { ...@@ -96,18 +62,11 @@ public class CheckController extends AbstractBaseController {
@Value("${linux.img.path}") @Value("${linux.img.path}")
private String linuxImgPath; private String linuxImgPath;
// @Value("${file.ip}")
// private String fileIp;
//
// @Value("${file.port}")
// private String filePort;
@Value("${file.url}") @Value("${file.url}")
private String fileUrl; private String fileUrl;
@Value("${amosRefresh.patrol.topic}") @Value("${amosRefresh.patrol.topic}")
private String patrolTopic; private String patrolTopic;
@Autowired
private WebMqttComponent webMqttComponent;
/** /**
* 巡检计划查询 * 巡检计划查询
...@@ -132,7 +91,6 @@ public class CheckController extends AbstractBaseController { ...@@ -132,7 +91,6 @@ public class CheckController extends AbstractBaseController {
hasOrgCode = Boolean.FALSE; hasOrgCode = Boolean.FALSE;
} }
} }
;
} }
HashMap<String, Object> paramMap; HashMap<String, Object> paramMap;
if (hasOrgCode) { if (hasOrgCode) {
...@@ -177,21 +135,13 @@ public class CheckController extends AbstractBaseController { ...@@ -177,21 +135,13 @@ public class CheckController extends AbstractBaseController {
List<CheckInfoVo> list = checkService.getCheckInfoList(getToken(), getProduct(), getAppKey(), param); List<CheckInfoVo> list = checkService.getCheckInfoList(getToken(), getProduct(), getAppKey(), param);
String fileName = "巡检记录" + new Date().getTime(); String fileName = "巡检记录" + new Date().getTime();
FileHelper.exportExcel(list, "维保记录", "维保记录", CheckInfoVo.class, fileName + ".xls", response); 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) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出巡检记录", notes = "导出巡检记录") @ApiOperation(value = "导出巡检记录", notes = "导出巡检记录")
@RequestMapping(value = "/exportSelectRecord", method = RequestMethod.GET) @RequestMapping(value = "/exportSelectRecord", method = RequestMethod.GET)
public void exportSelectCheckRecord( public void exportSelectCheckRecord(
@ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids, @ApiParam(value = "查询条件") @RequestParam(required = false) Long[] ids,
HttpServletResponse response) { HttpServletResponse response) {
List<CheckInfoVo> list = checkService.getSelectedCheckInfoList(getToken(), getProduct(), getAppKey(), ids); List<CheckInfoVo> list = checkService.getSelectedCheckInfoList(getToken(), getProduct(), getAppKey(), ids);
String fileName = "巡检记录" + new Date().getTime(); String fileName = "巡检记录" + new Date().getTime();
...@@ -202,7 +152,7 @@ public class CheckController extends AbstractBaseController { ...@@ -202,7 +152,7 @@ public class CheckController extends AbstractBaseController {
@ApiOperation(value = "导出巡检记录图片", notes = "导出巡检记录图片") @ApiOperation(value = "导出巡检记录图片", notes = "导出巡检记录图片")
@RequestMapping(value = "/exportImgs", method = RequestMethod.POST) @RequestMapping(value = "/exportImgs", method = RequestMethod.POST)
public void exportCheckImgs( public void exportCheckImgs(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
HttpServletResponse response) { HttpServletResponse response) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams); String orgCode = getOrgCode(reginParams);
...@@ -225,7 +175,6 @@ public class CheckController extends AbstractBaseController { ...@@ -225,7 +175,6 @@ public class CheckController extends AbstractBaseController {
CheckInfoPageParam param = CheckPageParamUtil.fillCheckInfoParam(queryRequests, null, paramMap); CheckInfoPageParam param = CheckPageParamUtil.fillCheckInfoParam(queryRequests, null, paramMap);
List<Map<String, Object>> list = checkService.getCheckInfoImgsList(param); List<Map<String, Object>> list = checkService.getCheckInfoImgsList(param);
String fileName = "巡检记录图片" + new Date().getTime() + ".zip"; String fileName = "巡检记录图片" + new Date().getTime() + ".zip";
// String rootPath = "http://" + fileIp + ":" + filePort + "/";
for (Map<String, Object> map : list) { for (Map<String, Object> map : list) {
map.put("photoData", fileUrl + map.get("photoData").toString()); map.put("photoData", fileUrl + map.get("photoData").toString());
} }
...@@ -239,7 +188,6 @@ public class CheckController extends AbstractBaseController { ...@@ -239,7 +188,6 @@ public class CheckController extends AbstractBaseController {
HttpServletResponse response) { HttpServletResponse response) {
List<Map<String, Object>> list = checkService.getCheckInfoImgsList(ids); List<Map<String, Object>> list = checkService.getCheckInfoImgsList(ids);
String fileName = "巡检记录图片" + new Date().getTime() + ".zip"; String fileName = "巡检记录图片" + new Date().getTime() + ".zip";
// String rootPath = "http://" + fileIp + ":" + filePort + "/";
for (Map<String, Object> map : list) { for (Map<String, Object> map : list) {
map.put("photoData", fileUrl + map.get("photoData").toString()); map.put("photoData", fileUrl + map.get("photoData").toString());
} }
...@@ -247,86 +195,17 @@ public class CheckController extends AbstractBaseController { ...@@ -247,86 +195,17 @@ public class CheckController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @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) @RequestMapping(value = "/saveRecord", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse saveCheckRecord( public CommonResponse saveCheckRecord(
@ApiParam(value = "检查信息", required = false) @RequestBody(required = true) CheckRecordParam requestParam) { @ApiParam(value = "检查信息") @RequestBody() 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());
try { try {
if (planTask != null) { CheckDto checkDto = checkService.saveCheckRecord(requestParam, getSelectedOrgInfo());
if (!ToolUtils.transBeanList(planTask.getUserId()).contains(userId.toString())) { return CommonResponseUtil.success(checkDto);
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());
}
return CommonResponseUtil.success(checkDto);
} else {
return CommonResponseUtil.success("无需重新巡检");
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error(e.getMessage(), e);
// TODO Auto-generated catch block return CommonResponseUtil.failure(e.getMessage());
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();
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -670,4 +670,4 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -670,4 +670,4 @@ public class PlanTaskController extends AbstractBaseController {
public CommonResponse planTaskPointDetail(){ public CommonResponse planTaskPointDetail(){
return CommonResponseUtil.success(PlanTaskDetailIsFinishEnum.getEnumList()); return CommonResponseUtil.success(PlanTaskDetailIsFinishEnum.getEnumList());
} }
} }
\ No newline at end of file
...@@ -36,7 +36,7 @@ public interface CheckMapper extends BaseMapper { ...@@ -36,7 +36,7 @@ public interface CheckMapper extends BaseMapper {
List<PointCheckDetailBo> findCheckPointInputItem(@Param(value="checkId") long checkId); 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); 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; package com.yeejoin.amos.maintenance.business.param;
import com.yeejoin.amos.maintenance.business.dto.CheckShotDto;
import lombok.Data;
import java.util.List; import java.util.List;
/**
* @author DELL
*/
@Data
public class CheckInputParam { public class CheckInputParam {
private long inputItemId; private long inputItemId;
private String inputValue; private String inputValue;
private String selectName; private String selectName;
private boolean isCheck; private boolean isCheck;
private String remark; private String remark;
private Long classifyIds;
private Long routePointItemId; private Long routePointItemId;
private List<String> checkInputImg; private List<CheckShotDto> checkInputShot;
public List<String> getCheckInputImg() {
return checkInputImg;
}
public CheckInputParam(String inputValue){
this.inputValue = inputValue;
}
public void setCheckInputImg(List<String> checkInputImg) {
this.checkInputImg = checkInputImg;
}
public CheckInputParam(String inputValue) {
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) {
this.inputValue = 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; package com.yeejoin.amos.maintenance.business.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List; import java.util.List;
/**
* @author DELL
*/
@Data
@ApiModel(value = "任务提交")
public class CheckRecordParam { 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;
/**
* 检查时间
*/
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) { @ApiModelProperty(value = "任务id",required = true)
this.remark = remark; private Long planTaskId;
}
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;
}
public String getPointName() {
return pointName;
}
public void setPointName(String pointName) { @ApiModelProperty(value = "点id",required = true)
this.pointName = pointName; private Long pointId;
}
public void setCheckMode(String checkMode) { @ApiModelProperty(value = "点名称")
this.checkMode = checkMode; private String pointName;
}
public Long getClassId() { @ApiModelProperty(value = "检查记录id")
return classId; private Long checkId;
}
public void setClassId(Long classId) { @ApiModelProperty(value = "执行人id")
this.classId = classId; private String userId;
}
public Boolean getIsOffline() { @ApiModelProperty(value = "任务id")
return isOffline; private String orgCode;
}
public void setIsOffline(Boolean isOffline) { @ApiModelProperty(value = "备注")
this.isOffline = isOffline; private String remark;
}
public String getCheckDepartmentId() {
return checkDepartmentId;
}
public void setCheckDepartmentId(String checkDepartmentId) { @ApiModelProperty(value = "路线id")
this.checkDepartmentId = checkDepartmentId; private Long routeId;
}
public List<String> getCheckRecordImg() { @ApiModelProperty(value = "检查时间")
return checkRecordImg; 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; 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.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo; 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.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
...@@ -42,64 +16,45 @@ import com.yeejoin.amos.maintenance.business.dao.mapper.CheckMapper; ...@@ -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.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper; 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.mapper.RouteMapper;
import com.yeejoin.amos.maintenance.business.dao.repository.ICatalogTreeDao; import com.yeejoin.amos.maintenance.business.dao.repository.*;
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.dto.CheckDto; import com.yeejoin.amos.maintenance.business.dto.CheckDto;
import com.yeejoin.amos.maintenance.business.dto.CheckRecordDto; import com.yeejoin.amos.maintenance.business.dto.CheckRecordDto;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckDetailBo; import com.yeejoin.amos.maintenance.business.dto.CheckShotDto;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckInfoBo; import com.yeejoin.amos.maintenance.business.entity.mybatis.*;
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.feign.EquipFeign; import com.yeejoin.amos.maintenance.business.feign.EquipFeign;
import com.yeejoin.amos.maintenance.business.param.CheckInfoListPageParam; import com.yeejoin.amos.maintenance.business.param.*;
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.service.intfc.ICheckService; 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.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.service.intfc.IPointService;
import com.yeejoin.amos.maintenance.business.util.CheckDetailInputPageParam; 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.CheckAnalysisVo;
import com.yeejoin.amos.maintenance.business.vo.CheckInfoVo; import com.yeejoin.amos.maintenance.business.vo.CheckInfoVo;
import com.yeejoin.amos.maintenance.common.enums.CheckStatusEnum; 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.PointLevelEnum;
import com.yeejoin.amos.maintenance.common.enums.PointStatusEnum; import com.yeejoin.amos.maintenance.common.enums.PointStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.RuleTypeEnum; import com.yeejoin.amos.maintenance.core.common.response.*;
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.util.DateUtil; import com.yeejoin.amos.maintenance.core.util.DateUtil;
import com.yeejoin.amos.maintenance.core.util.StringUtil; import com.yeejoin.amos.maintenance.core.util.StringUtil;
import com.yeejoin.amos.maintenance.dao.entity.Check; import com.yeejoin.amos.maintenance.dao.entity.*;
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.feign.RemoteSecurityService; 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") @Service("checkService")
public class CheckServiceImpl implements ICheckService { public class CheckServiceImpl implements ICheckService {
...@@ -114,12 +69,14 @@ public class CheckServiceImpl implements ICheckService { ...@@ -114,12 +69,14 @@ public class CheckServiceImpl implements ICheckService {
private IPointService iPointService; private IPointService iPointService;
@Autowired @Autowired
private IPlanTaskService planTaskService;
@Autowired
private ICatalogTreeDao catalogTreeDao; private ICatalogTreeDao catalogTreeDao;
@Resource @Autowired
ICheckShotDao checkShotDao; ICheckShotDao checkShotDao;
@Resource
IPlanTaskDao planTaskDao;
@Autowired @Autowired
PlanTaskMapper planTaskMapper; PlanTaskMapper planTaskMapper;
...@@ -141,19 +98,11 @@ public class CheckServiceImpl implements ICheckService { ...@@ -141,19 +98,11 @@ public class CheckServiceImpl implements ICheckService {
IEquipmentHandlerService equipmentHandlerService; IEquipmentHandlerService equipmentHandlerService;
@Autowired @Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
IPointDao iPointDao; IPointDao iPointDao;
// @Value("${file.ip}")
// private String fileIp;
//
// @Value("${file.port}")
// private String filePort;
@Value("${file.url}") @Value("${file.url}")
private String fileUrl; private String fileUrl;
@Override @Override
public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) { public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) {
long total = checkMapper.countCheckInfoData(param); long total = checkMapper.countCheckInfoData(param);
...@@ -165,236 +114,161 @@ public class CheckServiceImpl implements ICheckService { ...@@ -165,236 +114,161 @@ public class CheckServiceImpl implements ICheckService {
return new PageImpl<>(content, param, total); 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 @Override
@Transactional @Transactional
public CheckDto saveCheckRecord(CheckRecordParam requestParam, AgencyUserModel user, DepartmentBo departmentModel, Toke token) { public CheckDto saveCheckRecord(CheckRecordParam recordParam, ReginParams reginParams) throws Exception {
PlanTaskDetail taskDetail = null; ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
PlanTask planTask = null; //执行人-维保人员,非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(); Check check = new Check();
if (ObjectUtils.isEmpty(point) || ObjectUtils.isEmpty(detail)) {
HashMap<String, Object> routeParam = new HashMap<String, Object>(); throw new Exception("前置校验不通过");
Map detail = null; }
Boolean isOffline = requestParam.getIsOffline(); //2.加工准备的数据
Point point = iPointService.queryPointById(requestParam.getPointId());
try { try {
if (!ObjectUtils.isEmpty(requestParam) && !ObjectUtils.isEmpty(requestParam.getPlanTaskId()) && requestParam.getPlanTaskId() > 0) { check.setPlanTaskDetailId(Long.parseLong(detail.get("planTaskDetailId").toString()));
detail = planTaskDetailMapper.findPlanTaskByTaskIdAndPointId(requestParam.getPlanTaskId(), requestParam.getPointId()); check.setRouteId(Long.parseLong(detail.get("routeId").toString()));
if (!ObjectUtils.isEmpty(detail)) { check.setRouteName(detail.get("routeName").toString());
check = checkDao.findByPlanTaskIdAndPointId(requestParam.getPlanTaskId(), requestParam.getPointId()); check.setPlanTaskId(recordParam.getPlanTaskId());
planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get(); check.setPlanId(planTask.getPlanId());
routeParam.put("routeId", planTask.getRouteId()); check.setPlanName(detail.get("planName").toString());
routeParam.put("pointId", requestParam.getPointId()); check.setPointName(detail.get("pointName").toString());
recordParam.setPointName(detail.get("pointName").toString());
if (ObjectUtils.isEmpty(check)) { check.setPointId(recordParam.getPointId());
check = new Check(); check.setRemark(recordParam.getRemark());
} check.setCheckTime(DateUtil.getLongDate(recordParam.getCheckTime()));
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.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()));
check.setUploadTime(new Date()); check.setUploadTime(new Date());
check.setOrgCode(requestParam.getOrgCode()); check.setOrgCode(recordParam.getOrgCode());
check.setUserId(user.getUserId().toString()); check.setUserId(mtUserSeq);
check.setUserName(user.getRealName()); check.setUserName(personIdentity.getPersonName());
// Department dep = user.getDepartment(); List<CheckInputParam> list = recordParam.getCheckItems();
if (departmentModel != null) {
check.setDepId(departmentModel.getSequenceNbr().toString());
check.setDepName(departmentModel.getDepartmentName());
}
check.setCheckMode(requestParam.getCheckMode());
List<CheckInputParam> list = requestParam.getCheckItems();
List<CheckInput> checkItemList = new ArrayList<>(); List<CheckInput> checkItemList = new ArrayList<>();
List<Map<String, Object>> unqualifiedcheckItemList = Lists.newArrayList(); List<Map<String, Object>> unqualifiedCheckItemList = Lists.newArrayList();
String error = ""; StringBuilder error = new StringBuilder();
HashMap<String, String> errorClassifyNames = new HashMap<>();
List<EquipmentInputItemRo> equipmentInputItemRoList = new ArrayList<>();
int score = 0; int score = 0;
for (CheckInputParam item : list) { for (CheckInputParam item : list) {
String pointClassifyName = null; List<CheckShot> checkShots = new ArrayList<>();
PointClassify pointClassify = null;
if (StringUtil.isNotEmpty(item.getClassifyIds()) && iPointClassifyDao.existsById(item.getClassifyIds())) {
pointClassify = iPointClassifyDao.findById(item.getClassifyIds()).get();
pointClassifyName = pointClassify.getName();
}
InputItem inputItem = inputItemDao.findById(item.getInputItemId()).get(); InputItem inputItem = inputItemDao.findById(item.getInputItemId()).get();
CheckInput checkInput = new CheckInput(); CheckInput checkInput = new CheckInput();
if (isOffline && check.getId() != 0) {
checkInput = checkInputDao.findByCheckIdAndInputIdAndPointClassifyId(check.getId(), inputItem.getId(), item.getClassifyIds());
}
checkInput.setCreateDate(new Date()); checkInput.setCreateDate(new Date());
checkInput.setOrgCode(requestParam.getOrgCode()); checkInput.setOrgCode(recordParam.getOrgCode());
checkInput.setInputId(Long.valueOf(item.getInputItemId() + "")); checkInput.setInputId(Long.valueOf(item.getInputItemId() + ""));
checkInput.setInputName(inputItem.getName()); checkInput.setInputName(inputItem.getName());
checkInput.setOrderNo(inputItem.getOrderNo()); checkInput.setOrderNo(inputItem.getOrderNo());
checkInput.setRemark(item.getRemark()); checkInput.setRemark(item.getRemark());
//1.校验结果 //1.校验结果
if (XJConstant.INPUT_ITEM_SELECT.equals(inputItem.getItemType())) { 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())) { } 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())) { } 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())) { if (XJConstant.NO.equals(checkInput.getIsOk())) {
String classifyName = pointClassifyName != null ? pointClassifyName + "-" : ""; error.append(inputItem.getName()).append("=").append(ObjectUtils.isEmpty(item.getInputValue()) ? "" : item.getInputValue()).append(";");
error += (classifyName + inputItem.getName() + "=" + (ObjectUtils.isEmpty(item.getInputValue()) ? "" : item.getInputValue()) + ";");
errorClassifyNames.put(pointClassifyName != null ? pointClassifyName : "", "");
checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode()); checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
Map<String, Object> unCheckMap = Maps.newHashMap(); Map<String, Object> unCheckMap = Maps.newHashMap();
unCheckMap.put("itemId", item.getInputItemId()); unCheckMap.put("itemId", item.getInputItemId());
unCheckMap.put("routeId", check.getRouteId()); unCheckMap.put("routeId", check.getRouteId());
unCheckMap.put("pointId", requestParam.getPointId()); unCheckMap.put("pointId", recordParam.getPointId());
unCheckMap.put("name", inputItem.getName()); unCheckMap.put("name", inputItem.getName());
unCheckMap.put("inputValue", item.getInputValue()); unCheckMap.put("inputValue", item.getInputValue());
unqualifiedcheckItemList.add(unCheckMap); unqualifiedCheckItemList.add(unCheckMap);
} else { } else {
checkInput.setIsOk(CheckStatusEnum.QUALIFIED.getCode()); checkInput.setIsOk(CheckStatusEnum.QUALIFIED.getCode());
} }
checkInput.setRoutePointItemId(item.getRoutePointItemId()); checkInput.setRoutePointItemId(item.getRoutePointItemId());
checkInput.setInputValue(item.getInputValue()); checkInput.setInputValue(item.getInputValue());
checkInput.setPointClassifyId(item.getClassifyIds());
checkInput.setPointClassifyName(pointClassifyName);
score += checkInput.getScore(); score += checkInput.getScore();
checkItemList.add(checkInput); for (CheckShotDto shotDto : item.getCheckInputShot()) {
EquipmentInputItemRo equipmentInputItemRo = new EquipmentInputItemRo(); CheckShot img = new CheckShot();
if (!StringUtils.isBlank(pointClassify.getName())) { img.setCreateDate(new Date());
equipmentInputItemRo.setEquipmentName(pointClassify.getName()); img.setPointName(check.getPointName());
} img.setShotType(shotDto.getShotType());
equipmentInputItemRo.setCheckResult(item.getInputValue()); img.setPhotoData(shotDto.getFileUrl());
equipmentInputItemRo.setRuleType(RuleTypeEnum.CHECKRESULT.getCode()); checkShots.add(img);
equipmentInputItemRo.setCheckContent(inputItem.getItemNo());
if (!StringUtils.isBlank(pointClassify.getEquipmentId())) {
equipmentInputItemRoList.add(equipmentInputItemRo);
} }
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); error.substring(0, error.length() - 1);
check.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode()); check.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
} else { } else {
check.setIsOk(CheckStatusEnum.QUALIFIED.getCode()); check.setIsOk(CheckStatusEnum.QUALIFIED.getCode());
} }
check.setError(error); check.setError(error.toString());
check.setErrorClassify(StringUtils.join(errorClassifyNames.keySet(), ","));
//计划外巡检是否计分 ,计划内默认都是计分 //计划外巡检是否计分 ,计划内默认都是计分
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); check.setScore(score);
} else { } else {
check.setScore(Integer.parseInt(XJConstant.POINT_NOT_SCORE)); check.setScore(Integer.parseInt(XJConstant.POINT_NOT_SCORE));
} }
//3.主表入库
check = checkDao.save(check); check = checkDao.save(check);
if (point != null) { //冗余记录最新一次检查记录,方便其他业务查询--当前为维保到期时间用到
//冗余记录最新一次检查记录,方便其他业务查询 point.setLastCheckId(String.valueOf(check.getId()));
point.setLastCheckId(String.valueOf(check.getId())); iPointDao.save(point);
iPointDao.save(point); Check finalCheck = check;
//4.检查项入库
checkItemList.forEach(checkInput -> checkInput.setCheckId(finalCheck.getId()));
if(!checkItemList.isEmpty()){
checkInputDao.saveAll(checkItemList);
} }
List<CheckShot> imgList = new ArrayList<>(); List<CheckShot> allShot = new ArrayList<>();
checkItemList.forEach(c -> {
c.getCheckShotList().forEach(s -> {
for (CheckInput item : checkItemList) { s.setCheckId(c.getCheckId());
item.setCheckId(check.getId()); s.setCheckInputId(c.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);
}
}
}
}); });
} allShot.addAll(c.getCheckShotList());
//现场图片保存
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());
}
}
}); });
equipmentHandlerService.getRulesCheckResult(equipmentInputItemRoList, token); //5.图片入库
if (imgList.size() > 0) { if (!allShot.isEmpty()) {
checkService.saveCheckImg(imgList); checkShotDao.saveAll(allShot);
}
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());
} }
return new CheckDto(check.getId(), unqualifiedcheckItemList); planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(), recordParam.getPlanTaskId(), mtUserSeq);
//6.返回不合格记录
return new CheckDto(check.getId(), unqualifiedCheckItemList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); throw new Exception(e.getMessage());
return null; }
}
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 (!ToolUtils.transBeanList(planTask.getUserId()).contains(mtUserSeq)) {
throw new RuntimeException("无权执行该任务");
}
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 @Override
public void delCheckById(List<Long> list) { public void delCheckById(List<Long> list) {
// List<Long> pointIdList = checkDao.getPointIdList(list);
checkDao.deleteBatch(list); checkDao.deleteBatch(list);
} }
...@@ -507,8 +381,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -507,8 +381,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @Override
public int checkHasRecord(CheckRecordParam requestParam) { public int checkHasRecord(Long planTaskId, Long pointId) {
return checkMapper.checkHasRecord(requestParam); return checkMapper.checkHasRecord(planTaskId, pointId);
} }
@Override @Override
...@@ -596,7 +470,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -596,7 +470,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @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 list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
...@@ -748,9 +623,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -748,9 +623,9 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @Override
public Map<String, Object> checkCalendar(CheckRecordParam requestParam) { public Map<String, Object> checkCalendar(CheckRecordParam recordParam) {
Map<String, Object> charData = checkMapper.pieChartData(requestParam); Map<String, Object> charData = checkMapper.pieChartData(recordParam);
List<Map<String, Object>> calendarData = checkMapper.calendarData(requestParam); List<Map<String, Object>> calendarData = checkMapper.calendarData(recordParam);
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, List<CalendarStatusCountRespone>> calendarMap = new HashMap<>(); Map<String, List<CalendarStatusCountRespone>> calendarMap = new HashMap<>();
if (!calendarData.isEmpty()) { if (!calendarData.isEmpty()) {
...@@ -857,7 +732,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -857,7 +732,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @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) { // if (dateMonth == null) {
// Date date = new Date(); // Date date = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); // SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
...@@ -881,7 +757,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -881,7 +757,8 @@ public class CheckServiceImpl implements ICheckService {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @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(); QueryCriteriaRespone pointQueryCriteriaRespone = new QueryCriteriaRespone();
...@@ -905,7 +782,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -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<Map<String, Object>> res = new ArrayList<>();
List<DepartmentBo> departmentBos = ModelToBo(departmentModels); List<DepartmentBo> departmentBos = ModelToBo(departmentModels);
for (DepartmentBo d : departmentBos) { for (DepartmentBo d : departmentBos) {
...@@ -1207,7 +1085,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1207,7 +1085,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @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(); QueryCriteriaRespone pointQueryCriteriaRespone = new QueryCriteriaRespone();
...@@ -1280,7 +1159,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1280,7 +1159,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @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); long total = checkMapper.countCheckInfoListData1(params);
List<Map<String, Object>> content = checkMapper.getCheckInfoList1(params); List<Map<String, Object>> content = checkMapper.getCheckInfoList1(params);
...@@ -1442,7 +1322,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1442,7 +1322,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @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); List<CheckAnalysisVo> checkAnalysisVos = checkMapper.getCheckStatisticalAnalysis(param);
if (param.getStatisticsTyle() == 3) { if (param.getStatisticsTyle() == 3) {
......
...@@ -1037,7 +1037,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1037,7 +1037,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String,Object> facility = new LinkedHashMap<>(); Map<String,Object> facility = new LinkedHashMap<>();
facility.put("name",point.getName()); facility.put("name",point.getName());
facility.put("pointId",point.getId()); 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("position",point.getBuildingName() + point.getAddress());
facility.put("userName",planTask.getUserName()); facility.put("userName",planTask.getUserName());
facility.put("riskAndManage",point.getRemark()); facility.put("riskAndManage",point.getRemark());
......
...@@ -4,6 +4,7 @@ import java.util.HashMap; ...@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -43,9 +44,13 @@ public interface ICheckService { ...@@ -43,9 +44,13 @@ public interface ICheckService {
*/ */
Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param); 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 { ...@@ -64,14 +69,6 @@ public interface ICheckService {
List<Map> queryUnqualifiedInputItem(int checkId); List<Map> queryUnqualifiedInputItem(int checkId);
/**
* 检查该店时候已经巡检完成
*
* @param requestParam
* @return
*/
int checkHasRecord(CheckRecordParam requestParam);
AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId); AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId);
AppPointCheckRespone queryCheckPointDetailInVersion2(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 { ...@@ -271,4 +268,12 @@ public interface ICheckService {
* @return CheckRecordDto * @return CheckRecordDto
*/ */
Map<String,CheckRecordDto> obtainLastCheckRecord(String[] relationId); Map<String,CheckRecordDto> obtainLastCheckRecord(String[] relationId);
/**
* 校验是否已经填写过
* @param planTaskId
* @param pointId
* @return
*/
int checkHasRecord(Long planTaskId, Long pointId);
} }
#DB properties: #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.username= root
spring.datasource.password= root_123 spring.datasource.password= root_123
## eureka properties: ## 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.password=a1234560
security.loginId=jc_wjk006 security.loginId=jc_wjk006
...@@ -12,10 +12,10 @@ security.productApp=STUDIO_APP_MOBILE ...@@ -12,10 +12,10 @@ security.productApp=STUDIO_APP_MOBILE
security.appKey=studio_normalapp_3168830 security.appKey=studio_normalapp_3168830
#redis 配置 #redis 配置
spring.redis.database=0 spring.redis.database=1
spring.redis.host=172.16.10.85 spring.redis.host=172.16.11.20
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=amos2019Redis spring.redis.password=1234560
spring.redis.jedis.pool.max-active=200 spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.max-idle=10
......
...@@ -5,5 +5,25 @@ ...@@ -5,5 +5,25 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"> 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> </databaseChangeLog>
\ No newline at end of file
...@@ -256,8 +256,7 @@ ...@@ -256,8 +256,7 @@
FROM FROM
p_check c p_check c
WHERE WHERE
is_ok in (1,2) c.point_id = #{pointId}
and c.point_id = #{pointId}
and c.plan_task_id = #{planTaskId} and c.plan_task_id = #{planTaskId}
</select> </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