Merge branch 'master' into typechange0901
This commit is contained in:
commit
99fc70cf0c
|
|
@ -0,0 +1,73 @@
|
|||
package com.bonus.sgzb.base.api.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value="com.bonus.sgzb.base.api.domain.MaMachineIntelligentVO")
|
||||
@Data
|
||||
public class MaMachineIntelligentVO extends BaseEntity {
|
||||
@ApiModelProperty(value = "数据有效标识 0:有效 1:无效")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "作废原因,数据作废时必填")
|
||||
private String delReason;
|
||||
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
private String remarks;
|
||||
|
||||
@ApiModelProperty(value = "工器具编码")
|
||||
private String deviceCode; //like CSG-A101-2024061900001
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String specificationType;
|
||||
|
||||
@ApiModelProperty(value = "生产厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "出厂日期")
|
||||
private Date factoryDate;
|
||||
|
||||
@ApiModelProperty(value = "检验证编号")
|
||||
private String inspectionCertificateNumber;
|
||||
|
||||
@ApiModelProperty(value = "检验单位")
|
||||
private String inspectorUnitName;
|
||||
|
||||
@ApiModelProperty(value = "所属单位")
|
||||
private String affiliatedUnitName;
|
||||
|
||||
@ApiModelProperty(value = "企业机构代码(统一社会信用代码)")
|
||||
private String socialCreditCode; //公司信息必填
|
||||
|
||||
@ApiModelProperty(value = "默认1:智慧工程系统 2:第三方数据")
|
||||
private Integer source;
|
||||
|
||||
@ApiModelProperty(value = "试验日期")
|
||||
private Date trialDate;
|
||||
|
||||
@ApiModelProperty(value = "有效截止日期")
|
||||
private Date validityDate;
|
||||
|
||||
@ApiModelProperty(value = "使用所属单位ID")
|
||||
private String belongUnitId;
|
||||
|
||||
@ApiModelProperty(value = "门类编码")
|
||||
private String categoryCode;
|
||||
|
||||
@ApiModelProperty(value = "分类编码")
|
||||
private String classifyCode;
|
||||
|
||||
@ApiModelProperty(value = "机具编码")
|
||||
private String machineryCode;
|
||||
|
||||
@ApiModelProperty(value = "操作方式 0:默认新增 1:修改以前推送的数据")
|
||||
private Integer operateType;
|
||||
|
||||
@ApiModelProperty(value = "存在图片时必填")
|
||||
private String multipartFiles;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||
}
|
||||
|
||||
public static final String getDateTimeString(Date date)
|
||||
{
|
||||
return DateFormatUtils.format(date, "yyyyMMdd");
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期型字符串转化为日期 格式
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,26 +11,46 @@ import org.apache.http.entity.StringEntity;
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpHelper {
|
||||
|
||||
public static String sendHttpPost(String url, String JSONBody) throws Exception {
|
||||
|
||||
System.out.println("JSONBody-=========:" + JSONBody);
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.addHeader("Content-Type", "application/json");
|
||||
httpPost.setEntity(new StringEntity(JSONBody));
|
||||
httpPost.addHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
httpPost.setEntity(new StringEntity(JSONBody,StandardCharsets.UTF_8));
|
||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseContent = EntityUtils.toString(entity, "UTF-8");
|
||||
String responseContent = EntityUtils.toString(entity, StandardCharsets.UTF_8);
|
||||
response.close();
|
||||
httpClient.close();
|
||||
return responseContent;
|
||||
}
|
||||
|
||||
public static String sendHttpPost(String url, Map<String,String> headerMap, String JSONBody) throws Exception {
|
||||
System.out.println("JSONBody-=========:" + JSONBody);
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.addHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
if (!CollectionUtils.isEmpty(headerMap)) {
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
httpPost.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
httpPost.setEntity(new StringEntity(JSONBody,StandardCharsets.UTF_8));
|
||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseContent = EntityUtils.toString(entity, StandardCharsets.UTF_8);
|
||||
response.close();
|
||||
httpClient.close();
|
||||
return responseContent;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,135 @@
|
|||
package com.bonus.sgzb.common.core.utils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/5/25 16:07
|
||||
*/
|
||||
public class RsaUtil {
|
||||
|
||||
//签名算法名称
|
||||
private static final String RSA_KEY_ALGORITHM = "RSA";
|
||||
|
||||
//RSA密钥长度,默认密钥长度是1024,密钥长度必须是64的倍数,在512到65536位之间,不管是RSA还是RSA2长度推荐使用2048
|
||||
private static final int KEY_SIZE = 2048;
|
||||
|
||||
/**
|
||||
* 公钥加密(用于数据加密)
|
||||
*
|
||||
* @param data 加密前的字符串
|
||||
* @param publicKeyStr base64编码后的公钥
|
||||
* @return base64编码后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPublicKey(String data, String publicKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] pubKey = Base64.getDecoder().decode(publicKeyStr);
|
||||
//创建X509编码密钥规范
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据X509编码密钥规范产生公钥对象
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用公钥初始化此Cipher对象(加密模式)
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
//对数据加密
|
||||
byte[] encrypt = cipher.doFinal(data.getBytes());
|
||||
//返回base64编码后的字符串
|
||||
return Base64.getEncoder().encodeToString(encrypt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 私钥解密(用于数据解密)
|
||||
*
|
||||
* @param data 解密前的字符串
|
||||
* @param privateKeyStr 私钥
|
||||
* @return 解密后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPrivateKey(String data, String privateKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] priKey = Base64.getDecoder().decode(privateKeyStr);
|
||||
//创建PKCS8编码密钥规范
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(priKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据PKCS8编码密钥规范产生私钥对象
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用私钥初始化此Cipher对象(解密模式)
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
//对数据解密
|
||||
byte[] decrypt = cipher.doFinal(Base64.getDecoder().decode(data));
|
||||
//返回字符串
|
||||
return new String(decrypt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 私钥加密(用于数据签名)
|
||||
*
|
||||
* @param data 加密前的字符串
|
||||
* @param privateKeyStr base64编码后的私钥
|
||||
* @return base64编码后后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPrivateKey(String data, String privateKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] priKey = Base64.getDecoder().decode(privateKeyStr);
|
||||
//创建PKCS8编码密钥规范
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(priKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据PKCS8编码密钥规范产生私钥对象
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用私钥初始化此Cipher对象(加密模式)
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
//对数据加密
|
||||
byte[] encrypt = cipher.doFinal(data.getBytes());
|
||||
//返回base64编码后的字符串
|
||||
return Base64.getEncoder().encodeToString(encrypt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密(用于数据验签)
|
||||
*
|
||||
* @param data 解密前的字符串
|
||||
* @param publicKeyStr base64编码后的公钥
|
||||
* @return 解密后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPublicKey(String data, String publicKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] pubKey = Base64.getDecoder().decode(publicKeyStr);
|
||||
//创建X509编码密钥规范
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据X509编码密钥规范产生公钥对象
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用公钥初始化此Cipher对象(解密模式)
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
//对数据解密
|
||||
byte[] decrypt = cipher.doFinal(Base64.getDecoder().decode(data));
|
||||
//返回字符串
|
||||
return new String(decrypt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.bonus.sgzb.common.core.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
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;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
/**
|
||||
|
|
@ -13,6 +12,7 @@ import org.springframework.util.AntPathMatcher;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Slf4j
|
||||
public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
{
|
||||
/** 空字符串 */
|
||||
|
|
@ -21,6 +21,59 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||
/** 下划线 */
|
||||
private static final char SEPARATOR = '_';
|
||||
|
||||
private static final Map<String, String> 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");
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取参数不为空值
|
||||
*
|
||||
|
|
@ -551,4 +604,20 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** 生成工器具编码: 类似CSG-A101-2024061900001 */
|
||||
public static String getDeviceCode(String ownerCode, String categoryName, String typeId, Date date, String maId) {
|
||||
int number = Integer.parseInt(maId);
|
||||
if (number > 30000) {
|
||||
number = number % 30000;
|
||||
}
|
||||
String numberStr = String.format("%05d", number);
|
||||
String deviceCode = ownerCode + "-" + CAT_MAP.get(categoryName) + typeId + "-" + DateUtils.getDateTimeString(date) + numberStr;
|
||||
return deviceCode;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// System.out.println(getDeviceCode("CSG", "线路施工类", "102", new Date(), "500322"));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,28 @@
|
|||
<artifactId>sgzb-common-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.6.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.43</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-configuration-processor</artifactId>-->
|
||||
<!-- <version>3.1.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba</groupId>-->
|
||||
<!-- <artifactId>fastjson</artifactId>-->
|
||||
<!-- <version>2.0.25</version>-->
|
||||
<!-- <scope>compile</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.sgzb.common.security.utils;
|
||||
|
||||
import cn.hutool.crypto.Mode;
|
||||
import cn.hutool.crypto.Padding;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class GetTokenByAppKey {
|
||||
// public static void main(String[] args) {
|
||||
// String appKey = "abc123";
|
||||
// String aesKey = "abcdefghijklmnop";
|
||||
// String token = getToken(appKey, aesKey);
|
||||
// System.err.println(token);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取Token
|
||||
* @return Token
|
||||
* appKey、aesKey联系智慧工程系统提供
|
||||
*/
|
||||
public static String getToken(String appKey, String aesKey) {
|
||||
Map<String, Object> signatureMap = new HashMap<String, Object>();
|
||||
signatureMap.put("appKey", appKey);
|
||||
signatureMap.put("timestamp", String.valueOf(System.currentTimeMillis()));
|
||||
Iterator<String> iterator = signatureMap.keySet().iterator();
|
||||
//Map 转成 JSONObject 字符串
|
||||
JSONObject jsonObj = new JSONObject(signatureMap);
|
||||
String jsonStr = jsonObj.toJSONString();
|
||||
|
||||
AES aes = new AES(Mode.ECB, Padding.PKCS5Padding, aesKey.getBytes());
|
||||
byte[] aesByte = aes.encrypt(jsonStr.getBytes(StandardCharsets.UTF_8));
|
||||
String token = byteToHex(aesByte);
|
||||
return token;
|
||||
}
|
||||
|
||||
public static String byteToHex(byte[] bytes) {
|
||||
String strHex = "";
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
for (int n = 0; n < bytes.length; n++) {
|
||||
strHex = Integer.toHexString(bytes[n] & 0xFF);
|
||||
sb.append((strHex.length() == 1) ? "0" + strHex : strHex); // 每个字节由两个字符表示,位数不够,高位补0
|
||||
}
|
||||
return sb.toString().trim();
|
||||
}
|
||||
}
|
||||
|
|
@ -604,5 +604,13 @@ public class TmTaskController extends BaseController {
|
|||
return getDataTable(leaseAuditList);
|
||||
}
|
||||
|
||||
@Log(title = "把设备推送到智慧工程", businessType = BusinessType.QUERY)
|
||||
@ApiOperation(value = "把设备推送到智慧工程")
|
||||
@PostMapping("/pushToIntelligentProject")
|
||||
public AjaxResult pushToIntelligentProject(@RequestBody List<TmTask> tmTasks)
|
||||
{
|
||||
logger.info("MaMachineController pushToIntelligentProject 装备推送入口====");
|
||||
return tmTaskService.pushToIntelligentProject(tmTasks);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,4 +272,13 @@ public class TmTask implements Serializable {
|
|||
private Integer souceByRefuse;
|
||||
private int souceBy;
|
||||
|
||||
@ApiModelProperty(value = "出厂日期")
|
||||
private Date outFacTime;
|
||||
@ApiModelProperty(value = "出厂编号")
|
||||
private String outFacCode;
|
||||
@ApiModelProperty(value = "本次检验日期")
|
||||
private Date thisCheckTime;
|
||||
@ApiModelProperty(value = "工器具编码")
|
||||
private String deviceCode; //like CSG-A101-2024061900001
|
||||
|
||||
}
|
||||
|
|
@ -112,6 +112,8 @@ public interface TmTaskMapper {
|
|||
|
||||
List<TmTask> getLeaseOutListByUser(TmTask task);
|
||||
|
||||
List<TmTask> getLeaseOutDetails(TmTask task);
|
||||
|
||||
List<TmTask> getLeaseDetailByParentId(TmTask record);
|
||||
|
||||
List<TmTask> getMaTypeDetails(LeaseApplyDetails leaseApplyDetails);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.app.service;
|
|||
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -110,4 +111,6 @@ public interface TmTaskService{
|
|||
* @return
|
||||
*/
|
||||
String selectTaskNumByMonths(@Param("date") Date nowDate, @Param("taskType") Integer taskType);
|
||||
|
||||
AjaxResult pushToIntelligentProject(List<TmTask> tmTasks);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.sgzb.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
|
|
@ -8,19 +10,24 @@ import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
|
|||
import com.bonus.sgzb.app.mapper.LeaseApplyInfoMapper;
|
||||
import com.bonus.sgzb.app.mapper.TmTaskMapper;
|
||||
import com.bonus.sgzb.app.service.*;
|
||||
import com.bonus.sgzb.base.api.domain.BmFlowRecord;
|
||||
import com.bonus.sgzb.base.api.domain.BmFlowRelation;
|
||||
import com.bonus.sgzb.base.api.domain.MachinePart;
|
||||
import com.bonus.sgzb.base.api.domain.*;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.domain.R;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||
import com.bonus.sgzb.common.core.utils.RsaUtil;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
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;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
|
@ -38,6 +45,15 @@ import java.util.stream.Collectors;
|
|||
@Slf4j
|
||||
public class TmTaskServiceImpl implements TmTaskService {
|
||||
|
||||
@Value("${sgzb.intelligentUrl}")
|
||||
private String intelligentUrl;
|
||||
|
||||
@Value("${sgzb.intelligentAppKey}")
|
||||
private String intelligentAppKey;
|
||||
|
||||
@Value("${sgzb.intelligentAesKey}")
|
||||
private String intelligentAesKey;
|
||||
|
||||
@Resource
|
||||
private TmTaskMapper tmTaskMapper;
|
||||
|
||||
|
|
@ -545,7 +561,6 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
return tmTaskMapper.selectTaskNumByMonths(nowDate, taskType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取领料申请列表
|
||||
*/
|
||||
|
|
@ -1349,4 +1364,92 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
public LeaseApplyInfo getListSomeol(LeaseApplyInfo info) {
|
||||
return tmTaskMapper.getListSomeol(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushToIntelligentProject(List<TmTask> tmTasks) {
|
||||
log.info("MaMachineServiceImpl pushNotifications 开始处理设备到智慧工程的推送逻辑==={}",tmTasks);
|
||||
List<MaMachineIntelligentVO> intelVOList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(tmTasks)){
|
||||
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG,"maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
|
||||
} else {
|
||||
makeIntelligentVOList(tmTasks, intelVOList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(intelVOList)) {
|
||||
try {
|
||||
String content = JSONObject.toJSONString(intelVOList);
|
||||
Map<String, String> bodyMap = new HashMap<>();
|
||||
bodyMap.put("body", content);
|
||||
String body = JSONObject.toJSONString(bodyMap);
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("appKey", intelligentAppKey);
|
||||
String token = GetTokenByAppKey.getToken(intelligentAppKey, intelligentAesKey);
|
||||
headerMap.put("token", token);
|
||||
String data = HttpHelper.sendHttpPost(intelligentUrl+"/acceptExternalMechanical", headerMap, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
resultDataHandler(data);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("请求失败!{}", e.getMessage());
|
||||
}
|
||||
//TODO 更改pushStatus
|
||||
return AjaxResult.success("请求成功!");
|
||||
}
|
||||
return AjaxResult.success("请求成功!");
|
||||
}
|
||||
|
||||
private void makeIntelligentVOList(List<TmTask> tmTasks, List<MaMachineIntelligentVO> intelVOList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
for (TmTask task : tmTasks) {
|
||||
List<TmTask> 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());
|
||||
intelVO.setClassifyCode(task.getTypeId());
|
||||
intelVO.setDelReason("");
|
||||
intelVO.setInspectorUnitName("");
|
||||
intelVO.setInspectionCertificateNumber("");
|
||||
intelVO.setManufacturer("");
|
||||
intelVO.setMultipartFiles("");
|
||||
intelVO.setOperateType(1); //0:默认新增 1:修改以前推送的数据
|
||||
intelVO.setRemarks("");
|
||||
intelVO.setSource(2); //1:智慧工程系统 2:第三方数据
|
||||
intelVO.setStatus("15".equals(task.getMaStatus()) ? 0 : 1); //0:有效 1:无效
|
||||
intelVO.setSpecificationType("");
|
||||
intelVO.setValidityDate(new Date());
|
||||
//每个设备不同点的设置
|
||||
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());
|
||||
//组成list
|
||||
intelVOList.add(intelVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resultDataHandler(String data) throws Exception {
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
System.err.println(data);
|
||||
String code = object.getString("code");
|
||||
if ("200".equals(code)) {
|
||||
String dataResultString = object.getString("data");
|
||||
// 数据解密
|
||||
String dataArrayString = RsaUtil.decryptByPrivateKey(dataResultString, Constants.publicKey);
|
||||
log.info("dataArrayString-=========:" + dataArrayString);
|
||||
JSONArray dataArray = JSONArray.parseArray(dataArrayString);
|
||||
if (dataArray != null && dataArray.size() > 0) {
|
||||
|
||||
|
||||
}else {
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -117,4 +117,14 @@ public class MaMachineController extends BaseController {
|
|||
{
|
||||
return success(maMachineService.selectMaMachineByMaId(maId));
|
||||
}
|
||||
|
||||
@Log(title = "把设备推送到租赁平台", businessType = BusinessType.QUERY)
|
||||
@ApiOperation(value = "把设备推送到租赁平台")
|
||||
@PostMapping("/pushNotifications")
|
||||
public AjaxResult pushNotifications(@RequestBody List<MaMachine> maMachineList)
|
||||
{
|
||||
logger.info("MaMachineController pushNotifications 装备推送入口====");
|
||||
return maMachineService.pushNotifications(maMachineList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.sgzb.common.core.web.controller.BaseController;
|
|||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -32,20 +33,15 @@ public class MaReceiveController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "获取推送数据")
|
||||
@PostMapping("/dataReceive")
|
||||
public AjaxResult getProjectInfoAll(@RequestBody List<DataReceiveDetail> dataReceiveDetails) {
|
||||
if (CollUtil.isEmpty(dataReceiveDetails)) {
|
||||
public AjaxResult getProjectInfoAll(@RequestBody String maMachineRequest) {
|
||||
if (StringUtils.isEmpty(maMachineRequest)) {
|
||||
return AjaxResult.error("推送数据为空");
|
||||
}
|
||||
DataReceiveInfo dataReceiveInfo = new DataReceiveInfo();
|
||||
dataReceiveInfo.setPushNum(dataReceiveDetails.size());
|
||||
int id = maReceiveService.saveDataReceiveInfo(dataReceiveInfo);
|
||||
|
||||
int id = maReceiveService.saveDataReceiveInfo(maMachineRequest);
|
||||
if (id == 0) {
|
||||
return AjaxResult.error("推送数据失败");
|
||||
}
|
||||
for (DataReceiveDetail dataReceiveDetail : dataReceiveDetails) {
|
||||
dataReceiveDetail.setReceiveId(id);
|
||||
maReceiveService.saveDataReceiveDetails(dataReceiveDetail);
|
||||
}
|
||||
return AjaxResult.success("数据推送成功");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.base.controller;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.domain.vo.TreeSelect;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeMapper;
|
||||
import com.bonus.sgzb.base.service.ITypeService;
|
||||
|
|
@ -42,6 +43,8 @@ public class MaTypeController extends BaseController {
|
|||
return AjaxResult.success(maTypeList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工机具类型下拉树
|
||||
* @return 结果
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
package com.bonus.sgzb.base.controller;
|
||||
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.service.IMaTypeKeeperService;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库管员配置ma_type_keeper(MaTypeKeeper)表控制层
|
||||
*
|
||||
|
|
@ -52,5 +56,11 @@ public class MaTypeKeeperController extends BaseController {
|
|||
return getDataTable(maTypeKeeperService.getListByMaType(userId, typeName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询全部库管员信息")
|
||||
@GetMapping("/getMaTypeKeeper")
|
||||
public AjaxResult getMaTypeKeeper(){
|
||||
List<MaKeeperUser> maTypeList = maTypeKeeperService.getMaTypeKeeper();
|
||||
return AjaxResult.success(maTypeList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,4 +85,6 @@ public class DataReceiveDetail {
|
|||
@ApiModelProperty(value = "数据来源(0新购 1盘点 2数据推送)")
|
||||
private Integer souceBy;
|
||||
|
||||
@ApiModelProperty(value = "接收人")
|
||||
private String userIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.sgzb.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MaKeeperUser {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.bonus.sgzb.base.mapper;
|
|||
import com.bonus.sgzb.base.domain.DataReceiveDetail;
|
||||
import com.bonus.sgzb.base.domain.DataReceiveInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -24,5 +25,5 @@ public interface MaReceiveMapper {
|
|||
|
||||
List<DataReceiveDetail> getDateReceiveMachine(DataReceiveDetail dataReceiveDetail);
|
||||
|
||||
int updateInfoStatus(Integer id);
|
||||
int updateInfoStatus(@Param("id") Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.base.mapper;
|
||||
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.vo.DeptUser;
|
||||
import com.bonus.sgzb.base.vo.MaTypeKeeperVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -29,5 +30,11 @@ public interface MaTypeKeeperMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaTypeKeeperVO> selectListByUserId(Long userId, String typeName);
|
||||
|
||||
/**
|
||||
* 查询全部库管员信息
|
||||
* @return
|
||||
*/
|
||||
List<MaKeeperUser> getMaTypeKeeper();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.base.mapper;
|
|||
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.domain.MaPropSet;
|
||||
import com.bonus.sgzb.base.domain.MaTypeKeeper;
|
||||
import com.bonus.sgzb.base.domain.MaTypeRepair;
|
||||
|
|
@ -86,4 +87,6 @@ public interface MaTypeMapper {
|
|||
int updateTypeNum(MaMachine maMachine);
|
||||
|
||||
List<MaTypeKeeper> selectMaTypeByUserId(Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.base.service;
|
||||
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.vo.DeptUser;
|
||||
import com.bonus.sgzb.base.vo.MaTypeKeeperVO;
|
||||
|
||||
|
|
@ -27,5 +28,11 @@ public interface IMaTypeKeeperService {
|
|||
* @return
|
||||
*/
|
||||
List<MaTypeKeeperVO> getListByMaType(Long userId, String typeName);
|
||||
|
||||
/**
|
||||
* 查询全部库管员信息
|
||||
* @return
|
||||
*/
|
||||
List<MaKeeperUser> getMaTypeKeeper();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.base.service;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.domain.vo.TreeSelect;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -69,4 +70,5 @@ public interface ITypeService {
|
|||
|
||||
List<MaType> getEquipmentType(Long typeId, String typeName);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.base.service;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -22,4 +23,6 @@ public interface MaMachineService {
|
|||
public MaMachine selectMaMachineByMaId(Long maId);
|
||||
|
||||
MaMachine getMachineByQrCode(MaMachine maMachine);
|
||||
|
||||
AjaxResult pushNotifications(List<MaMachine> maMachineList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
* @Date:2024/7/24 - 13:20
|
||||
*/
|
||||
public interface MaReceiveService {
|
||||
int saveDataReceiveInfo(DataReceiveInfo dataReceiveInfo);
|
||||
int saveDataReceiveInfo(String maMachineRequest);
|
||||
|
||||
int saveDataReceiveDetails(DataReceiveDetail dataReceiveDetail);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.sgzb.base.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.sgzb.base.api.domain.MaLabelBind;
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
|
|
@ -8,19 +10,26 @@ import com.bonus.sgzb.base.domain.MaPropSet;
|
|||
import com.bonus.sgzb.base.domain.vo.IotRecordVo;
|
||||
import com.bonus.sgzb.base.mapper.*;
|
||||
import com.bonus.sgzb.base.service.MaMachineService;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||
import com.bonus.sgzb.common.core.utils.RsaUtil;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.exception.ExceptionDict;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MaMachineServiceImpl implements MaMachineService {
|
||||
|
||||
@Value("${sgzb.zlptUrl}")
|
||||
private String zlptUrl;
|
||||
@Resource
|
||||
private MaMachineMapper maMachineMapper;
|
||||
|
||||
|
|
@ -171,4 +180,43 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
}
|
||||
return ma;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushNotifications(List<MaMachine> maMachineList) {
|
||||
log.info("MaMachineServiceImpl pushNotifications 开始处理设备推送逻辑==={}",maMachineList);
|
||||
if (maMachineList.isEmpty()){
|
||||
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG,"maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
|
||||
}
|
||||
String content = JSONObject.toJSONString(maMachineList);
|
||||
String encrypt;
|
||||
try {
|
||||
//encrypt = RsaUtil.encryptByPublicKey(content, Constants.publicKey);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("body", content);
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String data = HttpHelper.sendHttpPost(zlptUrl, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
//对返回的结果进行处理
|
||||
// resultDataHandler(data);
|
||||
|
||||
} catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
return AjaxResult.error("推送失败!");
|
||||
}
|
||||
return AjaxResult.success("请求成功!");
|
||||
}
|
||||
|
||||
private void resultDataHandler(String data) throws Exception {
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
System.err.println(data);
|
||||
String code = object.getString("code");
|
||||
if ("0".equals(code)) {
|
||||
String dataResultString = object.getString("data");
|
||||
// 数据解密
|
||||
String dataArrayString = RsaUtil.decryptByPrivateKey(dataResultString, Constants.publicKey);
|
||||
log.info("dataArrayString-=========:" + dataArrayString);
|
||||
} else {
|
||||
throw new Exception("推送失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.sgzb.base.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.base.domain.DataReceiveDetail;
|
||||
import com.bonus.sgzb.base.domain.DataReceiveInfo;
|
||||
|
|
@ -7,6 +9,7 @@ import com.bonus.sgzb.base.mapper.MaMachineMapper;
|
|||
import com.bonus.sgzb.base.mapper.MaReceiveMapper;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeMapper;
|
||||
import com.bonus.sgzb.base.service.MaReceiveService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -18,6 +21,7 @@ import java.util.List;
|
|||
* @Author:liang.chao
|
||||
* @Date:2024/7/24 - 13:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MaReceiveServiceImpl implements MaReceiveService {
|
||||
|
||||
|
|
@ -32,9 +36,20 @@ public class MaReceiveServiceImpl implements MaReceiveService {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public int saveDataReceiveInfo(DataReceiveInfo dataReceiveInfo) {
|
||||
public int saveDataReceiveInfo(String maMachineRequest) {
|
||||
log.info("推送数据{}", maMachineRequest);
|
||||
JSONObject object = JSONObject.parseObject(maMachineRequest);
|
||||
maMachineRequest = object.getString("body");
|
||||
JSONArray dataArray = JSONArray.parseArray(maMachineRequest);
|
||||
List<DataReceiveDetail> dataReceiveDetails = dataArray.toJavaList(DataReceiveDetail.class);
|
||||
DataReceiveInfo dataReceiveInfo = new DataReceiveInfo();
|
||||
dataReceiveInfo.setPushNum(dataReceiveDetails.size());
|
||||
maReceiveMapper.saveDataReceiveInfo(dataReceiveInfo);
|
||||
if (dataReceiveInfo.getId() != null) {
|
||||
for (DataReceiveDetail dataReceiveDetail : dataReceiveDetails) {
|
||||
dataReceiveDetail.setReceiveId(dataReceiveInfo.getId());
|
||||
saveDataReceiveDetails(dataReceiveDetail);
|
||||
}
|
||||
return dataReceiveInfo.getId();
|
||||
} else {
|
||||
return 0;
|
||||
|
|
@ -71,12 +86,12 @@ public class MaReceiveServiceImpl implements MaReceiveService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int saveMachine(DataReceiveInfo dataReceiveInfo) {
|
||||
for (DataReceiveDetail dataReceiveDetail : dataReceiveInfo.getDataReceiveDetailList()) {
|
||||
MaMachine maMachine = new MaMachine();
|
||||
maMachine.setMaCode(dataReceiveDetail.getMaCode());
|
||||
maMachine.setTypeId(dataReceiveDetail.getTypeId());
|
||||
maMachine.setMaCode(dataReceiveDetail.getMaCode());
|
||||
maMachine.setMaStatus("15");
|
||||
maMachine.setCreateTime(new Date());
|
||||
maMachine.setSouceBy(2);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.base.service.impl;
|
||||
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeKeeperMapper;
|
||||
import com.bonus.sgzb.base.service.IMaTypeKeeperService;
|
||||
import com.bonus.sgzb.base.vo.DeptUser;
|
||||
|
|
@ -43,5 +44,14 @@ public class MaTypeKeeperServiceImpl implements IMaTypeKeeperService {
|
|||
|
||||
return maTypeKeeperMapper.selectListByUserId(userId, typeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部库管员信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaKeeperUser> getMaTypeKeeper() {
|
||||
return maTypeKeeperMapper.getMaTypeKeeper();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.bonus.sgzb.base.service.impl;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
import com.bonus.sgzb.base.domain.MaPropSet;
|
||||
import com.bonus.sgzb.base.domain.MaTypeFile;
|
||||
import com.bonus.sgzb.base.domain.MaTypeKeeper;
|
||||
import com.bonus.sgzb.base.domain.MaTypeRepair;
|
||||
import com.bonus.sgzb.base.domain.*;
|
||||
import com.bonus.sgzb.base.domain.vo.TreeSelect;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeFileMapper;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeMapper;
|
||||
|
|
@ -344,7 +341,6 @@ public class MaTypeServiceImpl implements ITypeService {
|
|||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author dingjie
|
||||
* @Date 2023/12/14
|
||||
|
|
|
|||
|
|
@ -32,4 +32,8 @@ sgzb:
|
|||
site: cq
|
||||
job:
|
||||
settlementJobDay: 21
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
zlptUrl:
|
||||
intelligentUrl:
|
||||
intelligentAppKey:
|
||||
intelligentAesKey:
|
||||
|
|
@ -32,4 +32,8 @@ sgzb:
|
|||
site: cq
|
||||
job:
|
||||
settlementJobDay: 21
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
zlptUrl:
|
||||
intelligentUrl:
|
||||
intelligentAppKey:
|
||||
intelligentAesKey:
|
||||
|
|
@ -32,4 +32,8 @@ sgzb:
|
|||
site: cq
|
||||
job:
|
||||
settlementJobDay: 21
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
zlptUrl:
|
||||
intelligentUrl:
|
||||
intelligentAppKey:
|
||||
intelligentAesKey:
|
||||
|
|
@ -32,4 +32,8 @@ sgzb:
|
|||
site: cq
|
||||
job:
|
||||
settlementJobDay: 21
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
settlementJobCron: "0 0 1 21 * ?"
|
||||
zlptUrl:
|
||||
intelligentUrl:
|
||||
intelligentAppKey:
|
||||
intelligentAesKey:
|
||||
|
|
@ -38,4 +38,8 @@ sgzb:
|
|||
job:
|
||||
settlementJobDay: 1
|
||||
settlementJobCron: "0 0 1 1 * ?"
|
||||
zlptUrl: http://test-rental.zhgkxt.com/proxy/item-center/supply/item/pushNotifications
|
||||
intelligentUrl: http://www.zhgkxt.com/api/clientapi/public/externalApi
|
||||
intelligentAppKey: abc123
|
||||
intelligentAesKey: abcdefghijklmnop
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
namespace: sgzb_nwjj
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
namespace: sgzb_nwjj
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
@ -38,4 +38,9 @@ sgzb:
|
|||
job:
|
||||
settlementJobDay: 1
|
||||
settlementJobCron: "0 0 1 1 * ?"
|
||||
zlptUrl: http://test-rental.zhgkxt.com/proxy/item-center/supply/item/pushNotifications
|
||||
intelligentUrl: http://www.zhgkxt.com/api/clientapi/public/externalApi
|
||||
intelligentAppKey: abc123
|
||||
intelligentAesKey: abcdefghijklmnop
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1174,4 +1174,23 @@
|
|||
AND task_type = #{taskType}
|
||||
ORDER BY create_time DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getLeaseOutDetails" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||
select
|
||||
mam.ma_id as maId,
|
||||
mam.ma_code as maCode,
|
||||
mam.out_fac_time as outFacTime,
|
||||
mam.out_fac_code as outFacCode,
|
||||
mam.this_check_time as thisCheckTime,
|
||||
mam.create_time as createTime,
|
||||
mt.type_id,
|
||||
mt3.type_name as typeName
|
||||
from lease_out_details lod
|
||||
left join ma_machine mam on mam.ma_id = lod.ma_id
|
||||
left join ma_type mt on mam.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
left join ma_type mt2 on mt1.parent_id = mt2.type_id
|
||||
left join ma_type mt3 on mt2.parent_id = mt3.type_id
|
||||
where lod.parent_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -422,5 +422,4 @@
|
|||
<update id="updateTypeNum">
|
||||
update ma_type set num = IFNULL( num, 0 ) + 1 where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -9,20 +9,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
values(#{pushNum},now())
|
||||
</insert>
|
||||
<insert id="saveDataReceiveDetails">
|
||||
insert into data_receive_detail(receive_id,check_code,check_unit,check_date,is_new,ma_code,ma_user_name,next_check_date,out_factory_time,rent_price,rent_time,supplier,type_id,unit_id)
|
||||
values(#{receiveId},#{checkCode},#{checkUnit},#{checkDate},#{isNew},#{maCode},#{maUserName},#{nextCheckDate},#{outFactoryTime},#{rentPrice},#{rentTime},#{supplier},#{typeId},#{unitId})
|
||||
insert into data_receive_detail(receive_id,check_code,check_unit,check_date,is_new,ma_id,ma_user_name,next_check_date,out_factory_time,rent_price,rent_time,supplier,type_id,unit_id)
|
||||
values(#{receiveId},#{checkCode},#{checkUnit},#{checkDate},#{isNew},#{maId},#{maUserName},#{nextCheckDate},#{outFactoryTime},#{rentPrice},#{rentTime},#{supplier},#{typeId},#{unitId})
|
||||
</insert>
|
||||
<update id="updateStatus">
|
||||
UPDATE data_receive_detail
|
||||
SET STATUS = 1,
|
||||
ma_id = #{maId}
|
||||
where receive_id = #{receiveId} and type_id = #{typeId}
|
||||
AND ma_code = #{maCode}
|
||||
where id = #{id}
|
||||
|
||||
</update>
|
||||
<update id="updateInfoStatus">
|
||||
UPDATE data_receive_info
|
||||
SET receive_status = 1
|
||||
where id = #{receiveId}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<select id="getDataReceive" resultType="com.bonus.sgzb.base.domain.DataReceiveInfo">
|
||||
select * from data_receive_info where 1=1
|
||||
|
|
|
|||
|
|
@ -26,4 +26,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user su on mtk.user_id = su.user_id
|
||||
</select>
|
||||
|
||||
<select id="getMaTypeKeeper" resultType="com.bonus.sgzb.base.domain.MaKeeperUser">
|
||||
SELECT
|
||||
mtk.user_id AS userId,
|
||||
su.user_name AS userName,
|
||||
su.nick_name AS nickName
|
||||
FROM
|
||||
ma_type_keeper mtk
|
||||
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||
GROUP BY
|
||||
mtk.user_id
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue