Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

纪新园 7 месяцев назад
Родитель
Сommit
bdac089343
14 измененных файлов с 401 добавлено и 19 удалено
  1. 58 0
      blade-common/src/main/java/org/springblade/common/enums/BsTypeEnum.java
  2. 5 0
      blade-common/src/main/java/org/springblade/common/enums/CommonEnum.java
  3. 33 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/dto/SendMailLogDTO.java
  4. 50 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/entity/SendMailLog.java
  5. 19 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/vo/SendMailLogVO.java
  6. 13 16
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/funding/entity/PjpfBalanceReset.java
  7. 14 3
      blade-service/blade-los/src/main/java/org/springblade/los/email/controller/EmailController.java
  8. 28 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/SendMailLogMapper.java
  9. 29 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/SendMailLogMapper.xml
  10. 25 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/service/impl/SendMailLogServiceImpl.java
  11. 5 0
      blade-service/blade-sales-part/pom.xml
  12. 62 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/duoduo/controller/DuoDuoOpenApiController.java
  13. 59 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/duoduo/util/MallSignUtil.java
  14. 1 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/funding/mapper/PjpfBalanceResetMapper.xml

+ 58 - 0
blade-common/src/main/java/org/springblade/common/enums/BsTypeEnum.java

@@ -0,0 +1,58 @@
+package org.springblade.common.enums;
+
+/**
+ * @author Rain
+ */
+
+public enum BsTypeEnum {
+
+
+	/**
+	 * 融资采购
+	 */
+	FINANCING_PROCUREMENT("RZCG"),
+
+	/**
+	 * 销售
+	 */
+	SALE("XS"),
+
+	/**
+	 * 采购
+	 */
+	PROCUREMENT("CG"),
+
+	/**
+	 * 共享
+	 */
+	SHARING("GX"),
+
+	/**
+	 * 退款销售
+	 */
+	REFUND_SALE("TKXS"),
+
+	/**
+	 * 退款采购
+	 */
+	REFUND_PROCUREMENT("TKCG"),
+
+	/**
+	 * 积分订单
+	 */
+	POINTS_ORDER("JF");
+
+
+
+	BsTypeEnum(String info){
+		this.info = info;
+	}
+
+
+	/**
+	 * order bstype
+	 */
+	public final String info;
+
+
+}

+ 5 - 0
blade-common/src/main/java/org/springblade/common/enums/CommonEnum.java

@@ -33,6 +33,11 @@ public enum CommonEnum {
 	ZERO("0"),
 
 	/**
+	 * 日系率
+	 */
+	DAILY_INTEREST_RATE("0.0329"),
+
+	/**
 	 * 审核通过
 	 * 后续可以单例一个审核枚举
 	 */

+ 33 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/dto/SendMailLogDTO.java

@@ -0,0 +1,33 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.mail.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.los.mail.entity.SendMailLog;
+
+/**
+ * 邮件发送日志表数据传输对象实体类
+ *
+ * @author Rain
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SendMailLogDTO extends SendMailLog {
+	private static final long serialVersionUID = 1L;
+
+}

+ 50 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/entity/SendMailLog.java

@@ -0,0 +1,50 @@
+
+package org.springblade.los.mail.entity;
+
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 邮件发送日志表实体类
+ *
+ * @author Rain
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SendMailLog对象", description = "邮件发送日志表")
+public class SendMailLog extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	 * 发送人邮箱
+	 */
+	@ApiModelProperty(value = "发送人邮箱")
+	private String mailForm;
+	/**
+	 * 接收人邮箱
+	 */
+	@ApiModelProperty(value = "接收人邮箱")
+	private String mailTo;
+	/**
+	 * 标题
+	 */
+	@ApiModelProperty(value = "标题")
+	private String mailTitile;
+	/**
+	 * 内容
+	 */
+	@ApiModelProperty(value = "内容")
+	private String mailContent;
+	/**
+	 * 附件
+	 */
+	@ApiModelProperty(value = "附件")
+	private String mailFiles;
+
+
+}

+ 19 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/vo/SendMailLogVO.java

