Browse Source

1.对接第三方密集架接口

2.bug修改
3.优化部分功能
master
xia 2 years ago
parent
commit
8d8ca052f4
  1. 65
      archives/src/main/java/com/storeroom/modules/archives/controller/CallExternalController.java
  2. 30
      archives/src/main/java/com/storeroom/modules/archives/controller/ExternalArchives1Controller.java
  3. 8
      archives/src/main/java/com/storeroom/modules/archives/controller/ExternalArchivesController.java
  4. 56
      archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java
  5. 1
      archives/src/main/java/com/storeroom/modules/archives/domain/vo/StorageDetailesVO.java
  6. 6
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java
  7. 13
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java
  8. 2
      archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java
  9. 5
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java
  10. 53
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
  11. 3
      archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java
  12. 2
      archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java
  13. 5
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java
  14. 4
      storeroom/src/main/java/com/storeroom/modules/device/repository/StoreroomRepository.java
  15. 2
      storeroom/src/main/java/com/storeroom/modules/device/service/impl/StoreroomImpl.java
  16. 13
      storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/DisplayConfigController.java
  17. 3
      storeroom/src/main/java/com/storeroom/modules/storeroom3d/repository/DisplayConfigRepository.java
  18. 2
      storeroom/src/main/java/com/storeroom/modules/storeroom3d/service/DisplayConfigService.java
  19. 22
      storeroom/src/main/java/com/storeroom/modules/storeroom3d/service/impl/DisplayConfigImpl.java

65
archives/src/main/java/com/storeroom/modules/archives/controller/CallExternalController.java

@ -28,7 +28,7 @@ public class CallExternalController {
@ApiOperation("打开架体具体某一列")
@GetMapping("/openCol")
public ApiResponse<Object> openCol(
public Object openCol(
String deviceId,Integer quNo, Integer colNo,Integer leNo, Integer divNo,Integer zyNo
){
String retust = "";
@ -48,18 +48,20 @@ public class CallExternalController {
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/OpenCol",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/OpenCol",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/OpenCol",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
@ApiOperation("打开档案所在位置")
@GetMapping("/findFiles")
public ApiResponse<Object> findFiles(
public Object findFiles(
String deviceId,String fileName,String storeCode,Integer quNo, Integer colNo,Integer leNo, Integer divNo,Integer zyNo,String position,Integer type
){
String retust = "";
@ -79,110 +81,121 @@ public class CallExternalController {
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/findFiles",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/findFiles",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/findFiles",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
@ApiOperation("获取密集架实时状态")
@GetMapping("/reportStatus")
public ApiResponse<Object> reportStatus(
public Object reportStatus(
String deviceId,String StoreCode,Integer quNo
){
String retust = "";
DeviceInfoDto device = deviceService.findById(deviceId);
JSONObject json = new JSONObject();
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("StoreCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("QuNo",quNo);
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/ReportStatus",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/ReportStatus",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/ReportStatus",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
@ApiOperation("停止移动")
@GetMapping("/stopMove")
public ApiResponse<Object> stopMove(
public Object stopMove(
String deviceId,String StoreCode,Integer quNo
){
String retust = "";
DeviceInfoDto device = deviceService.findById(deviceId);
JSONObject json = new JSONObject();
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("StoreCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("QuNo",quNo);
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/StopMove",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/StopMove",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/StopMove",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
@ApiOperation("密集架通风")
@GetMapping("/vent")
public ApiResponse<Object> vent(
public Object vent(
String deviceId,String StoreCode,Integer quNo
){
String retust = "";
DeviceInfoDto device = deviceService.findById(deviceId);
JSONObject json = new JSONObject();
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("StoreCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("QuNo",quNo);
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Vent",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Vent",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/Vent",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
@ApiOperation("密集架合架")
@GetMapping("/reset")
public ApiResponse<Object> reset(
public Object reset(
String deviceId,String StoreCode,Integer quNo
){
String retust = "";
DeviceInfoDto device = deviceService.findById(deviceId);
JSONObject json = new JSONObject();
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("StoreCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json.put("QuNo",quNo);
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Reset",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Reset",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/Reset",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
@ApiOperation("公告下发")
@GetMapping("/getNotice")
public ApiResponse<Object> getNotice(
public Object getNotice(
String deviceId,String notice
){
String retust = "";
@ -193,13 +206,15 @@ public class CallExternalController {
try {
HashMap<String, String> map = new HashMap<>();
map.put("Content-type", "application/json");
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/getNotice",
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/getNotice",
// "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/getNotice",
"POST", map, null, json.toJSONString());
retust = EntityUtils.toString(response.getEntity());
}catch (Exception e){
retust = "连接失败";
}
return ApiResponse.success(retust);
return retust;
}
}

30
archives/src/main/java/com/storeroom/modules/archives/controller/ExternalArchives1Controller.java

@ -0,0 +1,30 @@
package com.storeroom.modules.archives.controller;
import com.storeroom.annotaion.rest.AnonymousPostMapping;
import com.storeroom.modules.archives.service.ArchivesService;
import com.storeroom.modules.archives.service.dto.ArchivesExternalGetDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Api(tags = "外部接口-档案")
@RequestMapping("/api/ArchiverDetails")
public class ExternalArchives1Controller {
private final ArchivesService archivesService;
@ApiOperation("7.移动列查询档案数据")
@AnonymousPostMapping("/MoveColumnGetFiles")
public Object externalMoveColumnGetFiles(
@Validated @RequestBody ArchivesExternalGetDTO dto
){
return archivesService.externalMoveColumnGetFiles(dto);
}
}

8
archives/src/main/java/com/storeroom/modules/archives/controller/ExternalArchivesController.java

@ -74,14 +74,6 @@ public class ExternalArchivesController {
return archivesService.externalGetArchivesByZy(dto);
}
@ApiOperation("7.移动列查询档案数据")
@AnonymousPostMapping("/MoveColumnGetFiles")
public Object externalMoveColumnGetFiles(
@Validated @RequestBody ArchivesExternalGetDTO dto
){
return archivesService.externalMoveColumnGetFiles(dto);
}
@ApiOperation("8.上传密集架报警信息")
@AnonymousPostMapping("log")
public Object deseCabinetAlarmLog(@RequestBody AlarmDeseCaBinetLog alarmDeseCaBinetLog) {

56
archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java

@ -29,6 +29,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.data.domain.Pageable;
import org.springframework.validation.annotation.Validated;
@ -142,10 +143,16 @@ public class StorageController {
String[] shelf = thisCase.getFolderLocation().split("-");
JSONObject json = new JSONObject();
json.put("id",thisCase.getId());
json.put("type",1);
json.put("title",thisCase.getCaseName());
json.put("filebox",thisCase.getId());
json.put("filecode","");
json.put("position",thisCase.getFolderLocation());
json.put("title",thisCase.getCaseName());
json.put("type",1);
json.put("starttime","");
// json.put("filebox",thisCase.getId());
// json.put("editdate","");
// json.put("endtime","");
// json.put("filetype",thisCase.getCaseType());
JSONObject json1 = new JSONObject();
json1.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json1.put("quNo",shelf[0]);
@ -154,9 +161,11 @@ public class StorageController {
json1.put("divNo",shelf[3]);
json1.put("zyNo",shelf[4]);
json.put("positionKey",json1);
json.put("filetype",thisCase.getCaseType());
// String reselt = HttpUtil.wlwHttpURLConnection(url,json,null,null,null);
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Task", "POST", map, null, json.toJSONString());
System.out.println(json.toJSONString());
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Task", "POST", map, null, json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/Task", "POST", map, null, "{\"datas\":["+json.toJSONString()+"]}");
String retust = EntityUtils.toString(response.getEntity());
System.out.println(retust);
}else{
}
@ -201,21 +210,30 @@ public class StorageController {
// String url = "http://"+device.getDeviceIp()+":"+device.getDevicePort()+"IntelligentCabinetAPIServer/Task";
JSONObject json = new JSONObject();
json.put("id",caseId);
json.put("type",2);
json.put("title",thisCase.getCaseName());
json.put("filebox",caseId);
json.put("filecode","");
json.put("position",thisCase.getFolderLocation());
JSONObject json1 = new JSONObject();
json1.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
json1.put("quNo",shelf[0]);
json1.put("colNo",shelf[1]);
json1.put("leNo",shelf[2]);
json1.put("divNo",shelf[3]);
json1.put("zyNo",shelf[4]);
json.put("positionKey",json1);
json.put("filetype",thisCase.getCaseType());
json.put("title",thisCase.getCaseName());
json.put("type",2);
json.put("starttime","");
// json.put("filebox",thisCase.getId());
// json.put("editdate","");
// json.put("endtime","");
// json.put("filetype",thisCase.getCaseType());
JSONObject positionKey = new JSONObject();
positionKey.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode());
positionKey.put("quNo",shelf[0]);
positionKey.put("colNo",shelf[1]);
positionKey.put("leNo",shelf[2]);
positionKey.put("divNo",shelf[3]);
positionKey.put("zyNo",shelf[4]);
json.put("positionKey",positionKey);
// String reselt = HttpUtil.wlwHttpURLConnection(url,json,null,null,null);
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Task", "POST", map, null, json.toJSONString());
// HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Task", "POST", map, null, json.toJSONString());
System.out.println(json.toJSONString());
HttpResponse response = HttpUtils.doPost("https://y40495935z.oicp.vip", "/IntelligentCabinetAPIServer/Task", "POST", map, null, "{\"datas\":["+json.toJSONString()+"]}");
String retust = EntityUtils.toString(response.getEntity());
System.out.println(retust);
}else{
}

1
archives/src/main/java/com/storeroom/modules/archives/domain/vo/StorageDetailesVO.java

@ -14,5 +14,6 @@ public class StorageDetailesVO {
private ArchivesCase archivesCase;
private List<ArchivesSummary> archivesSummaries;
private List<ArchivesSummary> archivesBasics;
}

6
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java

@ -95,6 +95,12 @@ public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, Stri
value = "select ac.* from archives_case ac inner join archives_case_cartoning acc on ac.id=acc.case_id where acc.parent_id = ?1 group by ac.id ")
List<ArchivesCase> initCaseByArchives(String archivesId);
@Query(nativeQuery = true,value = "select count(1) from archives_case_cartoning where parent_id in ?1")
Integer findArchivesBoxedCount(List<String> archivesIds);
@Query(nativeQuery = true,value = "select count(1) from archives_case_cartoning where archives_id in ?1")
Integer findBottomBoxedCount(List<String> archivesIds);
@Query(nativeQuery = true,
value = "select ac.* from archives_case ac inner join archives_case_cartoning acc on ac.id=acc.case_id where acc.parent_id IN " +
"(select in1.parent_id from archives_case_cartoning in1 where in1.case_id = ?1) group by ac.id ")

13
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java

@ -84,11 +84,18 @@ public interface ArchivesSummaryRepository extends JpaRepository<ArchivesSummary
//根据盒获取档案信息
@Query(nativeQuery = true,
value = "select * from archives_summary asy " +
value = "select * from archives_summary where archives_id in (" +
"select DISTINCT asy.archives_id from archives_summary asy " +
"inner join archives_case_cartoning acc on asy.archives_id = acc.parent_id " +
"where acc.case_id = ?1 ")
"where acc.case_id = ?1) ")
List<ArchivesSummary> findByCaseIds(String caseId);
@Query(nativeQuery = true,
value = "select * from archives_summary asy " +
"inner join archives_case_cartoning acc on asy.archives_id = acc.archives_id " +
"where acc.case_id = ?1 ")
List<ArchivesSummary> findBasicsByCaseIds(String caseId);
ArchivesSummary findByTagNo(String tid);
@Query(nativeQuery = true,
@ -101,7 +108,7 @@ public interface ArchivesSummaryRepository extends JpaRepository<ArchivesSummary
"WHERE di.storeroom_code = ?1 and ace.folder_location like ?2 " +
"and if(?3 = 0,(asy.maintitle like ?4 or asy.archive_no like ?4),(asy.maintitle = ?4 or asy.archive_no = ?4)) group by asy.archives_id ",
value = "SELECT DISTINCT asy.archives_id,di.storeroom_code as storeCode,asy.maintitle AS filename,asy.archive_no as fileno,asy.create_time as makedate,asy.category_id as filetype," +
"asy.barcode as filecode,asy.retention as keepday,CONCAT(room.name,' ',di.device_name,' ',ace.folder_location_details) as position," +
"asy.barcode as filecode,asy.retention as keepday,ace.folder_location_details as position," +
"ace.folder_location as location,asy.create_by as editdate,ace.storage_type as storageType,asy.child as enclosure " +
"FROM archives_summary asy " +
"INNER JOIN archives_case_cartoning acc on asy.archives_id = acc.parent_id " +

2
archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java

@ -15,7 +15,7 @@ public interface StorageLogRepository extends JpaRepository<StorageLog, Integer>
value = "select * from storage_log where if(?1 is null,1=1,storage_type = ?1) " +
"and if(?2 is null,1=1,case_name like ?2) " +
"and if(?3 is null,1=1,tid like ?3) " +
"and if(?4 is null,1=1,barcode like ?4) ")
"and if(?4 is null,1=1,barcode like ?4) order by create_time desc")
Page<StorageLog> initStorageLogList(Integer storageType, String caseName, String tid, String barcode, Pageable page);
@Query(nativeQuery = true,

5
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java

@ -770,6 +770,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
StorageDetailesVO vo = new StorageDetailesVO();
vo.setArchivesCase(caseRepository.findCaseById(caseId));
vo.setArchivesSummaries(archivesSummaryRepository.findByCaseIds(caseId));
vo.setArchivesBasics(archivesSummaryRepository.findBasicsByCaseIds(caseId));
return vo;
}
@ -807,7 +808,9 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
//查询档案和关联的档案
archivesSummaryRepository.cleanLocationByCaseId("%"+archivesCase.getId()+"%");
}
caseRepository.saveAndFlush(archivesCase);
archivesCase = caseRepository.saveAndFlush(archivesCase);
this.recordStorage(archivesCase,type == 1 ? 1:2);
return null;
}

53
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java

@ -2,9 +2,11 @@ package com.storeroom.modules.archives.service.impl;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.storeroom.exception.BaseException;
import com.storeroom.modules.archives.domain.ArchivesSearchLog;
import com.storeroom.modules.archives.domain.ArchivesSummary;
import com.storeroom.modules.archives.domain.vo.ArchivesDetailsVO;
import com.storeroom.modules.archives.repository.ArchivesCaseRepository;
import com.storeroom.modules.archives.repository.ArchivesSearchLogRepository;
import com.storeroom.modules.archives.repository.ArchivesSummaryRepository;
import com.storeroom.modules.archives.service.ArchivesService;
@ -35,6 +37,7 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.io.File;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -49,6 +52,7 @@ public class ArchivesServiceImpl implements ArchivesService {
private final ArchivesDictionaryRepository archivesDictionaryRepository;
private final ArchivesTypeService archivesTypeService;
private final ArchivesSearchLogRepository archivesSearchLogRepository;
private final ArchivesCaseRepository caseRepository;
@Value("${file.windows.path}")
// @Value("${file.linux.path}")
@ -151,8 +155,13 @@ public class ArchivesServiceImpl implements ArchivesService {
List<Object[]> countList = entityManager.createNativeQuery("select count(1) from (select "+queryField+appendQuery+isStorageQuery+isBorrowQuery+" from "+queryTable+additional+queryparentsId+") t "+queryTypeadd).getResultList();
Object count = countList.get(0);
Integer pageNumber = page.getPageNumber();
Integer pageSize = page.getPageSize();
String appendLimit = " ";
if(pageSize!=0 && null!=pageSize)
appendLimit = " limit "+pageNumber*pageSize+","+pageSize;
List<Object[]> list = entityManager.createNativeQuery("select * from (select "+queryField+appendQuery+isStorageQuery+isBorrowQuery+" from "+queryTable+additional+queryparentsId+quertOrder
+") t "+queryTypeadd+" limit "+page.getPageNumber()*page.getPageSize()+","+page.getPageSize()).getResultList();
+") t "+queryTypeadd+appendLimit).getResultList();
List<Map> returnlist = new ArrayList<>();
for(Object[] objs:list){
Map map = new HashMap();
@ -645,6 +654,34 @@ public class ArchivesServiceImpl implements ArchivesService {
public Object delete(ArchivesDTO dto) {
ArchivesType archivesType = archivesTypeRepository.findById(dto.getCategoryId()).get();
List<String> ids = dto.getIds();
//判断是否装盒
//当删除为项目级别
if(archivesType.getIsType() == ArchivesTypeEnum.project.getCode()){
//获取旗下案卷门类
ArchivesType archivesType_3 = archivesTypeRepository.findByPid(archivesType.getId());
if(null != archivesType_3){
String getArchivesIdsSql = "select id from "+archivesType_3.getEnName()
+" where parent_id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
List<String> list = entityManager.createNativeQuery(getArchivesIdsSql).getResultList();
if(null != list && list.size() != 0){
Integer count = caseRepository.findArchivesBoxedCount(list);
if(count!=0)
throw new BaseException("该项目下有档案已装盒,不可删除");
}
}
//当删除为案卷级别
}else if(archivesType.getIsType() == ArchivesTypeEnum.archives.getCode()){
Integer count = caseRepository.findArchivesBoxedCount(ids);
if(count!=0)
throw new BaseException("删除档案已装盒,不可删除");
//当删除为卷内/文件级别
}else if(archivesType.getIsType() == ArchivesTypeEnum.inChive.getCode() || archivesType.getIsType() == ArchivesTypeEnum.files.getCode()){
Integer count = caseRepository.findBottomBoxedCount(ids);
if(count!=0)
throw new BaseException("删除档案已装盒,不可删除");
}
String queryTable = archivesType.getEnName();
String delTime = sdf.format(new Date());
String sql = "update " + queryTable + " set is_delete_time = '" +delTime+"',is_delete_man='"+dto.getDelMan()
@ -676,14 +713,14 @@ public class ArchivesServiceImpl implements ArchivesService {
//获取档案表名
ArchivesType archivesType_3 = archivesTypeRepository.findByPid(archivesType.getId());
//获取该项目下所有案卷id
String query3sql = "select id from "+archivesType.getEnName()+" where parent_id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
String query3sql = "select id from "+archivesType_3.getEnName()+" where parent_id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
List<String> list3 = entityManager.createNativeQuery(query3sql).getResultList();
if(null != list3 && list3.size()!=0){
//删除案卷
String update3sql = "update " + archivesType.getEnName() + " set is_delete_time = '" +delTime+"',is_delete_man='"+dto.getDelMan()
String update3sql = "update " + archivesType_3.getEnName() + " set is_delete_time = '" +delTime+"',is_delete_man='"+dto.getDelMan()
+"' where id in ('"+list3.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
//获取卷内表名
String enName_4 = archivesTypeRepository.findEnNameByPid(archivesType.getId());
String enName_4 = archivesTypeRepository.findEnNameByPid(archivesType_3.getId());
if(null == enName_4)
return result;
String query4sql = "select id from "+enName_4+" where parent_id in ('"+list3.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
@ -1139,7 +1176,13 @@ public class ArchivesServiceImpl implements ArchivesService {
JSONObject resultJson = new JSONObject();
resultJson.put("filename",map.get("filename"));
resultJson.put("fileno",map.get("fileno"));
resultJson.put("makedate",map.get("makedate"));
SimpleDateFormat datesdf = new SimpleDateFormat("YYYY/MM/dd HH:mm:ss");
String makedate = map.get("makedate") == null?"":map.get("makedate")+"";
try {
resultJson.put("makedate",makedate == null?makedate:datesdf.format(sdf.parse(makedate)));
} catch (ParseException e) {
resultJson.put("makedate",null);
}
resultJson.put("filetype",map.get("filetype"));
resultJson.put("filecode",map.get("filecode"));
resultJson.put("keepday",map.get("keepday"));

3
archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java

@ -62,8 +62,7 @@ public class ArchivesTypeController {
if (StringUtils.isEmpty(archivesTypeDTO.getCnName())) {
throw new BaseException("名称不能为空");
}
archivesTypeService.create(archivesTypeDTO);
return ApiResponse.success("保存成功");
return ApiResponse.success(archivesTypeService.create(archivesTypeDTO));
}
@ApiOperation("修改门类")

2
archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java

@ -17,7 +17,7 @@ public interface ArchivesTypeService {
* 创建门类
* @param archivesTypeDTO
*/
void create(ArchivesTypeDTO archivesTypeDTO);
ArchivesType create(ArchivesTypeDTO archivesTypeDTO);
/**

5
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java

@ -38,7 +38,7 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(ArchivesTypeDTO archivesTypeDTO) {
public ArchivesType create(ArchivesTypeDTO archivesTypeDTO) {
//#生成表名称
String tableName = "tb_";
ArchivesType archivesType = archivesTypeMapper.toEntity(archivesTypeDTO);
@ -50,12 +50,13 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService {
}
archivesType.setId(NanoIdUtils.randomNanoId());
archivesType.setEnName(tableName);
archivesTypeRepository.save(archivesType);
archivesType = archivesTypeRepository.save(archivesType);
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName);
} else {
throw new BaseException("门类名称不能重复");
}
return archivesType;
}

4
storeroom/src/main/java/com/storeroom/modules/device/repository/StoreroomRepository.java

@ -4,6 +4,7 @@ package com.storeroom.modules.device.repository;
import com.storeroom.modules.device.domain.Storeroom;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
@ -17,4 +18,7 @@ public interface StoreroomRepository extends JpaRepository<Storeroom,String>, Jp
*/
List<Storeroom> findByName(String name);
@Query("from Storeroom order by sort asc")
List<Storeroom> findAllDesc();
}

2
storeroom/src/main/java/com/storeroom/modules/device/service/impl/StoreroomImpl.java

@ -71,7 +71,7 @@ public class StoreroomImpl implements StoreroomService {
@Override
public List<Storeroom> buildTree() {
List<Storeroom> list = storeroomRepository.findAll();
List<Storeroom> list = storeroomRepository.findAllDesc();
return list.stream().filter(item -> item.getPid().equals("0"))
.map(item -> item.setChildren(getChildren(item.getId(), list)))

13
storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/DisplayConfigController.java

@ -37,6 +37,7 @@ public class DisplayConfigController {
@AnonymousPostMapping("bind")
@ApiOperation("绑定参数")
public ApiResponse<Object> bind(@RequestBody DisplayConfig displayConfig) {
System.out.println(displayConfig.toString());
if (StringUtils.isEmpty(displayConfig.getId())) {
throw new BaseException("id不为空");
}
@ -44,6 +45,18 @@ public class DisplayConfigController {
return ApiResponse.success(ResponseStatus.SUCCESS);
}
@AnonymousPostMapping("unbind")
@ApiOperation("解绑")
public ApiResponse<Object> unbind(@RequestBody DisplayConfig displayConfig) {
if (StringUtils.isEmpty(displayConfig.getId())) {
throw new BaseException("id不为空");
}
displayConfigService.unbind(displayConfig.getId());
return ApiResponse.success(ResponseStatus.SUCCESS);
}
@AnonymousGetMapping("list")
@ApiOperation("获取列表")
public ApiResponse<Object> queryList(@RequestParam String storeroomId) {

3
storeroom/src/main/java/com/storeroom/modules/storeroom3d/repository/DisplayConfigRepository.java

@ -29,4 +29,7 @@ public interface DisplayConfigRepository extends JpaRepository<DisplayConfig, St
*/
DisplayConfig findByDeviceInfo(DeviceInfo deviceInfo);
@Query(nativeQuery = true,value = "select * from display_config where id = ?1")
DisplayConfig findConfigById(String id);
}

2
storeroom/src/main/java/com/storeroom/modules/storeroom3d/service/DisplayConfigService.java

@ -16,6 +16,8 @@ public interface DisplayConfigService {
*/
void bind(DisplayConfig displayConfig);
void unbind(String id);
/**
* 通过库房id查询设备

22
storeroom/src/main/java/com/storeroom/modules/storeroom3d/service/impl/DisplayConfigImpl.java

@ -1,5 +1,6 @@
package com.storeroom.modules.storeroom3d.service.impl;
import com.storeroom.exception.BaseException;
import com.storeroom.modules.device.domain.DeviceInfo;
import com.storeroom.modules.device.domain.DeviceSpecParam;
import com.storeroom.modules.device.domain.Storeroom;
@ -31,6 +32,15 @@ public class DisplayConfigImpl implements DisplayConfigService {
@Override
@Transactional(rollbackFor = Exception.class)
public void bind(DisplayConfig displayConfig) {
//当设备是摄像头时
if("7305DE3D273B0CAC079538".equals(displayConfig.getDeviceInfo().getDeviceTypeId().getId()) ||
"7882487E0C15304A3758AF".equals(displayConfig.getDeviceInfo().getDeviceTypeId().getId() )
){
DisplayConfig isExist = displayConfigRepository.findByDeviceInfo(displayConfig.getDeviceInfo());
if(null != isExist)
throw new BaseException("该设备已绑定,如需绑定请先解绑");
}
//displayConfig.setId(NanoIdUtils.randomNanoId());
displayConfig.setBindState(true);
displayConfig.getDeviceSpecParams().forEach(item -> {
@ -41,6 +51,18 @@ public class DisplayConfigImpl implements DisplayConfigService {
displayConfigRepository.save(displayConfig);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void unbind(String id) {
DisplayConfig config = displayConfigRepository.findConfigById(id);
if(null != config){
config.setBindState(false);
config.setDeviceInfo(null);
config.setDeviceSpecParams(null);
displayConfigRepository.saveAndFlush(config);
}
}
@Override
public List<DeviceInfo> queryDevceInfo(String storeroomId) {
Storeroom storeroom = storeroomRepository.findById(storeroomId).orElseGet(Storeroom::new);

Loading…
Cancel
Save