From 9ee3b22d2b6838eaf372b521525c7c9b5fb8b13b Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期一, 27 九月 2021 15:22:10 +0800 Subject: [PATCH] 修改便民服务bug --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java index ab37ec9..9fbaf17 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientProductServiceImpl.java +++ b/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)) { -- Gitblit v1.7.1