瀏覽代碼

Merge remote-tracking branch 'origin/developerC' into developerB

zhijiezhao 3 年之前
父節點
當前提交
8075905d16
共有 39 個文件被更改,包括 2140 次插入99 次删除
  1. 12 2
      src/main/java/com/caimei365/user/controller/ClubApi.java
  2. 3 0
      src/main/java/com/caimei365/user/controller/OperationApi.java
  3. 32 3
      src/main/java/com/caimei365/user/controller/SellerApi.java
  4. 76 1
      src/main/java/com/caimei365/user/controller/ShopApi.java
  5. 132 0
      src/main/java/com/caimei365/user/controller/UserCenterApi.java
  6. 23 7
      src/main/java/com/caimei365/user/mapper/ClubMapper.java
  7. 17 0
      src/main/java/com/caimei365/user/mapper/PersonalCenterMapper.java
  8. 10 0
      src/main/java/com/caimei365/user/mapper/SellerMapper.java
  9. 64 1
      src/main/java/com/caimei365/user/mapper/ShopMapper.java
  10. 48 0
      src/main/java/com/caimei365/user/mapper/UserCenterMapper.java
  11. 28 0
      src/main/java/com/caimei365/user/model/dto/AvatarDto.java
  12. 23 0
      src/main/java/com/caimei365/user/model/dto/MessageDto.java
  13. 48 0
      src/main/java/com/caimei365/user/model/dto/ShopBannerDto.java
  14. 66 1
      src/main/java/com/caimei365/user/model/po/ServiceProviderPo.java
  15. 58 0
      src/main/java/com/caimei365/user/model/vo/AdvertiseVo.java
  16. 78 0
      src/main/java/com/caimei365/user/model/vo/AfterSaleVo.java
  17. 72 0
      src/main/java/com/caimei365/user/model/vo/BalanceRecordVo.java
  18. 31 0
      src/main/java/com/caimei365/user/model/vo/HelpPageVo.java
  19. 64 0
      src/main/java/com/caimei365/user/model/vo/InformationVo.java
  20. 39 39
      src/main/java/com/caimei365/user/model/vo/OrderCountVo.java
  21. 28 0
      src/main/java/com/caimei365/user/model/vo/ShopBannerVo.java
  22. 89 0
      src/main/java/com/caimei365/user/model/vo/ShopHomeVo.java
  23. 0 1
      src/main/java/com/caimei365/user/model/vo/ShopVo.java
  24. 6 0
      src/main/java/com/caimei365/user/service/ClubService.java
  25. 13 0
      src/main/java/com/caimei365/user/service/SellerService.java
  26. 42 1
      src/main/java/com/caimei365/user/service/ShopService.java
  27. 50 0
      src/main/java/com/caimei365/user/service/UserCenterService.java
  28. 127 13
      src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java
  29. 3 0
      src/main/java/com/caimei365/user/service/impl/OperationServiceImpl.java
  30. 32 0
      src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java
  31. 190 2
      src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java
  32. 137 0
      src/main/java/com/caimei365/user/service/impl/UserCenterServiceImpl.java
  33. 108 14
      src/main/java/com/caimei365/user/utils/DateUtil.java
  34. 115 0
      src/main/java/com/caimei365/user/utils/ImageUtils.java
  35. 57 12
      src/main/resources/mapper/ClubMapper.xml
  36. 7 0
      src/main/resources/mapper/PersonalCenterMapper.xml
  37. 25 2
      src/main/resources/mapper/SellerMapper.xml
  38. 123 0
      src/main/resources/mapper/ShopMapper.xml
  39. 64 0
      src/main/resources/mapper/UserCenterMapper.xml

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

@@ -175,7 +175,6 @@ public class ClubApi {
      *                     fileList:    [{fileName:"文件名称",ossName:"oss文件名称"},{fileName:"文件名称",ossName:"oss文件名称"}...]
      *                     imageList:   ["图片","图片",...]
      *                    }
-     * @return
      */
     @ApiOperation("保存机构资料备注")
     @PostMapping("/remarks/save")
@@ -190,6 +189,17 @@ public class ClubApi {
         return clubService.deleteClubRemarks(clubRemarksDto.getRemarksId());
     }
 
-
+    /**
+     * 机构个人中心数据
+     */
+    @ApiOperation("机构个人中心数据(旧:/pcCenter/myPcCenter)")
+    @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
+    @GetMapping("/personal/data")
+    public ResponseJson<Map<String, Object>> getPersonalData(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return clubService.getPersonalData(userId);
+    }
 
 }

+ 3 - 0
src/main/java/com/caimei365/user/controller/OperationApi.java

@@ -56,6 +56,9 @@ public class OperationApi {
     @ApiOperation("更新运营人员邀请码")
     @PostMapping("/code/update")
     public ResponseJson updateInvitationCode(OperationDto operationDto){
+        if (null == operationDto.getId()){
+            return ResponseJson.error("运营人员Id不能为空!");
+        }
         return operationService.updateInvitationCode(operationDto);
     }
 

+ 32 - 3
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -3,7 +3,9 @@ package com.caimei365.user.controller;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.dto.OnlineDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
+import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.service.SellerService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -14,6 +16,8 @@ import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Map;
+
 /**
  * Description
  *
@@ -81,20 +85,45 @@ public class SellerApi {
      * @param spId 协销Id
      * @param status            机构状态
      * @param name              机构名字关键字(搜索用)
-     * @return
      */
     @ApiOperation("协销机构列表")
     @GetMapping("/club/list")
-    public ResponseJson getClubList(Integer spId,
+    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer spId,
                                     Integer status,
                                     String name,
                                     Integer userIdentity,
                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
         if (null == spId || null == status) {
-            return ResponseJson.error("spId 或 status 参数不全!");
+            return ResponseJson.error("spId 或 status 参数不全!", null);
         }
         return sellerService.getClubList(spId, status, name, userIdentity, pageNum, pageSize);
     }
 
+    /**
+     * 所有的机构列表
+     * 原spi的 /seller/findAllClub
+     * @param searchWord     关键字(搜索用)
+     */
+    @ApiOperation("所有的机构列表(搜索)")
+    @GetMapping("/club/all")
+    public ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord,
+                                                         @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                         @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return sellerService.getAllClubList(searchWord, pageNum, pageSize);
+    }
+
+    /**
+     * 协销个人中心
+     *
+     * @param userId 协销userId
+     */
+    @GetMapping("/home")
+    public  ResponseJson<ServiceProviderPo> getSellerHome(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return sellerService.getSellerHome(userId);
+    }
+
 }

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

@@ -1,7 +1,10 @@
 package com.caimei365.user.controller;
 
 import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ShopBannerDto;
 import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.vo.ShopBannerVo;
+import com.caimei365.user.model.vo.ShopHomeVo;
 import com.caimei365.user.service.ShopService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -12,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -85,7 +89,7 @@ public class ShopApi {
      */
     @ApiOperation("更新供应商资料")
     @PostMapping("/info/update")
-    public ResponseJson updateShopUserInfo(ShopUpdateDto shopUpdateDto) {
+    public ResponseJson<Void> updateShopUserInfo(ShopUpdateDto shopUpdateDto) {
         String operationLicence = shopUpdateDto.getOperationLicence();
         String hygienicLicense = shopUpdateDto.getHygienicLicense();
         String taxLicense = shopUpdateDto.getTaxLicense();
@@ -94,4 +98,75 @@ public class ShopApi {
         return shopService.updateShopUserInfo(shopUpdateDto, operationLicence, hygienicLicense, taxLicense, honorCertification, productCertification);
     }
 
+    /**
+     * 供应商首页数据
+     * @param shopId 供应商Id
+     */
+    @ApiOperation("供应商首页数据(旧:/supplier/home/detail(supplierId))")
+    @ApiImplicitParam(required = true, name = "shopId", value = "供应商Id")
+    @GetMapping("/home/data")
+    public ResponseJson<ShopHomeVo> getShopHomeData(Integer shopId) {
+        if (null == shopId) {
+            return ResponseJson.error("参数异常:供应商Id不能为空!", null);
+        }
+        return shopService.getShopHomeData(shopId);
+    }
+
+    /**
+     * 供应商首页-轮播图片
+     * @param shopId 供应商Id
+     */
+    @ApiOperation("供应商首页-轮播图片(旧:/supplier/home/images(supplierId))")
+    @GetMapping("/home/images")
+    public ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId) {
+        if (null == shopId) {
+            return ResponseJson.error("参数异常:供应商Id不能为空!", null);
+        }
+        return shopService.getShopHomeImages(shopId);
+    }
+
+    /**
+     * 供应商-更新轮播图片
+     * @param shopBannerDto {
+     *                      id      图片id
+     *                      shopId  供应商Id
+     *                      image   图片
+     *                      title   名称
+     *                      link    链接
+     *                      info    描述
+     * }
+     */
+    @ApiOperation("供应商-更新轮播图片(旧:/supplier/saveShopBanner)")
+    @PostMapping("/home/images/update")
+    public ResponseJson<Void> saveShopHomeImages(ShopBannerDto shopBannerDto) {
+        return shopService.saveShopHomeImages(shopBannerDto);
+    }
+
+    /**
+     * 供应商-删除轮播图片
+     * @param shopBannerDto { id  图片id}
+     */
+    @ApiOperation("供应商-删除轮播图片(旧:/supplier/deleteShopBanner)")
+    @PostMapping("/home/images/delete")
+    public ResponseJson<Void> deleteShopHomeImages(ShopBannerDto shopBannerDto) {
+        if (null == shopBannerDto.getId()) {
+            return ResponseJson.error("参数异常:图片Id不能为空!", null);
+        }
+        return shopService.deleteShopHomeImages(shopBannerDto.getId());
+    }
+
+    /**
+     * 供应商个人中心数据
+     * @param userId 用户Id
+     */
+    @ApiOperation("供应商个人中心数据(旧:/supplier/homePageData)")
+    @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
+    @GetMapping("/personal/data")
+    public ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return shopService.getShopPersonalData(userId);
+    }
+
 }

+ 132 - 0
src/main/java/com/caimei365/user/controller/UserCenterApi.java

