LIDEXI 4 lat temu
rodzic
commit
ea30be8068
23 zmienionych plików z 568 dodań i 31 usunięć
  1. 20 0
      src/main/java/org/springblade/common/constant/SystemConstant.java
  2. 2 2
      src/main/java/org/springblade/common/utils/MoneyDesUtil.java
  3. 128 0
      src/main/java/org/springblade/modules/guosen/bankcode/controller/BankCodeController.java
  4. 34 0
      src/main/java/org/springblade/modules/guosen/bankcode/dto/BankCodeDTO.java
  5. 61 0
      src/main/java/org/springblade/modules/guosen/bankcode/entity/BankCode.java
  6. 42 0
      src/main/java/org/springblade/modules/guosen/bankcode/mapper/BankCodeMapper.java
  7. 18 0
      src/main/java/org/springblade/modules/guosen/bankcode/mapper/BankCodeMapper.xml
  8. 41 0
      src/main/java/org/springblade/modules/guosen/bankcode/service/IBankCodeService.java
  9. 41 0
      src/main/java/org/springblade/modules/guosen/bankcode/service/impl/BankCodeServiceImpl.java
  10. 36 0
      src/main/java/org/springblade/modules/guosen/bankcode/vo/BankCodeVO.java
  11. 3 2
      src/main/java/org/springblade/modules/guosen/bussiness/controller/BussinessController.java
  12. 1 1
      src/main/java/org/springblade/modules/guosen/bussiness/controller/BussinessDebitController.java
  13. 1 1
      src/main/java/org/springblade/modules/guosen/bussiness/controller/BussinessDebitRequestController.java
  14. 6 0
      src/main/java/org/springblade/modules/guosen/bussiness/entity/Bussiness.java
  15. 3 0
      src/main/java/org/springblade/modules/guosen/bussiness/entity/BussinessDebit.java
  16. 3 1
      src/main/java/org/springblade/modules/guosen/bussiness/mapper/BussinessMapper.java
  17. 13 1
      src/main/java/org/springblade/modules/guosen/bussiness/mapper/BussinessMapper.xml
  18. 3 1
      src/main/java/org/springblade/modules/guosen/bussiness/service/IBussinessService.java
  19. 6 1
      src/main/java/org/springblade/modules/guosen/bussiness/service/impl/BussinessServiceImpl.java
  20. 25 0
      src/main/java/org/springblade/modules/guosen/bussiness/wrapper/BussinessWrapper.java
  21. 7 0
      src/main/java/org/springblade/modules/guosen/loginUser/entity/LoginUser.java
  22. 1 0
      src/main/java/org/springblade/modules/guosen/loginUser/mapper/LoginUserMapper.xml
  23. 73 21
      src/main/java/org/springblade/yeePay/listener/BatchTransferNotifyListener.java

+ 20 - 0
src/main/java/org/springblade/common/constant/SystemConstant.java

@@ -200,4 +200,24 @@ public interface SystemConstant {
 			this.value = value;
 		}
 	}
+
+	/**
+	 * 商户分润记录状态  状态: 1-待确认 2- 已确认 3-确认失败
+	 */
+	@Getter
+	enum BussinessDebitStatus{
+
+
+		WATING("待确认",1),
+		SUCCESS("已确认",2),
+		FAIL("分配失败",3);
+
+
+		String name;
+		Integer value;
+		BussinessDebitStatus(String name, Integer value){
+			this.name = name;
+			this.value = value;
+		}
+	}
 }

+ 2 - 2
src/main/java/org/springblade/common/utils/MoneyDesUtil.java

