puhanshu
2022-01-14 51ee3c4db2eb49062d3236bf44f95dc22f8f6ac9
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -6,6 +6,7 @@
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
@@ -80,6 +81,14 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R addMcsMerchant(McsMerchantDTO mcsMerchantDTO) {
        McsMerchant existMerchant = this.baseMapper.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getPhone, mcsMerchantDTO.getPhone()));
        if (nonNull(existMerchant)) {
            if (existMerchant.getIsDel()) {
                this.baseMapper.deleteById(existMerchant.getId());
            } else {
                return R.fail("手机号已存在");
            }
        }
        McsMerchant mcsMerchant = new McsMerchant();
        BeanUtils.copyProperties(mcsMerchantDTO, mcsMerchant);
        Integer litDays = mcsMerchantDTO.getLitDays();
@@ -433,7 +442,7 @@
        Integer idleTotal = publishLimit - publishCount;
        merchantVO.setIdleTotal(idleTotal > 0 ? idleTotal : 0);
        if (nonNull(merchantVO.getExpireAt())) {
            int surplusLitDays = DateUtils.differentDays(new Date(), merchantVO.getExpireAt());
            int surplusLitDays = DateUtils.retrieveRemainingDays(merchantVO.getExpireAt());
            merchantVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0);
        }
    }