gongzuming
2024-09-03 0a9e89a052663fbaee67e59f7b070ad6b110df44
当前用户积分
已修改2个文件
19 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/response/current/CurrentUserDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/system/UserService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/current/CurrentUserDTO.java
@@ -50,4 +50,7 @@
    @ApiModelProperty(value = "是否绑定微信")
    private Boolean bindWechat;
    @ApiModelProperty(value = "当前积分")
    private Integer currentPoint;
}
src/main/java/com/mzl/flower/service/system/UserService.java
@@ -13,11 +13,14 @@
import com.mzl.flower.dto.response.system.MenuTreeDTO;
import com.mzl.flower.dto.response.system.UserDetailsDTO;
import com.mzl.flower.dto.response.system.UserListDTO;
import com.mzl.flower.entity.point.CustomerPoint;
import com.mzl.flower.entity.system.*;
import com.mzl.flower.enums.TrueOrFalseEnum;
import com.mzl.flower.mapper.point.CustomerPointMapper;
import com.mzl.flower.mapper.system.*;
import com.mzl.flower.service.customer.CustomerService;
import com.mzl.flower.service.partner.PartnerService;
import com.mzl.flower.service.point.CustomerPointService;
import com.mzl.flower.service.supplier.SupplierService;
import com.mzl.flower.utils.TreeBuilderUtil;
import com.mzl.flower.utils.UUIDGenerator;
@@ -73,6 +76,10 @@
    @Autowired
    private EmployeeMapper employeeMapper;
    @Autowired
    private CustomerPointMapper customerPointMapper;
    public User findUserByOpenId(String openId, String sessionKey, String unionId
            , String imgUrl, String nickname,String userType){
@@ -188,6 +195,15 @@
        if(Constants.USER_TYPE.customer.name().equals(user.getType())){
            result.setCustomerDTO(customerService.getCurrentCustomer());
            //查询积分
            CustomerPoint customerPoint = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>()
                    .eq(CustomerPoint::getUserId, userId));
            if(customerPoint == null){
                result.setCurrentPoint(0);
            }else{
                Integer currentPoint =customerPoint.getTotalPoint()-customerPoint.getUsedPoint()-customerPoint.getExpiredPoint();
                result.setCurrentPoint(currentPoint>=0?currentPoint:0);
            }
        }else if(Constants.USER_TYPE.supplier.name().equals(user.getType())){
            result.setSupplierDTO(supplierService.getCurrentSupplier());
        }else if(Constants.USER_TYPE.partner.name().equals(user.getType())){