GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
fujun
/
dxCard-service
Browse code
处理办卡人员关联用户
master
1 parent
6f0ae76
commit
df50db69ef142cd347b83e30feab5f0e31e4b36a
YFJ
authored
27 days ago
Patch
Showing
1 changed file
jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/service/service/impl/AuthUserServiceImpl.java
Ignore Space
Show notes
View
jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/service/service/impl/AuthUserServiceImpl.java
package org.jeecg.modules.service.service.impl; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import jakarta.annotation.Resource; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.service.entity.AuthUser; import org.jeecg.modules.service.entity.GroupMembers; import org.jeecg.modules.service.mapper.AuthUserMapper; import org.jeecg.modules.service.mapper.GroupMembersMapper; import org.jeecg.modules.service.service.IAuthUserService; import org.jeecg.modules.service.vo.*; import org.jeecg.modules.system.entity.CardApplicationCustomers; import org.jeecg.modules.system.entity.CardDeliveryPerson; import org.jeecg.modules.system.mapper.CardApplicationCustomersMapper; import org.jeecg.modules.system.mapper.CardDeliveryPersonMapper; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; /** * @Description: 微信用户档案 * @Author: jeecg-boot * @Date: 2025-09-28 * @Version: V1.0 */ @Service public class AuthUserServiceImpl extends ServiceImpl<AuthUserMapper, AuthUser> implements IAuthUserService { @Resource private AuthUserMapper authUserMapper; @Resource private CardApplicationCustomersMapper cardApplicationCustomersMapper; @Resource private CardDeliveryPersonMapper cardDeliveryPersonMapper; @Resource private GroupMembersMapper groupMembersMapper; @Override public RecommendUserVO recommendUser(String userId) { RecommendUserVO recommendUserVO = new RecommendUserVO(); recommendUserVO.setAmount(BigDecimal.ZERO); recommendUserVO.setDetails(new ArrayList<>()); //查询所有分销人为当前用户的数据 QueryWrapper<CardApplicationCustomers> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("distribution_customers_id", userId); queryWrapper.isNotNull("actual_commission"); List<CardApplicationCustomers> list = cardApplicationCustomersMapper.selectList(queryWrapper); for (CardApplicationCustomers cardApplicationCustomers : list){ CardApplicationVO cardApplicationVO = new CardApplicationVO(); cardApplicationVO.setId(cardApplicationCustomers.getId()); //查询办卡用户信息 AuthUser authUser = authUserMapper.selectById(cardApplicationCustomers.getCardApplicationId()); if(authUser != null){ cardApplicationVO.setAvatar(authUser.getAvatar()); cardApplicationVO.setName(authUser.getWxName()); cardApplicationVO.setReservationTime(DateUtil.format(cardApplicationCustomers.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); } cardApplicationVO.setAmount(cardApplicationCustomers.getActualCommission()); recommendUserVO.setAmount(recommendUserVO.getAmount().add(cardApplicationCustomers.getActualCommission())); recommendUserVO.getDetails().add(cardApplicationVO); } return recommendUserVO; } @Override public List<MyGroupMemberVO> myGroupMemberList(String userId) { List<MyGroupMemberVO> list = new ArrayList<>(); //查询我的团成员信息 QueryWrapper<GroupMembers> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("client_id", userId); List<GroupMembers> groupMembers = groupMembersMapper.selectList(queryWrapper); for (GroupMembers groupMember : groupMembers) { MyGroupMemberVO myGroupMemberVO = new MyGroupMemberVO(); //查询会员信息 AuthUser authUser = authUserMapper.selectById(groupMember.getClientId()); if (authUser != null){ myGroupMemberVO.setName(authUser.getWxName()); myGroupMemberVO.setAvatar(authUser.getAvatar()); } //查询预约信息 CardApplicationCustomers cardApplicationCustomers = cardApplicationCustomersMapper.selectById(groupMember.getReservationId()); if (cardApplicationCustomers != null){ myGroupMemberVO.setReservationTime(DateUtil.format(cardApplicationCustomers.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); myGroupMemberVO.setPhone(cardApplicationCustomers.getCardApplicationPhone()); } list.add(myGroupMemberVO); } return list; } @Override public List<DispatchUserVO> dispatchUser(String userId) { List<DispatchUserVO> list = new ArrayList<>(); //查询办卡人员 AuthUser authUser = authUserMapper.selectById(userId); if (authUser == null){ throw new JeecgBootException("用户不存在"); } QueryWrapper<CardDeliveryPerson> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("status", "1"); queryWrapper.eq("phone", authUser.getWxPhone()); CardDeliveryPerson cardDeliveryPerson = cardDeliveryPersonMapper.selectOne(queryWrapper); if (cardDeliveryPerson == null){ throw new JeecgBootException("当前用户非办卡人员"); } QueryWrapper<CardApplicationCustomers> queryWrapper1 = new QueryWrapper<>(); queryWrapper1.eq("card_delivery_person", cardDeliveryPerson.getId()); List<CardApplicationCustomers> cardApplicationCustomers = cardApplicationCustomersMapper.selectList(queryWrapper1); for (CardApplicationCustomers cardApplicationCustomer : cardApplicationCustomers) { DispatchUserVO dispatchUserVO = new DispatchUserVO(); dispatchUserVO.setId(cardApplicationCustomer.getId()); dispatchUserVO.setName(cardApplicationCustomer.getCardApplicationName()); dispatchUserVO.setPhone(cardApplicationCustomer.getCardApplicationPhone()); dispatchUserVO.setReservationTime(DateUtil.format(cardApplicationCustomer.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); dispatchUserVO.setIsApplication(cardApplicationCustomer.getStatus().equals("2")); list.add(dispatchUserVO); } if (!list.isEmpty()){ //未办卡的排前面,按预约时间正序排列 list = list.stream() .sorted(Comparator.comparing(DispatchUserVO::getIsApplication) .thenComparing(DispatchUserVO::getReservationTime)) .collect(Collectors.toList()); } return list; } @Override public DispatchDetailVO dispatchUserDetail(String id) { DispatchDetailVO dispatchDetailVO = new DispatchDetailVO(); CardApplicationCustomers cardApplicationCustomers = cardApplicationCustomersMapper.selectById(id); if (cardApplicationCustomers == null){ throw new JeecgBootException("预约单不存在"); } dispatchDetailVO.setId(cardApplicationCustomers.getId()); dispatchDetailVO.setCreateTime(DateUtil.format(cardApplicationCustomers.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); dispatchDetailVO.setName(cardApplicationCustomers.getCardApplicationName()); dispatchDetailVO.setPhone(cardApplicationCustomers.getCardApplicationPhone()); dispatchDetailVO.setReservationTime(DateUtil.format(cardApplicationCustomers.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); dispatchDetailVO.setProvince(cardApplicationCustomers.getProvince()); dispatchDetailVO.setCity(cardApplicationCustomers.getCity()); dispatchDetailVO.setArea(cardApplicationCustomers.getArea()); dispatchDetailVO.setAddress(cardApplicationCustomers.getProvince() + cardApplicationCustomers.getCity() + cardApplicationCustomers.getArea() + cardApplicationCustomers.getAddress()); dispatchDetailVO.setTransactionPhone(cardApplicationCustomers.getTransactionPhone()); dispatchDetailVO.setAmount(cardApplicationCustomers.getAmount()); return dispatchDetailVO; } }
package org.jeecg.modules.service.service.impl; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import jakarta.annotation.Resource; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.service.entity.AuthUser; import org.jeecg.modules.service.entity.GroupMembers; import org.jeecg.modules.service.mapper.AuthUserMapper; import org.jeecg.modules.service.mapper.GroupMembersMapper; import org.jeecg.modules.service.service.IAuthUserService; import org.jeecg.modules.service.vo.*; import org.jeecg.modules.system.entity.CardApplicationCustomers; import org.jeecg.modules.system.mapper.CardApplicationCustomersMapper; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; /** * @Description: 微信用户档案 * @Author: jeecg-boot * @Date: 2025-09-28 * @Version: V1.0 */ @Service public class AuthUserServiceImpl extends ServiceImpl<AuthUserMapper, AuthUser> implements IAuthUserService { @Resource private AuthUserMapper authUserMapper; @Resource private CardApplicationCustomersMapper cardApplicationCustomersMapper; @Resource private GroupMembersMapper groupMembersMapper; @Override public RecommendUserVO recommendUser(String userId) { RecommendUserVO recommendUserVO = new RecommendUserVO(); recommendUserVO.setAmount(BigDecimal.ZERO); recommendUserVO.setDetails(new ArrayList<>()); //查询所有分销人为当前用户的数据 QueryWrapper<CardApplicationCustomers> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("distribution_customers_id", userId); queryWrapper.isNotNull("actual_commission"); List<CardApplicationCustomers> list = cardApplicationCustomersMapper.selectList(queryWrapper); for (CardApplicationCustomers cardApplicationCustomers : list){ CardApplicationVO cardApplicationVO = new CardApplicationVO(); cardApplicationVO.setId(cardApplicationCustomers.getId()); //查询办卡用户信息 AuthUser authUser = authUserMapper.selectById(cardApplicationCustomers.getCardApplicationId()); if(authUser != null){ cardApplicationVO.setAvatar(authUser.getAvatar()); cardApplicationVO.setName(authUser.getWxName()); cardApplicationVO.setReservationTime(DateUtil.format(cardApplicationCustomers.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); } cardApplicationVO.setAmount(cardApplicationCustomers.getActualCommission()); recommendUserVO.setAmount(recommendUserVO.getAmount().add(cardApplicationCustomers.getActualCommission())); recommendUserVO.getDetails().add(cardApplicationVO); } return recommendUserVO; } @Override public List<MyGroupMemberVO> myGroupMemberList(String userId) { List<MyGroupMemberVO> list = new ArrayList<>(); //查询我的团成员信息 QueryWrapper<GroupMembers> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("client_id", userId); List<GroupMembers> groupMembers = groupMembersMapper.selectList(queryWrapper); for (GroupMembers groupMember : groupMembers) { MyGroupMemberVO myGroupMemberVO = new MyGroupMemberVO(); //查询会员信息 AuthUser authUser = authUserMapper.selectById(groupMember.getClientId()); if (authUser != null){ myGroupMemberVO.setName(authUser.getWxName()); myGroupMemberVO.setAvatar(authUser.getAvatar()); } //查询预约信息 CardApplicationCustomers cardApplicationCustomers = cardApplicationCustomersMapper.selectById(groupMember.getReservationId()); if (cardApplicationCustomers != null){ myGroupMemberVO.setReservationTime(DateUtil.format(cardApplicationCustomers.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); myGroupMemberVO.setPhone(cardApplicationCustomers.getCardApplicationPhone()); } list.add(myGroupMemberVO); } return list; } @Override public List<DispatchUserVO> dispatchUser(String userId) { List<DispatchUserVO> list = new ArrayList<>(); QueryWrapper<CardApplicationCustomers> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("card_delivery_person", userId); List<CardApplicationCustomers> cardApplicationCustomers = cardApplicationCustomersMapper.selectList(queryWrapper); for (CardApplicationCustomers cardApplicationCustomer : cardApplicationCustomers) { DispatchUserVO dispatchUserVO = new DispatchUserVO(); dispatchUserVO.setId(cardApplicationCustomer.getId()); dispatchUserVO.setName(cardApplicationCustomer.getCardApplicationName()); dispatchUserVO.setPhone(cardApplicationCustomer.getCardApplicationPhone()); dispatchUserVO.setReservationTime(DateUtil.format(cardApplicationCustomer.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); dispatchUserVO.setIsApplication(cardApplicationCustomer.getStatus().equals("2")); list.add(dispatchUserVO); } if (!list.isEmpty()){ //未办卡的排前面,按预约时间正序排列 list = list.stream() .sorted(Comparator.comparing(DispatchUserVO::getIsApplication) .thenComparing(DispatchUserVO::getReservationTime)) .collect(Collectors.toList()); } return list; } @Override public DispatchDetailVO dispatchUserDetail(String id) { DispatchDetailVO dispatchDetailVO = new DispatchDetailVO(); CardApplicationCustomers cardApplicationCustomers = cardApplicationCustomersMapper.selectById(id); if (cardApplicationCustomers == null){ throw new JeecgBootException("预约单不存在"); } dispatchDetailVO.setId(cardApplicationCustomers.getId()); dispatchDetailVO.setCreateTime(DateUtil.format(cardApplicationCustomers.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); dispatchDetailVO.setName(cardApplicationCustomers.getCardApplicationName()); dispatchDetailVO.setPhone(cardApplicationCustomers.getCardApplicationPhone()); dispatchDetailVO.setReservationTime(DateUtil.format(cardApplicationCustomers.getReservationTime(), "yyyy-MM-dd HH:mm:ss")); dispatchDetailVO.setProvince(cardApplicationCustomers.getProvince()); dispatchDetailVO.setCity(cardApplicationCustomers.getCity()); dispatchDetailVO.setArea(cardApplicationCustomers.getArea()); dispatchDetailVO.setAddress(cardApplicationCustomers.getProvince() + cardApplicationCustomers.getCity() + cardApplicationCustomers.getArea() + cardApplicationCustomers.getAddress()); dispatchDetailVO.setTransactionPhone(cardApplicationCustomers.getTransactionPhone()); dispatchDetailVO.setAmount(cardApplicationCustomers.getAmount()); return dispatchDetailVO; } }
Show line notes below