提交 6e933109 authored 作者: zhoushaopan's avatar zhoushaopan

Merge remote-tracking branch 'origin/dev' into read-dev

# Conflicts: # dev-repair/src/main/java/com/tykj/dev/device/repair/controller/RepairController.java
......@@ -24,9 +24,11 @@ import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.cache.UnitsCache;
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.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.service.UnitsService;
......@@ -128,6 +130,9 @@ public class AllotBillController {
@Autowired
private PackingController packingController;
@Autowired
private UnitsCache unitsCache;
@ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备")
@PostMapping(value = "/load")
public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) {
......@@ -298,7 +303,11 @@ public class AllotBillController {
Map<Integer, Integer> changeMap = new HashMap<>();
Map<String, PackingLibrary> packingLibraryHashMap = new HashMap<>();
if (unitsService.findbyName(allotBillSaveVo.getSendUnit()).getLevel() == 1) {
// if (unitsService.findbyName(allotBillSaveVo.getSendUnit()).getLevel() == 1) {
// createPacking(strings, allotBillSaveVo, packingLibraryHashMap);
// }
Units units = unitsCache.findById(allotBillSaveVo.getSendUnitId());
if (units.getLevel() == 1 && units.getType() == 1) {
createPacking(strings, allotBillSaveVo, packingLibraryHashMap);
}
......
......@@ -25,9 +25,12 @@ import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.cache.UserCache;
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.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
......@@ -121,6 +124,9 @@ public class DeviceApplyController {
@Qualifier("taskExecutor")
private Executor executor;
@Autowired
private UnitsCache unitsCache;
// @Autowired
// private DeviceLibraryDao deviceLibraryDao;
......@@ -160,7 +166,10 @@ public class DeviceApplyController {
default:
title = "装备申请";
}
if (userUtils.getCurrentUnitLevel()==1){
// if (userUtils.getCurrentUnitLevel()==1){
Integer currentUnitLevel = userUtils.getCurrentUnitLevel();
Units units = unitsCache.findById(userUtils.getCurrentUnitId());
if (units.getLevel()==1 && units.getType() == 1){
//如果是省 等待中办 设置状态为3
deviceApplyBillEntity.setApplyStatus(3);
deviceApplyBillService.update(deviceApplyBillEntity);
......
......@@ -342,6 +342,12 @@ public class DeviceCheckController {
@ApiOperation(value = "根据billId查询核查详情数据", notes = "可以通过这个接口查询核查详情数据")
@GetMapping("/detail/{id}")
public ResponseEntity<ResultObj<CheckDetailVo>> findDetail(@PathVariable Integer id) {
DeviceCheckDetail detail = detailRepo.findById(id).orElseThrow(() -> new ApiException("给出的bill id 不存在"));
if (CHECK_DETAIL_REGION_0.equals(detail.getCheckStatus()) || CHECK_DETAIL_CITY_0.equals((detail.getCheckStatus()))) {
refreshDetail(id);
}
CheckDetailVo detailVoList = detailRepo.findById(id)
.map(transUtil::CheckDetailDo2Vo)
.orElse(null);
......
......@@ -95,9 +95,9 @@ public class LossBillServiceImpl implements LossBillService {
Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId());
TaskBto taskBto;
if (units.getLevel() == 1) {
if (units.getLevel() == 1 && units.getType()==1) {
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());
taskBto= newLossCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId());
}else {
......@@ -159,10 +159,10 @@ public class LossBillServiceImpl implements LossBillService {
Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId());
TaskBto taskBto;
if (units.getLevel() == 1) {
if (units.getLevel() == 1 && units.getType()==1) {
taskBto= endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId());
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());
taskBto= newRetrieveCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId());
}else {
......
......@@ -995,7 +995,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setRepelStatus(2);
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()));
} else {
deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
......@@ -1024,7 +1024,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} else {
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()));
} else {
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;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
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.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
......@@ -93,6 +94,9 @@ public class TaskServiceImpl implements TaskService {
@Autowired
UnitsDao unitsDao;
@Autowired
UnitsCache unitsCache;
@Override
public Task deleteById(Task task) {
......@@ -625,21 +629,20 @@ public class TaskServiceImpl implements TaskService {
//办结 4 封存 5 全部 0 我发起的 1
if (num == 4 || num == 5 || num == 1 || num == 0) {
//获取单位等级
Integer level = userUtils.getCurrentUnitLevel();
Units unit= unitsCache.findById(userUtils.getCurrentUnitId());
//获取该单位以及下属单位所有用户Id
List<Integer> idLists = userPublicService.findAllUserIdByUnitsName(userUtils.getCurrentUserUnitName());
List<TaskUserVo> taskUserVos = new ArrayList<>();
//省能看到所有业务
if (level == 1) {
if (unit.getType() == 1 && unit.getLevel()==1) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.filter(taskBto -> taskSelectVo.getType() == null
|| taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null || !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo())))
.map(Task::parse2Bto)
.map(TaskBto::toVo)
.collect(Collectors.toList());
}
//市或县只能看到涉及人员和idLists有交集的
if (level == 2 || level == 3) {
}else {
//市或县只能看到涉及人员和idLists有交集的
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.map(Task::parse2Bto)
.map(TaskBto::toVo)
......@@ -856,22 +859,21 @@ public class TaskServiceImpl implements TaskService {
//办结 封存 全部 我发起的
if (num == 4 || num == 5 || num == 1 || num == 0) {
//获取单位等级
Integer level = userUtils.getCurrentUnitLevel();
Units units= unitsCache.findById(userUtils.getCurrentUnitId());
//获取该单位以及下属单位所有用户Id
// List<Integer> idLists = userPublicService.findAllUserIdByUnitsName(userUtils.getCurrentUserUnitName());
List<Integer> idLists = userPublicService.findOtherUser(userUtils.getCurrentUserId());
List<TaskUserVo> taskUserVos = new ArrayList<>();
//省能看到所有业务
if (level == 1) {
if (units.getLevel() == 1 && units.getType()==1) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.filter(taskBto -> taskSelectVo.getType() == null
|| taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null || !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo())))
.map(Task::parse2Bto)
.map(TaskBto::toVo)
.collect(Collectors.toList());
}
//市或县只能看到涉及人员和idLists有交集的
if (level == 2 || level == 3) {
}else {
//市或县只能看到涉及人员和idLists有交集的
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.map(Task::parse2Bto)
.map(TaskBto::toVo)
......
......@@ -183,7 +183,7 @@ public class TrainJobController {
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());
userIds.remove(securityUser.getCurrentUserInfo().getUserId());
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 {
predicateBuilder.lt("createTime", conditionsTrainVo.getEndTime());
}
Units units= unitsCache.findById(conditionsTrainVo.getUnitId());
if (units.getLevel()!=1){
if (units.getLevel() != 1){
predicateBuilder.eq("unitsId",conditionsTrainVo.getUnitId());
}
if (conditionsTrainVo.getDimName() != null) {
Class<TrainTheme> trainThemeClass = TrainTheme.class;
......
......@@ -197,7 +197,7 @@ public class UnitsServiceImpl implements UnitsService {
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<Units> units1 = unitsDao.findAllByAreaIdIn(areaIds);
if (units.getLevel() == 1) {
if (units.getLevel() == 1 && units.getType()==1) {
units1.add(units);
units1.addAll(unitsDao.findAllByType(2));
}
......@@ -209,7 +209,7 @@ public class UnitsServiceImpl implements UnitsService {
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<Units> units1= unitsDao.findAllByAreaIdIn(areaIds);
if (units.getLevel()==1){
if (units.getLevel()==1 && units.getType()==1){
units1.addAll(unitsDao.findAllByType(2));
}
units1.add(units);
......@@ -221,7 +221,7 @@ public class UnitsServiceImpl implements UnitsService {
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<Units> units1 = unitsDao.findAllByAreaIdIn(areaIds);
if (units.getLevel() == 1) {
if (units.getLevel() == 1 && units.getType()==1) {
// units1.add(units);
units1.addAll(unitsDao.findAllByType(2));
}
......
......@@ -28,6 +28,7 @@ import com.tykj.dev.device.sendback.service.RepelQueryService;
import com.tykj.dev.device.storage.repository.StorageBillDao;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
......@@ -351,6 +352,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
int decommissioningStatisticsNum = 0;//退役
int toRepairBackNum = 0;//向下级进行维修退回
int toRepairNum = 0;// 接收下级单位维修
Units units = unitsCache.findById(userUtils.getCurrentUnitId());
//筛选出日期范围内所有入库账单
List<StorageBill> storageBillEntities = storageBillDao.findAll().stream()
.filter(storageBillEntity -> storageBillEntity.getStorageStatus() == 2 && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(storageBillEntity.getReceiveUseraId())) && storageBillEntity.getUpdateTime().after(date) && storageBillEntity.getUpdateTime().before(date2))
......@@ -419,7 +421,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
}
}
//筛选出配接收退回的账单 接收退回
if (userUtils.getCurrentUnitLevel() != 1){
if (userUtils.getCurrentUnitLevel() != 1 && units.getType() == 1){
//发起退回
// List<AllotBackBill> sendAllotBackBills = allotBackBillDao.findAll().stream()
// .filter(allotBackBill -> allotStatusBackList.contains(allotBackBill.getBackStatus()) && userUtils.getCurrentUserUnitName().equals(allotBackBill.getSendUnit()) && allotBackBill.getSendTime().after(date) && allotBackBill.getSendTime().before(date2))
......@@ -441,7 +443,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
}
//省级才能销毁,列装,退装 退役 报废
if (userUtils.getCurrentUnitLevel() == 1) {
if (userUtils.getCurrentUnitLevel() == 1 && units.getType() == 1) {
//报废
int scrapStatisticsCount = this.getScrapStatisticsCount(date, date2);
scrapStatisticsNum = scrapStatisticsCount;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论