@@ -165,7 +165,7 @@ public class MoneyDesUtil {
 	}
 
 	public static void main(String[] args) throws Exception {
-		String content = "1000";
+		String content = "-310.0380";
 
 		// 加密
 		System.out.println("加密前:" + content);
@@ -173,7 +173,7 @@ public class MoneyDesUtil {
 		System.out.println("加密后:" + encryptResultStr);
 		// 解密
 		System.out.println("解密后:" + decrypt(encryptResultStr, KEY_FOR_UC));
-		System.out.println("随意篡改:"+decrypt("F23CA00E7616BFE7C9F16D7E0724900E",KEY_FOR_UC));
+		System.out.println("随意篡改:"+decrypt("F568ADD8B33A02F2902978692B56098D",KEY_FOR_UC));
 	}
 
 

+ 128 - 0
src/main/java/org/springblade/modules/guosen/bankcode/controller/BankCodeController.java

@@ -0,0 +1,128 @@
+/*
+ *      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.modules.guosen.bankcode.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.guosen.bankcode.entity.BankCode;
+import org.springblade.modules.guosen.bankcode.vo.BankCodeVO;
+import org.springblade.modules.guosen.bankcode.service.IBankCodeService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.Map;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("cyzh-guosen/bankcode")
+@Api(value = "", tags = "接口")
+public class BankCodeController extends BladeController {
+
+	private final IBankCodeService bankCodeService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入bankCode")
+	public R<BankCode> detail(BankCode bankCode) {
+		BankCode detail = bankCodeService.getOne(Condition.getQueryWrapper(bankCode));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入bankCode")
+	public R<IPage<BankCode>> list(@RequestParam Map<String,Object> bankCode, Query query) {
+		IPage<BankCode> pages = bankCodeService.page(Condition.getPage(query), Condition.getQueryWrapper(bankCode,BankCode.class));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入bankCode")
+	public R<IPage<BankCodeVO>> page(BankCodeVO bankCode, Query query) {
+		IPage<BankCodeVO> pages = bankCodeService.selectBankCodePage(Condition.getPage(query), bankCode);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入bankCode")
+	public R save(@Valid @RequestBody BankCode bankCode) {
+		return R.status(bankCodeService.save(bankCode));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入bankCode")
+	public R update(@Valid @RequestBody BankCode bankCode) {
+		return R.status(bankCodeService.updateById(bankCode));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入bankCode")
+	public R submit(@Valid @RequestBody BankCode bankCode) {
+		return R.status(bankCodeService.saveOrUpdate(bankCode));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(bankCodeService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 34 - 0
src/main/java/org/springblade/modules/guosen/bankcode/dto/BankCodeDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      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.modules.guosen.bankcode.dto;
+
+import org.springblade.modules.guosen.bankcode.entity.BankCode;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BankCodeDTO extends BankCode {
+	private static final long serialVersionUID = 1L;
+
+}

+ 61 - 0
src/main/java/org/springblade/modules/guosen/bankcode/entity/BankCode.java

@@ -0,0 +1,61 @@
+/*
+ *      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.modules.guosen.bankcode.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+@Data
+@TableName("cyzh_bank_code")
+@ApiModel(value = "BankCode对象", description = "BankCode对象")
+public class BankCode implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 总行名称
+	*/
+		@ApiModelProperty(value = "总行名称")
+		private String name;
+	/**
+	* 总行编码
+	*/
+		@ApiModelProperty(value = "总行编码")
+		private String code;
+	/**
+	* 总行行号
+	*/
+		@ApiModelProperty(value = "总行行号")
+		private String line;
+	/**
+	* 总行简称
+	*/
+		@ApiModelProperty(value = "总行简称")
+		private String abbr;
+
+
+}

+ 42 - 0
src/main/java/org/springblade/modules/guosen/bankcode/mapper/BankCodeMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      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.modules.guosen.bankcode.mapper;
+
+import org.springblade.modules.guosen.bankcode.entity.BankCode;
+import org.springblade.modules.guosen.bankcode.vo.BankCodeVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+public interface BankCodeMapper extends BaseMapper<BankCode> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param bankCode
+	 * @return
+	 */
+	List<BankCodeVO> selectBankCodePage(IPage page, BankCodeVO bankCode);
+
+}

+ 18 - 0
src/main/java/org/springblade/modules/guosen/bankcode/mapper/BankCodeMapper.xml

@@ -0,0 +1,18 @@
+<?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">
+<mapper namespace="org.springblade.modules.guosen.bankcode.mapper.BankCodeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="bankCodeResultMap" type="org.springblade.modules.guosen.bankcode.entity.BankCode">
+        <result column="name" property="name"/>
+        <result column="code" property="code"/>
+        <result column="line" property="line"/>
+        <result column="abbr" property="abbr"/>
+    </resultMap>
+
+
+    <select id="selectBankCodePage" resultMap="bankCodeResultMap">
+        select * from cyzh_bank_code where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
src/main/java/org/springblade/modules/guosen/bankcode/service/IBankCodeService.java

@@ -0,0 +1,41 @@
+/*
+ *      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.modules.guosen.bankcode.service;
+
+import org.springblade.modules.guosen.bankcode.entity.BankCode;
+import org.springblade.modules.guosen.bankcode.vo.BankCodeVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+public interface IBankCodeService extends IService<BankCode> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param bankCode
+	 * @return
+	 */
+	IPage<BankCodeVO> selectBankCodePage(IPage<BankCodeVO> page, BankCodeVO bankCode);
+
+}

+ 41 - 0
src/main/java/org/springblade/modules/guosen/bankcode/service/impl/BankCodeServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      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.modules.guosen.bankcode.service.impl;
+
+import org.springblade.modules.guosen.bankcode.entity.BankCode;
+import org.springblade.modules.guosen.bankcode.vo.BankCodeVO;
+import org.springblade.modules.guosen.bankcode.mapper.BankCodeMapper;
+import org.springblade.modules.guosen.bankcode.service.IBankCodeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+@Service
+public class BankCodeServiceImpl extends ServiceImpl<BankCodeMapper, BankCode> implements IBankCodeService {
+
+	@Override
+	public IPage<BankCodeVO> selectBankCodePage(IPage<BankCodeVO> page, BankCodeVO bankCode) {
+		return page.setRecords(baseMapper.selectBankCodePage(page, bankCode));
+	}
+
+}

+ 36 - 0
src/main/java/org/springblade/modules/guosen/bankcode/vo/BankCodeVO.java

@@ -0,0 +1,36 @@
+/*
+ *      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.modules.guosen.bankcode.vo;
+
+import org.springblade.modules.guosen.bankcode.entity.BankCode;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-08-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "BankCodeVO对象", description = "BankCodeVO对象")
+public class BankCodeVO extends BankCode {
+	private static final long serialVersionUID = 1L;
+
+}

+ 3 - 2
src/main/java/org/springblade/modules/guosen/bussiness/controller/BussinessController.java

@@ -33,6 +33,7 @@ import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.guosen.bussiness.wrapper.BussinessWrapper;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -96,8 +97,8 @@ public class BussinessController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入bussiness")
 	public R<IPage<BussinessVO>> page(BussinessVO bussiness, Query query) {
-		IPage<BussinessVO> pages = bussinessService.selectBussinessPage(Condition.getPage(query), bussiness);
-		return R.data(pages);
+		IPage<Bussiness> pages = bussinessService.selectBussinessPage(Condition.getPage(query), bussiness);
+		return R.data(BussinessWrapper.build().pageVO(pages));
 	}
 
 	/**

+ 1 - 1
src/main/java/org/springblade/modules/guosen/bussiness/controller/BussinessDebitController.java

@@ -82,7 +82,7 @@ public class BussinessDebitController extends BladeController {
 			bussinessDebit.setBussinessId(bussiness.getId());
 		}
 
-		IPage<BussinessDebit> pages = bussinessDebitService.page(Condition.getPage(query), Condition.getQueryWrapper(bussinessDebit));
+		IPage<BussinessDebit> pages = bussinessDebitService.page(Condition.getPage(query), Condition.getQueryWrapper(bussinessDebit).lambda().orderByDesc(BussinessDebit::getUpdateTime));
 		return R.data(pages);
 	}
 

+ 1 - 1
src/main/java/org/springblade/modules/guosen/bussiness/controller/BussinessDebitRequestController.java

@@ -90,7 +90,7 @@ public class BussinessDebitRequestController extends BladeController {
 		if(bussiness != null){
 			bussinessDebitRequest.setBussinessId(bussiness.getId());
 		}
-		IPage<BussinessDebitRequest> pages = bussinessDebitRequestService.page(Condition.getPage(query), Condition.getQueryWrapper(bussinessDebitRequest));
+		IPage<BussinessDebitRequest> pages = bussinessDebitRequestService.page(Condition.getPage(query), Condition.getQueryWrapper(bussinessDebitRequest).lambda().orderByDesc(BussinessDebitRequest::getCreateTime));
 		return R.data(pages);
 	}
 

+ 6 - 0
src/main/java/org/springblade/modules/guosen/bussiness/entity/Bussiness.java

@@ -116,6 +116,12 @@ public class Bussiness extends BaseEntity {
 	@ApiModelProperty(value = "api文档链接")
 	private String apiFilePath;
 
+	/**
+	 * 版本号
+	 */
+	@ApiModelProperty(value = "api文档链接")
+	private Integer version;
+
 
 
 

