提交 77082a22 authored 作者: zhoushaopan's avatar zhoushaopan

feat(配套设备库): 修改配套整个流程

修改配套整个流程
上级 174ce433
...@@ -60,6 +60,9 @@ public class WebMvcConfigConfig extends WebMvcConfigurationSupport { ...@@ -60,6 +60,9 @@ public class WebMvcConfigConfig extends WebMvcConfigurationSupport {
@Value("${qrcode.path}") @Value("${qrcode.path}")
private String qrCodePath; private String qrCodePath;
@Value("${file.matching.excel}")
private String excelPath;
@Bean(name = "format") @Bean(name = "format")
DateTimeFormatter format() { DateTimeFormatter format() {
return DateTimeFormatter.ofPattern(formatValue); return DateTimeFormatter.ofPattern(formatValue);
...@@ -72,6 +75,7 @@ public class WebMvcConfigConfig extends WebMvcConfigurationSupport { ...@@ -72,6 +75,7 @@ public class WebMvcConfigConfig extends WebMvcConfigurationSupport {
protected void addResourceHandlers(ResourceHandlerRegistry registry) { protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/file/**").addResourceLocations("file:" + path); registry.addResourceHandler("/file/**").addResourceLocations("file:" + path);
registry.addResourceHandler("/code/**").addResourceLocations("file:" + qrCodePath); registry.addResourceHandler("/code/**").addResourceLocations("file:" + qrCodePath);
registry.addResourceHandler("/excel/**").addResourceLocations("file:"+excelPath);
//静态资源 //静态资源
registry.addResourceHandler( "/**" ).addResourceLocations( "classpath:/static/" ); registry.addResourceHandler( "/**" ).addResourceLocations( "classpath:/static/" );
// swagger handler // swagger handler
......
...@@ -29,4 +29,7 @@ public interface MatchingDeviceBillService { ...@@ -29,4 +29,7 @@ public interface MatchingDeviceBillService {
* @param matchingDeviceBillEntity 更新账单 * @param matchingDeviceBillEntity 更新账单
*/ */
MatchingDeviceBill update(MatchingDeviceBill matchingDeviceBillEntity); MatchingDeviceBill update(MatchingDeviceBill matchingDeviceBillEntity);
} }
package com.tykj.dev.device.matching.service; package com.tykj.dev.device.matching.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingUnitVo; import com.tykj.dev.device.matching.subject.vo.*;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo; import com.tykj.dev.device.matching.subject.vo.excel.MatchingDeviceSaveVoExcelList;
import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo;
import com.tykj.dev.device.matching.subject.vo.StatusVO;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo; import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -55,6 +53,11 @@ public interface MatchingDeviceLibraryService { ...@@ -55,6 +53,11 @@ public interface MatchingDeviceLibraryService {
*/ */
List<MatchingDeviceLibrary> getMatchingDevicePage(MatchingDeviceSelectVo matchingDeviceSelectVo); List<MatchingDeviceLibrary> getMatchingDevicePage(MatchingDeviceSelectVo matchingDeviceSelectVo);
/**
* @param matchingDeviceSelectVo 装备查询vo 修改分页
*/
Page<MatchingDeviceLibrary> getMatchingDevicePage1(MatchingDeviceSelectVo matchingDeviceSelectVo);
/** /**
* @param unitId 单位id * @param unitId 单位id
...@@ -110,6 +113,12 @@ public interface MatchingDeviceLibraryService { ...@@ -110,6 +113,12 @@ public interface MatchingDeviceLibraryService {
*/ */
List<String> getAllMatchingDeviceLibraryListSeqNumberList(); List<String> getAllMatchingDeviceLibraryListSeqNumberList();
/**
* 查询所有的固定资产号
* @return
*/
List<String> getAllFixedList();
/** /**
* 修改单位名称从而修改配套设备库装备的创建单位的名称 * 修改单位名称从而修改配套设备库装备的创建单位的名称
* @param matchingUnitVo 修改单位名称的vo * @param matchingUnitVo 修改单位名称的vo
...@@ -149,4 +158,17 @@ public interface MatchingDeviceLibraryService { ...@@ -149,4 +158,17 @@ public interface MatchingDeviceLibraryService {
*/ */
void updateLifeStatus2(Integer lifeStatus,List<Integer> ids); void updateLifeStatus2(Integer lifeStatus,List<Integer> ids);
/**
* 配套设备库表格导入
* @return
*/
List<MatchingDeviceSaveVo> importExcel(MultipartFile file);
/**
* 导出excel
* @param matchingDeviceLibraries
* @return
*/
String exportExcel(List<MatchingDeviceLibrary> matchingDeviceLibraries);
} }
package com.tykj.dev.device.matching.service.impl; package com.tykj.dev.device.matching.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.github.wenhao.jpa.PredicateBuilder; import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash; import com.tykj.dev.blockcha.subject.entity.BcHash;
...@@ -13,30 +17,35 @@ import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService; ...@@ -13,30 +17,35 @@ import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl; import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl;
import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService; import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingUnitVo; import com.tykj.dev.device.matching.subject.vo.*;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo; import com.tykj.dev.device.matching.subject.vo.excel.MatchingDeviceSaveVoExcelList;
import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo;
import com.tykj.dev.device.matching.subject.vo.StatusVO;
import com.tykj.dev.device.user.cache.UnitsCache; import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.DateUtil;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.PageUtil; import com.tykj.dev.misc.utils.PageUtil;
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.PrintVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo; import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.Transient; import javax.persistence.Transient;
import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
...@@ -47,6 +56,7 @@ import java.util.stream.Collectors; ...@@ -47,6 +56,7 @@ import java.util.stream.Collectors;
* @author dengdiyi * @author dengdiyi
*/ */
@Service @Service
@Slf4j
public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibraryService { public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibraryService {
@Autowired @Autowired
...@@ -70,6 +80,9 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -70,6 +80,9 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
@Resource @Resource
private UnitsCache unitsCache; private UnitsCache unitsCache;
@Value("${file.matching.excel}")
private String fileUrl;
@Override @Override
public MatchingDeviceLibrary addEntity(MatchingDeviceLibrary matchingDeviceLibraryEntity) { public MatchingDeviceLibrary addEntity(MatchingDeviceLibrary matchingDeviceLibraryEntity) {
MatchingDeviceLibrary matchingDeviceLibrary = matchingDeviceLibraryDao.save(matchingDeviceLibraryEntity); MatchingDeviceLibrary matchingDeviceLibrary = matchingDeviceLibraryDao.save(matchingDeviceLibraryEntity);
...@@ -226,6 +239,40 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -226,6 +239,40 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
} }
} }
@Override
public Page<MatchingDeviceLibrary> getMatchingDevicePage1(MatchingDeviceSelectVo matchingDeviceSelectVo) {
PredicateBuilder<MatchingDeviceLibrary> predicateBuilder = Specifications.and();
predicateBuilder.like(matchingDeviceSelectVo.getModelLike() != null,"model","%"+matchingDeviceSelectVo.getModelLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getNameLike() != null,"name","%"+matchingDeviceSelectVo.getNameLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getBrandLike() != null,"brand","%"+matchingDeviceSelectVo.getBrandLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getFixedAssetsCodeNumberLike() != null,
"fixedAssetsCodeNumber","%"+matchingDeviceSelectVo.getFixedAssetsCodeNumberLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getManageUnitLike() != null,
"manageUnit","%"+matchingDeviceSelectVo.getManageUnitLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getUseUnitLike() != null,"useUnit","%"+matchingDeviceSelectVo.getUseUnitLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getDeployAddressLike() != null,
"deployAddress","%"+matchingDeviceSelectVo.getDeployAddressLike()+"%");
predicateBuilder.like(matchingDeviceSelectVo.getYiNameLike() != null,"yiName","%"+matchingDeviceSelectVo.getYiNameLike()+"%");
if (matchingDeviceSelectVo.getSignStartDate() != null ){
predicateBuilder.ge("signDate",matchingDeviceSelectVo.getSignStartDate());
}
if(matchingDeviceSelectVo.getSignEndDate() != null){
predicateBuilder.le("signDate",matchingDeviceSelectVo.getSignEndDate());
}
predicateBuilder.like(matchingDeviceSelectVo.getRemakeLike() != null,"remake","%"+matchingDeviceSelectVo.getRemakeLike()+"%");
if (matchingDeviceSelectVo.getMatchingType() == 0){
predicateBuilder.eq(matchingDeviceSelectVo.getMatchingType() != null,"lifeStatus",2);
}
if (matchingDeviceSelectVo.getMatchingType() == 1){
predicateBuilder.eq(matchingDeviceSelectVo.getMatchingType() != null,"lifeStatus",23);
}
predicateBuilder.eq(matchingDeviceSelectVo.getUnitId() != null,"createUnitId",matchingDeviceSelectVo.getUnitId());
if (matchingDeviceSelectVo.getUnitIds() != null){
predicateBuilder.in("createUnitId",matchingDeviceSelectVo.getUnitIds().toArray());
}
return matchingDeviceLibraryDao.findAll(predicateBuilder.build(),matchingDeviceSelectVo.getPageable());
}
@Override @Override
public List<MatchingDeviceLibrary> getMatchingByUnitIdAll(Integer unitId) { public List<MatchingDeviceLibrary> getMatchingByUnitIdAll(Integer unitId) {
...@@ -344,6 +391,12 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -344,6 +391,12 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public List<String> getAllFixedList() {
return matchingDeviceLibraryDao.findAll().stream().map(MatchingDeviceLibrary::getFixedAssetsCodeNumber)
.collect(Collectors.toList());
}
@Override @Override
public void updateMatchingDeviceCreateUnitNameByUnitName(MatchingUnitVo matchingUnitVo) { public void updateMatchingDeviceCreateUnitNameByUnitName(MatchingUnitVo matchingUnitVo) {
matchingDeviceLibraryDao.updateCreateUnitName(matchingUnitVo.getOriginUnitName(),matchingUnitVo.getUpdateUnitName()); matchingDeviceLibraryDao.updateCreateUnitName(matchingUnitVo.getOriginUnitName(),matchingUnitVo.getUpdateUnitName());
...@@ -412,6 +465,68 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -412,6 +465,68 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
matchingDeviceLibraryDao.batchUpdate2(lifeStatus,ids); matchingDeviceLibraryDao.batchUpdate2(lifeStatus,ids);
} }
@Value("${file.matching.excel}")
private String fileExcel;
@Override
public List<MatchingDeviceSaveVo> importExcel(MultipartFile file) {
ImportParams importParams = new ImportParams();
importParams.setHeadRows(1);
importParams.setTitleRows(0);
try {
return ExcelImportUtil.importExcel(file.getInputStream(), MatchingDeviceSaveVo.class, importParams);
} catch (Exception e) {
e.printStackTrace();
log.info("异常信息:{}",e.getMessage());
throw new ApiException(e.getMessage());
}
}
@Override
public String exportExcel(List<MatchingDeviceLibrary> matchingDeviceLibraries) {
try {
ExportParams exportParams = new ExportParams();
exportParams.setSheetName("配套设备库导出");
List<MatchingDeviceSaveVo> matchingDeviceSaveVoList = new ArrayList<>();
for (int i = 0; i < matchingDeviceLibraries.size(); i++) {
MatchingDeviceSaveVo matchingDeviceSaveVo = new MatchingDeviceSaveVo();
MatchingDeviceLibrary matchingDeviceLibrary = matchingDeviceLibraries.get(i);
BeanUtils.copyProperties(matchingDeviceLibrary,matchingDeviceSaveVo);
if (matchingDeviceSaveVo.getSignDate() != null){
matchingDeviceSaveVo.setSignDate(DateUtil.localDate2String(matchingDeviceLibrary.getSignDate()));
}
matchingDeviceSaveVo.setNum((i+1));
matchingDeviceSaveVoList.add(matchingDeviceSaveVo);
}
// matchingDeviceLibraries.forEach(matchingDeviceLibrary -> {
// MatchingDeviceSaveVo matchingDeviceSaveVo = new MatchingDeviceSaveVo();
// BeanUtils.copyProperties(matchingDeviceLibrary,matchingDeviceSaveVo);
// if (matchingDeviceSaveVo.getSignDate() != null){
// matchingDeviceSaveVo.setSignDate(DateUtil.localDate2String(matchingDeviceLibrary.getSignDate()));
// }
// matchingDeviceSaveVoList.add(matchingDeviceSaveVo);
// });
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, MatchingDeviceSaveVo.class, matchingDeviceSaveVoList);
String uuid = UUID.randomUUID().toString();
File file = new File(fileExcel + uuid + ".xlsx");
// if (!file.exists()){
// file.mkdirs();
//// file.createNewFile();
// log.info("创建文件夹");
// }
FileOutputStream fileOutputStream = new FileOutputStream(file);
workbook.write(fileOutputStream);
fileOutputStream.close();
return uuid+ ".xlsx";
} catch (IOException e) {
e.printStackTrace();
log.info("文件导出异常:{}",e.getMessage());
}
return null;
}
/** /**
* @param matchingDeviceSelectVo 配套设备查询vo * @param matchingDeviceSelectVo 配套设备查询vo
......
package com.tykj.dev.device.matching.subject.domin; package com.tykj.dev.device.matching.subject.domin;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.cache.ConfigCache; import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.SpringUtils; import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -15,8 +17,11 @@ import org.springframework.data.annotation.CreatedDate; ...@@ -15,8 +17,11 @@ import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
/** /**
...@@ -59,6 +64,10 @@ public class MatchingDeviceLibrary { ...@@ -59,6 +64,10 @@ public class MatchingDeviceLibrary {
*/ */
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String name; private String name;
@ApiModelProperty(value = "品牌")
private String brand;
/** /**
* 创建单位 * 创建单位
*/ */
...@@ -78,6 +87,33 @@ public class MatchingDeviceLibrary { ...@@ -78,6 +87,33 @@ public class MatchingDeviceLibrary {
*/ */
@ApiModelProperty(value = "设备序列号") @ApiModelProperty(value = "设备序列号")
private String seqNumber; private String seqNumber;
@ApiModelProperty(value = "固定资产号")
private String fixedAssetsCodeNumber;
@ApiModelProperty(value = "资产管理单位")
private String manageUnit;
@ApiModelProperty(value = "使用单位")
private String useUnit;
@ApiModelProperty(value = "部署地址")
private String deployAddress;
@ApiModelProperty(value = "合同金额")
private String amount;
@ApiModelProperty(value = "采购方式")
private String purchaseWay;
@ApiModelProperty(value = "乙方名称")
private String yiName;
@ApiModelProperty(value = "签订日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private LocalDate signDate;
/** /**
* rfid表面号 * rfid表面号
*/ */
...@@ -187,13 +223,18 @@ public class MatchingDeviceLibrary { ...@@ -187,13 +223,18 @@ public class MatchingDeviceLibrary {
public MatchingDeviceLibrary setConfigName(){ public MatchingDeviceLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache"); ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) { UnitsCache unitCache = SpringUtils.getBean("initUnitCache");
if (configCache != null && unitCache != null) {
setLifeStatusName(configCache.getLifeStatusMap().get(this.lifeStatus)==null?"-":configCache.getLifeStatusMap().get(this.lifeStatus)); setLifeStatusName(configCache.getLifeStatusMap().get(this.lifeStatus)==null?"-":configCache.getLifeStatusMap().get(this.lifeStatus));
if (this.type != null){
setTypeName(configCache.getMatchingTypeMap().get(Integer.valueOf(this.type))==null?"-":configCache.getMatchingTypeMap().get(Integer.valueOf(this.type))); setTypeName(configCache.getMatchingTypeMap().get(Integer.valueOf(this.type))==null?"-":configCache.getMatchingTypeMap().get(Integer.valueOf(this.type)));
}
if (this.statusJson != null){ if (this.statusJson != null){
statusJsonRet = JacksonUtil.readValue(this.statusJson, new TypeReference<FileRet>() { statusJsonRet = JacksonUtil.readValue(this.statusJson, new TypeReference<FileRet>() {
}); });
} }
setCreateUnit(unitCache.findById(this.createUnitId).getName());
} }
return this; return this;
} }
......
...@@ -46,6 +46,9 @@ public class MatchingDeviceBillSaveVo { ...@@ -46,6 +46,9 @@ public class MatchingDeviceBillSaveVo {
@ApiModelProperty(value = "任务id") @ApiModelProperty(value = "任务id")
private Integer taskId = 0; private Integer taskId = 0;
@ApiModelProperty(value = "当前登录人的id")
private Integer currentUserId;
@Valid @Valid
......
package com.tykj.dev.device.matching.subject.vo; package com.tykj.dev.device.matching.subject.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
...@@ -80,4 +84,33 @@ public class MatchingDeviceEditVo { ...@@ -80,4 +84,33 @@ public class MatchingDeviceEditVo {
@ApiModelProperty(value = "文件") @ApiModelProperty(value = "文件")
private FileRet fileRet; private FileRet fileRet;
@ApiModelProperty(value = "品牌")
private String brand;
@ApiModelProperty(value = "固定资产号")
private String fixedAssetsCodeNumber;
@ApiModelProperty(value = "资产管理单位")
private String manageUnit;
@ApiModelProperty(value = "使用单位")
private String useUnit;
@ApiModelProperty(value = "部署地址")
private String deployAddress;
@ApiModelProperty(value = "合同金额")
private String amount;
@ApiModelProperty(value = "采购方式")
private String purchaseWay;
@ApiModelProperty(value = "乙方名称")
private String yiName;
@ApiModelProperty(value = "签订日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private LocalDate signDate;
} }
package com.tykj.dev.device.matching.subject.vo; package com.tykj.dev.device.matching.subject.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.misc.utils.DateFormatUtil;
import com.tykj.dev.misc.utils.DateUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
...@@ -14,40 +23,90 @@ import java.util.List; ...@@ -14,40 +23,90 @@ import java.util.List;
*/ */
@Data @Data
@ApiModel("配套设备存储类") @ApiModel("配套设备存储类")
@ExcelTarget("matchingDeviceSaveVo")
public class MatchingDeviceSaveVo { public class MatchingDeviceSaveVo {
@NotNull(message = "type不能为空") @ApiModelProperty(value = "序号")
@ApiModelProperty(value = "设备类型") @Excel(name = "序号")
private String type; private Integer num;
@NotNull(message = "model不能为空") @NotNull(message = "model不能为空")
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "型号")
@Excel(name = "型号")
private String model; private String model;
@NotNull(message = "name不能为空") // @NotNull(message = "name不能为空")
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
@Excel(name = "资产名称")
private String name; private String name;
@NotNull(message = "name不能为空") @ApiModelProperty(value = "品牌")
@ApiModelProperty(value = "形态") @Excel(name = "品牌")
private String style; private String brand;
@NotNull(message = "seqNumber不能为空")
@ApiModelProperty(value = "设备序列号")
@Excel(name = "装备序列号")
private String seqNumber;
@ApiModelProperty(value = "固定资产号")
@Excel(name = "固定资产号")
private String fixedAssetsCodeNumber;
@NotNull(message = "createUnit不能为空") // @NotNull(message = "createUnit不能为空")
@ApiModelProperty(value = "创建单位") @ApiModelProperty(value = "创建单位")
@Excel(name = "创建单位")
private String createUnit; private String createUnit;
@NotNull(message = "createUnitId不能为空") @NotNull(message = "createUnitId不能为空")
@ApiModelProperty(value = "创建单位Id") @ApiModelProperty(value = "创建单位Id")
private Integer createUnitId; private Integer createUnitId;
@NotNull(message = "locationUnitId不能为空") @ApiModelProperty(value = "资产管理单位")
@Excel(name = "资产管理单位")
private String manageUnit;
@ApiModelProperty(value = "使用单位")
@Excel(name = "使用单位")
private String useUnit;
@ApiModelProperty(value = "部署地址")
@Excel(name = "部署地址")
private String deployAddress;
@ApiModelProperty(value = "合同金额")
@Excel(name = "合同金额")
private String amount;
@ApiModelProperty(value = "采购方式")
@Excel(name = "采购方式")
private String purchaseWay;
@ApiModelProperty(value = "乙方名称")
@Excel(name = "乙方名称")
private String yiName;
@ApiModelProperty(value = "签订日期")
@Excel(name = "签订日期")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private String signDate;
@ApiModelProperty(value = "备注")
private String remake;
// @NotNull(message = "type不能为空")
@ApiModelProperty(value = "设备类型")
private String type;
// @NotNull(message = "name不能为空")
@ApiModelProperty(value = "形态")
private String style;
// @NotNull(message = "locationUnitId不能为空")
@ApiModelProperty(value = "所在单位Id") @ApiModelProperty(value = "所在单位Id")
private Integer locationUnitId; private Integer locationUnitId;
@NotNull(message = "seqNumber不能为空")
@ApiModelProperty(value = "设备序列号")
private String seqNumber;
// @NotNull(message = "rfidSurfaceId不能为空") // @NotNull(message = "rfidSurfaceId不能为空")
@ApiModelProperty(value = "rfid表面号") @ApiModelProperty(value = "rfid表面号")
private String rfidSurfaceId; private String rfidSurfaceId;
...@@ -77,12 +136,16 @@ public class MatchingDeviceSaveVo { ...@@ -77,12 +136,16 @@ public class MatchingDeviceSaveVo {
@ApiModelProperty(value = "锁定状态,0-未锁定可用,1-锁定不可用") @ApiModelProperty(value = "锁定状态,0-未锁定可用,1-锁定不可用")
private Integer lockStatus = 0; private Integer lockStatus = 0;
public MatchingDeviceLibrary toDo() { public MatchingDeviceLibrary toDo() {
MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary(); MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary();
BeanUtils.copyProperties(this, matchingDeviceLibraryEntity); BeanUtils.copyProperties(this, matchingDeviceLibraryEntity);
matchingDeviceLibraryEntity.setLifeStatus(2); matchingDeviceLibraryEntity.setLifeStatus(2);
matchingDeviceLibraryEntity.setDeviceId(0); matchingDeviceLibraryEntity.setDeviceId(0);
matchingDeviceLibraryEntity.setLocationUnitId(this.createUnitId); matchingDeviceLibraryEntity.setLocationUnitId(this.createUnitId);
matchingDeviceLibraryEntity.setSignDate(DateUtil.string2LocalDate(this.signDate));
//签订日期进行时间的转换
// matchingDeviceLibraryEntity.setSignDate(DateUtil.string2LocalDate(this.signDate));
// if (matchingDeviceLibraryEntity.getRfidCardId()==null||"".equals(matchingDeviceLibraryEntity.getRfidCardId())){ // if (matchingDeviceLibraryEntity.getRfidCardId()==null||"".equals(matchingDeviceLibraryEntity.getRfidCardId())){
// matchingDeviceLibraryEntity.setRfidCardId(UUID.randomUUID().toString()); // matchingDeviceLibraryEntity.setRfidCardId(UUID.randomUUID().toString());
// } // }
......
package com.tykj.dev.device.matching.subject.vo; package com.tykj.dev.device.matching.subject.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.misc.base.CustomPage; import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import java.time.LocalDate;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -51,6 +57,51 @@ public class MatchingDeviceSelectVo extends CustomPage { ...@@ -51,6 +57,51 @@ public class MatchingDeviceSelectVo extends CustomPage {
private Integer matchingDeviceStatus ; private Integer matchingDeviceStatus ;
//使用状态 签订日期 合同金额 装备序列号 采购方式 不需要
//
@ApiModelProperty(value = "型号 模糊查询")
private String modelLike ;
@ApiModelProperty(value = "资产名称 模糊查询")
private String nameLike ;
@ApiModelProperty(value = "品牌 模糊查询")
private String brandLike ;
@ApiModelProperty(value = "固定资产号 模糊查询")
private String fixedAssetsCodeNumberLike;
@ApiModelProperty(value = "资产管理单位 模糊查询")
private String manageUnitLike ;
@ApiModelProperty(value = "使用单位 模糊查询")
private String useUnitLike;
@ApiModelProperty(value = "部署地址 模糊查询")
private String deployAddressLike ;
@ApiModelProperty(value = "乙方名称 模糊查询")
private String yiNameLike;
@ApiModelProperty(value = "签订开始日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private LocalDate signStartDate;
@ApiModelProperty(value = "签订结束日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private LocalDate signEndDate;
@ApiModelProperty(value = "备注 模糊查询")
private String remakeLike;
@ApiModelProperty(value = "类型 1 代表只查询停用的") @ApiModelProperty(value = "类型 1 代表只查询停用的")
private Integer matchingType ; private Integer matchingType ;
@ApiModelProperty(value = "单位ID的集合")
private List<Integer> unitIds; ;
} }
package com.tykj.dev.device.matching.subject.vo.excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSaveVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("导入配套设备库的excel")
@ExcelTarget("matchingDeviceSaveVoExcelList")
public class MatchingDeviceSaveVoExcelList {
@ApiModelProperty(value = "集合")
private List<MatchingDeviceSaveVo> list;
}
...@@ -68,6 +68,12 @@ ...@@ -68,6 +68,12 @@
<artifactId>snappy-java</artifactId> <artifactId>snappy-java</artifactId>
<version>1.1.2.6</version> <version>1.1.2.6</version>
</dependency> </dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>3.3.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -22,4 +22,14 @@ public class DateUtil { ...@@ -22,4 +22,14 @@ public class DateUtil {
return localDateTime.toLocalDate(); return localDateTime.toLocalDate();
} }
public static LocalDate string2LocalDate(String format){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return LocalDate.parse(format, formatter);
}
public static String localDate2String(LocalDate localDate){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return formatter.format(localDate);
}
} }
...@@ -11,13 +11,15 @@ spring.jpa.hibernate.ddl-auto=update ...@@ -11,13 +11,15 @@ spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto=update #spring.jpa.hibernate.ddl-auto=update
#file.path=C:/Users/dengdiyi/Documents/file/ #file.path=C:/Users/dengdiyi/Documents/file/
# spring boot admin # spring boot admin
file.path=/Users/zjm/code/test-tu/ file.path=/Users/zhoushaopan/file/
preview.path=http://192.168.102.169:8087/file/ preview.path=http://192.168.102.169:8087/file/
spring.boot.admin.client.url=http://localhost:8769 spring.boot.admin.client.url=http://localhost:8769
spring.boot.admin.client.instance.serviceBaseUrl=http://localhost:8087w spring.boot.admin.client.instance.serviceBaseUrl=http://localhost:8087
block.flag=true block.flag=true
readMachine.ip=192.168.101.201 readMachine.ip=192.168.101.201
qrcode.path = C:/Users/zsp/Desktop/qrcode/ qrcode.path = C:/Users/zsp/Desktop/qrcode/
qrcode.preview.path=http://192.168.101.133:8087/code/ qrcode.preview.path=http://192.168.101.133:8087/code/
carrier.url = http://192.168.0.101:8087/configuration/saveConfiguration carrier.url = http://192.168.0.101:8087/configuration/saveConfiguration
file.matching.excel=/Users/zhoushaopan/excel/
...@@ -10,3 +10,4 @@ preview.path=http://10.153.4.11:8088/equip/file/ ...@@ -10,3 +10,4 @@ preview.path=http://10.153.4.11:8088/equip/file/
block.flag=true block.flag=true
carrier.url = http://10.153.4.11:8088/carrier/configuration/saveConfiguration carrier.url = http://10.153.4.11:8088/carrier/configuration/saveConfiguration
file.matching.excel=/data/equip/matching/excel/
\ No newline at end of file
...@@ -11,3 +11,4 @@ block.flag=false ...@@ -11,3 +11,4 @@ block.flag=false
qrcode.path = /opt/qrcode/ qrcode.path = /opt/qrcode/
qrcode.preview.path=http://10.153.4.11:8088/equipTest/code/ qrcode.preview.path=http://10.153.4.11:8088/equipTest/code/
carrier.url = http://10.153.4.11:8088/carrierTest/configuration/saveConfiguration carrier.url = http://10.153.4.11:8088/carrierTest/configuration/saveConfiguration
file.matching.excel=/data/equipTest/matching/excel/
\ No newline at end of file
...@@ -16,3 +16,5 @@ qrcode.path = /opt/qrcode/ ...@@ -16,3 +16,5 @@ qrcode.path = /opt/qrcode/
qrcode.preview.path=http://192.168.0.80/equip/code/ qrcode.preview.path=http://192.168.0.80/equip/code/
carrier.url = http://192.168.0.80:8088/carrier/configuration/saveConfiguration carrier.url = http://192.168.0.80:8088/carrier/configuration/saveConfiguration
file.matching.excel=/data/equip/excel/
\ No newline at end of file
...@@ -33,8 +33,11 @@ public class UnitsCache { ...@@ -33,8 +33,11 @@ public class UnitsCache {
} }
public Units findById(Integer id) { public Units findById(Integer id) {
if (idMap.containsKey(id)){
return idMap.get(id); return idMap.get(id);
} }
return new Units();
}
public List<Units> findAll(){ public List<Units> findAll(){
return new ArrayList<>(idMap.values()); return new ArrayList<>(idMap.values());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论