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

feat(日常检查模块): 新增众多接口

新增众多接口
上级 9151c603
package com.tykj.dev.device.selfcheck.repository;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDailyDeviceBill;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zsp
* @create 2022/5/23 9:22
*/
public interface HistoryDailyDeviceBillDao extends JpaRepository<HistoryDailyDeviceBill,Integer>, JpaSpecificationExecutor<HistoryDailyDeviceBill> {
/**
* 根据业务id和业务类型查询
* @param billId 业务id
* @return 实体对象
*/
List<HistoryDailyDeviceBill> findAllByBillId(Integer billId);
}
package com.tykj.dev.device.selfcheck.repository;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zsp
* @create 2022/5/23 9:22
*/
public interface HistoryDeviceBillDao extends JpaRepository<HistoryDeviceBill,Integer>, JpaSpecificationExecutor<HistoryDeviceBill> {
/**
* 根据业务id和业务类型查询
* @param billId 业务id
* @return 实体对象
*/
List<HistoryDeviceBill> findAllByBillId(Integer billId);
}
package com.tykj.dev.device.selfcheck.service;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import java.util.List;
/**
* @author zsp
* @create 2022/5/23 14:57
*/
public interface HistoryDailyDeviceBillService {
/**
* 批量保存
* @param historyDeviceBillList historyDeviceBillList
*/
void batchSave(List<HistoryDeviceBill> historyDeviceBillList);
/**
* 根据业务id和业务类型查询
* @param billId 业务id
* @return 实体对象
*/
List<HistoryDeviceBill> selectByBillId(Integer billId);
}
package com.tykj.dev.device.selfcheck.service;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import java.util.List;
/**
* @author zsp
* @create 2022/5/23 14:57
*/
public interface HistoryDeviceBillService {
/**
* 批量保存
* @param historyDeviceBillList historyDeviceBillList
*/
void batchSave(List<HistoryDeviceBill> historyDeviceBillList);
/**
* 根据业务id和业务类型查询
* @param billId 业务id
* @return 实体对象
*/
List<HistoryDeviceBill> selectByBillId(Integer billId);
}
package com.tykj.dev.device.selfcheck.service.impl;
import com.tykj.dev.device.selfcheck.service.HistoryDailyDeviceBillService;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zsp
* @create 2022/5/23 16:18
*/
@Service
public class HistoryDailyDeviceBillServiceImpl implements HistoryDailyDeviceBillService {
@Override
public void batchSave(List<HistoryDeviceBill> historyDeviceBillList) {
}
@Override
public List<HistoryDeviceBill> selectByBillId(Integer billId) {
return null;
}
}
package com.tykj.dev.device.selfcheck.service.impl;
import com.tykj.dev.device.selfcheck.repository.HistoryDeviceBillDao;
import com.tykj.dev.device.selfcheck.service.HistoryDeviceBillService;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zsp
* @create 2022/5/23 14:58
*/
@Service
public class HistoryDeviceBillServiceImpl implements HistoryDeviceBillService {
@Resource
private HistoryDeviceBillDao historyDeviceBillDao;
@Override
public void batchSave(List<HistoryDeviceBill> historyDeviceBillList) {
historyDeviceBillDao.saveAll(historyDeviceBillList);
}
@Override
public List<HistoryDeviceBill> selectByBillId(Integer billId) {
return historyDeviceBillDao.findAllByBillId(billId);
}
}
......@@ -38,11 +38,7 @@ public class DailyCheckBill {
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
/**
* 自查周期(1:月度,2:季度,3:年度,0:未设定周期)
*/
@ApiModelProperty(value = "自查周期(1:月度,2:季度,3:年度,0:未设定周期)")
private Integer cycle;
/**
* 自查标题
*/
......
package com.tykj.dev.device.selfcheck.subject.domin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
/**
* @author zsp
* @create 2022/5/23 14:37
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@ApiModel("存放日常检查历史设备单据表")
public class HistoryDailyDeviceBill {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
/**
* 装备id
*/
@ApiModelProperty(value = "装备id")
private Integer deviceId;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* 装备名称
*/
@ApiModelProperty(value = "装备名称")
private String name;
/**
* 装备序列号
*/
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* rfid卡号
*/
@ApiModelProperty(value = "rfid卡号")
private String rfidCardId;
/**
* 所在单位
*/
@ApiModelProperty(value = "所在单位")
private String locationUnit;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
/**
* 设备的状态
*/
@ApiModelProperty(value = "设备的状态",example = "0 缺失 1 正常 2 新增")
private Integer deviceStatus;
@ApiModelProperty(value = "业务id")
private Integer billId;
}
package com.tykj.dev.device.selfcheck.subject.domin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
/**
* @author zsp
* @create 2022/5/23 14:37
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@ApiModel("存放历史设备单据表")
public class HistoryDeviceBill {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
/**
* 装备id
*/
@ApiModelProperty(value = "装备id")
private Integer deviceId;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* 装备名称
*/
@ApiModelProperty(value = "装备名称")
private String name;
/**
* 装备序列号
*/
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* rfid卡号
*/
@ApiModelProperty(value = "rfid卡号")
private String rfidCardId;
/**
* 所在单位
*/
@ApiModelProperty(value = "所在单位")
private String locationUnit;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
/**
* 设备的状态
*/
@ApiModelProperty(value = "设备的状态",example = "0 缺失 1 正常 2 新增")
private Integer deviceStatus;
@ApiModelProperty(value = "业务id")
private Integer billId;
}
......@@ -56,9 +56,18 @@ public class SelfCheckSaveVo {
@ApiModelProperty(name = "自查详情", example = "10x21x", value = "自查详情(装备主键id+核对结果(0缺失1无误2新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增")
private String checkDetail;
@ApiModelProperty(name = "自查详情 1 正常")
private List<DeviceLibrary> checkDeviceList1;
@ApiModelProperty(name = "自查详情 0 缺失")
private List<DeviceLibrary> checkDeviceList0;
@ApiModelProperty(name = "新增未记录装备RFID列表")
private List<String> newDeviceList;
@ApiModelProperty(name = "新增未记录装备RFID列表")
private List<DeviceLibrary> newDeviceLibraryList;
@ApiModelProperty(value = "检查附件名")
private List<FileRet> checkFiles;
......
......@@ -26,7 +26,9 @@ import com.tykj.dev.device.repair.service.RepairBackBillService;
import com.tykj.dev.device.repair.service.RepairBillService;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.selfcheck.service.HistoryDeviceBillService;
import com.tykj.dev.device.selfcheck.service.SelfCheckBillService;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.storage.service.StorageBillService;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
......@@ -37,6 +39,7 @@ import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.taskselect.vo.SignatureSaveVo;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
......@@ -117,6 +120,9 @@ public class TaskSelectController {
@Autowired
private TaskDao taskDao;
@Resource
private HistoryDeviceBillService historyDeviceBillService;
// @Autowired
// private ReadMachineBillService readMachineBillService;
//
......@@ -307,7 +313,9 @@ public class TaskSelectController {
}
selfExaminationBillEntity.setCheckFileList(FilesUtil.stringFileToList(selfExaminationBillEntity.getCheckFiles()));
list.add(selfExaminationBillEntity);
String str3 = selfExaminationBillEntity.getCheckDetail();
String str4 = selfExaminationBillEntity.getNewDeviceDetail();
String[] split;
if (str3!=null) {
......@@ -332,23 +340,32 @@ public class TaskSelectController {
newDeviceList.add(d);
}
}
//添加新增的
list.add(newDeviceList);
}
if (str4 == null) {
List<DeviceLibrary> newDeviceList = new ArrayList<>();
list.add(newDeviceList);
}
// if (str4 == null) {
// List<DeviceLibrary> newDeviceList = new ArrayList<>();
// list.add(newDeviceList);
// }
List<DeviceLibrary> libraryEntities1 = new ArrayList<>();
for (String s : split) {
if (s.length() >= 2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryMap.get(id);
deviceLibraryEntity.setCheckResult(checkResult);
libraryEntities1.add(deviceLibraryEntity);
}
}
list.add(libraryEntities1);
// for (String s : split) {
// if (s.length() >= 2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
// DeviceLibrary deviceLibraryEntity = deviceLibraryMap.get(id);
// deviceLibraryEntity.setCheckResult(checkResult);
// libraryEntities1.add(deviceLibraryEntity);
// }
// }
List<HistoryDeviceBill> historyDeviceBillList =
historyDeviceBillService.selectByBillId(billId);
//过滤出1的
List<HistoryDeviceBill> billList1 =
historyDeviceBillList.stream().filter(historyDeviceBill -> historyDeviceBill.getDeviceStatus() == 1)
.collect(Collectors.toList());
// list.add(libraryEntities1);
list.add(billList1);
if (selfExaminationBillEntity.getUnStockDetail()!=null){
list.add(JacksonUtil.readValue(selfExaminationBillEntity.getUnStockDetail(), new TypeReference<List<DeviceLibrary>>() {
}));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论