jk-GitHub-coder 3 年之前
父節點
當前提交
6892cefabe

+ 20 - 13
YijiaRestful/src/main/java/com/platform/yijia/controller/CouponController.java

@@ -76,19 +76,6 @@ public class CouponController {
                     coupon.setCouponIssueId(couponIssueId);
                     //领取油站所分发的优惠券
                     List<Coupon> couponsList = couponService.selectStaGrantCouponList(coupon);
-//                    if(cgcInfo !=null){
-//                        //更新次数
-//                        Integer issueGiveCount = cgcInfo.getIssueGiveCount();
-//                        int i = issueGiveCount + 1;
-//                        couponUserGiveCount.setIssueGiveCount(i);
-//                        couponUserGiveCount.setUpdateTime(new Date());
-//                        couponService.updateCouponUserGiveCount(couponUserGiveCount);
-//                    }else {
-//                        //新增次数
-//                        couponUserGiveCount.setIssueGiveCount(1);
-//                        couponUserGiveCount.setCreteTime(new Date());
-//                        couponService.addCouponUserGiveCount(couponUserGiveCount);
-//                    }
                     resultData = ResultData.success(couponsList);
                 }
             }else {
@@ -273,6 +260,26 @@ public class CouponController {
                         resultMap.put("notClaimedCouponList", notClaimedCouponList);
                         resultMap.put("couponReceiveNumList", couponReceiveNumList);
                         logger.info("用户领取到的优惠券:" + resultMap.toString());
+                        //记录用户在该领取方式操作
+                        CouponUserGiveCount couponUserGiveCount = new CouponUserGiveCount();
+                        couponUserGiveCount.setStationId(stationId);
+                        couponUserGiveCount.setUnionId(unionId);
+                        couponUserGiveCount.setCouponIssueId(couponIssueId);
+                        //用户能进入领取界面的次数
+                        CouponUserGiveCount cgcInfo = couponService.selectCouponUserGiveCount(couponUserGiveCount);
+                        if(cgcInfo !=null){
+                            //更新次数
+                            Integer issueGiveCount = cgcInfo.getIssueGiveCount();
+                            int i = issueGiveCount + 1;
+                            couponUserGiveCount.setIssueGiveCount(i);
+                            couponUserGiveCount.setUpdateTime(new Date());
+                            couponService.updateCouponUserGiveCount(couponUserGiveCount);
+                        }else {
+                            //新增次数
+                            couponUserGiveCount.setIssueGiveCount(1);
+                            couponUserGiveCount.setCreteTime(new Date());
+                            couponService.addCouponUserGiveCount(couponUserGiveCount);
+                        }
                         resultData = ResultData.success(resultMap);
                     }else {
                         resultData = ResultData.error(CodeMsg.NO_COUPON_ISSUE);

+ 1 - 2
YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java

@@ -255,12 +255,11 @@ public class PayController {
                                 List<String> mnoProportionList = Arrays.asList(mnoProportionSplit);
                                 for (int i=0; i<mnoArrayList.size(); i++){
                                     for (int y=0; y<mnoProportionList.size()-1; y++){
-                                        Map<String, Object> map = new HashMap<>();
                                         String mno = mnoArrayList.get(i);
                                         String mnoPro = mnoProportionList.get(y);
                                         //本单金额
                                         String amt = payOrder.getAmt().toString();
-                                        BigDecimal allotValue = new BigDecimal(amt).multiply(new BigDecimal(mnoPro)).divide(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
+                                        BigDecimal allotValue = new BigDecimal(amt).multiply(new BigDecimal(mnoPro)).divide(new BigDecimal("10")).setScale(2, BigDecimal.ROUND_HALF_UP);
                                         Map<String, Object> m = new HashMap<>();
                                         m.put("mno", mno);
                                         m.put("allotValue", allotValue);

+ 7 - 1
YijiaRestful/src/main/java/com/platform/yijia/pojo/Coupon.java

@@ -3,7 +3,9 @@ package com.platform.yijia.pojo;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 优惠券实体类
@@ -41,6 +43,8 @@ public class Coupon {
     private String appointedDays;           //指定日期
     private String cycleDays;               //每周每月的周几和几号
 
+    private List<CouponVerification> couponVerificationList;        //核销站点
+
     //优惠活动是否叠加
     private String isCardFlag;              //是否电子卡
     private String isGradeFlag;             //是否等级
@@ -50,9 +54,11 @@ public class Coupon {
     private Integer showId;                     //展示位
     private BigDecimal discountThresholdAmt;    //领取方式门槛金额
 
-    //查询参数
+    //查询参数 领取方式返回值
     private String issueType;               //领取方式
+    private String issueName;               //领取方式名称
     private String couponIssueId;           //领取方式ID
+
     private String unionId;                 //用户unionId
 
 }

+ 15 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/CouponVerification.java

@@ -0,0 +1,15 @@
+package com.platform.yijia.pojo;
+
+import lombok.Data;
+
+/**
+ * 兑换券核销站点表
+ */
+@Data
+public class CouponVerification {
+    private Integer couponVerificationId;   //主键
+    Integer couponId;               //优惠券Id
+    private Integer verificationStationId;                 //优惠券Id
+    private String verification;            //站点
+    private String verificationName;        //
+}

+ 28 - 0
YijiaRestful/src/main/resources/mapper/CouponMapper.xml

@@ -48,9 +48,20 @@
       <result column="coupon_issue_id"           jdbcType="VARCHAR"   property="couponIssueId" />
       <result column="show_id"                   jdbcType="INTEGER"   property="showId" />
       <result column="issue_type"                jdbcType="VARCHAR"   property="issueType" />
+      <result column="issue_name"                jdbcType="VARCHAR"   property="issueName" />
       <result column="discount_threshold_amt"    jdbcType="DECIMAL"   property="discountThresholdAmt" />
+
+      <collection property="couponVerificationList"  select="selectCouponVerificationInfo"
+                  column="{param_station_id = station_id, param_coupon_id = id}" ofType="com.platform.yijia.pojo.CouponVerification"/>
+
   </resultMap>
 
+    <!-- 核销站点-->
+   <resultMap id="CouponVerificationBaseResultMap"       type="com.platform.yijia.pojo.CouponVerification">
+       <result column="dept_id"            jdbcType="INTEGER"   property="verificationStationId" />
+       <result column="dept_name"          jdbcType="VARCHAR"   property="verificationName" />
+   </resultMap>
+
     <!--发放方式,优惠劵信息-->
    <resultMap id="CouponIssueBaseResultMap"       type="com.platform.yijia.pojo.CouponIssue">
        <result column="coupon_issue_id"           jdbcType="VARCHAR"   property="couponIssueId" />
@@ -162,7 +173,10 @@
             T2.discount_threshold_amt,
             T2.station_id,
             T2.show_id,
+            T3.id,
+            T3.coupon_name,
             T3.coupon_amt,
+            T3.coupon_threshold_amt,
             T3.coupon_type,
             T3.oil_name,
             T3.use_discount_type,
@@ -204,6 +218,20 @@
         </where>
     </select>
 
+    <!--查询核销站点信息-->
+    <select id="selectCouponVerificationInfo" parameterType="java.util.HashMap" resultMap="CouponVerificationBaseResultMap">
+        SELECT
+                T2.dept_id,
+                T2.dept_name
+        FROM
+                    coupon_info     AS T1
+        LEFT JOIN   sys_dept        AS T2   ON FIND_IN_SET(T2.dept_id, T1.verification)
+        WHERE
+            T1.station_id = #{param_station_id}
+            AND T1.coupon_type = "3"
+            AND T1.id = #{param_coupon_id}
+    </select>
+
     <!--获取用户进入领取页面的次数-->
     <select id="selectCouponUserGiveCount" parameterType="com.platform.yijia.pojo.CouponUserGiveCount" resultMap="CouponUserGiveCountBaseResultMap">
         SELECT