@@ -0,0 +1,19 @@
+package org.springblade.los.mail.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import org.springblade.los.mail.entity.SendMailLog;
+
+/**
+ * 邮件发送日志表视图实体类
+ *
+ * @author Rain
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SendMailLogVO对象", description = "邮件发送日志表")
+public class SendMailLogVO extends SendMailLog {
+	private static final long serialVersionUID = 1L;
+
+}

+ 13 - 16
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/funding/entity/PjpfBalanceReset.java

@@ -1,25 +1,12 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
 package org.springblade.salesPart.funding.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
@@ -97,6 +84,7 @@ public class PjpfBalanceReset implements Serializable {
 	 * 金额
 	 */
 	@ApiModelProperty(value = "金额")
+	@NotNull(message = "充值金额不允许为空")
 	private BigDecimal amount;
 	/**
 	 * 状态
@@ -127,7 +115,16 @@ public class PjpfBalanceReset implements Serializable {
 	 * 租户id
 	 */
 	@ApiModelProperty(value = "租户id")
+	@NotNull(message = "客户编码不允许为空")
+	@NotBlank(message = "客户编码不允许为空")
 	private String tenantId;
 
+	/**
+	 * 业务发生日期
+	 */
+	@ApiModelProperty(value = "业务日期")
+	@NotNull(message = "充值时间不允许为空")
+	private Date businessDate;
+
 
 }

+ 14 - 3
blade-service/blade-los/src/main/java/org/springblade/los/email/controller/EmailController.java

@@ -1,13 +1,14 @@
 package org.springblade.los.email.controller;
 
 
+import com.echepei.dto.mail.MailDto;
+import com.echepei.utils.mail.SendMailUtil;
 import io.swagger.annotations.Api;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
+import org.springblade.core.tool.api.R;
 import org.springblade.los.email.service.EMailService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.thymeleaf.context.Context;
 
 import java.io.File;
@@ -77,4 +78,14 @@ public class EmailController {
 		emailService.send(to, "激活码模板邮件", context, file);
 		return "发送成功!!";
 	}
+
+
+
+	@PostMapping("/sendMailByFile")
+	public R<String> sendMailByFile(@RequestBody MailDto mailDto){
+		SendMailUtil.sendFileMail(mailDto);
+		return R.status(true);
+	}
+
+
 }

+ 28 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/SendMailLogMapper.java

@@ -0,0 +1,28 @@
+
+package org.springblade.los.email.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.mail.entity.SendMailLog;
+import org.springblade.los.mail.vo.SendMailLogVO;
+
+import java.util.List;
+
+/**
+ * 邮件发送日志表 Mapper 接口
+ *
+ * @author Rain
+ */
+public interface SendMailLogMapper extends BaseMapper<SendMailLog> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page        分页
+	 * @param sendMailLog 参数
+	 * @return 结果
+	 */
+	List<SendMailLogVO> selectSendMailLogPage(IPage page, SendMailLogVO sendMailLog);
+
+}

+ 29 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/SendMailLogMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--suppress ALL -->
+<mapper namespace="org.springblade.los.email.mapper.SendMailLogMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="sendMailLogResultMap" type="org.springblade.los.mail.entity.SendMailLog">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="mail_form" property="mailForm"/>
+        <result column="mail_to" property="mailTo"/>
+        <result column="mail_titile" property="mailTitile"/>
+        <result column="mail_content" property="mailContent"/>
+        <result column="mail_files" property="mailFiles"/>
+    </resultMap>
+
+
+    <select id="selectSendMailLogPage" resultMap="sendMailLogResultMap">
+        select *
+        from send_mail_log
+        where is_deleted = 0
+    </select>
+
+</mapper>

+ 25 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/service/impl/SendMailLogServiceImpl.java