@@ -0,0 +1,132 @@
+package com.caimei365.user.controller;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.AvatarDto;
+import com.caimei365.user.model.dto.MessageDto;
+import com.caimei365.user.model.vo.HelpPageVo;
+import com.caimei365.user.model.vo.PaginationVo;
+import com.caimei365.user.service.UserCenterService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Api(tags = "用户中心API")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/user/center")
+public class UserCenterApi {
+
+    private final UserCenterService userCenterService;
+
+    /**
+     * 查看帮助页信息(注册协议)
+     * @param helpPageId 帮助页Id
+     */
+    @ApiOperation("查看帮助页信息(注册协议)(旧:/club/protocol)")
+    @ApiImplicitParam(required = true, name = "helpPageId", value = "帮助页Id")
+    @GetMapping("/protocol")
+    public ResponseJson<HelpPageVo> getUserProtocol(Integer helpPageId) {
+        if (null == helpPageId) {
+            return ResponseJson.error("参数异常:帮助页Id不能为空!", null);
+        }
+        return userCenterService.getUserProtocol(helpPageId);
+    }
+
+    /**
+     * 保存用户头像
+     * @param avatarDto {
+     *                   userId 用户id
+     *                   image  头像图片
+     * }
+     */
+    @ApiOperation("保存用户头像(旧:/user/uploadAvatar)")
+    @PostMapping("/avatar/save")
+    public ResponseJson<Void> uploadAvatar(AvatarDto avatarDto) {
+        if (null == avatarDto.getUserId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        if (StringUtils.isBlank(avatarDto.getImage())) {
+            return ResponseJson.error("参数异常:用户头像不能为空!", null);
+        }
+        return userCenterService.saveUserAvatar(avatarDto.getUserId(), avatarDto.getImage());
+    }
+
+    /**
+     * 我的站内消息
+     */
+    @ApiOperation("我的站内消息(旧:/user/messageList)")
+    @GetMapping("/messages")
+    public ResponseJson<PaginationVo<Map<String, Object>>> getMessageList(Integer userId,
+                                                                          @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                          @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == userId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return userCenterService.getMessageList(userId, pageNum, pageSize);
+    }
+
+    /**
+     * 站内消息-标为已读
+     * @param messageDto {
+     *                   messageIds 站内消息Id集合
+     * }
+     */
+    @ApiOperation("站内消息-标为已读(旧:/user/markAsRead)")
+    @PostMapping("/messages/read")
+    public ResponseJson<Void> markMessageAsRead(MessageDto messageDto) {
+        if (StringUtils.isBlank(messageDto.getMessageIds())) {
+            return ResponseJson.error("参数异常:消息Id不能为空!", null);
+        }
+        return userCenterService.markMessageAsRead(messageDto.getMessageIds());
+    }
+
+    /**
+     * 站内消息-删除
+     * @param messageDto {
+     *                   messageIds 站内消息Id集合
+     * }
+     */
+    @ApiOperation("站内消息-删除(旧:/user/deleteMessage)")
+    @PostMapping("/messages/delete")
+    public ResponseJson<Void> deleteMessages(MessageDto messageDto) {
+        if (StringUtils.isBlank(messageDto.getMessageIds())) {
+            return ResponseJson.error("参数异常:消息Id不能为空!", null);
+        }
+        return userCenterService.deleteMessages(messageDto.getMessageIds());
+    }
+
+    /**
+     * 我的账户余额明细
+     */
+    @ApiOperation("账户余额明细(旧:/personalCenter/touchBalance)")
+    @ApiImplicitParams({
+        @ApiImplicitParam(required = true, name = "userId", value = "用户Id"),
+        @ApiImplicitParam(required = false, name = "year", value = "年份"),
+        @ApiImplicitParam(required = false, name = "month", value = "月份"),
+        @ApiImplicitParam(required = false, name = "type", value = "收支类型:1收入,2支出"),
+        @ApiImplicitParam(required = false, name = "pageNum", value = "第几页"),
+        @ApiImplicitParam(required = false, name = "pageSize", value = "一页多少条")
+    })
+    @GetMapping("/balance")
+    public ResponseJson<Map<String, Object>> getBalanceRecord(Integer userId, String type, Integer year, Integer month,
+                                                                          @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                          @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == userId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return userCenterService.getBalanceRecord(userId, type, year, month, pageNum, pageSize);
+    }
+
+}

+ 23 - 7
src/main/java/com/caimei365/user/mapper/ClubMapper.java

@@ -39,13 +39,13 @@ public interface ClubMapper {
      */
     void updateClubByUpdateInfo(ClubUpdateDto club);
 
-    /**
-     * 获取订单数量
-     *
-     * @param userId
-     * @return
-     */
-    OrderCountVo getOrderCount(Integer userId);
+//    /**
+//     * 获取订单数量
+//     *
+//     * @param userId
+//     * @return
+//     */
+//    OrderCountVo getOrderCount(Integer userId);
 
     /**
      * 查询采美豆类型记录
@@ -205,4 +205,20 @@ public interface ClubMapper {
      * @param remarksId  备注id
      */
     void deleteRemarksFiles(Integer remarksId);
+    /**
+     * 售后无忧,购物须知
+     */
+    AfterSaleVo getAfterSale();
+    /**
+     * 未读消息数量
+     */
+    Integer getUnReadMessageCount(Integer userId);
+    /**
+     * 优惠券可用数量
+     */
+    Integer getUserCouponCount(Integer userId);
+
+    List<AdvertiseVo> getUserAdvertiseList(AdvertiseVo advertiseVo);
+
+    List<InformationVo> getInformationList(InformationVo informationVo);
 }

+ 17 - 0
src/main/java/com/caimei365/user/mapper/PersonalCenterMapper.java

@@ -0,0 +1,17 @@
+package com.caimei365.user.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Mapper
+public interface PersonalCenterMapper {
+    /**
+     * 未读消息数量
+     */
+    Integer getUnReadMessageCount(Integer userId);
+}

+ 10 - 0
src/main/java/com/caimei365/user/mapper/SellerMapper.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.mapper;
 
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.UserLoginVo;
@@ -60,4 +61,13 @@ public interface SellerMapper {
     List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, Integer userIdentity);
 
     Integer findOrderNum(ClubVo club);
+    /**
+     * 所有的机构列表
+     */
+    List<ClubVo> getAllClubList(String searchWord);
+    /**
+     * 协销信息
+     */
+    ServiceProviderPo getSellerByUserId(Integer userId);
+
 }

+ 64 - 1
src/main/java/com/caimei365/user/mapper/ShopMapper.java

@@ -3,10 +3,12 @@ package com.caimei365.user.mapper;
 import com.caimei365.user.model.dto.ShopUpdateDto;
 import com.caimei365.user.model.po.ShopCertPo;
 import com.caimei365.user.model.po.UserPo;
-import com.caimei365.user.model.vo.ShopVo;
+import com.caimei365.user.model.vo.*;
+import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Description
@@ -54,4 +56,65 @@ public interface ShopMapper {
      * @param shopCert  资质证书数据
      */
     void insertShopCert(ShopCertPo shopCert);
+
+    /**
+     * 供应商首页数据
+     * @param shopId 供应商Id
+     */
+    ShopHomeVo getShopHomeData(Integer shopId);
+
+    /**
+     * 公司资质照片
+     */
+    List<String> getShopCertById(Integer shopId, int shopCertTypeId);
+
+    /**
+     * 供应商首页-轮播图片
+     */
+    List<ShopBannerVo> getShopHomeImages(Integer shopId);
+    /**
+     * 店铺促销活动
+     */
+    PromotionsVo getShopPromotionsByShopId(Integer shopId);
+    /**
+     * 促销赠品
+     */
+    List<ProductItemVo> getPromotionsGifts(Integer promotionsId);
+    /**
+     * 统计商品数量
+     *
+     * @param shopId    供应商id
+     * @param validFlag 商品状态
+     */
+    Integer getShopProductCount(Integer shopId, Integer validFlag);
+    /**
+     * 统计前五的商品销售信息
+     */
+    @MapKey("productId")
+    List<Map<String, Object>> getSalesRankingList(Integer shopId);
+    /**
+     * 获取商品信息
+     */
+    ProductItemVo getProductShown(Integer productId);
+    /**
+     * 销售统计
+     */
+    @MapKey("orderQuantity")
+    Map<String, Object> getSalesStatistics(Integer shopId, String startTime, String endTime);
+    /**
+     * 轮播图片数量
+     */
+    int getShopHomeImageCount(Integer shopId);
+    /**
+     * 新增轮播图
+     */
+    void insertShopHomeImage(ShopBannerVo shopBanner);
+    /**
+     * 更新轮播图
+     */
+    void updateShopHomeImage(ShopBannerVo shopBanner);
+    /**
+     * 删除轮播图
+     */
+    void deleteShopHomeImage(Integer id);
 }

+ 48 - 0
src/main/java/com/caimei365/user/mapper/UserCenterMapper.java

@@ -0,0 +1,48 @@
+package com.caimei365.user.mapper;
+
+import com.caimei365.user.model.vo.BalanceRecordVo;
+import com.caimei365.user.model.vo.HelpPageVo;
+import org.apache.ibatis.annotations.MapKey;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Mapper
+public interface UserCenterMapper {
+    /**
+     * 查看帮助页信息(注册协议)
+     */
+    HelpPageVo getUserProtocol(Integer helpPageId);
+    /**
+     * 保存用户头像
+     */
+    void saveUserAvatar(Integer userId, String image);
+    /**
+     * 获取我的站内消息
+     */
+    @MapKey("messageId")
+    List<Map<String, Object>> getMessageList(Integer userId);
+    /**
+     * 站内消息-标为已读
+     */
+    void updateMessageAsRead(String messageId);
+    /**
+     * 删除消息
+     */
+    void deleteMessage(String messageId);
+    /**
+     * 我的账户余额明细
+     */
+    List<BalanceRecordVo> getBalanceRecord(BalanceRecordVo balanceRecord);
+    /**
+     * 可用余额
+     */
+    Double getAbleUserMoney(Integer userId);
+}

+ 28 - 0
src/main/java/com/caimei365/user/model/dto/AvatarDto.java

@@ -0,0 +1,28 @@
+package com.caimei365.user.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@ApiModel("上传头像")
+@Data
+public class AvatarDto implements Serializable {
+    /**
+     * 用户Id
+     */
+    @ApiModelProperty("用户Id")
+    private Integer userId;
+    /**
+     * 头像
+     */
+    @ApiModelProperty("头像")
+    private String image;
+}

