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

更新

上级 7881c804
...@@ -398,6 +398,9 @@ public class AllotBillController { ...@@ -398,6 +398,9 @@ public class AllotBillController {
}); });
allotBillEntity.setReceiveFiles(FilesUtil.stringFileToList(allotReceiveVo.getReceiveFiles())); allotBillEntity.setReceiveFiles(FilesUtil.stringFileToList(allotReceiveVo.getReceiveFiles()));
} }
if (allotReceiveVo.getRightSignatureId()!=null&&!"".equals(allotReceiveVo.getRightSignatureId())) {
allotBillEntity.setRightSignatureId(allotReceiveVo.getRightSignatureId());
}
// fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl())); // fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl()));
//更新账单状态 //更新账单状态
allotBillEntity.setAllotStatus(5); allotBillEntity.setAllotStatus(5);
...@@ -423,8 +426,8 @@ public class AllotBillController { ...@@ -423,8 +426,8 @@ public class AllotBillController {
taskService.moveToNext(taskBto); taskService.moveToNext(taskBto);
} }
//生成上级上传单据任务 //生成上级上传单据任务
List<Integer> userIds = new ArrayList(); // List<Integer> userIds = new ArrayList();
userIds.add(0); // userIds.add(0);
// TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发单据", taskBto.getId(), taskBto.getNodeIdDetail()+taskBto.getId()+".", taskBto.getBillId(), 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, userIds); // TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发单据", taskBto.getId(), taskBto.getNodeIdDetail()+taskBto.getId()+".", taskBto.getBillId(), 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, userIds);
// taskService.start(taskBto); // taskService.start(taskBto);
//分隔装备id信息 //分隔装备id信息
......
...@@ -194,6 +194,9 @@ public class BackController { ...@@ -194,6 +194,9 @@ public class BackController {
// fileVoList.add(new FileVo("退回单", allotBackReceiveVo.getBillFileName(), allotBackReceiveVo.getBillFileUrl())); // fileVoList.add(new FileVo("退回单", allotBackReceiveVo.getBillFileName(), allotBackReceiveVo.getBillFileUrl()));
// fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl())); // fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl()));
//更新账单状态 //更新账单状态
if (allotBackReceiveVo.getRightSignatureId()!=null&&!"".equals(allotBackReceiveVo.getRightSignatureId())) {
allotBackBill.setRightSignatureId(allotBackReceiveVo.getRightSignatureId());
}
allotBackBill.setBackStatus(3); allotBackBill.setBackStatus(3);
BeanUtils.copyProperties(allotBackReceiveVo, allotBackBill); BeanUtils.copyProperties(allotBackReceiveVo, allotBackBill);
allotBackBill.setReceiveTime(TimestampUtil.getCurrentTimestamp()); allotBackBill.setReceiveTime(TimestampUtil.getCurrentTimestamp());
......
...@@ -63,4 +63,7 @@ public class AllotBackReceiveVo { ...@@ -63,4 +63,7 @@ public class AllotBackReceiveVo {
@ApiModelProperty(value = "接收方配发单") @ApiModelProperty(value = "接收方配发单")
private List<FileRet> receiveFiles; private List<FileRet> receiveFiles;
@ApiModelProperty(value = "收件单位签章id")
private String rightSignatureId;
} }
...@@ -68,4 +68,7 @@ public class AllotReceiveVo { ...@@ -68,4 +68,7 @@ public class AllotReceiveVo {
@ApiModelProperty(value = "接收方配发单") @ApiModelProperty(value = "接收方配发单")
private List<FileRet> receiveFiles; private List<FileRet> receiveFiles;
@ApiModelProperty(value = "收件单位签章id")
private String rightSignatureId;
} }
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>misc</artifactId> <artifactId>misc</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-library</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -7,27 +7,32 @@ import cn.afterturn.easypoi.excel.entity.ImportParams; ...@@ -7,27 +7,32 @@ import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.excel.entity.DeviceExcel;
import com.tykj.dev.device.excel.entity.TrainExcel;
import com.tykj.dev.device.excel.entity.TrainUserExcel;
import com.tykj.dev.device.excel.utils.ExcelStyleUtil; import com.tykj.dev.device.excel.utils.ExcelStyleUtil;
import com.tykj.dev.device.excel.utils.ExcelUtil; import com.tykj.dev.device.excel.utils.ExcelUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceExcel;
import com.tykj.dev.misc.utils.MapperUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.util.Comparator;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
...@@ -39,21 +44,22 @@ import java.util.List; ...@@ -39,21 +44,22 @@ import java.util.List;
@Api(tags = "excel", value = "excel") @Api(tags = "excel", value = "excel")
public class ExeclController { public class ExeclController {
@Autowired
DeviceLibraryDao deviceLibraryDao;
@Autowired
DeviceLibraryService deviceLibraryService;
/** /**
* 保存报废草稿 * 保存报废草稿
*/ */
@GetMapping(value ="/test") @GetMapping(value ="/test")
@ApiOperation(value = "下载培训excel", notes = "下载培训excel") @ApiOperation(value = "下载培训excel", notes = "下载培训excel")
public ResponseEntity saveDeviceDestroyBill(HttpServletRequest request, HttpServletResponse response){ public ResponseEntity saveDeviceDestroyBill(HttpServletRequest request, HttpServletResponse response){
List<DeviceExcel> excelList=deviceLibraryDao.findAll().stream().map(DeviceLibrary::parseExcel)
.sorted(Comparator.comparing(DeviceExcel::getSeqNumber,Comparator.nullsLast(String::compareTo)).thenComparing(DeviceExcel::getName))
.collect(Collectors.toList());
List<DeviceExcel> excelList=new ArrayList<>();
for (int i=0;i<6;i++){
DeviceExcel deviceExcel=new DeviceExcel();
deviceExcel.setId(i);
deviceExcel.setLifeStatus(1);
deviceExcel.setModel("1");
excelList.add(deviceExcel);
}
ExportParams exportParams = new ExportParams("xxx","xxx", ExcelType.XSSF); ExportParams exportParams = new ExportParams("xxx","xxx", ExcelType.XSSF);
exportParams.setStyle(ExcelStyleUtil.class); exportParams.setStyle(ExcelStyleUtil.class);
...@@ -97,7 +103,12 @@ public class ExeclController { ...@@ -97,7 +103,12 @@ public class ExeclController {
ExcelImportResult<DeviceExcel> result = ExcelImportUtil.importExcelMore(file.getInputStream(), DeviceExcel.class, ExcelImportResult<DeviceExcel> result = ExcelImportUtil.importExcelMore(file.getInputStream(), DeviceExcel.class,
params); params);
List<DeviceExcel> deviceExcels= result.getList(); List<DeviceExcel> deviceExcels= result.getList();
Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap();
for (DeviceExcel d:deviceExcels){
DeviceLibrary deviceLibrary = deviceLibraryMap.get(d.getId());
MapperUtils.copyNoNullProperties(d,deviceLibrary);
deviceLibraryService.update(deviceLibrary);
}
return ResponseEntity.ok(deviceExcels.size()); return ResponseEntity.ok(deviceExcels.size());
} }
......
...@@ -33,5 +33,22 @@ ...@@ -33,5 +33,22 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>blockcha</artifactId> <artifactId>blockcha</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -501,7 +501,19 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -501,7 +501,19 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override @Override
public Map<String, DeviceLibrary> getAllDeviceSeqMap() { public Map<String, DeviceLibrary> getAllDeviceSeqMap() {
List<DeviceLibrary> libraries = deviceLibraryDao.findAll(); List<DeviceLibrary> libraries = deviceLibraryDao.findAll();
libraries.forEach(DeviceLibrary::setConfigName); List<String> seqs = new ArrayList<>();
Iterator<DeviceLibrary> iterator = libraries.iterator();
while (iterator.hasNext()){
DeviceLibrary d = iterator.next();
if (!seqs.contains(d.getSeqNumber())) {
seqs.add(d.getSeqNumber());
d.setConfigName();
}
else {
iterator.remove();
}
}
// libraries.forEach(DeviceLibrary::setConfigName);
return libraries.stream().filter(deviceLibrary -> deviceLibrary.getSeqNumber()!=null&&!"".equals(deviceLibrary.getSeqNumber())).collect(Collectors.toMap(DeviceLibrary::getSeqNumber, Function.identity())); return libraries.stream().filter(deviceLibrary -> deviceLibrary.getSeqNumber()!=null&&!"".equals(deviceLibrary.getSeqNumber())).collect(Collectors.toMap(DeviceLibrary::getSeqNumber, Function.identity()));
} }
......
package com.tykj.dev.device.library.subject.domin; package com.tykj.dev.device.library.subject.domin;
import com.tykj.dev.config.cache.ConfigCache; import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.library.subject.vo.DeviceExcel;
import com.tykj.dev.device.library.subject.vo.DeviceVo; import com.tykj.dev.device.library.subject.vo.DeviceVo;
import com.tykj.dev.misc.base.BeanHelper; import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.SpringUtils; import com.tykj.dev.misc.utils.SpringUtils;
...@@ -275,6 +276,13 @@ public class DeviceLibrary { ...@@ -275,6 +276,13 @@ public class DeviceLibrary {
return mapper.map(this, DeviceVo.class); return mapper.map(this, DeviceVo.class);
} }
public DeviceExcel parseExcel(){
setConfigName();
//modelMap复制
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, DeviceExcel.class);
}
public DeviceLibrary setConfigName(){ public DeviceLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache"); ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) { if (configCache != null) {
......
package com.tykj.dev.device.excel.entity; package com.tykj.dev.device.library.subject.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -6,11 +6,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,11 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.Id;
/** /**
* entity class for device_library * entity class for device_library
...@@ -36,13 +33,7 @@ public class DeviceExcel { ...@@ -36,13 +33,7 @@ public class DeviceExcel {
@Excel(name = "型号", orderNum = "1", width = 30, needMerge = true) @Excel(name = "型号", orderNum = "1", width = 30, needMerge = true)
private String model; private String model;
/**
* 密级
*/
@ApiModelProperty(value = "密级")
@Excel(name = "密级", orderNum = "1", width = 30, needMerge = true)
private Integer secretLevel;
/** /**
* 装备名称 * 装备名称
*/ */
...@@ -50,6 +41,15 @@ public class DeviceExcel { ...@@ -50,6 +41,15 @@ public class DeviceExcel {
@Excel(name = "装备名称", orderNum = "1", width = 30, needMerge = true) @Excel(name = "装备名称", orderNum = "1", width = 30, needMerge = true)
private String name; private String name;
/**
* 密级
*/
@ApiModelProperty(value = "密级")
@Excel(name = "密级", orderNum = "1", width = 30, needMerge = true)
private String secretLevelName;
/** /**
* 装备序列号 * 装备序列号
*/ */
...@@ -71,12 +71,12 @@ public class DeviceExcel { ...@@ -71,12 +71,12 @@ public class DeviceExcel {
@ApiModelProperty(value = "类型") @ApiModelProperty(value = "类型")
@Excel(name = "类型", orderNum = "1", width = 30, needMerge = true) @Excel(name = "类型", orderNum = "1", width = 30, needMerge = true)
private Integer type; private String typeName;
/** /**
* 生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失 12.清退 * 生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失 12.清退
*/ */
@ApiModelProperty(value = "生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失") @ApiModelProperty(value = "生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失")
@Excel(name = "生命状态", orderNum = "1", width = 30, needMerge = true) @Excel(name = "生命状态", orderNum = "1", width = 30, needMerge = true)
private Integer lifeStatus; private String lifeStatusName;
} }
...@@ -28,6 +28,7 @@ import com.tykj.dev.device.user.util.UserUtils; ...@@ -28,6 +28,7 @@ import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.StringSplitUtil; import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.service.RfidService; import com.tykj.dev.rfid.service.RfidService;
import com.tykj.dev.rfid.service.impl.RfidServiceImpl; import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import com.tykj.dev.socket.MyWebSocket; import com.tykj.dev.socket.MyWebSocket;
...@@ -131,10 +132,11 @@ public class MatchingDeviceController { ...@@ -131,10 +132,11 @@ public class MatchingDeviceController {
//添加业务日志 //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto1.getId(), "发起新增配套", fileVoList); // TaskLogBto taskLogBto2 = new TaskLogBto(taskBto1.getId(), "发起新增配套", fileVoList);
// taskLogService.addLog(taskLogBto2); // taskLogService.addLog(taskLogBto2);
List<PrintVo> printVos = new ArrayList<>();
for (MatchingDeviceSaveVo matchingDeviceSaveVo : matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList()) { for (MatchingDeviceSaveVo matchingDeviceSaveVo : matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList()) {
MatchingDeviceLibrary matchingDeviceLibraryEntity = matchingDeviceSaveVo.toDo(); MatchingDeviceLibrary matchingDeviceLibraryEntity = matchingDeviceSaveVo.toDo();
MatchingDeviceLibrary d = matchingDeviceLibraryService.addEntity(matchingDeviceLibraryEntity); MatchingDeviceLibrary d = matchingDeviceLibraryService.addEntity(matchingDeviceLibraryEntity);
rfidService.printString(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber()); printVos.add(new PrintVo(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber()));
d.setRfidCardId(RfidServiceImpl.completeRfidStr2(String.valueOf(d.getId()))); d.setRfidCardId(RfidServiceImpl.completeRfidStr2(String.valueOf(d.getId())));
matchingDeviceLibraryService.update(d); matchingDeviceLibraryService.update(d);
stringBuffer.append(d.getId()); stringBuffer.append(d.getId());
...@@ -143,6 +145,7 @@ public class MatchingDeviceController { ...@@ -143,6 +145,7 @@ public class MatchingDeviceController {
DeviceLogDto deviceLogDto = new DeviceLogDto(1, d.getId(), "发起新增配套", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(1, d.getId(), "发起新增配套", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
rfidService.printString(printVos);
//set账单新增设备详情 //set账单新增设备详情
m.setDeviceDetail(stringBuffer.toString()); m.setDeviceDetail(stringBuffer.toString());
matchingDeviceBillService.update(m); matchingDeviceBillService.update(m);
......
...@@ -33,6 +33,7 @@ public class DeviceSeqUtil { ...@@ -33,6 +33,7 @@ public class DeviceSeqUtil {
System.out.println(getContinuousSeqs(list)); System.out.println(getContinuousSeqs(list));
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
System.out.println(sdf.format(new Date())); System.out.println(sdf.format(new Date()));
System.out.println(System.currentTimeMillis());
} }
/** /**
......
...@@ -15,7 +15,7 @@ public class Snowflake { ...@@ -15,7 +15,7 @@ public class Snowflake {
/** /**
* 开始时间戳 * 开始时间戳
*/ */
private static final long START_TIME = 1611555438111L; private static final long START_TIME = 1620355582082L;
/** /**
* 时间戳位数 * 时间戳位数
*/ */
......
...@@ -475,6 +475,9 @@ public class RepairController { ...@@ -475,6 +475,9 @@ public class RepairController {
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(repairBill.getId()); RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(repairBill.getId());
String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail(); String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail();
List<RepairDetail> repairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId()); List<RepairDetail> repairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId());
if (repairReceiveVo.getRightSignatureId()!=null&&!"".equals(repairReceiveVo.getRightSignatureId())){
repairBill.setRightSignatureId(repairReceiveVo.getRightSignatureId());
}
if (repairSendBill.getRepairUseraId() == null) { if (repairSendBill.getRepairUseraId() == null) {
repairBill.setRepairUserA(userUtils.getCurrentUserName()); repairBill.setRepairUserA(userUtils.getCurrentUserName());
repairSendBill.setRepairUseraId(userId); repairSendBill.setRepairUseraId(userId);
...@@ -887,6 +890,9 @@ public class RepairController { ...@@ -887,6 +890,9 @@ public class RepairController {
if (repairBackBill.getReceiveUseraId() == null) { if (repairBackBill.getReceiveUseraId() == null) {
repairBackBill.setReceiveUseraId(userId); repairBackBill.setReceiveUseraId(userId);
} }
if (repairReceiveVo.getRightSignatureId()!=null&&!"".equals(repairReceiveVo.getRightSignatureId())){
repairBackBill.setRightSignatureId(repairReceiveVo.getRightSignatureId());
}
//更新退回单 //更新退回单
repairBackBill.setBackStatus(5); repairBackBill.setBackStatus(5);
repairBackBill.setBillFileName(repairReceiveVo.getBillFileName()); repairBackBill.setBillFileName(repairReceiveVo.getBillFileName());
...@@ -951,7 +957,7 @@ public class RepairController { ...@@ -951,7 +957,7 @@ public class RepairController {
if (repairReceiveVo.getStatus()==0) { if (repairReceiveVo.getStatus()==0) {
taskBto2 = taskService.moveToEnd(taskBto); taskBto2 = taskService.moveToEnd(taskBto);
//子任务完结 //子任务完结
taskService.moveAllSonNodeToEnd(taskBto.getId()); taskService.moveAllSonNodeToEnd(taskBto2.getId());
} }
else { else {
taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE); taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE);
......
...@@ -72,4 +72,6 @@ public class RepairReceiveVo { ...@@ -72,4 +72,6 @@ public class RepairReceiveVo {
@ApiModelProperty(value = "接收方配发单") @ApiModelProperty(value = "接收方配发单")
private List<FileRet> receiveFiles; private List<FileRet> receiveFiles;
@ApiModelProperty(value = "收件单位签章id")
private String rightSignatureId;
} }
...@@ -106,7 +106,7 @@ public class RfidController { ...@@ -106,7 +106,7 @@ public class RfidController {
return ResultUtil.success(rfidService.getRfidNumber(list)); return ResultUtil.success(rfidService.getRfidNumber(list));
} }
@ApiOperation(value = "打印标签", notes = "可以通过这个接口打印RFID") @ApiOperation(value = "再次打印标签(已入库),未入库只能后台调打印", notes = "可以通过这个接口打印RFID")
@PostMapping(value = "/print") @PostMapping(value = "/print")
public ResponseEntity printRfid(@RequestBody List<RfidPrintVo> rfid) { public ResponseEntity printRfid(@RequestBody List<RfidPrintVo> rfid) {
Map<String,DeviceLibrary> map = deviceLibraryService.getAllDeviceSeqMap(); Map<String,DeviceLibrary> map = deviceLibraryService.getAllDeviceSeqMap();
...@@ -114,7 +114,8 @@ public class RfidController { ...@@ -114,7 +114,8 @@ public class RfidController {
//调用打印服务 批量打印 //调用打印服务 批量打印
for (RfidPrintVo printVo : rfid) { for (RfidPrintVo printVo : rfid) {
DeviceLibrary deviceLibrary = map.get(printVo.getDeviceNumber()); DeviceLibrary deviceLibrary = map.get(printVo.getDeviceNumber());
rfidService.printString(RfidServiceImpl.completeRfidStr(String.valueOf(deviceLibrary.getId())), deviceLibrary.getModel(), deviceLibrary.getName(),deviceLibrary.getSeqNumber()); PrintVo printVo1 = new PrintVo(RfidServiceImpl.completeRfidStr(String.valueOf(deviceLibrary.getId())), deviceLibrary.getModel(), deviceLibrary.getName(),deviceLibrary.getSeqNumber());
rfidService.printString(Collections.singletonList(printVo1));
deviceLogDtos.add(new DeviceLogDto(deviceLibrary.getId(), "打印标签", null)); deviceLogDtos.add(new DeviceLogDto(deviceLibrary.getId(), "打印标签", null));
} }
deviceLogService.addAllLog(deviceLogDtos); deviceLogService.addAllLog(deviceLogDtos);
......
package com.tykj.dev.rfid.entity.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PrintVo {
String rfidContent;
String str1;
String str2;
String str3;
}
package com.tykj.dev.rfid.service; package com.tykj.dev.rfid.service;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.entity.vo.RfidCreateVo; import com.tykj.dev.rfid.entity.vo.RfidCreateVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo; import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
...@@ -34,7 +35,7 @@ public interface RfidService { ...@@ -34,7 +35,7 @@ public interface RfidService {
* *
* @return * @return
*/ */
boolean printString(String rfidContent ,String str1,String str2,String str3); boolean printString(List<PrintVo> printVos);
/** /**
* 描述:生成装备的RFID表面号 * 描述:生成装备的RFID表面号
......
...@@ -4,6 +4,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService; ...@@ -4,6 +4,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.entity.vo.RfidCreateVo; import com.tykj.dev.rfid.entity.vo.RfidCreateVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo; import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import com.tykj.dev.rfid.entity.vo.SplitStringInfo; import com.tykj.dev.rfid.entity.vo.SplitStringInfo;
...@@ -85,13 +86,19 @@ public class RfidServiceImpl implements RfidService { ...@@ -85,13 +86,19 @@ public class RfidServiceImpl implements RfidService {
* @return * @return
*/ */
@Override @Override
public boolean printString(String rfidContent ,String str1,String str2,String str3) { public boolean printString( List<PrintVo> printVos) {
if (printVos==null&&printVos.size()<=0){
throw new ApiException("打印列表为空");
}
try { try {
Connection connection = new TcpConnection("192.168.000.222", 6101); Connection connection = new TcpConnection("192.168.000.222", 6101);
connection.open(); connection.open();
printer = ZebraPrinterFactory.getInstance(connection); for (PrintVo printVo : printVos) {
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),rfidContent,str1, str2,str3, 60, 55); printer = ZebraPrinterFactory.getInstance(connection);
printer.sendFileContents(demoFile); String demoFile = createDemoFile(printer.getPrinterControlLanguage(),printVo.getRfidContent(),printVo.getStr1(), printVo.getStr2(),printVo.getStr3(), 55, 50);
printer.sendFileContents(demoFile);
}
connection.close();
} catch (ConnectionException e) { } catch (ConnectionException e) {
throw new ApiException("未找到对应的打印机"); throw new ApiException("未找到对应的打印机");
} catch (ZebraPrinterLanguageUnknownException e) { } catch (ZebraPrinterLanguageUnknownException e) {
...@@ -102,6 +109,7 @@ public class RfidServiceImpl implements RfidService { ...@@ -102,6 +109,7 @@ public class RfidServiceImpl implements RfidService {
return true; return true;
} }
/** /**
* @param pl 打印机语言 * @param pl 打印机语言
* @param str1 空格一 * @param str1 空格一
...@@ -112,7 +120,9 @@ public class RfidServiceImpl implements RfidService { ...@@ -112,7 +120,9 @@ public class RfidServiceImpl implements RfidService {
* @return 拼接成功的打印机ZPL * @return 拼接成功的打印机ZPL
* @throws IOException IO错误 * @throws IOException IO错误
*/ */
private static String createDemoFile(PrinterLanguage pl,String rfidContent ,String str1,String str2,String str3, int marginLeft, int marginTop) throws IOException {
private String createDemoFile(PrinterLanguage pl,String rfidContent ,String str1,String str2,String str3, int marginLeft, int marginTop) throws IOException {
if (!checkRFID(rfidContent)){ if (!checkRFID(rfidContent)){
throw new ApiException(""); throw new ApiException("");
} }
...@@ -120,9 +130,9 @@ public class RfidServiceImpl implements RfidService { ...@@ -120,9 +130,9 @@ public class RfidServiceImpl implements RfidService {
File tmpFile = File.createTempFile("TEST_ZEBRA", "LBL"); File tmpFile = File.createTempFile("TEST_ZEBRA", "LBL");
FileOutputStream os = new FileOutputStream(tmpFile); FileOutputStream os = new FileOutputStream(tmpFile);
byte[] configLabel = null; byte[] configLabel = null;
SplitStringInfo deviceNumberSplit = spiltLineString("型"+str1, null); SplitStringInfo deviceNumberSplit = spiltLineString("型 号:"+str1, null);
SplitStringInfo contentSplit = spiltLineString("名"+str2, deviceNumberSplit.getStringLineNumber()); SplitStringInfo contentSplit = spiltLineString("名 称:"+str2, deviceNumberSplit.getStringLineNumber());
SplitStringInfo str3Split = spiltLineString("序列号"+str3, contentSplit.getStringLineNumber()); SplitStringInfo str3Split = spiltLineString("序列号:"+str3, contentSplit.getStringLineNumber());
//补零 //补零
rfidContent = completeRfidStr(rfidContent); rfidContent = completeRfidStr(rfidContent);
if (pl == PrinterLanguage.ZPL) { if (pl == PrinterLanguage.ZPL) {
...@@ -242,11 +252,11 @@ public class RfidServiceImpl implements RfidService { ...@@ -242,11 +252,11 @@ public class RfidServiceImpl implements RfidService {
} }
public static void main(String[] args) throws ConnectionException, ZebraPrinterLanguageUnknownException, IOException { public static void main(String[] args) throws ConnectionException, ZebraPrinterLanguageUnknownException, IOException {
Connection connection = new TcpConnection("192.168.0.222", 6101); // Connection connection = new TcpConnection("192.168.0.222", 6101);
connection.open(); // connection.open();
printer = ZebraPrinterFactory.getInstance(connection); // printer = ZebraPrinterFactory.getInstance(connection);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),"1234","装备号:xxxxxxxxxxxxxxxxxxxxxxxx", "内容:ABCD","序列号:123", 60, 80); // String demoFile = createDemoFile(printer.getPrinterControlLanguage(),"1234","装备号:xxxxxxxxxxxxxxxxxxxxxxxx", "内容:ABCD","序列号:123", 60, 80);
printer.sendFileContents(demoFile); // printer.sendFileContents(demoFile);
} }
......
...@@ -26,9 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -26,9 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -66,7 +63,6 @@ public class AgainStorageBillServiceImpl implements AgainStorageBillService { ...@@ -66,7 +63,6 @@ public class AgainStorageBillServiceImpl implements AgainStorageBillService {
public void againPutInStorage(TransitionOfLifeVo transitionOfLifeVo, SecurityUser securityUser) { public void againPutInStorage(TransitionOfLifeVo transitionOfLifeVo, SecurityUser securityUser) {
List<DeviceLibrary> deviceLibraries= deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(transitionOfLifeVo.getIds()); List<DeviceLibrary> deviceLibraries= deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(transitionOfLifeVo.getIds());
AgainStorageBill againStorageBill= againStorageBillDao.save(new AgainStorageBill(StringUtils.ListToString(transitionOfLifeVo.getIds()),transitionOfLifeVo.getType())); AgainStorageBill againStorageBill= againStorageBillDao.save(new AgainStorageBill(StringUtils.ListToString(transitionOfLifeVo.getIds()),transitionOfLifeVo.getType()));
TaskBto taskBto=againStorageTask(securityUser.getCurrentUserInfo().getUnitsId(),againStorageBill.getId(),securityUser.getCurrentUserInfo().getUserId());
String typeName; String typeName;
switch (transitionOfLifeVo.getType()){ switch (transitionOfLifeVo.getType()){
case 0: case 0:
...@@ -93,6 +89,7 @@ public class AgainStorageBillServiceImpl implements AgainStorageBillService { ...@@ -93,6 +89,7 @@ public class AgainStorageBillServiceImpl implements AgainStorageBillService {
throw new ApiException(ResponseEntity.status(500).body("[生命状态转换] 为找到对应的type")); throw new ApiException(ResponseEntity.status(500).body("[生命状态转换] 为找到对应的type"));
} }
TaskBto taskBto=againStorageTask(securityUser.getCurrentUserInfo().getUnitsId(),againStorageBill.getId(),securityUser.getCurrentUserInfo().getUserId(),typeName);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),securityUser.getUsername()+"执行了"+typeName,gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),securityUser.getUsername()+"执行了"+typeName,gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
devLogAdd(deviceLibraries,typeName,securityUser.getCurrentUserInfo().getUserId()); devLogAdd(deviceLibraries,typeName,securityUser.getCurrentUserInfo().getUserId());
} }
...@@ -115,10 +112,10 @@ public class AgainStorageBillServiceImpl implements AgainStorageBillService { ...@@ -115,10 +112,10 @@ public class AgainStorageBillServiceImpl implements AgainStorageBillService {
* 重新入库任务发起 * 重新入库任务发起
* 这里应为重新入库直接完结所有发起task任务为完结状态 * 这里应为重新入库直接完结所有发起task任务为完结状态
*/ */
private TaskBto againStorageTask(Integer unitId, Integer againStorageId , Integer userId){ private TaskBto againStorageTask(Integer unitId, Integer againStorageId , Integer userId , String typeName){
List<Integer> list=new ArrayList<>(); List<Integer> list=new ArrayList<>();
list.add(userId); list.add(userId);
return taskService.start(new TaskBto(StatusEnum.END.id, LocalDateTime.now().atZone(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "重新入库", null, ".", againStorageId, BusinessEnum.AGAINSTORAGE.id, unitId, 0, null, list)); return taskService.start(new TaskBto(StatusEnum.END.id, typeName, null, ".", againStorageId, BusinessEnum.AGAINSTORAGE.id, unitId, 0, null, list));
} }
private void addMessage(MessageBto messageBto){ private void addMessage(MessageBto messageBto){
......
...@@ -34,6 +34,7 @@ import com.tykj.dev.misc.base.BusinessEnum; ...@@ -34,6 +34,7 @@ import com.tykj.dev.misc.base.BusinessEnum;
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.exception.ApiException;
import com.tykj.dev.misc.utils.*; import com.tykj.dev.misc.utils.*;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.service.RfidService; import com.tykj.dev.rfid.service.RfidService;
import com.tykj.dev.rfid.service.impl.RfidServiceImpl; import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import com.tykj.dev.socket.MyWebSocket; import com.tykj.dev.socket.MyWebSocket;
...@@ -174,6 +175,7 @@ public class StorageBillController { ...@@ -174,6 +175,7 @@ public class StorageBillController {
public ResponseEntity addStorageDetail(@RequestBody List<StorageBillDetailVo> list) { public ResponseEntity addStorageDetail(@RequestBody List<StorageBillDetailVo> list) {
List<PackingLibrary> libraryEntities = new ArrayList<>(); List<PackingLibrary> libraryEntities = new ArrayList<>();
Map<Integer, List<PackingLibrary>> map = new HashMap<>(); Map<Integer, List<PackingLibrary>> map = new HashMap<>();
List<String> seqs = new ArrayList<>();
for (StorageBillDetailVo s : list) { for (StorageBillDetailVo s : list) {
if (s.getStorageCount()>0) { if (s.getStorageCount()>0) {
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount()); List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount());
...@@ -194,9 +196,13 @@ public class StorageBillController { ...@@ -194,9 +196,13 @@ public class StorageBillController {
if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size() > 0) { if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size() > 0) {
throw new ApiException("序列号" + strings.get(0) + "已存在"); throw new ApiException("序列号" + strings.get(0) + "已存在");
} }
if (seqs.contains(strings.get(0))){
throw new ApiException("序列号" + strings.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings.get(0)); packingLibraryEntity.setSeq(strings.get(0));
strings.remove(0); strings.remove(0);
} }
seqs.add(packingLibraryEntity.getSeq());
libraryEntities.add(packingLibraryEntity); libraryEntities.add(packingLibraryEntity);
if (s.getList() != null && s.getList().size() != 0) { if (s.getList() != null && s.getList().size() != 0) {
for (int j = 0; j < s.getList().size(); j++) { for (int j = 0; j < s.getList().size(); j++) {
...@@ -214,6 +220,9 @@ public class StorageBillController { ...@@ -214,6 +220,9 @@ public class StorageBillController {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) { if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号" + strings2.get(0) + "已存在"); throw new ApiException("序列号" + strings2.get(0) + "已存在");
} }
if (seqs.contains(strings2.get(0))){
throw new ApiException("序列号" + strings2.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings2.get(0)); packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0); strings2.remove(0);
} }
...@@ -221,6 +230,7 @@ public class StorageBillController { ...@@ -221,6 +230,7 @@ public class StorageBillController {
packingLibraryEntity.setProdNumber(strings1.get(0)); packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0); strings1.remove(0);
} }
seqs.add(packingLibraryEntity.getSeq());
libraryEntities.add(packingLibraryEntity); libraryEntities.add(packingLibraryEntity);
} }
if (s2.getStorageCount() - strings2.size() == deviceNum) { if (s2.getStorageCount() - strings2.size() == deviceNum) {
...@@ -232,6 +242,9 @@ public class StorageBillController { ...@@ -232,6 +242,9 @@ public class StorageBillController {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) { if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号" + strings2.get(0) + "已存在"); throw new ApiException("序列号" + strings2.get(0) + "已存在");
} }
if (seqs.contains(strings2.get(0))){
throw new ApiException("序列号" + strings2.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings2.get(0)); packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0); strings2.remove(0);
} }
...@@ -239,6 +252,7 @@ public class StorageBillController { ...@@ -239,6 +252,7 @@ public class StorageBillController {
packingLibraryEntity.setProdNumber(strings1.get(0)); packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0); strings1.remove(0);
} }
seqs.add(packingLibraryEntity.getSeq());
packingLibraries.add(packingLibraryEntity); packingLibraries.add(packingLibraryEntity);
} }
map.put(s2.getPackingId(), packingLibraries); map.put(s2.getPackingId(), packingLibraries);
...@@ -365,11 +379,13 @@ public class StorageBillController { ...@@ -365,11 +379,13 @@ public class StorageBillController {
} }
//若要打印标签 //若要打印标签
if(storageBillSaveVo.getIsPrint()==1){ if(storageBillSaveVo.getIsPrint()==1){
List<PrintVo> printVos = new ArrayList<>();
for (DeviceLibrary d : saveEntities) { for (DeviceLibrary d : saveEntities) {
rfidService.printString(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber()); printVos.add(new PrintVo(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber()));
d.setRfidCardId(RfidServiceImpl.completeRfidStr(String.valueOf(d.getId()))); d.setRfidCardId(RfidServiceImpl.completeRfidStr(String.valueOf(d.getId())));
deviceLibraryService.update(d); deviceLibraryService.update(d);
} }
rfidService.printString(printVos);
} }
//更新申请业务入库数量 //更新申请业务入库数量
if (deviceApplyBills.size()>0){ if (deviceApplyBills.size()>0){
......
...@@ -346,7 +346,17 @@ ...@@ -346,7 +346,17 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-excel</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.tykj.dev</groupId>
<artifactId>union</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-file</artifactId>
......
package com.tykj.dev.device.user.base.ret;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@AllArgsConstructor
@ApiModel("业务类型返回类")
public class BusinessTypeVo {
private Integer businessType;
@ApiModelProperty(value = "业务类型名称")
private String businessTypeName;
}
package com.tykj.dev.device.user.base.ret;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "阅知查询对象", description = "阅知查询对象")
public class MessageSelectVo extends CustomPage {
@ApiModelProperty(value = "业务类型", example = "2")
private Integer businessType;
@ApiModelProperty(value = "年份", example = "2")
private Integer year;
@ApiModelProperty(value = "已读/未读", example = "0")
private Integer isRead;
}
...@@ -4,16 +4,27 @@ package com.tykj.dev.device.user.read.controller; ...@@ -4,16 +4,27 @@ package com.tykj.dev.device.user.read.controller;
* @author dengdiyi * @author dengdiyi
*/ */
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.base.ret.BusinessTypeVo;
import com.tykj.dev.device.user.base.ret.MessageSelectVo;
import com.tykj.dev.device.user.read.service.MessageService; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo; import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.socket.MyWebSocket; import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
//import com.tykj.dev.device.read.service.MessageService; //import com.tykj.dev.device.read.service.MessageService;
/** /**
...@@ -31,12 +42,25 @@ public class MessageController { ...@@ -31,12 +42,25 @@ public class MessageController {
@Autowired @Autowired
private MyWebSocket myWebSocket; private MyWebSocket myWebSocket;
@ApiOperation(value = "阅知信息查询") @ApiOperation(value = "未读阅知信息查询")
@GetMapping("/get") @GetMapping("/get")
public ResponseEntity getMessage(){ public ResponseEntity getMessage(){
return ResponseEntity.ok(messageService.getList()); return ResponseEntity.ok(messageService.getList());
} }
@ApiOperation(value = "所有阅知信息查询")
@PostMapping("/get/all")
public ResponseEntity getAllMessage(@RequestBody MessageSelectVo messageSelectVo){
List<MessageUserVo> messageUserVos = messageService.getAllList(messageSelectVo);
Page<MessageUserVo> taskUserVos1 = PageUtil.getPerPage(messageSelectVo.getPage(), messageSelectVo.getSize(), messageUserVos, messageSelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
Map<Integer,String> businessMap = GlobalMap.getBusinessMap();
Set<Integer> businessType = messageUserVos.stream().map(MessageUserVo::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 ResponseEntity.ok(map);
}
@ApiOperation(value = "提交已读阅知信息") @ApiOperation(value = "提交已读阅知信息")
@PostMapping("/read/{id}") @PostMapping("/read/{id}")
public ResponseEntity readMessage(@PathVariable("id") int id){ public ResponseEntity readMessage(@PathVariable("id") int id){
......
package com.tykj.dev.device.user.read.service; package com.tykj.dev.device.user.read.service;
import com.tykj.dev.device.user.base.ret.MessageSelectVo;
import com.tykj.dev.device.user.read.subject.bto.MessageBto; 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.domin.Message;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo; import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
...@@ -23,6 +24,8 @@ public interface MessageService { ...@@ -23,6 +24,8 @@ public interface MessageService {
List<MessageUserVo> getList(); List<MessageUserVo> getList();
List<MessageUserVo> getAllList(MessageSelectVo messageSelectVo);
List<MessageBto> getBtoList(); List<MessageBto> getBtoList();
/** /**
......
...@@ -3,6 +3,7 @@ package com.tykj.dev.device.user.read.service.impl; ...@@ -3,6 +3,7 @@ package com.tykj.dev.device.user.read.service.impl;
import com.tykj.dev.blockcha.subject.entity.BcHash; import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.user.base.ret.MessageSelectVo;
import com.tykj.dev.device.user.read.repository.MessageDao; import com.tykj.dev.device.user.read.repository.MessageDao;
import com.tykj.dev.device.user.read.service.MessageService; 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.bto.MessageBto;
...@@ -90,6 +91,22 @@ public class MessageServiceImpl implements MessageService { ...@@ -90,6 +91,22 @@ public class MessageServiceImpl implements MessageService {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public List<MessageUserVo> getAllList(MessageSelectVo messageSelectVo) {
Integer userId = userUtils.getCurrentUserId();
Boolean hasYear = messageSelectVo.getYear()!=null;
Boolean hasBusinessType = messageSelectVo.getBusinessType()!=null;
return messageDao.findAll().stream()
.map(Message::parse2Bto)
.filter(messageBto -> messageBto.getInvolveUserIdList().contains(userId)
&&(!hasBusinessType||messageBto.getBusinessType().equals(messageSelectVo.getBusinessType()))
&&(!hasYear||messageBto.getCreateTime().getYear()==messageSelectVo.getYear()-1900))
.map(MessageBto::toVo)
.filter(messageUserVo -> messageUserVo.getIsRead().equals(messageSelectVo.getIsRead()))
.sorted(Comparator.comparing(MessageUserVo::getCreateTime,Comparator.nullsLast(Date::compareTo)).reversed())
.collect(Collectors.toList());
}
@Override @Override
public List<MessageBto> getBtoList() { public List<MessageBto> getBtoList() {
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论