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

更新

上级 4c84fe6e
package com.tykj.dev.device.allot.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.file.service.FilesUtil;
......@@ -37,6 +39,9 @@ public class AllotBillSelectController {
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private AllotBackBillService allotBackBillService;
@ApiOperation(value = "查询配发单", notes = "可以通过这个接口查询配发单")
@PostMapping(value = "/archives/allot/summary")
public ResponseEntity selectAllotBill(@RequestBody AllotBillSelectVo allotBillSelectVo) {
......@@ -44,6 +49,13 @@ public class AllotBillSelectController {
return ResponseEntity.ok(page);
}
@ApiOperation(value = "查询退回单", notes = "可以通过这个接口查询退回单")
@PostMapping(value = "/archives/back/summary")
public ResponseEntity selectBackBill(@RequestBody AllotBillSelectVo allotBillSelectVo) {
Page<AllotBackBill> page = allotBackBillService.getPage(allotBillSelectVo, allotBillSelectVo.getPageable());
return ResponseEntity.ok(page);
}
@ApiOperation(value = "查询配发单详情页", notes = "可以通过这个接口查询配发单")
@GetMapping(value = "/archives/allot/detail/{id}")
public ResponseEntity selectAllotBillDetail(@PathVariable("id") int id) {
......@@ -59,6 +71,7 @@ public class AllotBillSelectController {
allotBillEntity.setReceiveUserB(userService.getOne(allotBillEntity.getReceiveUserbId()).getName());
}
allotBillEntity.setSendFileList(FilesUtil.stringFileToList(allotBillEntity.getSendFiles()));
allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles()));
list.add(allotBillEntity);
List<DeviceLibrary> libraryEntities = new ArrayList<>();
//如果接收装备详情不为空,分隔装备id并添加
......@@ -70,4 +83,28 @@ public class AllotBillSelectController {
list.add(libraryEntities);
return ResponseEntity.ok(list);
}
@ApiOperation(value = "查询退回单详情页", notes = "可以通过这个接口查询退回单")
@GetMapping(value = "/archives/back/detail/{id}")
public ResponseEntity selectBackBillDetail(@PathVariable("id") int id) {
List<Object> list = new ArrayList<>();
//set账单用户名称并添加
AllotBackBill allotBillEntity = allotBackBillService.getOne(id);
allotBillEntity.setSendUsera(userService.getOne(allotBillEntity.getSendUseraId()).getName());
if (allotBillEntity.getReceiveUseraId() != null) {
allotBillEntity.setReceiveUsera(userService.getOne(allotBillEntity.getReceiveUseraId()).getName());
}
allotBillEntity.setSendFileList(FilesUtil.stringFileToList(allotBillEntity.getSendFiles()));
allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles()));
list.add(allotBillEntity);
List<DeviceLibrary> libraryEntities = new ArrayList<>();
//如果接收装备详情不为空,分隔装备id并添加
if (allotBillEntity.getBackCheckDetail() != null) {
for (Integer deviceId : StringSplitUtil.split(allotBillEntity.getBackCheckDetail())) {
libraryEntities.add(deviceLibraryService.getOne(deviceId));
}
}
list.add(libraryEntities);
return ResponseEntity.ok(list);
}
}
package com.tykj.dev.device.allot.service;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
......@@ -19,4 +22,6 @@ public interface AllotBackBillService {
AllotBackBill update(AllotBackBill allotBackBill);
AllotBackBill getOne(Integer id);
Page<AllotBackBill> getPage(AllotBillSelectVo allotBillSelectVo, Pageable pageable);
}
package com.tykj.dev.device.allot.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
......@@ -29,6 +38,9 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
@Autowired
private BlockChainUtil blockChainUtil;
@Autowired
private UserPublicService userPublicService;
@Override
public AllotBackBill addEntity(AllotBackBill allotBackBill) {
AllotBackBill allotBackBill1 = allotBackBillDao.save(allotBackBill);
......@@ -78,4 +90,54 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
throw new ApiException(ResultUtil.failed("查询的Id不存在"));
}
}
@Override
public Page<AllotBackBill> getPage(AllotBillSelectVo allotBillSelectVo, Pageable pageable) {
Page<AllotBackBill> page = allotBackBillDao.findAll(getSelectSpecification(allotBillSelectVo), pageable);
for (AllotBackBill a : page.getContent()) {
a.setSendUsera(userPublicService.getOne(a.getSendUseraId()).getName());
a.setReceiveUsera(userPublicService.getOne(a.getReceiveUseraId()).getName());
}
return page;
}
private Specification<AllotBackBill> getSelectSpecification(AllotBillSelectVo allotBillSelectVo) {
PredicateBuilder<AllotBackBill> predicateBuilder = Specifications.and();
if (allotBillSelectVo != null) {
if (allotBillSelectVo.getReplayNumber() != null) {
predicateBuilder.eq("replayNumber", allotBillSelectVo.getReplayNumber());
}
if (allotBillSelectVo.getReceiveUnit() != null) {
predicateBuilder.eq("receiveUnit", allotBillSelectVo.getReceiveUnit());
}
if (allotBillSelectVo.getReceiveUseraId() != null) {
predicateBuilder.eq("receiveUseraId", allotBillSelectVo.getReceiveUseraId());
}
if (allotBillSelectVo.getSendUnit() != null) {
predicateBuilder.eq("sendUnit", allotBillSelectVo.getSendUnit());
}
if (allotBillSelectVo.getSendUseraId() != null) {
predicateBuilder.eq("sendUseraId", allotBillSelectVo.getSendUseraId());
}
if (allotBillSelectVo.getContent() != null) {
Class<AllotBackBill> allotBillEntityClass = AllotBackBill.class;
Field[] declaredFields = allotBillEntityClass.getDeclaredFields();
PredicateBuilder<AllotBackBill> p = Specifications.or();
for (Field field : declaredFields) {
if (field.getType().equals(String.class) && field.getAnnotation(Transient.class) == null) {
p.like(field.getName(), "%" + allotBillSelectVo.getContent() + "%");
}
}
predicateBuilder.predicate(p.build());
}
if (allotBillSelectVo.getStartTime() != null) {
predicateBuilder.gt("sendTime", allotBillSelectVo.getStartTime());
}
if (allotBillSelectVo.getEndTime() != null) {
predicateBuilder.lt("receiveTime", allotBillSelectVo.getEndTime());
}
predicateBuilder.eq("backStatus", 3);
}
return predicateBuilder.build();
}
}
package com.tykj.dev.device.allot.subject.domin;
import com.tykj.dev.device.file.entity.FileRet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -12,7 +13,9 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author dengdiyi
......@@ -164,4 +167,10 @@ public class AllotBackBill {
@Column(name = "send_files",columnDefinition = "TEXT")
private String sendFiles;
@Transient
private List<FileRet> replyFileList = new ArrayList<>();
@Transient
private List<FileRet> sendFileList = new ArrayList<>();
}
package com.tykj.dev.config.base;
import com.tykj.dev.config.domin.SystemConfig;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 装备应用类型枚举
*/
@AllArgsConstructor
public enum DeviceApplyType {
/**
* 网络
*/
APPLYTYPE_1(1, "网络"),
/**
* 传真
*/
APPLYTYPE_2(2, "传真"),
/**
* 应用
*/
APPLYTYPE_3(3, "应用"),
/**
* 电话
*/
APPLYTYPE_4(4, "电话"),
/**
* 链路
*/
APPLYTYPE_5(5, "链路");
public Integer id;
public String name;
public SystemConfig toDo(){
SystemConfig systemConfig = new SystemConfig();
systemConfig.setValue(id);
systemConfig.setLabel(name);
systemConfig.setChineseName("应用类型");
systemConfig.setEnglishName("applyType");
return systemConfig;
}
}
package com.tykj.dev.config.base;
import com.tykj.dev.config.domin.SystemConfig;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 装备列装性质枚举
*/
@AllArgsConstructor
public enum DeviceNature {
/**
* 指令型
*/
NATURE_1(1, "指令型"),
/**
* 指导型
*/
NATURE_2(2, "指导型"),
/**
* 专项型
*/
NATURE_3(3, "专项型");
public Integer id;
public String name;
public SystemConfig toDo(){
SystemConfig systemConfig = new SystemConfig();
systemConfig.setValue(id);
systemConfig.setLabel(name);
systemConfig.setChineseName("列装性质");
systemConfig.setEnglishName("nature");
return systemConfig;
}
}
package com.tykj.dev.config.base;
import com.tykj.dev.config.domin.SystemConfig;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 装备形态枚举
*/
@AllArgsConstructor
public enum DeviceStyle {
/**
* 密码机
*/
STYLE_1(1, "密码机"),
/**
* 密码模块
*/
STYLE_2(2, "密码模块"),
/**
* 密码芯片
*/
STYLE_3(3, "密码芯片"),
/**
* 说明书
*/
STYLE_4(4, "说明书"),
/**
* U盘
*/
STYLE_5(5, "U盘"),
/**
* 光盘
*/
STYLE_6(6, "光盘"),
/**
* 密码软件
*/
STYLE_7(7, "密码软件"),
/**
* 密码卡
*/
STYLE_8(8, "密码卡");
public Integer id;
public String name;
public SystemConfig toDo(){
SystemConfig systemConfig = new SystemConfig();
systemConfig.setValue(id);
systemConfig.setLabel(name);
systemConfig.setChineseName("形态");
systemConfig.setEnglishName("style");
return systemConfig;
}
}
package com.tykj.dev.config.base;
import com.tykj.dev.config.domin.SystemConfig;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 职务枚举
*/
@AllArgsConstructor
public enum Position {
/**
* 干事
*/
POSITION_0(0, "干事"),
/**
* 领导
*/
POSITION_1(1, "领导");
public Integer id;
public String name;
public SystemConfig toDo(){
SystemConfig systemConfig = new SystemConfig();
systemConfig.setValue(id);
systemConfig.setLabel(name);
systemConfig.setChineseName("职务");
systemConfig.setEnglishName("position");
return systemConfig;
}
}
package com.tykj.dev.config.controller;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.repository.SystemConfigDao;
import com.tykj.dev.config.service.SystemConfigService;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.config.vo.ConfigUpdateVo;
import com.tykj.dev.config.vo.ConfigVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.groupingBy;
/**
* @author dengdiyi
*/
@RestController
@RequestMapping(value = "/config")
@AutoDocument
@Api(tags = "系统配置模块", description = "配置接口")
@Slf4j
public class ConfigController {
@Autowired
private SystemConfigService systemConfigService;
@Autowired
private SystemConfigDao systemConfigDao;
@ApiOperation(value = "添加系统配置变量值", notes = "添加系统配置变量值")
@PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity add(@RequestBody @Validated ConfigVo configVo) {
return ResponseEntity.ok(systemConfigService.add(configVo.toDo()));
}
@ApiOperation(value = "更新系统配置变量值", notes = "更新系统配置变量值")
@PostMapping(value = "/update")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity update(@RequestBody @Validated ConfigUpdateVo configUpdateVo) {
SystemConfig systemConfig = systemConfigService.getOne(configUpdateVo.getId());
systemConfig.setLabel(configUpdateVo.getLabel());
return ResponseEntity.ok(systemConfigService.update(systemConfig));
}
@ApiOperation(value = "删除系统配置变量", notes = "删除系统配置变量值")
@PostMapping(value = "/delete/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity delete(@PathVariable("id") int id) {
systemConfigService.delete(id);
return ResponseEntity.ok("删除成功");
}
@ApiOperation(value = "查询系统配置变量", notes = "查询系统配置变量值")
@GetMapping(value = "/select")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity select() {
Map<String, List<SystemConfig>> map = systemConfigDao.findAllByDeleteTag(0).stream().collect(groupingBy(SystemConfig::getChineseName));
// Map<String,List<String>> resultMap = new HashMap<>();
// for (String s:map.keySet()) {
// resultMap.put(s,map.get(s).stream().map(SystemConfig::getLabel).collect(Collectors.toList()));
// }
return ResponseEntity.ok(map);
}
}
package com.tykj.dev.config.domin;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
/**
* 系统配置表实体类
* @author dengdiyi
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update system_config set delete_tag = 1 where id = ?")
@ApiModel("系统配置表")
public class SystemConfig extends BaseEntity {
@ApiModelProperty(value = "英文变量名")
private String englishName;
@ApiModelProperty(value = "中文变量名")
private String chineseName;
@ApiModelProperty(value = "变量值")
private Integer value;
@ApiModelProperty(value = "变量值显示名")
private String label;
}
package com.tykj.dev.config.repository;
import com.tykj.dev.config.domin.SystemConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
public interface SystemConfigDao extends JpaRepository<SystemConfig,Integer>, JpaSpecificationExecutor<SystemConfig> {
List<SystemConfig> findAllByEnglishName(String name);
List<SystemConfig> findAllByDeleteTag(Integer deleteTag);
}
package com.tykj.dev.config.service;
import com.tykj.dev.config.domin.SystemConfig;
/**
* @author dengdiyi
*/
public interface SystemConfigService {
SystemConfig add(SystemConfig systemConfig);
SystemConfig update(SystemConfig systemConfig);
void delete(Integer id);
Integer getMaxValue(String englishName);
SystemConfig getOne(Integer id);
}
package com.tykj.dev.config.service.impl;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.repository.SystemConfigDao;
import com.tykj.dev.config.service.SystemConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
@Service
public class SystemConfigServiceImpl implements SystemConfigService {
@Autowired
SystemConfigDao systemConfigDao;
@Override
public SystemConfig add(SystemConfig systemConfig) {
return systemConfigDao.save(systemConfig);
}
@Override
public SystemConfig update(SystemConfig systemConfig) {
return systemConfigDao.save(systemConfig);
}
@Override
public void delete(Integer id) {
systemConfigDao.deleteById(id);
}
@Override
public Integer getMaxValue(String englishName) {
List<SystemConfig> systemConfigs = systemConfigDao.findAllByEnglishName(englishName);
if (systemConfigs.size()>0) {
return systemConfigs.stream().max(Comparator.comparing(SystemConfig::getValue)).get().getValue();
}
else {
return null;
}
}
@Override
public SystemConfig getOne(Integer id) {
return systemConfigDao.findById(id).get();
}
}
package com.tykj.dev.config.task;
import com.tykj.dev.config.base.*;
import com.tykj.dev.config.repository.SystemConfigDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SystemConfigRun implements CommandLineRunner {
@Autowired
private SystemConfigDao systemConfigDao;
/**
* Callback used to run the bean.
*
* @param args incoming main method arguments
* @throws Exception on error
*/
@Override
public void run(String... args) throws Exception {
if (systemConfigDao.findAll().size()==0){
for (DeviceInvisibleRange d:DeviceInvisibleRange.values()) {
systemConfigDao.save(d.toDo());
}
for (DeviceLifeStatus d:DeviceLifeStatus.values()) {
systemConfigDao.save(d.toDo());
}
for (DeviceSecretLevel d:DeviceSecretLevel.values()) {
systemConfigDao.save(d.toDo());
}
for (MatchingRange d:MatchingRange.values()) {
systemConfigDao.save(d.toDo());
}
for (StorageType d:StorageType.values()) {
systemConfigDao.save(d.toDo());
}
for (DeviceApplyType d:DeviceApplyType.values()) {
systemConfigDao.save(d.toDo());
}
for (DeviceNature d:DeviceNature.values()) {
systemConfigDao.save(d.toDo());
}
for (DeviceStyle d:DeviceStyle.values()) {
systemConfigDao.save(d.toDo());
}
for (Position d:Position.values()) {
systemConfigDao.save(d.toDo());
}
}
}
}
package com.tykj.dev.config.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("配置变量更新类")
public class ConfigUpdateVo {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "变量值显示名")
private String label;
}
......@@ -34,6 +34,10 @@
<artifactId>annotations</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-packing</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -33,4 +33,10 @@ public class DeviceInLibVo {
* 0缺失1无误2新增3不在库9未检查
*/
private int proofResult;
private int applyType;
private int style;
private int secretLevel;
}
......@@ -35,4 +35,10 @@ public class DeviceNotInLibVo {
private int status;
private int applyType;
private int style;
private int secretLevel;
}
......@@ -9,6 +9,8 @@ import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat;
import com.tykj.dev.device.confirmcheck.entity.vo.*;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.domin.Task;
......@@ -69,6 +71,9 @@ public class ObjTransUtil {
@Resource(name = "unMap")
private Map<String, AreaUnit> unMap;
@Autowired
private PackingLibraryService packingLibraryService;
/**
* 装备转化为初始化的装备统计类
......@@ -303,6 +308,7 @@ public class ObjTransUtil {
}
public DeviceInLibVo toCheckInLibVo(DeviceLibrary device, int proofResult) {
PackingLibrary packingLibrary = packingLibraryService.getOne(device.getPackingId());
return new DeviceInLibVo(
device.getId(),
device.getModel(),
......@@ -311,11 +317,15 @@ public class ObjTransUtil {
device.getProdNumber(),
device.getRfidSurfaceId(),
device.getRfidCardId(),
proofResult
proofResult,
packingLibrary.getApplyType(),
packingLibrary.getStyle(),
device.getSecretLevel()
);
}
public DeviceNotInLibVo toCheckNotInLibVo(DeviceLibrary device) {
PackingLibrary packingLibrary = packingLibraryService.getOne(device.getPackingId());
return new DeviceNotInLibVo(
device.getId(),
device.getModel(),
......@@ -326,7 +336,10 @@ public class ObjTransUtil {
device.getRfidCardId(),
device.getLocationUnit(),
device.getOwnUnit(),
device.getLifeStatus()
device.getLifeStatus(),
packingLibrary.getApplyType(),
packingLibrary.getStyle(),
device.getSecretLevel()
);
}
}
......
......@@ -158,7 +158,7 @@ public class DeviceDestroyController {
destroyBill.getDestroyFileName(),
destroyBill.getDestroyFileUrl(),
docNumber,
destroyBill.getCreateTime(),
destroyBill.getDestroyTime(),
destroyBill.getUndertaker(),
destroyBill.getLeader(),
destroyBill.getSupervisor(),
......
......@@ -158,6 +158,10 @@ public class DeviceDestroyBill {
@ApiModelProperty(value = "区块链记录id")
private String recordId;
@ApiModelProperty(value = "区块链记录id")
@Transient
private String num;
public DeviceDestroyBill(Integer startUserAId, Integer startUserBId, Integer destroyStatus, String fileName, String fileUrl, String supervisor, String leader, String undertaker, String userA, String destroyDeviceDetail) {
this.startUserAId = startUserAId;
this.startUserBId = startUserBId;
......
......@@ -79,6 +79,9 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
public Page<DeviceDestroyBill> getPage(DeviceDestroyBillSelectVo deviceDestoryBillSelectVo, Pageable pageable) {
Page<DeviceDestroyBill> page = deviceDestroyBillDao.findAll(getSelectSpecification(deviceDestoryBillSelectVo), deviceDestoryBillSelectVo.getPageable());
for (DeviceDestroyBill d : page.getContent()) {
if (d.getDocNumber()!=null){
d.setNum(makeDocNumber(d));
}
d.setUserA(userService.getOne(d.getStartUserAId()).getName());
List<Integer> list = StringSplitUtil.split(d.getDestroyDeviceDetail());
Set<String> nameSet = new HashSet<>();
......@@ -129,7 +132,7 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
// 如果有数据则取第一个
if (all.size() != 0) {
DeviceDestroyBill deviceDestoryBillEntity = all.get(0);
return deviceDestoryBillEntity.getDocNumber();
return deviceDestoryBillEntity.getDocNumber()+1;
} else {
// 如果没有则取1
return 1;
......@@ -170,4 +173,15 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
predicateBuilder.in("destroyStatus", 2);
return predicateBuilder.build();
}
private String makeDocNumber(DeviceDestroyBill deviceDestroyBill) {
if (deviceDestroyBill.getDestroyTime() != null) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(deviceDestroyBill.getDestroyTime());
int year = calendar.get(Calendar.YEAR);
return "NO:第" + year + "XH" + deviceDestroyBill.getDocNumber() + "号";
} else {
return "";
}
}
}
......@@ -110,9 +110,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
resultList.addAll(d.getChilds());
}
}
if (deviceLibrarySelectVo.getContent()!=null){
resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
}
// if (deviceLibrarySelectVo.getContent()!=null){
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
// }
return resultList;
}
//areId不为空,查询某个区域下的所有单位的所有装备
......@@ -134,9 +134,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
resultList.addAll(d.getChilds());
}
}
if (deviceLibrarySelectVo.getContent()!=null){
resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
}
// if (deviceLibrarySelectVo.getContent()!=null){
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
// }
return resultList;
}
//省能看到所有装备
......@@ -149,9 +149,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
resultList.addAll(d.getChilds());
}
}
if (deviceLibrarySelectVo.getContent()!=null){
resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
}
// if (deviceLibrarySelectVo.getContent()!=null){
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
// }
return resultList;
} else {
throw new ApiException(ResultUtil.failed("区域等级只能为1,2,3"));
......
package com.tykj.dev.device.library.subject.domin;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.device.library.subject.vo.DeviceVo;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel;
......@@ -235,23 +234,23 @@ public class DeviceLibrary {
return mapper.map(this, DeviceVo.class);
}
public String getKeyWords(){
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(this.model);
stringBuffer.append("Ǒ");
stringBuffer.append(this.name);
stringBuffer.append("Ǒ");
stringBuffer.append(this.seqNumber);
stringBuffer.append("Ǒ");
stringBuffer.append(this.rfidSurfaceId);
stringBuffer.append("Ǒ");
stringBuffer.append(this.locationUnit);
stringBuffer.append("Ǒ");
stringBuffer.append(this.ownUnit);
stringBuffer.append("Ǒ");
stringBuffer.append(GlobalMap.getDeviceLifeStatusMap().get(this.lifeStatus).name);
stringBuffer.append("Ǒ");
stringBuffer.append(this.record);
return stringBuffer.toString();
}
// public String getKeyWords(){
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append(this.model);
// stringBuffer.append("Ǒ");
// stringBuffer.append(this.name);
// stringBuffer.append("Ǒ");
// stringBuffer.append(this.seqNumber);
// stringBuffer.append("Ǒ");
// stringBuffer.append(this.rfidSurfaceId);
// stringBuffer.append("Ǒ");
// stringBuffer.append(this.locationUnit);
// stringBuffer.append("Ǒ");
// stringBuffer.append(this.ownUnit);
// stringBuffer.append("Ǒ");
// stringBuffer.append(GlobalMap.getDeviceLifeStatusMap().get(this.lifeStatus).name);
// stringBuffer.append("Ǒ");
// stringBuffer.append(this.record);
// return stringBuffer.toString();
// }
}
......@@ -6,6 +6,7 @@ import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.TaskBeanConfig;
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.Script;
......@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -50,6 +52,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private DeviceLibraryDao deviceLibraryDao;
@Override
public PackingLibrary addEntity(PackingLibrary packingLibraryEntity) {
PackingLibrary packingLibrary = packingLibraryDao.save(packingLibraryEntity);
......@@ -228,6 +233,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override
public void deleteAll(Integer id) {
PackingLibrary packingLibrary = getOne(id);
if (deviceLibraryDao.getAllByPackingId(id).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号已有装备,请进行退装操作"));
}
if (packingLibrary.getIsRoot()==1) {
Integer order = packingLibrary.getShowOrder();
getInsertList(new SelectPack()).forEach(packingLibrary1 -> {
......@@ -240,7 +248,12 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
List<Integer> ids = packingLibraryDao.findAllByPartParentId(id).stream().map(PackingLibrary::getId).collect(Collectors.toList());
delete(id);
if (ids.size()>0){
ids.forEach(this::deleteAll);
ids.forEach(integer -> {
if (deviceLibraryDao.getAllByPackingId(integer).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号已有装备,请进行退装操作"));
}
deleteAll(integer);
});
}
}
......
......@@ -62,7 +62,7 @@ public class PackingLibraryUpdateVo {
@ApiModelProperty(value = "创建单位", example = "测试创建单位")
private String createUnit;
@NotNull(message = "price不能为空")
// @NotNull(message = "price不能为空")
@ApiModelProperty(value = "价格", example = "2.000.000")
private String price;
......
......@@ -4,9 +4,12 @@ import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.service.RepairBackBillService;
import com.tykj.dev.device.repair.service.RepairBillService;
import com.tykj.dev.device.repair.service.RepairDetailService;
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;
......@@ -43,9 +46,15 @@ public class RepairBillSelectController {
@Autowired
private RepairBillService repairBillService;
@Autowired
private RepairBackBillService repairBackBillService;
@Autowired
private RepairSendBillDao repairSendBillDao;
@Autowired
private RepairDetailDao repairDetailDao;
@Autowired
private DeviceLibraryService deviceLibraryService;
......@@ -102,6 +111,12 @@ public class RepairBillSelectController {
return ResultUtil.success(repairBillService.getPage(repairBillSelectVo, repairBillSelectVo.getPageable()));
}
@ApiOperation(value = "查询领取单", notes = "可以通过这个接口查询领取单")
@PostMapping(value = "/archives/repairBack/summary")
public ResponseEntity selectRepairBackBill(@RequestBody RepairBillSelectVo repairBillSelectVo) {
return ResultUtil.success(repairBackBillService.getPage(repairBillSelectVo, repairBillSelectVo.getPageable()));
}
@ApiOperation(value = "查询维修单详情", notes = "可以通过这个接口查询维修单详情")
@GetMapping(value = "/archives/repair/detail/{id}")
public ResponseEntity selectRepairBillDetail(@PathVariable("id") int id) {
......@@ -140,6 +155,41 @@ public class RepairBillSelectController {
return ResponseEntity.ok(list);
}
@ApiOperation(value = "查询领取单详情", notes = "可以通过这个接口查询领取单详情")
@GetMapping(value = "/archives/repairBack/detail/{id}")
public ResponseEntity selectRepairBackBillDetail(@PathVariable("id") int id) {
List<Object> list = new ArrayList<>();
//获取维修单
RepairBackBill repairBackBill = repairBackBillService.getOne(id);
list.add(repairBackBill);
repairBackBill.setSendFileList(FilesUtil.stringFileToList(repairBackBill.getSendFiles()));
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
if (repairBackBill.getBackCheckDetail() != null) {
String[] strings1 = repairBackBill.getBackCheckDetail().split("x");
for (String s : strings1) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer deviceId = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceId);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraries.add(deviceLibraryEntity);
}
}
}
//获取维修详情
List<RepairDetail> repairDetails = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
//设置装备备注
deviceLibraries.forEach(deviceLibrary -> {
for (RepairDetail r : repairDetails) {
if (r.getDeviceId().equals(deviceLibrary.getId())) {
deviceLibrary.setRemark(r.getRemark());
}
}
});
list.add(deviceLibraries);
return ResponseEntity.ok(list);
}
/**
* @param repairBillId 维修单id
* @return 维修详情列表
......
......@@ -2,6 +2,9 @@ package com.tykj.dev.device.repair.service;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
......@@ -13,4 +16,6 @@ public interface RepairBackBillService extends RepairPublicService<RepairBackBil
* @param repairBackBills 异步上链
*/
void sendHash(List<RepairBackBill> repairBackBills);
Page<RepairBackBill> getPage(RepairBillSelectVo deviceRepairBillSelectVo, Pageable pageable);
}
package com.tykj.dev.device.repair.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.repair.repository.RepairBackBillDao;
import com.tykj.dev.device.repair.service.RepairBackBillService;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
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.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
......@@ -32,6 +41,9 @@ public class RepairBackBillServiceImpl implements RepairBackBillService {
@Autowired
BlockChainUtil blockChainUtil;
@Autowired
UserUtils userUtils;
@Override
public RepairBackBill save(RepairBackBill deviceRepairBackBillEntity) {
RepairBackBill repairBackBill = deviceRepairBackBillDao.save(deviceRepairBackBillEntity);
......@@ -90,4 +102,44 @@ public class RepairBackBillServiceImpl implements RepairBackBillService {
update(repairBackBill);
});
}
@Override
public Page<RepairBackBill> getPage(RepairBillSelectVo deviceRepairBillSelectVo, Pageable pageable) {
return deviceRepairBackBillDao.findAll(getSelectSpecification(deviceRepairBillSelectVo), pageable);
}
private Specification<RepairBackBill> getSelectSpecification(RepairBillSelectVo deviceRepairBillSelectVo) {
PredicateBuilder<RepairBackBill> predicateBuilder = Specifications.and();
PredicateBuilder<RepairBackBill> predicateBuilder1 = Specifications.or();
predicateBuilder1.eq("sendUnit", userUtils.getCurrentUserUnitName());
predicateBuilder1.eq("receiveUnit", userUtils.getCurrentUserUnitName());
predicateBuilder.predicate(predicateBuilder1.build());
if (deviceRepairBillSelectVo != null) {
if (deviceRepairBillSelectVo.getReceiveUnit() != null) {
predicateBuilder.eq("receiveUnit", deviceRepairBillSelectVo.getReceiveUnit());
}
if (deviceRepairBillSelectVo.getSendUnit() != null) {
predicateBuilder.eq("sendUnit", deviceRepairBillSelectVo.getSendUnit());
}
if (deviceRepairBillSelectVo.getContent() != null) {
Class<RepairBackBill> deviceRepairBillEntityClass = RepairBackBill.class;
Field[] declaredFields = deviceRepairBillEntityClass.getDeclaredFields();
PredicateBuilder<RepairBackBill> p = Specifications.or();
for (Field field : declaredFields) {
if (field.getType().equals(String.class) && field.getAnnotation(Transient.class) == null) {
p.like(field.getName(), "%" + deviceRepairBillSelectVo.getContent() + "%");
}
}
predicateBuilder.predicate(p.build());
}
if (deviceRepairBillSelectVo.getStartTime() != null) {
predicateBuilder.gt("createTime", deviceRepairBillSelectVo.getStartTime());
}
if (deviceRepairBillSelectVo.getEndTime() != null) {
predicateBuilder.lt("createTime", deviceRepairBillSelectVo.getEndTime());
}
}
// predicateBuilder.eq("repairStatus", 5);
return predicateBuilder.build();
}
}
......@@ -37,7 +37,7 @@ public class RepairDetailServiceImpl implements RepairDetailService {
RepairDetail repairDetail = deviceRepairDetailDao.save(deviceRepairDetailEntity);
CompletableFuture.runAsync(()->{
RepairDetail repairDetail1 = getOne(repairDetail.getId());
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(getOne(repairDetail.getId())));
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairDetail1));
String recordId = bcText.getData().getRecordID();
repairDetail1.setRecordId(recordId);
deviceRepairDetailDao.save(repairDetail1);
......
......@@ -44,7 +44,7 @@ public class RepairSendBillServiceImpl implements RepairSendBillService {
RepairSendBill repairSendBill = deviceRepairSendBillDao.save(deviceRepairSendBillEntity);
CompletableFuture.runAsync(()->{
RepairSendBill repairSendBill1 = getOne(repairSendBill.getId());
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(getOne(repairSendBill.getId())));
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairSendBill1));
String recordId = bcText.getData().getRecordID();
repairSendBill1.setRecordId(recordId);
deviceRepairSendBillDao.save(repairSendBill1);
......
package com.tykj.dev.device.repair.subject.domin;
import com.tykj.dev.device.file.entity.FileRet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -12,7 +13,9 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* entity class for repair_back_bill
......@@ -236,4 +239,7 @@ public class RepairBackBill {
@Column(name = "send_files",columnDefinition = "TEXT")
private String sendFiles;
@Transient
private List<FileRet> sendFileList = new ArrayList<>();
}
......@@ -113,7 +113,7 @@ public class DeviceScrapController {
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起报废",null);
deviceLogService.addLog(deviceLogDto);
}
return ResponseEntity.ok(taskBto.getBillId());
return selectRepairBill1(taskBto.getBillId());
}
@ApiOperation(value = "上传报废单", notes = "上传报废单")
......
......@@ -755,7 +755,13 @@ public class TaskServiceImpl implements TaskService {
long time = System.currentTimeMillis() - taskUserVo.getUpdateTime().getTime();
int day = new Long(time / 86_400_000).intValue();
int hour = new Long((time % 86_400_000) / 3_600_000).intValue();
taskUserVo.setTrackingTime(day + "天" + hour + "小时");
if (day==0){
taskUserVo.setTrackingTime(hour + "小时");
}
else {
taskUserVo.setTrackingTime(day + "天");
}
// taskUserVo.setTrackingTime(day + "天" + hour + "小时");
taskUserVo.setTrackingTimeDate(new Date(time));
}
//set跟踪时间
......@@ -768,7 +774,13 @@ public class TaskServiceImpl implements TaskService {
long time = System.currentTimeMillis() - taskUserVo.getCreateTime().getTime();
int day = new Long(time / 86_400_000).intValue();
int hour = new Long((time % 86_400_000) / 3_600_000).intValue();
taskUserVo.setUserTime(day + "天" + hour + "小时");
if (day==0){
taskUserVo.setUserTime(hour + "小时");
}
else {
taskUserVo.setUserTime(day + "天");
}
// taskUserVo.setUserTime(day + "天" + hour + "小时");
taskUserVo.setUserTimeDate(new Date(time));
// }
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论