+ 23 - 0
src/main/java/com/caimei365/user/model/dto/MessageDto.java

@@ -0,0 +1,23 @@
+package com.caimei365.user.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@ApiModel("站内消息")
+@Data
+public class MessageDto implements Serializable {
+    /**
+     * 站内消息Id集合
+     */
+    @ApiModelProperty("站内消息Id集合")
+    private String messageIds;
+}

+ 48 - 0
src/main/java/com/caimei365/user/model/dto/ShopBannerDto.java

@@ -0,0 +1,48 @@
+package com.caimei365.user.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@ApiModel("供应商轮播图")
+@Data
+public class ShopBannerDto implements Serializable {
+    /**
+     * Id
+     */
+    @ApiModelProperty("Id")
+    private Integer id;
+    /**
+     * 供应商Id
+     */
+    @ApiModelProperty("供应商Id")
+    private Integer shopId;
+    /**
+     * 名称
+     */
+    @ApiModelProperty("名称")
+    private String title;
+    /**
+     * 链接
+     */
+    @ApiModelProperty("链接")
+    private String link;
+    /**
+     * 描述
+     */
+    @ApiModelProperty("描述")
+    private String info;
+    /**
+     * 图片
+     */
+    @ApiModelProperty("图片")
+    private String image;
+}

+ 66 - 1
src/main/java/com/caimei365/user/model/po/ServiceProviderPo.java

@@ -2,6 +2,8 @@ package com.caimei365.user.model.po;
 
 import lombok.Data;
 
+import java.io.Serializable;
+
 /**
  * 协销
  *
@@ -9,7 +11,8 @@ import lombok.Data;
  * @date : 2021/3/18
  */
 @Data
-public class ServiceProviderPo {
+public class ServiceProviderPo implements Serializable {
+    private static final long serialVersionUID = 1L;
     /**
      * 协销Id(serviceProviderID)
      */
@@ -18,4 +21,66 @@ public class ServiceProviderPo {
      * 协销状态,见表c_serviceproviderstatus或枚举ServiceProviderStatus
      */
     private Integer status;
+    /**
+     * 对应的userId
+     */
+    private Integer userId;
+    /**
+     * 小程序openid
+     */
+    private String openid;
+    /**
+     * 微信unionId
+     */
+    private String unionId;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 联系手机
+     */
+    private String contractMobile;
+
+    /**
+     * 联系人1(默认联系人)
+     */
+    private String linkMan1;
+
+    /**
+     * 联系人1职务
+     */
+    private String duty1;
+
+    /**
+     * 联系人1手机
+     */
+    private String contractMobile1;
+    /**
+     * 审核状态
+     */
+    private String auditStatus;
+
+    /**
+     * 审核时间
+     */
+    private String auditTime;
+
+    /**
+     * 审核信息
+     */
+    private String auditNote;
+    /**
+     * 是否可用 1可用
+     */
+    private String validFlag;
+
+    /**
+     * 创建时间
+     */
+    private String addTime;
+    /**
+     * 创客经理Id
+     */
+    private Integer mainServiceProviderId;
 }

+ 58 - 0
src/main/java/com/caimei365/user/model/vo/AdvertiseVo.java

@@ -0,0 +1,58 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 今日推荐商品
+ *
+ * @author : Aslee
+ * @date : 2020/9/1
+ */
+
+@Data
+public class AdvertiseVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键 advertiseID
+     */
+    private Integer advertiseId;
+    /**
+     * 首页栏位ID:6机构个人中心推荐栏位
+     */
+    private Integer typeId;
+    /**
+     * 广告位种类ID:1001推荐商品,1002推荐公司
+     */
+    private Integer advertiseTypeId;
+    /**
+     * 关联广告位ID
+     */
+    private Integer associationId;
+    /**
+     * 广告位图片URL
+     */
+    private String image;
+    /**
+     * 广告位链接
+     */
+    private String link;
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+    /**
+     * 可用标志:1可用,0不可用
+     */
+    private String validFlag;
+    /**
+     * 广告标题
+     */
+    private String title;
+    /**
+     * 备注
+     */
+    private String comment;
+
+}

+ 78 - 0
src/main/java/com/caimei365/user/model/vo/AfterSaleVo.java

@@ -0,0 +1,78 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 售后无忧,购物须知
+ *
+ * @author : Charles
+ * @date : 2021/10/20
+ */
+@Data
+public class AfterSaleVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Integer id;
+
+    /**
+     * 组织名称
+     */
+    private String organizeName;
+
+    /**
+     * 组织联系人
+     */
+    private String organizeLinkName;
+
+    /**
+     * 手机号码
+     */
+    private String mobile;
+
+    /**
+     * 联系我们,手机或者座机号码
+     */
+    private String contactNumber;
+
+    /**
+     * 后台系统名称
+     */
+    private String systemName;
+
+    /**
+     * 后台系统图标
+     */
+    private String systemImage;
+
+    /**
+     * 关于我们:组织介绍信息
+     */
+    private String introduction;
+
+    /**
+     * 售后无忧
+     */
+    private String afterSale;
+
+    /**
+     * 购物须知
+     */
+    private String shoppingNotes;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 添加时间
+     */
+    private Date addTime;
+
+    /**
+     *  0 有效  其它无效
+     */
+    private String delFlag;
+}

+ 72 - 0
src/main/java/com/caimei365/user/model/vo/BalanceRecordVo.java

@@ -0,0 +1,72 @@
+package com.caimei365.user.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Data
+public class BalanceRecordVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Integer id;
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+    /**
+     * 收支类型:1收入,2支出
+     */
+    private String type;
+    /**
+     * 余额类型:1余额抵扣,2多收退款到余额,3申请退款,4余额充值,5余额提现,6订金订单充值,7余额订单充值,8订金订单退款,9余额订单退款
+     */
+    private String balanceType;
+    /**
+     * 添加时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date addDate;
+    /**
+     * 金额
+     */
+    private Double amount;
+    /**
+     * 主订单ID(适用余额类型1,3[类型为3多次退款存在相同记录ID则需通过退款ID唯一区分])
+     */
+    private Integer orderId;
+    /**
+     * 收款ID(适用余额类型2)
+     */
+    private Integer receiptId;
+    /**
+     * 退货退款ID(适用余额类型3)
+     */
+    private Integer returnedId;
+    /**
+     * 用户提现ID对应表(cm_user_balance_withdrawals)
+     */
+    private Integer withdrawalsId;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 删除标记 0 否,其余是
+     */
+    private String delFlag;
+    /**
+     * 开始时间
+     */
+    private String startTime;
+    /**
+     * 结束时间
+     */
+    private String endTime;
+}

+ 31 - 0
src/main/java/com/caimei365/user/model/vo/HelpPageVo.java

@@ -0,0 +1,31 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author Administrator
+ */
+@Data
+public class HelpPageVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer helpPageId;
+
+    private Integer helpPageTypeId;
+
+    private String title;
+
+    private String content;
+
+    private String contentTxt;
+
+    private String linkName;
+
+    private Integer sortIndex;
+
+    private String validFlag;
+
+    private String showFlag;
+}

+ 64 - 0
src/main/java/com/caimei365/user/model/vo/InformationVo.java

@@ -0,0 +1,64 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 最新动态信息
+ *
+ * @author : Aslee
+ * @date : 2020/9/1
+ */
+@Data
+public class InformationVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键 informationID
+     */
+    private Integer informationId;
+    /**
+     * 信息类型
+     */
+    private Integer infoTypeId;
+    /**
+     * 标签
+     */
+    private String tag;
+    /**
+     * 信息标题
+     */
+    private String title;
+    /**
+     * 信息链接
+     */
+    private String link;
+    /**
+     * html内容
+     */
+    private String content;
+    /**
+     * 文本内容
+     */
+    private String contentTxt;
+    /**
+     * 可用标志
+     */
+    private String validFlag;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+    /**
+     * 作者
+     */
+    private String author;
+    /**
+     * 图片路径
+     */
+    private String imgUrl;
+    /**
+     * 未知
+     */
+    private Long areaValue;
+}

+ 39 - 39
src/main/java/com/caimei365/user/model/vo/OrderCountVo.java

@@ -1,39 +1,39 @@
-package com.caimei365.user.model.vo;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * Description
- *
- * @author : Charles
- * @date : 2021/3/31
- */
-@Data
-public class OrderCountVo implements Serializable {
-    /**
-     * 待确认数量
-     */
-    private Integer orderCount;
-    /**
-     * 待确认数量
-     */
-    private Integer confirmedCount;
-    /**
-     * 待付款数量
-     */
-    private Integer paymentCount;
-    /**
-     * 待发货数量
-     */
-    private Integer waitShipmentsCount;
-    /**
-     * 已发货数量
-     */
-    private Integer shipmentsCount;
-    /**
-     * 退货款数量
-     */
-    private Integer salesReturnCount;
-}
+//package com.caimei365.user.model.vo;
+//
+//import lombok.Data;
+//
+//import java.io.Serializable;
+//
+///**
+// * Description
+// *
+// * @author : Charles
+// * @date : 2021/3/31
+// */
+//@Data
+//public class OrderCountVo implements Serializable {
+//    /**
+//     * 待确认数量
+//     */
+//    private Integer orderCount;
+//    /**
+//     * 待确认数量
+//     */
+//    private Integer confirmedCount;
+//    /**
+//     * 待付款数量
+//     */
+//    private Integer paymentCount;
+//    /**
+//     * 待发货数量
+//     */
+//    private Integer waitShipmentsCount;
+//    /**
+//     * 已发货数量
+//     */
+//    private Integer shipmentsCount;
+//    /**
+//     * 退货款数量
+//     */
+//    private Integer salesReturnCount;
+//}

+ 28 - 0
src/main/java/com/caimei365/user/model/vo/ShopBannerVo.java

@@ -0,0 +1,28 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Data
+public class ShopBannerVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private Integer shopId;
+
+    private String title;
+
+    private String link;
+
+    private String info;
+
+    private String image;
+}

+ 89 - 0
src/main/java/com/caimei365/user/model/vo/ShopHomeVo.java

