huanghongfa
2021-09-28 b35154180e1d327650b9f46bd6420cc2a7d760dc
Merge remote-tracking branch 'origin/test' into test
9个文件已修改
48 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductSpecificationDAO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductSpecificationMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientServiceCategoryMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java
@@ -307,7 +307,7 @@
    @ApiOperation(value = "新增便民服务商家")
    @PostMapping("/merchant/add")
    public R addMerchant(@RequestBody @Validated(AddGroup.class) ConvenientMerchantDTO convenientMerchantDTO) {
        log.error("catTimeStamp进入appletsbackstage", Instant.now().toEpochMilli());
        log.error("catTimeStamp进入appletsbackstage" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        convenientMerchantDTO.setCreatedBy(this.getUserId());
        return communityService.addMerchant(convenientMerchantDTO);
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ConvenientApi.java
@@ -365,7 +365,7 @@
     */
    @PostMapping("/merchant/add")
    public R addMerchant(@RequestBody ConvenientMerchantDTO convenientMerchantDTO) {
        log.error("catTimeStamp进入service_community", Instant.now().toEpochMilli());
        log.error("catTimeStamp进入service_community" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        return convenientMerchantService.addMerchant(convenientMerchantDTO);
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientProductSpecificationDAO.java
@@ -27,9 +27,10 @@
    /**
     * 删除传入ID以外的关联
     * @param notNeedDelIds
     * @param productId
     * @return
     */
    int deleteLoseRelationSpecifications(@Param("notNeedDelIds") List<Long> notNeedDelIds);
    int deleteLoseRelationSpecifications(@Param("notNeedDelIds") List<Long> notNeedDelIds, @Param("productId") Long productId);
    /**
     * 通过产品ID删除相关规格
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -83,7 +83,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R addMerchant(ConvenientMerchantDTO convenientMerchantDTO) {
        log.error("catTimeStamp开始执行addMerchant", Instant.now().toEpochMilli());
        log.error("catTimeStamp开始执行addMerchant" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        ComActDO comActDO = comActDAO.selectById(convenientMerchantDTO.getCommunityId());
        ConvenientMerchantDO convenientMerchantDO = new ConvenientMerchantDO();
        BeanUtils.copyProperties(convenientMerchantDTO, convenientMerchantDO);
@@ -103,7 +103,7 @@
                });
            }
        }
        log.error("catTimeStamp商家创建完成开始添加用户", Instant.now().toEpochMilli());
        log.error("catTimeStamp商家创建完成开始添加用户" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        //添加user
        R addUserResult = userService.addConvenientMerchantUser(convenientMerchantDTO);
        if (R.isOk(addUserResult)) {
@@ -113,7 +113,7 @@
        } else {
            throw new ServiceException("406", addUserResult.getMsg());
        }
        log.error("catTimeStamp全部完成", Instant.now().toEpochMilli());
        log.error("catTimeStamp全部完成" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        return R.ok();
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java
@@ -106,8 +106,7 @@
        convenientProductDO.setUpdatedBy(updatedBy);
        this.baseMapper.updateById(convenientProductDO);
        List<ConvenientProductSpecificationDTO> productSpecificationDTOList = convenientProductDTO.getProductSpecificationDTOList();
        List<Long> notNeedDelIds = productSpecificationDTOList.stream().filter(specificationDTO -> nonNull(specificationDTO.getId()))
                .map(ConvenientProductSpecificationDTO::getId).collect(Collectors.toList());
        List<Long> notNeedDelIds = new ArrayList<>();
        productSpecificationDTOList.forEach(specificationDTO -> {
            Long specificationId = specificationDTO.getId();
            if (isNull(specificationId)) {
@@ -118,16 +117,18 @@
                convenientProductSpecificationDO.setCreatedAt(nowDate);
                convenientProductSpecificationDO.setCreatedBy(updatedBy);
                convenientProductSpecificationDAO.insert(convenientProductSpecificationDO);
                notNeedDelIds.add(convenientProductSpecificationDO.getId());
            } else {
                //更新
                ConvenientProductSpecificationDO convenientProductSpecificationDO = convenientProductSpecificationDAO.selectById(specificationId);
                BeanUtils.copyProperties(specificationDTO, convenientProductSpecificationDO);
                convenientProductSpecificationDO.setUpdatedBy(updatedBy);
                convenientProductSpecificationDAO.updateById(convenientProductSpecificationDO);
                notNeedDelIds.add(specificationId);
            }
        });
        //删除已失去关联的规格
        convenientProductSpecificationDAO.deleteLoseRelationSpecifications(notNeedDelIds);
        convenientProductSpecificationDAO.deleteLoseRelationSpecifications(notNeedDelIds, productId);
        return R.ok();
    }
@@ -215,6 +216,7 @@
        List<ConvenientProductVO> productVOList = this.baseMapper.getMerchantProduct(merchantId);
        List<ConvenientProductSpecificationVO> specificationVOList = this.baseMapper.getProductSpecifications(merchantId);
        List<ConvenientProductLevelInfoVO> levelInfoVOList = new ArrayList<>();
        List<String> categoryList = new ArrayList<>();
        if (!productVOList.isEmpty()) {
            productVOList.forEach(productVO -> {
                List<ConvenientProductSpecificationVO> currentProductSpecificationVOList = new ArrayList<>();
@@ -224,22 +226,22 @@
                    }
                });
                productVO.setProductSpecificationVOList(currentProductSpecificationVOList);
                if (!categoryList.contains(productVO.getCategoryName())) {
                    categoryList.add(productVO.getCategoryName());
                }
            });
            //分类
            Map<String, List<ConvenientProductVO>> levelGroup = productVOList.stream()
                    .collect(Collectors.groupingBy(ConvenientProductVO::getCategoryName));
            Set<String> categoryNames = levelGroup.keySet();
            Iterator<String> iterator = categoryNames.iterator();
            while (iterator.hasNext()) {
                String categoryName = iterator.next();
            categoryList.forEach(category -> {
                ConvenientProductLevelInfoVO levelInfoVOLevelInfoVO = new ConvenientProductLevelInfoVO();
                levelInfoVOLevelInfoVO.setCategoryName(categoryName);
                List<ConvenientProductVO> productVOS = levelGroup.get(categoryName);
                levelInfoVOLevelInfoVO.setCategoryName(category);
                List<ConvenientProductVO> productVOS = levelGroup.get(category);
                List<ConvenientProductVO> sortedProductVOS = productVOS.stream()
                        .sorted(Comparator.comparing(ConvenientProductVO::getOnShelfAt).reversed()).collect(Collectors.toList());
                levelInfoVOLevelInfoVO.setProductVOList(sortedProductVOS);
                levelInfoVOList.add(levelInfoVOLevelInfoVO);
            }
            });
        }
        return R.ok(levelInfoVOList);
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml
@@ -56,6 +56,7 @@
        <if test="pageConvenientProductDTO.onShelf != null">
            AND ccp.on_shelf = #{pageConvenientProductDTO.onShelf}
        </if>
        ORDER BY ccp.created_at DESC
    </select>
    <select id="getMerchantProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO">
        SELECT  ccp.id, ccp.name, ccp.category_id, ccp.on_shelf_at, ccp.introduction, ccpc.name AS categoryName
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductSpecificationMapper.xml
@@ -29,7 +29,7 @@
    </insert>
    <update id="deleteLoseRelationSpecifications" parameterType="java.util.List">
        UPDATE com_convenient_product_specifications SET is_del = 1
        WHERE id NOT IN
        WHERE product_id = #{productId} AND id NOT IN
        <foreach collection="notNeedDelIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientServiceCategoryMapper.xml
@@ -50,6 +50,6 @@
        FROM com_convenient_service_categories ccsc
        INNER JOIN com_convenient_service_scope ccss ON ccsc.id = ccss.service_category_id
        LEFT JOIN com_convenient_merchants ccm ON ccss.merchant_id = ccm.id
        WHERE ccsc.is_del = 0 AND ccm.is_del = 0 AND ccm.community_id = #{communityId} AND ccm.business_status = 1 GROUP BY ccsc.id
        WHERE ccsc.is_del = 0 AND ccm.is_del = 0 AND ccm.community_id = #{communityId} AND ccm.business_status = 1 GROUP BY ccsc.id ORDER BY ccsc.weight desc
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -2592,7 +2592,7 @@
    @Transactional(rollbackFor = Exception.class)
    public R addConvenientMerchantUser(ConvenientMerchantDTO convenientMerchantDTO) {
        // todo 便民
        log.error("catTimeStamp进入addConvenientMerchantUser", Instant.now().toEpochMilli());
        log.error("catTimeStamp进入addConvenientMerchantUser" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        SysUserDO sysUserDO = new SysUserDO();
        Long communityId = 0L;
        // 新增社区高级管理员角色
@@ -2615,7 +2615,7 @@
                return R.fail("建立商家角色失败,商家名称可能已被占用!");
            }
        }
        log.error("catTimeStamp-SysRoleDO创建完成", Instant.now().toEpochMilli());
        log.error("catTimeStamp-SysRoleDO创建完成" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        // 新角色设置所有权限
        MenuRoleVO menuRoleVO = new MenuRoleVO();
        menuRoleVO.setIsAll(1);
@@ -2623,7 +2623,7 @@
        menuRoleVO.setRoleId(sysRoleDO.getRoleId());
        this.putMenuRole(menuRoleVO);
        log.error("catTimeStamp-MenuRoleVO创建完成", Instant.now().toEpochMilli());
        log.error("catTimeStamp-MenuRoleVO创建完成" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
        // sys_user 表
        String encode = new BCryptPasswordEncoder().encode(convenientMerchantDTO.getPassword());
@@ -2637,7 +2637,7 @@
        sysUserDO.setPassword(encode);
        try {
            userDao.insert(sysUserDO);
            log.error("catTimeStamp-sysUserDO创建完成", Instant.now().toEpochMilli());
            log.error("catTimeStamp-sysUserDO创建完成" + convenientMerchantDTO.getAccount() + Instant.now().toEpochMilli());
            return R.ok(sysUserDO.getUserId());
        } catch (Exception e) {
            e.printStackTrace();