无关风月
2025-08-25 48d3f1b77adea0609bb2453c7b4a660f2222871f
bug修改
16个文件已修改
165 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargeOrderController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/GetImportOrderDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/ChargeOrderMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TServiceController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/WXCallBackController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ServiceVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/IntegralRecord.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java
@@ -36,6 +36,11 @@
                return R.fail("保存用户充电记录:" + cause.getMessage());
            }
            @Override
            public R<String> getServiceStatus(Integer userId) {
                return R.fail("查询站点账号服务费缴纳去情况失败:" + cause.getMessage());
            }
        };
    }
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
@@ -8,6 +8,7 @@
import com.ruoyi.other.api.factory.StoreFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@@ -23,5 +24,8 @@
    @GetMapping(value = "/integral/saveIntegralRecord")
    R saveIntegralRecord(@RequestBody IntegralRecord record);
    @GetMapping(value = "/integralRule/getServiceStatus/{userId}")
    R<String> getServiceStatus(@PathVariable("userId") Integer userId);
}
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
@@ -3,6 +3,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.ruoyi.other.api.feignClient.OtherClient;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
@@ -38,6 +39,8 @@
    private SysLoginService sysLoginService;
    @Resource
    private SysUserClient userClient;
    @Resource
    private OtherClient otherClient;
    
    
    
@@ -53,8 +56,53 @@
        if(CollectionUtils.isEmpty(roles)){
            return R.fail("请关联角色!");
        }
        R<SysUser> sysUser1 = userClient.getSysUser(userInfo.getSysUser().getUserId());
        SysUser data = sysUser1.getData();
        if (data.getRoleType() == 2){
            String status = otherClient.getServiceStatus(data.getUserId().intValue()).getData();
            switch (status){
                case "1":
                    return R.fail("未缴纳服务费");
                case "2":
                    return R.fail("服务费已过期");
            }
        }
        map.put("roleName",roles.get(0).getRoleName());
        map.put("info", userInfo);
        // 修改用户最后登录时间
        SysUser sysUser = new SysUser();
        sysUser.setUserId(userInfo.getSysUser().getUserId());
        sysUser.setLoginDate(new Date());
        System.out.println("修改用户登录时间" + sysUser);
        userClient.updateSysUser(sysUser);
        return R.ok(map);
    }
        map.put("roleName",roles.get(0).getRoleName());
    @PostMapping("loginSite")
    public R<?> loginSite(@RequestBody LoginBody form, HttpServletRequest request) {
        // 用户登录
        LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), request);
        HashMap<String, Object> map = new HashMap<>();
        map.put("token", tokenService.createToken(userInfo));
        List<SysRole> roles = userInfo.getSysUser().getRoles();
        if(CollectionUtils.isEmpty(roles)){
            return R.fail("请关联角色!");
        }
        R<SysUser> sysUser1 = userClient.getSysUser(userInfo.getSysUser().getUserId());
        SysUser data = sysUser1.getData();
        if (data.getRoleType() != 2){
            return R.fail("仅限站点账号登录!");
        }
            String status = otherClient.getServiceStatus(data.getUserId().intValue()).getData();
            switch (status){
                case "1":
                    return R.fail("未缴纳服务费");
                case "2":
                    return R.fail("服务费已过期");
            }
        map.put("roleName",roles.get(0).getRoleName());
        map.put("info", userInfo);
        // 修改用户最后登录时间
        SysUser sysUser = new SysUser();
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -83,7 +83,7 @@
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser data = sysUserClient.getSysUser(userid).getData();
        if (data.getRoleType()==3){
        if (data.getRoleType()==2){
            siteList.setSiteId(data.getSiteId());
        }
        List<GetSiteListDTO> list = siteService.getSiteListNolimit(siteList);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargeOrderController.java
@@ -8,13 +8,20 @@
import com.ruoyi.common.core.dto.ChargingPercentProvinceDto;
import com.ruoyi.common.core.utils.WebUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.dto.GetImportOrderDTO;
import com.ruoyi.order.export.ChargeOrderExport;
import com.ruoyi.order.model.ChargeOrder;
import com.ruoyi.order.service.ChargeOrderService;
import com.ruoyi.other.api.domain.TIntegralRule;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -32,6 +39,8 @@
public class ChargeOrderController {
    @Resource
    private ChargeOrderService chargeOrderService;
    @Resource
    private SysUserClient sysUserClient;
    @PostMapping(value = "/getBySiteIdAndTime")
    public R<List<ChargingOrderGroup>> getBySiteIdAndTime(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto) {
@@ -52,6 +61,8 @@
        return chargeOrderService.importExpress(file);
    }
    @Autowired
    private TokenService tokenService;
    /**
     * 获取导入订单列表
     */
@@ -59,7 +70,13 @@
    @PostMapping("/getImportData")
    @ApiOperation(value = "获取导入订单列表", tags = "后台-充电订单")
    public R<PageInfo<ChargeOrder>> getUserPointPageList(@RequestBody GetImportOrderDTO getImportOrderDTO) {
        LoginUser loginUser = tokenService.getLoginUser();
        R<SysUser> sysUser = sysUserClient.getSysUser(loginUser.getUserid());
        SysUser data = sysUser.getData();
        if (data.getRoleType() == 2){
            // 只查询当前站点数据
            getImportOrderDTO.setSiteId(data.getSiteId());
        }
        PageInfo<ChargeOrder> pageInfo=chargeOrderService.getUserPointPageList(getImportOrderDTO);
        return R.ok(pageInfo);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -32,6 +32,7 @@
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.dto.ShopAnalysisDTO;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.other.api.feignClient.ShopClient;
@@ -675,7 +676,15 @@
                orderExport.setSupplierCostPrice(goods.getShopCost());*/
            }
        });
        List<Shop> data = shopClient.getAllShop().getData();
        // 转化为map
        Map<Integer, Shop> shopMap = data.stream().collect(Collectors.toMap(Shop::getId, shop -> shop));
        for (OrderExport orderExport : orderExportList) {
            Shop shop = shopMap.get(orderExport.getShopId());
            if (shop!=null){
                orderExport.setShopName(shop.getName());
            }
        }
        ExcelUtil<OrderExport> util = new ExcelUtil<OrderExport>(OrderExport.class);
        util.exportExcel(response, orderExportList, "订单数据");
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/GetImportOrderDTO.java
@@ -2,6 +2,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestParam;
@@ -14,6 +15,7 @@
    private String chargingStation;
    private String powerStationOperator;
    private String terminalCode;
    private Integer siteId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime beginTime1;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.dto.GetImportOrderDTO;
