提交 ea1331d3 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备申请模块,装备配发模块.装备退回,装备维修,装备自查,装备使用报告): 新增单位id字段

新增单位id字段
上级 35dd4398
......@@ -15,6 +15,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -51,9 +52,17 @@ public class AllotBackBill {
@ApiModelProperty(value = "发件单位")
private String sendUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发送单位Id")
private Integer sendUnitId;
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "接受单位id")
private Integer receiveUnitId;
@ApiModelProperty(value = "发件签发人")
private String agent;
......
......@@ -15,6 +15,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -59,11 +60,19 @@ public class AllotBill {
*/
@ApiModelProperty(value = "配发单位")
private String sendUnit;
@NotNull(message = "sendUnitId不能为空")
@ApiModelProperty(value = "发送单位Id")
private Integer sendUnitId;
/**
* 收件单位
*/
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
@NotNull(message = "sendUnitId不能为空")
@ApiModelProperty(value = "接受单位id")
private Integer receiveUnitId;
/**
* 配发时间
*/
......
......@@ -39,13 +39,21 @@ public class AllotBillSaveVo {
private String replayNumber;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "配发单位")
@ApiModelProperty(value = "发送单位")
private String sendUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发送单位Id")
private Integer sendUnitId;
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "接收单位")
private String receiveUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "接受单位id")
private Integer receiveUnitId;
// @NotNull(message = "sendUserbId不能为空")
// @Min(value = 1,message = "sendUserbId不能小于1")
@ApiModelProperty(value = "发件方(B岗位)")
......
......@@ -177,21 +177,35 @@ public class DeviceApplyController {
userIds.add(userId);
userIds.add(deviceApplySaveVo.getReplyUseraId());
//DEVICE_APPLY_CONFIRM 装备申请待批复
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
// taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".",
// deviceApplyBillEntity.getId(), 9,
// userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1,
// null, userIds);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".",
deviceApplyBillEntity.getId(), 9, deviceApplySaveVo.getReplyUnitId(), 1,
null, userIds);
}
//不指定批复人
else {
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
userIds.add(0);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
// taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".",
// deviceApplyBillEntity.getId(), 9,
// userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".",
deviceApplyBillEntity.getId(), 9, deviceApplySaveVo.getReplyUnitId(), 1,
null, userIds);
}
}
TaskBto taskBto1 = taskService.start(taskBto);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userId);
if (userUtils.getCurrentUnitLevel()!=1) {
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(deviceApplyBillEntity.getReplyUnit())).stream()
// userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(deviceApplyBillEntity.getReplyUnit())).stream()
// .map(User::getUserId)
// .collect(Collectors.toList()));
userIds.addAll(userDao.findAllByUnitsId(deviceApplyBillEntity.getReplyUnitId()).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
}
......@@ -228,7 +242,10 @@ public class DeviceApplyController {
applyBillEntity.setReplyUseraId(userId);
//阅知用户Id
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream()
// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream()
// .map(User::getUserId)
// .collect(Collectors.toList()));
ids.addAll(userDao.findAllByUnitsId(applyBillEntity.getApplyUnitId()).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//如果修改了批复文号
......@@ -296,7 +313,7 @@ public class DeviceApplyController {
allotBillEntity.setSendUnit(deviceApplyBillEntity.getReplyUnit());
allotBillEntity.setReceiveUnit(deviceApplyBillEntity.getApplyUnit());
allotBillEntity.setSendTime(new Date());
allotBillEntity.setAllotType(2);//?????
allotBillEntity.setAllotType(2);
allotBillEntity.setAllotStatus(2); //配发中
//判断单据是否为空
if(deviceApplyAllotSaveVo.getScriptSaveVos()!=null) {
......@@ -326,12 +343,18 @@ public class DeviceApplyController {
taskBto.setBillId(allotBill.getId());
//配发业务移动到下一阶段 配发中
TaskBto taskBto1 = taskService.moveToSpecial(taskBto,StatusEnum.ALLOTING);
taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBill.getReceiveUnit()));
// taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBill.getReceiveUnit()));
taskBto1.setOwnUnit(allotBill.getReceiveUnitId());
Task saveEntity = taskService.update(taskBto1);
List<Integer> userIds2 = new ArrayList<>();
userIds2.add(userId);
userIds2.add(0);
TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发单据", saveEntity.getId(), saveEntity.getNodeIdDetail()+saveEntity.getId()+".", saveEntity.getBillId(), 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, userIds2);
// TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发单据", saveEntity.getId(),
// saveEntity.getNodeIdDetail()+saveEntity.getId()+".", saveEntity.getBillId(), 3,
// userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, userIds2);
TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发单据", saveEntity.getId(),
saveEntity.getNodeIdDetail()+saveEntity.getId()+".", saveEntity.getBillId(), 3,
allotBillEntity.getSendUnitId(), 0, null, userIds2);
taskService.start(taskBto2);
//添加业务日志
List<FileVo> fileVoList = new ArrayList<>();
......@@ -356,7 +379,10 @@ public class DeviceApplyController {
inputOutputDeviceService.addWhiteDevices(ids, userUtils.getCurrentUnitId(), 1);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userId);
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit())).stream()
// userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit())).stream()
// .map(User::getUserId)
// .collect(Collectors.toList()));
userIds.addAll(userDao.findAllByUnitsId(allotBillEntity.getReceiveUnitId()).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
if (deviceApplyAllotSaveVo.getSendUserbId()!=null) {
......@@ -456,6 +482,7 @@ public class DeviceApplyController {
//add
deviceApplyBill.setAgent(uploadApplyFile.getAgent());
deviceApplyBill.setReplyUnit(uploadApplyFile.getReplyUnit());
deviceApplyBill.setReplyUnitId(uploadApplyFile.getReplyUnitId());
deviceApplyBillService.update(deviceApplyBill);
}
else {
......@@ -521,6 +548,7 @@ public class DeviceApplyController {
//add
deviceApplyBill.setAgent(uploadApplyFile.getAgent());
deviceApplyBill.setReplyUnit(uploadApplyFile.getReplyUnit());
deviceApplyBill.setReplyUnitId(uploadApplyFile.getReplyUnitId());
DeviceApplyBill deviceApplyBill1 = deviceApplyBillService.update(deviceApplyBill);
if (deviceApplyBill.getApplyType() > 1) {
......
......@@ -60,11 +60,17 @@ public class DeviceApplyBill {
*/
@ApiModelProperty(value = "申请单位")
private String applyUnit;
@ApiModelProperty(value = "申请单位ID")
private Integer applyUnitId;
/**
* 批复单位
*/
@ApiModelProperty(value = "批复单位")
private String replyUnit;
@ApiModelProperty(value = "批复单位Id")
private Integer replyUnitId;
/**
* 经办人
*/
......
......@@ -38,10 +38,16 @@ public class DeviceApplySaveVo {
@ApiModelProperty(value = "申请单位")
private String applyUnit;
@ApiModelProperty(value = "申请单位id")
private Integer applyUnitId;
@NotNull(message = "replyUnit不能为空")
@ApiModelProperty(value = "批复单位")
private String replyUnit;
@ApiModelProperty(value = "批复单位")
private Integer replyUnitId;
@ApiModelProperty(value = "经办人")
private String agent;
......
......@@ -44,6 +44,9 @@ public class UploadApplyFile {
*/
@ApiModelProperty(value = "批复单位")
private String replyUnit;
@ApiModelProperty(value = "批复单位Id")
private Integer replyUnitId;
/**
* 经办人
*/
......
......@@ -346,7 +346,10 @@ public class RepairDetailServiceImpl implements RepairDetailService {
//过滤出装备在中办的
List<Units> superiorUnitsList = unitsService.findSuperiorUnitsList();
List<String> names = superiorUnitsList.stream().map(Units::getName).collect(Collectors.toList());
List<RepairDetail> exceptionList = repairDetails.stream().filter(repairDetail -> names.contains(repairDetail.getLocationUnit())).sorted(Comparator.comparing(RepairDetail::getCreateTime)).collect(Collectors.toList());
// List<RepairDetail> exceptionList = repairDetails.stream().filter(repairDetail -> names.contains(repairDetail.getLocationUnit())).sorted(Comparator.comparing(RepairDetail::getCreateTime)).collect(Collectors.toList());
List<RepairDetail> exceptionList = repairDetails.stream().filter(repairDetail ->
names.contains(unitsService.findById(repairDetail.getLocationUnitId()).getName()))
.sorted(Comparator.comparing(RepairDetail::getCreateTime)).collect(Collectors.toList());
repairDetails.removeAll(exceptionList);
//维修未入库 等待维修分为接收区装备和市发起维修
// List<RepairDetail> repairIngList = repairDetails.stream().filter(repairDetail -> Objects.equals(repairDetail.getRepairStatus(), RepairStatusEnum.WAIT_REPAIR.id)).sorted(Comparator.comparing(RepairDetail::getCreateTime)).collect(Collectors.toList());
......
......@@ -59,11 +59,17 @@ public class RepairBackBill {
*/
@ApiModelProperty(value = "发件单位")
private String sendUnit;
@ApiModelProperty(value = "发件单位Id")
private Integer sendUnitId;
/**
* 收件单位
*/
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
@ApiModelProperty(value = "收件单位Id")
private Integer receiveUnitId;
/**
* 配发时间
*/
......
......@@ -49,11 +49,17 @@ public class RepairBill {
*/
@ApiModelProperty(value = "申请单位")
private String sendUnit;
@ApiModelProperty(value = "申请单位Id")
private Integer sendUnitId;
/**
* 维修单位
*/
@ApiModelProperty(value = "维修单位")
private String receiveUnit;
@ApiModelProperty(value = "维修单位Id")
private Integer receiveUnitId;
/**
* 维修状态
*/
......
......@@ -82,11 +82,17 @@ public class RepairDetail {
*/
@ApiModelProperty(value = "所在单位")
private String locationUnit;
@ApiModelProperty(value = "所在单位Id")
private Integer locationUnitId;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
@ApiModelProperty(value = "所属单位Id")
private Integer ownUnitId;
/**
* 维修状态
*/
......
......@@ -59,11 +59,17 @@ public class RepairSendBill {
*/
@ApiModelProperty(value = "发件单位")
private String sendUnit;
@ApiModelProperty(value = "发件单位Id")
private Integer sendUnitId;
/**
* 收件单位
*/
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
@ApiModelProperty(value = "收件单位Id")
private Integer receiveUnitId;
/**
* 配发时间
*/
......
......@@ -36,10 +36,16 @@ public class RepairBackBillSaveVo {
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "接收单位", example = "市机要局")
private String receiveUnit;
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "接收单位Id", example = "市机要局")
private Integer receiveUnitId;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发起单位", example = "市机要局")
private String sendUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发起单位Id", example = "市机要局")
private Integer sendUnitId;
// @NotNull(message = "receiveUseraId不能为空")
// @Min(value = 1,message = "receiveUseraId不能小于1")
......
......@@ -33,10 +33,18 @@ public class RepairBillSaveVo {
@ApiModelProperty(value = "维修单位", example = "市机要局")
private String receiveUnit;
@NotNull(message = "receiveUnitId不能为空")
@ApiModelProperty(value = "维修单位Id", example = "市机要局")
private Integer receiveUnitId;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发起单位", example = "市机要局")
private String sendUnit;
@NotNull(message = "sendUnitId不能为空")
@ApiModelProperty(value = "发起单位Id", example = "市机要局")
private Integer sendUnitId;
@ApiModelProperty(value = "维修经手人", example = "1")
private Integer repairUseraId;
......
......@@ -101,6 +101,7 @@ public class SelfCheckSchedulerTask {
SelfCheckBill selfCheckBill = new SelfCheckBill();
selfCheckBill.setCheckStatus(3);
selfCheckBill.setCheckUnit(units.getName());
selfCheckBill.setCheckUnitId(units.getUnitId());
StringBuffer title = new StringBuffer();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
......
......@@ -288,6 +288,7 @@ public class SelfCheckController {
SelfCheckBill selfCheckBill = new SelfCheckBill();
selfCheckBill.setCheckStatus(3);
selfCheckBill.setCheckUnit(unitName);
selfCheckBill.setCheckUnitId(userUtils.getCurrentUnitId());
selfCheckBill.setTitle(unitName + "发起的"+message2+"自查任务");
SelfCheckBill selfCheckBill1 = selfExaminationBillService.addEntity(selfCheckBill);
//发起待自查任务
......@@ -326,6 +327,7 @@ public class SelfCheckController {
selfExaminationBillEntity = selfCheckSaveVo.toDo();
selfExaminationBillEntity.setTitle(userUtils.getCurrentUserUnitName() + "发起的自查任务");
selfExaminationBillEntity.setCheckUnit(userUtils.getCurrentUserUnitName());
selfExaminationBillEntity.setCheckUnitId(userUtils.getCurrentUnitId());
}
selfExaminationBillEntity.setUseraId(userUtils.getCurrentUserId());
selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId());
......@@ -466,14 +468,21 @@ public class SelfCheckController {
}
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), content, idList, 0);
messageService.add(messageBto);
//优化日志
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"上传自查单",null,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"上传自查单",null,userId,taskBto.getId());
deviceLogService.addLog(deviceLogDto);
// deviceLogService.addLog(deviceLogDto);
deviceLogDtos.add(deviceLogDto);
}
}
//使用异步
executor.execute(()->{
deviceLogService.addAllLog(deviceLogDtos);
});
log.info("[自查模块]:审核通过自查完成");
myWebSocket.sendMessage1();
return ResultUtil.success("审核通过自查完成");
......@@ -630,6 +639,7 @@ public class SelfCheckController {
SelfCheckBill selfCheckBill = new SelfCheckBill();
selfCheckBill.setCheckStatus(3);
selfCheckBill.setCheckUnit(units.getName());
selfCheckBill.setCheckUnitId(units.getUnitId());
StringBuffer title = new StringBuffer();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
......
......@@ -67,6 +67,9 @@ public class SelfCheckBill {
*/
@ApiModelProperty(value = "自查单位")
private String checkUnit;
@ApiModelProperty(value = "自查单位Id")
private Integer checkUnitId;
/**
* 应查数量
*/
......
......@@ -21,7 +21,12 @@ public class CacheConfig {
@Bean
public StatisticalCache initStatisticalCache() throws ParseException {
return new StatisticalCache(statisticalService.getDeviceNum(),statisticalService.getLifeStatus(1),statisticalService.getLifeStatus(2),statisticalService.getSelfCheck(),statisticalService.getYearSelfCheck(),statisticalService.getRfidWarning(),statisticalService.getRfidWarningDetail(1),statisticalService.getRfidWarningDetail(2),statisticalService.getCheckNum(),statisticalService.getConfirmCheck(1),statisticalService.getConfirmCheck(2),statisticalService.getUserGeneralSituation(),statisticalService.getSelfCheckStat());
return new StatisticalCache(statisticalService.getDeviceNum(),statisticalService.getLifeStatus(1),
statisticalService.getLifeStatus(2),statisticalService.getSelfCheck(),statisticalService.getYearSelfCheck(),
statisticalService.getRfidWarning(),statisticalService.getRfidWarningDetail(1),
statisticalService.getRfidWarningDetail(2),statisticalService.getCheckNum(),
statisticalService.getConfirmCheck(1),statisticalService.getConfirmCheck(2),
statisticalService.getUserGeneralSituation(),statisticalService.getSelfCheckStat());
}
}
......@@ -22,6 +22,7 @@ import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.Area;
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.UnitsService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.StringSplitUtil;
......@@ -81,6 +82,9 @@ public class BigScreenServiceImpl implements BigScreenService {
@Autowired
private DeviceLibraryCacheService deviceLibraryCacheService;
@Autowired
private UnitsService unitsService;
/**
* 获取省及各市装备统计信息
*/
......@@ -306,8 +310,12 @@ public class BigScreenServiceImpl implements BigScreenService {
//获取市单位名称
String unitName = units.get(0).getName();
//筛选出当前单位已完成的自查和核查账单,按更新时间排序
// List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream()
// .filter(selfCheckBill -> selfCheckBill.getCheckUnit().equals(unitName))
// .sorted(Comparator.comparing(SelfCheckBill::getUpdateTime,Comparator.nullsLast(Date::compareTo)).reversed())
// .collect(Collectors.toList());
List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream()
.filter(selfCheckBill -> selfCheckBill.getCheckUnit().equals(unitName))
.filter(selfCheckBill -> unitsService.findById(selfCheckBill.getCheckUnitId()).getName().equals(unitName))
.sorted(Comparator.comparing(SelfCheckBill::getUpdateTime,Comparator.nullsLast(Date::compareTo)).reversed())
.collect(Collectors.toList());
if (!selfCheckBillList.isEmpty()) {
......
......@@ -29,6 +29,7 @@ import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.Area;
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.UnitsService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.rfid.entity.domin.LibraryWarningLog;
......@@ -104,6 +105,9 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired
private DeviceLibraryCacheService deviceLibraryCacheService;
@Autowired
private UnitsService unitsService;
/**
* 获取装备统计信息
*/
......@@ -244,7 +248,12 @@ public class StatisticalServiceImpl implements StatisticalService {
//获取最近一次自查标题
List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream().filter(selfCheckBill -> selfCheckBill.getCycle()!=null).sorted(Comparator.comparing(SelfCheckBill::getCreateTime,Comparator.nullsLast(Date::compareTo).reversed())).collect(Collectors.toList());
if (selfCheckBillList.size()>0){
Map<String,Integer> selfCheckBillMap = selfCheckBills.stream().filter(selfCheckBill ->selfCheckBill.getCycle()!=null && selfCheckBill.getTitle().equals(selfCheckBillList.get(0).getTitle())).collect(Collectors.toMap(SelfCheckBill::getCheckUnit,SelfCheckBill::getCheckStatus,(v1, v2)->v1));
// Map<String,Integer> selfCheckBillMap = selfCheckBills.stream().filter(selfCheckBill ->selfCheckBill.getCycle()!=null && selfCheckBill.getTitle().equals(selfCheckBillList.get(0).getTitle())).collect(Collectors.toMap(SelfCheckBill::getCheckUnit,SelfCheckBill::getCheckStatus,(v1, v2)->v1));
Map<String,Integer> selfCheckBillMap = selfCheckBills.stream().filter(selfCheckBill ->selfCheckBill.getCycle()!=null
&& selfCheckBill.getTitle().equals(selfCheckBillList.get(0).getTitle()))
.collect(Collectors.toMap(selfCheckBill ->
unitsService.findById(selfCheckBill.getCheckUnitId()).getName()
,SelfCheckBill::getCheckStatus,(v1, v2)->v1));
//获取所有市
List<Area> areas = areaDao.findAreasByType(2);
//遍历每个市
......@@ -545,12 +554,22 @@ public class StatisticalServiceImpl implements StatisticalService {
//获取市单位名称
String unitName = units.get(0).getName();
//筛选出当前单位已完成的自查和核查账单,按更新时间排序
// List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream()
// .filter(selfCheckBill -> selfCheckBill.getCheckUnit().equals(unitName) && selfCheckBill.getCheckedCount() != null)
// .sorted(Comparator.nullsLast(Comparator.comparing(SelfCheckBill::getUpdateTime).reversed()))
// .collect(Collectors.toList());
List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream()
.filter(selfCheckBill -> selfCheckBill.getCheckUnit().equals(unitName) && selfCheckBill.getCheckedCount() != null)
.filter(selfCheckBill -> unitsService.findById(selfCheckBill.getCheckUnitId()).getName().equals(unitName)
&& selfCheckBill.getCheckedCount() != null)
.sorted(Comparator.nullsLast(Comparator.comparing(SelfCheckBill::getUpdateTime).reversed()))
.collect(Collectors.toList());
// List<DeviceCheckDetail> deviceCheckDetailList = deviceCheckDetails.stream()
// .filter(deviceCheckDetail -> deviceCheckDetail.getCheckUnit().equals(unitName) && deviceCheckDetail.getCheckedCount() != null)
// .sorted(Comparator.nullsLast(Comparator.comparing(DeviceCheckDetail::getUpdateTime).reversed()))
// .collect(Collectors.toList());
List<DeviceCheckDetail> deviceCheckDetailList = deviceCheckDetails.stream()
.filter(deviceCheckDetail -> deviceCheckDetail.getCheckUnit().equals(unitName) && deviceCheckDetail.getCheckedCount() != null)
.filter(deviceCheckDetail -> unitsService.findById(deviceCheckDetail.getCheckUnitId()).getName().equals(unitName)
&& deviceCheckDetail.getCheckedCount() != null)
.sorted(Comparator.nullsLast(Comparator.comparing(DeviceCheckDetail::getUpdateTime).reversed()))
.collect(Collectors.toList());
if (!selfCheckBillList.isEmpty()) {
......@@ -687,8 +706,12 @@ public class StatisticalServiceImpl implements StatisticalService {
List<Units> units = unitsDao.findAllByAreaId(area.getId());
if (units.size()==1){
//筛选出标题包含当前年份季度的
// List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream()
// .filter(selfCheckBill -> selfCheckBill.getTitle().contains(quarter)&&selfCheckBill.getCheckUnit().equals(units.get(0).getName()))
// .collect(Collectors.toList());
List<SelfCheckBill> selfCheckBillList = selfCheckBills.stream()
.filter(selfCheckBill -> selfCheckBill.getTitle().contains(quarter)&&selfCheckBill.getCheckUnit().equals(units.get(0).getName()))
.filter(selfCheckBill -> selfCheckBill.getTitle().contains(quarter)&&
unitsService.findById(selfCheckBill.getCheckUnitId()).getName().equals(units.get(0).getName()))
.collect(Collectors.toList());
if(selfCheckBillList.size()==1){
SelfCheckBill selfCheckBill = selfCheckBillList.get(0);
......
package com.tykj.dev.union;
import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.repair.repository.RepairBackBillDao;
import com.tykj.dev.device.repair.repository.RepairBillDao;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Slf4j
@Component
public class DataInit implements CommandLineRunner {
@Resource
private UnitsDao unitsDao;
@Autowired
private AllotBillDao allotBillDao;
@Autowired
private AllotBackBillDao allotBackBillDao;
@Autowired
private RepairBackBillDao repairBackBillDao;
@Autowired
private RepairDetailDao repairDetailDao;
@Autowired
private RepairSendBillDao repairSendBillDao;
@Autowired
private RepairBillDao repairBillDao;
@Autowired
private SelfCheckBillDao selfCheckBillDao;
@Autowired
private DeviceUseReportDao deviceUseReportDao;
private void initCheckDetailUnitName() {
// 对现有的数据补充unitId信息
allotBillDao.findAll().forEach(this::saveModifyDetail1);
allotBackBillDao.findAll().forEach(this::saveModifyDetail2);
selfCheckBillDao.findAll().forEach(this::saveModifyDetail3);
repairBillDao.findAll().forEach(this::saveModifyDetail4);
repairSendBillDao.findAll().forEach(this::saveModifyDetail5);
repairDetailDao.findAll().forEach(this::saveModifyDetail6);
repairBackBillDao.findAll().forEach(this::saveModifyDetail7);
deviceUseReportDao.findAll().forEach(this::saveModifyDetail8);
}
private void saveModifyDetail1(AllotBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
allotBillDao.save(allotBill);
}
}
private void saveModifyDetail2(AllotBackBill allotBackBill) {
String receiveUnit = allotBackBill.getReceiveUnit();
String sendUnit = allotBackBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBackBill.setReceiveUnitId(receiveUnitId);
allotBackBill.setSendUnitId(sendUnitId);
log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
allotBackBillDao.save(allotBackBill);
}
}
private void saveModifyDetail3(SelfCheckBill selfCheckBill) {
String receiveUnit = selfCheckBill.getCheckUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
if (receiveUnitId != -1) {
selfCheckBill.setCheckUnitId(receiveUnitId);
log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}",
receiveUnit,receiveUnitId);
selfCheckBillDao.save(selfCheckBill);
}
}
private void saveModifyDetail4(RepairBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairBillDao.save(allotBill);
}
}
private void saveModifyDetail5(RepairSendBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairSendBillDao.save(allotBill);
}
}
private void saveModifyDetail6(RepairDetail allotBill) {
String receiveUnit = allotBill.getLocationUnit();
String sendUnit = allotBill.getOwnUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setLocationUnitId(receiveUnitId);
allotBill.setOwnUnitId(sendUnitId);
log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairDetailDao.save(allotBill);
}
}
private void saveModifyDetail7(RepairBackBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairBackBillDao.save(allotBill);
}
}
private void saveModifyDetail8(DeviceUseReport allotBill) {
String receiveUnit = allotBill.getUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
if (receiveUnitId != -1 ) {
allotBill.setUnitId(receiveUnitId);
log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}",
receiveUnit,receiveUnitId);
deviceUseReportDao.save(allotBill);
}
}
private Integer getUnitId(String unitName) {
List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList());
return units.size() == 1 ? units.get(0).getUnitId() : -1;
}
@Override
public void run(String... args) throws Exception {
log.info("单位名称初始化-----");
initCheckDetailUnitName();
}
}
......@@ -50,5 +50,4 @@ public interface UserPublicService {
String getAreaNameByUnitName(String unitName);
}
......@@ -124,6 +124,7 @@ public class UserPublicServiceImpl implements UserPublicService {
}
}
@Override
public String findUnitsNameByUserId(Integer userId) {
User resultEntity = userCache.findById(userId);
......
......@@ -102,7 +102,8 @@ public class DeviceUseReportController {
DeviceUseReportDetailVo deviceUseReportDetailVo = (DeviceUseReportDetailVo) resultObj.getData();
//新建word模板
WrodParameter wrodParameter = deviceUseReportDetailVo.toWrodParameter();
Units units= unitsService.findbyName(deviceUseReportDetailVo.getUnit());
// Units units= unitsService.findbyName(deviceUseReportDetailVo.getUnit());
Units units= unitsService.findById(deviceUseReportDetailVo.getUnitId());
Instant instant = deviceUseReportDetailVo.getCreateTime().toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
......
......@@ -45,6 +45,8 @@ public class DeviceUseReport {
*/
@ApiModelProperty(value = "报告所属单位")
private String unit;
@ApiModelProperty(value = "报告所属单位Id")
private Integer unitId;
/**
* 报告详情(入库数x退回数x退装数x维修数x销毁数x配发数x列装数)
......
......@@ -19,6 +19,8 @@ public class DeviceUseReportDetailVo {
private String title;
@ApiModelProperty(value = "所属单位", example = "省机要局")
private String unit;
@ApiModelProperty(value = "所属单位id", example = "省机要局")
private Integer unitId;
@ApiModelProperty(value = "装备类型总数", example = "100")
private Integer deviceNumber;
@ApiModelProperty(value = "入库数量", example = "10")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论