From ff926ba7b7fe5e7a3edffd994f605acd552a27db Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期五, 02 六月 2023 16:54:20 +0800 Subject: [PATCH] 商户进件支付框架补充 --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 45 insertions(+), 4 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 94fb893..8a4dc81 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 @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.uuid.IdUtils; import com.ruoyi.shop.domain.dto.*; import com.ruoyi.shop.domain.pojo.shop.*; import com.ruoyi.shop.domain.pojo.task.ShopFile; @@ -71,6 +73,8 @@ @Resource private RemoteOrderService remoteOrderService; + @Resource + private ShopStaffService shopStaffService; /** * 获取商户详情 * @param shopId @@ -115,16 +119,19 @@ Shop shop = new Shop(); if(MGTEditShopDto.getShopId()!=null){ shop = this.getById(MGTEditShopDto.getShopId()); - shop.setUpdateTime(new Date()); + shop.setUpdateTime(DateUtils.getNowDate()); shop.setUpdateUserId(MGTEditShopDto.getUserId()); shop.setShopTags(null); //清空关联记录 shopFileService.deleteByShopId(shop.getShopId()); shopRelTagService.deleteByShopId(shop.getShopId()); shopRelUserService.deleteByShopId(shop.getShopId()); + //清空归属 + shopRelUserService.deleteByShopId(shop.getShopId()); + shopStaffService.clearShopStaffRelation(shop.getShopId()); }else{ shop.setShopStatus(2); - shop.setCreateTime(new Date()); + shop.setCreateTime(DateUtils.getNowDate()); shop.setCreateUserId(MGTEditShopDto.getUserId()); } BeanUtils.copyProperties(MGTEditShopDto,shop); @@ -155,6 +162,9 @@ shop.setShopTags(shopTagSj.toString()); this.saveOrUpdate(shop); } + //商户归属员工 + SysUser belongSysUser = sysUserService.getSysUser(shop.getBelongUserId()).getData(); + handleShopStaff(shop.getShopId(),belongSysUser); //商户关联人员 String relUserIds = MGTEditShopDto.getRelUserIds(); if(StringUtils.isNotBlank(relUserIds)){ @@ -173,6 +183,7 @@ shopRelUser.setUserMobile(sysUser.getPhonenumber()); shopRelUser.setUserDeptId(sysUser.getDeptId()); shopRelUserService.save(shopRelUser); + handleShopStaff(shop.getShopId(),sysUser); } } //商户封面 @@ -210,7 +221,7 @@ try { Date coopStartDate = simpleDateFormat.parse(coopStartTime); Date coopEndDate = simpleDateFormat.parse(coopEndTime); - Date nowTime = new Date(); + Date nowTime = DateUtils.getNowDate(); shop.setCooperationStartTime(coopStartDate); shop.setCooperationEndTime(coopEndDate); Boolean inTime = false; @@ -347,6 +358,7 @@ if(member!=null&&member.getBindingFlag()!=1){ AppMemberBindingDto appMemberBindingDto = new AppMemberBindingDto(); appMemberBindingDto.setShopId(shop.getShopId()); + appMemberBindingDto.setShopName(shop.getShopName()); appMemberBindingDto.setUserId(member.getUserId()); appMemberBindingDto.setBindingFlag(0); remoteMemberService.updateMemberBinding(appMemberBindingDto); @@ -372,6 +384,11 @@ return shop; } + /** + * 获取商户端 + * @param userId + * @return + */ @Override public MerHomeShopTotalVo getMerHomeTotal(Long userId){ MerHomeShopTotalVo merHomeShopTotalVo = new MerHomeShopTotalVo(); @@ -387,7 +404,7 @@ } /** - * + * 获取商户绑定代理商 * @param page * @param merAgencyPageDto * @return @@ -398,5 +415,29 @@ return merAgencyPageVoList; } + /** + * 处理商户员工 + * @param shopId + * @param sysUser + */ + private void handleShopStaff(Long shopId,SysUser sysUser){ + ShopStaff shopStaff = shopStaffService.getByUserId(sysUser.getUserId()); + if(shopStaff!=null){ + shopStaff.setShopId(shopId); + }else{ + String staffId = IdUtils.simpleUUID(); + shopStaff = new ShopStaff(); + shopStaff.setStaffId(staffId); + shopStaff.setDelFlag(0); + shopStaff.setUserId(sysUser.getUserId()); + shopStaff.setShopId(shopId); + shopStaff.setStaffName(sysUser.getNickName()); + shopStaff.setStaffMobile(sysUser.getPhonenumber()); + shopStaff.setStaffGender(Integer.valueOf(sysUser.getSex())); + shopStaff.setStaffAvatar(sysUser.getAvatar()); + } + shopStaffService.saveOrUpdate(shopStaff); + } + } -- Gitblit v1.7.1