| | |
| | | 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; |
| | |
| | | @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(); |
| | |
| | | if (R.isOk(userInfoVOR) && nonNull(userInfoVOR.getData())) { |
| | | LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(JSONObject.toJSONString(userInfoVOR.getData()), LoginUserInfoVO.class); |
| | | mcsMerchant = new McsMerchant(); |
| | | mcsMerchant.setName(isBlank(merchantName) ? "默认名称" : merchantName); |
| | | mcsMerchant.setName(isBlank(merchantName) ? loginUserInfoVO.getName() : merchantName); |
| | | mcsMerchant.setPhone(loginUserInfoVO.getPhone()); |
| | | mcsMerchant.setAccount(loginUserInfoVO.getAccount()); |
| | | mcsMerchant.setLevel(1); |
| | |
| | | mcsMerchant.setCreatedBy(userId); |
| | | mcsMerchant.setUpdatedBy(userId); |
| | | num = this.baseMapper.insert(mcsMerchant); |
| | | McsMerchantDTO mcsMerchantDTO = new McsMerchantDTO(); |
| | | mcsMerchantDTO.setName(mcsMerchant.getName()); |
| | | userService.putMcsMerchantUser(mcsMerchantDTO); |
| | | } else { |
| | | return R.fail("获取用户信息失败"); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |