puhanshu
2021-09-27 9ee3b22d2b6838eaf372b521525c7c9b5fb8b13b
修改便民服务bug
4个文件已修改
24 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductDO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientProductDO.java
@@ -43,6 +43,10 @@
     */
    private Boolean onShelf;
    /**
     * 上架时间
     */
    private Date onShelfAt;
    /**
     * 产品介绍
     */
    private String introduction;
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -191,7 +191,7 @@
        R result = userService.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO);
        int type = disableOrEnableConvenientMerchantDTO.getType().intValue();
        if (type == 2) {
            this.baseMapper.batchUpdateBusinessStatus(convenientMerchantDOList, 2);
            this.baseMapper.batchUpdateBusinessStatus(convenientMerchantDOList, 0);
        }
        if (R.isOk(result)) {
            return R.ok();
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java
@@ -66,6 +66,9 @@
        ConvenientProductDO convenientProductDO = new ConvenientProductDO();
        BeanUtils.copyProperties(convenientProductDTO, convenientProductDO);
        Date nowDate = new Date();
        if (convenientProductDTO.getOnShelf()) {
            convenientProductDO.setOnShelfAt(nowDate);
        }
        convenientProductDO.setCreatedAt(nowDate);
        this.baseMapper.insert(convenientProductDO);
        Long productId = convenientProductDO.getId();
@@ -91,16 +94,20 @@
        Long productId = convenientProductDTO.getId();
        Long updatedBy = convenientProductDTO.getUpdatedBy();
        ConvenientProductDO convenientProductDO = this.baseMapper.selectById(productId);
        Boolean isOnShelf = convenientProductDO.getOnShelf();
        if (isNull(convenientProductDO)) {
            return R.fail("产品不存在");
        }
        BeanUtils.copyProperties(convenientProductDTO, convenientProductDO);
        Date nowDate = new Date();
        if (!isOnShelf && convenientProductDTO.getOnShelf()) {
            convenientProductDO.setOnShelfAt(nowDate);
        }
        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());
        Date nowDate = new Date();
        productSpecificationDTOList.forEach(specificationDTO -> {
            Long specificationId = specificationDTO.getId();
            if (isNull(specificationId)) {
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml
@@ -9,6 +9,7 @@
                <id column="category_id" property="categoryId" />
                <id column="merchant_id" property="merchantId" />
                <id column="on_shelf" property="onShelf" />
                <id column="on_shelf_at" property="onShelfAt" />
                <id column="introduction" property="introduction" />
                <id column="is_del" property="isDel" />
                <id column="view_num" property="viewNum" />
@@ -20,7 +21,7 @@
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,`name`,category_id,merchant_id,on_shelf,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by
        id,`name`,category_id,merchant_id,on_shelf,on_shelf_at,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by
    </sql>
    <update id="batchDeleteByIds">
        UPDATE com_convenient_products SET is_del = 1 WHERE id IN
@@ -29,7 +30,11 @@
        </foreach>
    </update>
    <update id="batchOnShelfOrOffShelfByIds">
        UPDATE com_convenient_products SET on_shelf = #{saleStatus}, updated_by = #{updatedBy} WHERE id IN
        UPDATE com_convenient_products SET on_shelf = #{saleStatus},
         <if test="saleStatus">
             on_shelf_at = NOW(),
         </if>
        updated_by = #{updatedBy} WHERE id IN
        <foreach collection="needDealIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>