@@ -0,0 +1,89 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Data
+public class ShopHomeVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 对应的userId
+     */
+    private Integer userId;
+    /**
+     * 供应商名称
+     */
+    private String name;
+    /**
+     * 供应商公司简称
+     */
+    private String abbr;
+    /**
+     * 公司LOGO
+     */
+    private String logo;
+    /**
+     * 所在地区
+     */
+    private String address;
+    /**
+     * 经营范围
+     */
+    private String businessScope;
+    private String[] businessScopeArr;
+    /**
+     * 营业执照
+     */
+    private String businessLicense;
+    /**
+     * 税务登记证
+     */
+    private String taxCertificate;
+    /**
+     * 供应商授权采美代理证书
+     */
+    private String certificate;
+    /**
+     * 介绍
+     */
+    private String info;
+    /**
+     * 主打产品说明
+     */
+    private String productDesc;
+    /**
+     * 网站
+     */
+    private String site;
+    /**
+     * 上架商品数量
+     */
+    private Integer normalNum;
+    /**
+     * 公司资质照片1
+     */
+    private String medicalPracticeLicenseImg1;
+    /**
+     * 公司资质照片2
+     */
+    private String medicalPracticeLicenseImg2;
+    /**
+     * 公司资质照片3
+     */
+    private String medicalPracticeLicenseImg3;
+    /**
+     * 授权牌照
+     */
+    private String authorizationCertificateImage;
+}

+ 0 - 1
src/main/java/com/caimei365/user/model/vo/ShopVo.java

@@ -103,7 +103,6 @@ public class ShopVo implements Serializable {
      * 省市区地址
      */
     private String provincialAddress;
-
     /**
      * 荣誉证书
      */

+ 6 - 0
src/main/java/com/caimei365/user/service/ClubService.java

@@ -129,4 +129,10 @@ public interface ClubService {
      * @return
      */
     ResponseJson deleteClubRemarks(Integer remarksId);
+
+    /**
+     * 机构个人中心数据
+     * @param userId 用户Id
+     */
+    ResponseJson<Map<String, Object>> getPersonalData(Integer userId);
 }

+ 13 - 0
src/main/java/com/caimei365/user/service/SellerService.java

@@ -2,6 +2,7 @@ package com.caimei365.user.service;
 
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.UserLoginVo;
@@ -60,4 +61,16 @@ public interface SellerService {
      * @return
      */
     ResponseJson<String> deleteTemporaryClub(Integer id);
+
+    /**
+     * 所有的机构列表
+     * @param searchWord 搜索关键字
+     */
+    ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord, int pageNum, int pageSize);
+
+    /**
+     * 协销个人中心
+     * @param userId 协销用户id
+     */
+    ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
 }

+ 42 - 1
src/main/java/com/caimei365/user/service/ShopService.java

@@ -2,8 +2,12 @@ package com.caimei365.user.service;
 
 
 import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ShopBannerDto;
 import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.vo.ShopBannerVo;
+import com.caimei365.user.model.vo.ShopHomeVo;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -60,5 +64,42 @@ public interface ShopService {
      * @param productCertification      产品证书
      * @return ClubUpdateDto
      */
-    ResponseJson updateShopUserInfo(ShopUpdateDto shopUpdateDto, String operationLicence, String hygienicLicense, String taxLicense, String honorCertification, String productCertification);
+    ResponseJson<Void> updateShopUserInfo(ShopUpdateDto shopUpdateDto, String operationLicence, String hygienicLicense, String taxLicense, String honorCertification, String productCertification);
+
+    /**
+     * 供应商首页数据
+     * @param shopId 供应商Id
+     */
+    ResponseJson<ShopHomeVo> getShopHomeData(Integer shopId);
+
+    /**
+     * 供应商首页-轮播图片
+     * @param shopId 供应商Id
+     */
+    ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId);
+
+    /**
+     * 供应商个人中心数据
+     * @param userId 用户Id
+     */
+    ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId);
+
+    /**
+     * 供应商-更新轮播图片
+     * @param shopBannerDto {
+     *                      id      图片id
+     *                      shopId  供应商Id
+     *                      image   图片
+     *                      title   名称
+     *                      link    链接
+     *                      info    描述
+     * }
+     */
+    ResponseJson<Void> saveShopHomeImages(ShopBannerDto shopBannerDto);
+
+    /**
+     * 供应商-删除轮播图片
+     * @param id  图片id
+     */
+    ResponseJson<Void> deleteShopHomeImages(Integer id);
 }

+ 50 - 0
src/main/java/com/caimei365/user/service/UserCenterService.java

@@ -0,0 +1,50 @@
+package com.caimei365.user.service;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.vo.HelpPageVo;
+import com.caimei365.user.model.vo.PaginationVo;
+
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+public interface UserCenterService {
+    /**
+     * 查看帮助页信息(注册协议)
+     * @param helpPageId 帮助页Id
+     */
+    ResponseJson<HelpPageVo> getUserProtocol(Integer helpPageId);
+    /**
+     * 保存用户头像
+     * @param userId 用户id
+     * @param image  头像图片
+     */
+    ResponseJson<Void> saveUserAvatar(Integer userId, String image);
+    /**
+     * 我的站内消息
+     * @param userId 用户Id
+     */
+    ResponseJson<PaginationVo<Map<String, Object>>> getMessageList(Integer userId, int pageNum, int pageSize);
+    /**
+     * 站内消息-标为已读
+     * @param messageIds 站内消息Id集合
+     */
+    ResponseJson<Void> markMessageAsRead(String messageIds);
+    /**
+     * 站内消息-删除
+     * @param messageIds 站内消息Id集合
+     */
+    ResponseJson<Void> deleteMessages(String messageIds);
+    /**
+     * 我的账户余额明细
+     * @param userId  用户Id
+     * @param type    收支类型:1收入,2支出
+     * @param year    年
+     * @param month   月
+     */
+    ResponseJson<Map<String, Object>> getBalanceRecord(Integer userId, String type, Integer year, Integer month, int pageNum, int pageSize);
+}

+ 127 - 13
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClientBuilder;
+import com.caimei365.user.components.RedisService;
 import com.caimei365.user.mapper.BaseMapper;
 import com.caimei365.user.mapper.ClubMapper;
 import com.caimei365.user.mapper.RegisterMapper;
