diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/SysDept.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/SysDept.java index fea5c0c..d35793e 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/SysDept.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/SysDept.java @@ -1,16 +1,16 @@ package com.bonus.sgzb.system.api.domain; -import java.util.ArrayList; -import java.util.List; +import com.bonus.sgzb.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; - -import io.swagger.annotations.ApiModelProperty; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.bonus.sgzb.common.core.web.domain.BaseEntity; +import java.util.ArrayList; +import java.util.List; /** * 部门表 sys_dept @@ -75,6 +75,12 @@ public class SysDept extends BaseEntity /** 所属组织id */ private Long companyId; + /** 企业机构代码(统一社会信用代码) */ + private String socialCreditCode; + + /** 企业归属代码 CSG-南方电网下属企业 SE-社会及大集体企业 */ + private String enterpriseOwnershipCode; + @Override public String getRemark() { return remark; @@ -93,6 +99,22 @@ public class SysDept extends BaseEntity this.companyId = companyId; } + public String getSocialCreditCode() { + return socialCreditCode; + } + + public void setSocialCreditCode(String socialCreditCode) { + this.socialCreditCode = socialCreditCode; + } + + public String getEnterpriseOwnershipCode() { + return enterpriseOwnershipCode; + } + + public void setEnterpriseOwnershipCode(String enterpriseOwnershipCode) { + this.enterpriseOwnershipCode = enterpriseOwnershipCode; + } + public Long getDeptId() { return deptId; diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/StringUtils.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/StringUtils.java index 7491ffc..4189ae2 100644 --- a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/StringUtils.java +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/StringUtils.java @@ -1,10 +1,7 @@ package com.bonus.sgzb.common.core.utils; -import java.security.SecureRandom; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; + import com.bonus.sgzb.common.core.constant.Constants; import com.bonus.sgzb.common.core.text.StrFormatter; import lombok.extern.slf4j.Slf4j; @@ -24,7 +21,58 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** 下划线 */ private static final char SEPARATOR = '_'; - private static SecureRandom random = null; + private static final Map CAT_MAP; + + static { + CAT_MAP = new HashMap<>(); + CAT_MAP.put("线路施工类", "A"); + CAT_MAP.put("变电施工类", "B"); + CAT_MAP.put("特种及其他设备", "C"); + CAT_MAP.put("检修试验", "D"); + CAT_MAP.put("创新装备", "E"); + } + + /** + 1 抱杆 01人字抱杆、02平臂抱杆、03悬浮抱杆、04.... + 2 放线及滑车 01牵张设备、02滑车、03.... + 3 收紧设备 01电动紧线机、02液压紧线机、03... + 4 线路动力设备 01机动绞磨、02压接机、03飞车及间隔棒运输机、04.... + 5 配件及仪器仪表 01锚固、02绳索、03连接器、04全站仪RPK、05附件、06.... + + 1 一次安装设备 01滤油机、02 SF6回收装置、03排油泵、04真空泵、05.... + 2 变电运输设备 01二次屏柜搬运设备、02液压移动小车、03轨道小车、04 GIS运输小坦克、05.. + + 1 直升机及无人机 01、多旋翼无人机、02固定翼无人机、03巡线直升机、04... + 2 带电清洗设备 01线路水冲洗、02变电水冲洗、03... + 3 起重设备 01汽车起重机、02履带式起重机、03随车起重机、04... + 4 土建设备 01履带式推土机、02液压式挖掘机、03混凝土泵车、05旋挖钻机、06... + 5 运输设备 01厢式货车、02平板货车、03灌式运输车、04履带运输车、05... + 6 高空作业设备 01曲臂升降车、02高处作业平台车、03剪叉式升降平台、04... + + 1 一次试验设备 01试验变压器、02高压直流发生器、03绕组直流电阻、04变比测试仪、05... + 2 二次试验设备 01万用表、02电流表、03微安表、04... + 3 油化试验设备 01微水测试仪、02介损测试仪、03... + + 1 线路创新装备 01索道自动上下料装置、02遥控索道牵引机、03塔材组片专用装备、04... + 2 变电创新装备 01自动安装机械、02新型模具和加固装置、03 GIS/HGIS设备整体就位装备、04.. + 3 其他新装备 01砌筑作业机器人、02高处作业平台车、03电缆敷设智能化控制装备、04... + + map.put("抱杆_人字抱杆","101"); + map.put("抱杆_平臂抱杆","102"); + map.put("抱杆_悬浮抱杆","103"); + map.put("放线及滑车_牵张设备","201"); + map.put("放线及滑车_滑车","202"); + map.put("收紧设备_电动紧线机","301"); + map.put("收紧设备_液压紧线机","302"); + map.put("线路动力设备_机动绞磨","401"); + map.put("线路动力设备_压接机","402"); + map.put("线路动力设备_飞车及间隔棒运输机","403"); + map.put("配件及仪器仪表_锚固","501"); + map.put("配件及仪器仪表_绳索","502"); + map.put("配件及仪器仪表_连接器","503"); + map.put("配件及仪器仪表_全站仪RPK","504"); + map.put("配件及仪器仪表_附件","505"); + */ /** * 获取参数不为空值 @@ -557,29 +605,19 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils return sb.toString(); } -// public static String getDeviceCode() { -// String randomNum = null; -// try { -// random = SecureRandom.getInstance("SHA1PRNG"); -// randomNum = String.format("%02d", random.nextInt(100)); -// } catch (NoSuchAlgorithmException e) { -// log.error("生成随机数失败,", e); -// } -// String deviceCode = "CSG-A101-" + DateUtils.dateTime() + randomNum; //like CSG-A101-2024061900001, need save it -// return deviceCode; -// } - - public static String getDeviceCode(Date date, String maId) { + /** 生成工器具编码: 类似CSG-A101-2024061900001 */ + public static String getDeviceCode(String ownerCode, String categoryName, String typeId, Date date, String maId) { int number = Integer.parseInt(maId); - if (number > 50000) { - number = number % 50000; + if (number > 30000) { + number = number % 30000; } String numberStr = String.format("%05d", number); - String deviceCode = "CSG-A101-" + DateUtils.getDateTimeString(date) + numberStr; //like CSG-A101-2024061900001 + String deviceCode = ownerCode + "-" + CAT_MAP.get(categoryName) + typeId + "-" + DateUtils.getDateTimeString(date) + numberStr; return deviceCode; } // public static void main(String[] args) { -// System.out.println(getDeviceCode(new Date(), "500322")); +// System.out.println(getDeviceCode("CSG", "线路施工类", "102", new Date(), "500322")); // } + } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index a9b5db9..ff45684 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -22,6 +22,7 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.GetTokenByAppKey; import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.material.exception.ExceptionDict; +import com.bonus.sgzb.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -1387,17 +1388,21 @@ public class TmTaskServiceImpl implements TmTaskService { log.info("dataString-=========:" + data); resultDataHandler(data); } catch (Exception e) { - return AjaxResult.success("请求成功!"); + return AjaxResult.error("请求失败!{}", e.getMessage()); } + //TODO 更改pushStatus + return AjaxResult.success("请求成功!"); } return AjaxResult.success("请求成功!"); } private void makeIntelligentVOList(List tmTasks, List intelVOList) { + LoginUser loginUser = SecurityUtils.getLoginUser(); for (TmTask task : tmTasks) { List subTasks = tmTaskMapper.getLeaseOutDetails(task); for (TmTask subTask : subTasks) { MaMachineIntelligentVO intelVO = new MaMachineIntelligentVO(); + intelVO.setSocialCreditCode(loginUser.getSysUser().getDept().getSocialCreditCode()); intelVO.setAffiliatedUnitName(task.getUnitName()); intelVO.setBelongUnitId(String.valueOf(task.getUnitId())); intelVO.setCategoryCode(task.getTypeId()); @@ -1414,7 +1419,8 @@ public class TmTaskServiceImpl implements TmTaskService { intelVO.setSpecificationType(""); intelVO.setValidityDate(new Date()); //每个设备不同点的设置 - intelVO.setDeviceCode(StringUtils.getDeviceCode(subTask.getCreateTime(), subTask.getMaId())); + String ownerCode = loginUser.getSysUser().getDept().getEnterpriseOwnershipCode(); + intelVO.setDeviceCode(StringUtils.getDeviceCode(ownerCode, subTask.getTypeName(), subTask.getTypeId(), subTask.getCreateTime(), subTask.getMaId())); intelVO.setFactoryDate(subTask.getOutFacTime()); intelVO.setMachineryCode(subTask.getMaId()); intelVO.setTrialDate(subTask.getThisCheckTime()); diff --git a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_dev.yml b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_dev.yml index 70297e7..d27b307 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_dev.yml +++ b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_dev.yml @@ -32,4 +32,8 @@ sgzb: site: cq job: settlementJobDay: 21 - settlementJobCron: "0 0 1 21 * ?" \ No newline at end of file + settlementJobCron: "0 0 1 21 * ?" + zlptUrl: + intelligentUrl: + intelligentAppKey: + intelligentAesKey: \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_local.yml b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_local.yml index f3326a0..fdef011 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_local.yml +++ b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cloud_local.yml @@ -32,4 +32,8 @@ sgzb: site: cq job: settlementJobDay: 21 - settlementJobCron: "0 0 1 21 * ?" \ No newline at end of file + settlementJobCron: "0 0 1 21 * ?" + zlptUrl: + intelligentUrl: + intelligentAppKey: + intelligentAesKey: \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_dev.yml b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_dev.yml index d1d05df..f9d7633 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_dev.yml +++ b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_dev.yml @@ -32,4 +32,8 @@ sgzb: site: cq job: settlementJobDay: 21 - settlementJobCron: "0 0 1 21 * ?" \ No newline at end of file + settlementJobCron: "0 0 1 21 * ?" + zlptUrl: + intelligentUrl: + intelligentAppKey: + intelligentAesKey: \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_local.yml b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_local.yml index dc5cd6f..a830327 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_local.yml +++ b/sgzb-modules/sgzb-material/src/main/resources/bootstrap-sgzb_cq_local.yml @@ -32,4 +32,8 @@ sgzb: site: cq job: settlementJobDay: 21 - settlementJobCron: "0 0 1 21 * ?" \ No newline at end of file + settlementJobCron: "0 0 1 21 * ?" + zlptUrl: + intelligentUrl: + intelligentAppKey: + intelligentAesKey: \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/app/TmTaskMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/app/TmTaskMapper.xml index d2f4f0d..e442ce3 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/app/TmTaskMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/app/TmTaskMapper.xml @@ -1176,14 +1176,21 @@