puhanshu
2021-09-24 a263479c22af5a31d93d3c545963bdec693a6c2a
便民服务功能开发
20个文件已修改
60个文件已添加
5934 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityConvenientApi.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java 152 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/api/LoginApi.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/LoginService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/MerchantBusinessPeriod.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientMerchantDTO.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductCategoryDTO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductDTO.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductSpecificationDTO.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientServiceCategoryDTO.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/DeleteConvenientProductDTO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/DisableOrEnableConvenientMerchantDTO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ExportMerchantDTO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/OnShelfOrOffShelfProductDTO.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageClassifyMerchantDTO.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientMerchantDTO.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientProductCategoryDTO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientProductDTO.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientServiceCategoryDTO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PagePopularMerchantDTO.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageSearchDTO.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ResetPasswordConvenientMerchantDTO.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/user/ConvenientResetPasswordDTO.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientConsultationStatisticsVO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientMerchantVO.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductCategoryVO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductLevelInfoVO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductShelfVO.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductSpecificationVO.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductVO.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientServiceCategoryVO.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientViewStatisticsVO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ExportMerchantVO.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/LoginMerchantUserInfoVO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/auth/TokenService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 394 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java 458 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientConsultationStatisticsDAO.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientMerchantDAO.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductCategoryDAO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductDAO.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductSpecificationDAO.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientServiceCategoryDAO.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientViewStatisticsDAO.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientConsultationStatisticsDO.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientMerchantDO.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductCategoryDO.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductDO.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductSpecificationDO.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientServiceCategoryDO.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientViewStatisticsDO.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientMerchantService.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientProductCategoryService.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientProductService.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientServiceCategoryService.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java 396 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductCategoryServiceImpl.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java 292 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientServiceCategoryServiceImpl.java 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientConsultationStatisticsMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientMerchantMapper.xml 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductCategoryMapper.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductSpecificationMapper.xml 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientServiceCategoryMapper.xml 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientViewStatisticsMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/SysUserDOMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/ConvenientApi.java 309 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java 97 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/model/vos/LoginBody.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityConvenientApi.java
@@ -1,15 +1,30 @@
package com.panzhihua.applets.api;
import javax.annotation.Resource;
import java.util.Objects;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.PageComCvtBusinessAppletsDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComCvtBusinessDetailVO;
import com.panzhihua.common.model.vos.community.ComCvtBusinessVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductLevelInfoVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.common.service.community.CommunityService;
import io.swagger.annotations.Api;
@@ -30,6 +45,7 @@
    @Resource
    private CommunityService communityService;
    @Deprecated
    @ApiOperation(value = "分页查询便民服务商家", response = ComCvtBusinessVO.class)
    @PostMapping("/business/area/page")
    public R pageComCvtBusiness(@RequestBody PageComCvtBusinessAppletsDTO comCvtBusinessAppletsDTO) {
@@ -40,10 +56,79 @@
        return communityService.pageComCvtBusinessByServiceArea(comCvtBusinessAppletsDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务商家详情", response = ComCvtBusinessDetailVO.class)
    @GetMapping("/business/get")
    public R getComCvtBusinessServeDetail(@RequestParam("id") Long id) {
        return communityService.getComCvtBusinessServeDetail(id);
    }
    @ApiOperation(value = "获取商家数量大于0的服务类型", response = ConvenientServiceCategoryVO.class)
    @GetMapping("/service-category/suitable")
    public R getSuitableServiceCategories(@RequestParam("communityId") Long communityId) {
        if (Objects.isNull(communityId)) {
            return R.fail("社区id不能为空");
        }
        return communityService.getSuitableServiceCategories(communityId);
    }
    @ApiOperation(value = "分页获取热门商家", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/popular")
    public R getPopularMerchants(@RequestBody @Valid PagePopularMerchantDTO pagePopularMerchantDTO) {
        return communityService.getPopularMerchants(pagePopularMerchantDTO);
    }
    @ApiOperation(value = "分页获取服务类型下商家", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/classify")
    public R getClassifyMerchants(@RequestBody @Valid PageClassifyMerchantDTO pageClassifyMerchantDTO) {
        return communityService.getClassifyMerchants(pageClassifyMerchantDTO);
    }
    @ApiOperation(value = "商家详情", response = ConvenientMerchantVO.class)
    @GetMapping("/merchant/detail")
    public R getMerchantDetail(@RequestParam("merchantId") Long merchantId) {
        return communityService.getMerchantDetail(merchantId);
    }
    @ApiOperation(value = "获取商家产品", response = ConvenientProductLevelInfoVO.class)
    @GetMapping("/product/list")
    public R getMerchantProduct(@RequestParam("merchantId") Long merchantId) {
        return communityService.getMerchantProduct(merchantId);
    }
    @ApiOperation(value = "获取产品详情", response = ConvenientProductVO.class)
    @GetMapping("/product/detail")
    public R getProductDetail(@RequestParam("productId") Long productId) {
        return communityService.getProductDetail(productId);
    }
    @ApiOperation(value = "商家分页搜索", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/search")
    public R pageSearchMerchant(@RequestBody @Valid PageSearchDTO pageSearchDTO) {
        return communityService.pageSearchMerchant(pageSearchDTO);
    }
    @ApiOperation(value = "商品分页搜索", response = ConvenientProductVO.class)
    @PostMapping("/product/search")
    public R pageSearchProduct(@RequestBody @Valid PageSearchDTO pageSearchDTO) {
        return communityService.pageSearchProduct(pageSearchDTO);
    }
    @ApiOperation(value = "增加商家咨询量")
    @GetMapping("/merchant/incr-consult")
    public R incrMerchantConsult(@RequestParam("merchantId") Long merchantId) {
        return communityService.consultMerchant(merchantId);
    }
    @ApiOperation(value = "增加商家浏览量")
    @GetMapping("/merchant/incr-view")
    public R incrMerchantView(@RequestParam("merchantId") Long merchantId) {
        return communityService.incrMerchantView(merchantId);
    }
    @ApiOperation(value = "增加产品浏览量")
    @GetMapping("/product/incr-view")
    public R incrProductView(@RequestParam("productId") Long productId) {
        return communityService.incrProductView(productId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java
@@ -7,11 +7,22 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.panzhihua.applets_backstage.config.MinioUtil;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.excel.EasyExcel;
@@ -19,15 +30,33 @@
import com.panzhihua.common.constants.FtpConstants;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.listen.ComCvtServeExcelListen;
import com.panzhihua.common.model.dtos.community.*;
import com.panzhihua.common.model.dtos.community.ComCvtBusinessDTO;
import com.panzhihua.common.model.dtos.community.ComCvtCategoryDTO;
import com.panzhihua.common.model.dtos.community.ComCvtServeDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtBusinessDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtCategoryDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtServeDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.ComCvtBusinessVO;
import com.panzhihua.common.model.vos.community.ComCvtCategoryVO;
import com.panzhihua.common.model.vos.community.ComCvtServeExcelVO;
import com.panzhihua.common.model.vos.community.ComCvtServeVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
/**
@@ -64,12 +93,14 @@
    @Value("${ftp.url}")
    private String url;
    @Deprecated
    @ApiOperation(value = "分页查询便民服务商家", response = ComCvtBusinessVO.class)
    @PostMapping("/business/page")
    public R pageComCvtBusiness(@RequestBody PageComCvtBusinessDTO pageComCvtBusinessDTO) {
        return communityService.pageComCvtBusiness(pageComCvtBusinessDTO);
    }
    @Deprecated
    @ApiOperation(value = "新增便民服务商家")
    @PostMapping("/business/add")
    public R addComCvtBusiness(@RequestBody ComCvtBusinessDTO comCvtBusinessDTO) {
@@ -79,72 +110,77 @@
        return communityService.addComCvtBusiness(comCvtBusinessDTO);
    }
    @ApiOperation(value = "社区下拉列表", response = ComActVO.class)
    @GetMapping("/community")
    public R listCommunity() {
        return communityService.listCommunityAll();
    }
    @Deprecated
    @ApiOperation(value = "编辑便民服务商家")
    @PutMapping("/business/put")
    public R putComCvtBusiness(@RequestBody ComCvtBusinessDTO comCvtBusinessDTO) {
        return communityService.putComCvtBusiness(comCvtBusinessDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务商家详情")
    @GetMapping("/business/get")
    public R getComCvtBusiness(@RequestParam("id") Long id) {
        return communityService.getComCvtBusiness(id);
    }
    @Deprecated
    @ApiOperation(value = "删除便民服务商家详情")
    @DeleteMapping("/business/delete")
    public R deleteComCvtBusiness(@RequestParam("id") Long id) {
        return communityService.deleteComCvtBusiness(id);
    }
    @Deprecated
    @ApiOperation(value = "分页查询便民服务分类", response = ComCvtCategoryVO.class)
    @PostMapping("/category/page")
    public R pageComCvtCategory(@RequestBody PageComCvtCategoryDTO pageComCvtCategoryDTO) {
        return communityService.pageComCvtCategory(pageComCvtCategoryDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务所有分类,下拉框", response = ComCvtCategoryVO.class)
    @PostMapping("/category/all")
    public R allComCvtCategory() {
        return communityService.allComCvtCategory();
    }
    @Deprecated
    @ApiOperation(value = "新增便民服务分类")
    @PostMapping("/category/add")
    public R pageComCvtCategory(@RequestBody ComCvtCategoryDTO comCvtCategoryDTO) {
        return communityService.addComCvtCategory(comCvtCategoryDTO);
    }
    @Deprecated
    @ApiOperation(value = "编辑便民服务分类")
    @PutMapping("/category/put")
    public R putComCvtCategory(@RequestBody ComCvtCategoryDTO comCvtCategoryDTO) {
        return communityService.putComCvtCategory(comCvtCategoryDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务分类详情", response = ComCvtCategoryVO.class)
    @GetMapping("/category/get")
    public R getComCvtCategory(@RequestParam("id") Long id) {
        return communityService.getComCvtCategory(id);
    }
    @Deprecated
    @ApiOperation(value = "删除便民服务分类信息")
    @DeleteMapping("/category/delete")
    public R deleteComCvtCategory(@RequestParam("id") Long id) {
        return communityService.deleteComCvtCategory(id);
    }
    @Deprecated
    @ApiOperation(value = "分页查询便民服务", response = ComCvtServeVO.class)
    @PostMapping("/serve/page")
    public R pageComCvtServe(@RequestBody PageComCvtServeDTO pageComCvtServeDTO) {
        return communityService.pageComCvtServe(pageComCvtServeDTO);
    }
    @Deprecated
    @ApiOperation(value = "新增便民服务")
    @PostMapping("/serve/add")
    public R addComCvtServe(@RequestBody ComCvtServeDTO comCvtServeDTO) {
@@ -154,18 +190,21 @@
        return communityService.addComCvtServe(comCvtServeDTO);
    }
    @Deprecated
    @ApiOperation(value = "编辑便民服务")
    @PutMapping("/serve/put")
    public R putComCvtServe(@RequestBody ComCvtServeDTO comCvtServeDTO) {
        return communityService.putComCvtServe(comCvtServeDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务详情", response = ComCvtServeVO.class)
    @GetMapping("/serve/get")
    public R getComCvtServe(@RequestParam("id") Long id) {
        return communityService.getComCvtServe(id);
    }
    @Deprecated
    @ApiOperation(value = "删除便民服务信息")
    @DeleteMapping("/serve/delete")
    public R deleteComCvtServe(@RequestParam("id") Long id) {
@@ -227,4 +266,99 @@
        }
        return R.ok();
    }
    @ApiOperation(value = "新增便民服务分类")
    @PostMapping("/service-category/add")
    public R addServiceCategory(@RequestBody @Validated(AddGroup.class) ConvenientServiceCategoryDTO convenientServiceCategoryDTO) {
        convenientServiceCategoryDTO.setCreatedBy(this.getUserId());
        return communityService.addServiceCategory(convenientServiceCategoryDTO);
    }
    @ApiOperation(value = "编辑便民服务分类")
    @PutMapping("/service-category/put")
    public R putServiceCategory(@RequestBody @Validated(PutGroup.class) ConvenientServiceCategoryDTO convenientServiceCategoryDTO) {
        convenientServiceCategoryDTO.setUpdatedBy(this.getUserId());
        return communityService.putServiceCategory(convenientServiceCategoryDTO);
    }
    @ApiOperation(value = "删除便民服务分类")
    @DeleteMapping("/service-category/delete")
    public R deleteServiceCategory(@RequestParam("categoryId")
                                   @ApiParam(value = "便民服务分类id", required = true)
                                   Long categoryId) {
        return communityService.deleteServiceCategory(categoryId, this.getUserId());
    }
    @ApiOperation(value = "查询便民服务分类详情", response = ConvenientServiceCategoryVO.class)
    @GetMapping("/service-category/get")
    public R getServiceCategory(@RequestParam("categoryId")
                                @ApiParam(value = "便民服务分类id", required = true)
                                Long categoryId) {
        return communityService.getServiceCategory(categoryId);
    }
    @ApiOperation(value = "分页查询便民服务分类", response = ConvenientServiceCategoryVO.class)
    @PostMapping("/service-category/page")
    public R pageServiceCategory(@RequestBody PageConvenientServiceCategoryDTO pageConvenientServiceCategoryDTO) {
        return communityService.pageServiceCategory(pageConvenientServiceCategoryDTO);
    }
    @ApiOperation(value = "新增便民服务商家")
    @PostMapping("/merchant/add")
    public R addMerchant(@RequestBody @Validated(AddGroup.class) ConvenientMerchantDTO convenientMerchantDTO) {
        convenientMerchantDTO.setCreatedBy(this.getUserId());
        return communityService.addMerchant(convenientMerchantDTO);
    }
    @ApiOperation(value = "编辑便民服务商家")
    @PutMapping("/merchant/put")
    public R putMerchant(@RequestBody @Validated(PutGroup.class) ConvenientMerchantDTO convenientMerchantDTO) {
        convenientMerchantDTO.setUpdatedBy(this.getUserId());
        convenientMerchantDTO.setCreatedBy(this.getUserId());
        return communityService.putMerchant(convenientMerchantDTO);
    }
    @ApiOperation(value = "查询便民服务商家详情", response = ConvenientMerchantVO.class)
    @GetMapping("/merchant/get")
    public R getMerchant(@RequestParam("merchantId") Long merchantId) {
        return communityService.getMerchant(merchantId);
    }
    @ApiOperation(value = "删除便民服务商家")
    @DeleteMapping("/merchant/delete")
    public R deleteMerchant(@RequestParam("merchantId") Long merchantId) {
        return communityService.deleteMerchant(merchantId, this.getUserId());
    }
    @ApiOperation(value = "分页查询便民服务商家", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/page")
    public R pageMerchant(@RequestBody PageConvenientMerchantDTO pageConvenientMerchantDTO) {
        return communityService.pageMerchant(pageConvenientMerchantDTO);
    }
    @ApiOperation(value = "禁用/启用便民服务商家")
    @PutMapping("/merchant/disable-or-enable")
    public R disableOrEnableMerchant(@RequestBody @Valid DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO) {
        disableOrEnableConvenientMerchantDTO.setUpdatedBy(this.getUserId());
        return communityService.disableOrEnableMerchant(disableOrEnableConvenientMerchantDTO);
    }
    @ApiOperation(value = "重置便民服务商家账号密码")
    @PutMapping("/merchant/reset-password")
    public R resetPasswordMerchant(@RequestBody @Valid ResetPasswordConvenientMerchantDTO resetPasswordConvenientMerchantDTO) {
        resetPasswordConvenientMerchantDTO.setUpdatedBy(this.getUserId());
        return communityService.resetPasswordMerchant(resetPasswordConvenientMerchantDTO);
    }
    @ApiOperation(value = "社区下拉列表", response = ComActVO.class)
    @GetMapping("/community")
    public R listCommunity() {
        return communityService.listCommunityAll();
    }
    @ApiOperation(value = "所有服务分类", response = ConvenientServiceCategoryVO.class)
    @GetMapping("/service-category/all")
    public R getAllServiceCategories() {
        return communityService.getAllServiceCategories();
    }
}
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/api/LoginApi.java
@@ -3,7 +3,11 @@
import javax.annotation.Resource;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.panzhihua.auth.model.dos.LoginBody;
import com.panzhihua.auth.service.LoginService;
@@ -209,4 +213,18 @@
        return R.ok(loginReturnVO);
    }
    /**
     * 便民服务商家后台登录
     *
     * @param account
     *            账户
     * @param password
     *            密码
     * @return 登录结果
     */
    @PostMapping("/loginMerchantBackStage")
    public R loginMerchantBackStage(@RequestParam("account") String account, @RequestParam("password") String password) {
        LoginReturnVO loginReturnVO = loginService.loginMerchantBackStage(account, password);
        return R.ok(loginReturnVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/LoginService.java
@@ -114,4 +114,12 @@
     * @return 登录结果
     */
    LoginReturnsVO loginAlarmApp(String account, String password);
    /**
     * 便民服务商家后台登录
     * @param account 账户
     * @param password 密码
     * @return 登录结果
     */
    LoginReturnVO loginMerchantBackStage(String account, String password);
}
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java
@@ -239,4 +239,21 @@
        return loginReturnVO;
    }
    /**
     * 便民服务商家后台登录
     * @param account 账户
     * @param password 密码
     * @return 登录结果
     */
    @Override
    public LoginReturnVO loginMerchantBackStage(String account, String password) {
        Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account + "_10", password));
        LoginUserInfoVO loginUser = (LoginUserInfoVO)authentication.getPrincipal();
        String token = JWTTokenUtil.generateToken(loginUser);
        String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser);
        LoginReturnVO loginReturnVO = new LoginReturnVO();
        loginReturnVO.setToken(token);
        loginReturnVO.setRefreshToken(refeshToken);
        return loginReturnVO;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java
@@ -133,6 +133,10 @@
     */
    public static final String ADMIN_SHOP_ROLE_KEY = "chaojiguanliyuan";
    /**
     * 便民服务商户默认角色权限默认字符串
     */
    public static final String CONVENIENT_MERCHANT_ROLE_KEY = "convenient_merchant_platform";
    /**
     * 首页商城是否展示(1.是 2.否)
     */
    public static final Integer IS_SHOP_OPEN = 2;
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/MerchantBusinessPeriod.java
New file
@@ -0,0 +1,15 @@
package com.panzhihua.common.enums;
import lombok.Getter;
/**
 * @title: MerchantBusinessPeriod
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家营业周期枚举类
 * @author: hans
 * @date: 2021/09/17 16:06
 */
@Getter
public enum MerchantBusinessPeriod {
    EVERY_DAY, WEEKDAY, WEEKEND
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientMerchantDTO.java
New file
@@ -0,0 +1,132 @@
package com.panzhihua.common.model.dtos.community.convenient;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.panzhihua.common.enums.MerchantBusinessPeriod;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 新增/编辑便民服务商家
 * @author: hans
 * @date: 2021/09/15 17:18
 */
@Data
@ApiModel("新增/编辑便民服务商家")
public class ConvenientMerchantDTO {
    @ApiModelProperty("便民服务商家ID")
    @NotNull(groups = {PutGroup.class}, message = "便民服务商家ID不能为空")
    private Long id;
    @ApiModelProperty("商家名称")
    @NotBlank(groups = {AddGroup.class}, message = "商家名称不能为空")
    @Length(groups = {AddGroup.class}, max = 25, message = "商家名称最多支持25个字符")
    private String name;
    @ApiModelProperty("商家logo")
    private String logo;
    @ApiModelProperty("联系人")
    @NotBlank(groups = {AddGroup.class}, message = "联系人不能为空")
    private String contacts;
    @ApiModelProperty("负责人身份证号")
    @Pattern(groups = {AddGroup.class}, message = "请输入18位有效身份证号码", regexp = "(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)")
    private String idCard;
    @ApiModelProperty("咨询电话")
    @Pattern(groups = {AddGroup.class}, message = "咨询电话格式错误", regexp = "(1[3|4|5|7|8][0-9]\\d{8})|(\\d{3}-\\d{8}|\\d{4}-\\d{7})")
    private String phone;
    @ApiModelProperty("商家地址")
    @NotBlank(groups = {AddGroup.class}, message = "商家地址不能为空")
    private String address;
    @ApiModelProperty("纬度")
    @NotBlank(groups = {AddGroup.class}, message = "纬度不能为空")
    private String lat;
    @ApiModelProperty("经度")
    @NotBlank(groups = {AddGroup.class}, message = "经度不能为空")
    private String lon;
    @ApiModelProperty("营业开始时间")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @NotNull(groups = {AddGroup.class}, message = "营业开始时间不能为空")
    private Date beginAt;
    @ApiModelProperty("营业截至时间")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @NotNull(groups = {AddGroup.class}, message = "营业截至时间不能为空")
    private Date endAt;
    @ApiModelProperty(value = "营业周期", allowableValues = "EVERY_DAY,WEEKDAY,WEEKEND")
    @NotNull(groups = {AddGroup.class}, message = "营业周期不能为空")
    private MerchantBusinessPeriod period;
    @ApiModelProperty("商家介绍")
    @Size(max = 100)
    private String introduction;
    @ApiModelProperty("服务范围")
    @NotEmpty(groups = {AddGroup.class}, message = "服务范围不能为空")
    private List<Long> serviceIds;
    @ApiModelProperty("是否营业中,1.在营 0.已关闭")
    @NotNull(groups = {AddGroup.class}, message = "是否营业不能为空")
    private Integer businessStatus;
    @ApiModelProperty("管理账号")
    @Pattern(groups = {AddGroup.class}, message = "请输入6-10位管理账号,由英文或数字组成", regexp = "^[0-9A-Za-z]{6,10}$")
    private String account;
    @ApiModelProperty("登陆密码")
//    @Pattern(groups = {AddGroup.class}, message = "请输入8-12位登陆密码,由英文,数字和特殊符号组成",
//            regexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[$@$!%*#?&])[A-Za-z\\d$@$!%*#?&]{8,12}$")
    @Pattern(groups = {AddGroup.class}, message = "请输入8-12位登陆密码,由英文,数字和特殊符号组成",
            regexp = "^(?=.*[A-Za-z])(?=(.*[\\d]){1,})(?=(.*[\\W]){1,})(?!.*\\s).{8,}$")
    private String password;
    @ApiModelProperty(value = "所属社区id")
    @NotNull(groups = {AddGroup.class}, message = "所属社区id不能为空")
    private Long communityId;
    @ApiModelProperty(value = "创建人", hidden = true)
    private Long createdBy;
    @ApiModelProperty(value = "更新人", hidden = true)
    private Long updatedBy;
    public String getPeriod() {
        return period.name();
    }
    public void setPeriod(MerchantBusinessPeriod period) {
        this.period = period;
    }
    public Boolean getBusinessStatus() {
        return businessStatus.intValue() == 1;
    }
    public void setBusinessStatus(Boolean businessStatus) {
        this.businessStatus = businessStatus ? 1 : 0;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductCategoryDTO.java
New file
@@ -0,0 +1,43 @@
package com.panzhihua.common.model.dtos.community.convenient;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
 * @title: ConvenientProductCategoryDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 新增/编辑产品分类
 * @author: hans
 * @date: 2021/09/20 10:32
 */
@Data
@ApiModel("新增/编辑产品分类")
public class ConvenientProductCategoryDTO {
    @ApiModelProperty("分类ID")
    @NotNull(groups = {PutGroup.class}, message = "分类id不能为空")
    private Long id;
    @ApiModelProperty("分类名称")
    @NotBlank(groups = {AddGroup.class}, message = "分类名称不能为空")
    private String name;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("权重")
    @NotNull(groups = {AddGroup.class}, message = "权重不能为空")
    private Integer weight;
    @ApiModelProperty(value = "创建人", hidden = true)
    private Long createdBy;
    @ApiModelProperty(value = "更新人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductDTO.java
New file
@@ -0,0 +1,66 @@
package com.panzhihua.common.model.dtos.community.convenient;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
 * @title: ConvenientProductDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 新增/编辑便民服务商家后台产品
 * @author: hans
 * @date: 2021/09/20 20:32
 */
@Data
@ApiModel("新增/编辑便民服务商家后台产品")
public class ConvenientProductDTO {
    @ApiModelProperty("产品ID")
    @NotNull(groups = {PutGroup.class}, message = "产品ID不能为空")
    private Long id;
    @ApiModelProperty("产品名称")
    @NotBlank(groups = {AddGroup.class}, message = "产品名称不能为空")
    @Length(groups = {AddGroup.class}, max = 20, message = "产品名称最多支持20个字符")
    private String name;
    @ApiModelProperty("产品介绍")
    private String introduction;
    @ApiModelProperty("所属分类")
    @NotNull(groups = {AddGroup.class}, message = "所属分类不能为空")
    private Long categoryId;
    @ApiModelProperty("产品规格")
    @NotEmpty(groups = {AddGroup.class}, message = "产品规格不能为空")
    private List<ConvenientProductSpecificationDTO> productSpecificationDTOList;
    @ApiModelProperty("上架状态,1.上架 0.下架")
    @NotNull(groups = {AddGroup.class}, message = "上架状态不能为空")
    private Integer onShelf;
    @ApiModelProperty(value = "创建人", hidden = true)
    private Long createdBy;
    @ApiModelProperty(value = "更新人", hidden = true)
    private Long updatedBy;
    @ApiModelProperty(value = "所属商家", hidden = true)
    private Long merchantId;
    public Boolean getOnShelf() {
        return onShelf.intValue() == 1;
    }
    public void setOnShelf(Boolean onShelf) {
        this.onShelf = onShelf ? 1 : 0;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductSpecificationDTO.java
New file
@@ -0,0 +1,48 @@
package com.panzhihua.common.model.dtos.community.convenient;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
 * @title: ConvenientProductSpecificationDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 新增/编辑产品规格信息
 * @author: hans
 * @date: 2021/09/20 20:46
 */
@Data
@ApiModel("新增/编辑产品规格信息")
public class ConvenientProductSpecificationDTO {
    @ApiModelProperty("规格ID")
    @NotNull(message = "规格ID不能为空", groups = {PutGroup.class})
    private Long id;
    @ApiModelProperty("规格名称")
    @NotBlank(message = "规格名称不能为空", groups = {AddGroup.class})
    @Max(6)
    private String name;
    @ApiModelProperty("价格")
    @NotNull(message = "价格不能为空", groups = {AddGroup.class})
    @Min(0)
    private BigDecimal price;
    @ApiModelProperty("产品图片")
    private String image;
    @ApiModelProperty(value = "创建人", hidden = true)
    private Long createdBy;
    @ApiModelProperty(value = "更新人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientServiceCategoryDTO.java
New file
@@ -0,0 +1,48 @@
package com.panzhihua.common.model.dtos.community.convenient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientServiceCategoryDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 新增/编辑便民服务分类
 * @author: hans
 * @date: 2021/09/16 9:49
 */
@Data
@ApiModel("新增/编辑便民服务分类")
public class ConvenientServiceCategoryDTO {
    @ApiModelProperty("分类ID")
    @NotNull(groups = {PutGroup.class}, message = "分类id不能为空")
    private Long id;
    @ApiModelProperty("分类名称")
    @NotBlank(groups = {AddGroup.class}, message = "分类名称不能为空")
    private String name;
    @ApiModelProperty("分类图标")
    @NotBlank(groups = {AddGroup.class}, message = "分类图标不能为空")
    private String icon;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("权重")
    @NotNull(groups = {AddGroup.class}, message = "权重不能为空")
    private Integer weight;
    @ApiModelProperty(value = "创建人", hidden = true)
    private Long createdBy;
    @ApiModelProperty(value = "更新人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/DeleteConvenientProductDTO.java
New file
@@ -0,0 +1,27 @@
package com.panzhihua.common.model.dtos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
 * @title: DeleteConvenientProductDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 删除便民服务商家后台产品请求参数
 * @author: hans
 * @date: 2021/09/21 16:25
 */
@Data
@ApiModel("删除便民服务商家后台产品请求参数")
public class DeleteConvenientProductDTO {
    @ApiModelProperty(value = "需要删除的产品id集合", required = true)
    @NotEmpty(message = "产品id不能为空")
    private List<Long> ids;
    @ApiModelProperty(value = "处理人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/DisableOrEnableConvenientMerchantDTO.java
New file
@@ -0,0 +1,33 @@
package com.panzhihua.common.model.dtos.community.convenient;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: DisableOrEnableConvenientMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 禁用/启用便民服务商家请求参数
 * @author: hans
 * @date: 2021/09/16 15:34
 */
@Data
@ApiModel("禁用/启用便民服务商家请求参数")
public class DisableOrEnableConvenientMerchantDTO {
    @ApiModelProperty(value = "处理类型(1.启用 2.禁用)", required = true, allowableValues = "1,2")
    @NotNull(message = "处理类型不能为空")
    private Integer type;
    @ApiModelProperty(value = "需要处理的id集合", required = true)
    @NotEmpty(message = "处理id不能为空")
    private List<Long> ids;
    @ApiModelProperty(value = "处理人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ExportMerchantDTO.java
New file
@@ -0,0 +1,37 @@
package com.panzhihua.common.model.dtos.community.convenient;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ExportMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 商家导出请求参数
 * @author: hans
 * @date: 2021/09/23 15:23
 */
@Data
@ApiModel("商家导出请求参数")
public class ExportMerchantDTO {
    @ApiModelProperty(value = "批量勾选时传参数组")
    private List<Long> ids;
    @ApiModelProperty("关键词")
    private String keyword;
    @ApiModelProperty("服务分类id")
    private Long serviceId;
    @ApiModelProperty("营业状态(1.在营 0.已关闭)")
    private Integer businessStatus;
    @ApiModelProperty("账号状态(1.启用 2.禁用)")
    private Integer accountStatus;
    @ApiModelProperty(value = "服务分类id", hidden = true)
    private Long communityId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/OnShelfOrOffShelfProductDTO.java
New file
@@ -0,0 +1,32 @@
package com.panzhihua.common.model.dtos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
 * @title: OnShelfOrOffShelfProductDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 上架/下架便民服务商家后台产品请求参数
 * @author: hans
 * @date: 2021/09/21 16:42
 */
@Data
@ApiModel("上架/下架便民服务商家后台产品请求参数")
public class OnShelfOrOffShelfProductDTO {
    @ApiModelProperty(value = "处理类型(1.上架 2.下架)", required = true, allowableValues = "1,2")
    @NotNull(message = "处理类型不能为空")
    private Integer type;
    @ApiModelProperty(value = "需要上架/下架的产品id集合", required = true)
    @NotEmpty(message = "需要上架/下架的产品id不能为空")
    private List<Long> ids;
    @ApiModelProperty(value = "处理人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageClassifyMerchantDTO.java
New file
@@ -0,0 +1,41 @@
package com.panzhihua.common.model.dtos.community.convenient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PageClassifyMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页获取服务类型下商家信息请求参数
 * @author: hans
 * @date: 2021/09/22 16:45
 */
@Data
@ApiModel("分页获取服务类型下商家信息请求参数")
public class PageClassifyMerchantDTO {
    @ApiModelProperty(value = "商家服务分类id")
    @NotNull(message = "商家服务分类id不能为空")
    @Min(value = 1)
    private Long serviceId;
    @ApiModelProperty(value = "社区id")
    @NotNull(message = "社区id不能为空")
    @Min(value = 1)
    private Long communityId;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageSize;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientMerchantDTO.java
New file
@@ -0,0 +1,45 @@
package com.panzhihua.common.model.dtos.community.convenient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PageConvenientMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页查询便民服务商家请求参数
 * @author: hans
 * @date: 2021/09/16 15:03
 */
@Data
@ApiModel("分页查询便民服务商家请求参数")
public class PageConvenientMerchantDTO {
    @ApiModelProperty("关键词")
    private String keyword;
    @ApiModelProperty("社区id")
    private Long communityId;
    @ApiModelProperty("服务分类id")
    private Long serviceId;
    @ApiModelProperty("营业状态(1.在营 0.已关闭)")
    private Integer businessStatus;
    @ApiModelProperty("账号状态(1.启用 2.禁用)")
    private Integer accountStatus;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageSize;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientProductCategoryDTO.java
New file
@@ -0,0 +1,26 @@
package com.panzhihua.common.model.dtos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PageConvenientProductCategoryDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页查询产品分类请求参数
 * @author: hans
 * @date: 2021/09/20 15:23
 */
@Data
@ApiModel("分页查询产品分类请求参数")
public class PageConvenientProductCategoryDTO {
    @ApiModelProperty("分类名称")
    private String name;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    private Long pageSize;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientProductDTO.java
New file
@@ -0,0 +1,42 @@
package com.panzhihua.common.model.dtos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
 * @title: PageConvenientProductDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页查询便民服务商家后台产品信息请求参数
 * @author: hans
 * @date: 2021/09/21 16:12
 */
@Data
@ApiModel("分页查询便民服务商家后台产品信息请求参数")
public class PageConvenientProductDTO {
    @ApiModelProperty("产品名称")
    private String name;
    @ApiModelProperty("产品分类id")
    private Long categoryId;
    @ApiModelProperty("上架状态(1.已上架 0.已下架)")
    private Integer onShelf;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageSize;
    @ApiModelProperty(value = "所属商家", hidden = true)
    private Long merchantId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientServiceCategoryDTO.java
New file
@@ -0,0 +1,26 @@
package com.panzhihua.common.model.dtos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PageConvenientServiceCategoryDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页查询便民服务分类请求参数
 * @author: hans
 * @date: 2021/09/16 10:16
 */
@Data
@ApiModel("分页查询便民服务分类请求参数")
public class PageConvenientServiceCategoryDTO {
    @ApiModelProperty("分类名称")
    private String name;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    private Long pageSize;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PagePopularMerchantDTO.java
New file
@@ -0,0 +1,36 @@
package com.panzhihua.common.model.dtos.community.convenient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PagePopularMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页查询热门商家请求参数
 * @author: hans
 * @date: 2021/09/22 16:29
 */
@Data
@ApiModel("分页查询热门商家请求参数")
public class PagePopularMerchantDTO {
    @ApiModelProperty(value = "社区id")
    @NotNull(message = "社区id不能为空")
    @Min(value = 1)
    private Long communityId;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageSize;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageSearchDTO.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.common.model.dtos.community.convenient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PageSearchMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 分页搜索商家/商品信息请求参数
 * @author: hans
 * @date: 2021/09/23 12:34
 */
@Data
@ApiModel("分页搜索商家/商品信息请求参数")
public class PageSearchDTO {
    @ApiModelProperty(value = "关键词")
    @NotBlank(message = "关键词不能为空")
    private String keyword;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageNum;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
    @NotNull(message = "分页参数不能为空")
    @Min(value = 1)
    private Long pageSize;
    @ApiModelProperty(value = "社区id")
    @NotNull(message = "社区id不能为空")
    @Min(value = 1)
    private Long communityId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ResetPasswordConvenientMerchantDTO.java
New file
@@ -0,0 +1,36 @@
package com.panzhihua.common.model.dtos.community.convenient;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import com.panzhihua.common.validated.AddGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ResetPasswordConvenientMerchantDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 重置便民服务商家账号密码请求参数
 * @author: hans
 * @date: 2021/09/16 15:47
 */
@Data
@ApiModel("重置便民服务商家账号密码请求参数")
public class ResetPasswordConvenientMerchantDTO {
    @ApiModelProperty(value = "需要处理的id集合", required = true)
    @NotEmpty(message = "处理id不能为空")
    private List<Long> ids;
    @ApiModelProperty(value = "新密码", required = true)
    @Pattern(groups = {AddGroup.class}, message = "请输入8-12位登陆密码,由英文,数字和特殊符号组成",
            regexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[$@$!%*#?&])[A-Za-z\\d$@$!%*#?&]{8,12}$")
    private String password;
    @ApiModelProperty(value = "处理人", hidden = true)
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/user/ConvenientResetPasswordDTO.java
New file
@@ -0,0 +1,31 @@
package com.panzhihua.common.model.dtos.user;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import com.panzhihua.common.validated.AddGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientResetPasswordDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家修改密码
 * @author: hans
 * @date: 2021/09/17 17:27
 */
@Data
@ApiModel("便民服务商家修改密码请求参数")
public class ConvenientResetPasswordDTO {
    @ApiModelProperty("旧密码")
    @NotBlank(message = "旧密码不能为空")
    private String oldPassword;
    @ApiModelProperty("新密码")
    @Pattern(groups = {AddGroup.class}, message = "请输入8-12位登陆密码,由英文,数字和特殊符号组成",
            regexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[$@$!%*#?&])[A-Za-z\\d$@$!%*#?&]{8,12}$")
    private String newPassword;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientConsultationStatisticsVO.java
New file
@@ -0,0 +1,20 @@
package com.panzhihua.common.model.vos.community.convenient;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
 * @title: ConvenientConsultationStatisticsVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家咨询量
 * @author: hans
 * @date: 2021/09/16 13:49
 */
@Data
@ApiModel("便民服务商家咨询量")
public class ConvenientConsultationStatisticsVO {
    private Long merchantId;
    private Integer totalConsultationNum;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientMerchantVO.java
New file
@@ -0,0 +1,113 @@
package com.panzhihua.common.model.vos.community.convenient;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.panzhihua.common.enums.MerchantBusinessPeriod;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientMerchantVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家信息
 * @author: hans
 * @date: 2021/09/16 13:49
 */
@Data
@ApiModel("便民服务商家信息")
public class ConvenientMerchantVO {
    @ApiModelProperty("商家ID")
    private Long id;
    @ApiModelProperty("商家名称")
    private String name;
    @ApiModelProperty("商家logo")
    private String logo;
    @ApiModelProperty("联系人")
    private String contacts;
    @ApiModelProperty("负责人身份证号码")
    private String idCard;
    @ApiModelProperty("咨询电话")
    private String phone;
    @ApiModelProperty("商家地址")
    private String address;
    @ApiModelProperty("纬度")
    private String lat;
    @ApiModelProperty("经度")
    private String lon;
    @ApiModelProperty("营业开始时间")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    private Date beginAt;
    @ApiModelProperty("营业截止时间")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    private Date endAt;
    @ApiModelProperty("营业周期")
    private MerchantBusinessPeriod period;
    @ApiModelProperty("商家介绍")
    private String introduction;
    @ApiModelProperty("营业状态")
    private Integer businessStatus;
    @ApiModelProperty("总咨询量")
    private Integer consultationVolume;
    @ApiModelProperty("月咨询量")
    private Integer monthConsultationVolume;
    @ApiModelProperty("日咨询量")
    private Integer dayConsultationVolume;
    @ApiModelProperty("总浏览量")
    private Integer viewNum;
    @ApiModelProperty("月浏览量")
    private Integer monthViewNum;
    @ApiModelProperty("日总浏览量")
    private Integer dayViewNum;
    @ApiModelProperty("商家绑定账户")
    private String account;
    @ApiModelProperty("商家账户状态(1.启用 2.禁用)")
    private Integer accountStatus;
    @ApiModelProperty("所属社区id")
    private Long communityId;
    @ApiModelProperty("所属社区名称")
    private String communityName;
    @ApiModelProperty("服务范围,多个服务类型','拼接")
    private String serviceScope;
    @ApiModelProperty("服务类型id列表")
    private List<Long> serviceIds;
    @ApiModelProperty("该商家存有商品,最多返回两条")
    private List<ConvenientProductVO> productVOList;
    public void setPeriod(String period) {
        this.period = MerchantBusinessPeriod.valueOf(period);
    }
    public void setBusinessStatus(Boolean businessStatus) {
        this.businessStatus = businessStatus ? 1 : 0;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductCategoryVO.java
New file
@@ -0,0 +1,37 @@
package com.panzhihua.common.model.vos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * @title: ConvenientProductCategoryVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 产品分类信息
 * @author: hans
 * @date: 2021/09/20 11:08
 */
@Data
@ApiModel("产品分类信息")
public class ConvenientProductCategoryVO {
    @ApiModelProperty("分类ID")
    private Long id;
    @ApiModelProperty("分类名称")
    private String name;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("权重")
    private Integer weight;
    @ApiModelProperty("创建人")
    private String createdBy;
    @ApiModelProperty("创建时间")
    private Date createdAt;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductLevelInfoVO.java
New file
@@ -0,0 +1,25 @@
package com.panzhihua.common.model.vos.community.convenient;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientProductLevelInfoVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 商品层级信息VO
 * @author: hans
 * @date: 2021/09/23 9:55
 */
@Data
@ApiModel("商品层级信息VO")
public class ConvenientProductLevelInfoVO {
    @ApiModelProperty("商品分类名称")
    private String categoryName;
    @ApiModelProperty("该分类下商品")
    private List<ConvenientProductVO> productVOList;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductShelfVO.java
New file
@@ -0,0 +1,23 @@
package com.panzhihua.common.model.vos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientProductShelfVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家后台产品信息
 * @author: hans
 * @date: 2021/09/20 21:23
 */
@Data
@ApiModel("便民服务商家后台产品信息")
public class ConvenientProductShelfVO {
    @ApiModelProperty("上架产品数量")
    private Integer onShelfTotalNum;
    @ApiModelProperty("下架产品数量")
    private Integer offShelfTotalNum;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductSpecificationVO.java
New file
@@ -0,0 +1,38 @@
package com.panzhihua.common.model.vos.community.convenient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @title: ConvenientProductSpecificationVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 产品规格信息
 * @author: hans
 * @date: 2021/09/20 20:43
 */
@Data
@ApiModel("产品规格信息")
public class ConvenientProductSpecificationVO {
    @ApiModelProperty("规格ID")
    private Long id;
    @ApiModelProperty("规格名称")
    private String name;
    @ApiModelProperty("价格")
    private BigDecimal price;
    @ApiModelProperty("产品图片")
    private String image;
    @ApiModelProperty("规格所属产品ID")
    private Long productId;
    @ApiModelProperty("创建时间")
    private Date createdAt;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientProductVO.java
New file
@@ -0,0 +1,53 @@
package com.panzhihua.common.model.vos.community.convenient;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientProductVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家后台产品信息
 * @author: hans
 * @date: 2021/09/20 21:23
 */
@Data
@ApiModel("便民服务商家后台产品信息")
public class ConvenientProductVO {
    @ApiModelProperty("产品ID")
    private Long id;
    @ApiModelProperty("产品名称")
    private String name;
    @ApiModelProperty("产品图片")
    private String image;
    @ApiModelProperty("产品介绍")
    private String introduction;
    @ApiModelProperty("所属分类")
    private Long categoryId;
    @ApiModelProperty("所属商家")
    private Long merchantId;
    @ApiModelProperty("所属分类名称")
    private String categoryName;
    @ApiModelProperty("产品规格")
    private List<ConvenientProductSpecificationVO> productSpecificationVOList;
    @ApiModelProperty("上架状态,1.上架 0.下架")
    private Integer onShelf;
    @ApiModelProperty("上架时间")
    private Date onShelfAt;
    @ApiModelProperty("浏览量")
    private Integer viewNum;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientServiceCategoryVO.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.common.model.vos.community.convenient;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: ConvenientServiceCategoryVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务分类信息
 * @author: hans
 * @date: 2021/09/16 10:06
 */
@Data
@ApiModel("便民服务分类信息")
public class ConvenientServiceCategoryVO {
    @ApiModelProperty("分类ID")
    private Long id;
    @ApiModelProperty("分类名称")
    private String name;
    @ApiModelProperty("分类图标")
    private String icon;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("权重")
    private Integer weight;
    @ApiModelProperty("创建人")
    private String createdBy;
    @ApiModelProperty("创建时间")
    private Date createdAt;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ConvenientViewStatisticsVO.java
New file
@@ -0,0 +1,20 @@
package com.panzhihua.common.model.vos.community.convenient;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
 * @title: ConvenientViewStatisticsVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家浏览量
 * @author: hans
 * @date: 2021/09/16 13:49
 */
@Data
@ApiModel("便民服务商家浏览量")
public class ConvenientViewStatisticsVO {
    private Long merchantId;
    private Integer totalViewNum;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ExportMerchantVO.java
New file
@@ -0,0 +1,75 @@
package com.panzhihua.common.model.vos.community.convenient;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
 * @title: ExportMerchantVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 商家导出VO
 * @author: hans
 * @date: 2021/09/23 15:41
 */
@Data
public class ExportMerchantVO {
    private Long id;
    @ExcelProperty("商家名称")
    private String name;
    @ExcelProperty("联系人")
    private String contacts;
    @ExcelProperty("负责人身份证号")
    private String idCard;
    @ExcelProperty("咨询电话")
    private String phone;
    @ExcelProperty("商家地址")
    private String address;
    @ExcelProperty("营业时间")
    private String businessTime;
    @ExcelProperty("商家介绍")
    private String introduction;
    @ExcelProperty("营业状态")
    private String businessStatus;
    @ExcelProperty("总咨询量")
    private Integer consultationVolume;
    @ExcelProperty("管理账号")
    private String account;
    @ExcelProperty("账户状态")
    private String accountStatus;
    @ExcelProperty("所属社区")
    private String communityName;
    @ExcelProperty("服务范围")
    private String serviceScope;
    public void setBusinessStatus(Boolean businessStatus) {
        this.businessStatus = businessStatus ? "在营" : "已关闭";
    }
    public void setAccountStatus(Integer accountStatus) {
        this.accountStatus = accountStatus.intValue() == 1 ? "启用" : "禁用";
    }
    public void setBusinessTimeTime(String businessTime) {
        if (businessTime.contains("EVERY_DAY")) {
            this.businessTime = businessTime.replace("EVERY_DAY", "每天:");
        } else if (businessTime.contains("WEEKDAY")) {
            this.businessTime = businessTime.replace("WEEKDAY", "周一至周五:");
        } else {
            this.businessTime = businessTime.replace("WEEKEND", "周末:");
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/LoginMerchantUserInfoVO.java
New file
@@ -0,0 +1,22 @@
package com.panzhihua.common.model.vos.shop;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: LoginMerchantUserInfoVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家登录信息
 * @author: hans
 * @date: 2021/09/17 18:46
 */
@Data
@ApiModel(value = "便民服务商家登录信息")
public class LoginMerchantUserInfoVO extends LoginUserInfoVO {
    @ApiModelProperty("用户商铺信息")
    private ConvenientMerchantVO merchantInfo;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/auth/TokenService.java
@@ -121,4 +121,16 @@
     */
    @PostMapping("/loginAlarmApp")
    R loginAlarmApp(@RequestParam("account") String account, @RequestParam("password") String password);
    /**
     * 便民服务商家后台登录
     *
     * @param account
     *            账户
     * @param password
     *            密码
     * @return 登录结果
     */
    @PostMapping("/loginMerchantBackStage")
    R loginMerchantBackStage(@RequestParam("account") String account, @RequestParam("password") String password);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -2,18 +2,6 @@
import java.util.List;
import com.panzhihua.common.model.dtos.community.GetIdentityEidTokenDTO;
import com.panzhihua.common.model.dtos.community.*;
import com.panzhihua.common.model.dtos.property.CommonPage;
import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussDetailDTO;
import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussPublishResultDTO;
import com.panzhihua.common.model.dtos.community.elder.ElderAuthStatisticHeaderDTO;
import com.panzhihua.common.model.dtos.community.elder.PageElderAuthStatisticDTO;
import com.panzhihua.common.model.dtos.community.elder.PagePensionAuthStatisticDTO;
import com.panzhihua.common.model.dtos.community.elder.SignElderAuthStatisticDTO;
import com.panzhihua.common.model.dtos.neighbor.*;
import com.panzhihua.common.model.vos.community.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@@ -51,12 +39,15 @@
import com.panzhihua.common.model.dtos.community.ComMngPopulationTagDTO;
import com.panzhihua.common.model.dtos.community.ComMngRealCompanyBelongsDTO;
import com.panzhihua.common.model.dtos.community.ComOpsHouseDTO;
import com.panzhihua.common.model.dtos.community.ComSwDangerReportEditDTO;
import com.panzhihua.common.model.dtos.community.ComSwDangerReportHandleDTO;
import com.panzhihua.common.model.dtos.community.ComSwDangerReportRectifyDTO;
import com.panzhihua.common.model.dtos.community.ComSwPatrolRecordAddDTO;
import com.panzhihua.common.model.dtos.community.ComSwPatrolRecordEditDTO;
import com.panzhihua.common.model.dtos.community.ComSwPatrolRecordPageDTO;
import com.panzhihua.common.model.dtos.community.ComSwRotaPageDTO;
import com.panzhihua.common.model.dtos.community.ComSwRotaSaveDTO;
import com.panzhihua.common.model.dtos.community.ComSwSafetyWorkEditDTO;
import com.panzhihua.common.model.dtos.community.DisabledPersonsDTO;
import com.panzhihua.common.model.dtos.community.EditComActDynTypeDTO;
import com.panzhihua.common.model.dtos.community.EldersAuthAddByFamilyDTO;
@@ -69,6 +60,7 @@
import com.panzhihua.common.model.dtos.community.ExportComMngCarExcelDTO;
import com.panzhihua.common.model.dtos.community.ExportRealAssetsExcelDTO;
import com.panzhihua.common.model.dtos.community.ExportRealCompanyExcelDTO;
import com.panzhihua.common.model.dtos.community.GetIdentityEidTokenDTO;
import com.panzhihua.common.model.dtos.community.GrantRewardDTO;
import com.panzhihua.common.model.dtos.community.KeyPersonInfoDTO;
import com.panzhihua.common.model.dtos.community.OperationDetailDTO;
@@ -89,6 +81,7 @@
import com.panzhihua.common.model.dtos.community.PageComMngVillageDTO;
import com.panzhihua.common.model.dtos.community.PageComOpsHouseDTO;
import com.panzhihua.common.model.dtos.community.PageComStreetDTO;
import com.panzhihua.common.model.dtos.community.PageElderAuthRecordsDTO;
import com.panzhihua.common.model.dtos.community.PageEldersAuthDTO;
import com.panzhihua.common.model.dtos.community.PageEldersAuthElderlyDTO;
import com.panzhihua.common.model.dtos.community.PageEldersAuthHistoryDTO;
@@ -107,12 +100,34 @@
import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenActActivityPeopleListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenDiscussListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenMicroListDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussDetailDTO;
import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussPublishResultDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.AddEasyPhotoActivityDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.AddEasyPhotoClassifyDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.EditEasyPhotoActivityDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.PageEasyPhotoActivityDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.PageEasyPhotoActivityUserDTO;
import com.panzhihua.common.model.dtos.community.elder.ElderAuthStatisticHeaderDTO;
import com.panzhihua.common.model.dtos.community.elder.PageElderAuthStatisticDTO;
import com.panzhihua.common.model.dtos.community.elder.PagePensionAuthStatisticDTO;
import com.panzhihua.common.model.dtos.community.elder.SignElderAuthStatisticDTO;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.EditComActIntegralRuleDTO;
@@ -153,6 +168,23 @@
import com.panzhihua.common.model.dtos.grid.admin.ComMngVillageListExportAdminDTO;
import com.panzhihua.common.model.dtos.grid.admin.PageComMngVillagePopulationDTO;
import com.panzhihua.common.model.dtos.grid.admin.PageComMngVillagePopulationHouseDTO;
import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO;
import com.panzhihua.common.model.dtos.neighbor.AddNeighborCircleTopicAdminDTO;
import com.panzhihua.common.model.dtos.neighbor.AddNeighborCircleTopicAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborAddBrowseAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleTopicAdminDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCommentAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCommentReplyAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborFabulousAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborForwardAppDTO;
import com.panzhihua.common.model.dtos.neighbor.ComActNeighborReplyAppDTO;
import com.panzhihua.common.model.dtos.neighbor.DeleteNeighborCircleAppDTO;
import com.panzhihua.common.model.dtos.neighbor.DetailNeighborAllCommentByAdminDTO;
import com.panzhihua.common.model.dtos.neighbor.DetailNeighborCommentReplyByAdminDTO;
import com.panzhihua.common.model.dtos.property.CommonPage;
import com.panzhihua.common.model.dtos.shop.ComShopAddressDTO;
import com.panzhihua.common.model.dtos.shop.ComShopCartDTO;
import com.panzhihua.common.model.dtos.shop.ComShopEditNubCartDTO;
@@ -190,15 +222,20 @@
import com.panzhihua.common.model.vos.community.ComActActEvaluateVO;
import com.panzhihua.common.model.vos.community.ComActActRegistVO;
import com.panzhihua.common.model.vos.community.ComActActivityVO;
import com.panzhihua.common.model.vos.community.ComActCommiteeVO;
import com.panzhihua.common.model.vos.community.ComActDynVO;
import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO;
import com.panzhihua.common.model.vos.community.ComActMessageBackVO;
import com.panzhihua.common.model.vos.community.ComActMessageVO;
import com.panzhihua.common.model.vos.community.ComActMicroWishVO;
import com.panzhihua.common.model.vos.community.ComActReserveCommitVO;
import com.panzhihua.common.model.vos.community.ComActSocialOrgVO;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.ComActWorkGuideClassifyVO;
import com.panzhihua.common.model.vos.community.ComActWorkGuideVO;
import com.panzhihua.common.model.vos.community.ComCvtServeExcelVO;
import com.panzhihua.common.model.vos.community.ComElderAuthRecordImportExcelVO;
import com.panzhihua.common.model.vos.community.ComElderAuthRecordVO;
import com.panzhihua.common.model.vos.community.ComEldersAuthElderlyDetailsVO;
import com.panzhihua.common.model.vos.community.ComMngBuildingExcelVO;
import com.panzhihua.common.model.vos.community.ComMngCarExcelVO;
@@ -206,9 +243,11 @@
import com.panzhihua.common.model.vos.community.ComMngPopulationCultExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationDisabilityExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationDrugExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationElderExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationKeyExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationLowSecurityExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationMajorExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationPensionExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationRehabilitationExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationSentenceExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO;
@@ -226,6 +265,9 @@
import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO;
import com.panzhihua.common.model.vos.community.ComOpsHouseUndercarriageVO;
import com.panzhihua.common.model.vos.community.ComOpsHouseVO;
import com.panzhihua.common.model.vos.community.ComPensionAuthRecordImportExcelVO;
import com.panzhihua.common.model.vos.community.ComPensionAuthRecordVO;
import com.panzhihua.common.model.vos.community.ComPropertyVO;
import com.panzhihua.common.model.vos.community.ComStreetVO;
import com.panzhihua.common.model.vos.community.ComSwRotaExcelVO;
import com.panzhihua.common.model.vos.community.EldersAuthDetailsVO;
@@ -236,6 +278,7 @@
import com.panzhihua.common.model.vos.community.bigscreen.BigScreenStatisticPartyActivity;
import com.panzhihua.common.model.vos.community.bigscreen.BigScreenStatisticPartyBuild;
import com.panzhihua.common.model.vos.community.bigscreen.PartyBuildingMemberVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.questnaire.EditComActQuestnaireVo;
import com.panzhihua.common.model.vos.community.questnaire.QuestnaireVO;
import com.panzhihua.common.model.vos.community.questnaire.UsersAnswerQuestnaireVO;
@@ -6040,4 +6083,331 @@
     */
    @GetMapping("/wish/handle/list/admin")
    R wishHandleListAdmin(@RequestParam(value = "communityId") Long communityId,@RequestParam("type") Integer type);
    /**
     * 便民服务新增分类
     * @param convenientServiceCategoryDTO
     * @return
     */
    @PostMapping("/convenient/service-category/add")
    R addServiceCategory(@RequestBody ConvenientServiceCategoryDTO convenientServiceCategoryDTO);
    /**
     * 便民服务分类编辑
     * @param convenientServiceCategoryDTO
     * @return
     */
    @PutMapping("/convenient/service-category/put")
    R putServiceCategory(@RequestBody ConvenientServiceCategoryDTO convenientServiceCategoryDTO);
    /**
     * 便民服务分类删除
     * @param categoryId
     * @return
     */
    @DeleteMapping("/convenient/service-category/delete")
    R deleteServiceCategory(@RequestParam("categoryId") Long categoryId, @RequestParam("operator") Long operator);
    /**
     * 获取便民服务分类详情
     * @param categoryId
     * @return
     */
    @GetMapping("/convenient/service-category/get")
    R getServiceCategory(@RequestParam("categoryId") Long categoryId);
    /**
     * 分页查询便民服务分类
     * @param pageConvenientServiceCategoryDTO
     * @return
     */
    @PostMapping("/convenient/service-category/page")
    R pageServiceCategory(@RequestBody PageConvenientServiceCategoryDTO pageConvenientServiceCategoryDTO);
    /**
     * 便民服务新增商家
     * @param convenientMerchantDTO
     * @return
     */
    @PostMapping("/convenient/merchant/add")
    R addMerchant(@RequestBody ConvenientMerchantDTO convenientMerchantDTO);
    /**
     * 编辑便民服务商家
     * @param convenientMerchantDTO
     * @return
     */
    @PutMapping("/convenient/merchant/put")
    R putMerchant(@RequestBody ConvenientMerchantDTO convenientMerchantDTO);
    /**
     * 删除便民服务商家
     * @param merchantId
     * @param operator
     * @return
     */
    @DeleteMapping("/convenient/merchant/delete")
    R deleteMerchant(@RequestParam("merchantId") Long merchantId, @RequestParam("operator") Long operator);
    /**
     * 分页查询便民服务商家
     * @param pageConvenientMerchantDTO
     * @return
     */
    @PostMapping("/convenient/merchant/page")
    R pageMerchant(@RequestBody PageConvenientMerchantDTO pageConvenientMerchantDTO);
    /**
     * 获取便民服务商家详情
     * @param merchantId
     * @return
     */
    @GetMapping("/convenient/merchant/get")
    R getMerchant(@RequestParam("merchantId") Long merchantId);
    /**
     * 禁用/启用便民服务商家
     * @param disableOrEnableConvenientMerchantDTO
     * @return
     */
    @PutMapping("/convenient/merchant/disable-or-enable")
    R disableOrEnableMerchant(@RequestBody DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO);
    /**
     * 重置便民服务商家账号密码
     * @param resetPasswordConvenientMerchantDTO
     * @return
     */
    @PutMapping("/convenient/merchant/reset-password")
    R resetPasswordMerchant(@RequestBody ResetPasswordConvenientMerchantDTO resetPasswordConvenientMerchantDTO);
    /**
     * 获取所有便民服务分类
     * @return
     */
    @GetMapping("/convenient/service-category/all")
    R getAllServiceCategories();
    /**
     * 获取用户便民服务商家详情
     * @param account 商家绑定账号
     * @return
     */
    @GetMapping("/convenient/getUserMerchantInfoByAccount")
    R<ConvenientMerchantVO> getUserMerchantInfoByAccount(@RequestParam("account") String account);
    /**
     * 获取商便民服务商家信息
     * @param userId
     * @return
     */
    @GetMapping("/convenient/merchantInfo")
    R<ConvenientMerchantVO> getUserConvenientMerchantInfo(@RequestParam("userId") Long userId);
    /**
     * 新增便民服务产品分类信息
     * @param convenientProductCategoryDTO
     * @return
     */
    @PostMapping("/convenient/product-category/add")
    R addProductCategory(@RequestBody ConvenientProductCategoryDTO convenientProductCategoryDTO);
    /**
     * 编辑便民服务产品分类信息
     * @param convenientProductCategoryDTO
     * @return
     */
    @PutMapping("/convenient/product-category/put")
    R putProductCategory(@RequestBody ConvenientProductCategoryDTO convenientProductCategoryDTO);
    /**
     * 删除便民服务产品分类信息
     * @param categoryId
     * @param operator
     * @return
     */
    @DeleteMapping("/convenient/product-category/delete")
    R deleteProductCategory(@RequestParam("categoryId") Long categoryId, @RequestParam("operator") Long operator);
    /**
     * 获取便民服务产品分类详情
     * @param categoryId
     * @return
     */
    @GetMapping("/convenient/product-category/get")
    R getProductCategory(@RequestParam("categoryId") Long categoryId);
    /**
     * 分页查询便民服务产品分类信息
     * @param pageConvenientProductCategoryDTO
     * @return
     */
    @PostMapping("/convenient/product-category/page")
    R pageProductCategory(@RequestBody PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO);
    /**
     * 便民服务商家后台新增产品
     * @param convenientProductDTO
     * @return
     */
    @PostMapping("/convenient/product/add")
    R addProduct(@RequestBody ConvenientProductDTO convenientProductDTO);
    /**
     * 便民服务商家后台编辑产品
     * @param convenientProductDTO
     * @return
     */
    @PutMapping("/convenient/product/put")
    R putProduct(@RequestBody ConvenientProductDTO convenientProductDTO);
    /**
     * 便民服务商家后台获取产品详情
     * @param productId
     * @return
     */
    @GetMapping("/convenient/product/get")
    R getProduct(@RequestParam("productId") Long productId);
    /**
     * 便民服务商家后台分页获取产品信息
     * @param pageConvenientProductDTO
     * @return
     */
    @PostMapping("/convenient/product/page")
    R pageProduct(@RequestBody PageConvenientProductDTO pageConvenientProductDTO);
    /**
     * 便民服务商家后台删除产品信息
     * @param deleteConvenientProductDTO
     * @return
     */
    @DeleteMapping("/convenient/product/delete")
    R deleteProduct(@RequestBody DeleteConvenientProductDTO deleteConvenientProductDTO);
    /**
     * 便民服务商家后台上架/下架产品
     * @param onShelfOrOffShelfProductDTO
     * @return
     */
    @PutMapping("/convenient/product/onShelf-or-offShelf")
    R onShelfOrOffShelfProduct(@RequestBody OnShelfOrOffShelfProductDTO onShelfOrOffShelfProductDTO);
    /**
     * 获取所有产品分类
     * @return
     */
    @GetMapping("/convenient/product-category/all")
    R getAllProductCategory();
    /**
     * 获取该社区商家数量大于0的分类
     * @param communityId
     * @return
     */
    @GetMapping("/convenient/service-category/suitable")
    R getSuitableServiceCategories(@RequestParam("communityId") Long communityId);
    /**
     * 获取该社区下的热门商家
     * @param pagePopularMerchantDTO
     * @return
     */
    @PostMapping("/convenient/merchant/popular")
    R getPopularMerchants(@RequestBody PagePopularMerchantDTO pagePopularMerchantDTO);
    /**
     * 分页获取服务类型下商家信息
     * @param pageClassifyMerchantDTO
     * @return
     */
    @PostMapping("/convenient/merchant/classify")
    R getClassifyMerchants(@RequestBody PageClassifyMerchantDTO pageClassifyMerchantDTO);
    /**
     * 获取商家详情
     * @param merchantId
     * @return
     */
    @GetMapping("/convenient/merchant/detail")
    R getMerchantDetail(@RequestParam("merchantId") Long merchantId);
    /**
     * 获取商家产品
     * @param merchantId
     * @return
     */
    @GetMapping("/convenient/product/list")
    R getMerchantProduct(@RequestParam("merchantId") Long merchantId);
    /**
     * 获取产品详情
     * @param productId
     * @return
     */
    @GetMapping("/convenient/product/detail")
    R getProductDetail(@RequestParam("productId") Long productId);
    /**
     * 搜索商家信息
     * @param pageSearchDTO
     * @return
     */
    @PostMapping("/convenient/merchant/search")
    R pageSearchMerchant(@RequestBody PageSearchDTO pageSearchDTO);
    /**
     * 搜索商品信息
     * @param pageSearchDTO
     * @return
     */
    @PostMapping("/convenient/product/search")
    R pageSearchProduct(@RequestBody PageSearchDTO pageSearchDTO);
    /**
     * 增加商家店铺咨询量
     * @param merchantId
     * @return
     */
    @GetMapping("/convenient/merchant/consult")
    R consultMerchant(@RequestParam("merchantId") Long merchantId);
    /**
     * 增加产品浏览量
     * @param productId
     * @return
     */
    @GetMapping("/convenient/product/incr-view")
    R incrProductView(@RequestParam("productId") Long productId);
    /**
     * 获取商家导出数据
     * @param exportMerchantDTO
     * @return
     */
    @PostMapping("/convenient/merchant/export")
    R exportMerchant(@RequestBody ExportMerchantDTO exportMerchantDTO);
    /**
     * 增加商家店铺浏览量
     * @param merchantId
     * @return
     */
    @GetMapping("/convenient/merchant/incr-view")
    R incrMerchantView(@RequestParam("merchantId") Long merchantId);
    /**
     * 定时任务每隔半小时将商家浏览量和咨询量总值计入指定商家数据中
     * @return
     */
    @PostMapping("/convenient/timedTaskWriteDataToMerchantJobHandler")
    R timedTaskWriteDataToMerchantJobHandler();
    /**
     * 获取商家上下架产品数量
     * @param merchantId
     * @return
     */
    @GetMapping("/convenient/product/shelf-num")
    R getProductShelfNum(@RequestParam("merchantId") Long merchantId);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java
@@ -2,6 +2,8 @@
import java.util.List;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@@ -1017,4 +1019,29 @@
     */
    @GetMapping("checkIsTeam")
    R checkCurrentUserIsTeam(@RequestParam("phone") String phone, @RequestParam("communityId") Long communityId);
    /**
     * 便民服务新增商家账号
     * @param convenientMerchantDTO
     * @return 商家用户id
     */
    @PostMapping("insertMerchantAccount")
    R addConvenientMerchantUser(@RequestBody ConvenientMerchantDTO convenientMerchantDTO);
    /**
     * 修改便民服务商家绑定账号
     * @param userId
     * @param account
     * @return
     */
    @PutMapping("putMerchantUserAccount")
    R putUserAccount(@RequestParam("userId") Long userId, @RequestParam("account") String account);
    /**
     * 禁用/启用便民服务商家用户
     * @param disableOrEnableConvenientMerchantDTO
     * @return
     */
    @PutMapping("disableOrEnableMerchantUsers")
    R disableOrEnableMerchantUsers(@RequestBody DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java
@@ -1,7 +1,10 @@
package com.panzhihua.community_backstage.api;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
@@ -11,10 +14,20 @@
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONArray;
import com.jcraft.jsch.SftpException;
import com.panzhihua.common.constants.FtpConstants;
import com.panzhihua.common.controller.BaseController;
@@ -23,9 +36,18 @@
import com.panzhihua.common.model.dtos.community.ComCvtServeDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtBusinessDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtServeDTO;
import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.ComCvtBusinessVO;
import com.panzhihua.common.model.vos.community.ComCvtCategoryVO;
import com.panzhihua.common.model.vos.community.ComCvtServeExcelVO;
import com.panzhihua.common.model.vos.community.ComCvtServeVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.SFTPUtil;
@@ -74,6 +96,7 @@
    @Resource
    private MinioUtil minioUtil;
    @Deprecated
    @ApiOperation(value = "分页查询便民服务商家", response = ComCvtBusinessVO.class)
    @PostMapping("/business/page")
    public R pageComCvtBusiness(@RequestBody PageComCvtBusinessDTO pageComCvtBusinessDTO) {
@@ -82,6 +105,7 @@
        return communityService.pageComCvtBusiness(pageComCvtBusinessDTO);
    }
    @Deprecated
    @ApiOperation(value = "新增便民服务商家")
    @PostMapping("/business/add")
    public R addComCvtBusiness(@RequestBody @Validated(AddGroup.class) ComCvtBusinessDTO comCvtBusinessDTO) {
@@ -93,42 +117,49 @@
        return communityService.addComCvtBusiness(comCvtBusinessDTO);
    }
    @Deprecated
    @ApiOperation(value = "社区下拉列表", response = ComActVO.class)
    @GetMapping("/community")
    public R listCommunity() {
        return communityService.listCommunityAll();
    }
    @Deprecated
    @ApiOperation(value = "编辑便民服务商家")
    @PutMapping("/business/put")
    public R putComCvtBusiness(@Validated(AddGroup.class) @RequestBody ComCvtBusinessDTO comCvtBusinessDTO) {
        return communityService.putComCvtBusiness(comCvtBusinessDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务商家详情")
    @GetMapping("/business/get")
    public R getComCvtBusiness(@RequestParam("id") Long id) {
        return communityService.getComCvtBusiness(id);
    }
    @Deprecated
    @ApiOperation(value = "删除便民服务商家详情")
    @DeleteMapping("/business/delete")
    public R deleteComCvtBusiness(@RequestParam("id") Long id) {
        return communityService.deleteComCvtBusiness(id);
    }
    @Deprecated
    @ApiOperation(value = "分页查询便民服务", response = ComCvtServeVO.class)
    @PostMapping("/serve/page")
    public R pageComCvtServe(@RequestBody PageComCvtServeDTO pageComCvtServeDTO) {
        return communityService.pageComCvtServe(pageComCvtServeDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务所有分类,下拉框", response = ComCvtCategoryVO.class)
    @PostMapping("/category/all")
    public R allComCvtCategory() {
        return communityService.allComCvtCategory();
    }
    @Deprecated
    @ApiOperation(value = "新增便民服务")
    @PostMapping("/serve/add")
    public R addComCvtServe(@RequestBody ComCvtServeDTO comCvtServeDTO) {
@@ -138,24 +169,28 @@
        return communityService.addComCvtServe(comCvtServeDTO);
    }
    @Deprecated
    @ApiOperation(value = "编辑便民服务")
    @PutMapping("/serve/put")
    public R putComCvtServe(@RequestBody ComCvtServeDTO comCvtServeDTO) {
        return communityService.putComCvtServe(comCvtServeDTO);
    }
    @Deprecated
    @ApiOperation(value = "查询便民服务详情", response = ComCvtServeVO.class)
    @GetMapping("/serve/get")
    public R getComCvtServe(@RequestParam("id") Long id) {
        return communityService.getComCvtServe(id);
    }
    @Deprecated
    @ApiOperation(value = "删除便民服务信息")
    @DeleteMapping("/serve/delete")
    public R deleteComCvtServe(@RequestParam("id") Long id) {
        return communityService.deleteComCvtServe(id);
    }
    @Deprecated
    @ApiOperation(value = "下载模板-便民服务")
    @GetMapping(value = "/serve/download/template")
    public R downloadTemplate(HttpServletResponse response) throws IOException, SftpException {
@@ -214,4 +249,70 @@
        return R.ok();
    }
    @ApiOperation(value = "分页查询便民服务商家", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/page")
    public R pageMerchant(@RequestBody PageConvenientMerchantDTO pageConvenientMerchantDTO) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        pageConvenientMerchantDTO.setCommunityId(loginUserInfo.getCommunityId());
        return communityService.pageMerchant(pageConvenientMerchantDTO);
    }
    @ApiOperation(value = "所有服务分类", response = ConvenientServiceCategoryVO.class)
    @GetMapping("/service-category/all")
    public R getAllServiceCategories() {
        return communityService.getAllServiceCategories();
    }
    @ApiOperation(value = "便民服务商家导出")
    @PostMapping("/merchant/export")
    public R exportMerchant(@RequestBody ExportMerchantDTO exportMerchantDTO) {
        String url = excelUrl;
        String name = "便民服务商家.xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
        R r = communityService.exportMerchant(exportMerchantDTO);
        if (R.isOk(r)) {
            List<ExportMerchantVO> exportMerchantVOList =
                    JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ExportMerchantVO.class);
            try {
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ExportMerchantVO.class).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("便民服务商家导出").build();
                        excelWriter.write(exportMerchantVOList, writeSheet);
                        excelWriter.finish();
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        return R.fail("未查询到数据");
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java
@@ -5,14 +5,48 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.*;
import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.panzhihua.common.model.dtos.community.*;
import com.panzhihua.common.model.dtos.community.ComCvtBusinessDTO;
import com.panzhihua.common.model.dtos.community.ComCvtCategoryDTO;
import com.panzhihua.common.model.dtos.community.ComCvtServeDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtBusinessAppletsDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtBusinessDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtCategoryDTO;
import com.panzhihua.common.model.dtos.community.PageComCvtServeDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComCvtServeExcelVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.service_community.service.ComCvtBusinessService;
import com.panzhihua.service_community.service.ComCvtCategoryService;
import com.panzhihua.service_community.service.ComCvtServeService;
import com.panzhihua.service_community.service.ConvenientMerchantService;
import com.panzhihua.service_community.service.ConvenientProductCategoryService;
import com.panzhihua.service_community.service.ConvenientProductService;
import com.panzhihua.service_community.service.ConvenientServiceCategoryService;
import lombok.extern.slf4j.Slf4j;
@@ -34,6 +68,18 @@
    @Resource
    private ComCvtServeService comCvtServeService;
    @Resource
    private ConvenientServiceCategoryService convenientServiceCategoryService;
    @Resource
    private ConvenientMerchantService convenientMerchantService;
    @Resource
    private ConvenientProductCategoryService convenientProductCategoryService;
    @Resource
    private ConvenientProductService convenientProductService;
    /**
     * 社区后台分页查询便民服务商家
@@ -260,4 +306,412 @@
        @RequestParam(value = "communityId", required = false) Long communityId) {
        return comCvtServeService.listSaveConvenientServeExcelVO(list, communityId);
    }
    /**
     * 便民服务新增分类
     * @param convenientServiceCategoryDTO
     * @return
     */
    @PostMapping("/service-category/add")
    public R addServiceCategory(@RequestBody ConvenientServiceCategoryDTO convenientServiceCategoryDTO) {
        return convenientServiceCategoryService.addServiceCategory(convenientServiceCategoryDTO);
    }
    /**
     * 便民服务分类编辑
     * @param convenientServiceCategoryDTO
     * @return
     */
    @PutMapping("/service-category/put")
    public R putServiceCategory(@RequestBody ConvenientServiceCategoryDTO convenientServiceCategoryDTO) {
        return convenientServiceCategoryService.putServiceCategory(convenientServiceCategoryDTO);
    }
    /**
     * 便民服务分类删除
     * @param categoryId
     * @return
     */
    @DeleteMapping("/service-category/delete")
    public R deleteServiceCategory(@RequestParam("categoryId") Long categoryId, @RequestParam("operator") Long operator) {
        return convenientServiceCategoryService.deleteServiceCategoryById(categoryId, operator);
    }
    /**
     * 获取便民服务分类详情
     * @param categoryId
     * @return
     */
    @GetMapping("/service-category/get")
    public R getServiceCategory(@RequestParam("categoryId") Long categoryId) {
        return convenientServiceCategoryService.getServiceCategoryById(categoryId);
    }
    /**
     * 分页查询便民服务分类
     * @param pageConvenientServiceCategoryDTO
     * @return
     */
    @PostMapping("/service-category/page")
    public R pageServiceCategory(@RequestBody PageConvenientServiceCategoryDTO pageConvenientServiceCategoryDTO) {
        return convenientServiceCategoryService.pageServiceCategory(pageConvenientServiceCategoryDTO);
    }
    /**
     * 便民服务新增商家
     * @param convenientMerchantDTO
     * @return
     */
    @PostMapping("/merchant/add")
    public R addMerchant(@RequestBody ConvenientMerchantDTO convenientMerchantDTO) {
        return convenientMerchantService.addMerchant(convenientMerchantDTO);
    }
    /**
     * 编辑便民服务商家
     * @param convenientMerchantDTO
     * @return
     */
    @PutMapping("/merchant/put")
    public R putMerchant(@RequestBody ConvenientMerchantDTO convenientMerchantDTO) {
        return convenientMerchantService.putMerchant(convenientMerchantDTO);
    }
    /**
     * 删除便民服务商家
     * @param merchantId
     * @return
     */
    @DeleteMapping("/merchant/delete")
    public R deleteMerchant(@RequestParam("merchantId") Long merchantId, @RequestParam("operator") Long operator) {
        return convenientMerchantService.deleteMerchant(merchantId, operator);
    }
    /**
     * 分页查询便民服务商家
     * @param pageConvenientMerchantDTO
     * @return
     */
    @PostMapping("/merchant/page")
    public R pageMerchant(@RequestBody PageConvenientMerchantDTO pageConvenientMerchantDTO) {
        return convenientMerchantService.pageMerchant(pageConvenientMerchantDTO);
    }
    /**
     * 获取便民服务商家详情
     * @param merchantId
     * @return
     */
    @GetMapping("/merchant/get")
    public R getMerchant(@RequestParam("merchantId") Long merchantId) {
        return convenientMerchantService.getMerchant(merchantId);
    }
    /**
     * 禁用/启用便民服务商家
     * @param disableOrEnableConvenientMerchantDTO
     * @return
     */
    @PutMapping("/merchant/disable-or-enable")
    public R disableOrEnableMerchant(@RequestBody DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO) {
        return convenientMerchantService.disableOrEnableMerchant(disableOrEnableConvenientMerchantDTO);
    }
    /**
     * 重置便民服务商家账号密码
     * @param resetPasswordConvenientMerchantDTO
     * @return
     */
    @PutMapping("/merchant/reset-password")
    public R resetPasswordMerchant(@RequestBody ResetPasswordConvenientMerchantDTO resetPasswordConvenientMerchantDTO) {
        return convenientMerchantService.resetPasswordMerchant(resetPasswordConvenientMerchantDTO);
    }
    /**
     * 获取所有便民服务分类
     * @return
     */
    @GetMapping("/service-category/all")
    public R getAllServiceCategories() {
        return convenientServiceCategoryService.getAllServiceCategories();
    }
    /**
     * 获取用户便民服务商家详情
     * @param account 商家绑定账号
     * @return
     */
    @GetMapping("/getUserMerchantInfoByAccount")
    public R<ConvenientMerchantVO> getUserMerchantInfoByAccount(@RequestParam("account") String account) {
        return convenientMerchantService.getUserMerchantInfoByAccount(account);
    }
    /**
     * 获取商便民服务商家信息
     * @param userId
     * @return
     */
    @GetMapping("/merchantInfo")
    public R<ConvenientMerchantVO> getUserConvenientMerchantInfo(@RequestParam("userId") Long userId) {
        return convenientMerchantService.getUserConvenientMerchantInfo(userId);
    }
    /**
     * 新增便民服务产品分类信息
     * @param convenientProductCategoryDTO
     * @return
     */
    @PostMapping("/product-category/add")
    public R addProductCategory(@RequestBody ConvenientProductCategoryDTO convenientProductCategoryDTO) {
        return convenientProductCategoryService.addProductCategory(convenientProductCategoryDTO);
    }
    /**
     * 编辑便民服务产品分类信息
     * @param convenientProductCategoryDTO
     * @return
     */
    @PutMapping("/product-category/put")
    public R putProductCategory(@RequestBody ConvenientProductCategoryDTO convenientProductCategoryDTO) {
        return convenientProductCategoryService.putProductCategory(convenientProductCategoryDTO);
    }
    /**
     * 删除便民服务产品分类信息
     * @param categoryId
     * @param operator
     * @return
     */
    @DeleteMapping("/product-category/delete")
    public R deleteProductCategory(@RequestParam("categoryId") Long categoryId, @RequestParam("operator") Long operator) {
        return convenientProductCategoryService.deleteProductCategory(categoryId, operator);
    }
    /**
     * 获取便民服务产品分类详情
     * @param categoryId
     * @return
     */
    @GetMapping("/product-category/get")
    public R getProductCategory(@RequestParam("categoryId") Long categoryId) {
        return convenientProductCategoryService.getProductCategory(categoryId);
    }
    /**
     * 分页查询便民服务产品分类信息
     * @param pageConvenientProductCategoryDTO
     * @return
     */
    @PostMapping("/product-category/page")
    public R pageProductCategory(@RequestBody PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO) {
        return convenientProductCategoryService.pageProductCategory(pageConvenientProductCategoryDTO);
    }
    /**
     * 便民服务商家后台新增产品
     * @param convenientProductDTO
     * @return
     */
    @PostMapping("/product/add")
    public R addProduct(@RequestBody ConvenientProductDTO convenientProductDTO) {
        return convenientProductService.addProduct(convenientProductDTO);
    }
    /**
     * 便民服务商家后台编辑产品
     * @param convenientProductDTO
     * @return
     */
    @PutMapping("/product/put")
    public R putProduct(@RequestBody ConvenientProductDTO convenientProductDTO) {
        return convenientProductService.putProduct(convenientProductDTO);
    }
    /**
     * 便民服务商家后台获取产品详情
     * @param productId
     * @return
     */
    @GetMapping("/product/get")
    public R getProduct(@RequestParam("productId") Long productId) {
        return convenientProductService.getProduct(productId);
    }
    /**
     * 便民服务商家后台分页获取产品信息
     * @param pageConvenientProductDTO
     * @return
     */
    @PostMapping("/product/page")
    public R pageProduct(@RequestBody PageConvenientProductDTO pageConvenientProductDTO) {
        return convenientProductService.pageProduct(pageConvenientProductDTO);
    }
    /**
     * 便民服务商家后台删除产品信息
     * @param deleteConvenientProductDTO
     * @return
     */
    @DeleteMapping("/product/delete")
    public R deleteProduct(@RequestBody DeleteConvenientProductDTO deleteConvenientProductDTO) {
        return convenientProductService.deleteProduct(deleteConvenientProductDTO);
    }
    /**
     * 便民服务商家后台上架/下架产品
     * @param onShelfOrOffShelfProductDTO
     * @return
     */
    @PutMapping("/product/onShelf-or-offShelf")
    public R onShelfOrOffShelfProduct(@RequestBody OnShelfOrOffShelfProductDTO onShelfOrOffShelfProductDTO) {
        return convenientProductService.onShelfOrOffShelfProduct(onShelfOrOffShelfProductDTO);
    }
    /**
     * 获取所有产品分类
     * @return
     */
    @GetMapping("/product-category/all")
    public R getAllProductCategory() {
        return convenientProductCategoryService.getAllProductCategory();
    }
    /**
     * 获取该社区商家数量大于0的分类
     * @param communityId
     * @return
     */
    @GetMapping("/service-category/suitable")
    public R getSuitableServiceCategories(@RequestParam("communityId") Long communityId) {
        return convenientServiceCategoryService.getSuitableServiceCategories(communityId);
    }
    /**
     * 获取该社区下的热门商家
     * @param pagePopularMerchantDTO
     * @return
     */
    @PostMapping("/merchant/popular")
    public R getPopularMerchants(@RequestBody PagePopularMerchantDTO pagePopularMerchantDTO) {
        return convenientMerchantService.getPopularMerchants(pagePopularMerchantDTO);
    }
    /**
     * 分页获取服务类型下商家信息
     * @param pageClassifyMerchantDTO
     * @return
     */
    @PostMapping("/merchant/classify")
    public R getClassifyMerchants(@RequestBody PageClassifyMerchantDTO pageClassifyMerchantDTO) {
        return convenientMerchantService.getClassifyMerchants(pageClassifyMerchantDTO);
    }
    /**
     * 小程序获取商家详情
     * @param merchantId
     * @return
     */
    @GetMapping("/merchant/detail")
    public R getMerchantDetail(@RequestParam("merchantId") Long merchantId) {
        return convenientMerchantService.getMerchantDetail(merchantId);
    }
    /**
     * 小程序获取商家产品
     * @param merchantId
     * @return
     */
    @GetMapping("/product/list")
    public R getMerchantProduct(@RequestParam("merchantId") Long merchantId) {
        return convenientProductService.getMerchantProduct(merchantId);
    }
    /**
     * 获取产品详情
     * @param productId
     * @return
     */
    @GetMapping("/product/detail")
    public R getProductDetail(@RequestParam("productId") Long productId) {
        return convenientProductService.getProduct(productId);
    }
    /**
     * 搜索商家信息
     * @param pageSearchDTO
     * @return
     */
    @PostMapping("/merchant/search")
    public R pageSearchMerchant(@RequestBody PageSearchDTO pageSearchDTO) {
        return convenientMerchantService.pageSearchMerchant(pageSearchDTO);
    }
    /**
     * 搜索商品信息
     * @param pageSearchDTO
     * @return
     */
    @PostMapping("/product/search")
    public R pageSearchProduct(@RequestBody PageSearchDTO pageSearchDTO) {
        return convenientProductService.pageSearchProduct(pageSearchDTO);
    }
    /**
     * 增加商家店铺咨询量
     * @param merchantId
     * @return
     */
    @GetMapping("/merchant/consult")
    public R consultMerchant(@RequestParam("merchantId") Long merchantId) {
        return convenientMerchantService.consultMerchant(merchantId);
    }
    /**
     * 增加商家店铺浏览量
     * @param merchantId
     * @return
     */
    @GetMapping("/merchant/incr-view")
    public R incrMerchantView(@RequestParam("merchantId") Long merchantId) {
        return convenientMerchantService.incrMerchantView(merchantId);
    }
    /**
     * 增加产品浏览量
     * @param productId
     * @return
     */
    @GetMapping("/product/incr-view")
    public R incrProductView(@RequestParam("productId") Long productId) {
        return convenientProductService.incrProductView(productId);
    }
    /**
     * 获取商家导出数据
     * @param exportMerchantDTO
     * @return
     */
    @PostMapping("/merchant/export")
    public R exportMerchant(@RequestBody ExportMerchantDTO exportMerchantDTO) {
        return convenientMerchantService.exportMerchant(exportMerchantDTO);
    }
    /**
     * 定时任务每隔半小时将商家浏览量和咨询量总值计入指定商家数据中
     * @return
     */
    @PostMapping("/timedTaskWriteDataToMerchantJobHandler")
    public R timedTaskWriteDataToMerchantJobHandler() {
        return convenientMerchantService.timedTaskWriteDataToMerchantJobHandler();
    }
    /**
     * 获取商家上下架产品数量
     * @param merchantId
     * @return
     */
    @GetMapping("/product/shelf-num")
    public R getProductShelfNum(@RequestParam("merchantId") Long merchantId) {
        return convenientProductService.getProductShelfNum(merchantId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientConsultationStatisticsDAO.java
New file
@@ -0,0 +1,58 @@
package com.panzhihua.service_community.dao;
import com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.service_community.model.dos.ConvenientConsultationStatisticsDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @title: ConvenientConsultationStatisticsDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家咨询量统计DAO
 * @author: hans
 * @date: 2021/09/23 13:55
 */
@Mapper
public interface ConvenientConsultationStatisticsDAO extends BaseMapper<ConvenientConsultationStatisticsDO> {
    /**
     * 创建当天统计数据
     * @param merchantId
     * @return
     */
    int createTodayStatistic(@Param("merchantId") Long merchantId);
    /**
     * 增加当天浏览量
     * @param merchantId
     * @param nowDate
     * @return
     */
    int incrConsultationNum(@Param("merchantId") Long merchantId, @Param("nowDate") String nowDate);
    /**
     * 获取月咨询量
     * @param merchantId
     * @param moth
     * @return
     */
    int selectMonthConsultationVolume(@Param("merchantId") Long merchantId, @Param("moth") String moth);
    /**
     * 获取当天咨询量
     * @param merchantId
     * @param day
     * @return
     */
    int selectDayConsultationVolume(@Param("merchantId") Long merchantId, @Param("day") String day);
    /**
     * 获取商家总咨询量
     * @return
     */
    List<ConvenientConsultationStatisticsVO> selectSumForConsultationNum();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientMerchantDAO.java
New file
@@ -0,0 +1,117 @@
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientViewStatisticsVO;
import com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.service_community.model.dos.ConvenientMerchantDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @title: ConvenientMerchantDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家DAO
 * @author: hans
 * @date: 2021/09/16 16:13
 */
@Mapper
public interface ConvenientMerchantDAO extends BaseMapper<ConvenientMerchantDO> {
    /**
     * 删除便民服务商家
     * @param merchantId
     * @param operator
     * @return
     */
    int deleteMerchantById(@Param("merchantId") Long merchantId, @Param("operator") Long operator);
    /**
     * 分页查询便民服务商家
     * @param page 分页参数
     * @param pageConvenientMerchantDTO
     * @return
     */
    IPage<ConvenientMerchantVO> pageMerchant(@Param("page") Page page,
                                             @Param("pageConvenientMerchantDTO") PageConvenientMerchantDTO pageConvenientMerchantDTO);
    /**
     * 查询商家信息
     * @param merchantId
     * @return
     */
    ConvenientMerchantVO selectMerchantById(@Param("merchantId") Long merchantId);
    /**
     * 获取社区下热门商家
     *
     * @param page
     * @param communityId
     * @param currentMon
     * @return
     */
    IPage<ConvenientMerchantVO> getPopularMerchants(@Param("page") Page page, @Param("communityId") Long communityId, @Param("currentMon") String currentMon);
    /**
     * 获取指定类型的商家
     * @param page
     * @param pageClassifyMerchantDTO
     * @param currentMon
     * @return
     */
    IPage<ConvenientMerchantVO> getClassifyMerchants(@Param("page") Page page, @Param("pageClassifyMerchantDTO") PageClassifyMerchantDTO pageClassifyMerchantDTO, @Param("currentMon") String currentMon);
    /**
     * 获取商家详情
     * @param merchantId
     * @param currentMon
     * @return
     */
    ConvenientMerchantVO getMerchantDetail(@Param("merchantId") Long merchantId, @Param("currentMon") String currentMon);
    /**
     * 分页搜索商家信息
     * @param page
     * @param pageSearchDTO
     * @param currentMon
     * @return
     */
    IPage<ConvenientMerchantVO> pageSearchMerchant(@Param("page") Page page, @Param("pageSearchDTO") PageSearchDTO pageSearchDTO, @Param("currentMon") String currentMon);
    /**
     * 根据查询条件获取商家导出数据
     * @param exportMerchantDTO
     * @return
     */
    List<ExportMerchantVO> exportMerchantBySearch(@Param("exportMerchantDTO") ExportMerchantDTO exportMerchantDTO);
    /**
     * 批量更新商家咨询量
     * @param consultationVOList
     * @return
     */
    int batchUpdateMerchantConsultationNum(@Param("consultationVOList") List<ConvenientConsultationStatisticsVO> consultationVOList);
    /**
     * 批量更新商家浏览量
     * @param viewVOList
     * @return
     */
    int batchUpdateMerchantViewNum(@Param("viewVOList") List<ConvenientViewStatisticsVO> viewVOList);
    /**
     * 根据指定id获取商家导出数据
     * @param needExportIds
     * @return
     */
    List<ExportMerchantVO> exportMerchantByIds(@Param("needExportIds") List<Long> needExportIds);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductCategoryDAO.java
New file
@@ -0,0 +1,37 @@
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO;
import com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @title: ConvenientProductCategoryDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务产品分类DAO
 * @author: hans
 * @date: 2021/09/20 16:16
 */
@Mapper
public interface ConvenientProductCategoryDAO extends BaseMapper<ConvenientProductCategoryDO> {
    /**
     * 分页查询便民服务产品分类
     * @param page 分页参数
     * @param pageConvenientProductCategoryDTO
     * @return 产品分类详情
     */
    IPage<ConvenientProductCategoryVO> pageProductCategory(@Param("page") Page page, @Param("pageConvenientProductCategoryDTO") PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO);
    /**
     * 查询所有分类
     * @return
     */
    List<ConvenientProductCategoryVO> selectAllCategories();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductDAO.java
New file
@@ -0,0 +1,79 @@
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductSpecificationVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO;
import com.panzhihua.service_community.model.dos.ConvenientProductDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @title: ConvenientProductDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家后台产品DAO
 * @author: hans
 * @date: 2021/09/21 21:35
 */
@Mapper
public interface ConvenientProductDAO extends BaseMapper<ConvenientProductDO> {
    /**
     * 分页查询产品
     *
     * @param page
     * @param pageConvenientProductDTO
     * @return
     */
    IPage<ConvenientProductVO> pageProduct(@Param("page") Page page, @Param("pageConvenientProductDTO") PageConvenientProductDTO pageConvenientProductDTO);
    /**
     * 批量删除产品
     * @param needDelIds
     * @return
     */
    int batchDeleteByIds(@Param("needDelIds") List<Long> needDelIds);
    /**
     * 批量上架
     * @param needDealIds
     * @param updatedBy
     * @param saleStatus
     * @return
     */
    int batchOnShelfOrOffShelfByIds(@Param("needDealIds") List<Long> needDealIds, @Param("updatedBy") Long updatedBy, @Param("saleStatus") boolean saleStatus);
    /**
     * 小程序获取商家产品
     * @param merchantId
     * @return
     */
    List<ConvenientProductVO> getMerchantProduct(@Param("merchantId") Long merchantId);
    /**
     * 获取产品规格
     * @param merchantId
     * @return
     */
    List<ConvenientProductSpecificationVO> getProductSpecifications(@Param("merchantId") Long merchantId);
    /**
     * 分页搜索产品信息
     * @param page
     * @param pageSearchDTO
     * @return
     */
    IPage<ConvenientProductVO> pageSearchProduct(@Param("page") Page page, @Param("pageSearchDTO") PageSearchDTO pageSearchDTO);
    /**
     * 增加产品浏览量
     * @param productId
     * @return
     */
    int incrProductView(@Param("productId") Long productId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductSpecificationDAO.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.service_community.model.dos.ConvenientProductSpecificationDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @title: ConvenientProductSpecificationDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务产品分类DAO
 * @author: hans
 * @date: 2021/09/21 21:56
 */
@Mapper
public interface ConvenientProductSpecificationDAO extends BaseMapper<ConvenientProductSpecificationDO> {
    /**
     * 批量插入产品规格
     * @param productSpecificationDOList
     * @return
     */
    int batchInsert(@Param("productSpecificationDOList") List<ConvenientProductSpecificationDO> productSpecificationDOList);
    /**
     * 删除传入ID以外的关联
     * @param notNeedDelIds
     * @return
     */
    int deleteLoseRelationSpecifications(@Param("notNeedDelIds") List<Long> notNeedDelIds);
    /**
     * 通过产品ID删除相关规格
     * @param needDelProductIds
     * @return
     */
    int batchDeleteByProductIds(@Param("needDelProductIds") List<Long> needDelProductIds);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientServiceCategoryDAO.java
New file
@@ -0,0 +1,77 @@
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @title: ConvenientServiceCategoryDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务分类DAO
 * @author: hans
 * @date: 2021/09/16 10:55
 */
@Mapper
public interface ConvenientServiceCategoryDAO extends BaseMapper<ConvenientServiceCategoryDO> {
    /**
     * 分页查询便民服务分类
     * @param page 分页参数
     * @param pageConvenientServiceCategoryDTO
     * @return 服务分类详情
     */
    IPage<ConvenientServiceCategoryVO> pageServiceCategory(@Param("page") Page page, @Param("pageConvenientServiceCategoryDTO")
                                                           PageConvenientServiceCategoryDTO pageConvenientServiceCategoryDTO);
    /**
     * 创建商家服务类型关系
     * @param merchantId
     * @param serviceId
     * @param name
     * @param createdBy
     * @return
     */
    int createMerchantServiceRelation(@Param("merchantId") Long merchantId, @Param("serviceId") Long serviceId,
                                      @Param("name") String name, @Param("createdBy") Long createdBy);
    /**
     * 删除商家服务类型关系
     * @param merchantId
     * @return
     */
    int deleteMerchantServiceRelation(@Param("merchantId") Long merchantId);
    /**
     * 获取商家服务范围
     * @param merchantId
     * @return
     */
    String selectServiceScopeByMerchantId(@Param("merchantId") Long merchantId);
    /**
     * 获取商家服务类型
     * @param merchantId
     * @return serviceIds
     */
    List<Long> selectServiceIdsForMerchant(@Param("merchantId") Long merchantId);
    /**
     * 查看服务分类是否被引用
     * @param categoryId
     * @return
     */
    int checkCategoryIsUsing(@Param("categoryId") Long categoryId);
    /**
     * 获取该社区商家数量大于0的分类
     * @param communityId
     * @return
     */
    List<ConvenientServiceCategoryVO> selectSuitableServiceCategories(@Param("communityId") Long communityId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientViewStatisticsDAO.java
New file
@@ -0,0 +1,58 @@
package com.panzhihua.service_community.dao;
import com.panzhihua.common.model.vos.community.convenient.ConvenientViewStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.service_community.model.dos.ConvenientViewStatisticsDO;
import java.util.List;
/**
 * @title: ConvenientViewStatisticsDAO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家浏览量统计DAO
 * @author: hans
 * @date: 2021/09/23 16:53
 */
@Mapper
public interface ConvenientViewStatisticsDAO extends BaseMapper<ConvenientViewStatisticsDO> {
    /**
     * 创建当天统计数据
     * @param merchantId
     * @return
     */
    int createTodayStatistic(@Param("merchantId") Long merchantId);
    /**
     * 增加当天浏览量
     * @param merchantId
     * @param nowDate
     * @return
     */
    int incrViewNum(@Param("merchantId") Long merchantId, @Param("nowDate") String nowDate);
    /**
     * 获取月浏览量
     * @param merchantId
     * @param moth
     * @return
     */
    int selectMonthViewNum(@Param("merchantId") Long merchantId, @Param("moth") String moth);
    /**
     * 获取当天浏览量
     * @param merchantId
     * @param day
     * @return
     */
    int selectDayViewNum(@Param("merchantId") Long merchantId, @Param("day") String day);
    /**
     * 获取商家总浏览量
     * @return
     */
    List<ConvenientViewStatisticsVO> selectSumForViewNum();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientConsultationStatisticsDO.java
New file
@@ -0,0 +1,42 @@
package com.panzhihua.service_community.model.dos;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
 * @title: ConvenientConsultationStatisticsDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家咨询量统计DO
 * @author: hans
 * @date: 2021/09/23 13:56
 */
@Data
@TableName(value = "com_convenient_consultation_statistics")
public class ConvenientConsultationStatisticsDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 商家id
     */
    private Long merchantId;
    /**
     * 统计日期
     */
    private Date statisticDate;
    /**
     * 咨询量
     */
    private Integer consultationVolume;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientMerchantDO.java
New file
@@ -0,0 +1,122 @@
package com.panzhihua.service_community.model.dos;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
 * @title: ConvenientMerchantDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家DO
 * @author: hans
 * @date: 2021/09/16 16:04
 */
@Data
@TableName(value = "com_convenient_merchants")
public class ConvenientMerchantDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 商家名称
     */
    private String name;
    /**
     * 社区id
     */
    private Long communityId;
    /**
     * 社区名称
     */
    private String communityName;
    /**
     * 商家logo
     */
    private String logo;
    /**
     * 联系人
     */
    private String contacts;
    /**
     * 身份证号码
     */
    private String idCard;
    /**
     * 咨询电话
     */
    private String phone;
    /**
     * 商家地址
     */
    private String address;
    /**
     * 纬度
     */
    private String lat;
    /**
     * 经度
     */
    private String lon;
    /**
     * 营业开始时间
     */
    private Date beginAt;
    /**
     * 营业截止时间
     */
    private Date endAt;
    /**
     * 营业周期
     */
    private String period;
    /**
     * 商家介绍
     */
    private String introduction;
    /**
     * 营业状态
     */
    private Boolean businessStatus;
    /**
     * 商家绑定用户id
     */
    private Long userId;
    /**
     * 咨询量
     */
    private Integer consultationVolume;
    /**
     * 浏览量
     */
    private Integer viewNum;
    /**
     * 是否删除
     */
    private Boolean isDel;
    /**
     * 创建时间
     */
    private Date createdAt;
    /**
     * 创建人
     */
    private Long createdBy;
    /**
     * 更新时间
     */
    private Date updatedAt;
    /**
     * 更新人
     */
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductCategoryDO.java
New file
@@ -0,0 +1,61 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @title: ConvenientProductCategoryDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务产品分类DO
 * @author: hans
 * @date: 2021/09/20 16:12
 */
@Data
@TableName(value = "com_convenient_product_categories")
public class ConvenientProductCategoryDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 分类名称
     */
    private String name;
    /**
     * 备注
     */
    private String remark;
    /**
     * 权重
     */
    private Integer weight;
    /**
     * 是否删除
     */
    private Boolean isDel;
    /**
     * 创建时间
     */
    private Date createdAt;
    /**
     * 创建人
     */
    private Long createdBy;
    /**
     * 更新时间
     */
    private Date updatedAt;
    /**
     * 更新人
     */
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductDO.java
New file
@@ -0,0 +1,73 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @title: ConvenientProductDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家DO
 * @author: hans
 * @date: 2021/09/16 21:01
 */
@Data
@TableName(value = "com_convenient_products")
public class ConvenientProductDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 产品名称
     */
    private String name;
    /**
     * 产品分类id
     */
    private Long categoryId;
    /**
     * 产品所属商家
     */
    private Long merchantId;
    /**
     * 是否上架
     */
    private Boolean onShelf;
    /**
     * 产品介绍
     */
    private String introduction;
    /**
     * 是否删除
     */
    private Boolean isDel;
    /**
     * 浏览量
     */
    private Integer viewNum;
    /**
     * 创建时间
     */
    private Date createdAt;
    /**
     * 创建人
     */
    private Long createdBy;
    /**
     * 更新时间
     */
    private Date updatedAt;
    /**
     * 更新人
     */
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductSpecificationDO.java
New file
@@ -0,0 +1,66 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @title: ConvenientProductSpecificationDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务产品分类DO
 * @author: hans
 * @date: 2021/09/21 22:08
 */
@Data
@TableName(value = "com_convenient_product_specifications")
public class ConvenientProductSpecificationDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 规格名称
     */
    private String name;
    /**
     * 价格
     */
    private BigDecimal price;
    /**
     * 产品规格图片
     */
    private String image;
    /**
     * 所属产品ID
     */
    private Long productId;
    /**
     * 是否删除
     */
    private Boolean isDel;
    /**
     * 创建时间
     */
    private Date createdAt;
    /**
     * 创建人
     */
    private Long createdBy;
    /**
     * 更新时间
     */
    private Date updatedAt;
    /**
     * 更新人
     */
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientServiceCategoryDO.java
New file
@@ -0,0 +1,68 @@
package com.panzhihua.service_community.model.dos;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
 * @title: ConvenientServiceCategoryDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务分类DO
 * @author: hans
 * @date: 2021/09/16 10:35
 */
@Data
@TableName(value = "com_convenient_service_categories")
public class ConvenientServiceCategoryDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 分类名称
     */
    private String name;
    /**
     * 分类图标
     */
    private String icon;
    /**
     * 备注
     */
    private String remark;
    /**
     * 权重
     */
    private Integer weight;
    /**
     * 是否删除
     */
    private Boolean isDel;
    /**
     * 创建时间
     */
    private Date createdAt;
    /**
     * 创建人
     */
    private Long createdBy;
    /**
     * 更新时间
     */
    private Date updatedAt;
    /**
     * 更新人
     */
    private Long updatedBy;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientViewStatisticsDO.java
New file
@@ -0,0 +1,42 @@
package com.panzhihua.service_community.model.dos;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
 * @title: ConvenientViewStatisticsDO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家浏览量统计DO
 * @author: hans
 * @date: 2021/09/23 16:54
 */
@Data
@TableName(value = "com_convenient_view_statistics")
public class ConvenientViewStatisticsDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 商家id
     */
    private Long merchantId;
    /**
     * 统计日期
     */
    private Date statisticDate;
    /**
     * 浏览量
     */
    private Integer viewNum;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientMerchantService.java
New file
@@ -0,0 +1,142 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.service_community.model.dos.ConvenientMerchantDO;
/**
 * @title: ConvenientMerchantService
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家服务类
 * @author: hans
 * @date: 2021/09/16 16:02
 */
public interface ConvenientMerchantService extends IService<ConvenientMerchantDO> {
    /**
     * 便民服务新增商家
     * @param convenientMerchantDTO
     * @return 新增结果
     */
    R addMerchant(ConvenientMerchantDTO convenientMerchantDTO);
    /**
     * 编辑便民服务商家
     * @param convenientMerchantDTO
     * @return
     */
    R putMerchant(ConvenientMerchantDTO convenientMerchantDTO);
    /**
     * 删除便民服务商家
     * @param merchantId 商家id
     * @param operator 操作人员
     * @return
     */
    R deleteMerchant(Long merchantId, Long operator);
    /**
     * 分页查询便民服务商家
     * @param pageConvenientMerchantDTO
     * @return
     */
    R pageMerchant(PageConvenientMerchantDTO pageConvenientMerchantDTO);
    /**
     * 获取便民服务商家详情
     * @param merchantId
     * @return
     */
    R getMerchant(Long merchantId);
    /**
     * 禁用/启用便民服务商家
     * @param disableOrEnableConvenientMerchantDTO
     * @return
     */
    R disableOrEnableMerchant(DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO);
    /**
     * 重置便民服务商家账号密码
     * @param resetPasswordConvenientMerchantDTO
     * @return
     */
    R resetPasswordMerchant(ResetPasswordConvenientMerchantDTO resetPasswordConvenientMerchantDTO);
    /**
     * 获取用户便民服务商家详情
     * @param account 商家绑定账号
     * @return
     */
    R<ConvenientMerchantVO> getUserMerchantInfoByAccount(String account);
    /**
     * 获取商便民服务商家信息
     * @param userId
     * @return
     */
    R<ConvenientMerchantVO> getUserConvenientMerchantInfo(Long userId);
    /**
     * 获取该社区下的热门商家
     * @param pagePopularMerchantDTO
     * @return
     */
    R getPopularMerchants(PagePopularMerchantDTO pagePopularMerchantDTO);
    /**
     * 分页获取服务类型下商家信息
     * @param pageClassifyMerchantDTO
     * @return
     */
    R getClassifyMerchants(PageClassifyMerchantDTO pageClassifyMerchantDTO);
    /**
     * 小程序获取商家详情
     * @param merchantId
     * @return
     */
    R getMerchantDetail(Long merchantId);
    /**
     * 搜索商家信息
     * @param pageSearchDTO
     * @return
     */
    R pageSearchMerchant(PageSearchDTO pageSearchDTO);
    /**
     * 增加商家店铺咨询量
     * @param merchantId
     * @return
     */
    R consultMerchant(Long merchantId);
    /**
     * 增加商家店铺浏览量
     * @param merchantId
     * @return
     */
    R incrMerchantView(Long merchantId);
    /**
     * 获取商家导出数据
     * @param exportMerchantDTO
     * @return
     */
    R exportMerchant(ExportMerchantDTO exportMerchantDTO);
    /**
     * 定时任务每隔半小时将商家浏览量和咨询量总值计入指定商家数据中
     * @return
     */
    R timedTaskWriteDataToMerchantJobHandler();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientProductCategoryService.java
New file
@@ -0,0 +1,59 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO;
/**
 * @title: ConvenientProductCategoryService
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务产品服务类
 * @author: hans
 * @date: 2021/09/20 15:36
 */
public interface ConvenientProductCategoryService extends IService<ConvenientProductCategoryDO> {
    /**
     * 新增便民服务产品分类信息
     * @param convenientProductCategoryDTO
     * @return
     */
    R addProductCategory(ConvenientProductCategoryDTO convenientProductCategoryDTO);
    /**
     * 编辑便民服务产品分类信息
     * @param convenientProductCategoryDTO
     * @return
     */
    R putProductCategory(ConvenientProductCategoryDTO convenientProductCategoryDTO);
    /**
     * 删除便民服务产品分类信息
     * @param categoryId
     * @param operator
     * @return
     */
    R deleteProductCategory(Long categoryId, Long operator);
    /**
     * 获取便民服务产品分类详情
     * @param categoryId
     * @return
     */
    R getProductCategory(Long categoryId);
    /**
     * 分页查询便民服务产品分类信息
     * @param pageConvenientProductCategoryDTO
     * @return
     */
    R pageProductCategory(PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO);
    /**
     * 获取所有产品分类
     * @return
     */
    R getAllProductCategory();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientProductService.java
New file
@@ -0,0 +1,90 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.ConvenientProductDO;
/**
 * @title: ConvenientProductService
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家后台产品服务类
 * @author: hans
 * @date: 2021/09/21 21:02
 */
public interface ConvenientProductService extends IService<ConvenientProductDO> {
    /**
     * 便民服务商家后台新增产品
     * @param convenientProductDTO
     * @return
     */
    R addProduct(ConvenientProductDTO convenientProductDTO);
    /**
     * 便民服务商家后台编辑产品
     * @param convenientProductDTO
     * @return
     */
    R putProduct(ConvenientProductDTO convenientProductDTO);
    /**
     * 便民服务商家后台获取产品详情
     * @param productId
     * @return
     */
    R getProduct(Long productId);
    /**
     * 便民服务商家后台分页获取产品信息
     * @param pageConvenientProductDTO
     * @return
     */
    R pageProduct(PageConvenientProductDTO pageConvenientProductDTO);
    /**
     * 便民服务商家后台删除产品信息
     * @param deleteConvenientProductDTO
     * @return
     */
    R deleteProduct(DeleteConvenientProductDTO deleteConvenientProductDTO);
    /**
     * 便民服务商家后台上架/下架产品
     * @param onShelfOrOffShelfProductDTO
     * @return
     */
    R onShelfOrOffShelfProduct(OnShelfOrOffShelfProductDTO onShelfOrOffShelfProductDTO);
    /**
     * 小程序获取商家产品
     * @param merchantId
     * @return
     */
    R getMerchantProduct(Long merchantId);
    /**
     * 搜索商品信息
     * @param pageSearchDTO
     * @return
     */
    R pageSearchProduct(PageSearchDTO pageSearchDTO);
    /**
     * 增加产品浏览量
     * @param productId
     * @return
     */
    R incrProductView(Long productId);
    /**
     * 获取商家上下架产品数量
     * @param merchantId
     * @return
     */
    R getProductShelfNum(Long merchantId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientServiceCategoryService.java
New file
@@ -0,0 +1,65 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO;
/**
 * @title: ConvenientServiceCategoryService
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务分类服务类
 * @author: hans
 * @date: 2021/09/16 10:31
 */
public interface ConvenientServiceCategoryService extends IService<ConvenientServiceCategoryDO> {
    /**
     * 便民服务新增分类
     * @param convenientServiceCategoryDTO
     * @return 新增结果
     */
    R addServiceCategory(ConvenientServiceCategoryDTO convenientServiceCategoryDTO);
    /**
     * 便民服务分类编辑
     * @param convenientServiceCategoryDTO
     * @return 修改结果
     */
    R putServiceCategory(ConvenientServiceCategoryDTO convenientServiceCategoryDTO);
    /**
     * 便民服务分类删除
     * @param categoryId 便民服务分类id
     * @param operator 操作人员
     * @return 删除结果
     */
    R deleteServiceCategoryById(Long categoryId, Long operator);
    /**
     * 获取便民服务分类详情
     * @param categoryId 便民服务分类id
     * @return 分类详情
     */
    R getServiceCategoryById(Long categoryId);
    /**
     * 分页查询便民服务分类
     * @param pageConvenientServiceCategoryDTO
     * @return 分类详情
     */
    R pageServiceCategory(PageConvenientServiceCategoryDTO pageConvenientServiceCategoryDTO);
    /**
     * 获取所有便民服务分类
     * @return
     */
    R getAllServiceCategories();
    /**
     * 获取该社区商家数量大于0的分类
     * @param communityId
     * @return
     */
    R getSuitableServiceCategories(Long communityId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
New file
@@ -0,0 +1,396 @@
package com.panzhihua.service_community.service.impl;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberPassResetDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductSpecificationVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientViewStatisticsVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ConvenientConsultationStatisticsDAO;
import com.panzhihua.service_community.dao.ConvenientMerchantDAO;
import com.panzhihua.service_community.dao.ConvenientProductDAO;
import com.panzhihua.service_community.dao.ConvenientServiceCategoryDAO;
import com.panzhihua.service_community.dao.ConvenientViewStatisticsDAO;
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.model.dos.ConvenientConsultationStatisticsDO;
import com.panzhihua.service_community.model.dos.ConvenientMerchantDO;
import com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO;
import com.panzhihua.service_community.model.dos.ConvenientViewStatisticsDO;
import com.panzhihua.service_community.service.ConvenientMerchantService;
/**
 * @title: ConvenientMerchantServiceImpl
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家服务实现类
 * @author: hans
 * @date: 2021/09/16 16:14
 */
@Service
public class ConvenientMerchantServiceImpl extends ServiceImpl<ConvenientMerchantDAO, ConvenientMerchantDO> implements ConvenientMerchantService {
    @Resource
    private UserService userService;
    @Resource
    private ConvenientServiceCategoryDAO convenientServiceCategoryDAO;
    @Resource
    private ComActDAO comActDAO;
    @Resource
    private ConvenientProductDAO convenientProductDAO;
    @Resource
    private ConvenientConsultationStatisticsDAO convenientConsultationStatisticsDAO;
    @Resource
    private ConvenientViewStatisticsDAO convenientViewStatisticsDAO;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R addMerchant(ConvenientMerchantDTO convenientMerchantDTO) {
        ComActDO comActDO = comActDAO.selectById(convenientMerchantDTO.getCommunityId());
        ConvenientMerchantDO convenientMerchantDO = new ConvenientMerchantDO();
        BeanUtils.copyProperties(convenientMerchantDTO, convenientMerchantDO);
        convenientMerchantDO.setUserId(0L);
        convenientMerchantDO.setCommunityName(comActDO.getName());
        convenientMerchantDO.setCreatedAt(new Date());
        int insertResult = this.baseMapper.insert(convenientMerchantDO);
        if (insertResult > 0) {
            Long merchantId = convenientMerchantDO.getId();
            if (nonNull(merchantId)) {
                //添加服务
                List<Long> serviceIds = convenientMerchantDTO.getServiceIds();
                serviceIds.forEach(serviceId -> {
                    ConvenientServiceCategoryDO convenientServiceCategoryDO = convenientServiceCategoryDAO.selectById(serviceId);
                    convenientServiceCategoryDAO.createMerchantServiceRelation(merchantId, serviceId,
                            convenientServiceCategoryDO.getName(), convenientMerchantDTO.getCreatedBy());
                });
            }
        }
        //添加user
        R addUserResult = userService.addConvenientMerchantUser(convenientMerchantDTO);
        if (R.isOk(addUserResult)) {
            Long merchantUserId = ((Integer) addUserResult.getData()).longValue();
            convenientMerchantDO.setUserId(merchantUserId);
            this.baseMapper.updateById(convenientMerchantDO);
        } else {
            throw new ServiceException("406", addUserResult.getMsg());
        }
        return R.ok();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R putMerchant(ConvenientMerchantDTO convenientMerchantDTO) {
        Long merchantId = convenientMerchantDTO.getId();
        ConvenientMerchantDO convenientMerchantDO = this.baseMapper.selectById(merchantId);
        if (isNull(convenientMerchantDO)) {
            return R.fail("商家不存在");
        }
        Long communityId = convenientMerchantDTO.getCommunityId();
        if (nonNull(communityId)) {
            ComActDO comActDO = comActDAO.selectById(communityId);
            convenientMerchantDO.setCommunityName(comActDO.getName());
        }
        String account = convenientMerchantDTO.getAccount();
        if (isNotBlank(account)) {
            //修改商家绑定账户号
            R putAccountResult = userService.putUserAccount(convenientMerchantDO.getUserId(), account);
            if (!R.isOk(putAccountResult)) {
                return putAccountResult;
            }
        }
        List<Long> serviceIds = convenientMerchantDTO.getServiceIds();
        if (!serviceIds.isEmpty()) {
            convenientServiceCategoryDAO.deleteMerchantServiceRelation(merchantId);
            serviceIds.forEach(serviceId -> {
                ConvenientServiceCategoryDO convenientServiceCategoryDO = convenientServiceCategoryDAO.selectById(serviceId);
                convenientServiceCategoryDAO.createMerchantServiceRelation(merchantId, serviceId,
                        convenientServiceCategoryDO.getName(), convenientMerchantDTO.getCreatedBy());
            });
        }
        BeanUtils.copyProperties(convenientMerchantDTO, convenientMerchantDO);
        this.baseMapper.updateById(convenientMerchantDO);
        return R.ok();
    }
    @Override
    public R deleteMerchant(Long merchantId, Long operator) {
        int result = this.baseMapper.deleteMerchantById(merchantId, operator);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("删除失败");
    }
    @Override
    public R pageMerchant(PageConvenientMerchantDTO pageConvenientMerchantDTO) {
        Page page = new Page<>();
        page.setSize(pageConvenientMerchantDTO.getPageSize());
        page.setCurrent(pageConvenientMerchantDTO.getPageNum());
        IPage<ConvenientMerchantVO> iPage = this.baseMapper.pageMerchant(page, pageConvenientMerchantDTO);
        if (nonNull(pageConvenientMerchantDTO.getServiceId())) {
            List<ConvenientMerchantVO> records = iPage.getRecords();
            if (!records.isEmpty()) {
                records.forEach(record -> {
                    String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(record.getId());
                    record.setServiceScope(serviceScope);
                });
            }
        }
        return R.ok(iPage);
    }
    @Override
    public R getMerchant(Long merchantId) {
        ConvenientMerchantVO convenientMerchantVO = this.baseMapper.selectMerchantById(merchantId);
        List<Long> serviceIds = convenientServiceCategoryDAO.selectServiceIdsForMerchant(merchantId);
        convenientMerchantVO.setServiceIds(serviceIds);
        return R.ok(convenientMerchantVO);
    }
    @Override
    public R disableOrEnableMerchant(DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO) {
        R result = userService.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO);
        if (R.isOk(result)) {
            return R.ok();
        }
        return R.fail("操作失败");
    }
    @Override
    public R resetPasswordMerchant(ResetPasswordConvenientMerchantDTO resetPasswordConvenientMerchantDTO) {
        EventGridMemberPassResetDTO eventGridMemberPassResetDTO = new EventGridMemberPassResetDTO();
        eventGridMemberPassResetDTO.setPassword(resetPasswordConvenientMerchantDTO.getPassword());
        eventGridMemberPassResetDTO.setIds(resetPasswordConvenientMerchantDTO.getIds());
        return userService.gridMemberPassReset(eventGridMemberPassResetDTO);
    }
    @Override
    public R<ConvenientMerchantVO> getUserMerchantInfoByAccount(String account) {
        try {
            R<LoginUserInfoVO> loginUserInfoVOR = userService.getUserInfo(account + "_10");
            LoginUserInfoVO loginUserInfoVO =
                    JSONObject.parseObject(JSONObject.toJSONString(loginUserInfoVOR.getData()), LoginUserInfoVO.class);
            if (isNull(loginUserInfoVO)) {
                return R.fail(500, "该账号不存在");
            }
            ConvenientMerchantDO merchantDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ConvenientMerchantDO>()
                    .eq(ConvenientMerchantDO::getIsDel, false).eq(ConvenientMerchantDO::getUserId, loginUserInfoVO.getUserId()));
            if (isNull(merchantDO)) {
                return R.fail(500, "该账号不存在");
            }
            ConvenientMerchantVO merchantVO = new ConvenientMerchantVO();
            BeanUtils.copyProperties(merchantDO, merchantVO);
            merchantVO.setAccount(account);
            merchantVO.setAccountStatus(loginUserInfoVO.getStatus());
            return R.ok(merchantVO);
        } catch (Exception e) {
            return R.fail();
        }
    }
    @Override
    public R<ConvenientMerchantVO> getUserConvenientMerchantInfo(Long userId) {
        ConvenientMerchantDO merchantDO = this.baseMapper.selectOne(new QueryWrapper<ConvenientMerchantDO>()
                .lambda().eq(ConvenientMerchantDO::getUserId, userId));
        if (isNull(merchantDO)) {
            return R.fail("商家不存在");
        }
        Long merchantId = merchantDO.getId();
        ConvenientMerchantVO convenientMerchantVO = new ConvenientMerchantVO();
        BeanUtils.copyProperties(merchantDO, convenientMerchantVO);
        List<Long> serviceIds = convenientServiceCategoryDAO.selectServiceIdsForMerchant(merchantId);
        convenientMerchantVO.setServiceIds(serviceIds);
        Date nowDate = new Date();
        SimpleDateFormat mothFormat = new SimpleDateFormat("yyyy-MM");
        SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
        String moth = mothFormat.format(nowDate);
        String day = dayFormat.format(nowDate);
        int monthConsultationVolume = convenientConsultationStatisticsDAO.selectMonthConsultationVolume(merchantId, moth);
        int dayConsultationVolume = convenientConsultationStatisticsDAO.selectDayConsultationVolume(merchantId, day);
        int monthViewNum = convenientViewStatisticsDAO.selectMonthViewNum(merchantId, moth);
        int dayViewNum = convenientViewStatisticsDAO.selectDayViewNum(merchantId, day);
        convenientMerchantVO.setMonthConsultationVolume(monthConsultationVolume);
        convenientMerchantVO.setDayConsultationVolume(dayConsultationVolume);
        convenientMerchantVO.setMonthViewNum(monthViewNum);
        convenientMerchantVO.setDayViewNum(dayViewNum);
        return R.ok(convenientMerchantVO);
    }
    @Override
    public R getPopularMerchants(PagePopularMerchantDTO pagePopularMerchantDTO) {
        Date nowDate = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
        String currentMon = simpleDateFormat.format(nowDate).concat("%");
        Page page = new Page<>();
        page.setSize(pagePopularMerchantDTO.getPageSize());
        page.setCurrent(pagePopularMerchantDTO.getPageNum());
        IPage<ConvenientMerchantVO> merchantVOList = this.baseMapper.getPopularMerchants(page, pagePopularMerchantDTO.getCommunityId(), currentMon);
        return R.ok(merchantVOList);
    }
    @Override
    public R getClassifyMerchants(PageClassifyMerchantDTO pageClassifyMerchantDTO) {
        Date nowDate = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
        String currentMon = simpleDateFormat.format(nowDate).concat("%");
        Page page = new Page<>();
        page.setSize(pageClassifyMerchantDTO.getPageSize());
        page.setCurrent(pageClassifyMerchantDTO.getPageNum());
        IPage<ConvenientMerchantVO> merchantVOList = this.baseMapper.getClassifyMerchants(page, pageClassifyMerchantDTO, currentMon);
        List<ConvenientMerchantVO> records = merchantVOList.getRecords();
        if (!records.isEmpty()) {
            records.forEach(record -> {
                String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(record.getId());
                record.setServiceScope(serviceScope);
            });
        }
        return R.ok(merchantVOList);
    }
    /**
     * 小程序获取商家详情
     * @param merchantId
     * @return
     */
    @Override
    public R getMerchantDetail(Long merchantId) {
        Date nowDate = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
        String currentMon = simpleDateFormat.format(nowDate).concat("%");
        return R.ok(this.baseMapper.getMerchantDetail(merchantId, currentMon));
    }
    @Override
    public R pageSearchMerchant(PageSearchDTO pageSearchDTO) {
        Date nowDate = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
        String currentMon = simpleDateFormat.format(nowDate).concat("%");
        Page page = new Page<>();
        page.setSize(pageSearchDTO.getPageSize());
        page.setCurrent(pageSearchDTO.getPageNum());
        IPage<ConvenientMerchantVO> merchantVOIPage = this.baseMapper.pageSearchMerchant(page, pageSearchDTO, currentMon);
        List<ConvenientMerchantVO> records = merchantVOIPage.getRecords();
        if (!records.isEmpty()) {
            records.forEach(record -> {
                List<ConvenientProductVO> merchantProduct = convenientProductDAO.getMerchantProduct(record.getId());
                List<ConvenientProductSpecificationVO> productSpecifications = convenientProductDAO.getProductSpecifications(record.getId());
                if (!merchantProduct.isEmpty()) {
                    if (merchantProduct.size() > 2) {
                        merchantProduct = merchantProduct.subList(0, 2);
                    }
                    merchantProduct.forEach(product -> {
                        List<ConvenientProductSpecificationVO> list = new ArrayList<>();
                        productSpecifications.forEach(specification -> {
                            if (product.getId().equals(specification.getProductId())) {
                                list.add(specification);
                            }
                        });
                        product.setProductSpecificationVOList(list);
                    });
                }
                record.setProductVOList(merchantProduct);
            });
        }
        return R.ok(merchantVOIPage);
    }
    @Override
    public R consultMerchant(Long merchantId) {
        ConvenientMerchantDO merchantDO = this.baseMapper.selectById(merchantId);
        if (isNull(merchantDO)) {
            return R.fail("商家不存在");
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowDate = simpleDateFormat.format(new Date());
        ConvenientConsultationStatisticsDO statisticsDO = convenientConsultationStatisticsDAO.selectOne(new LambdaQueryWrapper<ConvenientConsultationStatisticsDO>()
                .eq(ConvenientConsultationStatisticsDO::getMerchantId, merchantId).eq(ConvenientConsultationStatisticsDO::getStatisticDate, nowDate));
        if (isNull(statisticsDO)) {
            convenientConsultationStatisticsDAO.createTodayStatistic(merchantId);
        } else {
            convenientConsultationStatisticsDAO.incrConsultationNum(merchantId, nowDate);
        }
        return R.ok();
    }
    @Override
    public R incrMerchantView(Long merchantId) {
        ConvenientMerchantDO merchantDO = this.baseMapper.selectById(merchantId);
        if (isNull(merchantDO)) {
            return R.fail("商家不存在");
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowDate = simpleDateFormat.format(new Date());
        ConvenientViewStatisticsDO statisticsDO = convenientViewStatisticsDAO.selectOne(new LambdaQueryWrapper<ConvenientViewStatisticsDO>()
                .eq(ConvenientViewStatisticsDO::getMerchantId, merchantId).eq(ConvenientViewStatisticsDO::getStatisticDate, nowDate));
        if (isNull(statisticsDO)) {
            convenientViewStatisticsDAO.createTodayStatistic(merchantId);
        } else {
            convenientViewStatisticsDAO.incrViewNum(merchantId, nowDate);
        }
        return R.ok();
    }
    @Override
    public R exportMerchant(ExportMerchantDTO exportMerchantDTO) {
        List<Long> needExportIds = exportMerchantDTO.getIds();
        if (nonNull(needExportIds) && !needExportIds.isEmpty()) {
            //根据id导出
            return R.ok(this.baseMapper.exportMerchantByIds(needExportIds));
        }
        List<ExportMerchantVO> exportMerchantVOList = this.baseMapper.exportMerchantBySearch(exportMerchantDTO);
        if (nonNull(exportMerchantDTO.getServiceId()) && !exportMerchantVOList.isEmpty()) {
            exportMerchantVOList.forEach(merchant -> {
                String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(merchant.getId());
                merchant.setServiceScope(serviceScope);
            });
        }
        return R.ok(exportMerchantVOList);
    }
    /**
     * 定时任务每隔半小时将商家浏览量和咨询量总值计入指定商家数据中
     * @return
     */
    @Override
    public R timedTaskWriteDataToMerchantJobHandler() {
        List<ConvenientConsultationStatisticsVO> consultationVOList = convenientConsultationStatisticsDAO.selectSumForConsultationNum();
        List<ConvenientViewStatisticsVO> viewVOList = convenientViewStatisticsDAO.selectSumForViewNum();
        this.baseMapper.batchUpdateMerchantConsultationNum(consultationVOList);
        this.baseMapper.batchUpdateMerchantViewNum(viewVOList);
        return R.ok();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductCategoryServiceImpl.java
New file
@@ -0,0 +1,102 @@
package com.panzhihua.service_community.service.impl;
import static java.util.Objects.isNull;
import java.util.Date;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO;
import com.panzhihua.service_community.dao.ConvenientProductCategoryDAO;
import com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO;
import com.panzhihua.service_community.service.ConvenientProductCategoryService;
/**
 * @title: ConvenientProductCategoryServiceImpl
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务产品分类服务实现类
 * @author: hans
 * @date: 2021/09/20 16:13
 */
@Service
public class ConvenientProductCategoryServiceImpl extends ServiceImpl<ConvenientProductCategoryDAO, ConvenientProductCategoryDO> implements ConvenientProductCategoryService {
    @Override
    public R addProductCategory(ConvenientProductCategoryDTO convenientProductCategoryDTO) {
        ConvenientProductCategoryDO convenientProductCategoryDO = new ConvenientProductCategoryDO();
        BeanUtils.copyProperties(convenientProductCategoryDTO, convenientProductCategoryDO);
        convenientProductCategoryDO.setCreatedAt(new Date());
        int result = this.baseMapper.insert(convenientProductCategoryDO);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("添加失败");
    }
    @Override
    public R putProductCategory(ConvenientProductCategoryDTO convenientProductCategoryDTO) {
        ConvenientProductCategoryDO convenientProductCategoryDO = this.baseMapper.selectById(convenientProductCategoryDTO.getId());
        if (isNull(convenientProductCategoryDO)) {
            return R.fail("分类id不存在");
        }
        BeanUtils.copyProperties(convenientProductCategoryDTO, convenientProductCategoryDO);
        int result = this.baseMapper.updateById(convenientProductCategoryDO);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("更新失败");
    }
    @Override
    public R deleteProductCategory(Long categoryId, Long operator) {
        if (isNull(categoryId)) {
            return R.fail("分类id不能为空");
        }
        ConvenientProductCategoryDO convenientProductCategoryDO = this.baseMapper.selectById(categoryId);
        if (isNull(convenientProductCategoryDO)) {
            return R.fail("分类id不存在");
        }
        convenientProductCategoryDO.setIsDel(true);
        convenientProductCategoryDO.setUpdatedBy(operator);
        int result = this.baseMapper.updateById(convenientProductCategoryDO);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("删除失败");
    }
    @Override
    public R getProductCategory(Long categoryId) {
        if (isNull(categoryId)) {
            return R.fail("分类id不能为空");
        }
        ConvenientProductCategoryDO convenientProductCategoryDO = this.baseMapper.selectById(categoryId);
        if (isNull(convenientProductCategoryDO)) {
            return R.fail("分类id不存在");
        }
        ConvenientProductCategoryVO convenientProductCategoryVO = new ConvenientProductCategoryVO();
        BeanUtils.copyProperties(convenientProductCategoryDO, convenientProductCategoryVO);
        return R.ok(convenientProductCategoryVO);
    }
    @Override
    public R pageProductCategory(PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO) {
        Page page = new Page<>();
        page.setSize(pageConvenientProductCategoryDTO.getPageSize());
        page.setCurrent(pageConvenientProductCategoryDTO.getPageNum());
        IPage<ConvenientProductCategoryVO> iPage = this.baseMapper.pageProductCategory(page, pageConvenientProductCategoryDTO);
        return R.ok(iPage);
    }
    @Override
    public R getAllProductCategory() {
        return R.ok(this.baseMapper.selectAllCategories());
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java
New file
@@ -0,0 +1,292 @@
package com.panzhihua.service_community.service.impl;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductSpecificationDTO;
import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductLevelInfoVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductShelfVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductSpecificationVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO;
import com.panzhihua.service_community.dao.ConvenientProductCategoryDAO;
import com.panzhihua.service_community.dao.ConvenientProductDAO;
import com.panzhihua.service_community.dao.ConvenientProductSpecificationDAO;
import com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO;
import com.panzhihua.service_community.model.dos.ConvenientProductDO;
import com.panzhihua.service_community.model.dos.ConvenientProductSpecificationDO;
import com.panzhihua.service_community.service.ConvenientProductService;
/**
 * @title: ConvenientProductServiceImpl
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家后台产品服务实现类
 * @author: hans
 * @date: 2021/09/21 21:33
 */
@Service
public class ConvenientProductServiceImpl extends ServiceImpl<ConvenientProductDAO, ConvenientProductDO> implements ConvenientProductService {
    @Resource
    private ConvenientProductCategoryDAO convenientProductCategoryDAO;
    @Resource
    private ConvenientProductSpecificationDAO convenientProductSpecificationDAO;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R addProduct(ConvenientProductDTO convenientProductDTO) {
        ConvenientProductCategoryDO convenientProductCategoryDO = convenientProductCategoryDAO.selectById(convenientProductDTO.getCategoryId());
        if (isNull(convenientProductCategoryDO)) {
            return R.fail("产品分类不存在");
        }
        ConvenientProductDO convenientProductDO = new ConvenientProductDO();
        BeanUtils.copyProperties(convenientProductDTO, convenientProductDO);
        Date nowDate = new Date();
        convenientProductDO.setCreatedAt(nowDate);
        this.baseMapper.insert(convenientProductDO);
        Long productId = convenientProductDO.getId();
        if (nonNull(productId)) {
            //规格
            List<ConvenientProductSpecificationDTO> productSpecificationDTOList = convenientProductDTO.getProductSpecificationDTOList();
            List<ConvenientProductSpecificationDO> productSpecificationDOList = productSpecificationDTOList.stream().map(specificationDTO -> {
                ConvenientProductSpecificationDO convenientProductSpecificationDO = new ConvenientProductSpecificationDO();
                BeanUtils.copyProperties(specificationDTO, convenientProductSpecificationDO);
                convenientProductSpecificationDO.setProductId(productId);
                convenientProductSpecificationDO.setCreatedAt(nowDate);
                convenientProductSpecificationDO.setCreatedBy(convenientProductDTO.getCreatedBy());
                return convenientProductSpecificationDO;
            }).collect(Collectors.toList());
            convenientProductSpecificationDAO.batchInsert(productSpecificationDOList);
        }
        return R.ok();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R putProduct(ConvenientProductDTO convenientProductDTO) {
        Long productId = convenientProductDTO.getId();
        Long updatedBy = convenientProductDTO.getUpdatedBy();
        ConvenientProductDO convenientProductDO = this.baseMapper.selectById(productId);
        if (isNull(convenientProductDO)) {
            return R.fail("产品不存在");
        }
        BeanUtils.copyProperties(convenientProductDTO, convenientProductDO);
        convenientProductDO.setUpdatedBy(updatedBy);
        this.baseMapper.updateById(convenientProductDO);
        List<ConvenientProductSpecificationDTO> productSpecificationDTOList = convenientProductDTO.getProductSpecificationDTOList();
        List<Long> notNeedDelIds = productSpecificationDTOList.stream().filter(specificationDTO -> nonNull(specificationDTO.getId()))
                .map(ConvenientProductSpecificationDTO::getId).collect(Collectors.toList());
        //删除已失去关联的规格
        convenientProductSpecificationDAO.deleteLoseRelationSpecifications(notNeedDelIds);
        Date nowDate = new Date();
        productSpecificationDTOList.forEach(specificationDTO -> {
            Long specificationId = specificationDTO.getId();
            if (isNull(specificationId)) {
                //新增
                ConvenientProductSpecificationDO convenientProductSpecificationDO = new ConvenientProductSpecificationDO();
                BeanUtils.copyProperties(specificationDTO, convenientProductSpecificationDO);
                convenientProductSpecificationDO.setProductId(productId);
                convenientProductSpecificationDO.setCreatedAt(nowDate);
                convenientProductSpecificationDO.setCreatedBy(updatedBy);
                convenientProductSpecificationDAO.insert(convenientProductSpecificationDO);
            } else {
                //更新
                ConvenientProductSpecificationDO convenientProductSpecificationDO = convenientProductSpecificationDAO.selectById(specificationId);
                BeanUtils.copyProperties(specificationDTO, convenientProductSpecificationDO);
                convenientProductSpecificationDO.setUpdatedBy(updatedBy);
                convenientProductSpecificationDAO.updateById(convenientProductSpecificationDO);
            }
        });
        return R.ok();
    }
    @Override
    public R getProduct(Long productId) {
        if (isNull(productId)) {
            return R.fail("产品ID不能为空");
        }
        ConvenientProductDO convenientProductDO = this.baseMapper.selectById(productId);
        if (isNull(convenientProductDO)) {
            return R.fail("产品不存在");
        }
        ConvenientProductVO convenientProductVO = new ConvenientProductVO();
        BeanUtils.copyProperties(convenientProductDO, convenientProductVO);
        //查找产品规格
        List<ConvenientProductSpecificationDO> convenientProductSpecificationDOList = convenientProductSpecificationDAO.selectList(new LambdaQueryWrapper<ConvenientProductSpecificationDO>()
                .eq(ConvenientProductSpecificationDO::getProductId, productId).eq(ConvenientProductSpecificationDO::getIsDel, false));
        List<ConvenientProductSpecificationVO> convenientProductSpecificationVOList = new ArrayList<>();
        if (!convenientProductSpecificationDOList.isEmpty()) {
            convenientProductSpecificationDOList.forEach(specificationDO -> {
                ConvenientProductSpecificationVO convenientProductSpecificationVO = new ConvenientProductSpecificationVO();
                BeanUtils.copyProperties(specificationDO, convenientProductSpecificationVO);
                convenientProductSpecificationVOList.add(convenientProductSpecificationVO);
            });
        }
        convenientProductVO.setProductSpecificationVOList(convenientProductSpecificationVOList);
        return R.ok(convenientProductVO);
    }
    @Override
    public R pageProduct(PageConvenientProductDTO pageConvenientProductDTO) {
        Page page = new Page<>();
        page.setSize(pageConvenientProductDTO.getPageSize());
        page.setCurrent(pageConvenientProductDTO.getPageNum());
        IPage<ConvenientProductVO> productVOIPage = this.baseMapper.pageProduct(page, pageConvenientProductDTO);
        List<ConvenientProductVO> convenientProductVOList = productVOIPage.getRecords();
        //图片填充
        if (!convenientProductVOList.isEmpty()) {
            convenientProductVOList.forEach(product -> {
                List<ConvenientProductSpecificationDO> specificationDOList = convenientProductSpecificationDAO.selectList(new LambdaQueryWrapper<ConvenientProductSpecificationDO>()
                        .eq(ConvenientProductSpecificationDO::getProductId, product.getId()).isNotNull(ConvenientProductSpecificationDO::getImage));
                product.setImage(specificationDOList.isEmpty() ? null : specificationDOList.get(0).getImage());
            });
        }
        return R.ok(productVOIPage);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R deleteProduct(DeleteConvenientProductDTO deleteConvenientProductDTO) {
        List<Long> needDelIds = deleteConvenientProductDTO.getIds();
        //删除产品
        int result = this.baseMapper.batchDeleteByIds(needDelIds);
        if (result > 0) {
            //删除规格
            convenientProductSpecificationDAO.batchDeleteByProductIds(needDelIds);
        }
        return R.ok();
    }
    @Override
    public R onShelfOrOffShelfProduct(OnShelfOrOffShelfProductDTO onShelfOrOffShelfProductDTO) {
        Integer type = onShelfOrOffShelfProductDTO.getType();
        Long updatedBy = onShelfOrOffShelfProductDTO.getUpdatedBy();
        List<Long> needDelIds = onShelfOrOffShelfProductDTO.getIds();
        if (type.intValue() == 1) {
            //上架
            this.baseMapper.batchOnShelfOrOffShelfByIds(needDelIds, updatedBy, true);
        } else if (type.intValue() == 2) {
            //下架
            this.baseMapper.batchOnShelfOrOffShelfByIds(needDelIds, updatedBy, false);
        } else {
            return R.fail("处理类型错误");
        }
        return R.ok();
    }
    /**
     * 小程序获取商家产品
     * @param merchantId
     * @return
     */
    @Override
    public R getMerchantProduct(Long merchantId) {
        List<ConvenientProductVO> productVOList = this.baseMapper.getMerchantProduct(merchantId);
        List<ConvenientProductSpecificationVO> specificationVOList = this.baseMapper.getProductSpecifications(merchantId);
        List<ConvenientProductLevelInfoVO> levelInfoVOList = new ArrayList<>();
        if (!productVOList.isEmpty()) {
            productVOList.forEach(productVO -> {
                List<ConvenientProductSpecificationVO> currentProductSpecificationVOList = new ArrayList<>();
                specificationVOList.forEach(specificationVO -> {
                    if (productVO.getId().equals(specificationVO.getProductId())) {
                        currentProductSpecificationVOList.add(specificationVO);
                    }
                });
                productVO.setProductSpecificationVOList(currentProductSpecificationVOList);
            });
            //分类
            Map<String, List<ConvenientProductVO>> levelGroup = productVOList.stream()
                    .collect(Collectors.groupingBy(ConvenientProductVO::getCategoryName));
            Set<String> categoryNames = levelGroup.keySet();
            Iterator<String> iterator = categoryNames.iterator();
            while (iterator.hasNext()) {
                String categoryName = iterator.next();
                ConvenientProductLevelInfoVO levelInfoVOLevelInfoVO = new ConvenientProductLevelInfoVO();
                levelInfoVOLevelInfoVO.setCategoryName(categoryName);
                List<ConvenientProductVO> productVOS = levelGroup.get(categoryName);
                List<ConvenientProductVO> sortedProductVOS = productVOS.stream()
                        .sorted(Comparator.comparing(ConvenientProductVO::getOnShelfAt).reversed()).collect(Collectors.toList());
                levelInfoVOLevelInfoVO.setProductVOList(sortedProductVOS);
                levelInfoVOList.add(levelInfoVOLevelInfoVO);
            }
        }
        return R.ok(levelInfoVOList);
    }
    @Override
    public R pageSearchProduct(PageSearchDTO pageSearchDTO) {
        Page page = new Page<>();
        page.setSize(pageSearchDTO.getPageSize());
        page.setCurrent(pageSearchDTO.getPageNum());
        IPage<ConvenientProductVO> productVOIPage = this.baseMapper.pageSearchProduct(page, pageSearchDTO);
        List<ConvenientProductVO> records = productVOIPage.getRecords();
        if (!records.isEmpty()) {
            List<Long> productIds = records.stream().map(ConvenientProductVO::getId).collect(Collectors.toList());
            List<ConvenientProductSpecificationDO> specificationDOS = convenientProductSpecificationDAO
                    .selectList(new LambdaQueryWrapper<ConvenientProductSpecificationDO>().in(ConvenientProductSpecificationDO::getProductId, productIds));
            List<ConvenientProductSpecificationVO> specificationVOList = new ArrayList<>();
            if (!specificationDOS.isEmpty()) {
                specificationDOS.forEach(specificationDO -> {
                    ConvenientProductSpecificationVO specificationVO = new ConvenientProductSpecificationVO();
                    BeanUtils.copyProperties(specificationDO, specificationVO);
                    specificationVOList.add(specificationVO);
                });
                Map<Long, List<ConvenientProductSpecificationVO>> collect = specificationVOList
                        .stream().collect(Collectors.groupingBy(ConvenientProductSpecificationVO::getProductId));
                Set<Long> keySet = collect.keySet();
                Iterator<Long> iterator = keySet.iterator();
                while (iterator.hasNext()) {
                    Long productId = iterator.next();
                    records.forEach(record -> {
                        if (record.getId().equals(productId)) {
                            record.setProductSpecificationVOList(collect.get(productId));
                        }
                    });
                }
            }
        }
        return R.ok(productVOIPage);
    }
    @Override
    public R incrProductView(Long productId) {
        this.baseMapper.incrProductView(productId);
        return R.ok();
    }
    @Override
    public R getProductShelfNum(Long merchantId) {
        int onShelfTotalNum = this.baseMapper.selectCount(new LambdaQueryWrapper<ConvenientProductDO>().eq(ConvenientProductDO::getMerchantId, merchantId)
                .eq(ConvenientProductDO::getIsDel, false).eq(ConvenientProductDO::getOnShelf, true));
        int offShelfTotalNum = this.baseMapper.selectCount(new LambdaQueryWrapper<ConvenientProductDO>().eq(ConvenientProductDO::getMerchantId, merchantId)
                .eq(ConvenientProductDO::getIsDel, false).eq(ConvenientProductDO::getOnShelf, false));
        ConvenientProductShelfVO convenientProductShelfVO = new ConvenientProductShelfVO();
        convenientProductShelfVO.setOnShelfTotalNum(onShelfTotalNum);
        convenientProductShelfVO.setOffShelfTotalNum(offShelfTotalNum);
        return R.ok(convenientProductShelfVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientServiceCategoryServiceImpl.java
New file
@@ -0,0 +1,126 @@
package com.panzhihua.service_community.service.impl;
import static java.util.Objects.isNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.service_community.dao.ConvenientServiceCategoryDAO;
import com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO;
import com.panzhihua.service_community.service.ConvenientServiceCategoryService;
/**
 * @title: ConvenientServiceCategoryServiceImpl
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务分类服务实现类
 * @author: hans
 * @date: 2021/09/16 10:56
 */
@Service
public class ConvenientServiceCategoryServiceImpl extends ServiceImpl<ConvenientServiceCategoryDAO, ConvenientServiceCategoryDO>
        implements ConvenientServiceCategoryService {
    @Override
    public R addServiceCategory(ConvenientServiceCategoryDTO convenientServiceCategoryDTO) {
        ConvenientServiceCategoryDO convenientServiceCategoryDO = new ConvenientServiceCategoryDO();
        BeanUtils.copyProperties(convenientServiceCategoryDTO, convenientServiceCategoryDO);
        convenientServiceCategoryDO.setCreatedAt(new Date());
        int result = this.baseMapper.insert(convenientServiceCategoryDO);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("添加失败");
    }
    @Override
    public R putServiceCategory(ConvenientServiceCategoryDTO convenientServiceCategoryDTO) {
        ConvenientServiceCategoryDO convenientServiceCategoryDO = this.baseMapper.selectById(convenientServiceCategoryDTO.getId());
        if (isNull(convenientServiceCategoryDO)) {
            return R.fail("分类id不存在");
        }
        BeanUtils.copyProperties(convenientServiceCategoryDTO, convenientServiceCategoryDO);
        int result = this.baseMapper.updateById(convenientServiceCategoryDO);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("更新失败");
    }
    @Override
    public R deleteServiceCategoryById(Long categoryId, Long operator) {
        if (isNull(categoryId)) {
            return R.fail("分类id不能为空");
        }
        ConvenientServiceCategoryDO convenientServiceCategoryDO = this.baseMapper.selectById(categoryId);
        if (isNull(convenientServiceCategoryDO)) {
            return R.fail("分类id不存在");
        }
        int count = this.baseMapper.checkCategoryIsUsing(categoryId);
        if (count > 0) {
            return R.fail("分类已被引用,无法删除");
        }
        convenientServiceCategoryDO.setIsDel(true);
        convenientServiceCategoryDO.setUpdatedBy(operator);
        int result = this.baseMapper.updateById(convenientServiceCategoryDO);
        if (result > 0) {
            return R.ok();
        }
        return R.fail("删除失败");
    }
    @Override
    public R getServiceCategoryById(Long categoryId) {
        if (isNull(categoryId)) {
            return R.fail("分类id不能为空");
        }
        ConvenientServiceCategoryDO convenientServiceCategoryDO = this.baseMapper.selectById(categoryId);
        if (isNull(convenientServiceCategoryDO)) {
            return R.fail("分类id不存在");
        }
        ConvenientServiceCategoryVO convenientServiceCategoryVO = new ConvenientServiceCategoryVO();
        BeanUtils.copyProperties(convenientServiceCategoryDO, convenientServiceCategoryVO);
        return R.ok(convenientServiceCategoryVO);
    }
    @Override
    public R pageServiceCategory(PageConvenientServiceCategoryDTO pageConvenientServiceCategoryDTO) {
        Page page = new Page<>();
        page.setSize(pageConvenientServiceCategoryDTO.getPageSize());
        page.setCurrent(pageConvenientServiceCategoryDTO.getPageNum());
        IPage<ConvenientServiceCategoryVO> iPage = this.baseMapper.pageServiceCategory(page, pageConvenientServiceCategoryDTO);
        return R.ok(iPage);
    }
    @Override
    public R getAllServiceCategories() {
        List<ConvenientServiceCategoryVO> categoryVOList = new ArrayList<>();
        List<ConvenientServiceCategoryDO> categoryDOS = this.baseMapper.selectList(new QueryWrapper<ConvenientServiceCategoryDO>()
                .lambda().orderByDesc(ConvenientServiceCategoryDO::getWeight));
        if (!ObjectUtils.isEmpty(categoryDOS)) {
            categoryDOS.forEach(categoryDO -> {
                ConvenientServiceCategoryVO categoryVO = new ConvenientServiceCategoryVO();
                BeanUtils.copyProperties(categoryDO, categoryVO);
                categoryVOList.add(categoryVO);
            });
        }
        return R.ok(categoryVOList);
    }
    @Override
    public R getSuitableServiceCategories(Long communityId) {
        return R.ok(this.baseMapper.selectSuitableServiceCategories(communityId));
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientConsultationStatisticsMapper.xml
New file
@@ -0,0 +1,39 @@
<?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.panzhihua.service_community.dao.ConvenientConsultationStatisticsDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientConsultationStatisticsDO">
                <id column="id" property="id" />
                <id column="merchant_id" property="merchantId" />
                <id column="statistic_date" property="statisticDate" />
                <id column="consultation_volume" property="consultationVolume" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,merchant_id,statistic_date,consultation_volume
    </sql>
    <insert id="createTodayStatistic">
        INSERT INTO com_convenient_consultation_statistics (merchant_id, statistic_date) VALUES (#{merchantId}, NOW())
    </insert>
    <update id="incrConsultationNum">
        UPDATE com_convenient_consultation_statistics SET consultation_volume = consultation_volume + 1
        WHERE merchant_id = #{merchantId} AND statistic_date = #{nowDate}
    </update>
    <select id="selectMonthConsultationVolume" resultType="java.lang.Integer">
        SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume))
        FROM com_convenient_consultation_statistics
        WHERE merchant_id = #{merchantId} AND (statistic_date LIKE CONCAT(#{moth}, '%') OR statistic_date IS NULL)
    </select>
    <select id="selectDayConsultationVolume" resultType="java.lang.Integer">
        SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume))
        FROM com_convenient_consultation_statistics
        WHERE merchant_id = #{merchantId} AND (statistic_date = #{day} OR statistic_date IS NULL)
    </select>
    <select id="selectSumForConsultationNum" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO">
        SELECT merchant_id, SUM(consultation_volume) AS totalConsultationNum
        FROM com_convenient_consultation_statistics GROUP BY merchant_id
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientMerchantMapper.xml
New file
@@ -0,0 +1,188 @@
<?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.panzhihua.service_community.dao.ConvenientMerchantDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientMerchantDO">
                <id column="id" property="id" />
                <id column="name" property="name" />
                <id column="community_id" property="communityId" />
                <id column="community_name" property="communityName" />
                <id column="logo" property="logo" />
                <id column="contacts" property="contacts" />
                <id column="id_card" property="idCard" />
                <id column="phone" property="phone" />
                <id column="address" property="address" />
                <id column="lat" property="lat" />
                <id column="lon" property="lon" />
                <id column="begin_at" property="beginAt" />
                <id column="end_at" property="endAt" />
                <id column="period" property="period" />
                <id column="introduction" property="introduction" />
                <id column="business_status" property="businessStatus" />
                <id column="user_id" property="userId" />
                <id column="consultation_volume" property="consultationVolume" />
                <id column="view_num" property="viewNum" />
                <id column="is_del" property="isDel" />
                <id column="created_at" property="createdAt" />
                <id column="created_by" property="createdBy" />
                <id column="updated_at" property="updatedAt" />
                <id column="updated_by" property="updatedBy" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,`name`,community_id,community_name,logo,contacts,id_card,phone,address,lat,lon,begin_at,end_at,period,introduction,
        business_status,user_id,consultation_volume,is_del,created_at,created_by,updated_at,updated_by
    </sql>
    <select id="pageMerchant" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO">
        SELECT ccm.*, su.account, su.status AS accountStatus, GROUP_CONCAT(ccss.service_name) AS serviceScope
        FROM  com_convenient_merchants ccm
        LEFT JOIN sys_user su ON ccm.user_id = su.user_id
        LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
        WHERE ccm.is_del = 0
        <if test="pageConvenientMerchantDTO.serviceId != null and pageConvenientMerchantDTO.serviceId != 0">
            AND ccss.service_category_id = #{pageConvenientMerchantDTO.serviceId}
        </if>
        <if test="pageConvenientMerchantDTO.accountStatus != null">
            AND su.status = #{pageConvenientMerchantDTO.accountStatus}
        </if>
        <if test="pageConvenientMerchantDTO.communityId != null and pageConvenientMerchantDTO.communityId != 0">
            AND ccm.community_id = #{pageConvenientMerchantDTO.communityId}
        </if>
        <if test="pageConvenientMerchantDTO.businessStatus != null">
            AND ccm.business_status = #{pageConvenientMerchantDTO.businessStatus}
        </if>
        <if test="pageConvenientMerchantDTO.keyword != null and pageConvenientMerchantDTO.keyword != &quot;&quot;">
            AND ccm.name LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%')
            AND ccm.address LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%')
            AND ccm.phone LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%')
        </if>
        GROUP BY ccm.id
    </select>
    <select id="selectMerchantById" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO">
        SELECT ccm.*, su.account, su.status AS accountStatus
        FROM  com_convenient_merchants ccm
        LEFT JOIN sys_user su ON ccm.user_id = su.user_id
        WHERE ccm.id = #{merchantId}
    </select>
    <select id="getPopularMerchants" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO">
        SELECT
            temp.id, temp.name, temp.introduction, temp.logo,
            temp.serviceScope, IF(SUM(temp.consultation_volume) is null, 0, SUM(temp.consultation_volume)) as monthConsultationVolume
        FROM (
            SELECT
                ccm.id, ccm.name, ccm.introduction, ccm.logo,
                cccs.consultation_volume,GROUP_CONCAT(ccss.service_name) AS serviceScope
            FROM com_convenient_merchants ccm
            LEFT JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id
            LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
            WHERE ccm.community_id = #{communityId} AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id
        ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC
    </select>
    <select id="getClassifyMerchants" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO">
        SELECT
            temp.id, temp.name, temp.introduction, temp.logo,
            IF(SUM(temp.consultation_volume) is null,0,SUM(temp.consultation_volume)) as monthConsultationVolume
        FROM (
            SELECT
                ccm.id, ccm.name, ccm.introduction, ccm.logo, cccs.consultation_volume
            FROM com_convenient_merchants ccm
            LEFT JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id
            LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
            WHERE ccm.community_id = #{pageClassifyMerchantDTO.communityId} AND ccss.service_category_id = #{pageClassifyMerchantDTO.serviceId}
                AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id
        ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC
    </select>
    <select id="getMerchantDetail" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO">
        SELECT
            temp.id, temp.name, temp.introduction, temp.logo, temp.phone, temp.begin_at, temp.end_at, temp.period,
            temp.address, temp.lat, temp.lon, temp.serviceScope, IF(SUM(temp.consultation_volume) is null,0,SUM(temp.consultation_volume)) as monthConsultationVolume
        FROM (
            SELECT
                ccm.id, ccm.name, ccm.introduction, ccm.logo, ccm.phone, ccm.begin_at, ccm.end_at, ccm.period,
                ccm.address, ccm.lat, ccm.lon, cccs.consultation_volume,GROUP_CONCAT(ccss.service_name) AS serviceScope
            FROM com_convenient_merchants ccm
            INNER JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id
            LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
            WHERE ccm.id = #{merchantId} AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id
        ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC
    </select>
    <select id="pageSearchMerchant" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO">
         SELECT
            temp.id, temp.name, temp.introduction, temp.logo,
            temp.serviceScope, IF(SUM(temp.consultation_volume) is null,0,SUM(temp.consultation_volume)) as monthConsultationVolume
        FROM (
            SELECT
                ccm.id, ccm.name, ccm.introduction, ccm.logo,
                cccs.consultation_volume,GROUP_CONCAT(ccss.service_name) AS serviceScope
            FROM com_convenient_merchants ccm
            INNER JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id
            LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
            WHERE ccm.community_id = #{pageSearchDTO.communityId} AND ccm.`name` LIKE CONCAT('%', #{pageSearchDTO.keyword}, '%')
                AND ccm.is_del = 0 AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id
        ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC
    </select>
    <select id="exportMerchantBySearch" resultType="com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO">
        SELECT ccm.*, su.account, su.status AS accountStatus, GROUP_CONCAT(ccss.service_name) AS serviceScope,
            CONCAT(ccm.period,DATE_FORMAT(ccm.begin_at,'%T'),'~',DATE_FORMAT(ccm.end_at,'%T')) AS businessTime
        FROM  com_convenient_merchants ccm
        LEFT JOIN sys_user su ON ccm.user_id = su.user_id
        LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
        WHERE ccm.community_id = #{exportMerchantDTO.communityId} AND ccm.is_del = 0
        <if test="exportMerchantDTO.serviceId != null and exportMerchantDTO.serviceId != 0">
            AND ccss.service_category_id = #{exportMerchantDTO.serviceId}
        </if>
        <if test="exportMerchantDTO.accountStatus != null">
            AND su.status = #{exportMerchantDTO.accountStatus}
        </if>
        <if test="exportMerchantDTO.businessStatus != null">
            AND ccm.business_status = #{exportMerchantDTO.businessStatus}
        </if>
        <if test="exportMerchantDTO.keyword != null and exportMerchantDTO.keyword != &quot;&quot;">
            AND ccm.name LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%')
            AND ccm.address LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%')
            AND ccm.phone LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%')
        </if>
        GROUP BY ccm.id
    </select>
    <select id="exportMerchantByIds" resultType="com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO">
        SELECT ccm.*, su.account, su.status AS accountStatus, GROUP_CONCAT(ccss.service_name) AS serviceScope,
        CONCAT(ccm.period,DATE_FORMAT(ccm.begin_at,'%T'),'~',DATE_FORMAT(ccm.end_at,'%T')) AS businessTime
        FROM  com_convenient_merchants ccm
        LEFT JOIN sys_user su ON ccm.user_id = su.user_id
        LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
        WHERE ccm.id IN
            <foreach collection="needExportIds" open="(" separator="," close=")" index="index" item="item">
                #{item}
            </foreach>
        GROUP BY ccm.id
    </select>
    <update id="deleteMerchantById">
        UPDATE com_convenient_merchants SET is_del = 1, updated_by = #{operator} WHERE id = #{merchantId}
    </update>
    <update id="batchUpdateMerchantConsultationNum">
        UPDATE `com_convenient_merchants` SET consultation_volume = CASE id
        <foreach collection="consultationVOList" item="item" index="index">
            WHEN #{item.merchantId} THEN #{item.totalConsultationNum}
        </foreach>
        END
        WHERE id = CASE id
        <foreach collection="consultationVOList" item="item" index="index">
            WHEN #{item.merchantId} THEN #{item.merchantId}
        </foreach>
        END
    </update>
    <update id="batchUpdateMerchantViewNum">
        UPDATE `com_convenient_merchants` SET view_num = CASE id
        <foreach collection="viewVOList" item="item" index="index">
            WHEN #{item.merchantId} THEN #{item.totalViewNum}
        </foreach>
        END
        WHERE id = CASE id
        <foreach collection="viewVOList" item="item" index="index">
            WHEN #{item.merchantId} THEN #{item.merchantId}
        </foreach>
        END
    </update>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductCategoryMapper.xml
New file
@@ -0,0 +1,37 @@
<?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.panzhihua.service_community.dao.ConvenientProductCategoryDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO">
                <id column="id" property="id" />
                <id column="name" property="name" />
                <id column="remark" property="remark" />
                <id column="weight" property="weight" />
                <id column="is_del" property="isDel" />
                <id column="created_at" property="createdAt" />
                <id column="created_by" property="createdBy" />
                <id column="updated_at" property="updatedAt" />
                <id column="updated_by" property="updatedBy" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
    id,`name`,remark,weight,is_del,created_at,created_by,updated_at,updated_by
    </sql>
    <select id="pageProductCategory" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO">
        SELECT <include refid="Base_Column_List"/>
        FROM com_convenient_product_categories
        WHERE is_del = 0
        <if test="pageConvenientProductCategoryDTO.name != null and pageConvenientProductCategoryDTO.name.trim() != &quot;&quot;">
            AND `name` LIKE concat('%', #{pageConvenientProductCategoryDTO.name}, '%' )
        </if>
        ORDER BY weight DESC
    </select>
    <select id="selectAllCategories" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO">
        SELECT <include refid="Base_Column_List"/>
        FROM com_convenient_product_categories
        WHERE is_del = 0 ORDER BY weight DESC
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml
New file
@@ -0,0 +1,76 @@
<?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.panzhihua.service_community.dao.ConvenientProductDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientProductDO">
                <id column="id" property="id" />
                <id column="name" property="name" />
                <id column="category_id" property="categoryId" />
                <id column="merchant_id" property="merchantId" />
                <id column="on_shelf" property="onShelf" />
                <id column="introduction" property="introduction" />
                <id column="is_del" property="isDel" />
                <id column="view_num" property="viewNum" />
                <id column="created_at" property="createdAt" />
                <id column="created_by" property="createdBy" />
                <id column="updated_at" property="updatedAt" />
                <id column="updated_by" property="updatedBy" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,`name`,category_id,merchant_id,on_shelf,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by
    </sql>
    <update id="batchDeleteByIds">
        UPDATE com_convenient_products SET is_del = 1 WHERE id IN
        <foreach collection="needDelIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
    </update>
    <update id="batchOnShelfOrOffShelfByIds">
        UPDATE com_convenient_products SET on_shelf = #{saleStatus}, updated_by = #{updatedBy} WHERE id IN
        <foreach collection="needDealIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
    </update>
    <update id="incrProductView">
        UPDATE com_convenient_products SET view_num = view_num + 1 WHERE id = #{productId}
    </update>
    <select id="pageProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO">
        SELECT ccp.id, ccp.name,ccpc.name AS categoryName,ccp.view_num,ccp.on_shelf
        FROM com_convenient_products ccp
        LEFT JOIN com_convenient_product_categories ccpc ON ccp.category_id = ccpc.id
        WHERE ccp.merchant_id = #{pageConvenientProductDTO.merchantId} AND ccp.is_del = 0
        <if test="pageConvenientProductDTO.name != null and pageConvenientProductDTO.name != &quot;&quot;">
            AND ccp.name LIKE CONCAT('%', #{pageConvenientProductDTO.name}, '%')
        </if>
        <if test="pageConvenientProductDTO.categoryId != null and pageConvenientProductDTO.categoryId != 0">
            AND ccp.category_id = #{pageConvenientProductDTO.categoryId}
        </if>
        <if test="pageConvenientProductDTO.onShelf != null">
            AND ccp.on_shelf = #{pageConvenientProductDTO.onShelf}
        </if>
    </select>
    <select id="getMerchantProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO">
        SELECT  ccp.id, ccp.name, ccp.category_id, ccp.on_shelf_at, ccp.introduction, ccpc.name AS categoryName
        FROM com_convenient_products ccp
        LEFT JOIN com_convenient_product_categories ccpc ON ccp.category_id = ccpc.id
        INNER JOIN com_convenient_product_specifications ccps ON ccp.id = ccps.product_id
        WHERE ccp.merchant_id = #{merchantId} AND ccp.is_del = 0
        AND ccp.on_shelf = 1 AND ccps.is_del = 0 GROUP BY ccp.id ORDER BY ccpc.weight DESC
    </select>
    <select id="getProductSpecifications" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductSpecificationVO">
        SELECT  ccps.id, ccps.name, ccps.price, ccps.image, ccps.product_id
        FROM com_convenient_products ccp
        LEFT JOIN com_convenient_product_categories ccpc ON ccp.category_id = ccpc.id
        INNER JOIN com_convenient_product_specifications ccps ON ccp.id = ccps.product_id
        WHERE ccp.merchant_id = #{merchantId} AND ccp.is_del = 0 AND ccp.on_shelf = 1 AND ccps.is_del = 0
    </select>
    <select id="pageSearchProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO">
        SELECT ccp.id,ccp.`name`,ccp.category_id,ccp.merchant_id,ccp.introduction
        FROM com_convenient_products ccp
        LEFT JOIN com_convenient_merchants ccm  ON  ccp.merchant_id = ccm.id
        WHERE ccm.community_id = #{pageSearchDTO.communityId} AND ccp.`name` LIKE CONCAT('%', #{pageSearchDTO.keyword}, '%')
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductSpecificationMapper.xml
New file
@@ -0,0 +1,46 @@
<?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.panzhihua.service_community.dao.ConvenientProductSpecificationDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientProductSpecificationDO">
                <id column="id" property="id" />
                <id column="name" property="name" />
                <id column="price" property="price" />
                <id column="image" property="image" />
                <id column="product_id" property="productId" />
                <id column="is_del" property="isDel" />
                <id column="created_at" property="createdAt" />
                <id column="created_by" property="createdBy" />
                <id column="updated_at" property="updatedAt" />
                <id column="updated_by" property="updatedBy" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
    id,`name`,price,image,product_id,is_del,created_at,created_by,updated_at,updated_by
    </sql>
    <insert id="batchInsert">
        INSERT INTO `com_convenient_product_specifications`(name,price,image,product_id,created_at,created_by)
        VALUES
        <foreach collection="productSpecificationDOList" item="item" index="index" separator="," >
            (#{item.name}, #{item.price}, #{item.image}, #{item.productId}, #{item.createdAt}, #{item.createdBy})
        </foreach>
    </insert>
    <update id="deleteLoseRelationSpecifications" parameterType="java.util.List">
        UPDATE com_convenient_product_specifications SET is_del = 1
        WHERE id NOT IN
        <foreach collection="notNeedDelIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
    </update>
    <update id="batchDeleteByProductIds">
        UPDATE com_convenient_product_specifications SET is_del = 1
        WHERE id IN
        <foreach collection="needDelProductIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
    </update>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientServiceCategoryMapper.xml
New file
@@ -0,0 +1,55 @@
<?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.panzhihua.service_community.dao.ConvenientServiceCategoryDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO">
                <id column="id" property="id" />
                <id column="name" property="name" />
                <id column="icon" property="icon" />
                <id column="remark" property="remark" />
                <id column="weight" property="weight" />
                <id column="is_del" property="isDel" />
                <id column="created_at" property="createdAt" />
                <id column="created_by" property="createdBy" />
                <id column="updated_at" property="updatedAt" />
                <id column="updated_by" property="updatedBy" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
    id,`name`,icon,remark,weight,is_del,created_at,created_by,updated_at,updated_by
    </sql>
    <insert id="createMerchantServiceRelation">
        INSERT INTO com_convenient_service_scope (merchant_id, service_category_id, service_name, created_by, created_at)
        VALUES (#{merchantId}, #{serviceId}, #{name}, #{createdBy}, NOW())
    </insert>
    <delete id="deleteMerchantServiceRelation">
        DELETE FROM com_convenient_service_scope WHERE merchant_id = #{merchantId}
    </delete>
    <select id="pageServiceCategory" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO">
        SELECT <include refid="Base_Column_List"/>
        FROM com_convenient_service_categories
        WHERE is_del = 0
            <if test="pageConvenientServiceCategoryDTO.name != null and pageConvenientServiceCategoryDTO.name.trim() != &quot;&quot;">
                AND `name` LIKE concat('%', #{pageConvenientServiceCategoryDTO.name}, '%' )
            </if>
        ORDER BY weight DESC
    </select>
    <select id="selectServiceScopeByMerchantId" resultType="java.lang.String">
        SELECT GROUP_CONCAT(`service_name`) serviceScope FROM com_convenient_service_scope WHERE merchant_id = #{merchantId}
    </select>
    <select id="selectServiceIdsForMerchant" resultType="java.lang.Long">
        SELECT service_category_id FROM com_convenient_service_scope WHERE merchant_id = #{merchantId}
    </select>
    <select id="checkCategoryIsUsing" resultType="java.lang.Integer">
        SELECT COUNT(1) FROM com_convenient_service_scope WHERE service_category_id = #{categoryId}
    </select>
    <select id="selectSuitableServiceCategories" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO">
        SELECT ccsc.id, ccsc.name, ccsc.icon, ccsc.remark, ccsc.weight
        FROM com_convenient_service_categories ccsc
        INNER JOIN com_convenient_service_scope ccss ON ccsc.id = ccss.service_category_id
        LEFT JOIN com_convenient_merchants ccm ON ccss.merchant_id = ccm.id
        WHERE ccsc.is_del = 0 AND ccm.is_del = 0 AND ccm.community_id = #{communityId} GROUP BY ccsc.id
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientViewStatisticsMapper.xml
New file
@@ -0,0 +1,39 @@
<?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.panzhihua.service_community.dao.ConvenientViewStatisticsDAO">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientViewStatisticsDO">
                <id column="id" property="id" />
                <id column="merchant_id" property="merchantId" />
                <id column="statistic_date" property="statisticDate" />
                <id column="view_num" property="viewNum" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,merchant_id,statistic_date,view_num
    </sql>
    <insert id="createTodayStatistic">
        INSERT INTO com_convenient_view_statistics (merchant_id, statistic_date) VALUES (#{merchantId}, NOW())
    </insert>
    <update id="incrViewNum">
        UPDATE com_convenient_view_statistics SET view_num = view_num + 1
        WHERE merchant_id = #{merchantId} AND statistic_date = #{nowDate}
    </update>
    <select id="selectMonthViewNum" resultType="java.lang.Integer">
        SELECT IF(SUM(view_num) IS NULL,0,SUM(view_num))
        FROM com_convenient_view_statistics
        WHERE merchant_id = #{merchantId} AND (statistic_date LIKE CONCAT(#{moth}, '%') OR statistic_date IS NULL)
    </select>
    <select id="selectDayViewNum" resultType="java.lang.Integer">
        SELECT IF(SUM(view_num) IS NULL,0,SUM(view_num))
        FROM com_convenient_view_statistics
        WHERE merchant_id = #{merchantId} AND (statistic_date = #{day} OR statistic_date IS NULL)
    </select>
    <select id="selectSumForViewNum" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientViewStatisticsVO">
        SELECT merchant_id, SUM(view_num) AS totalViewNum
        FROM com_convenient_view_statistics GROUP BY merchant_id
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -4,6 +4,8 @@
import javax.annotation.Resource;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import org.springframework.web.bind.annotation.*;
import com.panzhihua.common.model.dtos.PageDTO;
@@ -1147,4 +1149,35 @@
    public R checkCurrentUserIsTeam(String phone, Long communityId) {
        return userService.checkCurrentUserIsTeam(phone, communityId);
    }
    /**
     * 便民服务新增商家账号
     * @param convenientMerchantDTO
     * @return 商家用户id
     */
    @PostMapping("insertMerchantAccount")
    public R addConvenientMerchantUser(@RequestBody ConvenientMerchantDTO convenientMerchantDTO) {
        return userService.addConvenientMerchantUser(convenientMerchantDTO);
    }
    /**
     * 修改便民服务商家绑定账号
     * @param userId 用户id
     * @param account 修改账户
     * @return 修改结果
     */
    @PutMapping("putMerchantUserAccount")
    public R putUserAccount(@RequestParam("userId") Long userId, @RequestParam("account") String account) {
        return userService.putUserAccount(userId, account);
    }
    /**
     * 禁用/启用便民服务商家用户
     * @param disableOrEnableConvenientMerchantDTO
     * @return
     */
    @PutMapping("disableOrEnableMerchantUsers")
    public R disableOrEnableMerchantUsers(@RequestBody DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO) {
        return userService.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java
@@ -6,6 +6,8 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -166,4 +168,11 @@
    int putUserTag(@Param("sysUserDO") SysUserDO sysUserDO);
    /**
     * 禁用/启用便民服务商家账号
     * @param status
     * @param userIds
     * @return
     */
    int disableOrEnableMerchantUsers(@Param("status") Integer status, @Param("userIds") List<Long> userIds);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java
@@ -5,6 +5,8 @@
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.dtos.community.ExportUserDTO;
import com.panzhihua.common.model.dtos.community.NoticeReadDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.dtos.user.PageFeedBackDTO;
import com.panzhihua.common.model.dtos.user.PageUserAppletsBackstageDTO;
@@ -698,4 +700,26 @@
     * 重置密码
     */
    R resetPassword(Long userId);
    /**
     * 便民服务新增商家账号
     * @param convenientMerchantDTO
     * @return 商家用户id
     */
    R addConvenientMerchantUser(ConvenientMerchantDTO convenientMerchantDTO);
    /**
     * 修改便民服务商家绑定账号
     * @param userId 用户id
     * @param account 修改账户
     * @return 修改结果
     */
    R putUserAccount(Long userId, String account);
    /**
     * 禁用/启用便民服务商家用户
     * @param disableOrEnableConvenientMerchantDTO
     * @return
     */
    R disableOrEnableMerchantUsers(DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -1,6 +1,15 @@
package com.panzhihua.service_user.service.impl;
import java.util.*;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@@ -26,19 +35,80 @@
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.dtos.community.ExportUserDTO;
import com.panzhihua.common.model.dtos.community.NoticeReadDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.dtos.user.*;
import com.panzhihua.common.model.vos.*;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberAddDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberEditAdminDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberEditStatusDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberPassResetDTO;
import com.panzhihua.common.model.dtos.grid.PageEventGridMemberRelationDTO;
import com.panzhihua.common.model.dtos.user.EexcelUserDTO;
import com.panzhihua.common.model.dtos.user.PageFeedBackDTO;
import com.panzhihua.common.model.dtos.user.PageUserAppletsBackstageDTO;
import com.panzhihua.common.model.dtos.user.SysUserEditTipsDTO;
import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO;
import com.panzhihua.common.model.vos.AppletUserInfoVO;
import com.panzhihua.common.model.vos.EditUserInfoPassAppDTO;
import com.panzhihua.common.model.vos.IndexDataKanbanVO;
import com.panzhihua.common.model.vos.IndexDataVO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.SystemmanagementConfigVO;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO;
import com.panzhihua.common.model.vos.grid.GridMemberVO;
import com.panzhihua.common.model.vos.grid.admin.GridMemberBuildingVO;
import com.panzhihua.common.model.vos.partybuilding.ActivityManagerVO;
import com.panzhihua.common.model.vos.shop.ShopStoreVO;
import com.panzhihua.common.model.vos.user.*;
import com.panzhihua.common.utlis.*;
import com.panzhihua.service_user.dao.*;
import com.panzhihua.service_user.model.dos.*;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.common.model.vos.user.ChangePasswordVO;
import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
import com.panzhihua.common.model.vos.user.ComMngUserTagVO;
import com.panzhihua.common.model.vos.user.CommunityUserInfoVO;
import com.panzhihua.common.model.vos.user.MenuRoleVO;
import com.panzhihua.common.model.vos.user.NoticeUnReadVO;
import com.panzhihua.common.model.vos.user.SysOperLogVO;
import com.panzhihua.common.model.vos.user.SysUserAgreementVO;
import com.panzhihua.common.model.vos.user.SysUserFeedbackVO;
import com.panzhihua.common.model.vos.user.SysUserNoticeVO;
import com.panzhihua.common.model.vos.user.SysUserVO;
import com.panzhihua.common.model.vos.user.UpdateUserArchivesVO;
import com.panzhihua.common.model.vos.user.UserArchivesVO;
import com.panzhihua.common.model.vos.user.UserPhoneVO;
import com.panzhihua.common.utlis.IdCard;
import com.panzhihua.common.utlis.SensitiveUtil;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.common.utlis.WxUtil;
import com.panzhihua.common.utlis.WxXCXTempSend;
import com.panzhihua.service_user.dao.ComMngFamilyInfoDAO;
import com.panzhihua.service_user.dao.ComMngUserTagDAO;
import com.panzhihua.service_user.dao.EventGridMemberBuildingRelationMapper;
import com.panzhihua.service_user.dao.LcCompareMemberCodeMapper;
import com.panzhihua.service_user.dao.RoleDAO;
import com.panzhihua.service_user.dao.SysMenuDAO;
import com.panzhihua.service_user.dao.SysOperLogDAO;
import com.panzhihua.service_user.dao.SysRoleMenuDAO;
import com.panzhihua.service_user.dao.SysUserAgreementDAO;
import com.panzhihua.service_user.dao.SysUserFeedbackDAO;
import com.panzhihua.service_user.dao.SysUserInputDAO;
import com.panzhihua.service_user.dao.SysUserNoticeDAO;
import com.panzhihua.service_user.dao.SysUserRoleDAO;
import com.panzhihua.service_user.dao.UserDao;
import com.panzhihua.service_user.model.dos.ComMngFamilyInfoDO;
import com.panzhihua.service_user.model.dos.ComMngUserTagDO;
import com.panzhihua.service_user.model.dos.EventGridMemberBuildingRelationDO;
import com.panzhihua.service_user.model.dos.LcCompareCodeMemberDO;
import com.panzhihua.service_user.model.dos.SysMenuDO;
import com.panzhihua.service_user.model.dos.SysOperLogDO;
import com.panzhihua.service_user.model.dos.SysRoleDO;
import com.panzhihua.service_user.model.dos.SysRoleMenuDO;
import com.panzhihua.service_user.model.dos.SysUserAgreementDO;
import com.panzhihua.service_user.model.dos.SysUserDO;
import com.panzhihua.service_user.model.dos.SysUserFeedbackDO;
import com.panzhihua.service_user.model.dos.SysUserInputDO;
import com.panzhihua.service_user.model.dos.SysUserNoticeDO;
import com.panzhihua.service_user.model.dos.SysUserRoleDO;
import com.panzhihua.service_user.model.dtos.DataKanbanDTO;
import com.panzhihua.service_user.service.EventGridMemberBuildingRelationService;
import com.panzhihua.service_user.service.UserService;
@@ -2493,4 +2563,99 @@
        }
        return R.fail();
    }
    /**
     * 便民服务新增商家账号
     * @param convenientMerchantDTO
     * @return 商家用户id
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R addConvenientMerchantUser(ConvenientMerchantDTO convenientMerchantDTO) {
        SysUserDO sysUserDO = new SysUserDO();
        Long communityId = 0L;
        // 新增社区高级管理员角色
        SysRoleDO sysRoleDO = new SysRoleDO();
        sysRoleDO.setCommunityId(0L);
        sysRoleDO.setRoleName(convenientMerchantDTO.getName());
        sysRoleDO.setRoleKey(Constants.CONVENIENT_MERCHANT_ROLE_KEY + convenientMerchantDTO.getAccount());
        sysRoleDO.setRoleSort(0);
        sysRoleDO.setCreateBy(convenientMerchantDTO.getCreatedBy());
        try {
            int insert = roleDAO.insert(sysRoleDO);
            if (insert != 1) {
                return R.fail("网络错误");
            }
        } catch (Exception e) {
            log.error("新增角色报错【{}】", e.getMessage());
            if (e.getMessage().contains("unique_role_name_community_id")) {
                return R.fail("商家名称已被占用");
            } else {
                return R.fail("建立商家角色失败");
            }
        }
        // 新角色设置所有权限
        MenuRoleVO menuRoleVO = new MenuRoleVO();
        menuRoleVO.setIsAll(1);
        menuRoleVO.setCommunityId(communityId);
        menuRoleVO.setRoleId(sysRoleDO.getRoleId());
        this.putMenuRole(menuRoleVO);
        // sys_user 表
        String encode = new BCryptPasswordEncoder().encode(convenientMerchantDTO.getPassword());
        BeanUtils.copyProperties(convenientMerchantDTO, sysUserDO);
        sysUserDO.setAccount(convenientMerchantDTO.getAccount());
        sysUserDO.setType(10);
        sysUserDO.setAreaId(null);
        sysUserDO.setStatus(1);
        sysUserDO.setPhone(convenientMerchantDTO.getPhone());
        sysUserDO.setName(convenientMerchantDTO.getContacts());
        sysUserDO.setPassword(encode);
        try {
            userDao.insert(sysUserDO);
            return R.ok(sysUserDO.getUserId());
        } catch (Exception e) {
            e.printStackTrace();
            log.error("新增后台用户报错【{}】", e.getMessage());
            roleDAO.deleteByRoleKey(Constants.CONVENIENT_MERCHANT_ROLE_KEY + convenientMerchantDTO.getAccount());
            if (e.getMessage().contains("union_phone_type")) {
                return R.fail("手机号已经存在");
            } else if (e.getMessage().contains("union_account_type")) {
                return R.fail("账户已经存在");
            }
        }
        return R.fail("新增商户发生错误");
    }
    /**
     * 修改便民服务商家绑定账号
     * @param userId 用户id
     * @param account 修改账户
     * @return 修改结果
     */
    @Override
    public R putUserAccount(Long userId, String account) {
        SysUserDO sysUserDO = userDao.selectById(userId);
        if (isNull(sysUserDO)) {
            return R.fail("用户不存在");
        }
        String oldAccount = sysUserDO.getAccount();
        sysUserDO.setAccount(account);
        int result = userDao.updateById(sysUserDO);
        if (result > 0) {
            SysRoleDO sysRoleDO = roleDAO.selectOne(new QueryWrapper<SysRoleDO>()
                    .lambda().eq(SysRoleDO::getRoleKey, Constants.CONVENIENT_MERCHANT_ROLE_KEY + oldAccount));
            if (nonNull(sysRoleDO)) {
                sysRoleDO.setRoleKey(Constants.CONVENIENT_MERCHANT_ROLE_KEY + account);
                roleDAO.updateById(sysRoleDO);
            }
        }
        return R.ok();
    }
    @Override
    public R disableOrEnableMerchantUsers(DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO) {
        userDao.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO.getType(), disableOrEnableConvenientMerchantDTO.getIds());
        return R.ok();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/SysUserDOMapper.xml
@@ -46,6 +46,13 @@
    <sql id="Base_Column_List">
        user_id, account, password, openid, session_key, unionid, phone, nick_name, name, community_id, sex, id_card, birthday, image_url, type, job, is_volunteer, is_partymember, status, create_at, last_login_time, tags, family_id, face_url, face_state, reject_reson, area_id, card_photo_front, card_photo_back, family_book, continuous_landing_days, is_tips, work_status, work_start_time, work_end_time, big_age_tips
    </sql>
    <update id="disableOrEnableMerchantUsers">
        UPDATE sys_user SET status = #{status}
        WHERE user_id IN
        <foreach collection="userIds" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
    <select id="pageUser" parameterType="com.panzhihua.common.model.vos.AppletUserInfoVO"
            resultType="com.panzhihua.common.model.vos.AppletUserInfoVO">
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/ConvenientApi.java
New file
@@ -0,0 +1,309 @@
package com.panzhihua.shop_backstage.api;
import java.io.InputStream;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductShelfVO;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.constants.FtpConstants;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO;
import com.panzhihua.common.model.dtos.user.ConvenientResetPasswordDTO;
import com.panzhihua.common.model.vos.LoginReturnVO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.common.model.vos.shop.LoginMerchantUserInfoVO;
import com.panzhihua.common.model.vos.user.ChangePasswordVO;
import com.panzhihua.common.service.auth.TokenService;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import com.panzhihua.shop_backstage.model.vos.LoginBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
/**
 * @title: ConvenientApi
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 便民服务商家后台相关
 * @author: hans
 * @date: 2021/09/17 16:22
 */
@Slf4j
@RestController
@RequestMapping("/convenient")
@Api(tags = {"便民服务商家后台相关"})
public class ConvenientApi extends BaseController {
    @Resource
    private TokenService tokenService;
    @Resource
    private UserService userService;
    @Resource
    private CommunityService communityService;
    // FTP 登录用户名
    @Value("${ftp.username}")
    private String userName;
    // FTP 登录密码
    @Value("${ftp.password}")
    private String password;
    // FTP 服务器地址IP地址
    @Value("${ftp.host}")
    private String host;
    // FTP 端口
    @Value("${ftp.port}")
    private int port;
    @Value("${ftp.url}")
    private String url;
    @ApiOperation(value = "便民服务商家后台登录", response = LoginReturnVO.class)
//    @ShopOperLog(operType = 1)
    @PostMapping("/login")
    public R login(@RequestBody @Valid LoginBody loginBody) {
        String account = loginBody.getAccount();
        log.info("登录用户信息【{}】", loginBody);
        try {
            R<ConvenientMerchantVO> merchant = communityService.getUserMerchantInfoByAccount(account);
            if (R.isOk(merchant)) {
                ConvenientMerchantVO merchantVO =
                        JSONObject.parseObject(JSONObject.toJSONString(merchant.getData()), ConvenientMerchantVO.class);
                Boolean accountValid = merchantVO.getAccountStatus() == 1;
                if (accountValid) {
                    R result = tokenService.loginMerchantBackStage(account, loginBody.getPassword());
                    return result;
                } else {
                    return R.fail("账号被禁用");
                }
            }
            return R.fail(merchant.getMsg());
        } catch (Exception e) {
            return R.fail("登陆失败了");
        }
    }
    @ApiOperation(value = "修改密码")
    @PutMapping("/reset-password")
//    @ShopOperLog(operType = 2)
    public R resetPassword(@RequestBody @Valid ConvenientResetPasswordDTO convenientResetPasswordDTO) {
        String newPassword = convenientResetPasswordDTO.getNewPassword();
        String oldPassword = convenientResetPasswordDTO.getOldPassword();
        if (newPassword.equals(oldPassword)) {
            return R.fail("修改失败,新密码和原密码一致");
        }
        ChangePasswordVO changePasswordVO = new ChangePasswordVO();
        changePasswordVO.setOldPassword(oldPassword);
        changePasswordVO.setNewPassword(newPassword);
        changePasswordVO.setUserId(this.getUserId());
        return userService.changePassword(changePasswordVO);
    }
    @ApiOperation(value = "当前登录用户信息", response = LoginMerchantUserInfoVO.class)
    @GetMapping("/userInfo")
    public R detailUser() {
        Long userId = this.getUserId();
        R<LoginUserInfoVO> loginUserInfoVOR = userService.detailUser(userId);
        try {
            LoginUserInfoVO loginUserInfoVO =
                    JSONObject.parseObject(JSONObject.toJSONString(loginUserInfoVOR.getData()), LoginUserInfoVO.class);
            loginUserInfoVO.setPassword("******");
            R<ConvenientMerchantVO> merchantVO = communityService.getUserConvenientMerchantInfo(userId);
            LoginMerchantUserInfoVO loginMerchantUserInfoVO = new LoginMerchantUserInfoVO();
            BeanUtils.copyProperties(loginUserInfoVO, loginMerchantUserInfoVO);
            if (R.isOk(merchantVO) && merchantVO.getData() != null) {
                ConvenientMerchantVO convenientMerchantVO =
                        JSONObject.parseObject(JSONObject.toJSONString(merchantVO.getData()), ConvenientMerchantVO.class);
                convenientMerchantVO.setAccount(loginUserInfoVO.getAccount());
                convenientMerchantVO.setAccountStatus(loginUserInfoVO.getStatus());
                loginMerchantUserInfoVO.setMerchantInfo(convenientMerchantVO);
            }
            return R.ok(loginMerchantUserInfoVO);
        } catch (Exception e) {
            e.printStackTrace();
            return R.fail("获取登陆商家用户信息失败");
        }
    }
    @ApiOperation(value = "所有服务分类", response = ConvenientServiceCategoryVO.class)
    @GetMapping("/service-category/all")
    public R getAllServiceCategories() {
        return communityService.getAllServiceCategories();
    }
    @ApiOperation(value = "编辑便民服务商家")
    @PutMapping("/merchant/put")
    public R putMerchant(@RequestBody @Validated(PutGroup.class) ConvenientMerchantDTO convenientMerchantDTO) {
        convenientMerchantDTO.setUpdatedBy(this.getUserId());
        convenientMerchantDTO.setCreatedBy(this.getUserId());
        return communityService.putMerchant(convenientMerchantDTO);
    }
    @ApiOperation(value = "上传文件")
    @PostMapping(value = "/upload/file", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R uploadImage(@RequestParam MultipartFile file, HttpServletRequest request) {
        String extension = FilenameUtils.getExtension(file.getOriginalFilename());
        String name = UUID.randomUUID().toString().replaceAll("-", "") + "." + extension;
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            InputStream is = file.getInputStream();
            sftp.uploadMore(FtpConstants.FTPFILEPATH_IDCARD, name, is);
            sftp.logout();
            return R.ok(url + "/idcard/" + name);
        } catch (Exception e) {
            log.error("上传照片失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "新增产品分类")
    @PostMapping("/product-category/add")
    public R addProductCategory(@RequestBody @Validated(AddGroup.class) ConvenientProductCategoryDTO convenientProductCategoryDTO) {
        convenientProductCategoryDTO.setCreatedBy(this.getUserId());
        return communityService.addProductCategory(convenientProductCategoryDTO);
    }
    @ApiOperation(value = "编辑产品分类")
    @PutMapping("/product-category/put")
    public R putProductCategory(@RequestBody @Validated(PutGroup.class) ConvenientProductCategoryDTO convenientProductCategoryDTO) {
        convenientProductCategoryDTO.setUpdatedBy(this.getUserId());
        return communityService.putProductCategory(convenientProductCategoryDTO);
    }
    @ApiOperation(value = "删除产品分类")
    @DeleteMapping("/product-category/delete")
    public R deleteProductCategory(@RequestParam("categoryId")
                                   @ApiParam(value = "产品分类id", required = true)
                                           Long categoryId) {
        return communityService.deleteProductCategory(categoryId, this.getUserId());
    }
    @ApiOperation(value = "查询产品分类详情", response = ConvenientProductCategoryVO.class)
    @GetMapping("/product-category/get")
    public R getProductCategory(@RequestParam("categoryId")
                                @ApiParam(value = "产品分类id", required = true)
                                        Long categoryId) {
        return communityService.getProductCategory(categoryId);
    }
    @ApiOperation(value = "分页查询产品分类", response = ConvenientProductCategoryVO.class)
    @PostMapping("/product-category/page")
    public R pageProductCategory(@RequestBody PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO) {
        return communityService.pageProductCategory(pageConvenientProductCategoryDTO);
    }
    @ApiOperation(value = "获取所有产品分类", response = ConvenientProductCategoryVO.class)
    @GetMapping("/product-category/all")
    public R getAllProductCategory() {
        return communityService.getAllProductCategory();
    }
    @ApiOperation(value = "便民服务商家后台新增产品")
    @PostMapping("/product/add")
    public R addProduct(@RequestBody @Validated(AddGroup.class) ConvenientProductDTO convenientProductDTO) {
        Long userId = this.getUserId();
        convenientProductDTO.setCreatedBy(userId);
        R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(userId);
        if (R.isOk(merchantInfo)) {
            ConvenientMerchantVO merchantVO =
                    JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class);
            convenientProductDTO.setMerchantId(merchantVO.getId());
            return communityService.addProduct(convenientProductDTO);
        }
        return R.fail("新增失败,请重试");
    }
    @ApiOperation(value = "便民服务商家后台编辑产品")
    @PutMapping("/product/put")
    public R putProduct(@RequestBody @Validated(PutGroup.class) ConvenientProductDTO convenientProductDTO) {
        Long userId = this.getUserId();
        convenientProductDTO.setUpdatedBy(userId);
        R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(userId);
        if (R.isOk(merchantInfo)) {
            ConvenientMerchantVO merchantVO =
                    JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class);
            convenientProductDTO.setMerchantId(merchantVO.getId());
            return communityService.putProduct(convenientProductDTO);
        }
        return R.fail("保存失败,请重试");
    }
    @ApiOperation(value = "便民服务商家后台查询产品详情", response = ConvenientProductVO.class)
    @GetMapping("/product/get")
    public R getProduct(@RequestParam("productId") Long productId) {
        return communityService.getProduct(productId);
    }
    @ApiOperation(value = "便民服务商家后台分页查询产品", response = ConvenientProductVO.class)
    @PostMapping("/product/page")
    public R pageProduct(@RequestBody PageConvenientProductDTO pageConvenientProductDTO) {
        Long userId = this.getUserId();
        R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(userId);
        if (R.isOk(merchantInfo)) {
            ConvenientMerchantVO merchantVO =
                    JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class);
            pageConvenientProductDTO.setMerchantId(merchantVO.getId());
            return communityService.pageProduct(pageConvenientProductDTO);
        }
        return R.fail("获取失败,请重新尝试");
    }
    @ApiOperation(value = "便民服务商家后台删除产品")
    @DeleteMapping("/product/delete")
    public R deleteProduct(@RequestBody @Valid DeleteConvenientProductDTO deleteConvenientProductDTO) {
        deleteConvenientProductDTO.setUpdatedBy(this.getUserId());
        return communityService.deleteProduct(deleteConvenientProductDTO);
    }
    @ApiOperation(value = "上架/下架产品")
    @PutMapping("/product/onShelf-or-offShelf")
    public R onShelfOrOffShelfProduct(@RequestBody @Valid OnShelfOrOffShelfProductDTO onShelfOrOffShelfProductDTO) {
        onShelfOrOffShelfProductDTO.setUpdatedBy(this.getUserId());
        return communityService.onShelfOrOffShelfProduct(onShelfOrOffShelfProductDTO);
    }
    @ApiOperation(value = "便民服务商家后台查询产品上下架数量", response = ConvenientProductShelfVO.class)
    @GetMapping("/product/shelf-num")
    public R getProductShelfNum() {
        R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(this.getUserId());
        if (R.isOk(merchantInfo)) {
            ConvenientMerchantVO merchantVO =
                    JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class);
            return communityService.getProductShelfNum(merchantVO.getId());
        }
        return R.fail("获取失败,请重试");
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java
@@ -3,10 +3,16 @@
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.*;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.panzhihua.common.constants.HttpStatus;
import com.panzhihua.common.utlis.ResultUtil;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
@@ -15,6 +21,7 @@
import com.panzhihua.common.constants.TokenConstant;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.shop.ShopStoreVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.AES;
@@ -42,35 +49,73 @@
        HttpServletResponse response = (HttpServletResponse)servletResponse;
        String uri = request.getRequestURI();
        boolean isDoc = uri.contains("doc.html") || uri.contains("-docs");
        boolean convenientLogin = "/convenient/login".equals(uri);
        boolean isConvenientReq = uri.contains("/convenient");
        boolean storeLogin = "/login".equals(uri);
        if (!"/login".equals(uri)) {
            String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO);
            boolean empty = ObjectUtils.isEmpty(userInfo);
            if (empty) {
                log.error("获取登录用户信息失败【{}】", request);
                return;
            }
            byte[] bytes = AES.parseHexStr2Byte(userInfo);
            byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY);
            userInfo = new String(decrypt);
            LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class);
        if (isDoc) {
            //放过swagger请求
        } else {
            if (!storeLogin && !isConvenientReq) {
                String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO);
                boolean empty = ObjectUtils.isEmpty(userInfo);
                if (empty) {
                    log.error("获取登录用户信息失败【{}】", request);
                    ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token过期"));
                    return;
                }
                byte[] bytes = AES.parseHexStr2Byte(userInfo);
                byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY);
                userInfo = new String(decrypt);
                LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class);
            R r = communityService.getUserStoreInfo(loginUserInfoVO.getUserId());
            boolean shopStoreValid = false;
            if (R.isOk(r) && r.getData() != null) {
                ShopStoreVO shopStoreVO =
                    JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ShopStoreVO.class);
                shopStoreValid = shopStoreVO.getStatus() == 1;
            }
            if (!shopStoreValid) {
                // 返回请求被拒绝响应
                response.setContentType("application/json");
                response.setCharacterEncoding("UTF-8");
                response.getWriter().write(JSONObject.toJSONString(R.fail(403)));
                response.flushBuffer();
                return;
                R r = communityService.getUserStoreInfo(loginUserInfoVO.getUserId());
                boolean shopStoreValid = false;
                if (R.isOk(r) && r.getData() != null) {
                    ShopStoreVO shopStoreVO =
                            JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ShopStoreVO.class);
                    shopStoreValid = shopStoreVO.getStatus() == 1;
                }
                if (!shopStoreValid) {
                    // 返回请求被拒绝响应
                    response.setContentType("application/json");
                    response.setCharacterEncoding("UTF-8");
                    response.getWriter().write(JSONObject.toJSONString(R.fail(403)));
                    response.flushBuffer();
                    return;
                }
            } else if (!convenientLogin && isConvenientReq) {
                String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO);
                boolean empty = ObjectUtils.isEmpty(userInfo);
                if (empty) {
                    log.error("获取登录用户信息失败【{}】", request);
                    ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token过期"));
                    return;
                }
                byte[] bytes = AES.parseHexStr2Byte(userInfo);
                byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY);
                userInfo = new String(decrypt);
                LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class);
                R r = communityService.getUserMerchantInfoByAccount(loginUserInfoVO.getAccount());
                boolean merchantValid = false;
                if (R.isOk(r) && r.getData() != null) {
                    ConvenientMerchantVO merchantVO =
                            JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ConvenientMerchantVO.class);
                    merchantValid = merchantVO.getAccountStatus() == 1;
                }
                if (!merchantValid) {
                    // 返回请求被拒绝响应
                    response.setContentType("application/json");
                    response.setCharacterEncoding("UTF-8");
                    response.getWriter().write(JSONObject.toJSONString(R.fail(403)));
                    response.flushBuffer();
                    return;
                }
            }
        }
        filterChain.doFilter(servletRequest, servletResponse);
    }
}
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/model/vos/LoginBody.java
@@ -6,6 +6,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 登录
@@ -19,8 +21,10 @@
public class LoginBody {
    @ApiModelProperty(value = "登录账户")
    @NotBlank(message = "登录账户不能为空")
    private String account;
    @ApiModelProperty(value = "登录密码")
    @NotBlank(message = "登录密码不能为空")
    private String password;
}
springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java
@@ -249,4 +249,15 @@
        log.info("执行结果【{}】", r.toString());
        return ReturnT.SUCCESS;
    }
    /**
     * 定时任务每隔半小时将商家浏览量和咨询量总值计入指定商家数据中
     */
    @XxlJob("timedTaskWriteDataToMerchantJobHandler")
    public ReturnT<String> timedTaskWriteDataToMerchantJobHandler(String param) {
        log.info("定时任务每隔半小时将商家浏览量和咨询量总值计入指定商家数据中");
        R r = communityService.timedTaskWriteDataToMerchantJobHandler();
        log.info("执行结果【{}】", r.toString());
        return ReturnT.SUCCESS;
    }
}
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
@@ -249,6 +249,17 @@
                noLoginUrl.add("/api/applets/community/volunteer");
                noLoginUrl.add("/api/applets/discuss/increase-view-num");
                noLoginUrl.add("/api/applets/community/evaluate/page");
                noLoginUrl.add("/api/applets/convenient/service-category/suitable");
                noLoginUrl.add("/api/applets/convenient/merchant/popular");
                noLoginUrl.add("/api/applets/convenient/merchant/classify");
                noLoginUrl.add("/api/applets/convenient/merchant/detail");
                noLoginUrl.add("/api/applets/convenient/product/list");
                noLoginUrl.add("/api/applets/convenient/product/detail");
                noLoginUrl.add("/api/applets/convenient/merchant/search");
                noLoginUrl.add("/api/applets/convenient/product/search");
                noLoginUrl.add("/api/applets/convenient/merchant/incr-consult");
                noLoginUrl.add("/api/applets/convenient/merchant/incr-view");
                noLoginUrl.add("/api/applets/convenient/product/incr-view");
                if (noLoginUrl.contains(requestURI)) {
                    List<SimpleGrantedAuthority> authorities = new ArrayList<>();
                    authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS));