Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
ty 4 months ago
parent
commit
7192116dc2
  1. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java
  2. 17
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java
  3. 33
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java
  4. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceMonitorReportMonthDTO.java
  5. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceMonitorServiceImpl.java

8
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java

@ -18,7 +18,9 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
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.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
@ -89,9 +91,9 @@ public class EmDefinitionController extends BladeController {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "新增", notes = "传入EmDefinitionDTO") @ApiOperation(value = "新增", notes = "传入EmDefinitionDTO")
public R save(@Valid @RequestBody EmDefinitionDTO emDefinitionDTO) { public R save(@Valid @RequestBody EmDefinitionDTO emDefinitionDTO) {
EmDefinitionEntity emDefinition = new EmDefinitionEntity(); EmDefinitionEntity definition = BeanUtil.copy(emDefinitionDTO, EmDefinitionEntity.class);
Func.copy(emDefinitionDTO, emDefinition); definition.setCreateUser(AuthUtil.getUserId());
return R.data(emDefinitionService.save(emDefinition)); return R.data(emDefinitionService.save(definition));
} }
/** /**

17
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java

@ -11,7 +11,9 @@ 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.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; 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;
@ -53,11 +55,11 @@ public class ObjectUserServiceImpl extends ServiceImpl<ObjectUserMapper, ObjectU
if(objectUsers.isEmpty()){ if(objectUsers.isEmpty()){
return new ArrayList<>(); return new ArrayList<>();
} }
R<List<User>> users = userClient.userListByCodeAndNameAndAccount(AuthUtil.getTenantId(),content.getUserCode(),content.getUserName(),content.getLoginName()); // R<List<User>> users = userClient.userListByCodeAndNameAndAccount(AuthUtil.getTenantId(),content.getUserCode(),content.getUserName(),content.getLoginName());
if(!users.isSuccess() || CollectionUtil.isEmpty(users.getData())){ // if(!users.isSuccess() || CollectionUtil.isEmpty(users.getData())){
return new ArrayList<>(); // return new ArrayList<>();
} // }
Map<Long,User> userMap = users.getData().stream().collect(Collectors.toMap(User::getId, Function.identity())); // Map<Long,User> userMap = users.getData().stream().collect(Collectors.toMap(User::getId, Function.identity()));
return objectUsers.stream().map(objectUser->{ return objectUsers.stream().map(objectUser->{
ObjectUserListVO builder = new ObjectUserListVO(); ObjectUserListVO builder = new ObjectUserListVO();
builder.setId(objectUser.getId()); builder.setId(objectUser.getId());
@ -65,7 +67,8 @@ public class ObjectUserServiceImpl extends ServiceImpl<ObjectUserMapper, ObjectU
builder.setObjName(objectUser.getObjName()); builder.setObjName(objectUser.getObjName());
builder.setTempCode(objectUser.getTempCode()); builder.setTempCode(objectUser.getTempCode());
builder.setTempName(objectUser.getTempName()); builder.setTempName(objectUser.getTempName());
User user = userMap.get(objectUser.getUserId()); // User user = userMap.get(objectUser.getUserId());
User user = UserCache.getUser(objectUser.getUserId());
if(ObjectUtil.isNotEmpty(user)){ if(ObjectUtil.isNotEmpty(user)){
builder.setUserCode(user.getCode()); builder.setUserCode(user.getCode());
builder.setUserName(user.getRealName()); builder.setUserName(user.getRealName());
@ -73,6 +76,6 @@ public class ObjectUserServiceImpl extends ServiceImpl<ObjectUserMapper, ObjectU
builder.setUserId(user.getId()); builder.setUserId(user.getId());
} }
return builder; return builder;
}).collect(Collectors.toList()); }).filter(o -> Func.isNotEmpty(o.getUserId())).collect(Collectors.toList());
} }
} }

33
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzinfo.inspect.task.service.impl; package com.hnac.hzinfo.inspect.task.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.operational.defect.constants.DefectConstant; import com.hnac.hzims.operational.defect.constants.DefectConstant;
@ -92,13 +93,16 @@ public class EventServiceImpl extends ServiceImpl<TaskEventMapper, EventEntity>
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean addTaskEvent(EventAddVO eventVO){ public boolean addTaskEvent(EventAddVO eventVO){
BladeUser user = AuthUtil.getUser();
//第一次登记时,需领用任务 //第一次登记时,需领用任务
if(!AuthUtil.isAdministrator()){ if(!AuthUtil.isAdministrator()){
// 判断当前登录人是否在任务人员列表中
ITaskService taskService = SpringUtil.getBean(ITaskService.class); ITaskService taskService = SpringUtil.getBean(ITaskService.class);
TaskEntity taskEntity = taskService.getById(eventVO.getTaskId()); TaskEntity taskEntity = taskService.getById(eventVO.getTaskId());
TaskUserEntity taskUserEntity = taskUserService.getOne(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId,eventVO.getTaskId()).eq(TaskUserEntity::getUserId,user == null ? eventVO.getUserId() : user.getUserId())); BladeUser user = AuthUtil.getUser();
LambdaQueryWrapper<TaskUserEntity> wrapper = Wrappers.<TaskUserEntity>lambdaQuery()
.eq(TaskUserEntity::getTaskId, eventVO.getTaskId())
.eq(TaskUserEntity::getUserId, user == null ? eventVO.getUserId() : user.getUserId());
TaskUserEntity taskUserEntity = taskUserService.getOne(wrapper);
if(taskUserEntity == null){ if(taskUserEntity == null){
throw new ServiceException("该任务已被别人领取"); throw new ServiceException("该任务已被别人领取");
} }
@ -106,17 +110,18 @@ public class EventServiceImpl extends ServiceImpl<TaskEventMapper, EventEntity>
taskUserEntity.setClaimStatus(TaskContants.ClaimStatusEnum.COLLECT.getStatus()); taskUserEntity.setClaimStatus(TaskContants.ClaimStatusEnum.COLLECT.getStatus());
taskUserEntity.setClaimTime(LocalDateTime.now()); taskUserEntity.setClaimTime(LocalDateTime.now());
taskUserService.updateById(taskUserEntity); taskUserService.updateById(taskUserEntity);
if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(taskEntity.getMethod())){//如果是抢占任务,删除能够抢占此任务的其他人 if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(taskEntity.getMethod())){
taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId,eventVO.getTaskId()).ne(TaskUserEntity::getId,taskUserEntity.getUserId())); //如果是抢占任务,删除能够抢占此任务的其他人
LambdaQueryWrapper<TaskUserEntity> removeUser = Wrappers.<TaskUserEntity>lambdaQuery()
.eq(TaskUserEntity::getTaskId, eventVO.getTaskId())
.ne(TaskUserEntity::getUserId, taskUserEntity.getUserId());
taskUserService.remove(removeUser);
} }
} }
} }
EventEntity event = BeanUtil.copy(eventVO, EventEntity.class); EventEntity event = BeanUtil.copy(eventVO, EventEntity.class);
event.setUserId(eventVO.getUserId()); event.setUserId(eventVO.getUserId());
// if(Func.isEmpty(user)){
// event.setTenantId("000000");
// }
event.setObjectId(eventVO.getObjId()); event.setObjectId(eventVO.getObjId());
event.setCode(CodeUtils.randomCode()); event.setCode(CodeUtils.randomCode());
boolean success = this.save(event); boolean success = this.save(event);
@ -160,18 +165,6 @@ public class EventServiceImpl extends ServiceImpl<TaskEventMapper, EventEntity>
if(success && fileList.size()>0){ if(success && fileList.size()>0){
success = eventAttachmentService.saveBatch(fileList); success = eventAttachmentService.saveBatch(fileList);
} }
//如果是问题则启动工作流引擎
if(TaskContants.ProblemEnum.yes.getType().equals(eventVO.getIsProblem())){
//TODO 并入缺陷处理模块
// startFlow(user,taskObj,event);
/* OperPhenomenonEntity phenomenon = new OperPhenomenonEntity();
phenomenon.setSourceCode(DefectConstant.DefectSourceEnum.XJ.getStatus());
phenomenon.setSourceId(event.getId());
phenomenon.setFinder(user == null ? eventVO.getUserId() : user.getUserId());
phenomenon.setDescripiton(eventVO.getDescription());
phenomenon.setInitResult(eventVO.getInitResult());
startPhenomenonFlow(phenomenon);*/
}
checkProjectFinish(eventVO); checkProjectFinish(eventVO);
return success; return success;
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceMonitorReportMonthDTO.java

@ -27,4 +27,7 @@ public class OperMaintenanceMonitorReportMonthDTO implements Serializable {
@ApiModelProperty(value = "机构ID") @ApiModelProperty(value = "机构ID")
private Long deptId; private Long deptId;
@ApiModelProperty(value = "站点编号")
private String stationCode;
} }

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceMonitorServiceImpl.java

@ -49,6 +49,7 @@ public class OperMaintenanceMonitorServiceImpl implements IOperMaintenanceMonito
eq(OperMaintenancePlanEntity::getIsDeleted, 0L); eq(OperMaintenancePlanEntity::getIsDeleted, 0L);
ge(OperMaintenancePlanEntity::getDisposeTime, startDate); ge(OperMaintenancePlanEntity::getDisposeTime, startDate);
lt(OperMaintenancePlanEntity::getDisposeTime, startDate.plusMonths(1)); lt(OperMaintenancePlanEntity::getDisposeTime, startDate.plusMonths(1));
eq(StringUtil.isNotBlank(req.getStationCode()),OperMaintenancePlanEntity::getStationCode,req.getStationCode());
eq(Func.isNotEmpty(req.getDeptId()), OperMaintenancePlanEntity::getCreateDept, req.getDeptId()); eq(Func.isNotEmpty(req.getDeptId()), OperMaintenancePlanEntity::getCreateDept, req.getDeptId());
}}); }});

Loading…
Cancel
Save