@@ -20,12 +21,14 @@ import com.caimei365.user.model.po.UserBeansHistoryPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ClubService;
+import com.caimei365.user.utils.ImageUtils;
 import com.caimei365.user.utils.OssUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -44,7 +47,8 @@ import static com.alibaba.fastjson.JSON.parseObject;
 @Slf4j
 @Service
 public class ClubServiceImpl implements ClubService {
-
+    @Value("${caimei.wwwDomain}")
+    private String wwwDomain;
     @Resource
     private ClubMapper clubMapper;
     @Resource
@@ -53,6 +57,8 @@ public class ClubServiceImpl implements ClubService {
     private RegisterMapper registerMapper;
     @Resource
     private SuperVipMapper vipMapper;
+    @Resource
+    private RedisService redisService;
 
     /**
      * 根据用户Id查询机构资料
@@ -234,20 +240,20 @@ public class ClubServiceImpl implements ClubService {
         if (club == null) {
             return ResponseJson.error("机构信息不存在", null);
         }
-        Map<String, Object> map = new HashMap<>(10);
+        Map<String, Object> map = new HashMap<>(6);
         map.put("user", user);
         map.put("club", club);
-        OrderCountVo countVo = clubMapper.getOrderCount(userId);
-        //待确认数量
-        map.put("confirmedCount", countVo != null ? countVo.getConfirmedCount() : 0);
-        //待付款数量
-        map.put("paymentCount", countVo != null ? countVo.getPaymentCount() : 0);
-        //待发货数量
-        map.put("waitShipmentsCount", countVo != null ? countVo.getWaitShipmentsCount() : 0);
-        //已发货数量
-        map.put("shipmentsCount", countVo != null ? countVo.getShipmentsCount() : 0);
-        //退货款数量
-        map.put("salesReturnCount", countVo != null ? countVo.getSalesReturnCount() : 0);
+//        OrderCountVo countVo = clubMapper.getOrderCount(userId);
+//        //待确认数量
+//        map.put("confirmedCount", countVo != null ? countVo.getConfirmedCount() : 0);
+//        //待付款数量
+//        map.put("paymentCount", countVo != null ? countVo.getPaymentCount() : 0);
+//        //待发货数量
+//        map.put("waitShipmentsCount", countVo != null ? countVo.getWaitShipmentsCount() : 0);
+//        //已发货数量
+//        map.put("shipmentsCount", countVo != null ? countVo.getShipmentsCount() : 0);
+//        //退货款数量
+//        map.put("salesReturnCount", countVo != null ? countVo.getSalesReturnCount() : 0);
         //联系电话
         String contactNumber = baseMapper.getAfterSalesPhone();
         map.put("contactNumber", contactNumber);
@@ -472,4 +478,112 @@ public class ClubServiceImpl implements ClubService {
         clubMapper.deleteRemarksFiles(remarksId);
         return ResponseJson.success("删除成功");
     }
+
+    /**
+     * 机构个人中心数据
+     *
+     * @param userId 用户Id
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> getPersonalData(Integer userId) {
+        Map<String, Object> result = new HashMap<>(8);
+        // 1.用户信息
+        UserVo user = baseMapper.getUserByUserId(userId);
+        if (user == null) {
+            return ResponseJson.error("用户信息不存在", null);
+        }
+        result.put("user", user);
+        // 2.机构信息
+        ClubVo club = clubMapper.getClubById(user.getClubId());
+        if (club == null) {
+            return ResponseJson.error("机构信息不存在", null);
+        }
+        result.put("club", club);
+        // 3.售后无忧,购物须知
+        AfterSaleVo afterSale = clubMapper.getAfterSale();
+        result.put("afterSale", afterSale);
+        // 4.资料完善度
+        boolean identityFlag = (null != user.getUserIdentity() && (user.getUserIdentity() == 4 || user.getUserIdentity() == 2));
+        if (!identityFlag) {
+            return ResponseJson.error("用户身份错误", null);
+        }
+        // 会员机构
+        boolean userFlag1 = (StringUtils.isNotBlank(club.getLinkMan()) && StringUtils.isNotBlank(user.getBindMobile()) && StringUtils.isNotBlank(club.getContractPhone()) && StringUtils.isNotBlank(club.getFax()) && StringUtils.isNotBlank(club.getProfile()) && StringUtils.isNotBlank(club.getName()) && StringUtils.isNotBlank(user.getEmail()) && StringUtils.isNotBlank(club.getShortName()) && club.getProvinceId() != null && club.getProvinceId() != 0 && club.getCityId() != null && club.getCityId() != 0 && club.getTownId() != null && club.getTownId() != 0 && StringUtils.isNotBlank(club.getAddress()) && StringUtils.isNotBlank(club.getSocialCreditCode()) && StringUtils.isNotBlank(club.getBusinessLicense()) && StringUtils.isNotBlank(club.getShopPhoto()) && null != club.getFirstClubType() && StringUtils.isNotBlank(club.getMainProduct()));
+        // 普通机构
+        boolean userFlag2 = (StringUtils.isNotBlank(club.getLinkMan()) && StringUtils.isNotBlank(user.getBindMobile()) && StringUtils.isNotBlank(club.getContractPhone()) && StringUtils.isNotBlank(club.getFax()) && StringUtils.isNotBlank(club.getProfile()));
+        boolean degreeFlag = (user.getUserIdentity() == 4 && userFlag1) || (user.getUserIdentity() == 2 && userFlag2);
+        if (degreeFlag) {
+            result.put("degree", "100%");
+        } else {
+            result.put("degree", "80%");
+        }
+        // 5.未读消息数量
+        Integer unReadMessageCount = clubMapper.getUnReadMessageCount(userId);
+        result.put("unReadMessageCount", unReadMessageCount);
+        // 6.优惠券可用数量
+        Integer couponNum = clubMapper.getUserCouponCount(userId);
+        result.put("couponNum", couponNum);
+        // 7.今日推荐
+        int floorId = 6;
+        int index = 1;
+        String homeAdvertiseKey = "user_advertise_" + floorId;
+        if (!redisService.exists(homeAdvertiseKey)) {
+            AdvertiseVo homePageAdvertise = new AdvertiseVo();
+            homePageAdvertise.setAdvertiseTypeId(1001);
+            homePageAdvertise.setTypeId(floorId);
+            homePageAdvertise.setValidFlag("1");
+            List<AdvertiseVo> list = clubMapper.getUserAdvertiseList(homePageAdvertise);
+            for (AdvertiseVo advertise : list) {
+                advertise.setImage(ImageUtils.getImageURL("homePageImages", advertise.getImage(), 0, wwwDomain));
+            }
+            redisService.setList(homeAdvertiseKey, list);
+        }
+        int pageSize = 4;
+        int totalRecord = (int) redisService.listSize(homeAdvertiseKey);
+        int total = totalRecord % pageSize == 0 ? totalRecord / pageSize : totalRecord / pageSize + 1;
+        if (index > total) {
+            index = index % total;
+        }
+        int begin = (index - 1) * pageSize;
+        int end = index * pageSize - 1;
+        //避免unchecked cast warning
+        List<AdvertiseVo> list = new ArrayList<>();
+        Object advertiseObj = redisService.getList(homeAdvertiseKey, begin, end);
+        if (advertiseObj instanceof ArrayList<?>) {
+            for (Object o : (List<?>) advertiseObj) {
+                list.add((AdvertiseVo) o);
+            }
+        }
+        result.put("homePageAdvertiseList", list);
+        // 8.最新动态
+        String informationKey = "home_info_" + floorId;
+        redisService.remove(informationKey);
+        if (!redisService.exists(informationKey)) {
+            InformationVo info = new InformationVo();
+            info.setInfoTypeId(1);
+            info.setValidFlag("1");
+            List<InformationVo> infoList = clubMapper.getInformationList(info);
+            infoList.forEach(information -> information.setLink("/info/detail-" + information.getInformationId() + "-1.html"));
+            redisService.setList(informationKey, infoList);
+        }
+        int infoIndex = 1;
+        int infoPageSize = 5;
+        int totalInfoRecord = (int) redisService.listSize(informationKey);
+        int totalInfo = totalInfoRecord % infoPageSize == 0 ? totalInfoRecord / infoPageSize : totalInfoRecord / infoPageSize + 1;
+        if (infoIndex > totalInfo) {
+            infoIndex = infoIndex % totalInfo;
+        }
+        int infoBegin = (infoIndex - 1) * infoPageSize;
+        int infoEnd = infoIndex * infoPageSize - 1;
+        List<InformationVo> infoList = new ArrayList<>();
+        Object infoObj = redisService.getList(informationKey, infoBegin, infoEnd);
+        if (infoObj instanceof ArrayList<?>) {
+            for (Object o : (List<?>) infoObj) {
+                infoList.add((InformationVo) o);
+            }
+        }
+        result.put("homePageInfoList", infoList);
+
+        return ResponseJson.success(result);
+    }
 }

+ 3 - 0
src/main/java/com/caimei365/user/service/impl/OperationServiceImpl.java

@@ -112,6 +112,9 @@ public class OperationServiceImpl implements OperationService {
     @Override
     public ResponseJson updateInvitationCode(OperationDto operationDto) {
         OperationPo operation = operationMapper.getOperationCodeInfoById(operationDto.getId());
+        if (null == operation){
+            return ResponseJson.error("运营人员数据异常!");
+        }
         int flag = 0;
         if (operation.getStatus() == 2) {
             return ResponseJson.error("该邀请码已绑定");

+ 32 - 0
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -6,6 +6,7 @@ import com.caimei365.user.mapper.SellerMapper;
 import com.caimei365.user.mapper.SuperVipMapper;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
@@ -20,6 +21,7 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -133,4 +135,34 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success("");
     }
 
+    /**
+     * 所有的机构列表
+     *
+     * @param searchWord 搜索关键字
+     * @param pageNum
+     * @param pageSize
+     */
+    @Override
+    public ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ClubVo> clubList = sellerMapper.getAllClubList(searchWord);
+        PageInfo<ClubVo> pageData = new PageInfo<>(clubList);
+        return ResponseJson.success(pageData);
+    }
+
+    /**
+     * 协销个人中心
+     *
+     * @param userId 协销用户id
+     */
+    @Override
+    public ResponseJson<ServiceProviderPo> getSellerHome(Integer userId) {
+        // 协销用户
+        ServiceProviderPo seller = sellerMapper.getSellerByUserId(userId);
+        if (null == seller) {
+            return ResponseJson.error("未查询到此协销人员!", null);
+        }
+        return ResponseJson.success(seller);
+    }
+
 }

+ 190 - 2
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -2,15 +2,21 @@ package com.caimei365.user.service.impl;
 
 import com.caimei365.user.components.RedisService;
 import com.caimei365.user.mapper.BaseMapper;
+import com.caimei365.user.mapper.PersonalCenterMapper;
 import com.caimei365.user.mapper.ShopMapper;
 import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ShopBannerDto;
 import com.caimei365.user.model.dto.ShopUpdateDto;
 import com.caimei365.user.model.po.ShopCertPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ShopService;
+import com.caimei365.user.utils.DateUtil;
+import com.caimei365.user.utils.ImageUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -25,13 +31,16 @@ import java.util.*;
 @Slf4j
 @Service
 public class ShopServiceImpl implements ShopService {
-
+    @Value("${caimei.wwwDomain}")
+    private String wwwDomain;
     @Resource
     private RedisService redisService;
     @Resource
     private BaseMapper baseMapper;
     @Resource
     private ShopMapper shopMapper;
+    @Resource
+    private PersonalCenterMapper personalCenterMapper;
 
 
     /**
@@ -139,7 +148,7 @@ public class ShopServiceImpl implements ShopService {
      * @return ClubUpdateDto
      */
     @Override
-    public ResponseJson updateShopUserInfo(ShopUpdateDto shopUpdateDto, String operationLicence, String hygienicLicense, String taxLicense, String honorCertification, String productCertification) {
+    public ResponseJson<Void> updateShopUserInfo(ShopUpdateDto shopUpdateDto, String operationLicence, String hygienicLicense, String taxLicense, String honorCertification, String productCertification) {
         // 参数校验
         if (null == shopUpdateDto.getUserId()) {
             return ResponseJson.error("参数异常:用户Id不能为空!");
@@ -212,4 +221,183 @@ public class ShopServiceImpl implements ShopService {
         }
         return ResponseJson.success("修改供应商资料成功", null);
     }
+
+    /**
+     * 供应商首页数据
+     *
+     * @param shopId 供应商Id
+     */
+    @Override
+    public ResponseJson<ShopHomeVo> getShopHomeData(Integer shopId) {
+        ShopHomeVo supplier = shopMapper.getShopHomeData(shopId);
+        if (supplier != null && supplier.getBusinessScope() != null) {
+            String[] businessScope = supplier.getBusinessScope().split("/");
+            supplier.setBusinessScopeArr(businessScope);
+            supplier.setLogo(ImageUtils.getImageURL("shopLogo", supplier.getLogo(), 0, wwwDomain));
+        }
+        //公司资质照片
+        List<String> productionLicence = shopMapper.getShopCertById(shopId, 2);
+        if (null != productionLicence && productionLicence.size() > 0) {
+            supplier.setMedicalPracticeLicenseImg1(productionLicence.get(0));
+        }
+        List<String> hygienicLicense = shopMapper.getShopCertById(shopId, 5);
+        if (null != hygienicLicense && hygienicLicense.size() > 0) {
+            supplier.setMedicalPracticeLicenseImg2(hygienicLicense.get(0));
+        }
+        List<String> taxLicense = shopMapper.getShopCertById(shopId, 6);
+        if (null != taxLicense && taxLicense.size() > 0) {
+            supplier.setMedicalPracticeLicenseImg3(taxLicense.get(0));
+        }
+        return ResponseJson.success(supplier);
+    }
+
+    /**
+     * 供应商首页-轮播图片
+     *
+     * @param shopId 供应商Id
+     */
+    @Override
+    public ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId) {
+        List<ShopBannerVo> images = shopMapper.getShopHomeImages(shopId);
+        return ResponseJson.success(images);
+    }
+
+    /**
+     * 供应商-更新轮播图片
+     *
+     * @param shopBannerDto {
+     *                      id      图片id
+     *                      shopId  供应商Id
+     *                      image   图片
+     *                      title   名称
+     *                      link    链接
+     *                      info    描述
+     *                      }
+     */
+    @Override
+    public ResponseJson<Void> saveShopHomeImages(ShopBannerDto shopBannerDto) {
+        ShopBannerVo shopBanner = new ShopBannerVo();
+        BeanUtils.copyProperties(shopBannerDto, shopBanner);
+        if (null != shopBannerDto.getId()){
+            // 更新
+            shopBanner.setId(shopBannerDto.getId());
+            shopMapper.updateShopHomeImage(shopBanner);
+        } else {
+            // 新增
+            int count = shopMapper.getShopHomeImageCount(shopBannerDto.getShopId());
+            if (count >= 4) {
+                return ResponseJson.error("主页广告图的上限是4张图!", null);
+            }
+            shopMapper.insertShopHomeImage(shopBanner);
+        }
+        return ResponseJson.success(null);
+    }
+
+    /**
+     * 供应商-删除轮播图片
+     *
+     * @param id  图片id
+     */
+    @Override
+    public ResponseJson<Void> deleteShopHomeImages(Integer id) {
+        shopMapper.deleteShopHomeImage(id);
+        return ResponseJson.success(null);
+    }
+
+    /**
+     * 供应商个人中心数据
+     *
+     * @param userId 用户Id
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId) {
+        Map<String, Object> result = new HashMap<>(11);
+        // 1.用户信息
+        UserVo user = baseMapper.getUserByUserId(userId);
+        if (user == null) {
+            return ResponseJson.error("用户信息不存在", null);
+        }
+        result.put("user", user);
+        // 2.供应商信息
+        ShopVo shop = shopMapper.getShopById(user.getShopId());
+        if (shop == null) {
+            return ResponseJson.error("供应商信息不存在", null);
+        }
+        shop.setLogo(ImageUtils.getImageURL("shopLogo", shop.getLogo(), 0, wwwDomain));
+        result.put("shop", shop);
+        // 3.资料完整度
+        List<String> productCertification = shopMapper.getShopCertById(user.getShopId(), 3);
+        List<String> certificateHonor = shopMapper.getShopCertById(user.getShopId(), 1);
+        // 4.是否有荣誉证书与产品证书
+        boolean b = productCertification != null && productCertification.size() > 0 && certificateHonor != null && certificateHonor.size() > 0;
+        if (StringUtils.isNotBlank(user.getEmail()) && StringUtils.isNotBlank(shop.getLegalPerson()) && StringUtils.isNotBlank(shop.getShopDesc())
+                && StringUtils.isNotBlank(shop.getLogo()) && b) {
+            result.put("dataIntegrity", "100%");
+        } else if (StringUtils.isNotBlank(shop.getLegalPerson()) && StringUtils.isNotBlank(shop.getShopDesc()) && StringUtils.isNotBlank(shop.getLogo())) {
+            result.put("dataIntegrity", "90%");
+        } else {
+            result.put("dataIntegrity", "70%");
+        }
+        // 5.店铺促销活动
+        PromotionsVo promotions = shopMapper.getShopPromotionsByShopId(user.getShopId());
+        if (null != promotions && 3 == promotions.getMode()) {
+            List<ProductItemVo> productGifts = shopMapper.getPromotionsGifts(promotions.getId());
+            productGifts.forEach(p -> {
+                p.setImage(ImageUtils.getImageURL("product", p.getImage(), 0, wwwDomain));
+            });
+            promotions.setGiftList(productGifts);
+        }
+        result.put("promotions", promotions);
+        // 6.未读消息数量
+        Integer unReadMessageCount = personalCenterMapper.getUnReadMessageCount(userId);
+        result.put("unReadMessageCount", unReadMessageCount);
+        // 7.商品数量统计,validFlag 商品状态,见ProductStatus,0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结'
+        Integer allNum = shopMapper.getShopProductCount(user.getShopId(), null);
+        result.put("allNum", allNum);
+        // 8.已上架数量
+        Integer upNum = shopMapper.getShopProductCount(user.getShopId(), 2);
+        result.put("upNum", upNum);
+        // 9.已下架数量
+        Integer downNum = shopMapper.getShopProductCount(user.getShopId(), 3);
+        result.put("downNum", downNum);
+        // 10.单品销售排名
+        List<Map<String, Object>> salesRankingList = shopMapper.getSalesRankingList(user.getShopId());
+        if (salesRankingList != null && salesRankingList.size() > 0) {
+            salesRankingList.forEach(map -> {
+                ProductItemVo product = shopMapper.getProductShown((Integer) map.get("productId"));
+                if (product != null) {
+                    map.put("name", product.getName());
+                    map.put("image", ImageUtils.getImageURL("product", product.getImage(), 0, wwwDomain));
+                }
+            });
+        }
+        result.put("salesRankingList", salesRankingList);
+        // 11.销售情况统计
+        List<Map<String, Object>> salesStatisticsList = new ArrayList<>();
+        Date endDayOfDay = DateUtil.getDayEnd();
+        // 近一个月销售情况统计
+        Date beginDayOfYesterday = DateUtil.addMonth(endDayOfDay, -1);
+        Map<String, Object> m1 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfYesterday), DateUtil.formatDateTime(endDayOfDay));
+        m1.put("time", "近一月");
+        salesStatisticsList.add(m1);
+        // 近三个月销售情况统计
+        Date beginDayOfLastWeek = DateUtil.addMonth(endDayOfDay, -3);
+        Map<String, Object> m2 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfLastWeek), DateUtil.formatDateTime(endDayOfDay));
+        m2.put("time", "近三月");
+        salesStatisticsList.add(m2);
+        // 近半年销售情况统计
+        Date beginDayOfLastMonth = DateUtil.addMonth(endDayOfDay, -6);
+        Map<String, Object> m3 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfLastMonth), DateUtil.formatDateTime(endDayOfDay));
+        m3.put("time", "近半年");
+        salesStatisticsList.add(m3);
+        // 近一年销售情况统计
+        Date beginDayOfLastYear = DateUtil.addMonth(endDayOfDay, -12);
+        Map<String, Object> m4 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfLastYear), DateUtil.formatDateTime(endDayOfDay));
+        m4.put("time", "近一年");
+        salesStatisticsList.add(m4);
+        result.put("salesStatisticsList", salesStatisticsList);
+
+        return ResponseJson.success(result);
+    }
+
 }

+ 137 - 0
src/main/java/com/caimei365/user/service/impl/UserCenterServiceImpl.java

@@ -0,0 +1,137 @@
+package com.caimei365.user.service.impl;
+
+import com.caimei365.user.mapper.UserCenterMapper;
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.vo.BalanceRecordVo;
+import com.caimei365.user.model.vo.HelpPageVo;
+import com.caimei365.user.model.vo.PaginationVo;
+import com.caimei365.user.service.UserCenterService;
+import com.github.pagehelper.PageHelper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/10/22
+ */
+@Slf4j
+@Service
+public class UserCenterServiceImpl implements UserCenterService {
+    @Resource
+    private UserCenterMapper userCenterMapper;
+
+    /**
+     * 查看帮助页信息(注册协议)
+     *
+     * @param helpPageId 帮助页Id
+     */
+    @Override
+    public ResponseJson<HelpPageVo> getUserProtocol(Integer helpPageId) {
+        HelpPageVo helpPage = userCenterMapper.getUserProtocol(helpPageId);
+        return ResponseJson.success(helpPage);
+    }
+
+    /**
+     * 保存用户头像
+     *
+     * @param userId 用户id
+     * @param image  头像图片
+     */
+    @Override
+    public ResponseJson<Void> saveUserAvatar(Integer userId, String image) {
+        userCenterMapper.saveUserAvatar(userId, image);
+        return ResponseJson.success(null);
+    }
+
+    /**
+     * 我的站内消息
+     *
+     * @param userId   用户Id
+     */
+    @Override
+    public ResponseJson<PaginationVo<Map<String, Object>>> getMessageList(Integer userId, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<Map<String, Object>> messageList = userCenterMapper.getMessageList(userId);
+        PaginationVo<Map<String, Object>> pageData = new PaginationVo<>(messageList);
+        return ResponseJson.success(pageData);
+    }
+
+    /**
+     * 站内消息-标为已读
+     *
+     * @param messageIds 站内消息Id集合
+     */
+    @Override
+    public ResponseJson<Void> markMessageAsRead(String messageIds) {
+        String[] split = messageIds.split(",");
+        for (String messageId : split) {
+            if (StringUtils.isNotBlank(messageId)) {
+                userCenterMapper.updateMessageAsRead(messageId);
+            }
+        }
+        return ResponseJson.success(null);
+    }
+
+    /**
+     * 站内消息-删除
+     *
+     * @param messageIds 站内消息Id集合
+     */
+    @Override
+    public ResponseJson<Void> deleteMessages(String messageIds) {
+        String[] split = messageIds.split(",");
+        for (String messageId : split) {
+            if (StringUtils.isNotBlank(messageId)) {
+                userCenterMapper.deleteMessage(messageId);
+            }
+        }
+        return ResponseJson.success(null);
+    }
+
+    /**
+     * 我的账户余额明细
+     *
+     * @param userId   用户Id
+     * @param type     收支类型:1收入,2支出
+     * @param year     年
+     * @param month    月
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> getBalanceRecord(Integer userId, String type, Integer year, Integer month, int pageNum, int pageSize) {
+        BalanceRecordVo balanceRecord = new BalanceRecordVo();
+        balanceRecord.setUserId(userId);
+        balanceRecord.setType(type);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.YEAR, year);
+        calendar.set(Calendar.MONTH, month - 1);
+        calendar.set(Calendar.DAY_OF_MONTH, calendar.getMinimum(Calendar.DATE));
+        String startTime = format.format(calendar.getTime()) + " 00:00:00";
+        balanceRecord.setStartTime(startTime);
+        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DATE));
+        String endTime = format.format(calendar.getTime()) + " 23:59:59";
+        balanceRecord.setEndTime(endTime);
+        PageHelper.startPage(pageNum, pageSize);
+        List<BalanceRecordVo> balanceRecordList = userCenterMapper.getBalanceRecord(balanceRecord);
+        PaginationVo<BalanceRecordVo> pageDate = new PaginationVo<>(balanceRecordList);
+        Double ableUserMoney = userCenterMapper.getAbleUserMoney(userId);
+        Map<String, Object> map = new HashMap<>();
+        if (null != ableUserMoney && ableUserMoney > 0d) {
+            map.put("ableUserMoney", String.format("%.2f", ableUserMoney));
+        } else {
+            map.put("ableUserMoney", "0.00");
+        }
+        map.put("pageDate", pageDate);
+        return ResponseJson.success(map);
+    }
+}

+ 108 - 14
src/main/java/com/caimei365/user/utils/DateUtil.java

@@ -4,14 +4,20 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
 
+/**
+ * @author Administrator
+ */
 public class DateUtil {
-    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
     private static Calendar calendar = Calendar.getInstance();
 
-    /*
-    输入日期字符串比如201703,返回当月第一天的Date
-    */
+    /**
+     * 输入日期字符串比如201703,返回当月第一天的Date
+     * @param month
+     * @return
+     */
     public static Date getMinDay(String month) {
         try {
             Date nowDate = sdf.parse(month);
@@ -25,9 +31,11 @@ public class DateUtil {
         return null;
     }
 
-    /*
-    输入日期字符串,返回下个月1号0点
-    */
+    /**
+     * 输入日期字符串,返回下个月1号0点
+     * @param month
+     * @return
+     */
     public static Date getMaxDay(String month) {
         try {
             Date nowDate = sdf.parse(month);
@@ -44,25 +52,111 @@ public class DateUtil {
 
     /**
      * 返回现在时间yyyy-mm格式
-     *
      * @return
      */
     public static String getNowMonth() {
-        Date date = new Date();
-        String format = new SimpleDateFormat("yyyy-MM").format(date);
-        return format;
+        return new SimpleDateFormat("yyyy-MM").format(new Date());
     }
 
-
     /**
      * 获取现在时间的00:00
+     */
+    public static Date getNowZeroTime() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        return cal.getTime();
+    }
+    /**
+     * 判断当前时间在时间区间内
+     *
+     * @param nowTime   当前时间
+     * @param startTime 开始时间
+     * @param endTime   结束时间
+     * @return
+     */
+    public static boolean isEffectiveDate(Date nowTime, Date startTime, Date endTime) {
+        if (nowTime.getTime() == startTime.getTime()
+                || nowTime.getTime() == endTime.getTime()) {
+            return true;
+        }
+        Calendar date = Calendar.getInstance();
+        date.setTime(nowTime);
+        Calendar begin = Calendar.getInstance();
+        begin.setTime(startTime);
+        Calendar end = Calendar.getInstance();
+        end.setTime(endTime);
+        if (date.after(begin) && date.before(end)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 获取当天的结束时间
+     */
+    public static Date getDayEnd() {
+        Calendar cal = new GregorianCalendar();
+        cal.set(Calendar.HOUR_OF_DAY, 23);
+        cal.set(Calendar.MINUTE, 59);
+        cal.set(Calendar.SECOND, 59);
+        return cal.getTime();
+    }
+
+    /**
+     * 在日期上增加数个整月
      *
+     * @param date 日期
+     * @param n    要增加的月数
      * @return
      */
-    public static Date getNowTime() {
+    public static Date addMonth(Date date, int n) {
         Calendar cal = Calendar.getInstance();
-        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.setTime(date);
+        cal.add(Calendar.MONTH, n);
         return cal.getTime();
     }
 
+    /**
+     * 得到日期时间字符串,转换格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public static String formatDateTime(Date date) {
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
+    }
+
+    /**
+     * date2比date1多的天数
+     *
+     * @param date1
+     * @param date2
+     * @return
+     */
+    public static int differentDays(Date date1, Date date2) {
+        Calendar cal1 = Calendar.getInstance();
+        cal1.setTime(date1);
+        Calendar cal2 = Calendar.getInstance();
+        cal2.setTime(date2);
+        int day1 = cal1.get(Calendar.DAY_OF_YEAR);
+        int day2 = cal2.get(Calendar.DAY_OF_YEAR);
+        int year1 = cal1.get(Calendar.YEAR);
+        int year2 = cal2.get(Calendar.YEAR);
+        if (year1 != year2) {
+            //同一年
+            int timeDistance = 0;
+            for (int i = year1; i < year2; i++) {
+                if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
+                    //闰年
+                    timeDistance += 366;
+                } else {
+                    //不是闰年
+                    timeDistance += 365;
+                }
+            }
+            return timeDistance + (day2 - day1);
+        } else {
+            //不同年
+            System.out.println("判断day2 - day1 : " + (day2 - day1));
+            return day2 - day1;
+        }
+    }
 }

+ 115 - 0
src/main/java/com/caimei365/user/utils/ImageUtils.java

@@ -0,0 +1,115 @@
+package com.caimei365.user.utils;
+
+import org.springframework.util.StringUtils;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/16
+ */
+public class ImageUtils {
+
+	public static String getImageURL(String dirName, String src, String domain) {
+		return getImageURL(dirName, src, 0,domain);
+	}
+
+	/***
+	 * 获取图片地址
+	 *
+	 * @param src
+	 *            保存在数据库中的图片文件名
+	 * @param type
+	 *            图片的前缀 (如 type = 200 那么则获取的图片是 200_XXX的图片)
+	 * @param dirName
+	 *            图片保存的文件夹名 如 (league)
+	 * @param domain
+	 * 			   加上域名拼成完整路径
+	 * @return
+	 */
+	public static String getImageURL(String dirName, String src, int type, String domain) {
+
+
+		//正式环境 域名 http --- https处理
+		if (domain != null && !"".equals(domain) && domain.startsWith("http:") && domain.toLowerCase().lastIndexOf("config/beta")== -1 && domain.toLowerCase().lastIndexOf("localhost")== -1) {
+			domain = domain.replace("http:", "https:");
+		}
+
+		//正式环境 图片地址 http --- https处理
+		if(src != null && src.startsWith("https:")){
+			//非正式环境 使用http
+			if (domain !=null && !"".equals(domain) && domain.toLowerCase().lastIndexOf("config/beta")>-1 || domain.toLowerCase().lastIndexOf("localhost")>-1){
+				src = src.replace("https:","http:");
+			}
+			return src;
+		}
+
+		//正式环境 图片地址  http --- https处理
+		if(src != null && src.startsWith("http:")){
+			//非正式环境 使用http
+			if (domain !=null && !"".equals(domain) && domain.toLowerCase().lastIndexOf("config/beta")==-1 && domain.toLowerCase().lastIndexOf("localhost")==-1){
+				src = src.replace("http:","https:");
+			}
+			return src;
+		}
+		type = 0 ;
+		dirName = dirName.trim();
+		if (dirName == null) {dirName = "";}
+		if(src == null || src.equalsIgnoreCase("null")) {src = "";}
+		if (src.indexOf(",") > 0) {
+			String tmp = src;
+			src = tmp.substring(0, tmp.indexOf(","));
+		}
+		String image = "/img/default/none.jpg";
+		if (dirName.equals("user")) {
+			image = "/img/default/HeaderImg.png";
+		} else if (dirName.equals("club")) {
+			image = "/img/default/default_club.jpg";
+		} else if (dirName.equals("shopLogo")) {
+			image = "/img/default/suppliver.jpg";
+		}else if (dirName.equals("caiMeiImage")) {
+			image = "/img/default/caiMeiImage.jpg";
+		}else {
+			image = "/img/default/none.jpg";
+		}
+		if (src != null && !src.equals("")) {
+			if (type != 0 || dirName.equals("product")) {
+				src = src.replace("\\", "/");
+				String srcActual = src;
+				String subDirName = "";
+				int index = src.lastIndexOf("/");
+
+				if (index != -1) {
+					subDirName = src.substring(0, index + 1);
+					srcActual = src.substring(index + 1);
+				}
+				boolean b = src.startsWith("/uploadFile");
+				if(b){
+					image = src;
+				}else{
+					image = "/uploadFile/" + dirName + "/" + subDirName
+							+ (type == 0 ? "" : type + "_") + srcActual;
+				}
+			} else {
+				boolean b = src.startsWith("/uploadFile");
+				if(b){
+					image = src;
+				}else{
+					image = "/uploadFile/" + dirName + "/" + src;
+				}
+			}
+		}else {
+			if(StringUtils.isEmpty(image)) {
+				image = "/img/default/none.jpg";
+			}
+		}
+		return domain + image;
+	}
+
+	public static String getProductImageURL(String image, int type, String domain) {
+		if (image == null) {
+			return getImageURL("product", "", type, domain);
+		}
+		return getImageURL("product", image, type, domain);
+	}
+}

+ 57 - 12
src/main/resources/mapper/ClubMapper.xml

@@ -84,18 +84,18 @@
         from club
         where clubID = #{clubId}
     </select>
-    <select id="getOrderCount" resultType="com.caimei365.user.model.vo.OrderCountVo">
-        select userID as userId,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0') as orderCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status = '0') as confirmedCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,13,21,22,23)) as paymentCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,21,22,31,32)) as waitShipmentsCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(12,13,22,23,32,33)) as shipmentsCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(1,2)) as salesReturnCount
-        from cm_order
-        where  userID = #{userId} and delFlag = '0'
-        limit 1
-    </select>
+<!--    <select id="getOrderCount" resultType="com.caimei365.user.model.vo.OrderCountVo">-->
+<!--        select userID as userId,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0') as orderCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status = '0') as confirmedCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,13,21,22,23)) as paymentCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,21,22,31,32)) as waitShipmentsCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(12,13,22,23,32,33)) as shipmentsCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(1,2)) as salesReturnCount-->
+<!--        from cm_order-->
+<!--        where  userID = #{userId} and delFlag = '0'-->
+<!--        limit 1-->
+<!--    </select>-->
 
     <select id="findBeansHistoryByType" resultType="integer">
         SELECT id FROM user_beans_history WHERE userId = #{userId} AND beansType = #{beansType} AND delFlag = 0
@@ -219,4 +219,49 @@
         where remarksId = #{remarksId}
           and fileType = 2
     </select>
+    <select id="getAfterSale" resultType="com.caimei365.user.model.vo.AfterSaleVo">
+        SELECT id, organizeName, organizeLinkName, mobile, contactNumber, systemName, systemImage,
+               introduction, afterSale, shoppingNotes, updateTime, addTime, delFlag
+        FROM cm_mall_organize
+        WHERE id = 0 AND delFlag = '0'
+    </select>
+    <select id="getUnReadMessageCount" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM message WHERE toUserID = #{userId} AND readFlag='0'
+    </select>
+    <select id="getUserCouponCount" resultType="java.lang.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.status = 1 AND cc.status != 2
+        AND a.userId = #{userId}  AND NOW() BETWEEN cc.startDate AND cc.endDate
+    </select>
+    <select id="getUserAdvertiseList" resultType="com.caimei365.user.model.vo.AdvertiseVo">
+        SELECT image, link, title
+        FROM c_homepageadvertise
+        <where>
+            <if test="advertiseTypeId != null">
+                AND advertiseTypeID = #{advertiseTypeId}
+            </if>
+            <if test="typeId != null">
+                AND typeID = #{typeId}
+            </if>
+            <if test="validFlag != null">
+                AND validFlag = #{validFlag}
+            </if>
+        </where>
+        ORDER BY sortIndex DESC
+    </select>
+    <select id="getInformationList" resultType="com.caimei365.user.model.vo.InformationVo">
+        SELECT informationID AS informationId, title, link, addTime
+        FROM information
+        <where>
+            <if test="infoTypeId != null">
+                AND infoTypeID = #{infoTypeId}
+            </if>
+            <if test="validFlag != null">
+                AND validFlag = #{validFlag}
+            </if>
+        </where>
+        ORDER BY informationID DESC
+    </select>
 </mapper>

+ 7 - 0
src/main/resources/mapper/PersonalCenterMapper.xml

@@ -0,0 +1,7 @@
+<?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="com.caimei365.user.mapper.PersonalCenterMapper">
+    <select id="getUnReadMessageCount" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM message WHERE toUserID = #{userId} AND readFlag='0'
+    </select>
+</mapper>

+ 25 - 2
src/main/resources/mapper/SellerMapper.xml

@@ -102,8 +102,7 @@
     </select>
 
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
-        select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail1
-        as contractEmail,
+        select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail1 as contractEmail,
         c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
         c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
@@ -126,4 +125,28 @@
         </if>
         order by c.clubID desc
     </select>
+    <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
+        SELECT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail1 as contractEmail,
+        c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
+        c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
+        c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
+        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status,
+        u.userIdentity
+        FROM club c
+        LEFT JOIN user u ON c.userID=u.userID
+        WHERE u.userOrganizeID = 0 AND c.status = '90'
+        <if test="searchWord != null and searchWord != ''">
+            and (
+            c.name LIKE CONCAT('%',#{searchWord},'%') or
+            c.linkMan1 LIKE CONCAT('%',#{searchWord},'%') or
+            c.contractMobile1 LIKE CONCAT('%',#{searchWord},'%')
+            )
+        </if>
+    </select>
+    <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
+        select serviceProviderID AS serviceProviderId, status, userID AS userId, openid, unionId, name, contractMobile,
+               linkMan1, duty1, contractMobile1, auditStatus, auditTime, auditNote, validFlag, addTime,
+               mainServiceProviderID AS mainServiceProviderId
+        from serviceprovider where userID = #{userId}
+    </select>
 </mapper>

+ 123 - 0
src/main/resources/mapper/ShopMapper.xml

@@ -96,4 +96,127 @@
                businessScope, logo, addTime, status, contractPhone, validFlag, website, wxOfficialAccount, wxApplets
         from shop where shopID = #{shopId}
     </select>
+    <select id="getShopHomeData" resultType="com.caimei365.user.model.vo.ShopHomeVo">
+        select
+            s.shopID as id,
+            s.userID as userId,
+            s.name,
+            s.sname as abbr,
+            s.logo,
+            s.address,
+            s.businessScope,
+            s.businessLicenseImage as businessLicense,
+            s.taxCertificateImage as taxCertificate,
+            s.authorizationCertificateImage as certificate,
+            s.info,
+            s.productDesc,
+            s.site,
+            count(*) as normalNum
+        from shop s
+        where s.shopID = #{supplierId}
+        group by s.shopID
+    </select>
+    <select id="getShopCertById" resultType="java.lang.String">
+        SELECT image FROM shopcert WHERE shopID = #{shopId} AND shopCertTypeID = #{shopCertTypeId}
+    </select>
+    <select id="getShopHomeImages" resultType="com.caimei365.user.model.vo.ShopBannerVo">
+        select shopBannerID AS id, shopID AS shopId, image, link, title, info
+        from shopbanner where shopID = #{shopId}
+    </select>
+    <select id="getShopPromotionsByShopId" resultType="com.caimei365.user.model.vo.PromotionsVo">
+        select  pr.id,
+                pr.name,
+                pr.description,
+                pr.type,
+                pr.mode,
+                pr.touchPrice,
+                pr.reducedPrice,
+                pr.beginTime,
+                pr.endTime,
+                pr.status,
+                prp.productId,
+                prp.supplierId
+        from cm_promotions pr
+        left join cm_promotions_product prp on pr.id = prp.promotionsId
+        where prp.supplierId = #{shopId}
+          and (pr.status = 1 or ( pr.status = 2 and (NOW() between pr.beginTime and pr.endTime)))
+          and pr.type=3
+          and pr.delFlag not in (1,2)
+        order by pr.type desc
+        limit 1
+    </select>
+    <select id="getPromotionsGifts" resultType="com.caimei365.user.model.vo.ProductItemVo">
+        select
+            cpg.id as id,
+            p.productID as productId,
+            p.shopID as shopId,
+            p.`name` as `name`,
+            p.mainImage as image,
+            cpg.number as number,
+            0 as price,
+            2 as productType,
+            p.price1 as originalPrice,
+            p.unit as unit,
+            p.validFlag as validFlag,
+            p.stock as stock
+        from product p
+        left join cm_promotions_gift cpg on cpg.productId = p.productID
+        where cpg.promotionsId = #{promotionsId}
+        order by cpg.addTime desc
+    </select>
+    <select id="getShopProductCount" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM product
+        WHERE shopID = #{shopId}
+        <if test="validFlag != null">
+            AND validFlag = #{validFlag}
+        </if>
+    </select>
+    <select id="getSalesRankingList" resultType="java.util.Map">
+        SELECT cop.productID AS productId, SUM(cop.num) AS total
+        FROM cm_order_product cop JOIN cm_order co ON co.orderID = cop.orderID
+        WHERE cop.shopID = #{shopId}
+          AND co.STATUS NOT IN ('0', '6', '7')
+          AND co.delFlag = '0'
+          AND co.secondHandOrderFlag != '1'
+        GROUP BY productID
+        ORDER BY total DESC
+        LIMIT 5
+    </select>
+    <select id="getProductShown" resultType="com.caimei365.user.model.vo.ProductItemVo">
+        SELECT name, mainImage AS image
+        FROM product
+        WHERE  productId = #{productId}
+    </select>
+    <select id="getSalesStatistics" resultType="java.util.Map">
+        SELECT COUNT(DISTINCT so.shopOrderID) AS orderQuantity,
+        IFNULL(SUM(o.productTotalFee),0) AS orderAmount
+        FROM cm_order o
+        JOIN cm_shop_order so ON o.orderID = so.orderID
+        WHERE o.status NOT IN('0', '6', '7')
+        AND o.delFlag = '0'
+        AND so.delFlag = '0'
+        AND so.shopID = #{shopId}
+        AND o.secondHandOrderFlag != '1'
+        <if test="startTime != null and startTime != ''">
+            AND o.orderTime <![CDATA[  >=  ]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND o.orderTime <![CDATA[   <=  ]]> #{endTime}
+        </if>
+    </select>
+    <select id="getShopHomeImageCount" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM shopbanner WHERE shopID = #{shopId}
+    </select>
+    <insert id="insertShopHomeImage">
+        INSERT INTO shopbanner (shopID,title,link,info,image)
+        VALUES (#{shopId},#{title},#{link},#{info},#{image})
+    </insert>
+    <update id="updateShopHomeImage">
+        UPDATE shopbanner
+        SET title = #{title}, link = #{link}, info = #{info}, image = #{image}
+        WHERE shopBannerID = #{id}
+    </update>
+    <delete id="deleteShopHomeImage">
+        DELETE FROM shopbanner WHERE shopBannerID = #{id}
+    </delete>
 </mapper>

+ 64 - 0
src/main/resources/mapper/UserCenterMapper.xml

@@ -0,0 +1,64 @@
+<?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="com.caimei365.user.mapper.UserCenterMapper">
+    <update id="saveUserAvatar">
+        UPDATE user SET image = #{image} WHERE userID = #{userId}
+    </update>
+    <update id="updateMessageAsRead">
+        UPDATE message SET readFlag = '1' WHERE messageID = #{messageId}
+    </update>
+    <delete id="deleteMessage">
+        DELETE FROM message WHERE messageID = #{messageId}
+    </delete>
+    <select id="getUserProtocol" resultType="com.caimei365.user.model.vo.HelpPageVo">
+        SELECT helpPageID AS helpPageId,
+               helpPageTypeID AS helpPageTypeId,
+               title,
+               content,
+               contentTxt,
+               linkName,
+               sortIndex,
+               validFlag,
+               showFlag
+        FROM helppage WHERE helpPageID = #{helpPageId}
+    </select>
+    <select id="getMessageList" resultType="java.util.Map">
+        SELECT
+            messageID AS messageId,
+            content,
+            addTime,
+            readFlag
+        FROM message
+        WHERE toUserID = #{userId}
+        ORDER BY addTime DESC
+    </select>
+    <select id="getBalanceRecord" resultType="com.caimei365.user.model.vo.BalanceRecordVo">
+        SELECT
+            id,
+            userId,
+            type,
+            balanceType,
+            addDate,
+            amount,
+            orderId,
+            receiptId,
+            returnedId,
+            withdrawalsId,
+            remark,
+            delFlag
+        FROM cm_user_balance_record
+        <where>
+            <if test="type != null and type != ''">
+                AND type = #{type}
+            </if>
+            AND addDate <![CDATA[ >= ]]> #{startTime}
+            AND addDate <![CDATA[ <= ]]> #{endTime}
+            AND userId = #{userId}
+            AND delFlag = '0'
+        </where>
+        ORDER BY addDate DESC
+    </select>
+    <select id="getAbleUserMoney" resultType="java.lang.Double">
+        SELECT ableUserMoney FROM user WHERE userID = #{userId}
+    </select>
+</mapper>