| | |
| | | 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; |
| | |
| | | @Resource |
| | | private RemoteOrderService remoteOrderService; |
| | | |
| | | @Resource |
| | | private ShopStaffService shopStaffService; |
| | | /** |
| | | * 获取商户详情 |
| | | * @param shopId |
| | |
| | | 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); |
| | |
| | | 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)){ |
| | |
| | | shopRelUser.setUserMobile(sysUser.getPhonenumber()); |
| | | shopRelUser.setUserDeptId(sysUser.getDeptId()); |
| | | shopRelUserService.save(shopRelUser); |
| | | handleShopStaff(shop.getShopId(),sysUser); |
| | | } |
| | | } |
| | | //商户封面 |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | return shop; |
| | | } |
| | | |
| | | /** |
| | | * 获取商户端 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MerHomeShopTotalVo getMerHomeTotal(Long userId){ |
| | | MerHomeShopTotalVo merHomeShopTotalVo = new MerHomeShopTotalVo(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 获取商户绑定代理商 |
| | | * @param page |
| | | * @param merAgencyPageDto |
| | | * @return |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |