提交 38612d3f authored 作者: zhoushaopan's avatar zhoushaopan

提交代码

上级 99bb2aad
...@@ -23,8 +23,6 @@ public interface FinalCheckService { ...@@ -23,8 +23,6 @@ public interface FinalCheckService {
*/ */
FinalReportVo generateReport(LocalDate startTime, LocalDate endTime); FinalReportVo generateReport(LocalDate startTime, LocalDate endTime);
FinalReportVo generateReport1(LocalDate startTime, LocalDate endTime);
/** /**
* 根据关键字查询报告列表(不附带detail) * 根据关键字查询报告列表(不附带detail)
* @return {@link FinalReportVo} 's List * @return {@link FinalReportVo} 's List
......
package com.tykj.dev.device.finalcheck.service.impl; package com.tykj.dev.device.finalcheck.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.allot.repository.AllotBillDao; import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
...@@ -35,8 +36,10 @@ import com.tykj.dev.misc.utils.StringSplitUtil; ...@@ -35,8 +36,10 @@ import com.tykj.dev.misc.utils.StringSplitUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
//import sun.text.normalizer.UBiDiProps;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -72,26 +75,26 @@ public class FinalCheckServiceImpl implements FinalCheckService { ...@@ -72,26 +75,26 @@ public class FinalCheckServiceImpl implements FinalCheckService {
@Autowired @Autowired
private UserUtils userService; private UserUtils userService;
@Autowired // @Autowired
private ScrapBillDao scrapBillDao; // private ScrapBillDao scrapBillDao;
//
@Autowired // @Autowired
private DeviceDestroyBillDao deviceDestroyBillDao; // private DeviceDestroyBillDao deviceDestroyBillDao;
//
@Autowired // @Autowired
private UnitsDao unitsDao; // private UnitsDao unitsDao;
//
@Autowired // @Autowired
private RepairSendBillDao repairSendBillDao; // private RepairSendBillDao repairSendBillDao;
//
@Autowired // @Autowired
private RepairBackBillDao repairBackBillDao; // private RepairBackBillDao repairBackBillDao;
//
@Autowired // @Autowired
private AllotBillDao allotBillDao; // private AllotBillDao allotBillDao;
//
@Autowired // @Autowired
private DeviceLibraryService deviceLibraryService; // private DeviceLibraryService deviceLibraryService;
@Override @Override
public FinalReportVo generateReport(LocalDate startTime, LocalDate endTime) { public FinalReportVo generateReport(LocalDate startTime, LocalDate endTime) {
...@@ -101,12 +104,17 @@ public class FinalCheckServiceImpl implements FinalCheckService { ...@@ -101,12 +104,17 @@ public class FinalCheckServiceImpl implements FinalCheckService {
FinalReport report = new FinalReport(name, unitName, startTime, endTime, LocalDateTime.now(), operatorName); FinalReport report = new FinalReport(name, unitName, startTime, endTime, LocalDateTime.now(), operatorName);
report = reportDao.save(report); report = reportDao.save(report);
// 查询这段时间内该单位下的所有装备 并且计数 // 查询这段时间内该单位下的所有装备 并且计数
List<DeviceLibrary> devices = deviceDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime)); // List<DeviceLibrary> devices = deviceDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime));
//
PredicateBuilder<DeviceLibrary> builder = Specifications.and();
builder.eq("ownUnit",unitName);
List<DeviceLibrary> devices = deviceDao.findAll(builder.build());
// 纵向-查 横向-0 委托-0 合计-合计 代管0 收到 发出 报废0 // 纵向-查 横向-0 委托-0 合计-合计 代管0 收到 发出 报废0
Map<String, List<DeviceLibrary>> map = devices.stream() Map<String, List<DeviceLibrary>> map = devices.stream()
.collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName())); .collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
//报废 //报废
List<ScrapBill> scrapBills = scrapBillDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime)); // List<ScrapBill> scrapBills = scrapBillDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime));
//根据单位名称查询单位id //根据单位名称查询单位id
// Units units = unitsDao.findByName(unitName); // Units units = unitsDao.findByName(unitName);
...@@ -178,46 +186,6 @@ public class FinalCheckServiceImpl implements FinalCheckService { ...@@ -178,46 +186,6 @@ public class FinalCheckServiceImpl implements FinalCheckService {
return report.toVo(detailList); return report.toVo(detailList);
} }
@Override
public FinalReportVo generateReport1(LocalDate startTime, LocalDate endTime) {
String name = startTime+"~"+endTime + "决算报告";
String unitName = userService.getCurrentUserUnitName();
String operatorName = userService.getCurrentName();
FinalReport report = new FinalReport(name, unitName, startTime, endTime, LocalDateTime.now(), operatorName);
report = reportDao.save(report);
//送修
Map<String, DeviceStatistics> repairMap = dataService.getRepairStatistics(localDateToDate(startTime), localDateToDate(endTime))
.stream()
.collect(toMap(deviceStatistics -> deviceStatistics.getModel()+"Ǵ"+deviceStatistics.getName(), Function.identity()));
// //主键为model+name,最后输出vaules集合
// Map<String, FinalDetailVo> finalDetailVoMap= new HashMap<>();
// //去每个账单遍历筛选出装备,每个装备put进finalDetailVoMap,如果没有则直接插入,对应的统计数据+1
//// finalDetailVoMap.values()
// Map<String, DeviceStatistics> storageMap = dataService.getStorageStatistics(localDateToDate(startTime), localDateToDate(endTime))
// .stream()
// .collect(toMap(deviceStatistics -> deviceStatistics.getModel()+"Ǵ"+deviceStatistics.getName(), Function.identity()));
//
// for (String s : storageMap.keySet()) {
// if (!finalDetailVoMap.containsKey(s)){
// FinalDetailVo finalDetailVo = new FinalDetailVo();
// String[] strings = s.split("Ǵ");
// String model1 = strings[0];
// String name1 = strings[1];
// finalDetailVo.setReceived(storageMap.get(s).getNum());
// finalDetailVo.setModel(model1);
// finalDetailVo.setType(name1);
// finalDetailVoMap.put(s,finalDetailVo);
// }else {
// FinalDetailVo finalDetailVo = finalDetailVoMap.get(s);
// finalDetailVo.setReceived(storageMap.get(s).getNum()+finalDetailVo.getReceived());
// finalDetailVoMap.put(s,finalDetailVo);
// }
// }
return null;
}
@Override @Override
public Page<FinalReportVo> findAllWithoutDetail(FinalReportSelectVo finalReportSelectVo) { public Page<FinalReportVo> findAllWithoutDetail(FinalReportSelectVo finalReportSelectVo) {
......
...@@ -92,6 +92,31 @@ public class TaskController { ...@@ -92,6 +92,31 @@ public class TaskController {
map.put("businessTypes",businessType.stream().map(integer -> new BusinessTypeVo(integer,businessMap.get(integer))).collect(Collectors.toList())); map.put("businessTypes",businessType.stream().map(integer -> new BusinessTypeVo(integer,businessMap.get(integer))).collect(Collectors.toList()));
return ResultUtil.success(map); return ResultUtil.success(map);
} }
@ApiOperation(value = "业务分页查询", notes = "可以通过这个接口分页查询业务")
@RequestMapping(method = RequestMethod.POST, value = "/manage/summary1", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getTaskPage1(@RequestBody TaskSelectVo taskSelectVo) {
Boolean hasTitleDim = taskSelectVo.getTitleDim()!=null;
Boolean hasStatusDim = taskSelectVo.getStatusDim()!=null;
Boolean hasCreateUserDim = taskSelectVo.getCreateUserDim()!=null;
Boolean hasProcessingUserDim = taskSelectVo.getProcessingUserDim()!=null;
List<TaskUserVo> taskUserVos = taskService.getManageList1(taskSelectVo);
if (hasTitleDim||hasStatusDim||hasCreateUserDim||hasProcessingUserDim) {
taskUserVos = taskUserVos.stream().filter(taskUserVo -> {
Boolean containTitleDim = !hasTitleDim||taskUserVo.getTitle().contains(taskSelectVo.getTitleDim());
Boolean containStatusDim = !hasStatusDim||taskUserVo.getStatus().contains(taskSelectVo.getStatusDim());
Boolean containCreateUserDim = !hasCreateUserDim||taskUserVo.getCreateUser().contains(taskSelectVo.getCreateUserDim());
Boolean containProcessingUserDim = !hasProcessingUserDim||taskUserVo.getProcessingUser().contains(taskSelectVo.getProcessingUserDim());
return containTitleDim&&containStatusDim&&containCreateUserDim&&containProcessingUserDim;
}).collect(Collectors.toList());
}
Page<TaskUserVo> taskUserVos1 = PageUtil.getPerPage(taskSelectVo.getPage(), taskSelectVo.getSize(), taskUserVos, taskSelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
Map<Integer,String> businessMap = GlobalMap.getBusinessMap();
Set<Integer> businessType = taskUserVos.stream().map(TaskUserVo::getBusinessType).collect(Collectors.toSet());
map.put("pages",taskUserVos1);
map.put("businessTypes",businessType.stream().map(integer -> new BusinessTypeVo(integer,businessMap.get(integer))).collect(Collectors.toList()));
return ResultUtil.success(map);
}
@ApiOperation(value = "新增待办列表查询", notes = "可以通过这个接口查询业务") @ApiOperation(value = "新增待办列表查询", notes = "可以通过这个接口查询业务")
...@@ -313,9 +338,18 @@ public class TaskController { ...@@ -313,9 +338,18 @@ public class TaskController {
Integer businessType = taskBusinessTypeVo.getBusinessType(); Integer businessType = taskBusinessTypeVo.getBusinessType();
Integer taskId = taskBusinessTypeVo.getTaskId(); Integer taskId = taskBusinessTypeVo.getTaskId();
// Integer parentTaskId = taskService.get(taskId).getParentTaskId();
//当前状态 //当前状态
Integer billStatus = taskService.get(taskId).getBillStatus(); Integer billStatus = taskService.get(taskId).getBillStatus();
List<TaskLogUserVo> taskLogUserVos = taskLogService.getByTaskId2(taskId); List<TaskLogUserVo> taskLogUserVos = taskLogService.getByTaskId2(taskId);
// List<TaskBto> taskBtos = taskDao.findAll().stream()
// .filter(task -> task.getNodeIdDetail() != null && task.getNodeIdDetail().contains("." + taskId + "."))
// .map(Task::parse2Bto)
// .collect(Collectors.toList());
// if (taskBtos.size() > 0) {
// taskBtos.forEach(taskBto -> taskLogUserVos.addAll(taskLogService.getByTaskId(taskBto.getId())));
// }
switch(businessType){ switch(businessType){
case 3 : case 3 :
return ResponseEntity.ok(allot(taskLogUserVos,billStatus)); return ResponseEntity.ok(allot(taskLogUserVos,billStatus));
...@@ -389,7 +423,11 @@ public class TaskController { ...@@ -389,7 +423,11 @@ public class TaskController {
} }
} else { } else {
//0 333 //0 333
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser()); // if (billStatus == 333){
// map.clear();
// }else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
// }
} }
} }
...@@ -421,7 +459,12 @@ public class TaskController { ...@@ -421,7 +459,12 @@ public class TaskController {
} }
} }
}else { }else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser()); // if (billStatus == 922){
// map.clear();
// }else{
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
// }
} }
} }
...@@ -445,13 +488,19 @@ public class TaskController { ...@@ -445,13 +488,19 @@ public class TaskController {
if (billStatus == 788 && taskLogUserVo.getOldStatus() == 790){ if (billStatus == 788 && taskLogUserVo.getOldStatus() == 790){
map.clear(); map.clear();
}else { }else {
map.put("790",taskLogUserVo.getUser()); map.put("790",taskLogUserVo.getUser());
} }
} }
} }
}else { }else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser()); // if (billStatus == 788){
// map.clear();
// }else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
// }
} }
} }
...@@ -482,7 +531,11 @@ public class TaskController { ...@@ -482,7 +531,11 @@ public class TaskController {
} }
} }
}else { }else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser()); // if (billStatus == 888){
// map.clear();
// }else {
map.put(taskLogUserVo.getOldStatus()+"",taskLogUserVo.getUser());
// }
} }
} }
......
...@@ -135,6 +135,8 @@ public interface TaskService { ...@@ -135,6 +135,8 @@ public interface TaskService {
*/ */
List<TaskUserVo> getManageList(TaskSelectVo taskSelectVo); List<TaskUserVo> getManageList(TaskSelectVo taskSelectVo);
List<TaskUserVo> getManageList1(TaskSelectVo taskSelectVo);
/** /**
* @param taskBto 任务bto * @param taskBto 任务bto
* @param userId 新增涉及用户id * @param userId 新增涉及用户id
......
...@@ -33,9 +33,12 @@ import com.tykj.dev.device.task.subject.bto.TaskBto; ...@@ -33,9 +33,12 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto; import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.train.dao.TrainThemeDao; import com.tykj.dev.device.train.dao.TrainThemeDao;
import com.tykj.dev.device.train.dao.WorkHandoverDao; import com.tykj.dev.device.train.dao.WorkHandoverDao;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BeanHelper; import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.SpringUtils; import com.tykj.dev.misc.utils.SpringUtils;
import com.tykj.dev.rfid.service.RfidChangeBillService; import com.tykj.dev.rfid.service.RfidChangeBillService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -46,6 +49,7 @@ import org.aspectj.lang.annotation.Before; ...@@ -46,6 +49,7 @@ import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -157,6 +161,7 @@ public class LogAspect { ...@@ -157,6 +161,7 @@ public class LogAspect {
this.outPutTask = (TaskBto) returnValue; this.outPutTask = (TaskBto) returnValue;
this.businessType = this.outPutTask.getBusinessType(); this.businessType = this.outPutTask.getBusinessType();
this.newStatus = this.outPutTask.getBillStatus(); this.newStatus = this.outPutTask.getBillStatus();
if (this.inputTask.getId() != null) { if (this.inputTask.getId() != null) {
for (LogType l : LogType.values()) { for (LogType l : LogType.values()) {
if (l.oldStatus.equals(oldStatus) && l.newStatus.equals(newStatus) &&l.businessType.equals(outPutTask.getBusinessType())) { if (l.oldStatus.equals(oldStatus) && l.newStatus.equals(newStatus) &&l.businessType.equals(outPutTask.getBusinessType())) {
...@@ -180,9 +185,14 @@ public class LogAspect { ...@@ -180,9 +185,14 @@ public class LogAspect {
// 将模板中的参数全部替换掉 // 将模板中的参数全部替换掉
opreation = this.replaceParam(opreation); opreation = this.replaceParam(opreation);
} }
if (this.opreation == null) { if (this.opreation == null) {
log.warn("[业务操作日志]存储失败:找不到业务类型为+"+outPutTask.getBusinessType()+",旧状态为" + this.oldStatus + ",新状态为" + this.newStatus + "的日志模板"); log.warn("[业务操作日志]存储失败:找不到业务类型为+"+outPutTask.getBusinessType()+",旧状态为" + this.oldStatus + ",新状态为" + this.newStatus + "的日志模板");
} else { }
// else if (!confirmUser(this.outPutTask)){
// log.info("当前任务不是当前登入用户的代办任务-任务id:{},用户id:{},指向下标{}",this.outPutTask.getId(),userUtils.getCurrentUserId(),this.outPutTask.getCurrentPoint());
// }
else {
TaskLogBto taskLogBto = new TaskLogBto(this.outPutTask.getId(), this.opreation, this.fileVos); TaskLogBto taskLogBto = new TaskLogBto(this.outPutTask.getId(), this.opreation, this.fileVos);
taskLogBto.setOldStatus(this.oldStatus); taskLogBto.setOldStatus(this.oldStatus);
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
...@@ -194,6 +204,34 @@ public class LogAspect { ...@@ -194,6 +204,34 @@ public class LogAspect {
} }
} }
// @Autowired
// private UserCache userCache;
//
// public boolean confirmUser(TaskBto taskBto){
// Integer userId = userUtils.getCurrentUserId();
// List<Integer> userIds = taskBto.getInvolveUserIdList();
// List<Integer> ids = new ArrayList<>();
// if (userIds.size() > 0 && taskBto.getCurrentPoint() < userIds.size()) {
// Integer userId3 = userIds.get(taskBto.getCurrentPoint());
// //当前指针userId大于0,待办人即当前id
// if (userId3 > 0) {
// ids.add(userId3);
// }
// //当前指针userId等于0,待办人为所属单位下所有用户
// else if (userId3 == 0 && taskBto.getOwnUnit() != null) {
// List<User> users = userCache.findAll();
// users.stream().filter(user -> user.getUnitsId().equals(taskBto.getOwnUnit())).forEach(user -> {
// ids.add(user.getUserId());
// });
// }
// }
// if (ids.contains(userId)){
// return true;
// }else {
// return false;
// }
// }
/** /**
* 将模板中的预留字段全部替换为拦截到的参数 * 将模板中的预留字段全部替换为拦截到的参数
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论