From db3c1f464e80458a1b6ccbe31b0355775df8e574 Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期三, 23 八月 2023 20:45:34 +0800 Subject: [PATCH] bug --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java | 144 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 134 insertions(+), 10 deletions(-) diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java index b2915ae..ea3587f 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult; import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult; +import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReceiver; import com.github.binarywang.wxpay.exception.WxPayException; import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.exception.ServiceException; @@ -20,6 +21,7 @@ import com.ruoyi.shop.domain.dto.*; import com.ruoyi.shop.domain.pojo.shop.*; import com.ruoyi.shop.domain.pojo.task.ShopFile; +import com.ruoyi.shop.domain.pojo.task.ShopTask; import com.ruoyi.shop.domain.vo.*; import com.ruoyi.shop.enums.WxApplyMentStateEnum; import com.ruoyi.shop.mapper.shop.ShopMapper; @@ -122,6 +124,14 @@ @Resource private WechatPayUtils wechatPayUtils; + + @Resource + private ShopDetailService shopDetailService; + + @Resource + private RemoteUserService remoteUserService; + + /** * 获取商户详情 @@ -791,17 +801,28 @@ mgtBasePlatformDto.setUserIdList(userIds); shopIds = shopMapper.listShopIdByTotal(mgtBasePlatformDto); Shop shop = this.getShopByBelongUserId(userId); - shopIds.add(shop.getShopId()); - userIds.add(userId); + if(shop!=null){ + shopIds.add(shop.getShopId()); + userIds.add(userId); + } }else { //普通员工查询商户归属的shopId Shop shop = this.getShopByBelongUserId(userId); - shopIds.add(shop.getShopId()); } //分别查询 - StaffHomeShopTotalVo staffHomeShopTotalVo = shopMapper.getStaffHomeTotal(userIds); - Integer shopTaskCount = shopTaskService.getShopIngTotal(shopIds); + StaffHomeShopTotalVo staffHomeShopTotalVo = new StaffHomeShopTotalVo(); + if(userIds!=null&&!userIds.isEmpty()){ + staffHomeShopTotalVo = shopMapper.getStaffHomeTotal(userIds); + }else{ + staffHomeShopTotalVo.setShopTotal(0); + staffHomeShopTotalVo.setAgencyTotal(0); + staffHomeShopTotalVo.setDealerTotal(0); + } + Integer shopTaskCount = 0; + if(shopIds!=null&&!shopIds.isEmpty()){ + shopTaskService.getShopIngTotal(shopIds); + } staffHomeShopTotalVo.setFollowMember(0); staffHomeShopTotalVo.setNewMember(0); staffHomeShopTotalVo.setShopTask(shopTaskCount); @@ -1002,21 +1023,25 @@ public void mgtShopAuth(MgtShopAuthDto mgtShopAuthDto) throws WxPayException { ShopAuthentication shopAuthentication = shopAuthenticationService.getById(mgtShopAuthDto.getAuthId()); Shop shop = this.getByShopId(shopAuthentication.getShopId()); - String applyNumber = IdUtils.simpleUUID(); + if(mgtShopAuthDto.getBlBusinessFoeverFlag()!=null&&mgtShopAuthDto.getBlBusinessFoeverFlag()==1){ - mgtShopAuthDto.setBlBusinessDeanline(mgtShopAuthDto.getBlBusinessStartTime()+",长期"); + mgtShopAuthDto.setBlBusinessDeanline("长期"); } if(mgtShopAuthDto.getLpIcForeverFlag()!=null&&mgtShopAuthDto.getLpIcForeverFlag()==1){ mgtShopAuthDto.setLpIcEndDate("长期"); } BeanUtils.copyProperties(mgtShopAuthDto , shopAuthentication); - shopAuthentication.setApplyNumber(applyNumber); + String applyNumber = shopAuthentication.getApplyNumber(); + if(StringUtils.isBlank(applyNumber)){ + applyNumber = IdUtils.simpleUUID(); + shopAuthentication.setApplyNumber(applyNumber); + } ApplymentsResult applymentsResult; try { applymentsResult = wechatPayUtils.ecommerceApply(shopAuthentication,applyNumber,shop); } catch (Exception e) { log.debug("-----"+shop.getShopId()+":进件异常-----"); - throw new RuntimeException(e); + throw new ServiceException(e.getMessage()); } shopAuthentication.setAuditStatus(3); shopAuthenticationService.saveOrUpdate(shopAuthentication); @@ -1253,7 +1278,12 @@ }else { userIdList.add(userId); } - return shopMapper.getStaffSimpleTotal(userIdList); + StaffShopSimpleTotalVo shopTotal = shopMapper.getStaffSimpleTotal(1,userIdList); + StaffShopSimpleTotalVo agencyTotal = shopMapper.getStaffSimpleTotal(2,userIdList); + shopTotal.setAgencyTotal(agencyTotal.getShopTotal()); + shopTotal.setOpenAgencyTotal(agencyTotal.getOpenShopTotal()); + shopTotal.setCloseAgencyTotal(agencyTotal.getCloseAgencyTotal()); + return shopTotal; } /** @@ -1377,6 +1407,8 @@ List<ExtendContactsVo> extendContactsVoList = staffShopECEditDto.getExtendContactsVoList(); if(extendContactsVoList!=null&&!extendContactsVoList.isEmpty()){ extendContacts = JSON.toJSONString(extendContactsVoList); + }else{ + extendContacts = ""; } shop.setExtendContacts(extendContacts); shop.setShopId(staffShopECEditDto.getShopId()); @@ -1465,4 +1497,96 @@ throw new RuntimeException(e); } } + + /** + * @description 修改店铺详细资料 + * @author jqs + * @date 2023/8/22 14:51 + * @param staffShopDetailDto + * @return void + */ + @Override + public void editShopDetail(StaffShopDetailDto staffShopDetailDto){ + ShopDetail shopDetail = shopDetailService.getById(staffShopDetailDto.getShopId()); + if(shopDetail == null){ + shopDetail = new ShopDetail(); + shopDetail.setDelFlag(0); + } + BeanUtils.copyProperties(staffShopDetailDto, shopDetail); + List<StaffCustomerDto> staffCustomerDtoList = staffShopDetailDto.getStaffCustomerDtoList(); + if(staffCustomerDtoList!=null&&!staffCustomerDtoList.isEmpty()){ + StringJoiner customerNameSJ = new StringJoiner(","); + StringJoiner customerMobileSJ = new StringJoiner(","); + for(StaffCustomerDto staffCustomerDto : staffCustomerDtoList){ + customerNameSJ.add(staffCustomerDto.getCustomerName()); + customerMobileSJ.add(staffCustomerDto.getCustomerMobile()); + } + shopDetail.setCustomerName(customerNameSJ.toString()); + shopDetail.setCustomerMobile(customerMobileSJ.toString()); + } + shopDetailService.saveOrUpdate(shopDetail); + } + + /** + * @description 获取店铺详细资料 + * @author jqs + * @date 2023/8/22 16:15 + * @param shopId + * @return StaffShopDetailVo + */ + @Override + public StaffShopDetailVo getShopDetail(Long shopId){ + ShopDetail shopDetail = shopDetailService.getById(shopId); + StaffShopDetailVo staffShopDetailVo = new StaffShopDetailVo(); + if(shopDetail!=null){ + BeanUtils.copyProperties(shopDetail, staffShopDetailVo); + //处理联系人 + String customerName = shopDetail.getCustomerName(); + String customerMobile = shopDetail.getCustomerMobile(); + List<StaffCustomerDto> staffCustomerDtoList = new ArrayList<>(); + String[] customerNameArr = customerName.split(","); + String[] customerMobileArr = customerMobile.split(","); + staffShopDetailVo.setContactName(customerNameArr[0]); + StaffCustomerDto staffCustomerDto; + for(int i=0;i<customerNameArr.length;i++){ + staffCustomerDto = new StaffCustomerDto(); + staffCustomerDto.setCustomerName(customerNameArr[i]); + staffCustomerDto.setCustomerMobile(customerMobileArr[i]); + staffCustomerDtoList.add(staffCustomerDto); + } + staffShopDetailVo.setStaffCustomerDtoList(staffCustomerDtoList); + } + //归属客户 + Shop shop = this.getByShopId(shopId); + Long belongUserId = shop.getBelongUserId(); + if(belongUserId!=null){ + SysUser sysUser = remoteUserService.getSysUser(belongUserId).getData(); + if(sysUser!=null){ + staffShopDetailVo.setBelongUser(sysUser.getNickName()); + } + } + //最近任务时间 + ShopTask shopTask = shopTaskService.getLastTask(shopId); + if(shopTask!=null){ + staffShopDetailVo.setNextTaskDate(shopTask.getTaskDate()); + } + return staffShopDetailVo; + } + + + /** + * @description + * @author jqs + * @date 2023/8/23 9:44 + * @param + * @return void + */ + @Override + public void addProfitSharingReceiver(ProfitSharingReceiver profitSharingReceiver){ + try { + ProfitSharingReceiver result = wechatPayUtils.addProfitSharingReceiver(profitSharingReceiver); + } catch (WxPayException e) { + throw new RuntimeException(e); + } + } } -- Gitblit v1.7.1