+ 3 - 0
src/main/java/org/springblade/modules/guosen/bussiness/entity/BussinessDebit.java

@@ -85,6 +85,9 @@ public class BussinessDebit extends BaseEntity {
 	@ApiModelProperty("账户类型,可选项如下: DEBIT_CARD:借记卡 ;CREDIT_CARD:贷记卡; QUASI_CREDIT_CARD:准贷卡; PASSBOOK:存折;UNIT_SETTLE_CARD:单位结算卡; PUBLIC_CARD:对公卡;示例值:DEBIT_CARD")
 	private String bankAccountType;
 
+	@ApiModelProperty("第三方支付日志")
+	private String thirdPayLog;
+
 
 
 

+ 3 - 1
src/main/java/org/springblade/modules/guosen/bussiness/mapper/BussinessMapper.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.guosen.bussiness.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.modules.guosen.bussiness.entity.Bussiness;
 import org.springblade.modules.guosen.bussiness.vo.BussinessVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -37,6 +38,7 @@ public interface BussinessMapper extends BaseMapper<Bussiness> {
 	 * @param bussiness
 	 * @return
 	 */
-	List<BussinessVO> selectBussinessPage(IPage page, BussinessVO bussiness);
+	List<Bussiness> selectBussinessPage(IPage page, BussinessVO bussiness);
 
+    boolean updateRemain(@Param("version") Integer version,@Param("id") Long id,@Param("remain") String remain);
 }

+ 13 - 1
src/main/java/org/springblade/modules/guosen/bussiness/mapper/BussinessMapper.xml

@@ -22,11 +22,23 @@
         <result column="secret" property="secret"/>
         <result column="service_rate" property="serviceRate"/>
         <result column="api_file_path" property="apiFilePath"/>
+        <result column="remain" property="remain"/>
     </resultMap>
 
 
     <select id="selectBussinessPage" resultMap="bussinessResultMap">
-        select id,`name`,account_id,user_name,max_limit,recall_url,service_rate,api_file_path from cyzh_bussiness where is_deleted = 0
+        select id,`name`,account_id,user_name,max_limit,recall_url,service_rate,api_file_path,remain from cyzh_bussiness where is_deleted = 0
     </select>
 
+    <update id="updateRemain">
+        update
+            cyzh_bussiness
+        set
+            remain = #{remain},
+            version = ${version+1}
+        where
+            id = #{id}
+            and version = #{version}
+    </update>
+
 </mapper>

+ 3 - 1
src/main/java/org/springblade/modules/guosen/bussiness/service/IBussinessService.java

@@ -36,9 +36,11 @@ public interface IBussinessService extends BaseService<Bussiness> {
 	 * @param bussiness
 	 * @return
 	 */
-	IPage<BussinessVO> selectBussinessPage(IPage<BussinessVO> page, BussinessVO bussiness);
+	IPage<Bussiness> selectBussinessPage(IPage<Bussiness> page, BussinessVO bussiness);
 
 	boolean saveOrUpdate(Bussiness bussiness);
 
 	String generateApiByBussiness(Bussiness bussiness);
+
+    boolean updateRemain(Bussiness bussiness);
 }

+ 6 - 1
src/main/java/org/springblade/modules/guosen/bussiness/service/impl/BussinessServiceImpl.java

@@ -63,7 +63,7 @@ public class BussinessServiceImpl extends BaseServiceImpl<BussinessMapper, Bussi
 	}
 
 	@Override
