提交 159d6e5a authored 作者: zhoushaopan's avatar zhoushaopan

[任务]修改方法

上级 16450d9c
package com.tykj.dev.device.repair.subject.vo;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
/**
* DATE:2021-6-28
* Author:zsp
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("送修装备返回类")
public class WaitingRepairEquipmentVo {
/**
* 主键id
*/
@Id
@GeneratedValue
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
@ApiModelProperty(name = "父id")
private Integer pid;
/**
* 装备id
*/
@ApiModelProperty(value = "装备id")
private Integer deviceId;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* 名称
*/
@ApiModelProperty(value = "名称")
private String name;
/**
* 类型
*/
@ApiModelProperty(value = "类型")
private Integer type;
/**
* 装备序列号
*/
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* rfid表面号
*/
@ApiModelProperty(value = "rfid表面号")
private String rfidSurfaceId;
/**
* 维修单id
*/
@ApiModelProperty(value = "维修单id")
private Integer deviceRepairBillId;
/**
* 所在单位
*/
@ApiModelProperty(value = "所在单位")
private String locationUnit;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
/**
* 维修状态
*/
@ApiModelProperty(value = "维修状态")
private Integer repairStatus;
/**
* 维修备注
*/
@ApiModelProperty(value = "维修备注")
private String remark;
/**
* 维修领取备注
*/
@ApiModelProperty(value = "维修领取备注")
private String backRemark;
/**
* 已报废换新装备详情主键Id(null代表没有报废,0代表已报废还没有换新)
*/
@ApiModelProperty(value = "已报废换新装备详情主键Id(null代表没有报废,0代表已报废还没有换新)")
private Integer newDeviceDetailId;
/**
* 创建用户id
*/
@ApiModelProperty(value = "创建用户id")
@CreatedBy
private Integer createUserId;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@CreatedDate
private Date createTime;
/**
* 更新用户id
*/
@ApiModelProperty(value = "更新用户id")
@LastModifiedBy
private Integer updateUserId;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
@LastModifiedDate
private Date updateTime;
/**
* 删除标记(0:未删除,1:已删除)
*/
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
@ApiModelProperty(value = "省维修记录信息")
private String record;
@ApiModelProperty(value = "市维修记录信息")
private String record2;
@ApiModelProperty(value = "县维修记录信息")
private String record3;
@ApiModelProperty(value = "领取单id")
private Integer repairBackBillId;
@ApiModelProperty(value = "形态")
@Transient
private String typeName;
@ApiModelProperty(value = "任务uservo")
private TaskUserVo taskUserVos;
}
......@@ -338,6 +338,8 @@ public class TaskController {
Integer businessType = taskBusinessTypeVo.getBusinessType();
Integer taskId = taskBusinessTypeVo.getTaskId();
//拿到标志位
// Integer outOrEnter = taskBusinessTypeVo.getOutOrEnter();
//当前状态
Integer billStatus = taskService.get(taskId).getBillStatus();
List<TaskLogUserVo> taskLogUserVos = taskLogService.getByTaskId2(taskId);
......@@ -429,8 +431,11 @@ public class TaskController {
if (billStatus == 302 || billStatus == 340){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
} else {
map.put("340j",taskLogUserVo.getUser());
if (billStatus == 341 && !map.containsKey("302")){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}else {
map.put("340j",taskLogUserVo.getUser());
}
}
}else {
//存在 配发中
......@@ -450,6 +455,18 @@ public class TaskController {
} else {
//0 333
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
if (billStatus == 302 && map.containsKey("340")){
map.remove("340");
map.remove("341");
}
//签章拒绝 改为签字 需要移除340 340j
if (billStatus == 303 && taskLogUserVo.getOldStatus() == 302){
// map.remove("340");
map.remove("340j");
// map.remove("341");
}
if (billStatus == 333 && map.containsKey("340")){
map.remove("340");
}
......@@ -457,6 +474,10 @@ public class TaskController {
if (billStatus == 340 && map.containsKey("340") && !map.containsKey("302") && taskLogUserVo.getOldStatus()!=341){
map.remove("340");
}
//add
if (billStatus == 340 && taskLogUserVo.getOldStatus() == 302){
map.remove("340j");
}
}
}
......@@ -473,17 +494,21 @@ public class TaskController {
if (taskLogUserVo.getOldStatus() == 930){
if (map.containsKey("930")){
if (billStatus == 900 && billStatus == 930){
if (billStatus == 900 || billStatus == 930){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}else {
map.put("930j",taskLogUserVo.getUser());
} else {
if (billStatus == 931 && !map.containsKey("900")){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}else {
map.put("930j",taskLogUserVo.getUser());
}
}
}else {
//存在
//存在 配发中
if (map.containsKey("900")){
map.put("930j",taskLogUserVo.getUser());
}else {
if (billStatus == 922 && taskLogUserVo.getOldStatus() ==930){
if (billStatus == 922 && taskLogUserVo.getOldStatus() == 930){
map.clear();
}else {
map.put("930",taskLogUserVo.getUser());
......@@ -493,16 +518,34 @@ public class TaskController {
map.remove("930j");
}
}
}else {
} else {
//0 333
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
if (billStatus == 900 && map.containsKey("930")){
map.remove("930");
map.remove("931");
}
if (billStatus == 922 && map.containsKey("930")){
map.remove("930");
}
if (billStatus == 930 && map.containsKey("930") && map.containsKey("900")){
if (billStatus == 930 && map.containsKey("930") && !map.containsKey("900") && taskLogUserVo.getOldStatus()!=931){
map.remove("930");
}
//签章拒绝 改为签字 需要移除340 340j
if (billStatus == 901 && taskLogUserVo.getOldStatus() == 900){
map.remove("930");
// map.remove("930j");
}
//add
if (billStatus == 930 && taskLogUserVo.getOldStatus() == 900){
map.remove("930j");
}
}
}
}
......@@ -510,20 +553,25 @@ public class TaskController {
}
private Map<String, String> repair(List<TaskLogUserVo> taskLogUserVos,Integer billStatus){
Map<String, String> map = new HashMap<>();
for (TaskLogUserVo taskLogUserVo : taskLogUserVos) {
if (taskLogUserVo.getOldStatus()!=null){
if (taskLogUserVo.getOldStatus() == 790){
if (map.containsKey("790")){
if (billStatus == 701 && map.containsKey("790"))
map.remove("790");
else {
map.put("790j",taskLogUserVo.getUser());
if (billStatus == 701 || billStatus == 790){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
} else {
if (billStatus == 791 && !map.containsKey("701")){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}else {
map.put("790j",taskLogUserVo.getUser());
}
}
}else {
//存在
if (map.containsKey("703")){
//存在 配发中
if (map.containsKey("701")){
map.put("790j",taskLogUserVo.getUser());
}else {
if (billStatus == 788 && taskLogUserVo.getOldStatus() == 790){
......@@ -532,29 +580,39 @@ public class TaskController {
map.put("790",taskLogUserVo.getUser());
}
}
if (billStatus == 701 && map.containsKey("790j")){
map.remove("790j");
}
}
}else {
if (taskLogUserVo.getOldStatus() == 791){
if (map.containsKey("791") && billStatus == 701){
map.remove("791");
}else if (map.containsKey("791") && map.containsKey("790j")){
map.put("791j",taskLogUserVo.getUser());
}else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}
}else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
if (billStatus == 790 && map.containsKey("790")){
map.remove("790");
}
} else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
if (billStatus == 701 && map.containsKey("790")){
map.remove("790");
map.remove("791");
}
//0 333
if (billStatus == 788 && map.containsKey("790")){
map.remove("790");
}
if (billStatus == 790 && map.containsKey("790") && !map.containsKey("701") && taskLogUserVo.getOldStatus()!=791){
map.remove("790");
}
//签章拒绝 改为签字 需要移除340 340j
if (billStatus == 704 && taskLogUserVo.getOldStatus() == 701){
map.remove("790");
// map.remove("790j");
}
//add
if (billStatus == 790 && taskLogUserVo.getOldStatus() == 701){
map.remove("790j");
}
}
}
}
return map;
......@@ -567,15 +625,19 @@ public class TaskController {
if (taskLogUserVo.getOldStatus() == 820){
if (map.containsKey("820")){
if (billStatus == 801 && map.containsKey("820"))
map.remove("820");
else {
map.put("820j",taskLogUserVo.getUser());
if (billStatus == 801 || billStatus == 820){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
} else {
if (billStatus == 821 && !map.containsKey("801")){
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}else {
map.put("820j",taskLogUserVo.getUser());
}
}
}else {
//存在
//存在 配发中
if (map.containsKey("801")){
map.put("820",taskLogUserVo.getUser());
map.put("820j",taskLogUserVo.getUser());
}else {
if (billStatus == 888 && taskLogUserVo.getOldStatus() == 820){
map.clear();
......@@ -583,27 +645,36 @@ public class TaskController {
map.put("820",taskLogUserVo.getUser());
}
}
if (billStatus == 801 && map.containsKey("820j")){
map.remove("820j");
}
}
}else {
if (taskLogUserVo.getOldStatus() == 821){
if (map.containsKey("821") && billStatus == 801){
map.remove("821");
}else if (map.containsKey("821") && map.containsKey("821j")){
map.put("821j",taskLogUserVo.getUser());
}else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
}
}else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
if (billStatus == 820 && map.containsKey("820")){
map.remove("820");
}
} else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
if (billStatus == 801 && map.containsKey("820")){
map.remove("820");
map.remove("821");
}
//0 333
if (billStatus == 888 && map.containsKey("820")){
map.remove("820");
}
if (billStatus == 820 && map.containsKey("820") && !map.containsKey("801") && taskLogUserVo.getOldStatus()!=821){
map.remove("820");
}
//签章拒绝 改为签字 需要移除340 340j
if (billStatus == 804 && taskLogUserVo.getOldStatus() == 801){
map.remove("820");
// map.remove("820j");
}
//add
if (billStatus == 820 && taskLogUserVo.getOldStatus() == 801){
map.remove("820j");
}
}
}
}
......@@ -611,55 +682,6 @@ public class TaskController {
}
// private Map<String, String> repairBack(List<TaskLogUserVo> taskLogUserVos,Integer billStatus){
// Map<String, String> map = new HashMap<>();
// for (TaskLogUserVo taskLogUserVo : taskLogUserVos) {
// if (taskLogUserVo.getOldStatus()!=null){
//
// if (taskLogUserVo.getOldStatus() == 820){
// if (billStatus == 801 && map.containsKey("820")){
// map.remove("820");
// }else if (map.containsKey("820")){
// map.put("820j",taskLogUserVo.getUser());
// }else {
// //存在
// if (map.containsKey("801")){
// map.put("820j",taskLogUserVo.getUser());
// }else {
// if (billStatus == 888 && taskLogUserVo.getOldStatus() == 820){
// map.clear();
// }else {
// map.put("820",taskLogUserVo.getUser());
//
// }
// if (billStatus == 801 && map.containsKey("820j")){
// map.remove("820j");
// }
// }
// }
// }else {
// if (taskLogUserVo.getOldStatus() == 821){
// if (map.containsKey("821") && billStatus == 801){
// map.remove("821");
// }else if (map.containsKey("821") && map.containsKey("820j")){
// map.put("821j",taskLogUserVo.getUser());
// }else {
// map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
// }
// }else {
// map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
// if (billStatus == 820 && map.containsKey("820")){
// map.remove("820");
// }
// }
// }
// }
//
// }
// return map;
//
// }
private Map<String, String> defaults(List<TaskLogUserVo> taskLogUserVos){
Map<String, String> map = new HashMap<>();
for (TaskLogUserVo taskLogUserVo : taskLogUserVos) {
......@@ -668,7 +690,6 @@ public class TaskController {
}
}
return map;
}
......
......@@ -31,5 +31,6 @@ public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationE
@Query("update User o set o.trainStatus = :trainStatus where o.userId in :userIds")
int upDateUserIdsAndTrainStatus(@Param("userIds") List<Integer> userIds,Integer trainStatus);
User findByName(String name);
}
......@@ -10,6 +10,7 @@ import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import java.util.List;
import java.util.Map;
/**
* @author zjm
......@@ -27,7 +28,8 @@ public interface UserService extends PublicService<User> {
*/
User findByUserName(String userName);
User save(User user, SecurityUser securityUser);
// User save(User user, SecurityUser securityUser);
Map save(User user, SecurityUser securityUser);
/**
* 查询同级人员
......
......@@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.rmi.MarshalledObject;
import java.util.*;
import java.util.stream.Collectors;
......@@ -73,12 +74,24 @@ public class UserServiceImpl implements UserService {
ConfigCache configCache;
@Override
public User save(User user, SecurityUser securityUser) {
public Map save(User user, SecurityUser securityUser) {
Map<String, Object> map = new HashMap<>();
String encode = bCryptPasswordEncoder.encode("qwer1234");
user.setPassword(encode);
user.setNoPassword("qwer1234");
Units units = unitsService.findById(user.getUnitsId());
user.setShowOrder(userDao.maxShowOrder(units.getUnitId())+1);
//先判断用户名是否被注册
User byName = userDao.findByName(user.getName());
if (byName != null){
map.put("error",byName);
return map;
}
User byUsername = userDao.findByUsername(user.getUsername());
if (byUsername != null){
map.put("error",byUsername);
return map;
}
User user1 = userDao.save(user);
switch (units.getLevel()){
case 1:
......@@ -94,10 +107,11 @@ public class UserServiceImpl implements UserService {
log.info("[user] 添加转管员单位等级不存在:{}",units.getLevel());
}
messageService.add(new MessageBto(0,-1,securityUser.getUsername()+"添加专管员"+user1.getUsername(),this.findAllLastUserids(securityUser.getCurrentUserInfo().getUserId())));
messageService.add(new MessageBto(0,-1,securityUser.getCurrentUserInfo().getName()+"添加专管员"+user1.getName(),this.findAllLastUserids(securityUser.getCurrentUserInfo().getUserId())));
userLogService.save(new UserLog(user1.getUserId(),new Date(),"专管员任命成功"));
userCache.refresh(userDao.findAll());
return user1;
map.put("user1",user1);
return map;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论