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

提交代码

上级 99bb2aad
......@@ -23,8 +23,6 @@ public interface FinalCheckService {
*/
FinalReportVo generateReport(LocalDate startTime, LocalDate endTime);
FinalReportVo generateReport1(LocalDate startTime, LocalDate endTime);
/**
* 根据关键字查询报告列表(不附带detail)
* @return {@link FinalReportVo} 's List
......
package com.tykj.dev.device.finalcheck.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
......@@ -35,8 +36,10 @@ import com.tykj.dev.misc.utils.StringSplitUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
//import sun.text.normalizer.UBiDiProps;
import java.time.LocalDate;
import java.time.LocalDateTime;
......@@ -72,26 +75,26 @@ public class FinalCheckServiceImpl implements FinalCheckService {
@Autowired
private UserUtils userService;
@Autowired
private ScrapBillDao scrapBillDao;
@Autowired
private DeviceDestroyBillDao deviceDestroyBillDao;
@Autowired
private UnitsDao unitsDao;
@Autowired
private RepairSendBillDao repairSendBillDao;
@Autowired
private RepairBackBillDao repairBackBillDao;
@Autowired
private AllotBillDao allotBillDao;
@Autowired
private DeviceLibraryService deviceLibraryService;
// @Autowired
// private ScrapBillDao scrapBillDao;
//
// @Autowired
// private DeviceDestroyBillDao deviceDestroyBillDao;
//
// @Autowired
// private UnitsDao unitsDao;
//
// @Autowired
// private RepairSendBillDao repairSendBillDao;
//
// @Autowired
// private RepairBackBillDao repairBackBillDao;
//
// @Autowired
// private AllotBillDao allotBillDao;
//
// @Autowired
// private DeviceLibraryService deviceLibraryService;
@Override
public FinalReportVo generateReport(LocalDate startTime, LocalDate endTime) {
......@@ -101,12 +104,17 @@ public class FinalCheckServiceImpl implements FinalCheckService {
FinalReport report = new FinalReport(name, unitName, startTime, endTime, LocalDateTime.now(), operatorName);
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
Map<String, List<DeviceLibrary>> map = devices.stream()
.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
// Units units = unitsDao.findByName(unitName);
......@@ -178,46 +186,6 @@ public class FinalCheckServiceImpl implements FinalCheckService {
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
public Page<FinalReportVo> findAllWithoutDetail(FinalReportSelectVo finalReportSelectVo) {
......
......@@ -92,6 +92,31 @@ public class TaskController {
map.put("businessTypes",businessType.stream().map(integer -> new BusinessTypeVo(integer,businessMap.get(integer))).collect(Collectors.toList()));
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 = "可以通过这个接口查询业务")
......@@ -313,9 +338,18 @@ public class TaskController {
Integer businessType = taskBusinessTypeVo.getBusinessType();
Integer taskId = taskBusinessTypeVo.getTaskId();
// Integer parentTaskId = taskService.get(taskId).getParentTaskId();
//当前状态
Integer billStatus = taskService.get(taskId).getBillStatus();
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){
case 3 :
return ResponseEntity.ok(allot(taskLogUserVos,billStatus));
......@@ -389,7 +423,11 @@ public class TaskController {
}
} else {
//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 {
}
}
}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 {
if (billStatus == 788 && taskLogUserVo.getOldStatus() == 790){
map.clear();
}else {
map.put("790",taskLogUserVo.getUser());
}
}
}
}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 {
}
}
}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 {
*/
List<TaskUserVo> getManageList(TaskSelectVo taskSelectVo);
List<TaskUserVo> getManageList1(TaskSelectVo taskSelectVo);
/**
* @param taskBto 任务bto
* @param userId 新增涉及用户id
......
......@@ -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.train.dao.TrainThemeDao;
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.misc.base.BeanHelper;
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.rfid.service.RfidChangeBillService;
import lombok.extern.slf4j.Slf4j;
......@@ -46,6 +49,7 @@ import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
......@@ -157,6 +161,7 @@ public class LogAspect {
this.outPutTask = (TaskBto) returnValue;
this.businessType = this.outPutTask.getBusinessType();
this.newStatus = this.outPutTask.getBillStatus();
if (this.inputTask.getId() != null) {
for (LogType l : LogType.values()) {
if (l.oldStatus.equals(oldStatus) && l.newStatus.equals(newStatus) &&l.businessType.equals(outPutTask.getBusinessType())) {
......@@ -180,9 +185,14 @@ public class LogAspect {
// 将模板中的参数全部替换掉
opreation = this.replaceParam(opreation);
}
if (this.opreation == null) {
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.setOldStatus(this.oldStatus);
taskLogService.addLog(taskLogBto);
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论