@@ -0,0 +1,25 @@
+package org.springblade.los.email.service.impl;
+
+
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.los.email.mapper.SendMailLogMapper;
+import org.springblade.los.email.service.ISendMailLogService;
+import org.springblade.los.mail.entity.SendMailLog;
+import org.springblade.los.mail.vo.SendMailLogVO;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 邮件发送日志表 服务实现类
+ *
+ * @author Rain
+ */
+@Service
+public class SendMailLogServiceImpl extends BaseServiceImpl<SendMailLogMapper, SendMailLog> implements ISendMailLogService {
+
+	@Override
+	public IPage<SendMailLogVO> selectSendMailLogPage(IPage<SendMailLogVO> page, SendMailLogVO sendMailLog) {
+		return page.setRecords(baseMapper.selectSendMailLogPage(page, sendMailLog));
+	}
+
+}

+ 5 - 0
blade-service/blade-sales-part/pom.xml

@@ -103,6 +103,11 @@
             </exclusions>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.26</version>
+        </dependency>
 
     </dependencies>
 

+ 62 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/duoduo/controller/DuoDuoOpenApiController.java

@@ -0,0 +1,62 @@
+package org.springblade.salesPart.duoduo.controller;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.salesPart.duoduo.util.MallSignUtil;
+import org.springblade.salesPart.funding.entity.PjpfBalanceReset;
+import org.springblade.salesPart.funding.service.IPjpfBalanceResetService;
+import org.springblade.system.entity.Tenant;
+import org.springblade.system.feign.ISysClient;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+
+/**
+ * @author Rain
+ */
+@RestController
+@RequestMapping("/cnAuto/mall")
+@Slf4j
+@AllArgsConstructor
+public class DuoDuoOpenApiController {
+
+	private final IPjpfBalanceResetService balanceResetService;
+
+	 private  final ISysClient sysClient;
+
+
+
+	@PostMapping("customerRechargeMsg")
+	public R<Boolean> customerRechargeMsg(@RequestHeader("sign") String sign,
+										  @RequestHeader("timestamp") Long timestamp,
+										  @RequestHeader("companyCode") String companyCode,
+										  @RequestBody @Valid PjpfBalanceReset pjpfBalanceReset) {
+		boolean verify = MallSignUtil.verify(sign, timestamp, companyCode);
+		if (!verify) {
+			return R.fail("签名验证失败");
+		}
+		R<Tenant> tenant = sysClient.getTenant(pjpfBalanceReset.getTenantId());
+		if (!tenant.isSuccess() || ObjectUtil.isEmpty(tenant.getData())) {
+			return R.fail("客户不存在");
+		}
+		pjpfBalanceReset.setDate(DateUtil.now());
+		pjpfBalanceReset.setSysNo("CZ" + DateUtil.format(pjpfBalanceReset.getDate(), DateUtil.PATTERN_DATETIME));
+		boolean saveStatus = balanceResetService.save(pjpfBalanceReset);
+		if (!saveStatus) {
+			return R.fail("接收到款数据失败");
+		}
+		return R.success("接收到款数据成功");
+	}
+
+
+	@PostMapping("sign")
+	public R<byte[]> sign(@RequestHeader("timestamp") Long timestamp, @RequestHeader("companyCode") String companyCode) {
+		return R.data(MallSignUtil.sign(timestamp, companyCode));
+	}
+
+
+}

+ 59 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/duoduo/util/MallSignUtil.java

