Commit 9a411522 authored by tangwei's avatar tangwei

修改bug

parent bbfd15d0
...@@ -137,7 +137,85 @@ public class CheckController extends AbstractBaseController { ...@@ -137,7 +137,85 @@ public class CheckController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "保存巡检记录<font color='blue'>手机app</font>", notes = "保存巡检记录<font color='blue'>手机app</font>")
@RequestMapping(value = "/saveRecordNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse saveCheckRecordNew(
@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());
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()?DateUtil.getLongDate(requestParam.getCheckTime()):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 == -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 orgCode =reginParams.getPersonIdentity().getBizOrgCode();
// String departmentId = getDepartmentId(reginParams);
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
requestParam.setOrgCode(orgCode);
requestParam.setUserId(getUserId());
requestParam.setCheckDepartmentId(personIdentity.getCompanyId());
requestParam.setUserName(personIdentity.getPersonName());
requestParam.setDepId(personIdentity.getCompanyId());
requestParam.setDepName(personIdentity.getCompanyName());
CheckDto checkDto = checkService.saveCheckRecordNew(requestParam,token);
if(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) {
e.printStackTrace();
// TODO Auto-generated catch block
log.error(e.getMessage());
return CommonResponseUtil.failure("数据提交失败");
}
}
......
...@@ -39,6 +39,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -39,6 +39,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -89,6 +90,57 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -89,6 +90,57 @@ public class PlanTaskController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse qryLoginUserPlanTaskNew(
@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo();
PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
params.put("orgCode", reginParams.getPersonIdentity().getCompanyBizOrgCode());
params.put("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) {
params.put("orderBy", "beginTime desc");
}
if (params.get("orderBy").toString().contains("taskPlanNum")) {
params.put("orderBy", params.get("orderBy") + ",beginTime asc");
}
try {
Page<Map<String, Object>> page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
return CommonResponseUtil.success(page);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "计划执行重做", notes = "计划执行重做") @ApiOperation(value = "计划执行重做", notes = "计划执行重做")
@RequestMapping(value = "/regenPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/regenPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse planTaskReGenNew( public CommonResponse planTaskReGenNew(
...@@ -175,7 +227,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -175,7 +227,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "执行计划导出", notes = "执行计划导出") @ApiOperation(value = "执行计划导出", notes = "执行计划导出")
@GetMapping (value = "/reportPlanTaskNew", produces = "application/vnd.ms-excel;charset=UTF-8") @GetMapping (value = "/reportPlanTaskNew", produces = "application/vnd.ms-excel;charset=UTF-8")
public void planTaskReportNew( public void planTaskReportNew(
@ApiParam(value = "导出参数", required = false) @RequestParam(required = false)PlanTaskPageParam params, @ApiParam(value = "导出参数", required = false) @RequestBody(required = false)PlanTaskPageParam params,
HttpServletResponse response) { HttpServletResponse response) {
try { try {
......
...@@ -566,6 +566,50 @@ public class PointController extends AbstractBaseController { ...@@ -566,6 +566,50 @@ public class PointController extends AbstractBaseController {
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检点信息(<font color='blue'>手机app</font>)", notes = "查询巡检点信息(<font color='blue'>手机app</font>)")
@PostMapping(value = "/queryPointByPageNew", produces = "application/json;charset=UTF-8")
public CommonResponse queryPointByPageNew(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true, defaultValue = "pageNumber=0&pageSize=10") CommonPageable commonPageable) {
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
if (ObjectUtils.isEmpty(reginParams)) {
return CommonResponseUtil.failure("用户session过期");
}
try {
CommonRequest commonRequest = new CommonRequest();
commonRequest.setName("orgCode");
commonRequest.setValue(orgCode);
queryRequests.add(commonRequest);
HashMap<String, Object> param = PointParamUtils.fillTaskInfo(queryRequests);
Page<PointVo> pointList = iPointService.queryPointByPage(param, commonPageable);
return CommonResponseUtil.success(pointList);
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点信息失败");
}
}
/** /**
* 更新巡检点 * 更新巡检点
* *
......
...@@ -12,6 +12,36 @@ public class CheckRecordParam { ...@@ -12,6 +12,36 @@ public class CheckRecordParam {
private String orgCode; private String orgCode;
private String checkDepartmentId; private String checkDepartmentId;
private List<String> checkRecordImg; private List<String> checkRecordImg;
private String userName;
private String depId;
private String depName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDepId() {
return depId;
}
public void setDepId(String depId) {
this.depId = depId;
}
public String getDepName() {
return depName;
}
public void setDepName(String depName) {
this.depName = depName;
}
/** /**
* 检查项分类 * 检查项分类
*/ */
......
package com.yeejoin.amos.patrol.business.service.impl; package com.yeejoin.amos.patrol.business.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import com.yeejoin.amos.patrol.core.util.StringUtil; import com.yeejoin.amos.patrol.core.util.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -144,8 +140,14 @@ public class PlanServiceImpl implements IPlanService { ...@@ -144,8 +140,14 @@ public class PlanServiceImpl implements IPlanService {
@Override @Override
public Plan queryPlanById(Long id) { public Plan queryPlanById(Long id) {
Plan plan = planDao.findById(id).get(); Optional<Plan> plan = planDao.findById(id);
return plan; if(Optional.ofNullable(plan).isPresent()){
return null;
}else{
return plan.get();
}
} }
@Override @Override
......
...@@ -1146,30 +1146,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1146,30 +1146,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
} }
content = planTaskMapper.getPlanTasks(params); content = planTaskMapper.getPlanTasks(params);
if (!CollectionUtils.isEmpty(content)) { if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet(); // Set<String> userIds = Sets.newHashSet();
content.forEach(e -> { // content.forEach(e -> {
String userId = e.get("userId").toString(); // String userId = e.get("userId").toString();
if (StringUtil.isNotEmpty(userId)) { // if (StringUtil.isNotEmpty(userId)) {
userIds.add(userId); // userIds.add(userId);
} // }
}); // });
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds)); // List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); // Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
List<String> userNames = new ArrayList<>(); // List<String> userNames = new ArrayList<>();
// content.forEach(e -> {
// userNames.clear();
// String[] userIds1 = e.get("userId").toString().split(",");
// for (String userId : userIds1) {
// if (!ObjectUtils.isEmpty(userModelMap.get(userId))) {
// userNames.add(userModelMap.get(userId));
// }
// }
// if (userNames.size() > 0) {
// e.put("executiveName", Joiner.on(",").join(userNames));
// } else {
// e.put("executiveName", " ");
// }
// });
content.forEach(e -> { content.forEach(e -> {
userNames.clear(); e.put("executiveName",e.get("userName") );
String[] userIds1 = e.get("userId").toString().split(",");
for (String userId : userIds1) {
if (!ObjectUtils.isEmpty(userModelMap.get(userId))) {
userNames.add(userModelMap.get(userId));
}
}
if (userNames.size() > 0) {
e.put("executiveName", Joiner.on(",").join(userNames));
} else {
e.put("executiveName", " ");
}
}); });
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
} }
......
...@@ -45,7 +45,7 @@ public interface ICheckService { ...@@ -45,7 +45,7 @@ public interface ICheckService {
void saveCheckImg(List<CheckShot> imgList); void saveCheckImg(List<CheckShot> imgList);
CheckDto saveCheckRecord(CheckRecordParam requestParam, AgencyUserModel user, DepartmentBo departmentModel, Toke token); CheckDto saveCheckRecord(CheckRecordParam requestParam, AgencyUserModel user, DepartmentBo departmentModel, Toke token);
CheckDto saveCheckRecordNew(CheckRecordParam requestParam, Toke token);
/** /**
* 巡检记录删除 * 巡检记录删除
* *
......
...@@ -303,9 +303,9 @@ ...@@ -303,9 +303,9 @@
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if> <if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if> <if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} ) and a.OrgCode LIKE CONCAT( #{orgCode}, '%' )
</if> </if>
<if test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</if> <!-- <if test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</if>-->
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND ( AND (
( (
......
...@@ -200,6 +200,7 @@ ...@@ -200,6 +200,7 @@
'$' '$'
)</if> )</if>
AND p.is_delete = 0 AND p.is_delete = 0
and ( select COUNT(p_point_classify.id) fROM p_point_classify where p_point_classify.point_id =p.id) >0
<if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name},'%') <if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name},'%')
OR p.NAME LIKE CONCAT('%', #{name},'%')) </if> OR p.NAME LIKE CONCAT('%', #{name},'%')) </if>
<if test="query != null and query != ''"> <if test="query != null and query != ''">
...@@ -229,7 +230,10 @@ ...@@ -229,7 +230,10 @@
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
<if test="orgCode!=null "> and p.org_Code= #{orgCode} </if> <!-- <if test="orgCode!=null "> and p.org_Code= #{orgCode} </if>-->
<if test="orgCode!=null "> and p.biz_org_code LIKE CONCAT (#{orgCode} ,'%') </if>
</where> </where>
</select> </select>
...@@ -253,6 +257,8 @@ ...@@ -253,6 +257,8 @@
'$' '$'
)</if> )</if>
AND p.is_delete = 0 AND p.is_delete = 0
and ( select COUNT(p_point_classify.id) fROM p_point_classify where p_point_classify.point_id =p.id) >0
<if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name},'%') <if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name},'%')
OR p.NAME LIKE CONCAT('%', #{name},'%')) </if> OR p.NAME LIKE CONCAT('%', #{name},'%')) </if>
<if test="query != null and query != ''"> <if test="query != null and query != ''">
...@@ -308,7 +314,9 @@ ...@@ -308,7 +314,9 @@
) --> ) -->
</if> </if>
<if test="orgCode!=null "> and p.org_Code= #{orgCode} </if> <!-- <if test="orgCode!=null "> and p.org_Code= #{orgCode} </if>-->
<if test="orgCode!=null "> and p.biz_org_code LIKE CONCAT (#{orgCode} ,'%') </if>
</where> </where>
limit #{offset},#{pageSize}; limit #{offset},#{pageSize};
</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