puhanshu
2021-09-18 987d3d6f0a4212c553b610882ebc6e22a225c6e7
便民服务
15个文件已修改
22个文件已添加
2314 ■■■■■ 已修改文件
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 14 ●●●●● 补丁 | 查看 | 原始文档 | 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 124 ●●●●● 补丁 | 查看 | 原始文档 | 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/DisableOrEnableConvenientMerchantDTO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientMerchantDTO.java 51 ●●●●● 补丁 | 查看 | 原始文档 | 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/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/ConvenientMerchantVO.java 84 ●●●●● 补丁 | 查看 | 原始文档 | 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/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 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientMerchantDAO.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientServiceCategoryDAO.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientMerchantDO.java 118 ●●●●● 补丁 | 查看 | 原始文档 | 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/service/ConvenientMerchantService.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientServiceCategoryService.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java 214 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientServiceCategoryServiceImpl.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientMerchantMapper.xml 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientServiceCategoryMapper.xml 45 ●●●●● 补丁 | 查看 | 原始文档 | 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 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/model/vos/LoginBody.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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());
        convenientMerchantDTO.setCreatedBy(5L);
        return communityService.addMerchant(convenientMerchantDTO);
    }
    @ApiOperation(value = "编辑便民服务商家")
    @PutMapping("/merchant/put")
    public R putMerchant(@RequestBody @Validated(PutGroup.class) ConvenientMerchantDTO convenientMerchantDTO) {
        convenientMerchantDTO.setUpdatedBy(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
@@ -197,4 +197,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
@@ -103,4 +103,12 @@
     * @return  登录结果
     */
    LoginReturnVO loginCgBackage(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
@@ -223,4 +223,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,124 @@
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: AddConvenientMerchantDTO
 * @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;
    }
}
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/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/PageConvenientMerchantDTO.java
New file
@@ -0,0 +1,51 @@
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 name;
    @ApiModelProperty("商家名称")
    private String address;
    @ApiModelProperty("咨询电话")
    private String phone;
    @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/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/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/ConvenientMerchantVO.java
New file
@@ -0,0 +1,84 @@
package com.panzhihua.common.model.vos.community.convenient;
import java.util.Date;
import java.util.List;
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("营业开始时间")
    private Date beginAt;
    @ApiModelProperty("营业截止时间")
    private Date endAt;
    @ApiModelProperty("营业周期")
    private MerchantBusinessPeriod period;
    @ApiModelProperty("商家介绍")
    private String introduction;
    @ApiModelProperty("营业状态")
    private Integer businessStatus;
    @ApiModelProperty("咨询量")
    private Integer consultationVolume;
    @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;
}
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/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
@@ -112,4 +112,16 @@
     */
    @PostMapping("/loginCgBackage")
    R loginCgBackage(@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
@@ -3,10 +3,17 @@
import java.util.List;
import com.panzhihua.common.model.dtos.community.*;
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.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
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.neighbor.*;
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -5693,4 +5700,124 @@
     */
    @PutMapping("/elders/new/authType/{type}")
    R setEldersAuthType(@RequestParam("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);
}
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.*;
@@ -997,4 +999,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/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java
@@ -5,9 +5,31 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.*;
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.PageConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO;
import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.service_community.service.ConvenientMerchantService;
import com.panzhihua.service_community.service.ConvenientServiceCategoryService;
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.ConvenientServiceCategoryDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComCvtServeExcelVO;
import com.panzhihua.service_community.service.ComCvtBusinessService;
@@ -34,6 +56,12 @@
    @Resource
    private ComCvtServeService comCvtServeService;
    @Resource
    private ConvenientServiceCategoryService convenientServiceCategoryService;
    @Resource
    private ConvenientMerchantService convenientMerchantService;
    /**
     * 社区后台分页查询便民服务商家
@@ -260,4 +288,153 @@
        @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);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientMerchantDAO.java
New file
@@ -0,0 +1,45 @@
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.PageConvenientMerchantDTO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
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;
/**
 * @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);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientServiceCategoryDAO.java
New file
@@ -0,0 +1,63 @@
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);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientMerchantDO.java
New file
@@ -0,0 +1,118 @@
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 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/service/ConvenientMerchantService.java
New file
@@ -0,0 +1,83 @@
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.PageConvenientMerchantDTO;
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);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientServiceCategoryService.java
New file
@@ -0,0 +1,58 @@
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();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
New file
@@ -0,0 +1,214 @@
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.util.Date;
import java.util.List;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.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.PageConvenientMerchantDTO;
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.ConvenientMerchantVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ConvenientMerchantDAO;
import com.panzhihua.service_community.dao.ConvenientServiceCategoryDAO;
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.model.dos.ConvenientMerchantDO;
import com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO;
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;
    @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());
            });
        }
        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);
        //填充服务范围
        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("商家不存在");
        }
        ConvenientMerchantVO convenientMerchantVO = new ConvenientMerchantVO();
        BeanUtils.copyProperties(merchantDO, convenientMerchantVO);
        List<Long> serviceIds = convenientServiceCategoryDAO.selectServiceIdsForMerchant(merchantDO.getId());
        convenientMerchantVO.setServiceIds(serviceIds);
        return null;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientServiceCategoryServiceImpl.java
New file
@@ -0,0 +1,117 @@
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不存在");
        }
        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);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientMerchantMapper.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.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="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
        FROM  com_convenient_merchants ccm
        LEFT JOIN sys_user su ON ccm.user_id = su.user_id
        <if test="pageConvenientMerchantDTO.serviceId != null and pageConvenientMerchantDTO.serviceId != 0">
            LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id
        </if>
        WHERE 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.name != null and pageConvenientMerchantDTO.name != &quot;&quot;">
            AND ccm.name LIKE CONCAT('%', #{pageConvenientMerchantDTO.name}, '%')
        </if>
        <if test="pageConvenientMerchantDTO.address != null and pageConvenientMerchantDTO.address != &quot;&quot;">
            AND ccm.address LIKE CONCAT('%', #{pageConvenientMerchantDTO.address}, '%')
        </if>
        <if test="pageConvenientMerchantDTO.phone != null and pageConvenientMerchantDTO.phone != &quot;&quot;">
            AND ccm.phone LIKE CONCAT('%', #{pageConvenientMerchantDTO.phone}, '%')
        </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>
    </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>
    <update id="deleteMerchantById">
        UPDATE com_convenient_merchants SET is_del = 1, updated_by = #{operator} WHERE id = #{merchantId}
    </update>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientServiceCategoryMapper.xml
New file
@@ -0,0 +1,45 @@
<?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>
</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;
@@ -1122,4 +1124,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;
@@ -685,4 +687,26 @@
     * @return
     */
    R checkCurrentUserIsTeam(String phone, Long communityId);
    /**
     * 便民服务新增商家账号
     * @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;
@@ -2437,4 +2507,99 @@
        }
        return R.ok(false);
    }
    /**
     * 便民服务新增商家账号
     * @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,117 @@
package com.panzhihua.shop_backstage.api;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.beans.BeanUtils;
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.RestController;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.interfaces.ShopOperLog;
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.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.shop_backstage.model.vos.LoginBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
    @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);
                loginMerchantUserInfoVO.setMerchantInfo(convenientMerchantVO);
            }
            return R.ok(loginMerchantUserInfoVO);
        } catch (Exception e) {
            e.printStackTrace();
            return R.fail("获取登陆商家用户信息失败");
        }
    }
}
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;
}