Browse Source

#检修bug修改

zhongwei
yang_shj 8 months ago
parent
commit
064e6fbb96
  1. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/listener/AlarmListener.java
  2. 21
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java
  3. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessTaskV4Controller.java
  4. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java
  5. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  6. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessTaskV4Service.java
  7. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  8. 29
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  9. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/MyAccessTaskVO.java

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/listener/AlarmListener.java

@ -45,7 +45,7 @@ public class AlarmListener implements IQueueConsume {
// 步骤4.微信公众号发送 // 步骤4.微信公众号发送
if(alarm.getIsWxMessage() == 0){ if(alarm.getIsWxMessage() == 0){
messageService.weChatMessage(alarm); //messageService.weChatMessage(alarm);
} }
} }
} }

21
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java

@ -60,13 +60,14 @@ public class MessageServiceImpl implements MessageService {
@Override @Override
public void shortMessage(AlarmEntity entity) { public void shortMessage(AlarmEntity entity) {
R<StationEntity> station = stationClient.getStationByCode(entity.getStationId()); R<StationEntity> station = stationClient.getStationByCode(entity.getStationId());
if (!station.isSuccess() && ObjectUtils.isEmpty(station.getData())) { if (!station.isSuccess() || ObjectUtils.isEmpty(station.getData())) {
log.error("消息发送失败:站点code获取失败 : {}",entity); log.error("消息发送失败:站点code获取失败 : {}",entity);
return; return;
} }
//通知站点项目经理这个角色 //通知站点项目经理这个角色
List<User> users = userClient.relationUserListByRoleAlias(station.getData().getTenantId(), station.getData().getRefDept(), PROJECT_MANAGER).getData(); List<User> users = userClient.relationUserListByRoleAlias(station.getData().getTenantId(), station.getData().getRefDept(), PROJECT_MANAGER).getData();
if(CollectionUtil.isEmpty(users)){ if(CollectionUtil.isEmpty(users)){
log.error("消息发送失败:获取站点项目经理用户失败 : {}",entity);
return; return;
} }
SmsImmediatelyPushDTO push = SmsImmediatelyPushDTO.builder() SmsImmediatelyPushDTO push = SmsImmediatelyPushDTO.builder()
@ -98,14 +99,14 @@ public class MessageServiceImpl implements MessageService {
public void webAppMessage(AlarmEntity entity) { public void webAppMessage(AlarmEntity entity) {
R<StationEntity> stationByCode = stationClient.getStationByCode(entity.getStationId()); R<StationEntity> stationByCode = stationClient.getStationByCode(entity.getStationId());
if (!stationByCode.isSuccess() && ObjectUtils.isEmpty(stationByCode.getData())) { if (!stationByCode.isSuccess() && ObjectUtils.isEmpty(stationByCode.getData())) {
log.error("消息发送失败:站点code获取失败 : {}",entity); log.error("WEB/APP消息发送失败:站点code获取失败 : {}",entity);
return; return;
} }
Long dept = stationByCode.getData().getCreateDept(); Long dept = stationByCode.getData().getRefDept();
// 获取站点用户 // 获取站点用户
R<List<User>> result = userClient.userListByDeptId(dept); R<List<User>> result = userClient.userList(stationByCode.getData().getTenantId(),dept);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
log.error("消息发送失败:用户获取失败 : {}",entity); log.error("WEB/APP消息发送失败:用户获取失败 : {}",entity);
return; return;
} }
BusinessMessageDTO message = new BusinessMessageDTO(); BusinessMessageDTO message = new BusinessMessageDTO();
@ -113,7 +114,7 @@ public class MessageServiceImpl implements MessageService {
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey());
message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription());
message.setTaskId(entity.getId()); message.setTaskId(entity.getId());
message.setTenantId("200000"); message.setTenantId(stationByCode.getData().getTenantId());
message.setContent(entity.getAlarmContext()); message.setContent(entity.getAlarmContext());
message.setDeptId(dept); message.setDeptId(dept);
R<String> deptName = sysClient.getDeptName(dept); R<String> deptName = sysClient.getDeptName(dept);
@ -133,14 +134,14 @@ public class MessageServiceImpl implements MessageService {
public void weChatMessage(AlarmEntity entity) { public void weChatMessage(AlarmEntity entity) {
R<StationEntity> station = stationClient.getStationByCode(entity.getStationId()); R<StationEntity> station = stationClient.getStationByCode(entity.getStationId());
if (!station.isSuccess() && ObjectUtils.isEmpty(station.getData())) { if (!station.isSuccess() && ObjectUtils.isEmpty(station.getData())) {
log.error("消息发送失败:站点code获取失败 : {}",entity); log.error("微信消息发送失败:站点code获取失败 : {}",entity);
return; return;
} }
Long dept = station.getData().getCreateDept(); Long dept = station.getData().getCreateDept();
// 获取站点用户 // 获取站点用户
R<List<User>> result = userClient.userListByDeptId(dept); R<List<User>> result = userClient.userList(station.getData().getTenantId(),dept);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
log.error("消息发送失败:用户获取失败 : {}",entity); log.error("微信消息发送失败:用户获取失败 : {}",entity);
return; return;
} }
WxMessageDTO message = new WxMessageDTO(); WxMessageDTO message = new WxMessageDTO();
@ -155,7 +156,7 @@ public class MessageServiceImpl implements MessageService {
// 业务分类关键字 // 业务分类关键字
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.WARNING.getKey());
// 任务Id // 任务Id
message.setTaskId(Long.valueOf(entity.getAlarmId())); message.setTaskId(entity.getId());
// 微信参数键值对 // 微信参数键值对
HashMap<String,Object> map = new HashMap<>(); HashMap<String,Object> map = new HashMap<>();
map.put("thing18",entity.getStationName()); map.put("thing18",entity.getStationName());

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessTaskV4Controller.java

@ -1,8 +1,18 @@
package com.hnac.hzims.operational.access.controller; package com.hnac.hzims.operational.access.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.service.AccessTaskV4Service;
import com.hnac.hzims.operational.access.vo.MyAccessTaskVO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -16,4 +26,13 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "v4检修计划流程") @Api(tags = "v4检修计划流程")
public class AccessTaskV4Controller extends BladeController { public class AccessTaskV4Controller extends BladeController {
private final AccessTaskV4Service accessTaskV4Service;
@ApiLog
@GetMapping("/myAccessTasks")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "我的检修任务")
public R<IPage<OperAccessTaskVO>> myAccessTasks(MyAccessTaskVO myAccessTaskVO, Query query) {
return R.data(accessTaskV4Service.myAccessTasks(myAccessTaskVO.getTaskName(), query));
}
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java

@ -45,4 +45,6 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper<OperAccess
List<RepairBillVO> getRepairBill(@Param("deviceCodes") List<String> deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime); List<RepairBillVO> getRepairBill(@Param("deviceCodes") List<String> deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime);
List<AccessTaskExportVo> accessTasks(@Param("planId") Long id); List<AccessTaskExportVo> accessTasks(@Param("planId") Long id);
IPage<OperAccessTaskVO> myAccessTasks(@Param("handler") Long handler,@Param("taskName") String taskName, IPage page);
} }

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -245,4 +245,20 @@
FROM HZIMS_OPER_ACCESS_TASK FROM HZIMS_OPER_ACCESS_TASK
WHERE PLAN_ID = #{planId} WHERE PLAN_ID = #{planId}
</select> </select>
<select id="myAccessTasks" resultType="com.hnac.hzims.operational.access.vo.OperAccessTaskVO">
SELECT TASK.*,PLAN.NAME AS PLANNAME
FROM HZIMS_OPER_ACCESS_TASK TASK
LEFT JOIN HZIMS_OPER_ACCESS_PLAN PLAN
ON TASK.PLAN_ID = PLAN.ID
<where>
<if test="taskName != null and taskName != ''">
AND TASK.`NAME` LIKE CONCAT('%',#{taskName},'%')
</if>
<if test="handler != null">
AND TASK.`HANDLER` = #{handler}
</if>
</where>
ORDER BY TASK.STATUS ASC,TASK.CREATE_TIME DESC
</select>
</mapper> </mapper>

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessTaskV4Service.java

@ -1,7 +1,12 @@
package com.hnac.hzims.operational.access.service; package com.hnac.hzims.operational.access.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
/** /**
* @author ysj * @author ysj
@ -11,4 +16,6 @@ public interface AccessTaskV4Service {
void startProcessV4(AccessTaskV4DTO entity); void startProcessV4(AccessTaskV4DTO entity);
boolean listener(ProcessWorkFlowResponse processWorkFlowResponse); boolean listener(ProcessWorkFlowResponse processWorkFlowResponse);
IPage<OperAccessTaskVO> myAccessTasks(String taskName, Query query);
} }

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.dto.BusinessMessageDTO;
@ -376,6 +377,14 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
} }
} }
IPage pages = this.planService.page(page,queryWrapper); IPage pages = this.planService.page(page,queryWrapper);
List<OperAccessPlanEntity> plans = pages.getRecords();
if(CollectionUtil.isEmpty(plans)){
return pages;
}
// 查询计划项目
List<OperAccessContentEntity> contents = contentService.list(Wrappers.<OperAccessContentEntity>lambdaQuery()
.eq(OperAccessContentEntity::getPlanId,plans.stream().map(OperAccessPlanEntity::getId).collect(Collectors.toList())));
pages.setRecords(OperAccessPlanWrapper.build().listVO(pages.getRecords())); pages.setRecords(OperAccessPlanWrapper.build().listVO(pages.getRecords()));
return pages; return pages;
} }

29
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.dto.BusinessMessageDTO;
@ -16,11 +17,16 @@ import com.hnac.hzims.operational.access.entity.OperAccessContentEntity;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity;
import com.hnac.hzims.operational.access.mapper.OperAccessTaskMapper;
import com.hnac.hzims.operational.access.service.*; import com.hnac.hzims.operational.access.service.*;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessTaskWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
@ -37,10 +43,10 @@ import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -61,6 +67,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
private final IOperAccessStatisticsService statisticsService; private final IOperAccessStatisticsService statisticsService;
private final OperAccessTaskMapper operAccessTaskMapper;
private final ISysClient sysClient; private final ISysClient sysClient;
private final IFlowClient flowClient; private final IFlowClient flowClient;
@ -96,6 +104,9 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
*/ */
private void startProcess(AccessTaskV4DTO entity) { private void startProcess(AccessTaskV4DTO entity) {
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class); Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class);
if(ObjectUtil.isNotEmpty(entity.getCreateUser())){
variables.put("startFlowUserId",entity.getCreateUser().toString());
}
variables.put("solve",TaskUtil.getTaskUser(entity.getHandler().toString())); variables.put("solve",TaskUtil.getTaskUser(entity.getHandler().toString()));
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey("overhaul_task", FlowUtil.getBusinessKey("access_task_v4", String.valueOf(entity.getId())), entity.getName(),variables); R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey("overhaul_task", FlowUtil.getBusinessKey("access_task_v4", String.valueOf(entity.getId())), entity.getName(),variables);
// 更新任务流程Id // 更新任务流程Id
@ -216,6 +227,7 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
return true; return true;
} }
/** /**
* 推送业务流程消息 * 推送业务流程消息
* @param entity * @param entity
@ -271,4 +283,17 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
} }
statisticsService.save(statisticsDTO); statisticsService.save(statisticsDTO);
} }
/**
* 我的检修任务
* @param taskName
* @param query
* @return
*/
@Override
public IPage<OperAccessTaskVO> myAccessTasks(String taskName, Query query) {
IPage<OperAccessTaskVO> pages = operAccessTaskMapper.myAccessTasks(AuthUtil.getUser().getUserId(),taskName, Condition.getPage(query));
pages.setRecords(OperAccessTaskWrapper.build().listVOExtras(pages.getRecords()));
return pages;
}
} }

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/MyAccessTaskVO.java

@ -0,0 +1,20 @@
package com.hnac.hzims.operational.access.vo;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author ysj
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MyAccessTaskVO extends OperAccessTaskEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("任务名称")
private String taskName;
}
Loading…
Cancel
Save