瀏覽代碼

Merge remote-tracking branch 'remotes/origin/developerB' into developer

plf 3 年之前
父節點
當前提交
39425f222f

+ 1 - 1
src/main/java/com/caimei365/user/controller/ClubApi.java

@@ -87,7 +87,7 @@ public class ClubApi {
      * @param userId 用户Id
      * @return Map(userPo, clubPo)
      */
-    @ApiOperation("机构个人中心(小程序-未调试)")
+    @ApiOperation("机构个人中心")
     @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
     @GetMapping("/home")
     public ResponseJson<Map<String, Object>> getClubHomeData(Integer userId) {

+ 8 - 0
src/main/java/com/caimei365/user/mapper/ClubMapper.java

@@ -108,4 +108,12 @@ public interface ClubMapper {
      * @return
      */
     Integer findLoginBeans(Integer userId);
+
+    /**
+     * 查询机构用户可用优惠券数量
+     *
+     * @param userId
+     * @return
+     */
+    Integer findCountCoupon(Integer userId);
 }

+ 10 - 0
src/main/java/com/caimei365/user/model/vo/UserVo.java

@@ -117,6 +117,16 @@ public class UserVo implements Serializable {
      */
     private Integer userBeans;
 
+    /**
+     * 账户实际可用余额
+     */
+    private Double ableUserMoney;
+
+    /**
+     * 头像
+     */
+    private String image;
+
     /**
      * 审核不通过原因列表
      */

+ 21 - 7
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -216,24 +216,38 @@ public class ClubServiceImpl implements ClubService {
         if (club == null) {
             return ResponseJson.error("机构信息不存在", null);
         }
-        Map<String, Object> map = new HashMap();
+        Map<String, Object> map = new HashMap<>(10);
         map.put("user", user);
         map.put("club", club);
         OrderCountVo countVo = clubMapper.getOrderCount(userId);
         //待确认数量
-        map.put("confirmedCount", countVo.getConfirmedCount());
+        map.put("confirmedCount", countVo != null ? countVo.getConfirmedCount() : 0);
         //待付款数量
-        map.put("paymentCount", countVo.getPaymentCount());
+        map.put("paymentCount", countVo != null ? countVo.getPaymentCount() : 0);
         //待发货数量
-        map.put("waitShipmentsCount", countVo.getWaitShipmentsCount());
+        map.put("waitShipmentsCount", countVo != null ? countVo.getWaitShipmentsCount() : 0);
         //已发货数量
-        map.put("shipmentsCount", countVo.getShipmentsCount());
+        map.put("shipmentsCount", countVo != null ? countVo.getShipmentsCount() : 0);
         //退货款数量
-        map.put("salesReturnCount", countVo.getSalesReturnCount());
+        map.put("salesReturnCount", countVo != null ? countVo.getSalesReturnCount() : 0);
         //联系电话
         String contactNumber = baseMapper.getAfterSalesPhone();
         map.put("contactNumber", contactNumber);
-
+        //完善资料是否送豆
+        boolean isModify = true;
+        Integer id = null;
+        if (user.getUserIdentity() == 4) {
+            id = clubMapper.findBeansHistoryByType(userId, 3);
+        } else if (user.getUserIdentity() == 2) {
+            id = clubMapper.findBeansHistoryByType(userId, 4);
+        }
+        if (id != null && id > 0) {
+            isModify = false;
+        }
+        map.put("isModify", isModify);
+        //优惠券可用数量
+        Integer couponNum = clubMapper.findCountCoupon(userId);
+        map.put("couponNum", couponNum);
         return ResponseJson.success(map);
     }
 

+ 3 - 1
src/main/resources/mapper/BaseMapper.xml

@@ -92,7 +92,9 @@
                registerIP as registerIp,
                guideFlag,
                validFlag,
-               userBeans
+               userBeans,
+               ableUserMoney,
+               image
         from user
         where userID = #{userId}
     </select>

+ 16 - 0
src/main/resources/mapper/ClubMapper.xml

@@ -146,4 +146,20 @@
           AND DATE_FORMAT(addTime, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
           AND userId = #{userId}
     </select>
+
+    <select id="findCountCoupon" resultType="integer">
+        SELECT
+          COUNT(a.id)
+        FROM
+          cm_coupon_club a
+          LEFT JOIN cm_coupon cc ON a.couponId = cc.id
+        WHERE
+          cc.delFlag = 0
+          AND a.delFlag = 0
+          AND a.userId = #{userId}
+          AND a.status = 1
+          AND NOW() BETWEEN cc.startDate
+          AND cc.endDate
+          AND cc.status != 2
+    </select>
 </mapper>