@@ -0,0 +1,59 @@
+package org.springblade.salesPart.duoduo.util;
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.crypto.SecureUtil;
+import cn.hutool.crypto.asymmetric.RSA;
+import cn.hutool.crypto.asymmetric.Sign;
+import cn.hutool.crypto.asymmetric.SignAlgorithm;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.charset.StandardCharsets;
+
+/**
+ * @author Rain
+ */
+@Slf4j
+public class MallSignUtil {
+
+	private static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmjokR4q1XEGYGTDhASMpYaqwRSO5mXJkDqO22L6FD07FFlZf9VofieoxoYwp55fAahLIwOm7HwX1ciOwR2Z+zOLn72mBnMQxgnkJpxcIRDFCpSsBw4bLQMOY0evlCtbW1tlIA3D2ZhnrJUZE7fQkGx8cUhzvw38KPvTVBAIpfAQIDAQAB";
+
+	private static final String PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOaOiRHirVcQZgZMOEBIylhqrBFI7mZcmQOo7bYvoUPTsUWVl/1Wh+J6jGhjCnnl8BqEsjA6bsfBfVyI7BHZn7M4ufvaYGcxDGCeQmnFwhEMUKlKwHDhstAw5jR6+UK1tbW2UgDcPZmGeslRkTt9CQbHxxSHO/Dfwo+9NUEAil8BAgMBAAECgYAgPRYVlii+3+AkSUwkUQlaS7A7yoLrdU9AH8L9krNuFI/ZNw3Fsu/VT2WKwy6X1Ps5+gwgiksrS3cIFW1NIa0e0noHJzgcP3twcAA7tEX2bf/bRlmgQKgj2UChL2tZdP8eeykC0w/3V127DmTJ8Zb1hbQqHyCvsYUQ0oteLxPy8QJBAPqdHy5212/hWymTsSRC4EBp+N7+p4c0gyhOii+s54VW++kILFEokOOFVKQVYNd9f85pM3FiEAfjTT0IDGCkkAMCQQDrgw9eDI0yJcWOJA7hlwceMNmXiNZdDW2C76ZFIzX4Jd0pCt1B0D7ZkgzBJ5dsa3tyOVg4v22wEiYEeStkug+rAkBBAhDclKc9tk9XcaA5r79L9jFAZv497Dk5c2YVB9zmkbG2uRAF3Wf4HNXf2kvMmhlVCaT2fGF8KlIWyserKgTRAkEAriqEKNc7bASG7rE32BjqiKczo17suG//tr8nxSVe+h52Sa3hJpSshhX+HLH8x49NAZHq7jyTD4y8VL6PGrSGdQJAGaYcFWnc02LZw593SH4I2naA8LVwvyiGbuRPV6vJ6/e9G9ChoPM8i8+QjtcdAtzp6BBARnsNKeEBggnZV9bB7Q==";
+
+	private static final RSA RSA_SIGN = new RSA(PRIVATE_KEY, PUBLIC_KEY);
+
+
+	public static boolean verify(String signStr, Long timestamp, String companyCode) {
+		Sign sign = SecureUtil.sign(SignAlgorithm.SHA256withRSA);
+		sign.setPublicKey(RSA_SIGN.getPublicKey());
+		String data = companyCode + timestamp;
+		byte[] signBytes = Base64.decode(signStr);
+		return sign.verify(data.getBytes(), signBytes);
+	}
+
+	public static byte[] sign(Long timestamp, String companyCode) {
+		Sign sign = SecureUtil.sign(SignAlgorithm.SHA256withRSA);
+		sign.setPrivateKey(RSA_SIGN.getPrivateKey());
+		return sign.sign(companyCode + timestamp);
+	}
+
+
+	private static boolean verifySignature(String data, String sign) {
+		try {
+			// 创建RSA对象(使用Hutool封装方法)
+			RSA rsa = new RSA(PRIVATE_KEY, PUBLIC_KEY);
+			// 创建签名对象(指定SHA256withRSA算法)
+			Sign signer = new Sign(SignAlgorithm.SHA256withRSA, rsa.getPrivateKey(), rsa.getPublicKey());
+			// 将Base64编码的签名转为字节数组
+			byte[] signBytes = Base64.decode(sign);
+
+			// 执行验签操作(自动处理数据编码)
+			boolean isValid = signer.verify(data.getBytes(StandardCharsets.UTF_8), signBytes);
+			log.info("Signature verification result: {}", isValid);
+			return isValid;
+		} catch (Exception e) {
+			log.error("Signature verification failed", e);
+			return false;
+		}
+	}
+
+}

+ 1 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/funding/mapper/PjpfBalanceResetMapper.xml

@@ -22,6 +22,7 @@
         <result column="confirming_person_id" property="confirmingPersonId"/>
         <result column="confirming_person_name" property="confirmingPersonName"/>
         <result column="confirming_person_date" property="confirmingPersonDate"/>
+        <result column="business_date" property="businessDate"/>
     </resultMap>