|
@@ -1,14 +1,18 @@
|
|
|
package com.platform.rest.controller.upms;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import com.platform.common.cache.ConfigCache;
|
|
|
import com.platform.common.constant.CommonConstants;
|
|
|
+import com.platform.common.exception.BusinessException;
|
|
|
import com.platform.common.util.IdGeneratorUtils;
|
|
|
import com.platform.common.util.R;
|
|
|
+import com.platform.common.util.StringUtils;
|
|
|
import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
import com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO;
|
|
|
import com.platform.dao.dto.store.SpareStoreDTO;
|
|
|
import com.platform.dao.dto.upms.SysCodeDTO;
|
|
|
import com.platform.dao.enums.SysCodeTypeEnum;
|
|
|
+import com.platform.dao.enums.SysConfigEnum;
|
|
|
import com.platform.service.sb.SbInfoService;
|
|
|
import com.platform.service.sqarepartmanage.SparePartInfoService;
|
|
|
import com.platform.service.store.SpareStoreService;
|
|
@@ -52,22 +56,37 @@ public class SysCodeController {
|
|
|
String rootPath = environment.getProperty("upload.root-dir");
|
|
|
String filePath = rootPath + path;
|
|
|
String codePath = path + sysCodeDTO.getCodeId() + ".png";
|
|
|
- CodeFileUtils.uploadFileECode(sysCodeDTO.getCodeId(), rootPath, filePath, sysCodeDTO.getCodeId() + ".png");
|
|
|
// 修改
|
|
|
if (SysCodeTypeEnum.SB.getValue().equals(sysCodeDTO.getType())) {
|
|
|
+ String domain = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.SYSTEM_DOMAIN_MOBILE.name());
|
|
|
+ String sbUrl = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.SYSTEM_SB_URL.name());
|
|
|
+ if(StringUtils.isBlank(domain)){
|
|
|
+ throw new BusinessException("请先设置系统域名地址,系统管理-》系统参数配置-》SYSTEM_DOMAIN_MOBILE");
|
|
|
+ }
|
|
|
+ if(!domain.endsWith("/")){
|
|
|
+ domain = domain + "/";
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(sbUrl)){
|
|
|
+ throw new BusinessException("请先设置设备跳转前缀地址,系统管理-》系统参数配置-》SYSTEM_SB_URL");
|
|
|
+ }
|
|
|
+ if(!sbUrl.endsWith("/") || !sbUrl.endsWith("=")){
|
|
|
+ sbUrl = sbUrl + "/";
|
|
|
+ }
|
|
|
+ CodeFileUtils.uploadFileECode(domain + sbUrl + sysCodeDTO.getCodeId(), rootPath, filePath, sysCodeDTO.getCodeId() + ".png");
|
|
|
SbInfoDTO sbInfoDTO = new SbInfoDTO();
|
|
|
sbInfoDTO.setId(sysCodeDTO.getCodeId());
|
|
|
sbInfoDTO.setQrCode(codePath);
|
|
|
sbInfoService.updateQrCode(sbInfoDTO);
|
|
|
}
|
|
|
- // 修改
|
|
|
+ CodeFileUtils.uploadFileECode(sysCodeDTO.getCodeId(), rootPath, filePath, sysCodeDTO.getCodeId() + ".png");
|
|
|
+ // 备件
|
|
|
if (SysCodeTypeEnum.SPARE.getValue().equals(sysCodeDTO.getType())) {
|
|
|
SparePartInfoDTO sbInfoDTO = new SparePartInfoDTO();
|
|
|
sbInfoDTO.setId(sysCodeDTO.getCodeId());
|
|
|
sbInfoDTO.setQrCode(codePath);
|
|
|
sparePartInfoService.updateQrCode(sbInfoDTO);
|
|
|
}
|
|
|
- // 修改
|
|
|
+ // 仓库备件
|
|
|
if (SysCodeTypeEnum.SPARE_STORE.getValue().equals(sysCodeDTO.getType())) {
|
|
|
SpareStoreDTO sbInfoDTO = new SpareStoreDTO();
|
|
|
sbInfoDTO.setId(sysCodeDTO.getCodeId());
|