Commit 63ec9c86 authored by litengwei's avatar litengwei

双规小程序接口

parent 6ad426a3
......@@ -221,6 +221,8 @@ public class CheckController extends AbstractBaseController {
AgencyUserModel user = getUserInfo();
String userId = user.getUserId();
String realName = user.getRealName();
requestParam.setUserId(userId);
requestParam.setUserName(realName);
requestParam.setIsOffline(requestParam.getIsOffline()==null?false:requestParam.getIsOffline());
try {
if (planTask != null) {
......
......@@ -518,10 +518,19 @@ public class CheckServiceImpl implements ICheckService {
check.setOrgCode(requestParam.getOrgCode());
check.setUserId(requestParam.getUserId());
StringBuffer deptName = new StringBuffer();
if(planTask.getUserDept().indexOf(",") > 0) {
List<String> depts = Arrays.asList(planTask.getUserDept().split(","));
depts.stream().forEach(dept -> {
deptName.append(dept.split("@")[2]).append(",");
});
}
check.setDepName(deptName.substring(0,deptName.length() - 1));
check.setUserName(requestParam.getUserName());
check.setDepId(requestParam.getDepId());
check.setDepName(requestParam.getDepName());
//check.setDepId(requestParam.getDepId());
//check.setDepName(requestParam.getDepName());
check.setCheckMode(requestParam.getCheckMode());
......
......@@ -1151,7 +1151,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
});
}
// 生成巡检记录
jobService.createCheckRecord(planTask);
jobService.createCheckRecord(planTask, userId);
}
......@@ -1491,6 +1491,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
input.setDataJson(action.getDataJson());
input.setIsMultiline(action.getIsMultiline());
input.setIsMust(action.getIsMust());
input.setInputValue(null);
if(null != check) {
for (CheckInput ck :check.getCheckInput()
) {
......
......@@ -62,6 +62,6 @@ public interface IJobService {
*/
public void msgJobPerform(long msgId,String jobType,String jobName);
public void createCheckRecord(PlanTask planTask);
public void createCheckRecord(PlanTask planTask,String userId);
}
package com.yeejoin.amos.patrol.quartz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -205,14 +206,14 @@ public class JobService implements IJobService {
});
}
log.info("更新plan_task 和 plan_task_detail表完成,planTask:{}", planTask);
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
patrolDataSyncService.planTaskDetailDataSync(planTaskDetails);
}
});
// // 巡检站端与中心级数据同步
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// // 事物提交后业务逻辑
// patrolDataSyncService.planTaskDetailDataSync(planTaskDetails);
// }
// });
if (PlanTaskFinishStatusEnum.OVERTIME.getValue() == status) {
createOmissionCheckRecord(planTask);
}
......@@ -249,8 +250,9 @@ public class JobService implements IJobService {
List<String> ids = Arrays.asList(planTask.getUserId().split(","));
List<String> depts = Arrays.asList(planTask.getUserDept().split(","));
depts.stream().forEach(dept -> {
deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
deptId.append(dept.substring(dept.indexOf("@") + 1)).append(",");
deptMap.put(dept.split("@")[0], dept.split("@")[2]);
deptName.append(dept.split("@")[2]).append(",");
deptId.append(dept.split("@")[0]).append(",");
});
Set<String> departmentOrgCode = new HashSet<>();
for (String key : deptMap.keySet()) {
......@@ -264,28 +266,6 @@ public class JobService implements IJobService {
String realNames = "";
} else {
String realNames = "";
// deptMap.put(planTask.getUserDept().split(","), planTask.getUserDept().substring(planTask.getUserDept().indexOf("@") + 1));
//
// FeignClientResult<List<Map<String, Object>>> departmentModeldate = jcsFeignClient.selectByIdDeptList(deptMap.get(planTask.getUserId()));
// List<Map<String, Object>> departmentModel = departmentModeldate.getResult();
//
// if (departmentModel.size() > 0) {
// departmentModel.stream().forEach(model -> {
// deptName.append(model.get("bizOrgName").toString());
// });
// } else {
// deptName.append("其他").append(",");
// }
// FeignClientResult<List<Map<String, Object>>> agencyUserModelsDate = jcsFeignClient.selectByAmosOrgIdDeptList(planTask.getUserId());
// List<Map<String, Object>> agencyUserModels = agencyUserModelsDate.getResult();
//
// if (!agencyUserModels.isEmpty()) {
// realNames = agencyUserModels.stream().map(map -> map.get("bizOrgName").toString()).collect(Collectors.joining(","));
// }
userName.append(realNames);
}
List<Check> checkList = new ArrayList<>();
......@@ -301,7 +281,7 @@ public class JobService implements IJobService {
} else {
check.setUserName(userName.toString());
}
check.setDepId(deptId.toString().substring(0, deptId.length() - 1));
// check.setDepId(deptId.toString().substring(0, deptId.length() - 1));
check.setDepName(deptName.toString());
check.setPointId(arg.getPointId());
......@@ -343,61 +323,8 @@ public class JobService implements IJobService {
CheckInput checkInput1 = iCheckInputDao.saveAndFlush(checkInput);
checkInputIdList.add(checkInput1.getId());
}
//漏检修改APP待办通知状态不展示
Plan plan = new Plan();
plan.setId(planTask.getPlanId());
try {
updateTaskStatus(plan);
} catch (InnerInvokException e) {
log.error("待办消息不存在");
}
}
String usrIds = planTask.getUserId();
if (!ObjectUtils.isEmpty(usrIds)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String[] ids = usrIds.split(",");
for (String userId : usrIds.split(",")) {
if (ObjectUtils.isEmpty(userId)) {
continue;
}
planTaskMapper.reformStatistics(userId, sdf.format(new Date()), planTask.getOrgCode());
}
}
// 向3d推送数据,发送消息推送
checkIds.forEach(checkId -> {
try {
asyncTask.pushCheckInfoTo3D(checkId);
asyncTask.pushCheckMessage(checkId);
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
e.printStackTrace();
}
});
//数字换流站页面刷新
try {
webMqttComponent.publish(patrolTopic, "");
} catch (Exception e) {
log.error("数字换流站页面推送失败-----------" + e.getMessage());
}
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
patrolDataSyncService.checkDataSync(checkList);
Map<String, Object> map = new HashMap<>();
map.put("idList", checkInputIdList);
List<CheckInputSyncBo> checkInputSyncBoList = checkInputMapper.getCheckInputSyncBoList(map);
patrolDataSyncService.checkInputBoDataSync(checkInputSyncBoList);
List<CheckInput> checkInputList = checkInputMapper.findByIdIn(map);
patrolDataSyncService.checkInputDataSync(checkInputList);
}
});
}
......@@ -406,7 +333,7 @@ public class JobService implements IJobService {
*
* @param planTask
*/
public void createCheckRecord(PlanTask planTask) {
public void createCheckRecord(PlanTask planTask,String userId) {
List<PlanTaskPointInputItemBo> planTaskPointInputItems = planTaskMapper.getPlanTaskPointInputItemByPlanTaskId(planTask.getId(), PlanTaskDetailStatusEnum.NOTSTARTED.getValue());
Map<Long, Check> checkMap = new HashMap<>();
Set<Long> checkIds = new HashSet<Long>();
......@@ -419,7 +346,8 @@ public class JobService implements IJobService {
List<String> depts = Arrays.asList(planTask.getUserDept().split(","));
depts.stream().forEach(dept -> {
deptMap.put(dept.split("@")[0], dept.split("@")[2]);
// deptId.append(dept.substring(dept.indexOf("@") + 1)).append(",");
deptName.append(dept.split("@")[2]).append(",");
deptId.append(dept.split("@")[0]).append(",");
});
Set<String> departmentOrgCode = new HashSet<>();
for (String key : deptMap.keySet()) {
......@@ -432,27 +360,13 @@ public class JobService implements IJobService {
}
String realNames = "";
FeignClientResult<AgencyUserModel> agencyUserModelsDate = Privilege.agencyUserClient.queryByUserId(planTask.getUserId());
AgencyUserModel agencyUserModel = agencyUserModelsDate.getResult();
if (agencyUserModel != null) {
realNames = agencyUserModel.getRealName().join(",");
userName.append(realNames);
}
} else {
String realNames = "";
deptId.append(planTask.getUserDept().substring(planTask.getUserDept().indexOf("@") + 1)).append(",");
deptMap.put(planTask.getUserDept().substring(0, planTask.getUserDept().indexOf("@")), planTask.getUserDept().substring(planTask.getUserDept().indexOf("@") + 1));
FeignClientResult<AgencyUserModel> agencyUserModelsDate = Privilege.agencyUserClient.queryByUserId(planTask.getUserId());
FeignClientResult<AgencyUserModel> agencyUserModelsDate = Privilege.agencyUserClient.queryByUserId(userId);
AgencyUserModel agencyUserModel = agencyUserModelsDate.getResult();
if (agencyUserModel != null) {
realNames = agencyUserModel.getRealName().join(",");
userName.append(realNames);
}
userName.append(realNames);
}
List<Check> checkList = new ArrayList<>();
......@@ -550,7 +464,7 @@ public class JobService implements IJobService {
@Transactional
public void taskJobPerform(long taskId, String jobType, String jobName) {
// TODO Auto-generated method stub
log.error("开始执行定时任务========");
if (iTaskDao.existsById(taskId)) {
Task task = iTaskDao.findById(taskId).get();
......@@ -640,6 +554,7 @@ public class JobService implements IJobService {
if (iPlanTaskDao.existsById(planTaskId)) {
PlanTask planTask = iPlanTaskDao.findById(planTaskId).get();
log.error("开始执行定时任务添加的任务==========>>{}", JSON.toJSONString(planTask));
if (XJConstant.STATUS_MONITOR_START.equals(jobType)) {
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == planTask.getFinishStatus()) {
planTask.setFinishStatus(PlanTaskFinishStatusEnum.UNDERWAY.getValue());
......
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