From 76d4495f458d573e31e8b28002d2742821db3287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Mon, 25 Nov 2024 10:03:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=82=A8=E5=80=BC=E5=8D=A1=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E6=98=8E=E7=BB=86=E8=AE=B0=E5=BD=95=E4=B8=8D=E5=87=86?= =?UTF-8?q?=E7=A1=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 4e96acc2..b27dfb3a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -637,7 +637,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { flow.setBizName("会员储值卡退款"); flow.setType("+"); flow.setAmount(returnAmount); - flow.setBalance(user.getAmount()); + flow.setBalance(user.getAmount().add(returnAmount)); flow.setCreateTime(cn.hutool.core.date.DateUtil.date().toTimestamp()); flow.setIsReturn("0"); tbShopUserFlowMapper.insert(flow); From 6dc95d29a15276dbf613b7272641c902fb84e8fc Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 23 Nov 2024 09:41:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BC=80=E7=A5=A8=E7=BB=91=E5=AE=9A=20?= =?UTF-8?q?=E5=9B=9E=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopInfoServiceImpl.java | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopInfoServiceImpl.java index 574ee745..b6acf46b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopInfoServiceImpl.java @@ -49,11 +49,11 @@ import java.time.Instant; import java.util.*; /** -* @website https://eladmin.vip -* @description 服务实现 -* @author lyf -* @date 2023-11-07 -**/ + * @author lyf + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-11-07 + **/ @Service @RequiredArgsConstructor public class TbShopInfoServiceImpl implements TbShopInfoService { @@ -86,9 +86,11 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { public JSONObject binding(BindingDto bindingDto) { TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null); TbMerchantAccount account = merchantAccountRepository.findByAccount(tbShopInfo.getAccount()); + boolean isNew = true; if (org.apache.commons.lang3.StringUtils.isBlank(bindingDto.getAccount())) { if (tbShopInfo != null) { if (org.apache.commons.lang3.StringUtils.isNotBlank(account.getBindAccount())) { + isNew = false; bindingDto.setAccount(account.getBindAccount()); } else { return null; @@ -98,7 +100,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { Map param = new HashMap<>(); param.put("account", bindingDto.getAccount()); JSONObject data = bindService.binding(param); - if (org.apache.commons.lang3.StringUtils.isNotBlank(bindingDto.getAccount())) { + if (isNew) { account.setBindAccount(bindingDto.getAccount()); account.setArticle(bindingDto.getArticle()); account.setTaxAmount(bindingDto.getTaxAmount()); @@ -113,15 +115,15 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { } @Override - public Map queryAll(TbShopInfoQueryCriteria criteria){ + public Map queryAll(TbShopInfoQueryCriteria criteria) { Sort sort = Sort.by(Sort.Direction.DESC, "id"); Pageable pageables = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); - Page page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageables); + Page page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageables); return PageUtil.toPage(page); } @Override - public List queryChildShop(TbShopInfoQueryCriteria criteria){ + public List queryChildShop(TbShopInfoQueryCriteria criteria) { List list = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> { Predicate query1 = criteriaBuilder.equal(root.get("id"), criteria.getId()); Predicate query2 = criteriaBuilder.and( @@ -148,14 +150,14 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { @Transactional public TbShopInfoDto findById(Integer id) { TbShopInfo tbShopInfo = tbShopInfoRepository.findById(id).orElseGet(TbShopInfo::new); - if(StringUtils.isBlank(tbShopInfo.getSmallQrcode())){ + if (StringUtils.isBlank(tbShopInfo.getSmallQrcode())) { String smallQrcode = wxService.getSmallQrcode(id.toString()); tbShopInfo.setSmallQrcode(smallQrcode); tbShopInfoRepository.save(tbShopInfo); } String baseUrl = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name()); - tbShopInfo.setPaymentQrcode(baseUrl+"?shopId="+id); - ValidationUtil.isNull(tbShopInfo.getId(),"TbShopInfo","id",id); + tbShopInfo.setPaymentQrcode(baseUrl + "?shopId=" + id); + ValidationUtil.isNull(tbShopInfo.getId(), "TbShopInfo", "id", id); return tbShopInfoMapper.toDto(tbShopInfo); } @@ -168,46 +170,46 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { @Override @Transactional(rollbackFor = Exception.class) public TbShopInfoDto create(TbShopInfoDto resources) { - if(StringUtils.isBlank(resources.getShopName())){ + if (StringUtils.isBlank(resources.getShopName())) { throw new BadRequestException("店铺名称不可为空"); } resources.setShopName(resources.getShopName().trim()); - if ("release".equals(resources.getProfiles())){ - if (resources.getRegisterCode() == null){ + if ("release".equals(resources.getProfiles())) { + if (resources.getRegisterCode() == null) { throw new BadRequestException("未绑定激活码"); } } TbShopInfo byAccount = tbShopInfoRepository.findByAccount(resources.getAccount()); User byUsername = userRepository.findByUsername(resources.getAccount()); - if (byAccount != null || byUsername != null){ + if (byAccount != null || byUsername != null) { throw new BadRequestException("登录名已注册"); } TbShopInfo tbShopInfo = new TbShopInfo(); - BeanUtil.copyProperties(resources,tbShopInfo, CopyOptions.create().setIgnoreNullValue(true)); + BeanUtil.copyProperties(resources, tbShopInfo, CopyOptions.create().setIgnoreNullValue(true)); tbShopInfo.setCreatedAt(Instant.now().toEpochMilli()); tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli()); tbShopInfo.setIsOpenYhq(resources.getIsOpenYhq()); //激活码 TbMerchantRegister tbMerchantRegister = new TbMerchantRegister(); - if (resources.getRegisterCode() != null){ + if (resources.getRegisterCode() != null) { tbMerchantRegister = merchantRegisterRepository.findByRegisterCode(resources.getRegisterCode()); - if(tbMerchantRegister == null){ + if (tbMerchantRegister == null) { throw new BadRequestException("激活码有误"); } - if (tbMerchantRegister.getStatus() == 1){ + if (tbMerchantRegister.getStatus() == 1) { throw new BadRequestException("激活码已激活,不能重复绑定"); } tbShopInfo.setExpireAt(DateUtil.addMonthsAndGetTimestamp(tbMerchantRegister.getPeriodYear())); //向redis中存入key - redisUtils.set(CacheKey.ACT_CODE+resources.getAccount(),"1",tbShopInfo.getExpireAt()-Instant.now().toEpochMilli()); + redisUtils.set(CacheKey.ACT_CODE + resources.getAccount(), "1", tbShopInfo.getExpireAt() - Instant.now().toEpochMilli()); } - if(org.apache.commons.lang3.StringUtils.isNotBlank(resources.getType()) && !"only".equals(resources.getType())){ - if(resources.getMainId() == null){ + if (org.apache.commons.lang3.StringUtils.isNotBlank(resources.getType()) && !"only".equals(resources.getType())) { + if (resources.getMainId() == null) { throw new BadRequestException("连锁店或者扩展店 主店铺不能为空"); } - }else { + } else { tbShopInfo.setMainId(null); tbShopInfo.setTubeType(1); } @@ -275,7 +277,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { shopStaffRepository.save(tbPlussShopStaff); //增加默认支付方式 Integer integer = tbShopPayTypeRepository.creatPayType(save.getId().toString()); - if (integer<4){ + if (integer < 4) { throw new BadRequestException("请重试"); } TbProductGroup tbProductGroup = new TbProductGroup(); @@ -290,35 +292,35 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { @Override @Transactional - public void upShopPass(String username,String password){ + public void upShopPass(String username, String password) { User user = userRepository.findByUsername(username); if (user == null) { throw new EntityNotFoundException(User.class, "username", username); } String encPass = MD5Utils.encrypt(password); - shopStaffRepository.updatePass(username,encPass,System.currentTimeMillis()); - merchantAccountRepository.updatePass(username,encPass,System.currentTimeMillis()); + shopStaffRepository.updatePass(username, encPass, System.currentTimeMillis()); + merchantAccountRepository.updatePass(username, encPass, System.currentTimeMillis()); // passwordEncoder.encode(passwordEncoder.encode(password)) - userService.updatePass(username,passwordEncoder.encode(password)); + userService.updatePass(username, passwordEncoder.encode(password)); } @Override @Transactional(rollbackFor = Exception.class) public void update(TbShopInfo resources) { TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new); - if(org.apache.commons.lang3.StringUtils.isNotBlank(resources.getType()) && !"only".equals(resources.getType())){ - if(resources.getMainId() == null){ + if (org.apache.commons.lang3.StringUtils.isNotBlank(resources.getType()) && !"only".equals(resources.getType())) { + if (resources.getMainId() == null) { throw new BadRequestException("连锁店或者扩展店 主店铺不能为空"); } - }else { + } else { tbShopInfo.setMainId(null); tbShopInfo.setTubeType(1); } if (StringUtils.isNotBlank(resources.getShopName()) && !resources.getShopName().equals(tbShopInfo.getShopName())) { - shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString()); - userRepository.updateNickName(resources.getAccount(),resources.getShopName()); + shopStaffRepository.updateNameById(resources.getShopName(), resources.getId().toString()); + userRepository.updateNickName(resources.getAccount(), resources.getShopName()); } - ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId()); + ValidationUtil.isNull(tbShopInfo.getId(), "TbShopInfo", "id", resources.getId()); tbShopInfo.copy(resources); tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli()); tbShopInfoRepository.save(tbShopInfo); @@ -327,7 +329,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { @Override public void updateShopId(TbShopInfo resources) { TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new); - ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId()); + ValidationUtil.isNull(tbShopInfo.getId(), "TbShopInfo", "id", resources.getId()); tbShopInfo.copy(resources); } @@ -348,7 +350,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { public void download(List all, HttpServletResponse response) throws IOException { List> list = new ArrayList<>(); for (TbShopInfoDto tbShopInfo : all) { - Map map = new LinkedHashMap<>(); + Map map = new LinkedHashMap<>(); map.put("店铺帐号", tbShopInfo.getAccount()); map.put("店铺代号,策略方式为city +店铺号(8位)", tbShopInfo.getShopCode()); map.put("店铺口号", tbShopInfo.getSubTitle()); @@ -369,7 +371,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { map.put("经纬度", tbShopInfo.getLat()); map.put("经纬度", tbShopInfo.getLng()); map.put("未用", tbShopInfo.getMchId()); - map.put(" registerType", tbShopInfo.getRegisterType()); + map.put(" registerType", tbShopInfo.getRegisterType()); map.put("是否独立的微信小程序", tbShopInfo.getIsWxMaIndependent()); map.put("详细地址", tbShopInfo.getAddress()); map.put("类似于这种规则51.51.570", tbShopInfo.getCity()); @@ -378,7 +380,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { map.put("行业名称", tbShopInfo.getIndustryName()); map.put("营业时间", tbShopInfo.getBusinessTime()); map.put("配送时间", tbShopInfo.getPostTime()); - map.put(" postAmountLine", tbShopInfo.getPostAmountLine()); + map.put(" postAmountLine", tbShopInfo.getPostAmountLine()); map.put("0停业1,正常营业,网上售卖", tbShopInfo.getOnSale()); map.put("0今日,1次日", tbShopInfo.getSettleType()); map.put("时间", tbShopInfo.getSettleTime()); @@ -389,9 +391,9 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { map.put("订单等待时间", tbShopInfo.getOrderWaitPayMinute()); map.put("支持登陆设备个数", tbShopInfo.getSupportDeviceNumber()); map.put("分销层级(1-下级分销 2-两下级分销)", tbShopInfo.getDistributeLevel()); - map.put(" createdAt", tbShopInfo.getCreatedAt()); - map.put(" updatedAt", tbShopInfo.getUpdatedAt()); - map.put(" proxyId", tbShopInfo.getProxyId()); + map.put(" createdAt", tbShopInfo.getCreatedAt()); + map.put(" updatedAt", tbShopInfo.getUpdatedAt()); + map.put(" proxyId", tbShopInfo.getProxyId()); list.add(map); } FileUtil.downloadExcel(list, response);