Browse Source

分账回退

shiyunlong 1 năm trước cách đây
mục cha
commit
ed70a388bc
37 tập tin đã thay đổi với 311 bổ sung69 xóa
  1. 3 2
      .idea/mybatisx/templates.xml
  2. 42 0
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/AccountController.java
  3. BIN
      admin/target/aska-admin.jar
  4. BIN
      admin/target/aska-admin.jar.original
  5. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/AccountController.class
  6. 1 0
      admin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  7. 1 0
      admin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  8. 44 0
      dao/src/main/java/com/mofangchuxing/aska/dao/domain/AskaSplitrecord.java
  9. 3 0
      dao/src/main/java/com/mofangchuxing/aska/dao/mapper/AskaAccountsMapper.java
  10. 1 1
      dao/src/main/java/com/mofangchuxing/aska/dao/mapper/AskaSplitrecordMapper.java
  11. 6 0
      dao/src/main/resources/mapper/AskaAccountsMapper.xml
  12. 38 24
      dao/src/main/resources/mapper/AskaSplitrecordMapper.xml
  13. BIN
      dao/target/aska-dao-1.0.jar
  14. BIN
      dao/target/classes/com/mofangchuxing/aska/dao/domain/AskaSplitrecord.class
  15. BIN
      dao/target/classes/com/mofangchuxing/aska/dao/mapper/AskaAccountsMapper.class
  16. 6 0
      dao/target/classes/mapper/AskaAccountsMapper.xml
  17. 38 24
      dao/target/classes/mapper/AskaSplitrecordMapper.xml
  18. 15 0
      domain/src/main/java/com/mofangchuxing/aska/domain/dto/AccountDto.java
  19. 29 0
      domain/src/main/java/com/mofangchuxing/aska/domain/enums/RecordTypeEnum.java
  20. BIN
      domain/target/aska-domain-1.0.jar
  21. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/dto/AccountDto.class
  22. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/enums/RecordTypeEnum.class
  23. 10 8
      domain/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  24. 2 0
      domain/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  25. BIN
      main/target/aska.jar
  26. BIN
      main/target/aska.jar.original
  27. 1 1
      service/src/main/java/com/mofangchuxing/aska/service/ProfitSharingService.java
  28. 3 0
      service/src/main/java/com/mofangchuxing/aska/service/UserService.java
  29. 1 1
      service/src/main/java/com/mofangchuxing/aska/service/impl/PayServiceImpl.java
  30. 61 8
      service/src/main/java/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.java
  31. 6 0
      service/src/main/java/com/mofangchuxing/aska/service/impl/UserServiceImpl.java
  32. BIN
      service/target/aska-service-1.0.jar
  33. BIN
      service/target/classes/com/mofangchuxing/aska/service/ProfitSharingService.class
  34. BIN
      service/target/classes/com/mofangchuxing/aska/service/UserService.class
  35. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/PayServiceImpl.class
  36. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.class
  37. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/UserServiceImpl.class

+ 3 - 2
.idea/mybatisx/templates.xml

@@ -49,12 +49,13 @@
             <option name="tableUIInfoList">
               <list>
                 <TableUIInfo>
-                  <option name="className" value="RefundOrder" />
-                  <option name="tableName" value="refund_order" />
+                  <option name="className" value="AskaSplitrecord" />
+                  <option name="tableName" value="aska_splitRecord" />
                 </TableUIInfo>
               </list>
             </option>
             <option name="templatesName" value="default-all" />
+            <option name="useActualColumns" value="true" />
           </GenerateConfig>
         </option>
         <option name="moduleName" value="aska-dao" />

+ 42 - 0
admin/src/main/java/com/mofangchuxing/aska/admin/controller/AccountController.java

@@ -0,0 +1,42 @@
+package com.mofangchuxing.aska.admin.controller;
+
+import com.mofangchuxing.aska.dao.domain.AskaAccounts;
+import com.mofangchuxing.aska.domain.R;
+import com.mofangchuxing.aska.domain.dto.AccountDto;
+import com.mofangchuxing.aska.service.UserService;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: syl
+ * @Date: 2023/8/15
+ * @Description:
+ */
+@RestController
+@RequestMapping("/AccountMng")
+public class AccountController extends AdminBaseController{
+
+    @Resource
+    private UserService userService;
+
+    @PostMapping("/listUsers")
+    public R listUsers(@RequestBody AccountDto accountDto) {
+        Map<String, Object> result = new HashMap<>();
+        AskaAccounts askaAccounts = getSysUser(accountDto.getT());
+        if (askaAccounts == null){
+            return R.error("token_expire");
+        }
+        List<AskaAccounts> askaAccountsList = userService.listUsers(accountDto);
+        result.put("list", askaAccountsList);
+        return R.ok(result);
+    }
+
+
+}

BIN
admin/target/aska-admin.jar


BIN
admin/target/aska-admin.jar.original


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/AccountController.class


+ 1 - 0
admin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -1,3 +1,4 @@
+com/mofangchuxing/aska/admin/controller/AccountController.class
 com/mofangchuxing/aska/admin/config/WebConfig.class
 com/mofangchuxing/aska/admin/controller/ChannelController.class
 com/mofangchuxing/aska/admin/Intercepter/RequestInterceptor.class

+ 1 - 0
admin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -5,3 +5,4 @@
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/Intercepter/RequestInterceptor.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailController.java
+/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/AccountController.java

+ 44 - 0
dao/src/main/java/com/mofangchuxing/aska/dao/domain/AskaSplitrecord.java

@@ -23,6 +23,16 @@ public class AskaSplitrecord implements Serializable {
      */
     private String spiltOrderId;
 
+    /**
+     * 流水类型 1-收入 2-退款
+     */
+    private Integer recordType;
+
+    /**
+     * 
+     */
+    private Integer refundOrderId;
+
     /**
      * 订单金额
      */
@@ -172,6 +182,34 @@ public class AskaSplitrecord implements Serializable {
         this.spiltOrderId = spiltOrderId;
     }
 
+    /**
+     * 流水类型 1-收入 2-退款
+     */
+    public Integer getRecordType() {
+        return recordType;
+    }
+
+    /**
+     * 流水类型 1-收入 2-退款
+     */
+    public void setRecordType(Integer recordType) {
+        this.recordType = recordType;
+    }
+
+    /**
+     * 
+     */
+    public Integer getRefundOrderId() {
+        return refundOrderId;
+    }
+
+    /**
+     * 
+     */
+    public void setRefundOrderId(Integer refundOrderId) {
+        this.refundOrderId = refundOrderId;
+    }
+
     /**
      * 订单金额
      */
@@ -481,6 +519,8 @@ public class AskaSplitrecord implements Serializable {
         return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
             && (this.getPayId() == null ? other.getPayId() == null : this.getPayId().equals(other.getPayId()))
             && (this.getSpiltOrderId() == null ? other.getSpiltOrderId() == null : this.getSpiltOrderId().equals(other.getSpiltOrderId()))
+            && (this.getRecordType() == null ? other.getRecordType() == null : this.getRecordType().equals(other.getRecordType()))
+            && (this.getRefundOrderId() == null ? other.getRefundOrderId() == null : this.getRefundOrderId().equals(other.getRefundOrderId()))
             && (this.getPayAmount() == null ? other.getPayAmount() == null : this.getPayAmount().equals(other.getPayAmount()))
             && (this.getRetailId() == null ? other.getRetailId() == null : this.getRetailId().equals(other.getRetailId()))
             && (this.getRetailName() == null ? other.getRetailName() == null : this.getRetailName().equals(other.getRetailName()))
@@ -511,6 +551,8 @@ public class AskaSplitrecord implements Serializable {
         result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
         result = prime * result + ((getPayId() == null) ? 0 : getPayId().hashCode());
         result = prime * result + ((getSpiltOrderId() == null) ? 0 : getSpiltOrderId().hashCode());
+        result = prime * result + ((getRecordType() == null) ? 0 : getRecordType().hashCode());
+        result = prime * result + ((getRefundOrderId() == null) ? 0 : getRefundOrderId().hashCode());
         result = prime * result + ((getPayAmount() == null) ? 0 : getPayAmount().hashCode());
         result = prime * result + ((getRetailId() == null) ? 0 : getRetailId().hashCode());
         result = prime * result + ((getRetailName() == null) ? 0 : getRetailName().hashCode());
@@ -544,6 +586,8 @@ public class AskaSplitrecord implements Serializable {
         sb.append(", id=").append(id);
         sb.append(", payId=").append(payId);
         sb.append(", spiltOrderId=").append(spiltOrderId);
+        sb.append(", recordType=").append(recordType);
+        sb.append(", refundOrderId=").append(refundOrderId);
         sb.append(", payAmount=").append(payAmount);
         sb.append(", retailId=").append(retailId);
         sb.append(", retailName=").append(retailName);

+ 3 - 0
dao/src/main/java/com/mofangchuxing/aska/dao/mapper/AskaAccountsMapper.java

@@ -3,6 +3,8 @@ package com.mofangchuxing.aska.dao.mapper;
 import com.mofangchuxing.aska.dao.domain.AskaAccounts;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
 * @author syl
 * @description 针对表【aska_accounts】的数据库操作Mapper
@@ -25,4 +27,5 @@ public interface AskaAccountsMapper {
 
     AskaAccounts selectByUsername(@Param("username") String username);
 
+    List<AskaAccounts> selectByRole(@Param("role") String role);
 }

+ 1 - 1
dao/src/main/java/com/mofangchuxing/aska/dao/mapper/AskaSplitrecordMapper.java

@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param;
 /**
 * @author syl
 * @description 针对表【aska_splitRecord(分账记录)】的数据库操作Mapper
-* @createDate 2023-08-09 14:30:54
+* @createDate 2023-08-17 09:47:14
 * @Entity com.mofangchuxing.aska.dao.domain.AskaSplitrecord
 */
 public interface AskaSplitrecordMapper {

+ 6 - 0
dao/src/main/resources/mapper/AskaAccountsMapper.xml

@@ -32,6 +32,12 @@
         from aska_accounts
         where username = #{username} limit 1
     </select>
+    <select id="selectByRole" resultType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
+        select
+        <include refid="Base_Column_List" />
+        from aska_accounts
+        where role = #{role} and status = 'start'
+    </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from aska_accounts

+ 38 - 24
dao/src/main/resources/mapper/AskaSplitrecordMapper.xml

@@ -8,6 +8,8 @@
             <id property="id" column="id" jdbcType="INTEGER"/>
             <result property="payId" column="payId" jdbcType="INTEGER"/>
             <result property="spiltOrderId" column="spiltOrderId" jdbcType="VARCHAR"/>
+            <result property="recordType" column="recordType" jdbcType="INTEGER"/>
+            <result property="refundOrderId" column="refundOrderId" jdbcType="INTEGER"/>
             <result property="payAmount" column="payAmount" jdbcType="INTEGER"/>
             <result property="retailId" column="retailId" jdbcType="INTEGER"/>
             <result property="retailName" column="retailName" jdbcType="VARCHAR"/>
@@ -33,13 +35,14 @@
 
     <sql id="Base_Column_List">
         id,payId,spiltOrderId,
-        payAmount,retailId,retailName,
-        retailAccount,retailAmount,retailRealtimeAmount,
-        retailAccountAmount,retailSplitrule,channelId,
-        channelName,channelAccount,channelAmount,
-        channelRealtimeAmount,channelAccountAmount,channelSplitRule,
-        status,createTime,hasRefund,
-        refundTotal,refundRetail,refundChannel
+        recordType,refundOrderId,payAmount,
+        retailId,retailName,retailAccount,
+        retailAmount,retailRealtimeAmount,retailAccountAmount,
+        retailSplitrule,channelId,channelName,
+        channelAccount,channelAmount,channelRealtimeAmount,
+        channelAccountAmount,channelSplitRule,status,
+        createTime,hasRefund,refundTotal,
+        refundRetail,refundChannel
     </sql>
 
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -54,7 +57,6 @@
         from aska_splitRecord
         where payId = #{payId} limit 1
     </select>
-
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from aska_splitRecord
         where  id = #{id,jdbcType=INTEGER} 
@@ -62,23 +64,23 @@
     <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaSplitrecord" useGeneratedKeys="true">
         insert into aska_splitRecord
         ( id,payId,spiltOrderId
-        ,payAmount,retailId,retailName
-        ,retailAccount,retailAmount,retailRealtimeAmount
-        ,retailAccountAmount,retailSplitrule,channelId
-        ,channelName,channelAccount,channelAmount
-        ,channelRealtimeAmount,channelAccountAmount,channelSplitRule
-        ,status,createTime,hasRefund
-        ,refundTotal,refundRetail,refundChannel
-        )
+        ,recordType,refundOrderId,payAmount
+        ,retailId,retailName,retailAccount
+        ,retailAmount,retailRealtimeAmount,retailAccountAmount
+        ,retailSplitrule,channelId,channelName
+        ,channelAccount,channelAmount,channelRealtimeAmount
+        ,channelAccountAmount,channelSplitRule,status
+        ,createTime,hasRefund,refundTotal
+        ,refundRetail,refundChannel)
         values (#{id,jdbcType=INTEGER},#{payId,jdbcType=INTEGER},#{spiltOrderId,jdbcType=VARCHAR}
-        ,#{payAmount,jdbcType=INTEGER},#{retailId,jdbcType=INTEGER},#{retailName,jdbcType=VARCHAR}
-        ,#{retailAccount,jdbcType=VARCHAR},#{retailAmount,jdbcType=VARCHAR},#{retailRealtimeAmount,jdbcType=INTEGER}
-        ,#{retailAccountAmount,jdbcType=INTEGER},#{retailSplitrule,jdbcType=VARCHAR},#{channelId,jdbcType=INTEGER}
-        ,#{channelName,jdbcType=VARCHAR},#{channelAccount,jdbcType=VARCHAR},#{channelAmount,jdbcType=VARCHAR}
-        ,#{channelRealtimeAmount,jdbcType=INTEGER},#{channelAccountAmount,jdbcType=INTEGER},#{channelSplitRule,jdbcType=VARCHAR}
-        ,#{status,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{hasRefund,jdbcType=INTEGER}
-        ,#{refundTotal,jdbcType=INTEGER},#{refundRetail,jdbcType=INTEGER},#{refundChannel,jdbcType=INTEGER}
-        )
+        ,#{recordType,jdbcType=INTEGER},#{refundOrderId,jdbcType=INTEGER},#{payAmount,jdbcType=INTEGER}
+        ,#{retailId,jdbcType=INTEGER},#{retailName,jdbcType=VARCHAR},#{retailAccount,jdbcType=VARCHAR}
+        ,#{retailAmount,jdbcType=VARCHAR},#{retailRealtimeAmount,jdbcType=INTEGER},#{retailAccountAmount,jdbcType=INTEGER}
+        ,#{retailSplitrule,jdbcType=VARCHAR},#{channelId,jdbcType=INTEGER},#{channelName,jdbcType=VARCHAR}
+        ,#{channelAccount,jdbcType=VARCHAR},#{channelAmount,jdbcType=VARCHAR},#{channelRealtimeAmount,jdbcType=INTEGER}
+        ,#{channelAccountAmount,jdbcType=INTEGER},#{channelSplitRule,jdbcType=VARCHAR},#{status,jdbcType=INTEGER}
+        ,#{createTime,jdbcType=TIMESTAMP},#{hasRefund,jdbcType=INTEGER},#{refundTotal,jdbcType=INTEGER}
+        ,#{refundRetail,jdbcType=INTEGER},#{refundChannel,jdbcType=INTEGER})
     </insert>
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaSplitrecord" useGeneratedKeys="true">
         insert into aska_splitRecord
@@ -86,6 +88,8 @@
                 <if test="id != null">id,</if>
                 <if test="payId != null">payId,</if>
                 <if test="spiltOrderId != null">spiltOrderId,</if>
+                <if test="recordType != null">recordType,</if>
+                <if test="refundOrderId != null">refundOrderId,</if>
                 <if test="payAmount != null">payAmount,</if>
                 <if test="retailId != null">retailId,</if>
                 <if test="retailName != null">retailName,</if>
@@ -112,6 +116,8 @@
                 <if test="id != null">#{id,jdbcType=INTEGER},</if>
                 <if test="payId != null">#{payId,jdbcType=INTEGER},</if>
                 <if test="spiltOrderId != null">#{spiltOrderId,jdbcType=VARCHAR},</if>
+                <if test="recordType != null">#{recordType,jdbcType=INTEGER},</if>
+                <if test="refundOrderId != null">#{refundOrderId,jdbcType=INTEGER},</if>
                 <if test="payAmount != null">#{payAmount,jdbcType=INTEGER},</if>
                 <if test="retailId != null">#{retailId,jdbcType=INTEGER},</if>
                 <if test="retailName != null">#{retailName,jdbcType=VARCHAR},</if>
@@ -144,6 +150,12 @@
                 <if test="spiltOrderId != null">
                     spiltOrderId = #{spiltOrderId,jdbcType=VARCHAR},
                 </if>
+                <if test="recordType != null">
+                    recordType = #{recordType,jdbcType=INTEGER},
+                </if>
+                <if test="refundOrderId != null">
+                    refundOrderId = #{refundOrderId,jdbcType=INTEGER},
+                </if>
                 <if test="payAmount != null">
                     payAmount = #{payAmount,jdbcType=INTEGER},
                 </if>
@@ -215,6 +227,8 @@
         set 
             payId =  #{payId,jdbcType=INTEGER},
             spiltOrderId =  #{spiltOrderId,jdbcType=VARCHAR},
+            recordType =  #{recordType,jdbcType=INTEGER},
+            refundOrderId =  #{refundOrderId,jdbcType=INTEGER},
             payAmount =  #{payAmount,jdbcType=INTEGER},
             retailId =  #{retailId,jdbcType=INTEGER},
             retailName =  #{retailName,jdbcType=VARCHAR},

BIN
dao/target/aska-dao-1.0.jar


BIN
dao/target/classes/com/mofangchuxing/aska/dao/domain/AskaSplitrecord.class


BIN
dao/target/classes/com/mofangchuxing/aska/dao/mapper/AskaAccountsMapper.class


+ 6 - 0
dao/target/classes/mapper/AskaAccountsMapper.xml

@@ -32,6 +32,12 @@
         from aska_accounts
         where username = #{username} limit 1
     </select>
+    <select id="selectByRole" resultType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
+        select
+        <include refid="Base_Column_List" />
+        from aska_accounts
+        where role = #{role} and status = 'start'
+    </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from aska_accounts

+ 38 - 24
dao/target/classes/mapper/AskaSplitrecordMapper.xml

@@ -8,6 +8,8 @@
             <id property="id" column="id" jdbcType="INTEGER"/>
             <result property="payId" column="payId" jdbcType="INTEGER"/>
             <result property="spiltOrderId" column="spiltOrderId" jdbcType="VARCHAR"/>
+            <result property="recordType" column="recordType" jdbcType="INTEGER"/>
+            <result property="refundOrderId" column="refundOrderId" jdbcType="INTEGER"/>
             <result property="payAmount" column="payAmount" jdbcType="INTEGER"/>
             <result property="retailId" column="retailId" jdbcType="INTEGER"/>
             <result property="retailName" column="retailName" jdbcType="VARCHAR"/>
@@ -33,13 +35,14 @@
 
     <sql id="Base_Column_List">
         id,payId,spiltOrderId,
-        payAmount,retailId,retailName,
-        retailAccount,retailAmount,retailRealtimeAmount,
-        retailAccountAmount,retailSplitrule,channelId,
-        channelName,channelAccount,channelAmount,
-        channelRealtimeAmount,channelAccountAmount,channelSplitRule,
-        status,createTime,hasRefund,
-        refundTotal,refundRetail,refundChannel
+        recordType,refundOrderId,payAmount,
+        retailId,retailName,retailAccount,
+        retailAmount,retailRealtimeAmount,retailAccountAmount,
+        retailSplitrule,channelId,channelName,
+        channelAccount,channelAmount,channelRealtimeAmount,
+        channelAccountAmount,channelSplitRule,status,
+        createTime,hasRefund,refundTotal,
+        refundRetail,refundChannel
     </sql>
 
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -54,7 +57,6 @@
         from aska_splitRecord
         where payId = #{payId} limit 1
     </select>
-
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from aska_splitRecord
         where  id = #{id,jdbcType=INTEGER} 
@@ -62,23 +64,23 @@
     <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaSplitrecord" useGeneratedKeys="true">
         insert into aska_splitRecord
         ( id,payId,spiltOrderId
-        ,payAmount,retailId,retailName
-        ,retailAccount,retailAmount,retailRealtimeAmount
-        ,retailAccountAmount,retailSplitrule,channelId
-        ,channelName,channelAccount,channelAmount
-        ,channelRealtimeAmount,channelAccountAmount,channelSplitRule
-        ,status,createTime,hasRefund
-        ,refundTotal,refundRetail,refundChannel
-        )
+        ,recordType,refundOrderId,payAmount
+        ,retailId,retailName,retailAccount
+        ,retailAmount,retailRealtimeAmount,retailAccountAmount
+        ,retailSplitrule,channelId,channelName
+        ,channelAccount,channelAmount,channelRealtimeAmount
+        ,channelAccountAmount,channelSplitRule,status
+        ,createTime,hasRefund,refundTotal
+        ,refundRetail,refundChannel)
         values (#{id,jdbcType=INTEGER},#{payId,jdbcType=INTEGER},#{spiltOrderId,jdbcType=VARCHAR}
-        ,#{payAmount,jdbcType=INTEGER},#{retailId,jdbcType=INTEGER},#{retailName,jdbcType=VARCHAR}
-        ,#{retailAccount,jdbcType=VARCHAR},#{retailAmount,jdbcType=VARCHAR},#{retailRealtimeAmount,jdbcType=INTEGER}
-        ,#{retailAccountAmount,jdbcType=INTEGER},#{retailSplitrule,jdbcType=VARCHAR},#{channelId,jdbcType=INTEGER}
-        ,#{channelName,jdbcType=VARCHAR},#{channelAccount,jdbcType=VARCHAR},#{channelAmount,jdbcType=VARCHAR}
-        ,#{channelRealtimeAmount,jdbcType=INTEGER},#{channelAccountAmount,jdbcType=INTEGER},#{channelSplitRule,jdbcType=VARCHAR}
-        ,#{status,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{hasRefund,jdbcType=INTEGER}
-        ,#{refundTotal,jdbcType=INTEGER},#{refundRetail,jdbcType=INTEGER},#{refundChannel,jdbcType=INTEGER}
-        )
+        ,#{recordType,jdbcType=INTEGER},#{refundOrderId,jdbcType=INTEGER},#{payAmount,jdbcType=INTEGER}
+        ,#{retailId,jdbcType=INTEGER},#{retailName,jdbcType=VARCHAR},#{retailAccount,jdbcType=VARCHAR}
+        ,#{retailAmount,jdbcType=VARCHAR},#{retailRealtimeAmount,jdbcType=INTEGER},#{retailAccountAmount,jdbcType=INTEGER}
+        ,#{retailSplitrule,jdbcType=VARCHAR},#{channelId,jdbcType=INTEGER},#{channelName,jdbcType=VARCHAR}
+        ,#{channelAccount,jdbcType=VARCHAR},#{channelAmount,jdbcType=VARCHAR},#{channelRealtimeAmount,jdbcType=INTEGER}
+        ,#{channelAccountAmount,jdbcType=INTEGER},#{channelSplitRule,jdbcType=VARCHAR},#{status,jdbcType=INTEGER}
+        ,#{createTime,jdbcType=TIMESTAMP},#{hasRefund,jdbcType=INTEGER},#{refundTotal,jdbcType=INTEGER}
+        ,#{refundRetail,jdbcType=INTEGER},#{refundChannel,jdbcType=INTEGER})
     </insert>
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaSplitrecord" useGeneratedKeys="true">
         insert into aska_splitRecord
@@ -86,6 +88,8 @@
                 <if test="id != null">id,</if>
                 <if test="payId != null">payId,</if>
                 <if test="spiltOrderId != null">spiltOrderId,</if>
+                <if test="recordType != null">recordType,</if>
+                <if test="refundOrderId != null">refundOrderId,</if>
                 <if test="payAmount != null">payAmount,</if>
                 <if test="retailId != null">retailId,</if>
                 <if test="retailName != null">retailName,</if>
@@ -112,6 +116,8 @@
                 <if test="id != null">#{id,jdbcType=INTEGER},</if>
                 <if test="payId != null">#{payId,jdbcType=INTEGER},</if>
                 <if test="spiltOrderId != null">#{spiltOrderId,jdbcType=VARCHAR},</if>
+                <if test="recordType != null">#{recordType,jdbcType=INTEGER},</if>
+                <if test="refundOrderId != null">#{refundOrderId,jdbcType=INTEGER},</if>
                 <if test="payAmount != null">#{payAmount,jdbcType=INTEGER},</if>
                 <if test="retailId != null">#{retailId,jdbcType=INTEGER},</if>
                 <if test="retailName != null">#{retailName,jdbcType=VARCHAR},</if>
@@ -144,6 +150,12 @@
                 <if test="spiltOrderId != null">
                     spiltOrderId = #{spiltOrderId,jdbcType=VARCHAR},
                 </if>
+                <if test="recordType != null">
+                    recordType = #{recordType,jdbcType=INTEGER},
+                </if>
+                <if test="refundOrderId != null">
+                    refundOrderId = #{refundOrderId,jdbcType=INTEGER},
+                </if>
                 <if test="payAmount != null">
                     payAmount = #{payAmount,jdbcType=INTEGER},
                 </if>
@@ -215,6 +227,8 @@
         set 
             payId =  #{payId,jdbcType=INTEGER},
             spiltOrderId =  #{spiltOrderId,jdbcType=VARCHAR},
+            recordType =  #{recordType,jdbcType=INTEGER},
+            refundOrderId =  #{refundOrderId,jdbcType=INTEGER},
             payAmount =  #{payAmount,jdbcType=INTEGER},
             retailId =  #{retailId,jdbcType=INTEGER},
             retailName =  #{retailName,jdbcType=VARCHAR},

+ 15 - 0
domain/src/main/java/com/mofangchuxing/aska/domain/dto/AccountDto.java

@@ -0,0 +1,15 @@
+package com.mofangchuxing.aska.domain.dto;
+
+import lombok.Data;
+
+/**
+ * @Author: syl
+ * @Date: 2023/8/15
+ * @Description:
+ */
+@Data
+public class AccountDto extends BaseDto{
+    private Integer id;
+
+    private String role;
+}

+ 29 - 0
domain/src/main/java/com/mofangchuxing/aska/domain/enums/RecordTypeEnum.java

@@ -0,0 +1,29 @@
+package com.mofangchuxing.aska.domain.enums;
+
+/**
+ * @Author: syl
+ * @Date: 2023/8/16
+ * @Description:
+ */
+public enum RecordTypeEnum {
+    TYPE_PAY(1,"支付"),
+    TYPE_REFUND(2, "退款"),
+    ;
+
+    RecordTypeEnum(int type, String desc) {
+        this.type = type;
+        this.desc = desc;
+    }
+
+    private int type;
+    private String desc;
+
+    public int getType() {
+        return type;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+}

BIN
domain/target/aska-domain-1.0.jar


BIN
domain/target/classes/com/mofangchuxing/aska/domain/dto/AccountDto.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/enums/RecordTypeEnum.class


+ 10 - 8
domain/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -1,24 +1,26 @@
-com/mofangchuxing/aska/domain/dto/ChannelDto.class
-com/mofangchuxing/aska/domain/vo/WeiXinPayScoreServiceResourceDTO.class
 com/mofangchuxing/aska/domain/dto/BaseDto.class
 com/mofangchuxing/aska/domain/dto/RetailDto.class
 com/mofangchuxing/aska/domain/entity/SysMenuEntity.class
+com/mofangchuxing/aska/domain/utils/PageUtils.class
+com/mofangchuxing/aska/domain/dto/LoginDto.class
+com/mofangchuxing/aska/domain/ResponseResult.class
+com/mofangchuxing/aska/domain/enums/PayStatusEnum.class
+com/mofangchuxing/aska/domain/Constant$MenuType.class
+com/mofangchuxing/aska/domain/dto/AccountDto.class
+com/mofangchuxing/aska/domain/entity/SysMenuEntity$SysMenuEntityBuilder.class
+com/mofangchuxing/aska/domain/dto/ChannelDto.class
+com/mofangchuxing/aska/domain/vo/WeiXinPayScoreServiceResourceDTO.class
 com/mofangchuxing/aska/domain/enums/ResultEnum.class
 com/mofangchuxing/aska/domain/DelayObjectWrapper.class
-com/mofangchuxing/aska/domain/utils/PageUtils.class
 com/mofangchuxing/aska/domain/R.class
 com/mofangchuxing/aska/domain/dto/WeiXinPayScoreServiceResourceDTO.class
 com/mofangchuxing/aska/domain/enums/ClientTypeEnum.class
-com/mofangchuxing/aska/domain/dto/LoginDto.class
-com/mofangchuxing/aska/domain/ResponseResult.class
+com/mofangchuxing/aska/domain/enums/RecordTypeEnum.class
 com/mofangchuxing/aska/domain/vo/AskaRetailsVo.class
 com/mofangchuxing/aska/domain/enums/ItemTypeEnum.class
 com/mofangchuxing/aska/domain/enums/DelayTypeEnum.class
-com/mofangchuxing/aska/domain/enums/PayStatusEnum.class
 com/mofangchuxing/aska/domain/PayRequestDto.class
 com/mofangchuxing/aska/domain/vo/WeiXinPlatformCredentialVO.class
-com/mofangchuxing/aska/domain/Constant$MenuType.class
 com/mofangchuxing/aska/domain/Constant.class
-com/mofangchuxing/aska/domain/entity/SysMenuEntity$SysMenuEntityBuilder.class
 com/mofangchuxing/aska/domain/entity/PlainCertificateItem.class
 com/mofangchuxing/aska/domain/BizException.class

+ 2 - 0
domain/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -1,4 +1,5 @@
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/entity/SysMenuEntity.java
+/Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/enums/RecordTypeEnum.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/ResponseResult.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/enums/DelayTypeEnum.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/dto/WeiXinPayScoreServiceResourceDTO.java
@@ -8,6 +9,7 @@
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/BizException.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/vo/WeiXinPayScoreServiceResourceDTO.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/Constant.java
+/Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/dto/AccountDto.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/enums/ResultEnum.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/enums/ClientTypeEnum.java
 /Users/syl/Desktop/work/aska/domain/src/main/java/com/mofangchuxing/aska/domain/dto/BaseDto.java

BIN
main/target/aska.jar


BIN
main/target/aska.jar.original


+ 1 - 1
service/src/main/java/com/mofangchuxing/aska/service/ProfitSharingService.java

@@ -19,5 +19,5 @@ public interface ProfitSharingService {
 
     JSONObject queryProfit(String outOrderNo, String transactionId);
 
-    void returnOrder(Integer payId);
+    void returnOrder(Integer payId, Integer refundId);
 }

+ 3 - 0
service/src/main/java/com/mofangchuxing/aska/service/UserService.java

@@ -1,6 +1,7 @@
 package com.mofangchuxing.aska.service;
 
 import com.mofangchuxing.aska.dao.domain.AskaAccounts;
+import com.mofangchuxing.aska.domain.dto.AccountDto;
 import com.mofangchuxing.aska.domain.entity.SysMenuEntity;
 
 import java.util.List;
@@ -15,4 +16,6 @@ public interface UserService {
     AskaAccounts queryAccountByUsername(String username);
 
     List<SysMenuEntity> listUserMenu(AskaAccounts askaAccounts);
+
+    List<AskaAccounts> listUsers(AccountDto accountDto);
 }

+ 1 - 1
service/src/main/java/com/mofangchuxing/aska/service/impl/PayServiceImpl.java

@@ -136,7 +136,6 @@ public class PayServiceImpl implements PayService {
         if (!result) {
             return new ResponseResult(ResultEnum.UNKNOWN_ERROR);
         }
-        profitSharingService.returnOrder(payRequest.getId());
         RefundOrder refundOrder = new RefundOrder();
         refundOrder.setOrderSn(payRequestDto.getPaymentId());
         refundOrder.setRefundOrderSn(refundOrderNo);
@@ -144,6 +143,7 @@ public class PayServiceImpl implements PayService {
         refundOrder.setMessage(payRequestDto.getMessage());
         refundOrder.setCreateTime(new Date());
         refundOrderMapper.insertSelective(refundOrder);
+        profitSharingService.returnOrder(payRequest.getId(), refundOrder.getId());
         PayRequest updatePayRequest = new PayRequest();
         updatePayRequest.setId(payRequest.getId());
         updatePayRequest.setPayStatus(PayStatusEnum.refund_success.getCode());

+ 61 - 8
service/src/main/java/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.java

@@ -1,11 +1,13 @@
 package com.mofangchuxing.aska.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.mofangchuxing.aska.dao.domain.*;
 import com.mofangchuxing.aska.dao.mapper.*;
 import com.mofangchuxing.aska.domain.Constant;
 import com.mofangchuxing.aska.domain.enums.ClientTypeEnum;
+import com.mofangchuxing.aska.domain.enums.RecordTypeEnum;
 import com.mofangchuxing.aska.service.ProfitSharingService;
 import com.mofangchuxing.aska.service.utils.WxPayV3Utils;
 import lombok.extern.slf4j.Slf4j;
@@ -13,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import javax.crypto.IllegalBlockSizeException;
@@ -45,6 +48,8 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
     private AskaChannelcouponnosMapper askaChannelcouponnosMapper;
     @Resource
     private PayRequestMapper payRequestMapper;
+    @Resource
+    private RestTemplate restTemplate;
 
     @Override
     public void addSplitReceivers(String clientType, Long retailId, String couponNo) throws IllegalBlockSizeException, IOException {
@@ -106,6 +111,7 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
         askaSplitrecord.setPayId(payRequest.getId());
         askaSplitrecord.setPayAmount(payMoney);
         askaSplitrecord.setSpiltOrderId(pOrderNo);
+        askaSplitrecord.setRecordType(RecordTypeEnum.TYPE_PAY.getType());
         Integer maxValue = new BigDecimal(payMoney).multiply(new BigDecimal(0.3)).intValue();
         List<Map<String, Object>> receivers = new ArrayList<>();
         // 从门店读取配置 计算需要分账的金额
@@ -120,6 +126,7 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
             retailAmount = Integer.parseInt(retailReceiver.get("amount").toString());
             askaSplitrecord.setRetailAccount(askaRetails.getAccount());
             askaSplitrecord.setRetailAmount(retailAmount.toString());
+            askaSplitrecord.setRetailSplitrule("tripartite = " + askaRetails.getTripartite()+ ", tripvalue = "+askaRetails.getTripvalue());
         }
         // 如果使用礼券 根据礼券查询渠道 计算需要分账的金额
         AskaChannelcouponnos askaChannelcouponnos = askaChannelcouponnosMapper.searchAllByCouponNo(couponNo);
@@ -134,6 +141,7 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
             askaSplitrecord.setChannelId(askaChannels.getId());
             channelAmount = Integer.parseInt(channelReceiver.get("amount").toString());
             askaSplitrecord.setChannelAmount(channelAmount.toString());
+            askaSplitrecord.setChannelSplitRule("tripartite = " + askaChannels.getTripartite()+ ", tripvalue = "+askaChannels.getTripvalue());
         }
         // 计算门店和渠道最大可分账金额 剩下的记账
         askaSplitrecord = calculateRecord(askaSplitrecord, maxValue, retailAmount, channelAmount);
@@ -147,20 +155,45 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
         }
         param.put("receivers", receivers);
         param.put("unfreeze_unsplit", true);
+        askaSplitrecord.setStatus(1);
+        askaSplitrecord.setCreateTime(new Date());
+        askaSplitrecordMapper.insertSelective(askaSplitrecord);
         try {
             JSONObject jsonObject = wxPayV3Utils.postRequest(url, JSONUtil.toJsonStr(param), JSONObject.class);
             log.info("测试分账 result = {}", jsonObject.toJSONString());
             if ("PROCESSING".equals(jsonObject.getString("state")) || "FINISHED".equals(jsonObject.getString("state"))) {
-                askaSplitrecord.setStatus(1);
+                //分账成功
             }else {
-                askaSplitrecord.setStatus(0);
+                handleSplitFailed(askaSplitrecord);
             }
         } catch (Exception e) {
-            e.printStackTrace();
             log.info("测试分账 exception = {}", e.getMessage());
+            handleSplitFailed(askaSplitrecord);
         }
-        askaSplitrecord.setCreateTime(new Date());
-        askaSplitrecordMapper.insertSelective(askaSplitrecord);
+        notifyAmountChange(askaSplitrecord.getPayId());
+    }
+
+    /**
+     * 通知统计记账
+     * @param payId
+     */
+    private void notifyAmountChange(Integer payId) {
+        String url = "https://pay.mofangchuxing.com/mapi/Common/updateAccounts?payId=" + payId;
+        JSONObject result = restTemplate.getForObject(url, JSONObject.class);
+        log.info("result = {}", result);
+    }
+
+    /**
+     * 如果分账失败 分账的金额转为记账
+     * @param askaSplitrecord
+     */
+    private void handleSplitFailed(AskaSplitrecord askaSplitrecord) {
+        AskaSplitrecord updateSplitrecord = new AskaSplitrecord();
+        updateSplitrecord.setId(askaSplitrecord.getId());
+        updateSplitrecord.setRetailRealtimeAmount(0);
+        updateSplitrecord.setRetailAccountAmount(askaSplitrecord.getRetailAccountAmount() + askaSplitrecord.getRetailRealtimeAmount());
+        updateSplitrecord.setChannelRealtimeAmount(0);
+        updateSplitrecord.setChannelAccountAmount(askaSplitrecord.getChannelAccountAmount() + askaSplitrecord.getRetailRealtimeAmount());
     }
 
     /**
@@ -264,13 +297,33 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
     }
 
     @Override
-    public void returnOrder(Integer payId) {
+    public void returnOrder(Integer payId, Integer refundId) {
         AskaSplitrecord askaSplitrecord = askaSplitrecordMapper.selectAllByPayId(payId);
         if (askaSplitrecord != null) {
+            AskaSplitrecord refundRecord = new AskaSplitrecord();
+            BeanUtil.copyProperties(askaSplitrecord, refundRecord);
+            refundRecord.setId(null);
+            refundRecord.setRefundOrderId(refundId);
+            refundRecord.setRecordType(RecordTypeEnum.TYPE_REFUND.getType());
+            refundRecord.setRetailRealtimeAmount(Math.negateExact(refundRecord.getRetailRealtimeAmount()));
+            refundRecord.setRetailAccountAmount(Math.negateExact(refundRecord.getRetailAccountAmount()));
+            refundRecord.setRetailAmount(String.valueOf(Math.negateExact(Integer.parseInt(refundRecord.getRetailAmount()))));
             //门店分账回退
-            returnSplitApi(askaSplitrecord.getSpiltOrderId(), askaSplitrecord.getRetailAccount(), askaSplitrecord.getRetailRealtimeAmount());
+            boolean retailRefundResult = returnSplitApi(askaSplitrecord.getSpiltOrderId(), askaSplitrecord.getRetailAccount(), askaSplitrecord.getRetailRealtimeAmount());
+            if (!retailRefundResult) {
+                refundRecord.setRetailAccountAmount(refundRecord.getRetailRealtimeAmount() + refundRecord.getRetailAccountAmount());
+                refundRecord.setRetailRealtimeAmount(0);
+            }
+            refundRecord.setChannelRealtimeAmount(Math.negateExact(refundRecord.getChannelRealtimeAmount()));
+            refundRecord.setChannelAccountAmount(Math.negateExact(refundRecord.getChannelAccountAmount()));
+            refundRecord.setChannelAmount(String.valueOf(Math.negateExact(Integer.parseInt(refundRecord.getChannelAmount()))));
             //渠道分账回退
-            returnSplitApi(askaSplitrecord.getSpiltOrderId(), askaSplitrecord.getChannelAccount(), askaSplitrecord.getChannelRealtimeAmount());
+            boolean channelRefundRecord = returnSplitApi(askaSplitrecord.getSpiltOrderId(), askaSplitrecord.getChannelAccount(), askaSplitrecord.getChannelRealtimeAmount());
+            if (!channelRefundRecord) {
+                refundRecord.setChannelAccountAmount(refundRecord.getChannelAccountAmount() + refundRecord.getChannelRealtimeAmount());
+                refundRecord.setChannelRealtimeAmount(0);
+            }
+            askaSplitrecordMapper.insertSelective(refundRecord);
             AskaSplitrecord updateRecord = new AskaSplitrecord();
             updateRecord.setId(askaSplitrecord.getId());
             Integer totalRefund = askaSplitrecord.getRetailRealtimeAmount() + askaSplitrecord.getChannelRealtimeAmount();

+ 6 - 0
service/src/main/java/com/mofangchuxing/aska/service/impl/UserServiceImpl.java

@@ -4,6 +4,7 @@ import com.mofangchuxing.aska.dao.domain.AskaAccounts;
 import com.mofangchuxing.aska.dao.mapper.AskaAccountsMapper;
 import com.mofangchuxing.aska.dao.mapper.SysMenuMapper;
 import com.mofangchuxing.aska.domain.Constant;
+import com.mofangchuxing.aska.domain.dto.AccountDto;
 import com.mofangchuxing.aska.domain.entity.SysMenuEntity;
 import com.mofangchuxing.aska.service.UserService;
 import org.apache.commons.lang3.StringUtils;
@@ -70,4 +71,9 @@ public class UserServiceImpl implements UserService {
                             .buttonNewList(buttonList).build();
                 }).collect(Collectors.toList());
     }
+
+    @Override
+    public List<AskaAccounts> listUsers(AccountDto accountDto) {
+        return askaAccountsMapper.selectByRole(accountDto.getRole());
+    }
 }

BIN
service/target/aska-service-1.0.jar


BIN
service/target/classes/com/mofangchuxing/aska/service/ProfitSharingService.class


BIN
service/target/classes/com/mofangchuxing/aska/service/UserService.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/PayServiceImpl.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/UserServiceImpl.class