提交 d86f1bba authored 作者: zjm's avatar zjm

fix(任务、丢失、清退): 修改涉及单位等级为1的问题修改

修改涉及单位等级为1的问题修改
上级 4ad27adb
...@@ -95,9 +95,9 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -95,9 +95,9 @@ public class LossBillServiceImpl implements LossBillService {
Units units=unitsService.findById(deviceLoss.getUnitId()); Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId()); Area area=areaService.findByid(units.getAreaId());
TaskBto taskBto; TaskBto taskBto;
if (units.getLevel() == 1) { if (units.getLevel() == 1 && units.getType()==1) {
taskBto=end(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId()); taskBto=end(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId());
} else if (units.getLevel()==2){ } else if (units.getLevel()==2 || units.getType()==2){
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
taskBto= newLossCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId()); taskBto= newLossCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId());
}else { }else {
...@@ -159,10 +159,10 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -159,10 +159,10 @@ public class LossBillServiceImpl implements LossBillService {
Units units=unitsService.findById(deviceLoss.getUnitId()); Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId()); Area area=areaService.findByid(units.getAreaId());
TaskBto taskBto; TaskBto taskBto;
if (units.getLevel() == 1) { if (units.getLevel() == 1 && units.getType()==1) {
taskBto= endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId()); taskBto= endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId());
deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList()); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList());
} else if (units.getLevel()==2){ } else if (units.getLevel()==2 || units.getType()==2){
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
taskBto= newRetrieveCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId()); taskBto= newRetrieveCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId());
}else { }else {
......
...@@ -995,7 +995,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -995,7 +995,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setRepelStatus(2); deviceRepelDetail.setRepelStatus(2);
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
if (units.getLevel() == 1) { if (units.getLevel() == 1 && units.getType()==1) {
deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} else { } else {
deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
...@@ -1024,7 +1024,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1024,7 +1024,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} else { } else {
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
if (units.getLevel() == 1) { if (units.getLevel() == 1 && units.getType() == 1) {
deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} else { } else {
deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
......
...@@ -16,6 +16,7 @@ import com.tykj.dev.device.task.subject.domin.TaskLog; ...@@ -16,6 +16,7 @@ import com.tykj.dev.device.task.subject.domin.TaskLog;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo; import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo; import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.task.utils.TaskUtils; import com.tykj.dev.device.task.utils.TaskUtils;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.cache.UserCache; import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.read.service.MessageService; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto; import com.tykj.dev.device.user.read.subject.bto.MessageBto;
...@@ -93,6 +94,9 @@ public class TaskServiceImpl implements TaskService { ...@@ -93,6 +94,9 @@ public class TaskServiceImpl implements TaskService {
@Autowired @Autowired
UnitsDao unitsDao; UnitsDao unitsDao;
@Autowired
UnitsCache unitsCache;
@Override @Override
public Task deleteById(Task task) { public Task deleteById(Task task) {
...@@ -625,21 +629,20 @@ public class TaskServiceImpl implements TaskService { ...@@ -625,21 +629,20 @@ public class TaskServiceImpl implements TaskService {
//办结 4 封存 5 全部 0 我发起的 1 //办结 4 封存 5 全部 0 我发起的 1
if (num == 4 || num == 5 || num == 1 || num == 0) { if (num == 4 || num == 5 || num == 1 || num == 0) {
//获取单位等级 //获取单位等级
Integer level = userUtils.getCurrentUnitLevel(); Units unit= unitsCache.findById(userUtils.getCurrentUnitId());
//获取该单位以及下属单位所有用户Id //获取该单位以及下属单位所有用户Id
List<Integer> idLists = userPublicService.findAllUserIdByUnitsName(userUtils.getCurrentUserUnitName()); List<Integer> idLists = userPublicService.findAllUserIdByUnitsName(userUtils.getCurrentUserUnitName());
List<TaskUserVo> taskUserVos = new ArrayList<>(); List<TaskUserVo> taskUserVos = new ArrayList<>();
//省能看到所有业务 //省能看到所有业务
if (level == 1) { if (unit.getType() == 1 && unit.getLevel()==1) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream() taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.filter(taskBto -> taskSelectVo.getType() == null .filter(taskBto -> taskSelectVo.getType() == null
|| taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null || !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo()))) || taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null || !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo())))
.map(Task::parse2Bto) .map(Task::parse2Bto)
.map(TaskBto::toVo) .map(TaskBto::toVo)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }else {
//市或县只能看到涉及人员和idLists有交集的 //市或县只能看到涉及人员和idLists有交集的
if (level == 2 || level == 3) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream() taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.map(Task::parse2Bto) .map(Task::parse2Bto)
.map(TaskBto::toVo) .map(TaskBto::toVo)
...@@ -856,22 +859,21 @@ public class TaskServiceImpl implements TaskService { ...@@ -856,22 +859,21 @@ public class TaskServiceImpl implements TaskService {
//办结 封存 全部 我发起的 //办结 封存 全部 我发起的
if (num == 4 || num == 5 || num == 1 || num == 0) { if (num == 4 || num == 5 || num == 1 || num == 0) {
//获取单位等级 //获取单位等级
Integer level = userUtils.getCurrentUnitLevel(); Units units= unitsCache.findById(userUtils.getCurrentUnitId());
//获取该单位以及下属单位所有用户Id //获取该单位以及下属单位所有用户Id
// List<Integer> idLists = userPublicService.findAllUserIdByUnitsName(userUtils.getCurrentUserUnitName()); // List<Integer> idLists = userPublicService.findAllUserIdByUnitsName(userUtils.getCurrentUserUnitName());
List<Integer> idLists = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> idLists = userPublicService.findOtherUser(userUtils.getCurrentUserId());
List<TaskUserVo> taskUserVos = new ArrayList<>(); List<TaskUserVo> taskUserVos = new ArrayList<>();
//省能看到所有业务 //省能看到所有业务
if (level == 1) { if (units.getLevel() == 1 && units.getType()==1) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream() taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.filter(taskBto -> taskSelectVo.getType() == null .filter(taskBto -> taskSelectVo.getType() == null
|| taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null || !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo()))) || taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null || !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo())))
.map(Task::parse2Bto) .map(Task::parse2Bto)
.map(TaskBto::toVo) .map(TaskBto::toVo)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }else {
//市或县只能看到涉及人员和idLists有交集的 //市或县只能看到涉及人员和idLists有交集的
if (level == 2 || level == 3) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream() taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.map(Task::parse2Bto) .map(Task::parse2Bto)
.map(TaskBto::toVo) .map(TaskBto::toVo)
......
...@@ -183,7 +183,7 @@ public class TrainJobController { ...@@ -183,7 +183,7 @@ public class TrainJobController {
taskService.start(taskBto); taskService.start(taskBto);
} }
); );
if (securityUser.getCurrentUserInfo().getUnits().getLevel()==1){ if (securityUser.getCurrentUserInfo().getUnits().getLevel()==1 && securityUser.getCurrentUserInfo().getUnits().getType()==1){
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()); List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.remove(securityUser.getCurrentUserInfo().getUserId()); userIds.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(task.getId(),BusinessEnum.TRAIN.id,"发起"+(trainTheme.getTrainType()==0 ? "线上" : "线下")+ "培训业务:【"+messageToString(trainTheme)+"】",userIds,trainTheme.getTrainId().toString())); messageService.add(new MessageBto(task.getId(),BusinessEnum.TRAIN.id,"发起"+(trainTheme.getTrainType()==0 ? "线上" : "线下")+ "培训业务:【"+messageToString(trainTheme)+"】",userIds,trainTheme.getTrainId().toString()));
......
...@@ -352,8 +352,10 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -352,8 +352,10 @@ public class TrainThemeServiceImpl implements TrainThemeService {
predicateBuilder.lt("createTime", conditionsTrainVo.getEndTime()); predicateBuilder.lt("createTime", conditionsTrainVo.getEndTime());
} }
Units units= unitsCache.findById(conditionsTrainVo.getUnitId()); Units units= unitsCache.findById(conditionsTrainVo.getUnitId());
if (units.getLevel()!=1){ if (units.getLevel() != 1){
predicateBuilder.eq("unitsId",conditionsTrainVo.getUnitId()); predicateBuilder.eq("unitsId",conditionsTrainVo.getUnitId());
} }
if (conditionsTrainVo.getDimName() != null) { if (conditionsTrainVo.getDimName() != null) {
Class<TrainTheme> trainThemeClass = TrainTheme.class; Class<TrainTheme> trainThemeClass = TrainTheme.class;
......
...@@ -197,7 +197,7 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -197,7 +197,7 @@ public class UnitsServiceImpl implements UnitsService {
Units units = unitsDao.findById(unitsId).get(); Units units = unitsDao.findById(unitsId).get();
List<Integer> areaIds = areaDao.findAllByFatherId(units.getAreaId()).stream().filter(area -> area.getType() <= 3).map(Area::getId).collect(Collectors.toList()); List<Integer> areaIds = areaDao.findAllByFatherId(units.getAreaId()).stream().filter(area -> area.getType() <= 3).map(Area::getId).collect(Collectors.toList());
List<Units> units1 = unitsDao.findAllByAreaIdIn(areaIds); List<Units> units1 = unitsDao.findAllByAreaIdIn(areaIds);
if (units.getLevel() == 1) { if (units.getLevel() == 1 && units.getType()==1) {
units1.add(units); units1.add(units);
units1.addAll(unitsDao.findAllByType(2)); units1.addAll(unitsDao.findAllByType(2));
} }
...@@ -209,7 +209,7 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -209,7 +209,7 @@ public class UnitsServiceImpl implements UnitsService {
Units units = unitsDao.findById(unitsId).get(); Units units = unitsDao.findById(unitsId).get();
List<Integer> areaIds= areaDao.findAllByFatherId(units.getAreaId()).stream().filter(area -> area.getType() <= 3).map(Area::getId).collect(Collectors.toList()); List<Integer> areaIds= areaDao.findAllByFatherId(units.getAreaId()).stream().filter(area -> area.getType() <= 3).map(Area::getId).collect(Collectors.toList());
List<Units> units1= unitsDao.findAllByAreaIdIn(areaIds); List<Units> units1= unitsDao.findAllByAreaIdIn(areaIds);
if (units.getLevel()==1){ if (units.getLevel()==1 && units.getType()==1){
units1.addAll(unitsDao.findAllByType(2)); units1.addAll(unitsDao.findAllByType(2));
} }
units1.add(units); units1.add(units);
...@@ -221,7 +221,7 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -221,7 +221,7 @@ public class UnitsServiceImpl implements UnitsService {
Units units = unitsDao.findById(unitsId).get(); Units units = unitsDao.findById(unitsId).get();
List<Integer> areaIds = areaDao.findAllByFatherId(units.getAreaId()).stream().filter(area -> area.getType() <= 3).map(Area::getId).collect(Collectors.toList()); List<Integer> areaIds = areaDao.findAllByFatherId(units.getAreaId()).stream().filter(area -> area.getType() <= 3).map(Area::getId).collect(Collectors.toList());
List<Units> units1 = unitsDao.findAllByAreaIdIn(areaIds); List<Units> units1 = unitsDao.findAllByAreaIdIn(areaIds);
if (units.getLevel() == 1) { if (units.getLevel() == 1 && units.getType()==1) {
// units1.add(units); // units1.add(units);
units1.addAll(unitsDao.findAllByType(2)); units1.addAll(unitsDao.findAllByType(2));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论