提交 a915d304 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 b31093a0
......@@ -389,22 +389,20 @@ public class DeviceLibraryController {
}
deviceLogUserVos.addAll(deviceLogEntities);
libraryEntities.add(deviceLibraryEntity);
deviceDetailVo.setDeviceLogEntityList(deviceLogUserVos.stream().sorted(Comparator.comparing(DeviceLogUserVo::getCreateTime).reversed()).collect(Collectors.toList()));
if (deviceLibraryEntity.getIsPart() == 0) {
List<DeviceLibrary> partList = deviceLibraryDao.getAllByPartParentIdAndIsPart(id, 1);
partList.forEach(DeviceLibrary::setConfigName);
libraryEntities.addAll(partList);
deviceDetailVo.setDeviceList(libraryEntities);
deviceDetailVo.setDeviceLogEntityList(deviceLogUserVos);
return ResultUtil.success(deviceDetailVo);
} else {
if (deviceLibraryEntity.getPartParentId() == null) {
deviceDetailVo.setDeviceList(libraryEntities);
deviceDetailVo.setDeviceLogEntityList(deviceLogEntities);
return ResultUtil.success(deviceDetailVo);
}
libraryEntities.add(deviceLibraryService.getOne(deviceLibraryEntity.getPartParentId()).setConfigName());
deviceDetailVo.setDeviceList(libraryEntities);
deviceDetailVo.setDeviceLogEntityList(deviceLogUserVos);
return ResultUtil.success(deviceDetailVo);
}
}
......
......@@ -182,6 +182,8 @@ public class StorageBillController {
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(), s.getStorageCount());
List<List<String>> sons = new ArrayList<>();
List<List<String>> sons2 = new ArrayList<>();
List<List<String>> sons3 = new ArrayList<>();
List<List<String>> sons4 = new ArrayList<>();
int count = 1;
Integer deviceNum = s.getStorageCount();
while (deviceNum >= count) {
......@@ -257,62 +259,62 @@ public class StorageBillController {
}
map.put(s2.getPackingId(), packingLibraries);
}
// if (s2.getList() != null && s2.getList().size() != 0) {
// for (int k = 0; k < s2.getList().size(); k++) {
// StorageBillDetailVo s3 = s.getList().get(k);
// if (k >= sons.size()) {
// sons.add(DeviceSeqUtil.createDeviceSeqs(s3.getSeqInterval(), s3.getStorageCount()));
// sons2.add(DeviceSeqUtil.createDeviceSeqs(s3.getProdInterval(), s3.getStorageCount()));
// }
// packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
// List<String> strings4 = sons.get(k);
// List<String> strings5 = sons2.get(k);
// if (s3.getStorageCount() >= count) {
// packingLibraryEntity.setCorresponding(count);
// if (!strings4.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings4.get(0) + "已存在");
// }
// if (seqs.contains(strings4.get(0))){
// throw new ApiException("序列号" + strings4.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings4.get(0));
// strings4.remove(0);
// }
// if (!strings5.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings5.get(0));
// strings5.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// libraryEntities.add(packingLibraryEntity);
// }
// if (s3.getStorageCount() - strings4.size() == deviceNum) {
// List<PackingLibrary> packingLibraries = new ArrayList<>();
// for (int i = 0; i < s3.getStorageCount() - deviceNum; i++) {
// packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
// packingLibraryEntity.setCorresponding(0);
// if (!strings4.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings4.get(0) + "已存在");
// }
// if (seqs.contains(strings4.get(0))){
// throw new ApiException("序列号" + strings4.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings4.get(0));
// strings4.remove(0);
// }
// if (!strings5.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings5.get(0));
// strings5.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// packingLibraries.add(packingLibraryEntity);
// }
// map.put(s3.getPackingId(), packingLibraries);
// }
// }
//
// }
if (s2.getList() != null && s2.getList().size() != 0) {
for (int k = 0; k < s2.getList().size(); k++) {
StorageBillDetailVo s3 = s2.getList().get(k);
if (k >= sons3.size()) {
sons3.add(DeviceSeqUtil.createDeviceSeqs(s3.getSeqInterval(), s3.getStorageCount()));
sons4.add(DeviceSeqUtil.createDeviceSeqs(s3.getProdInterval(), s3.getStorageCount()));
}
packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
List<String> strings4 = sons3.get(k);
List<String> strings5 = sons4.get(k);
if (s3.getStorageCount() >= count) {
packingLibraryEntity.setCorresponding(count);
if (!strings4.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
throw new ApiException("序列号" + strings4.get(0) + "已存在");
}
if (seqs.contains(strings4.get(0))){
throw new ApiException("序列号" + strings4.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings4.get(0));
strings4.remove(0);
}
if (!strings5.isEmpty()) {
packingLibraryEntity.setProdNumber(strings5.get(0));
strings5.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
libraryEntities.add(packingLibraryEntity);
}
if (s3.getStorageCount() - strings4.size() == deviceNum) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
for (int i = 0; i < s3.getStorageCount() - deviceNum; i++) {
packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
packingLibraryEntity.setCorresponding(0);
if (!strings4.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
throw new ApiException("序列号" + strings4.get(0) + "已存在");
}
if (seqs.contains(strings4.get(0))){
throw new ApiException("序列号" + strings4.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings4.get(0));
strings4.remove(0);
}
if (!strings5.isEmpty()) {
packingLibraryEntity.setProdNumber(strings5.get(0));
strings5.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
packingLibraries.add(packingLibraryEntity);
}
map.put(s3.getPackingId(), packingLibraries);
}
}
}
}
}
......@@ -410,6 +412,7 @@ public class StorageBillController {
if (deviceLibraryEntity.getIsPart() == 1) {
deviceLibraryEntity.setPartParentId(parentId);
saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
parentId = saveEntity.getId();
}
}
//如果是单独的配件,不用设置父装备id
......
......@@ -9,10 +9,14 @@ 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.*;
import com.tykj.dev.device.task.utils.TaskUtils;
import com.tykj.dev.device.user.subject.dao.UserRecordDao;
import com.tykj.dev.device.user.subject.entity.UserRecord;
import com.tykj.dev.device.user.subject.service.UserRecordService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -49,6 +53,12 @@ public class TaskController {
@Autowired
private TaskDao taskDao;
@Autowired
private UserRecordService userRecordService;
@Autowired
private UserRecordDao userRecordDao;
@ApiOperation(value = "业务分页查询", notes = "可以通过这个接口分页查询业务")
@RequestMapping(method = RequestMethod.POST, value = "/manage/summary", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getTaskPage(@RequestBody TaskSelectVo taskSelectVo) {
......@@ -75,10 +85,85 @@ public class TaskController {
return ResultUtil.success(map);
}
@ApiOperation(value = "新增待办列表查询", notes = "可以通过这个接口查询业务")
@RequestMapping(method = RequestMethod.POST, value = "/getNewTaskList", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getNewTaskList(@RequestBody TaskSelectVo taskSelectVo) {
Integer userId = userUtils.getCurrentUserId();
UserRecord userRecord = userRecordDao.findByUserId(userId);
if (userRecord==null){
return ResponseEntity.ok(Collections.EMPTY_LIST);
}
else {
List<Integer> newTaskIds;
if (taskSelectVo.getType()==1) {
newTaskIds = StringSplitUtil.userIdSplit(userRecord.getNewTaskIds());
}
else {
newTaskIds = StringSplitUtil.userIdSplit(userRecord.getNewCountryTaskIds());
}
taskSelectVo.setSelectNum(2);
List<TaskUserVo> taskUserVos = taskService.getList(taskSelectVo).stream().filter(taskUserVo -> newTaskIds.contains(taskUserVo.getId())).collect(Collectors.toList());
return ResponseEntity.ok(taskUtils.orderByTrackingTimeDateDesc(taskUserVos));
}
}
@ApiOperation(value = "业务跟踪待办列表查询", notes = "可以通过这个接口查询业务")
@RequestMapping(method = RequestMethod.POST, value = "/getTaskList", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getTaskList(@RequestBody TaskSelectVo taskSelectVo) {
Boolean hasCondition = taskSelectVo.getContent()!=null||taskSelectVo.getStartTime()!=null||taskSelectVo.getEndTime()!=null||
(taskSelectVo.getBusinessType()!=null&&taskSelectVo.getBusinessType().size()>0)||taskSelectVo.getBillStatus()!=null||
(taskSelectVo.getRemark()!=null&&taskSelectVo.getRemark().size()>0)||taskSelectVo.getTitleDim()!=null||
taskSelectVo.getStatusDim()!=null||taskSelectVo.getCreateUserDim()!=null||taskSelectVo.getProcessingUserDim()!=null;
Integer userId = userUtils.getCurrentUserId();
List<TaskUserVo> taskUserVos = taskService.getList(taskSelectVo);
if (!hasCondition){
List<Integer> taskIds = taskUserVos.stream().map(TaskUserVo::getId).collect(Collectors.toList());
if (taskSelectVo.getSelectNum()==2) {
if (taskSelectVo.getType() == 1) {
if (userRecordDao.findByUserId(userId) == null) {
UserRecord userRecord = new UserRecord();
userRecord.setUserId(userId);
userRecord.setTaskIds(StringSplitUtil.idListToString(taskIds));
userRecord.setNewTaskIds(userRecord.getTaskIds());
userRecordService.save(userRecord);
} else {
UserRecord userRecord = userRecordDao.findByUserId(userId);
if (userRecord.getTaskIds() == null) {
userRecord.setTaskIds(StringSplitUtil.idListToString(taskIds));
userRecord.setNewTaskIds(userRecord.getTaskIds());
userRecordService.save(userRecord);
} else {
List<Integer> ids = StringSplitUtil.userIdSplit(userRecord.getTaskIds());
userRecord.setTaskIds(StringSplitUtil.idListToString(taskIds));
taskIds.removeAll(ids);
userRecord.setNewTaskIds(StringSplitUtil.idListToString(taskIds));
userRecordService.save(userRecord);
}
}
} else {
if (userRecordDao.findByUserId(userId) == null) {
UserRecord userRecord = new UserRecord();
userRecord.setUserId(userId);
userRecord.setCountryTaskIds(StringSplitUtil.idListToString(taskIds));
userRecord.setNewCountryTaskIds(userRecord.getCountryTaskIds());
userRecordService.save(userRecord);
} else {
UserRecord userRecord = userRecordDao.findByUserId(userId);
if (userRecord.getCountryTaskIds() == null) {
userRecord.setCountryTaskIds(StringSplitUtil.idListToString(taskIds));
userRecord.setNewCountryTaskIds(userRecord.getCountryTaskIds());
userRecordService.save(userRecord);
} else {
List<Integer> ids = StringSplitUtil.userIdSplit(userRecord.getCountryTaskIds());
userRecord.setCountryTaskIds(StringSplitUtil.idListToString(taskIds));
taskIds.removeAll(ids);
userRecordService.save(userRecord);
}
}
}
}
}
return ResultUtil.success(taskUtils.orderByTopDescAndReadAsc(taskUserVos));
}
......
......@@ -43,5 +43,4 @@ public class TaskSelectVo extends CustomPage {
@ApiModelProperty(value = "待办人模糊查询字段")
private String processingUserDim;
}
......@@ -48,6 +48,12 @@ public class MessageController {
return ResponseEntity.ok(messageService.getList());
}
@ApiOperation(value = "新增阅知信息查询")
@GetMapping("/getNew")
public ResponseEntity getNewMessage(){
return ResponseEntity.ok(messageService.getNewList());
}
@ApiOperation(value = "所有阅知信息查询")
@PostMapping("/get/all")
public ResponseEntity getAllMessage(@RequestBody MessageSelectVo messageSelectVo){
......
......@@ -24,6 +24,8 @@ public interface MessageService {
List<MessageUserVo> getList();
List<MessageUserVo> getNewList();
List<MessageUserVo> getAllList(MessageSelectVo messageSelectVo);
List<MessageBto> getBtoList();
......
......@@ -9,17 +9,18 @@ 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.domin.Message;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
import com.tykj.dev.device.user.subject.dao.UserRecordDao;
import com.tykj.dev.device.user.subject.entity.UserRecord;
import com.tykj.dev.device.user.subject.service.UserRecordService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
......@@ -38,6 +39,12 @@ public class MessageServiceImpl implements MessageService {
@Autowired
BlockChainUtil blockChainUtil;
@Autowired
UserRecordDao userRecordDao;
@Autowired
UserRecordService userRecordService;
@Override
public void add(MessageBto messageBto) {
Message message = messageDao.save(messageBto.toDo());
......@@ -83,12 +90,55 @@ public class MessageServiceImpl implements MessageService {
@Override
public List<MessageUserVo> getList() {
Integer userId = userUtils.getCurrentUserId();
return messageDao.findAll().stream()
List<MessageUserVo> messageUserVos = messageDao.findAll().stream()
.map(Message::parse2Bto)
.filter(messageBto -> messageBto.getInvolveUserIdList().contains(userId)&&!messageBto.getCompleteUserIdList().contains(userId))
.map(MessageBto::toVo)
.sorted(Comparator.comparing(MessageUserVo::getCreateTime,Comparator.nullsLast(Date::compareTo)).reversed())
.collect(Collectors.toList());
List<Integer> ids = messageUserVos.stream().map(MessageUserVo::getId).collect(Collectors.toList());
UserRecord userRecord = userRecordDao.findByUserId(userId);
if (userRecord==null){
UserRecord userRecord2 = new UserRecord();
userRecord2.setUserId(userId);
userRecord2.setReadIds(StringSplitUtil.idListToString(ids));
userRecord2.setNewReadIds(userRecord2.getReadIds());
userRecordService.save(userRecord2);
}
else {
if (userRecord.getReadIds() == null) {
userRecord.setReadIds(StringSplitUtil.idListToString(ids));
userRecord.setNewReadIds(userRecord.getReadIds());
userRecordService.save(userRecord);
} else {
List<Integer> integerList = StringSplitUtil.userIdSplit(userRecord.getReadIds());
userRecord.setReadIds(StringSplitUtil.idListToString(ids));
ids.removeAll(integerList);
userRecord.setNewReadIds(StringSplitUtil.idListToString(ids));
userRecordService.save(userRecord);
}
}
return messageUserVos;
}
@Override
public List<MessageUserVo> getNewList() {
List<MessageUserVo> messageUserVos = new ArrayList<>();
Integer userId = userUtils.getCurrentUserId();
UserRecord userRecord = userRecordDao.findByUserId(userId);
if (userRecord==null){
return messageUserVos;
}
else {
List<Integer> newTaskIds = StringSplitUtil.userIdSplit(userRecord.getNewReadIds());
messageUserVos = messageDao.findAll().stream()
.map(Message::parse2Bto)
.filter(messageBto -> messageBto.getInvolveUserIdList().contains(userId) && !messageBto.getCompleteUserIdList().contains(userId) && newTaskIds.contains(messageBto.getId()))
.map(MessageBto::toVo)
.sorted(Comparator.comparing(MessageUserVo::getCreateTime, Comparator.nullsLast(Date::compareTo)).reversed())
.collect(Collectors.toList());
return messageUserVos;
}
}
@Override
......
......@@ -5,4 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface UserRecordDao extends JpaRepository<UserRecord, Integer>, JpaSpecificationExecutor<UserRecord> {
UserRecord findByUserId(Integer userId);
}
......@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
......@@ -21,6 +23,8 @@ import java.util.Date;
@Data
@Entity
@ApiModel(value = "用户待办阅知记录对象", description = "用户记录")
@SQLDelete(sql = "update user_record set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
public class UserRecord {
@Id
......@@ -32,14 +36,31 @@ public class UserRecord {
@ApiModelProperty(value = "用户id", name = "userId")
private Integer userId;
@ApiModelProperty(value = "待办任务id拼接", name = "taskIds")
@ApiModelProperty(value = "省以下待办任务id拼接", name = "taskIds")
@Column(name = "task_ids",columnDefinition = "TEXT")
private String taskIds;
@ApiModelProperty(value = "新增省以下待办任务id拼接", name = "taskIds")
@Column(name = "new_task_ids",columnDefinition = "TEXT")
private String newTaskIds;
@ApiModelProperty(value = "中央到省待办任务id拼接", name = "taskIds")
@Column(name = "country_task_ids",columnDefinition = "TEXT")
private String countryTaskIds;
@ApiModelProperty(value = "新增中央到省待办任务id拼接", name = "taskIds")
@Column(name = "new_country_task_ids",columnDefinition = "TEXT")
private String newCountryTaskIds;
@ApiModelProperty(value = "阅知任务id拼接", name = "readIds")
@Column(name = "read_ids",columnDefinition = "TEXT")
private String readIds;
@ApiModelProperty(value = "新阅知任务id拼接", name = "readIds")
@Column(name = "new_read_ids",columnDefinition = "TEXT")
private String newReadIds;
@ApiModelProperty(value = "创建用户id")
@CreatedBy
private Integer createUserId;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论