import com.ruoyi.order.mapper.ChargeOrderMapper;
import com.ruoyi.order.mapper.OrderMapper;
@@ -313,7 +314,7 @@
            throw new ServiceException(e.getMessage());
        }
        if(!result.isEmpty()){
            return R.ok(result);
            return R.fail(result);
        }
        return R.ok();
    }
@@ -384,6 +385,9 @@
                sysUserClient.updateSysUser(sysUser);
            }
        }
        //保存到数据库
        chargeOrder.setPoint(point);
        chargeOrderService.save(chargeOrder);
        //添加用户积分流水
        //转入用户
        UserPoint userPoint = new UserPoint();
@@ -398,9 +402,7 @@
        if (r.isError(r)) {
            return R.fail("导入订单-保存用户积分流水失败");
        }
        //保存到数据库
        chargeOrder.setPoint(point);
        chargeOrderService.save(chargeOrder);
        return R.ok();
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
@@ -40,6 +40,7 @@
    private String userName;
    private Long appUserId;
    private Integer shopId;
    /**
     * 联系方式
@@ -53,6 +54,11 @@
     */
    @Excel(name = "商品名称")
    private String goodsName;
    /**
     * 商品名称
     */
    @Excel(name = "店铺名称")
    private String shopName;
    /**
     * 商品售价
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/ChargeOrderMapper.xml
@@ -29,6 +29,9 @@
        <if test="dto.beginTime2 != null and dto.endTime2 != null">
            AND end_time between #{dto.beginTime2 } and  #{dto.endTime2  }
        </if>
        <if test="dto.siteId != null">
            AND site_id = #{dto.siteId}
        </if>
      order by begin_time DESC
    </select>
    <select id="chargingOrderGroup" resultType="com.ruoyi.common.core.dto.ChargingOrderGroup">
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -173,11 +173,13 @@
        o.pay_method,
            o.payment_amount orderMoney,
            o.point ,
            o.serial_number
            o.serial_number,
        o.shop_id as shopId
        FROM
            t_order_good og
                LEFT JOIN t_order o ON og.order_id = o.id
        left join
        where  o.del_flag = 0 and o.pay_status = 2
        <if test="null != item.orderNumber and '' != item.orderNumber">
            and o.order_number like CONCAT('%', #{item.orderNumber}, '%')
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java
@@ -122,15 +122,27 @@
        ServicePay one = servicePayService.lambdaQuery().eq(ServicePay::getPayStatus, 2)
                .eq(ServicePay::getUserId, userid).orderByDesc(ServicePay::getCreateTime)
                .last("limit 1").one();
        if (one!=null){
        ServicePay servicePayBefore = servicePayService.lambdaQuery()
                .eq(ServicePay::getUserId, userid)
                .eq(ServicePay::getPayStatus,2)
                .eq(ServicePay::getDelFlag,0)
                .orderByDesc(ServicePay::getCreateTime)
                .last("limit 1")
                .one();
        if (servicePayBefore==null){
            workPlatformVO.setServiceStatus(1);
            workPlatformVO.setEndTime(one.getEndTime());
        } else if (servicePayBefore.getEndTime().isBefore(LocalDateTime.now())) {
            workPlatformVO.setServiceStatus(2);
            workPlatformVO.setEndTime(servicePayBefore.getEndTime());
        }else{
            workPlatformVO.setServiceStatus(0);
            workPlatformVO.setEndTime(null);
            workPlatformVO.setServiceStatus(3);
            workPlatformVO.setEndTime(servicePayBefore.getEndTime());
        }
        return R.ok(workPlatformVO);
    }
    @PostMapping("/integralPageList")
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TServiceController.java
@@ -75,6 +75,28 @@
    private TServicePayService servicePayService;
    @Resource
    private SiteClient siteClient;
    // 查询服务费缴纳情况
    @GetMapping("/getServiceStatus/{userId}")
    public R<String> getServiceStatus(@PathVariable("userId") Integer userId) {
        Long userid = tokenService.getLoginUser().getUserid();
        ServicePay servicePayBefore = servicePayService.lambdaQuery()
                .eq(ServicePay::getUserId, userid)
                .eq(ServicePay::getPayStatus,2)
                .eq(ServicePay::getDelFlag,0)
                .orderByDesc(ServicePay::getCreateTime)
                .last("limit 1")
                .one();
        if (servicePayBefore==null){
            return R.ok("1");
        }
        else if (servicePayBefore.getEndTime().isBefore(LocalDateTime.now())) {
            return R.ok("2");
        }
        else{
            return R.ok("3");
        }
    }
    @PostMapping("/servicePageList")
    @ApiOperation(tags = {"2.0-服务费"},value = "服务费管理")
    public R<ServiceVO> integralPageList(@RequestBody ServiceListQuery query) {
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/WXCallBackController.java
@@ -117,7 +117,9 @@
            integralRecord.setIntegralCount(integralPay.getIntegralCount());
            integralRecord.setDelFlag(0);
            integralRecord.setCreateTime(LocalDateTime.now());
            integralRecordService.save(integralRecord);
            if (integralPay.getIntegralCount()>0){
                integralRecordService.save(integralRecord);
            }
            data.setIntegral(data.getIntegral()!=null?data.getIntegral() + integralPay.getIntegralCount():integralPay.getIntegralCount());
            sysUserClient.updateSysUser(data);
            return R.ok(null, "success");
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ServiceVO.java
@@ -20,3 +20,4 @@
    @ApiModelProperty("缴纳明细")
    private PageInfo<ServiceListVO> serviceList;
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/IntegralRecord.xml
@@ -7,7 +7,7 @@
        select * from t_integral_record
        where 1=1
        <if test="query.type != null ">
            and integral_type = 1
            and integral_type = #{query.type}
        </if>
          and site_id = #{query.siteId}
        and del_flag = 0