-	public IPage<BussinessVO> selectBussinessPage(IPage<BussinessVO> page, BussinessVO bussiness) {
+	public IPage<Bussiness> selectBussinessPage(IPage<Bussiness> page, BussinessVO bussiness) {
 		return page.setRecords(baseMapper.selectBussinessPage(page, bussiness));
 	}
 
@@ -133,6 +133,11 @@ public class BussinessServiceImpl extends BaseServiceImpl<BussinessMapper, Bussi
 		return this.generateApiFile(bussiness.getId(),bussiness.getSecret());
 	}
 
+	@Override
+	public boolean updateRemain(Bussiness bussiness) {
+		return this.baseMapper.updateRemain(bussiness.getVersion(),bussiness.getId(),bussiness.getRemain());
+	}
+
 	private  String generateSecret(){
 		String uuid = UUID.randomUUID().toString();
 		char[] cs = new char[32];

+ 25 - 0
src/main/java/org/springblade/modules/guosen/bussiness/wrapper/BussinessWrapper.java

@@ -0,0 +1,25 @@
+package org.springblade.modules.guosen.bussiness.wrapper;
+
+import org.springblade.common.utils.MoneyDesUtil;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.guosen.bussiness.entity.Bussiness;
+import org.springblade.modules.guosen.bussiness.vo.BussinessVO;
+
+import java.util.Objects;
+
+/**
+ * Created By lidexi in 2021/8/6
+ **/
+public class BussinessWrapper extends BaseEntityWrapper<Bussiness, BussinessVO> {
+
+	public static BussinessWrapper build(){
+		return new BussinessWrapper();
+	}
+	@Override
+	public BussinessVO entityVO(Bussiness bussiness) {
+		BussinessVO bussinessVO = Objects.requireNonNull(BeanUtil.copy(bussiness,BussinessVO.class));
+		bussinessVO.setRemain(MoneyDesUtil.decrypt(bussiness.getRemain(), MoneyDesUtil.KEY_FOR_UC));
+		return bussinessVO;
+	}
+}

+ 7 - 0
src/main/java/org/springblade/modules/guosen/loginUser/entity/LoginUser.java

@@ -137,6 +137,13 @@ public class LoginUser extends BaseEntity {
 	@ApiModelProperty("操作限制")
 	private String limitTag;
 
+	/**
+	 * 视频
+	 */
+	@ApiModelProperty("宣传视频")
+	private String video;
+
+
 
 
 

+ 1 - 0
src/main/java/org/springblade/modules/guosen/loginUser/mapper/LoginUserMapper.xml

@@ -28,6 +28,7 @@
         <result column="province" property="province"/>
         <result column="city" property="city"/>
         <result column="limit_tag" property="limitTag"/>
+        <result column="video" property="video"/>
     </resultMap>
 
 

+ 73 - 21
src/main/java/org/springblade/yeePay/listener/BatchTransferNotifyListener.java

@@ -15,9 +15,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.EventListener;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.sql.PreparedStatement;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 
 @Component
@@ -28,15 +34,20 @@ public class BatchTransferNotifyListener {
 	@Autowired
 	private IBussinessService bussinessService;
 
+	@Autowired
+	private PlatformTransactionManager platformTransactionManager;
+	@Autowired
+	private TransactionDefinition transactionDefinition;
+
 
 	/**
-	 * 	转账回调业务逻辑处理  ---广告商批量付款专用
-	 * @param  event 回调事件
-	 * */
+	 * 转账回调业务逻辑处理  ---广告商批量付款专用
+	 *
+	 * @param event 回调事件
+	 */
 	@EventListener
 	@Async
-	@Transactional
-	public void notifyBusiness(BatchTransferEvent event){
+	public void notifyBusiness(BatchTransferEvent event) {
 		JSONObject decryptData = event.getDecryptData(); //获取回调信息,解密后的数据
 
 		//易宝订单状态 “SUCCESS"为成功
@@ -45,29 +56,70 @@ public class BatchTransferNotifyListener {
 		//通过订单号获取广告商分润明细记录
 		String requestNo = decryptData.getString("requestNo");
 		BussinessDebit bussinessDebit = bussinessDebitService.getById(Long.valueOf(requestNo));
-		if(bussinessDebit != null){
-			if(bussinessDebit.getStatus() == 2){//2为已成功过,无需再重复处理
+		if (bussinessDebit != null) {
+			if (bussinessDebit.getStatus() == SystemConstant.BussinessDebitStatus.SUCCESS.getValue()) {//2为已成功过,无需再重复处理
 				return;
-			}else{
-				if("SUCCESS".equals(status)){
-					bussinessDebit.setStatus(2);
-					Bussiness bussiness = bussinessService.getById(bussinessDebit.getBussinessId());
-					if(bussiness != null){
-						String remain = MoneyDesUtil.decrypt(bussiness.getRemain(), MoneyDesUtil.KEY_FOR_UC);
-						BigDecimal rare = new BigDecimal(remain);
-						rare =rare.subtract(bussinessDebit.getFee()).subtract(bussinessDebit.getPrice());
-						bussiness.setRemain(MoneyDesUtil.encrypt(rare.toString(),MoneyDesUtil.KEY_FOR_UC));
-						bussinessService.updateById(bussiness);
+			} else {
+				if ("SUCCESS".equals(status)) {
+					//修改分佣流水表的状态为成功
+					bussinessDebit.setStatus(SystemConstant.BussinessDebitStatus.SUCCESS.getValue());
+					//从流水表中获取商户账户id
+					String bussinessId = bussinessDebit.getBussinessId().toString();
+					synchronized (bussinessId.intern()) {//为每个商户加锁,减小锁的粒度
+						boolean flag = true;
+						while (flag) {//如果修改账户余额时发现版本不对要重试
+							//开启事务
+							TransactionStatus transaction = platformTransactionManager.getTransaction(transactionDefinition);
+							//处理逻辑
+							try {
+
+								//获取商户余额信息
+								Bussiness bussiness = bussinessService.getById(bussinessDebit.getBussinessId());
+								if (bussiness != null) {
+									String remain = MoneyDesUtil.decrypt(bussiness.getRemain(), MoneyDesUtil.KEY_FOR_UC);
+									BigDecimal rare = new BigDecimal(remain);
+									rare = rare.subtract(bussinessDebit.getFee()).subtract(bussinessDebit.getPrice());
+									bussiness.setRemain(MoneyDesUtil.encrypt(rare.toString(), MoneyDesUtil.KEY_FOR_UC));
+									//修改商户余额信息
+									boolean result = bussinessService.updateRemain(bussiness);
+									if(result){
+
+										//修改分佣流水表的分佣状态为成功
+										bussinessDebitService.updateById(bussinessDebit);
+
+										//提交事务
+										platformTransactionManager.commit(transaction);
+										flag = false;//修改成功跳出循環
+									}
+
+								}
+
+
+							} catch (Exception e) {
+								//回滚事务
+								platformTransactionManager.rollback(transaction);
+								e.printStackTrace();
+								bussinessDebit.setStatus(SystemConstant.BussinessDebitStatus.FAIL.getValue());
+								bussinessDebit.setThirdPayLog(e.getMessage());
+								bussinessDebitService.updateById(bussinessDebit);
+							}
+						}
+
 					}
-				}else {
-					bussinessDebit.setStatus(3);
+
+				} else {//第三方支付回调结果为失败,记录分佣流水失败的原因
+					bussinessDebit.setStatus(SystemConstant.BussinessDebitStatus.FAIL.getValue());
+					bussinessDebit.setThirdPayLog(decryptData.toJSONString());
+					bussinessDebitService.updateById(bussinessDebit);
 				}
-				bussinessDebitService.updateById(bussinessDebit);
+
 			}
 		}
 
 
-
 	}
 
+
+
+
 }