bug
jiangqs
2023-08-22 95044dd4dacee5f7ecb081af5d557d14fad83c24
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -20,6 +20,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 +123,12 @@
    @Resource
    private WechatPayUtils wechatPayUtils;
    @Resource
    private ShopDetailService shopDetailService;
    @Resource
    private RemoteUserService remoteUserService;
    /**
     * 获取商户详情
@@ -1002,7 +1009,7 @@
    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()+",长期");
        }
@@ -1010,7 +1017,11 @@
            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);
@@ -1465,4 +1476,77 @@
            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();
        BeanUtils.copyProperties(shopDetail, staffShopDetailVo);
        //归属客户
        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());
        }
        //处理联系人
        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);
        return staffShopDetailVo;
    }
}