springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java
@@ -9,9 +9,6 @@ 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.validation.annotation.Validated; @@ -27,6 +24,7 @@ import com.alibaba.excel.EasyExcel; import com.jcraft.jsch.SftpException; import com.panzhihua.applets_backstage.config.MinioUtil; import com.panzhihua.common.constants.FtpConstants; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.listen.ComCvtServeExcelListen; @@ -38,8 +36,10 @@ 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.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.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComActVO; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductCategoryDTO.java
@@ -40,4 +40,7 @@ @ApiModelProperty(value = "更新人", hidden = true) private Long updatedBy; @ApiModelProperty(value = "商家id", hidden = true) private Long merchantId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageConvenientProductCategoryDTO.java
@@ -23,4 +23,7 @@ @ApiModelProperty(value = "分页-每页记录数", example = "10") private Long pageSize; @ApiModelProperty(value = "商家id", hidden = true) private Long merchantId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -6318,9 +6318,10 @@ /** * 获取所有产品分类 * @return * @param merchantId */ @GetMapping("/convenient/product-category/all") R getAllProductCategory(); R getAllProductCategory(@RequestParam("merchantId") Long merchantId); /** * 获取该社区商家数量大于0的分类 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java
@@ -570,10 +570,11 @@ /** * 获取所有产品分类 * @return * @param merchantId */ @GetMapping("/product-category/all") public R getAllProductCategory() { return convenientProductCategoryService.getAllProductCategory(); public R getAllProductCategory(@RequestParam("merchantId") Long merchantId) { return convenientProductCategoryService.getAllProductCategory(merchantId); } /** springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientMerchantDAO.java
@@ -114,4 +114,12 @@ * @return */ List<ExportMerchantVO> exportMerchantByIds(@Param("needExportIds") List<Long> needExportIds); /** * 批量更新商家营业状态 * @param convenientMerchantDOList * @param status * @return */ int batchUpdateBusinessStatus(@Param("convenientMerchantDOList") List<ConvenientMerchantDO> convenientMerchantDOList, @Param("status") int status); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductCategoryDAO.java
@@ -32,6 +32,7 @@ /** * 查询所有分类 * @return * @param merchantId */ List<ConvenientProductCategoryVO> selectAllCategories(); List<ConvenientProductCategoryVO> selectAllCategories(@Param("merchantId") Long merchantId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductCategoryDO.java
@@ -31,6 +31,10 @@ */ private String name; /** * 分类所属商家 */ private Long merchantId; /** * 备注 */ private String remark; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientProductCategoryService.java
@@ -54,6 +54,7 @@ /** * 获取所有产品分类 * @return * @param merchantId */ R getAllProductCategory(); R getAllProductCategory(Long merchantId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -189,6 +189,10 @@ List<Long> userIds = convenientMerchantDOList.stream().map(ConvenientMerchantDO::getUserId).collect(Collectors.toList()); disableOrEnableConvenientMerchantDTO.setUserIds(userIds); R result = userService.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO); int type = disableOrEnableConvenientMerchantDTO.getType().intValue(); if (type == 2) { this.baseMapper.batchUpdateBusinessStatus(convenientMerchantDOList, 2); } if (R.isOk(result)) { return R.ok(); } @@ -197,9 +201,12 @@ @Override public R resetPasswordMerchant(ResetPasswordConvenientMerchantDTO resetPasswordConvenientMerchantDTO) { List<ConvenientMerchantDO> convenientMerchantDOList = this.baseMapper.selectList(new QueryWrapper<ConvenientMerchantDO>() .lambda().in(ConvenientMerchantDO::getId, resetPasswordConvenientMerchantDTO.getIds())); List<Long> userIds = convenientMerchantDOList.stream().map(ConvenientMerchantDO::getUserId).collect(Collectors.toList()); EventGridMemberPassResetDTO eventGridMemberPassResetDTO = new EventGridMemberPassResetDTO(); eventGridMemberPassResetDTO.setPassword(resetPasswordConvenientMerchantDTO.getPassword()); eventGridMemberPassResetDTO.setIds(resetPasswordConvenientMerchantDTO.getIds()); eventGridMemberPassResetDTO.setIds(userIds); return userService.gridMemberPassReset(eventGridMemberPassResetDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductCategoryServiceImpl.java
@@ -109,7 +109,7 @@ } @Override public R getAllProductCategory() { return R.ok(this.baseMapper.selectAllCategories()); public R getAllProductCategory(Long merchantId) { return R.ok(this.baseMapper.selectAllCategories(merchantId)); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java
@@ -100,8 +100,6 @@ List<ConvenientProductSpecificationDTO> productSpecificationDTOList = convenientProductDTO.getProductSpecificationDTOList(); List<Long> notNeedDelIds = productSpecificationDTOList.stream().filter(specificationDTO -> nonNull(specificationDTO.getId())) .map(ConvenientProductSpecificationDTO::getId).collect(Collectors.toList()); //删除已失去关联的规格 convenientProductSpecificationDAO.deleteLoseRelationSpecifications(notNeedDelIds); Date nowDate = new Date(); productSpecificationDTOList.forEach(specificationDTO -> { Long specificationId = specificationDTO.getId(); @@ -121,6 +119,8 @@ convenientProductSpecificationDAO.updateById(convenientProductSpecificationDO); } }); //删除已失去关联的规格 convenientProductSpecificationDAO.deleteLoseRelationSpecifications(notNeedDelIds); return R.ok(); } @@ -247,7 +247,8 @@ if (!records.isEmpty()) { List<Long> productIds = records.stream().map(ConvenientProductVO::getId).collect(Collectors.toList()); List<ConvenientProductSpecificationDO> specificationDOS = convenientProductSpecificationDAO .selectList(new LambdaQueryWrapper<ConvenientProductSpecificationDO>().in(ConvenientProductSpecificationDO::getProductId, productIds)); .selectList(new LambdaQueryWrapper<ConvenientProductSpecificationDO>() .eq(ConvenientProductSpecificationDO::getIsDel, false).in(ConvenientProductSpecificationDO::getProductId, productIds)); List<ConvenientProductSpecificationVO> specificationVOList = new ArrayList<>(); if (!specificationDOS.isEmpty()) { specificationDOS.forEach(specificationDO -> { springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientMerchantMapper.xml
@@ -189,4 +189,11 @@ </foreach> END </update> <update id="batchUpdateBusinessStatus"> UPDATE `com_convenient_merchants` SET business_status = #{status} WHERE id IN <foreach collection="convenientMerchantDOList" open="(" separator="," close=")" item="item" index="index"> #{item.id} </foreach> </update> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductCategoryMapper.xml
@@ -6,6 +6,7 @@ <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO"> <id column="id" property="id" /> <id column="name" property="name" /> <id column="merchant_id" property="merchantId" /> <id column="remark" property="remark" /> <id column="weight" property="weight" /> <id column="is_del" property="isDel" /> @@ -17,12 +18,12 @@ <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id,`name`,remark,weight,is_del,created_at,created_by,updated_at,updated_by id,`name`,merchant_id,remark,weight,is_del,created_at,created_by,updated_at,updated_by </sql> <select id="pageProductCategory" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO"> SELECT <include refid="Base_Column_List"/> FROM com_convenient_product_categories WHERE is_del = 0 WHERE is_del = 0 AND merchant_id = #{pageConvenientProductCategoryDTO.merchantId} <if test="pageConvenientProductCategoryDTO.name != null and pageConvenientProductCategoryDTO.name.trim() != """> AND `name` LIKE concat('%', #{pageConvenientProductCategoryDTO.name}, '%' ) </if> @@ -31,7 +32,7 @@ <select id="selectAllCategories" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO"> SELECT <include refid="Base_Column_List"/> FROM com_convenient_product_categories WHERE is_del = 0 ORDER BY weight DESC WHERE is_del = 0 AND merchant_id = #{merchantId} ORDER BY weight DESC </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/entity/ComPropertyRepair.java
@@ -133,6 +133,6 @@ * 物业id */ @ApiModelProperty(value = "物业id") private Integer propertyId; private Long propertyId; } springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/ConvenientApi.java
@@ -1,5 +1,7 @@ package com.panzhihua.shop_backstage.api; import static org.apache.commons.lang3.StringUtils.isBlank; import java.io.InputStream; import java.util.ArrayList; import java.util.Comparator; @@ -11,10 +13,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductSpecificationDTO; import com.panzhihua.common.model.vos.community.convenient.ConvenientProductShelfVO; import org.apache.commons.io.FilenameUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; @@ -35,6 +34,7 @@ import com.panzhihua.common.model.dtos.community.convenient.ConvenientMerchantDTO; import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductCategoryDTO; import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductDTO; import com.panzhihua.common.model.dtos.community.convenient.ConvenientProductSpecificationDTO; import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO; import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO; import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO; @@ -45,6 +45,7 @@ import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; import com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO; import com.panzhihua.common.model.vos.community.convenient.ConvenientProductShelfVO; import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO; import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO; import com.panzhihua.common.model.vos.shop.LoginMerchantUserInfoVO; @@ -199,8 +200,15 @@ @ApiOperation(value = "新增产品分类") @PostMapping("/product-category/add") public R addProductCategory(@RequestBody @Validated(AddGroup.class) ConvenientProductCategoryDTO convenientProductCategoryDTO) { R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(this.getUserId()); if (R.isOk(merchantInfo)) { ConvenientMerchantVO merchantVO = JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class); convenientProductCategoryDTO.setCreatedBy(this.getUserId()); convenientProductCategoryDTO.setMerchantId(merchantVO.getId()); return communityService.addProductCategory(convenientProductCategoryDTO); } return R.fail("获取登录信息失败,请重新尝试"); } @ApiOperation(value = "编辑产品分类") @@ -229,19 +237,36 @@ @ApiOperation(value = "分页查询产品分类", response = ConvenientProductCategoryVO.class) @PostMapping("/product-category/page") public R pageProductCategory(@RequestBody PageConvenientProductCategoryDTO pageConvenientProductCategoryDTO) { R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(this.getUserId()); if (R.isOk(merchantInfo)) { ConvenientMerchantVO merchantVO = JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class); pageConvenientProductCategoryDTO.setMerchantId(merchantVO.getId()); return communityService.pageProductCategory(pageConvenientProductCategoryDTO); } return R.fail("获取登录信息失败,请重新尝试"); } @ApiOperation(value = "获取所有产品分类", response = ConvenientProductCategoryVO.class) @GetMapping("/product-category/all") public R getAllProductCategory() { return communityService.getAllProductCategory(); R<ConvenientMerchantVO> merchantInfo = communityService.getUserConvenientMerchantInfo(this.getUserId()); if (R.isOk(merchantInfo)) { ConvenientMerchantVO merchantVO = JSONObject.parseObject(JSONObject.toJSONString(merchantInfo.getData()), ConvenientMerchantVO.class); return communityService.getAllProductCategory(merchantVO.getId()); } return R.fail("获取登录信息失败,请重新尝试"); } @ApiOperation(value = "便民服务商家后台新增产品") @PostMapping("/product/add") public R addProduct(@RequestBody @Validated(AddGroup.class) ConvenientProductDTO convenientProductDTO) { List<ConvenientProductSpecificationDTO> specificationDTOList = convenientProductDTO.getProductSpecificationDTOList(); boolean isDirtyData = specificationDTOList.stream().filter(specificationDTO -> isBlank(specificationDTO.getName())).findFirst().isPresent(); if (isDirtyData) { return R.fail("请不要传入空规格!"); } ArrayList<ConvenientProductSpecificationDTO> filteredSpecificationList = specificationDTOList.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ConvenientProductSpecificationDTO::getName))), ArrayList::new)); if (specificationDTOList.size() != filteredSpecificationList.size()) { @@ -263,6 +288,10 @@ @PutMapping("/product/put") public R putProduct(@RequestBody @Validated(PutGroup.class) ConvenientProductDTO convenientProductDTO) { List<ConvenientProductSpecificationDTO> specificationDTOList = convenientProductDTO.getProductSpecificationDTOList(); boolean isDirtyData = specificationDTOList.stream().filter(specificationDTO -> isBlank(specificationDTO.getName())).findFirst().isPresent(); if (isDirtyData) { return R.fail("请不要传入空规格!"); } ArrayList<ConvenientProductSpecificationDTO> filteredSpecificationList = specificationDTOList.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ConvenientProductSpecificationDTO::getName))), ArrayList::new)); if (specificationDTOList.size() != filteredSpecificationList.size()) {