Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
# Conflicts:
# ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
| | |
| | | @ApiModelProperty("最低会员价格") |
| | | private BigDecimal minPrice; |
| | | @ApiModelProperty("vip结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime vipExpireTime; |
| | | @ApiModelProperty("当天是否签到") |
| | | private Integer isSign; |
| | |
| | | private Integer points; |
| | | @ApiModelProperty("当前优惠卷数量") |
| | | private Integer couponNum; |
| | | private Long vipCouponNum; |
| | | @ApiModelProperty("是否第一次添加车") |
| | | private Integer firstAdd; |
| | | @ApiModelProperty("当前绑定的车辆") |
| | |
| | | @TableField("coupon_json") |
| | | private String couponJson; |
| | | |
| | | @TableField("detail_id") |
| | | private Long detailId; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private LocalDateTime createTime; |
| | | @TableField(exist = false) |
| | | private String avatar; |
| | | @TableField(exist = false) |
| | | private String name; |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateChargingPileStatus(String code, Integer status) { |
| | | public void updateChargingPileStatus(String pile_code, String gun_code, Integer status) { |
| | | log.error("修改充电桩状态失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | |
| | | public R<Partner> getPartnerById(Integer id) { |
| | | return R.fail("根据id获取合作商信息失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Set<Integer>> authSite(Integer partnerId, String siteMenu) { |
| | | return R.fail("获取合作商授权的站点数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | * @param status |
| | | */ |
| | | @PostMapping("/t-charging-pile/updateChargingPileStatus") |
| | | void updateChargingPileStatus(@RequestParam("code") String code, @RequestParam("status") Integer status); |
| | | void updateChargingPileStatus(@RequestParam("pile_code") String pile_code, @RequestParam("gun_code") String gun_code, @RequestParam("status") Integer status); |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/partner/getPartnerById/{id}") |
| | | R<Partner> getPartnerById(@PathVariable("id") Integer id); |
| | | |
| | | |
| | | /** |
| | | * 获取合作商授权的站点数据 |
| | | * @param partnerId |
| | | * @param siteMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/partner/authSite/{partnerId}") |
| | | R<Set<Integer>> authSite(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteMenu") String siteMenu); |
| | | } |
| | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "停车场名称") |
| | | @TableField("name") |
| | | private String name; |
| | |
| | | @ApiModelProperty(value = "车牌号") |
| | | @TableField("license_plate") |
| | | private String licensePlate; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private String uid; |
| | | |
| | |
| | | @TableField("serialnumber") |
| | | private String serialnumber; |
| | | |
| | | @TableField(exist = false) |
| | | private String parkName; |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(String orderId) { |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(String ids) { |
| | | return R.fail("根据订单编号s获取所有监测数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<UploadRealTimeMonitoringData>> getDataByOrderCode(String code) { |
| | |
| | | |
| | | @Override |
| | | public R<UploadRealTimeMonitoringPageData> getAll(MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | return null; |
| | | return R.fail("getAll:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | |
| | | /** |
| | | * 批量查询 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/uploadRealTimeMonitoringData/getOrderInfoByCodes") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@RequestParam("orderId") String orderId); |
| | | @GetMapping(value = "/uploadRealTimeMonitoringData/getOrderInfoByCodes/{ids}") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@PathVariable("ids") String ids); |
| | | /** |
| | | * 根据订单编号获取所有监测数据 |
| | | * @param code |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | |
| | | */ |
| | | @Data |
| | | public class BaseModel { |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date last_time = new Date(); |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date create_time = new Date(); |
| | | } |
| | |
| | | public void endChargeBillingCharge(TransactionRecordMessageVO vo) { |
| | | log.error("停止充电返回账单后计算费用处理失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TChargingOrder>> getChargingOrder(TChargingOrderVo order) { |
| | | return R.fail("获取充电订单数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Integer> getSalesCountByGoodsIdgetCount(Integer goodId, Integer goodeType, Integer buyType) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<String>> getCodeByOrderId(String goodsIds) { |
| | | return R.fail("根据订单ids查询现金购买优惠券订单编号:" + cause.getMessage()); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/t-charging-order/endChargeBillingCharge") |
| | | void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo); |
| | | |
| | | /** |
| | | * 获取充电订单数据 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-order/getChargingOrder") |
| | | R<List<TChargingOrder>> getChargingOrder(@RequestBody TChargingOrderVo order); |
| | | } |
| | |
| | | public R managementGiveVip(@RequestBody TGrantVip grantVip); |
| | | @GetMapping("/t-exchange-order/getSalesCountByGoodsIds/{goodsIds}") |
| | | R<List<Integer>> getSalesCountByGoodsId(@PathVariable("goodsIds") String goodsIds); |
| | | @GetMapping("/t-exchange-order/getCount") |
| | | R<Integer> getSalesCountByGoodsIdgetCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType); |
| | | |
| | | /** |
| | | * 管理后台 根据t_app_coupon订单购买或者兑换优惠券的订单编号 |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/29 13:35 |
| | | */ |
| | | @Data |
| | | public class TChargingOrderVo extends TChargingOrder { |
| | | private List<Integer> statusList; |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private Integer useCount; |
| | | |
| | | @ApiModelProperty(value = "销量") |
| | | @TableField(exist = false) |
| | | private Integer salesCount; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "充电枪code ") |
| | | private String chargingGunCode; |
| | | @ApiModelProperty(value = "开始时间2020-01-01 00:00:00 - 2021-01-01 23:59:59") |
| | | private String startTime; |
| | | private String createTime; |
| | | @ApiModelProperty(value = "结束时间2020-01-01 00:00:00 - 2021-01-01 23:59:59") |
| | | private String endTime; |
| | | private String lastTime; |
| | | @ApiModelProperty(value = "订单来源 1明星 2快电 3新电途") |
| | | private Integer orderSource; |
| | | @ApiModelProperty(value = "用户ids 前端忽略") |
| | |
| | | public static String getMD5(String str) { |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | try { |
| | | // 创建MD5加密实例 |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | md.update(str.getBytes()); |
| | | byte b[] = md.digest(); |
| | | int i; |
| | | StringBuffer buf = new StringBuffer(""); |
| | | for (int offset = 0; offset < b.length; offset++) { |
| | | i = b[offset]; |
| | | if (i < 0) |
| | | i += 256; |
| | | if (i < 16) |
| | | buf.append("0"); |
| | | buf.append(Integer.toHexString(i)); |
| | | |
| | | // 执行加密操作 |
| | | byte[] messageDigest = md.digest(str.getBytes()); |
| | | |
| | | // 将得到的散列值转换为十六进制 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (byte b : messageDigest) { |
| | | sb.append(String.format("%02x", b)); |
| | | } |
| | | //32位加密(小写) |
| | | return buf.toString(); |
| | | //32位加密(大写) |
| | | //return buf.toString().toUpperCase(); |
| | | // 16位的加密(小写) |
| | | //return buf.toString().substring(8, 24); |
| | | // 16位的加密(大写) |
| | | //return buf.toString().substring(8, 24).toUpperCase(); |
| | | |
| | | // 返回MD5散列值 |
| | | return sb.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | @Resource |
| | | private TAppUserVipDetailService appUserVipDetailService; |
| | | |
| | | @ApiOperation(value = "个人中心信息", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/info") |
| | |
| | | if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){ |
| | | appUserInfoDto.setIsVip(0); |
| | | }else { |
| | | TAppUserVipDetail one = appUserVipDetailService.getOne(new LambdaQueryWrapper<TAppUserVipDetail>() |
| | | .eq(TAppUserVipDetail::getAppUserId, userId) |
| | | .eq(TAppUserVipDetail::getVipId, byId.getVipId()) |
| | | .last(" and now() between start_time and end_time")); |
| | | Long count = appCouponService.lambdaQuery().eq(TAppCoupon::getDetailId, one.getId()).count(); |
| | | appUserInfoDto.setVipCouponNum(count); |
| | | appUserInfoDto.setIsVip(1); |
| | | appUserInfoDto.setVipExpireTime(byId.getVipEndTime()); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | for (TInviteUser record : page.getRecords()) { |
| | | TAppUser byId = appUserService.getById(record.getBeInvitedAppUserId()); |
| | | record.setAvatar(byId.getAvatar()); |
| | | record.setName(byId.getName()); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.account.mapper.TInviteUserMapper; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TInviteUserService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private IntegralRuleClient integralRuleClient; |
| | | @Autowired |
| | | private TAppUserService appUserService; |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | |
| | | /** |
| | | * |
| | | * @param appUserId 被邀请人 |
| | | * @param beInvitedAppUserId 邀请人 |
| | | */ |
| | | @Override |
| | | public void saveInviteUser(Long appUserId, Long beInvitedAppUserId) { |
| | | |
| | | // 查询用户信息 |
| | | TAppUser user = appUserService.getById(beInvitedAppUserId); |
| | | GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | getAppUserVipDetail.setAppUserId(beInvitedAppUserId); |
| | | getAppUserVipDetail.setVipId(user.getVipId()); |
| | | R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); |
| | | TAppUserVipDetail data1 = appUserVipDetail.getData(); |
| | | String vipJson = data1.getVipJson(); |
| | | TVip vip = JSON.parseObject(vipJson, TVip.class); |
| | | |
| | | // 查询邀请用户获得积分配置 |
| | | TIntegralRule integralRule = integralRuleClient.getSet().getData(); |
| | | JSONObject jsonObject = JSONObject.parseObject(integralRule.getInviteUsersToEarnPoints()); |
| | |
| | | inviteUser.setAppUserId(beInvitedAppUserId); |
| | | inviteUser.setBeInvitedAppUserId(appUserId); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | | inviteUser.setAward(jsonObject.getInteger("num1")); |
| | | if(Objects.nonNull(vip) && vip.getDoubleIntegration() == 1){ |
| | | inviteUser.setAward(jsonObject.getInteger("num1")*2); |
| | | }else { |
| | | inviteUser.setAward(jsonObject.getInteger("num1")); |
| | | } |
| | | this.save(inviteUser); |
| | | } |
| | | } |
| | |
| | | tAppCoupon.setWaysToObtain(4); |
| | | tAppCoupon.setStatus(1); |
| | | tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); |
| | | tAppCoupon.setDetailId(tAppUserVipDetail.getId()); |
| | | appCouponService.save(tAppCoupon); |
| | | } |
| | | } |
| | |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); |
| | | chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | |
| | | String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); |
| | | chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | Partner partner = partnerService.getPartner(id); |
| | | return R.ok(partner); |
| | | } |
| | | |
| | | /** |
| | | * 获取合作商授权的站点数据 |
| | | * @param partnerId |
| | | * @param siteMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/authSite/{partnerId}") |
| | | public R<Set<Integer>> authSite(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteMenu") String siteMenu){ |
| | | Set<Integer> integers = partnerService.authSite(partnerId, SiteMenu.valueOf(siteMenu)); |
| | | return R.ok(integers); |
| | | } |
| | | } |
| | |
| | | // 当前时间属于那个阶段 取哪个阶段的电价 |
| | | if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | if(null != byId1.getDiscount()){ |
| | | siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | }else{ |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(appUser)){ |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); |
| | | }else { |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | } |
| | | }else { |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | siteInfoVO.setChargingGunId(chargingGun.getId()); |
| | |
| | | // 当前时间属于那个阶段 取哪个阶段的电价 |
| | | if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | if(null != byId1.getDiscount()){ |
| | | siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | }else{ |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(appUser)){ |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); |
| | | }else { |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | } |
| | | }else { |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | siteInfoVO.setChargingPileId(one.getId()); |
| | |
| | | siteList.setPageSize(99999); |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | for (GetSiteListDTO record : list.getRecords()) { |
| | | Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); |
| | | List<Integer> c1 = new ArrayList<>(); |
| | | c1.add(3); |
| | | c1.add(4); |
| | | c1.add(5); |
| | | c1.add(6); |
| | | Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); |
| | | record.setC1(count); |
| | | Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); |
| | | Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count(); |
| | | record.setC2(count1); |
| | | Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); |
| | | Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); |
| | | record.setK1(count2); |
| | | Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); |
| | | Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count(); |
| | | record.setK2(count3); |
| | | Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); |
| | | Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); |
| | | record.setM1(count4); |
| | | Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); |
| | | Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count(); |
| | | record.setM2(count5); |
| | | |
| | | //利用率 |
| | |
| | | @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){ |
| | | |
| | | if (chargingPercentProvinceDto.getDate1()==null){ |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate lastMonth = today.minusMonths(1); |
| | | LocalDate firstDayOfLastMonth = lastMonth.withDayOfMonth(1); |
| | | LocalDate lastDayOfLastMonth =lastMonth.withDayOfMonth(lastMonth.lengthOfMonth()); |
| | | chargingPercentProvinceDto.setDate1(firstDayOfLastMonth); |
| | | chargingPercentProvinceDto.setDate2(lastDayOfLastMonth); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords(); |
| | | List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList()); |
| | | // 通过时间段获取和充电桩id获取各个充电站的充电订单 |
| | | if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){ |
| | | chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1)); |
| | | } |
| | | List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); |
| | | // 计算利用率展示 |
| | | for (ChargingOrderGroup datum : data) { |
| | |
| | | bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower()); |
| | | } |
| | | |
| | | long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()) + 1; |
| | | long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()); |
| | | BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")).multiply(BigDecimal.valueOf(daysBetween)); |
| | | //得到利用率 |
| | | BigDecimal divide = datum.getChargingCapacity().divide(multiply, 0, BigDecimal.ROUND_HALF_UP); |
| | |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | dto.getAccountingStrategyDetails().forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | }else { |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | dto.getAccountingStrategyDetails().forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | } |
| | | |
| | |
| | | TAccountingStrategy one = accountingStrategyService.lambdaQuery().eq(TAccountingStrategy::getId, byId.getParentId()).one(); |
| | | byId.setSiteId(one.getSiteId()); |
| | | //将site表对应的模板id修改为新的这个 |
| | | Site byId1 = siteService.getById(one.getSiteId()); |
| | | if (byId1!=null) { |
| | | byId1.setAccountingStrategyId(byId.getId()); |
| | | siteService.updateById(byId1); |
| | | List<Site> list = siteService.lambdaQuery().eq(Site::getAccountingStrategyId, one.getId()).list(); |
| | | for (Site site : list) { |
| | | site.setAccountingStrategyId(byId.getId()); |
| | | } |
| | | siteService.updateBatchById(list); |
| | | // |
| | | |
| | | |
| | | |
| | | // |
| | | accountingStrategyService.removeById(one.getId()); |
| | | } |
| | | //硬件 |
| | |
| | | settlementExportVO.setCreateTime1(createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | settlementExportVO.setStartTime1(startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | settlementExportVO.setEndTime1(endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | switch (settlementExportVO.getStatus()){ |
| | | case 0: |
| | | settlementExportVO.setStatusName("未知"); |
| | | break; |
| | | case 1: |
| | | settlementExportVO.setStatusName("等待中/已插枪"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setStatusName("启动中"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setStatusName("充电中"); |
| | | break; |
| | | case 4: |
| | | settlementExportVO.setStatusName("停止中"); |
| | | break; |
| | | case 5: |
| | | settlementExportVO.setStatusName("已结束"); |
| | | break; |
| | | if (chargingOrder.getStatus()!=null){ |
| | | switch (chargingOrder.getStatus()){ |
| | | case 0: |
| | | settlementExportVO.setStatusName("未知"); |
| | | break; |
| | | case 1: |
| | | settlementExportVO.setStatusName("等待中/已插枪"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setStatusName("启动中"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setStatusName("充电中"); |
| | | break; |
| | | case 4: |
| | | settlementExportVO.setStatusName("停止中"); |
| | | break; |
| | | case 5: |
| | | settlementExportVO.setStatusName("已结束"); |
| | | break; |
| | | |
| | | } |
| | | } |
| | | settlementExportVO.setOrderTypeName("充电订单"); |
| | | settlementExportVO.setChargingType("单桩双充"); |
| | |
| | | excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", chargingBillVOS), fillConfig, writeSheet2); |
| | | excelWriter.fill(new FillWrapper("data3", data.getList()), fillConfig, writeSheet3); |
| | | excelWriter.fill(new FillWrapper("data4", data.getList()), fillConfig, writeSheet3); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.TChargingOrderVo; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | @Autowired |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getChargingPileById/{id}") |
| | | public R<TChargingPile> getChargingPileById(@PathVariable Integer id){ |
| | | public R<TChargingPile> getChargingPileById(@PathVariable("id") Integer id){ |
| | | TChargingPile chargingPile = chargingPileService.getById(id); |
| | | return R.ok(chargingPile); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 更新充电桩状态 |
| | | * @param code |
| | | * @param status |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/updateChargingPileStatus") |
| | | public void updateChargingPileStatus(@RequestParam("code") String code, @RequestParam("status") Integer status){ |
| | | TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>() |
| | | .eq(TChargingPile::getCode, code).eq(TChargingPile::getDelFlag, 0)); |
| | | if(null != chargingPile){ |
| | | //充电桩正常,返回异常,处理充电桩状态和添加故障记录 |
| | | if(chargingPile.getStatus() == 1 && 1 == status){ |
| | | List<TFaultMessage> faultMessages = faultMessageService.list(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) |
| | | .eq(TFaultMessage::getStatus, 2).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); |
| | | if(faultMessages.isEmpty()){ |
| | | TFaultMessage faultMessage = new TFaultMessage(); |
| | | faultMessage.setSiteId(chargingPile.getSiteId()); |
| | | faultMessage.setChargingPileId(chargingPile.getId()); |
| | | faultMessage.setStatus(2); |
| | | faultMessage.setDownTime(LocalDateTime.now()); |
| | | faultMessage.setCreateTime(LocalDateTime.now()); |
| | | faultMessage.setDelFlag(false); |
| | | faultMessage.setContent("设备故障"); |
| | | faultMessageService.save(faultMessage); |
| | | |
| | | public void updateChargingPileStatus(@RequestParam("pile_code") String pile_code, @RequestParam("gun_code") String gun_code, @RequestParam("status") Integer status){ |
| | | Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online"); |
| | | Long time = (Long) charging_pile_online.get(pile_code + gun_code); |
| | | //小于30秒才处理数据,防止频繁查询数据 |
| | | if(null != time && (System.currentTimeMillis() - time) < 30000){ |
| | | return; |
| | | } |
| | | TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0)); |
| | | if(null != tChargingGun){ |
| | | TChargingPile chargingPile = chargingPileService.getById(tChargingGun.getChargingPileId()); |
| | | //枪处于离线或者故障,返回状态为正常,则修改其状态 |
| | | if(0 == status && tChargingGun.getStatus() != 2){ |
| | | TChargingGun tChargingGun1 = new TChargingGun(); |
| | | tChargingGun1.setId(tChargingGun.getId()); |
| | | tChargingGun1.setStatus(2); |
| | | chargingGunService.updateById(tChargingGun1); |
| | | if(chargingPile.getStatus() != 1){ |
| | | TChargingPile chargingPile1 = new TChargingPile(); |
| | | chargingPile1.setId(chargingPile.getId()); |
| | | chargingPile1.setStatus(3); |
| | | chargingPile1.setStatus(1); |
| | | chargingPileService.updateById(chargingPile1); |
| | | |
| | | List<TChargingGun> list1 = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId())); |
| | | for (TChargingGun chargingGun : list1) { |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(7); |
| | | chargingGunService.updateById(chargingGun1); |
| | | } |
| | | } |
| | | } |
| | | if(chargingPile.getStatus() != 1 && 0 == status){ |
| | | List<TFaultMessage> list = faultMessageService.list(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) |
| | | |
| | | List<TFaultMessage> list = faultMessageService.list(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingGunId, tChargingGun.getId()) |
| | | .isNull(TFaultMessage::getEndTime)); |
| | | if(!list.isEmpty()){ |
| | | list.forEach(s->s.setEndTime(LocalDateTime.now())); |
| | | faultMessageService.updateBatchById(list); |
| | | } |
| | | |
| | | TChargingPile chargingPile1 = new TChargingPile(); |
| | | chargingPile1.setId(chargingPile.getId()); |
| | | chargingPile1.setStatus(1); |
| | | chargingPileService.updateById(chargingPile1); |
| | | |
| | | List<TChargingGun> list1 = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId())); |
| | | for (TChargingGun chargingGun : list1) { |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(2); |
| | | chargingGunService.updateById(chargingGun1); |
| | | } |
| | | } |
| | | if(0 == status){ |
| | | Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_pile_online"); |
| | | charging_pile_online.put(code, System.currentTimeMillis()); |
| | | redisService.setCacheMap("charging_pile_online", charging_pile_online); |
| | | //枪处于正常,返回状态为故障,则修改其状态 |
| | | if(1 == status && tChargingGun.getStatus() != 1 && tChargingGun.getStatus() != 7){ |
| | | TChargingGun tChargingGun1 = new TChargingGun(); |
| | | tChargingGun1.setId(tChargingGun.getId()); |
| | | tChargingGun1.setStatus(7); |
| | | chargingGunService.updateById(tChargingGun1); |
| | | |
| | | //桩处于正常,桩所属的枪都处于非正常,修改桩状态为异常 |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0)); |
| | | int size = list.stream().filter(s -> s.getStatus() == 1 || s.getStatus() == 7).collect(Collectors.toList()).size(); |
| | | if(chargingPile.getStatus() == 1 && list.size() == size){ |
| | | TChargingPile chargingPile1 = new TChargingPile(); |
| | | chargingPile1.setId(chargingPile.getId()); |
| | | chargingPile1.setStatus(3); |
| | | chargingPileService.updateById(chargingPile1); |
| | | } |
| | | |
| | | TFaultMessage faultMessage = new TFaultMessage(); |
| | | faultMessage.setSiteId(chargingPile.getSiteId()); |
| | | faultMessage.setChargingPileId(chargingPile.getId()); |
| | | faultMessage.setChargingGunId(tChargingGun.getId()); |
| | | faultMessage.setStatus(2); |
| | | faultMessage.setDownTime(LocalDateTime.now()); |
| | | faultMessage.setCreateTime(LocalDateTime.now()); |
| | | faultMessage.setDelFlag(false); |
| | | faultMessage.setContent("设备故障"); |
| | | faultMessageService.save(faultMessage); |
| | | } |
| | | |
| | | if(1 != status){ |
| | | charging_pile_online.put(tChargingGun.getFullNumber(), System.currentTimeMillis()); |
| | | redisService.setCacheMap("charging_gun_online", charging_pile_online); |
| | | } |
| | | if(2 == status){ |
| | | TChargingOrderVo order = new TChargingOrderVo(); |
| | | order.setChargingPileId(tChargingGun.getChargingPileId()); |
| | | order.setChargingGunId(tChargingGun.getId()); |
| | | order.setStatusList(Arrays.asList(1, 2, 3, 4, 5)); |
| | | List<TChargingOrder> orders = chargingOrderClient.getChargingOrder(order).getData(); |
| | | if(orders.size() > 0){ |
| | | TChargingOrder chargingOrder = orders.get(0); |
| | | TChargingGun tChargingGun1 = new TChargingGun(); |
| | | if(Arrays.asList(1, 2).contains(chargingOrder.getStatus())){ |
| | | tChargingGun1.setStatus(3); |
| | | } |
| | | if(Arrays.asList(3).contains(chargingOrder.getStatus())){ |
| | | tChargingGun1.setStatus(4); |
| | | } |
| | | if(Arrays.asList(4).contains(chargingOrder.getStatus()) && chargingOrder.getEndMode() == 2){ |
| | | tChargingGun1.setStatus(5); |
| | | } |
| | | tChargingGun1.setId(tChargingGun.getId()); |
| | | chargingGunService.updateById(tChargingGun1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | .eq(TParkingLot::getSiteId, siteId))); |
| | | } |
| | | |
| | | @PostMapping(value = "/getRecordById") |
| | | @GetMapping(value = "/getRecordById") |
| | | public R<TParkingRecord> getRecordById(@RequestParam("id") Long id){ |
| | | return R.ok(parkingRecordService.getById(id)); |
| | | } |
| | |
| | | .page(Page.of(query.getPageCurr(), query.getPageSize())); |
| | | |
| | | for (TParkingRecord record : page.getRecords()) { |
| | | record.setName(parkingLotService.getById(record.getParkingLotId()).getName()); |
| | | TParkingLot byId = parkingLotService.getById(record.getParkingLotId()); |
| | | record.setUid(record.getId().toString()); |
| | | if (byId!=null) { |
| | | record.setParkName(byId.getName()); |
| | | } |
| | | } |
| | | return R.ok(page); |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.service.TRepairService; |
| | |
| | | private TRepairService repairService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private SysUserClient userClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | /** |
| | | * 添加故障报修管理 |
| | |
| | | public AjaxResult<String> add(@Validated @RequestBody TRepair dto) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 查询报修人员信息 |
| | | SysUser user = userClient.getSysUser(userId).getData(); |
| | | if(Objects.nonNull(user)){ |
| | | dto.setRepairman(user.getUserName()); |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(user)){ |
| | | dto.setRepairman(user.getName()); |
| | | } |
| | | repairService.add(dto); |
| | | return AjaxResult.success(); |
| | |
| | | @ResponseBody |
| | | @GetMapping("/getRepairList") |
| | | @ApiOperation(value = "获取报修记录列表数据", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, String siteId, BasePage basePage){ |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, Integer siteId, BasePage basePage){ |
| | | PageInfo<TRepair> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TRepair> repairList = repairService.getRepairList(pageInfo, name, siteId); |
| | | pageInfo.setRecords(repairList); |
| | |
| | | TVehicleRamp vehicleRamp = vehicleRampService.getById(dto.getId()); |
| | | TParkingLot parkingLot = parkingLotService.getById(vehicleRamp.getParkingLotId()); |
| | | SwitchwayGateReq req = new SwitchwayGateReq(); |
| | | req.setAction(vehicleRamp.getAction()); |
| | | req.setAction(dto.getAction()); |
| | | req.setChannel(vehicleRamp.getCarportNum()); |
| | | req.setAppkey(parkingLot.getAppKey()); |
| | | req.setSecretkey(parkingLot.getSecretKey()); |
| | |
| | | */ |
| | | List<TChargingPileNotification> chargingPileNotificationPageList(PageInfo<TChargingPileNotification> pageInfo, @Param("siteIds") Set<Integer> siteIds); |
| | | |
| | | /** |
| | | * 保存通知数据 |
| | | * @param siteId |
| | | * @param chargingPileId |
| | | * @param phone |
| | | * @param content |
| | | */ |
| | | void saveData(@Param("siteId") Integer siteId, |
| | | @Param("chargingPileId")Integer chargingPileId, |
| | | @Param("phone")String phone, |
| | | @Param("content")String content); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param pageInfo |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, @Param("siteId") Integer siteId); |
| | | List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, @Param("siteIds") List<Integer> siteIds); |
| | | } |
| | |
| | | * 获取列表数据 |
| | | * @param pageInfo |
| | | * @param name |
| | | * @param siteId |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, @Param("name") String name, @Param("siteId") String siteId); |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, @Param("name") String name, @Param("siteIds") List<Integer> siteIds); |
| | | |
| | | } |
| | |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId); |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, Integer siteId); |
| | | |
| | | /** |
| | | * 添加报修记录 |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | |
| | | @Resource |
| | | private IntegrationClient integrationClient; |
| | | |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param siteList |
| | | * @return |
| | | */ |
| | | |
| | | @Override |
| | | public PageInfo<GetSiteListDTO> getSiteList(GetSiteList siteList) { |
| | | Set<Integer> ids = null; |
| | |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | //改用roleId=1来判断 |
| | | if(admin.getData()!=1){ |
| | | // if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | if(data2.size() > 0){ |
| | |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(admin.getData()!=1){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | @Override |
| | | public PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin) { |
| | | TAppUser appUser = null; |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(isLogin == 1){ |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | appUser = appUserClient.getUserById(userId).getData(); |
| | | } |
| | |
| | | List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | // TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | getAppUserVipDetail.setAppUserId(userId); |
| | | getAppUserVipDetail.setVipId(appUser.getVipId()); |
| | | R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); |
| | | TAppUserVipDetail data1 = appUserVipDetail.getData(); |
| | | String vipJson = data1.getVipJson(); |
| | | TVip vip = JSON.parseObject(vipJson, TVip.class); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | list.forEach(item -> { |
| | | if(Objects.nonNull(vip.getDiscount())){ |
| | |
| | | List<SiteVO> list = this.baseMapper.getMapSiteList(query); |
| | | if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | // TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | getAppUserVipDetail.setAppUserId(userId); |
| | | getAppUserVipDetail.setVipId(appUser.getVipId()); |
| | | R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); |
| | | TAppUserVipDetail data1 = appUserVipDetail.getData(); |
| | | String vipJson = data1.getVipJson(); |
| | | TVip vip = JSON.parseObject(vipJson, TVip.class); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | list.forEach(item -> { |
| | | item.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); |
| | |
| | | @Override |
| | | public void saveData(Integer type,Integer siteId,Integer chargingPileId, String phone, String data) { |
| | | TChargingPileNotification notification = new TChargingPileNotification(); |
| | | switch (type){ |
| | | case 1: |
| | | // 验证码 |
| | | notification.setPhone(phone); |
| | | notification.setContent(data); |
| | | break; |
| | | default: |
| | | // 停车占位 |
| | | notification.setSiteId(siteId); |
| | | notification.setChargingPileId(chargingPileId); |
| | | notification.setPhone(phone); |
| | | notification.setContent(data); |
| | | break; |
| | | } |
| | | notification.setSiteId(siteId); |
| | | notification.setChargingPileId(chargingPileId); |
| | | notification.setPhone(phone); |
| | | notification.setContent(data); |
| | | this.save(notification); |
| | | } |
| | | |
| | |
| | | return AjaxResult.error("设备编号已存在"); |
| | | } |
| | | //调用华为Iot创建设备 |
| | | AddDevice addDevice = new AddDevice(); |
| | | addDevice.setProductId("66da68d21837002b28b34ec0"); |
| | | addDevice.setNodeId(chargingPile.getCode()); |
| | | addDevice.setDeviceName(chargingPile.getName()); |
| | | addDevice.setDescription(chargingPile.getNumber().toString()); |
| | | AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData(); |
| | | if(null != deviceResp){ |
| | | int httpStatusCode = deviceResp.getHttpStatusCode(); |
| | | if(httpStatusCode == 201){ |
| | | chargingPile.setIotdDeviceId(deviceResp.getDeviceId()); |
| | | this.save(chargingPile); |
| | | } |
| | | } |
| | | // AddDevice addDevice = new AddDevice(); |
| | | // addDevice.setProductId("66da68d21837002b28b34ec0"); |
| | | // addDevice.setNodeId(chargingPile.getCode()); |
| | | // addDevice.setDeviceName(chargingPile.getName()); |
| | | // addDevice.setDescription(chargingPile.getNumber().toString()); |
| | | // AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData(); |
| | | // if(null != deviceResp){ |
| | | // int httpStatusCode = deviceResp.getHttpStatusCode(); |
| | | // if(httpStatusCode == 201){ |
| | | // chargingPile.setIotdDeviceId(deviceResp.getDeviceId()); |
| | | // } |
| | | // } |
| | | this.save(chargingPile); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | //调用华为Iot删除设备 |
| | | if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ |
| | | DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); |
| | | if(null != deviceResp && deviceResp.getHttpStatusCode() == 0){ |
| | | this.removeById(chargingPile); |
| | | } |
| | | } |
| | | // if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ |
| | | // DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); |
| | | // if(null != deviceResp && deviceResp.getHttpStatusCode() == 0){ |
| | | // } |
| | | // } |
| | | this.removeById(chargingPile); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(0 == query.getSiteId()){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(admin.getData()!=1){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | */ |
| | | @Override |
| | | public void updateStatus() { |
| | | List<TChargingPile> list = this.list(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getDelFlag, 0)); |
| | | Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_pile_online"); |
| | | for (TChargingPile chargingPile : list) { |
| | | Long time = (Long) charging_pile_online.get(chargingPile.getCode()); |
| | | Map<String, Object> charging_gun_online = redisService.getCacheMap("charging_gun_online"); |
| | | Set<String> keySet = charging_gun_online.keySet(); |
| | | List<TChargingGun> list = new ArrayList<>(); |
| | | if(keySet.size() > 0){ |
| | | list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getFullNumber, keySet)); |
| | | } |
| | | for (TChargingGun chargingGun : list) { |
| | | Long time = (Long) charging_gun_online.get(chargingGun.getFullNumber()); |
| | | if(null != time && System.currentTimeMillis() - time > 60000){ |
| | | TChargingPile chargingPile1 = new TChargingPile(); |
| | | chargingPile1.setId(chargingPile.getId()); |
| | | chargingPile1.setStatus(2); |
| | | this.updateById(chargingPile1); |
| | | List<TChargingGun> list1 = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId())); |
| | | for (TChargingGun chargingGun : list1) { |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(1); |
| | | chargingGunService.updateById(chargingGun1); |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(1); |
| | | chargingGunService.updateById(chargingGun1); |
| | | |
| | | //桩处于正常,桩所属的枪都处于非正常,修改桩状态为异常 |
| | | TChargingPile chargingPile = this.getById(chargingGun.getChargingPileId()); |
| | | List<TChargingGun> list1 = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0)); |
| | | int size = list1.stream().filter(s -> s.getStatus() == 1 || s.getStatus() == 7).collect(Collectors.toList()).size(); |
| | | if(chargingPile.getStatus() == 1 && list1.size() == size){ |
| | | TChargingPile chargingPile1 = new TChargingPile(); |
| | | chargingPile1.setId(chargingGun.getChargingPileId()); |
| | | chargingPile1.setStatus(2); |
| | | this.updateById(chargingPile1); |
| | | } |
| | | |
| | | //添加记录 |
| | | TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) |
| | | .eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); |
| | | TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingGun.getChargingPileId()) |
| | | .eq(TFaultMessage::getChargingGunId, chargingGun.getId()).eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); |
| | | if(null == faultMessage){ |
| | | faultMessage = new TFaultMessage(); |
| | | faultMessage.setSiteId(chargingPile.getSiteId()); |
| | | faultMessage.setChargingPileId(chargingPile.getId()); |
| | | faultMessage.setSiteId(chargingGun.getSiteId()); |
| | | faultMessage.setChargingPileId(chargingGun.getChargingPileId()); |
| | | faultMessage.setChargingGunId(chargingGun.getId()); |
| | | faultMessage.setStatus(1); |
| | | faultMessage.setDownTime(LocalDateTime.now()); |
| | | faultMessage.setCreateTime(LocalDateTime.now()); |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TFaultMessageMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Override |
| | | public void add(TFaultMessage dto) { |
| | |
| | | */ |
| | | @Override |
| | | public List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, Integer siteId) { |
| | | return this.baseMapper.getFaultMessageList(pageInfo, siteId); |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | return this.baseMapper.getFaultMessageList(pageInfo, siteIds); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TRepairMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TRepairService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取报修记录列表 |
| | | * @param name |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId) { |
| | | return this.baseMapper.getRepairList(pageInfo, name, siteId); |
| | | public List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, Integer siteId) { |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | return this.baseMapper.getRepairList(pageInfo, name, siteIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | </if> |
| | | AND site_id IS NULL |
| | | AND (parent_id IS NULL OR audit_status = 1 OR audit_status = 2) |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | |
| | | select |
| | | a.id, |
| | | a.status, |
| | | CONCAT(b.number, a.name) as name, |
| | | CONCAT(b.name, a.name) as name, |
| | | a.parking_number as parkingNumber |
| | | from t_charging_gun a |
| | | left join t_charging_pile b on (a.charging_pile_id = b.id) |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, site_id, charging_pile_id, content, create_time, del_flag |
| | | </sql> |
| | | <insert id="saveData"> |
| | | insert into t_charging_pile_notification( |
| | | <if test="siteId != null and siteId != 0">site_id,</if> |
| | | <if test="chargingPileId != null and chargingPileId != 0">charging_pile_id,</if> |
| | | <if test="phone != null and phone != ''">phone,</if> |
| | | <if test="content != null and content != ''">content,</if> |
| | | create_time |
| | | )values( |
| | | <if test="siteId != null and siteId != 0">#{siteId},</if> |
| | | <if test="chargingPileId != null and chargingPileId != 0">#{chargingPileId},</if> |
| | | <if test="phone != null and phone != ''">#{phone},</if> |
| | | <if test="content != null and content != ''">#{content},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="chargingPileNotificationPageList" resultType="com.ruoyi.chargingPile.api.model.TChargingPileNotification"> |
| | | select |
| | | a.id, |
| | |
| | | left join t_charging_pile b on (a.charging_pile_id = b.id) |
| | | left join t_site c on (a.site_id = c.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != siteId"> |
| | | and a.site_id = #{siteId} |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | |
| | | <if test="null != name and '' != name"> |
| | | and a.repairman like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != siteId"> |
| | | and a.site_id = #{siteId} |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import com.alibaba.nacos.common.utils.MD5Utils; |
| | | import com.ruoyi.common.core.utils.MD5Util; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.tomcat.util.security.MD5Encoder; |
| | | |
| | | import java.nio.charset.Charset; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | this.setSign(encoder); |
| | | return this; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | return success; |
| | | } |
| | | |
| | | |
| | | // public static void main(String[] args) { |
| | | // SwitchwayGateService switchwayGateService = new SwitchwayGateService(); |
| | | // SwitchwayGateReq req = new SwitchwayGateReq(); |
| | | // req.setAction("close"); |
| | | // req.setChannel("001"); |
| | | // Boolean success = switchwayGateService.gateService(req); |
| | | // if(success){ |
| | | // log.info("调用成功"); |
| | | // }else{ |
| | | // log.info("调用失败"); |
| | | // } |
| | | // } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 批量查询 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getOrderInfoByCodes") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@RequestParam("orderId") String orderId){ |
| | | @GetMapping(value = "/getOrderInfoByCodes/{ids}") |
| | | public R<List<UploadRealTimeMonitoringData>> getOrderInfoByCodes(@PathVariable("ids") String ids){ |
| | | List<UploadRealTimeMonitoringData> res = new ArrayList<>(); |
| | | for (String s : orderId.split(",")) { |
| | | for (String s : ids.split(",")) { |
| | | List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(s); |
| | | if(dataByOrderCode.size() > 0){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = dataByOrderCode.get(0); |
| | |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { |
| | |
| | | UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); |
| | | |
| | | void delete(String id); |
| | | |
| | | void updateById(String id); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | |
| | | // query.addCriteria(Criteria.where("transaction_serial_number").in(values)); |
| | | // } |
| | | if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(), "i")); // "i" 表示不区分大小写 |
| | | query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(),"i")); // "i" 表示不区分大小写 |
| | | } |
| | | if (mongoChargingOrderQuery.getOrderType() !=null){ |
| | | query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); |
| | |
| | | query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getStartTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getStartTime().split(" - "); |
| | | if (mongoChargingOrderQuery.getCreateTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getCreateTime().split(" - "); |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("startTime").gte(start).lt(end)); |
| | | query.addCriteria(Criteria.where("create_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getEndTime() != null && mongoChargingOrderQuery.getEndTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getEndTime().split(" - "); |
| | | if (mongoChargingOrderQuery.getLastTime() != null && mongoChargingOrderQuery.getLastTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getLastTime().split(" - "); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("lastTime").gte(start).lt(end)); |
| | | query.addCriteria(Criteria.where("last_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); |
| | | // 设置分页 |
| | | Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageCurr(), mongoChargingOrderQuery.getPageSize()); |
| | | |
| | | // 创建带有排序的 Pageable 对象 |
| | | Pageable pageable = PageRequest.of( |
| | | mongoChargingOrderQuery.getPageCurr()-1, |
| | | mongoChargingOrderQuery.getPageSize(), |
| | | Sort.by(Sort.Direction.DESC, "create_time") |
| | | ); |
| | | |
| | | // 设置分页和排序 |
| | | query.with(pageable); |
| | | query.with(Sort.by(Sort.Direction.DESC,"create_time")); |
| | | |
| | | // 执行查询并获取 Page 对象 |
| | | List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); |
| | | |
| | | // 设置分页 |
| | | // Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); |
| | | // query.with(pageable); |
| | | // query.with(Sort.by(Sort.Direction.DESC,"create_time")); |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query |
| | | , UploadRealTimeMonitoringData.class); |
| | | |
| | | UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); |
| | | uploadRealTimeMonitoringPageData.setCount(totalElements); |
| | | uploadRealTimeMonitoringPageData.setRecords(uploadRealTimeMonitoringData); |
| | | uploadRealTimeMonitoringPageData.setRecords(page); |
| | | return uploadRealTimeMonitoringPageData; |
| | | } |
| | | |
| | |
| | | mongoTemplate.remove(byId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(String id) { |
| | | // 创建查询条件 |
| | | Query query = new Query(Criteria.where("_id").is(id)); |
| | | // 创建更新对象 |
| | | Update update = new Update().set("last_time", new Date()); |
| | | // 执行更新操作 |
| | | mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | } |
| | |
| | | BeanUtils.copyProperties(pingMessage,ping); |
| | | pingService.create(ping); |
| | | |
| | | chargingPileClient.updateChargingPileStatus(pingMessage.getCharging_pile_code(), pingMessage.getCharging_gun_status()); |
| | | chargingPileClient.updateChargingPileStatus(pingMessage.getCharging_pile_code(), pingMessage.getCharging_gun_code(), pingMessage.getCharging_gun_status()); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | | EndChargeMessage endChargeMessage = message.getEndChargeMessage(); |
| | |
| | | uploadRealTimeMonitoringData.setElectrovalence_all(accountingStrategyDetail.getElectrovalence()); |
| | | uploadRealTimeMonitoringData.setService_charge(accountingStrategyDetail.getServiceCharge()); |
| | | if (Objects.nonNull(data)) { |
| | | data.setLast_time(new Date()); |
| | | uploadRealTimeMonitoringDataService.updateById(data.getId()); |
| | | uploadRealTimeMonitoringData.setPeriod_electric_price(uploadRealTimeMonitoringDataMessage.getPaid_amount().subtract(data.getPaid_amount())); |
| | | uploadRealTimeMonitoringData.setPeriod_charging_degree(uploadRealTimeMonitoringDataMessage.getCharging_degree().subtract(data.getCharging_degree())); |
| | | uploadRealTimeMonitoringData.setPeriod_service_price(uploadRealTimeMonitoringDataMessage.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); |
| | |
| | | // 添加实时上传记录结束记录 |
| | | // 查询mogondb上一条数据 |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(transactionRecordMessage.getTransaction_serial_number()); |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(data,uploadRealTimeMonitoringData); |
| | | uploadRealTimeMonitoringData.setStatus(5); |
| | | uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | if(Objects.nonNull(data) && data.getStatus() != 5){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(data,uploadRealTimeMonitoringData); |
| | | uploadRealTimeMonitoringData.setStatus(5); |
| | | uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | } |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | | UpdateBalanceReplyMessage updateBalanceReplyMessage = message.getUpdateBalanceReplyMessage(); |
| | |
| | | payOrderInfoDto.setPayAmount(byId.getPaymentAmount()); |
| | | payOrderInfoDto.setPayTime(byId.getCreateTime()); |
| | | payOrderInfoDto.setRefundAmount(byId.getRefundAmount()); |
| | | payOrderInfoDto.setRechargeAmount(byId.getRechargeAmount()); |
| | | return R.ok(payOrderInfoDto); |
| | | case 2: |
| | | TShoppingOrder byId1 = shoppingOrderService.getById(orderId); |
| | |
| | | payOrderInfoDto1.setPayAmount(byId1.getPaymentAmount()); |
| | | payOrderInfoDto1.setPayTime(byId1.getCreateTime()); |
| | | payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount()); |
| | | payOrderInfoDto1.setRechargeAmount(byId1.getPaymentAmount()); |
| | | return R.ok(payOrderInfoDto1); |
| | | case 3: |
| | | TVipOrder byId2 = vipOrderService.getById(orderId); |
| | |
| | | payOrderInfoDto2.setPayAmount(byId2.getPaymentAmount()); |
| | | payOrderInfoDto2.setPayTime(byId2.getCreateTime()); |
| | | payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount()); |
| | | payOrderInfoDto2.setRechargeAmount(byId2.getPaymentAmount()); |
| | | return R.ok(payOrderInfoDto2); |
| | | //todo luo 停车场订单 |
| | | // case 4: |
| | |
| | | String format = tChargingOrderAccountingStrategy.getCreateTime().format(formatter); |
| | | tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime()); |
| | | tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime()); |
| | | if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setVipDiscount(multiply); |
| | | } |
| | | bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | |
| | | if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setCouponDiscount(multiply); |
| | | } |
| | | } |
| | | chargingOrderInfoVO.setList(list); |
| | | return AjaxResult.success(chargingOrderInfoVO); |
| | |
| | | @PostMapping(value = "/chargingOrderWXCallback") |
| | | public void chargingOrderWXCallback(@RequestParam("out_trade_no") String out_trade_no, @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach) { |
| | | AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach); |
| | | chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach); |
| | | } |
| | | |
| | | |
| | |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | Map<String,Object> map = chargingOrderService.countAll(sixBefore); |
| | | BigDecimal data = parkingLotClient.getRecordAmount(sixBefore).getData(); |
| | | if (map ==null){ |
| | | map = new HashMap<String,Object>(); |
| | | } |
| | | map.put("parkingAmount",data); |
| | | BigDecimal data1 = shoppingOrderService.getSumAmount(sixBefore); |
| | | map.put("shopAmount",data1); |
| | |
| | | public R watchChargingOrder(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | |
| | | mongoChargingOrderQuery.setPageSize(10); |
| | | UploadRealTimeMonitoringPageData data1 = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery).getData(); |
| | | R<UploadRealTimeMonitoringPageData> all = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery); |
| | | UploadRealTimeMonitoringPageData data1 = all.getData(); |
| | | |
| | | List<ChargingOrderAndUploadRealTimeMonitoringDataDto> dtos = new ArrayList<>(); |
| | | Map<String,ChargingOrderVO> map = new HashMap<>(); |
| | |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | end = statisticsQueryDto.getEndTime().plusDays(1); |
| | | // 获取本月1号的日期 |
| | | YearMonth yearMonth = YearMonth.from(today); |
| | | // start = yearMonth.atDay(1); |
| | | // |
| | | // System.out.println("本月1号是: " + start); |
| | | }else if (statisticsQueryDto.getDayType()==4){ |
| | | LocalDate today = LocalDate.now(); |
| | | // 获取当前年份 |
| | | int currentYear = today.getYear(); |
| | | |
| | | // 获取今年1月1日的日期 |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | |
| | | // 获取今年1月1日的日期 |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | if (start.equals(end)){ |
| | | end = end.plusDays(1); |
| | | } |
| | | } |
| | | |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getCreateTime, start).le(TChargingOrder::getCreateTime, end).in(TChargingOrder::getSiteId, siteIds).list(); |
| | | List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | chargingOrderIds.add(-1L); |
| | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | |
| | | tCharingUserMapVO.setMap(charMap); |
| | | tCharingUserMapVO.setMap1(charMap1); |
| | | }else { |
| | | |
| | | |
| | | List<Map<String,Object>> map = chargingOrderService.usersByQuery(statisticsQueryDto); |
| | | |
| | | |
| | |
| | | |
| | | //车辆用途 |
| | | List<Map<String, Object>> carMap = chargingOrderService.carUserMethod(); |
| | | |
| | | //车辆品牌 |
| | | List<Map<String, Object>> carBrandMap = chargingOrderService.carUserBrand(); |
| | | List<String> brands = new ArrayList<>(); |
| | | for (Map<String, Object> objectMap : carBrandMap) { |
| | | brands.add(objectMap.get("vehicle_brand").toString()); |
| | | } |
| | | |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand","其他"); |
| | | others.put("counts",count); |
| | | carBrandMap.add(others); |
| | | //本地车数量 |
| | | Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); |
| | | |
| | |
| | | @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"}) |
| | | public R<TCharingUserEquimentVO> equipment(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | if (statisticsQueryDto.getSiteId()==null||statisticsQueryDto.getSiteId()==0) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TChargingOrder> list = chargingOrderService.list(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getAppUserId, userId) |
| | | .eq(TChargingOrder::getStatus, 3)); |
| | | .in(TChargingOrder::getStatus, Arrays.asList(1,2,3,4))); |
| | | List<Integer> gunIds = list.stream().map(TChargingOrder::getChargingGunId).collect(Collectors.toList()); |
| | | return R.ok(gunIds); |
| | | } |
| | |
| | | EndOfChargePageInfo endOfChargePageInfo = chargingOrderService.getEndOfChargePageInfo(id); |
| | | return AjaxResult.success(endOfChargePageInfo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单数据 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | @PostMapping("/getChargingOrder") |
| | | public R<List<TChargingOrder>> getChargingOrder(@RequestBody TChargingOrderVo order){ |
| | | List<TChargingOrder> chargingOrder = chargingOrderService.getChargingOrder(order); |
| | | return R.ok(chargingOrder); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | |
| | | byId.setReceivingName(data.getName()+"-"+data.getPhone()); |
| | | byId.setReceivingAddress(data.getAddress()); |
| | | } |
| | | } |
| | | switch (byId.getOrderType()){ |
| | | case 1: |
| | | TGoods data = goodsClient.getGoodsById(byId.getGoodsId()).getData(); |
| | | if (data!=null){ |
| | | byId.setName(data.getName()); |
| | | } |
| | | break; |
| | | case 2: |
| | | TCoupon data1 = couponClient.getCouponById1(byId.getCouponId()).getData(); |
| | | if (data1!=null){ |
| | | byId.setName(data1.getName()); |
| | | } |
| | | break; |
| | | } |
| | | return AjaxResult.success(byId); |
| | | } |
| | |
| | | } |
| | | return R.ok(res); |
| | | } |
| | | |
| | | @GetMapping("/getCount") |
| | | public R<Integer> getCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType){ |
| | | if (buyType==1){ |
| | | //现金 |
| | | if (goodeType==1){ |
| | | //商品 |
| | | Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type",1) |
| | | .eq("goods_id", goodId) |
| | | .isNull("refund_status")) |
| | | .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | return R.ok(reduce); |
| | | }else { |
| | | //优惠券 |
| | | Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type",2) |
| | | .eq("coupon_id", goodId) |
| | | .isNull("refund_status")) |
| | | .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | return R.ok(reduce); |
| | | } |
| | | |
| | | }else { |
| | | //兑换 |
| | | if (goodeType==1){ |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1) |
| | | .ne("status",4).eq("goods_id", goodId)) |
| | | .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | return R.ok(reduce); |
| | | }else { |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",2) |
| | | .ne("status",4).eq("coupon_id", goodId)) |
| | | .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | return R.ok(reduce); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon订单ids查询优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | |
| | | .like(manageOrderAppealQuery.getPhone() != null, TOrderAppeal::getPhone, manageOrderAppealQuery.getPhone()) |
| | | .eq(manageOrderAppealQuery.getOrderType() != null, TOrderAppeal::getOrderType, manageOrderAppealQuery.getOrderType()) |
| | | .in(TOrderAppeal::getOrderType, 1, 2) |
| | | .orderByDesc(TOrderAppeal::getFeedbackTime) |
| | | .orderByDesc(TOrderAppeal::getCreateTime) |
| | | .page(Page.of(manageOrderAppealQuery.getPageCurr(), manageOrderAppealQuery.getPageSize())); |
| | | |
| | | for (TOrderAppeal record : page.getRecords()) { |
| | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") |
| | | @GetMapping(value = "/getTagCount") |
| | | public AjaxResult<List<TEvaluationTagVO>> getTagCount() { |
| | | return AjaxResult.ok(orderEvaluateService.getTagCount()); |
| | | public AjaxResult<List<TEvaluationTagVO>> getTagCount(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { |
| | | return AjaxResult.ok(orderEvaluateService.getTagCount(siteId)); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价分页列表查询") |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 19:07 |
| | |
| | | private LocalDateTime payTime; |
| | | @ApiModelProperty("退款金额") |
| | | private BigDecimal refundAmount; |
| | | private BigDecimal rechargeAmount; |
| | | |
| | | |
| | | } |
| | |
| | | List<Map<String, Object>> needElec1(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | Long countNoTag(); |
| | | |
| | | Long countCar(@Param("brands") List<String> brands); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<GetOrderEvaluatePageListDTO> getPageList(@Param("query") GetOrderEvaluatePageList pageList, @Param("evaluationTagIds") List<Integer> evaluationTagIds, |
| | | PageInfo<GetOrderEvaluatePageListDTO> pageInfo); |
| | | @Param("siteIds") List<Integer> siteIds, PageInfo<GetOrderEvaluatePageListDTO> pageInfo); |
| | | |
| | | /** |
| | | * 查询站点下的所有订单评价 |
| | |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | |
| | | EndOfChargePageInfo getEndOfChargePageInfo(String id); |
| | | |
| | | Long countNoTag(); |
| | | |
| | | |
| | | /** |
| | | * 获取订单数据 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> getChargingOrder(TChargingOrderVo order); |
| | | |
| | | Long countCar(List<String> brands); |
| | | } |
| | |
| | | * 获取评价标签 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getTagCount(); |
| | | List<TEvaluationTagVO> getTagCount(Integer siteId); |
| | | |
| | | /** |
| | | * 充电订单评价分页列表查询 |
| | |
| | | chargingBillVO.setOrderCount(list1.size()); |
| | | BigDecimal paymentAmountTotal = new BigDecimal("0"); |
| | | BigDecimal orderAmountTotal = new BigDecimal("0"); |
| | | BigDecimal refundAmountTotal = new BigDecimal("0"); |
| | | BigDecimal electrovalenceTotal = new BigDecimal("0"); |
| | | BigDecimal serviceChargeTotal = new BigDecimal("0"); |
| | | BigDecimal commissionAmountTotal = new BigDecimal("0"); |
| | |
| | | }else if (tChargingOrder.getPaymentAmount()!=null){ |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); |
| | | } |
| | | |
| | | // 累加订单金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | orderAmountTotal = orderAmountTotal.add(tChargingOrder.getOrderAmount()); |
| | |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | | electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus()!=null&& tChargingOrder.getRefundStatus()==2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()) |
| | | .eq(TChargingOrderRefund::getRefundStatus, 2).list(); |
| | | for (TChargingOrderRefund tChargingOrderRefund : list2) { |
| | | refundAmountTotal =refundAmountTotal.add(tChargingOrder.getRefundAmount()); |
| | | } |
| | | // 累加累计服务费 |
| | | if (tChargingOrder.getServiceCharge()!=null){ |
| | |
| | | chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); |
| | | chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); |
| | | chargingBillVO.setDiscount(discountTotal); |
| | | |
| | | chargingBillVO.setRefundAmount(refundAmountTotal); |
| | | |
| | | pageInfo.setRecords(list); |
| | | chargingBillVO.setList(pageInfo); |
| | |
| | | myChargingOrderInfo.setChargeMode(chargingGun.getChargeMode()); |
| | | String name = chargingGunClient.getAllName(chargingOrder.getChargingGunId()).getData(); |
| | | myChargingOrderInfo.setName(name); |
| | | if(null != chargingOrder.getAppUserCarId()){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(chargingOrder.getAppUserCarId())).getData().get(0); |
| | | myChargingOrderInfo.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | }else{ |
| | | myChargingOrderInfo.setLicensePlate("无"); |
| | | if(Objects.nonNull(chargingOrder.getAppUserCarId())){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarById(chargingOrder.getAppUserCarId().toString()).getData(); |
| | | if(null != tAppUserCar){ |
| | | myChargingOrderInfo.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | }else{ |
| | | myChargingOrderInfo.setLicensePlate("无"); |
| | | } |
| | | } |
| | | myChargingOrderInfo.setStartTime(chargingOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); |
| | | myChargingOrderInfo.setEndTime(chargingOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); |
| | |
| | | TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId()) |
| | | .in(TChargingOrder::getStatus, Arrays.asList(1, 2, 3)).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null != one){ |
| | | return AjaxResult.error("充电枪正在充电桩中,启动失败"); |
| | | return AjaxResult.error("充电枪正在充电中,启动失败"); |
| | | } |
| | | //查询当前充电枪是否有正在支付的订单 |
| | | one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId()) |
| | |
| | | chargingOrder.setVipDiscountAmount(BigDecimal.ZERO); |
| | | chargingOrder.setOrderSource(0); |
| | | chargingOrder.setTitle("【充电桩充电】" + chargingPile.getNumber() + "号桩/" + tChargingGun.getCode() + "号枪"); |
| | | chargingOrder.setStatus(1); |
| | | |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(tChargingGun.getSiteId())).getData().get(0); |
| | | Integer accountingStrategyId = tChargingGun.getAccountingStrategyId(); |
| | |
| | | String code = chargingOrder.getCode(); |
| | | String key = "AQJC_" + chargingOrder.getChargingGunId(); |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); |
| | | if(null == data || data.size() == 0){ |
| | | return false; |
| | | } |
| | | log.error(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); |
| | | if(data.size() != 0){ |
| | | PlatformStartChargingReply platformStartChargingReply = data.get(1); |
| | |
| | | counter = (null == counter ? 0 : counter) + 1; |
| | | boot_failed_map.put(code, counter); |
| | | //启动失败 |
| | | preChargeCheck1.setStartupSuccess(3); |
| | | preChargeCheck1.setStartupSuccess(1); |
| | | preChargeCheck1.setFailureCause(0); |
| | | redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); |
| | | return false; |
| | |
| | | chargingOrder.setId(Long.valueOf(id)); |
| | | chargingOrder.setAppUserId(order.getAppUserId()); |
| | | chargingOrder.setEndTime(LocalDateTime.now()); |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | |
| | | String code1 = chargingOrder.getCode(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | String code1 = order.getCode(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); |
| | | //异步线程处理停机 |
| | | ExecutorService cachedThreadPool = Executors.newFixedThreadPool(1); |
| | | cachedThreadPool.execute(()->{ |
| | | //调用硬件停止充电,停止成功后开始计算费用退款 |
| | | TChargingPile chargingPile = chargingPileClient.getChargingPileById(chargingOrder.getChargingPileId()).getData(); |
| | | TChargingPile chargingPile = chargingPileClient.getChargingPileById(order.getChargingPileId()).getData(); |
| | | PlatformStopCharging platformStopCharging = new PlatformStopCharging(); |
| | | platformStopCharging.setCharging_pile_code(chargingPile.getCode()); |
| | | platformStopCharging.setCharging_gun_code(chargingGun.getCode()); |
| | |
| | | inviteUser.setAward(num1); |
| | | inviteUserClient.updateInviteUser(inviteUser); |
| | | } |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser1.getId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | appUserIntegralChange.setExtension(chargingOrder.getId().toString()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | |
| | | appUser1.setPoints(appUser1.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser1); |
| | | if(num1 > 0){ |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser1.getId()); |
| | | appUserIntegralChange.setChangeType(4); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | appUserIntegralChange.setExtension(chargingOrder.getId().toString()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | |
| | | appUser1.setPoints(appUser1.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser1); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | public void endChargeBillingCharge(TransactionRecordMessageVO vo) { |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number())); |
| | | Integer status = chargingOrder.getStatus(); |
| | | if(status == 4 || status == 5){ |
| | | if(status == 5){ |
| | | return; |
| | | } |
| | | |
| | |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | System.err.println(start.getTime() + "\n" + end.getTime() + "\n" + lists.get(0).getStart() + "\n" + lists.get(0).getEnd()); |
| | | |
| | | |
| | | |
| | | for (AccountingStrategyDetailOrderVo strategyDetail : lists) { |
| | | BigDecimal sharp_peak_charge = strategyDetail.getChargingCapacity(); |
| | | TChargingOrderAccountingStrategy chargingOrderAccountingStrategy = new TChargingOrderAccountingStrategy(); |
| | |
| | | } |
| | | } |
| | | |
| | | order.setServiceCharge(periodServicePrice_total); |
| | | order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setPaymentAmount(payAmount); |
| | | order.setRefundAmount(refundAmount); |
| | | order.setRefundStatus(1); |
| | |
| | | } |
| | | } |
| | | |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | appUserIntegralChange.setAppUserId(appUser.getId()); |
| | | appUserIntegralChange.setChangeType(2); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser.getPoints()); |
| | | appUser.setPoints(appUser.getPoints() + integral); |
| | | appUserIntegralChange.setCurrentIntegral(appUser.getPoints()); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | appUserIntegralChange.setExtension(chargingOrder.getId().toString()); |
| | | appUserClient.updateAppUser(appUser); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | if(integral > 0){ |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | appUserIntegralChange.setAppUserId(appUser.getId()); |
| | | appUserIntegralChange.setChangeType(2); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser.getPoints()); |
| | | appUser.setPoints(appUser.getPoints() + integral); |
| | | appUserIntegralChange.setCurrentIntegral(appUser.getPoints()); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | appUserIntegralChange.setExtension(chargingOrder.getId().toString()); |
| | | appUserClient.updateAppUser(appUser); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | } |
| | | } |
| | | |
| | | //计算用户标签 |
| | |
| | | chargingOrderRefund.setRefundTitle("充电完成退款"); |
| | | chargingOrderRefund.setRefundContent("充电完成退款"); |
| | | chargingOrderRefund.setRefundReason("充电完成退款"); |
| | | chargingOrderRefund.setRefundRemark("实际充电消费金额:" + refundAmount); |
| | | chargingOrderRefund.setRefundRemark("实际充电消费金额:" + chargingOrder.getPaymentAmount()); |
| | | chargingOrderRefund.setRefundTotalAmount(refundAmount); |
| | | chargingOrderRefund.setPayAmount(rechargeAmount); |
| | | if(1 == rechargePaymentType){ |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | if ((tChargingOrder.getRechargeAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ |
| | | tChargingOrder.setStatus(5); |
| | | } |
| | | |
| | | |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | if ((tChargingOrder.getPaymentAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ |
| | | tChargingOrder.setStatus(5); |
| | | } |
| | | |
| | | TShoppingOrderRefund chargingOrderRefund = new TShoppingOrderRefund(); |
| | | chargingOrderRefund.setShoppingOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | |
| | | if (payOrderQueryDto.getRefundAmount().compareTo(tChargingOrder.getPaymentAmount())==0){ |
| | | tChargingOrder.setStatus(5); |
| | | } |
| | | |
| | | shoppingOrderService.updateById(tChargingOrder); |
| | | |
| | | shoppingOrderRefundService.save(chargingOrderRefund); |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | |
| | | |
| | | TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); |
| | | chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | |
| | | } |
| | | TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, appUserCar.getId()) |
| | | .eq(TChargingOrder::getDelFlag, 0).gt(TChargingOrder::getStartTime, query.getStartTime()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, -1)); |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, 5)); |
| | | return one; |
| | | } |
| | | |
| | |
| | | tSettlementConfirm.setRemark(dto.getRemark()); |
| | | tSettlementConfirm.setServicePartner(dto.getServicePartner()); |
| | | tSettlementConfirm.setServiceMoney(dto.getServiceMoney()); |
| | | BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner()); |
| | | BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner().multiply(new BigDecimal("0.01"))); |
| | | // 总电损费用 |
| | | BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, RoundingMode.HALF_DOWN); |
| | | // 平台承担电损 |
| | |
| | | } |
| | | // 充电总时长 |
| | | |
| | | Long temp = 0L; |
| | | Long temp = 1L; |
| | | if (StringUtils.hasLength(stringBuilder.toString())){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getOrderInfoByCodes(stringBuilder.substring(0,stringBuilder.length()-1)).getData(); |
| | | temp+=(data6.stream().mapToLong(UploadRealTimeMonitoringData::getCumulative_charging_time).sum()*60); |
| | | String substring = stringBuilder.substring(0, stringBuilder.length() - 1); |
| | | for (String s : substring.split(",")) { |
| | | UploadRealTimeMonitoringData data6 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(s).getData(); |
| | | if (data6!=null){ |
| | | temp+=(data6.getCumulative_charging_time()*60); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | List<TChargingPile> data = siteClient.getPileListBySiteId(tSettlementConfirm.getSiteId()).getData(); |
| | | // 计算充电桩的功率平均值 |
| | |
| | | if (tSettlementConfirm.getSiteId().equals(settlementConfirm.getSiteId())){ |
| | | // 电站相同比较收入涨幅跌幅 |
| | | if (tSettlementConfirm.getIncome().compareTo(BigDecimal.ZERO)>0){ |
| | | BigDecimal subtract = tSettlementConfirm.getIncome().subtract(settlementConfirm.getIncome()).divide(tSettlementConfirm.getIncome()).setScale(2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | BigDecimal subtract = tSettlementConfirm.getIncome().subtract(settlementConfirm.getIncome()).divide(tSettlementConfirm.getIncome(),2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | }else { |
| | | tSettlementConfirm.setIncomePercentage("100"+"%"); |
| | |
| | | public Long countNoTag() { |
| | | return this.baseMapper.countNoTag(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<TChargingOrder> getChargingOrder(TChargingOrderVo order) { |
| | | LambdaQueryWrapper<TChargingOrder> queryWrapper = new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getDelFlag, 0); |
| | | if(null != order.getChargingPileId()){ |
| | | queryWrapper.eq(TChargingOrder::getChargingPileId, order.getChargingPileId()); |
| | | } |
| | | if(null != order.getChargingGunId()){ |
| | | queryWrapper.eq(TChargingOrder::getChargingGunId, order.getChargingGunId()); |
| | | } |
| | | if(null != order.getStatus()){ |
| | | queryWrapper.eq(TChargingOrder::getStatus, order.getStatus()); |
| | | } |
| | | if(null != order.getAppUserId()){ |
| | | queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId()); |
| | | } |
| | | if(null != order.getAppUserId()){ |
| | | queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId()); |
| | | } |
| | | if(null != order.getStatusList()){ |
| | | queryWrapper.in(TChargingOrder::getAppUserId, order.getStatusList()); |
| | | } |
| | | if(null != order.getEndMode()){ |
| | | queryWrapper.eq(TChargingOrder::getEndMode, order.getEndMode()); |
| | | } |
| | | return this.list(queryWrapper.orderByDesc(TChargingOrder::getCreateTime)); |
| | | } |
| | | |
| | | @Override |
| | | public Long countCar(List<String> brands) { |
| | | return this.baseMapper.countCar(brands); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.TEvaluationTagClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private PartnerClient partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @Resource |
| | | private TOrderEvaluateMapper orderEvaluateMapper; |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagCount() { |
| | | public List<TEvaluationTagVO> getTagCount(Integer siteId) { |
| | | // 查询标签列表 |
| | | R<List<TEvaluationTagVO>> r = evaluationTagClient.getList(); |
| | | List<TEvaluationTagVO> tagList = r.getData(); |
| | | // 查询站点下的所有订单 |
| | | List<TChargingOrder> tChargingOrders = chargingOrderMapper.selectList(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getSiteId, siteId)); |
| | | if(CollectionUtils.isEmpty(tChargingOrders)){ |
| | | tagList.forEach(e->e.setTagCount(0)); |
| | | packageTagCount(0L,"有图",2,tagList); |
| | | packageTagCount(0L,"好评",3,tagList); |
| | | packageTagCount(0L,"中差评",4,tagList); |
| | | return tagList; |
| | | } |
| | | List<Integer> tagIds = tagList.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | // 统计标签使用数量 |
| | | List<TEvaluationTagVO> counts = orderEvaluateTagMapper.getCountByTagIds(tagIds); |
| | |
| | | List<TEvaluationTagVO> data = evaluationTagClient.getTagList(pageList.getEvaluateType()).getData(); |
| | | evaluationTagIds = data.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | } |
| | | List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, pageInfo); |
| | | |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == pageList.getSiteId() || 0 == pageList.getSiteId()){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, "/data/site").getData(); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(pageList.getSiteId()); |
| | | } |
| | | |
| | | List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, siteIds, pageInfo); |
| | | for (GetOrderEvaluatePageListDTO dto : list) { |
| | | TAppUser appUser = appUserClient.getUserById(dto.getAppUserId()).getData(); |
| | | if(null != appUser){ |
| | |
| | | String phone = appUser.getPhone(); |
| | | dto.setPhone(phone.substring(0, 3) + "****" + phone.substring(6)); |
| | | } |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData().get(0); |
| | | dto.setSiteName(site.getName()); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData(); |
| | | if(null != data1 && data1.size() > 0){ |
| | | Site site = data1.get(0); |
| | | dto.setSiteName(site.getName()); |
| | | } |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, dto.getId())); |
| | | List<Integer> tagIds = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); |
| | | if(tagIds.size() > 0){ |
| | |
| | | BeanUtils.copyProperties(orderEvaluate, orderEvaluateVo); |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, orderEvaluate.getId())); |
| | | List<Integer> tagId = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagId).getData(); |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | orderEvaluateVo.setTagName(collect); |
| | | if(tagId.size() > 0){ |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagId).getData(); |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | orderEvaluateVo.setTagName(collect); |
| | | } |
| | | return orderEvaluateVo; |
| | | } |
| | | return null; |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | List<Long> appUserIds = list.stream().map(TActivityStatisticslVO::getAppUserId).collect(Collectors.toList()); |
| | | List<TAppUser> appUsers = appUserClient.getUserByIds(appUserIds).getData(); |
| | | |
| | | for (TActivityStatisticslVO tActivityStatisticslVO : list) { |
| | | TAppUser appUser = appUsers.stream().filter(user -> user.getId().equals(tActivityStatisticslVO.getAppUserId())).findFirst().orElse(null); |
| | | if(Objects.nonNull(appUser)){ |
| | | tActivityStatisticslVO.setPhone(appUser.getPhone()); |
| | | } |
| | | // 判断享有了哪些类型 |
| | | switch (tActivityStatisticslVO.getOrderType()){ |
| | | case 1: |
| | |
| | | </if> |
| | | </select> |
| | | <select id="getNoInvoicedOrder" resultMap="BaseResultMap"> |
| | | select * from t_charging_order where del_flag = 0 and status = 5 and recharge_payment_status = 2 and payment_amount is not null and app_user_id = #{appUserId} and refund_status is null |
| | | select * from t_charging_order where del_flag = 0 and status = 5 and recharge_payment_status = 2 and payment_amount is not null and app_user_id = #{appUserId} |
| | | <if test="null != month and '' != month"> |
| | | and DATE_FORMAT(end_time, '%Y-%m') = #{month} |
| | | </if> |
| | |
| | | title, |
| | | `status`, |
| | | order_amount, |
| | | order_amount as payment_amount , |
| | | payment_amount as payment_amount , |
| | | create_time, |
| | | end_time, |
| | | pay_time, |
| | | refund_status, |
| | | (order_amount) as final_amount, |
| | | (recharge_amount-refund_amount) as final_amount, |
| | | del_flag, |
| | | app_user_id |
| | | FROM |
| | |
| | | |
| | | </select> |
| | | <select id="countAll" resultType="java.util.Map"> |
| | | select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.0006, 2) as commission_amount,sum(sharing_amount) as sharing_amount |
| | | select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.006, 2) as commission_amount,sum(sharing_amount) as sharing_amount |
| | | from t_charging_order |
| | | where create_time >= #{sixBefore} and del_flag = 0 and recharge_payment_status = 2 |
| | | </select> |
| | |
| | | <select id="getDateData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%H:00' ) as time, |
| | | CAST(SUM(service_charge-coupon_discount_amount) AS DECIMAL(20, 6)) as servicecharge, |
| | | CAST(SUM(service_charge) AS DECIMAL(20, 6)) as servicecharge, |
| | | CAST(SUM(charging_capacity) AS DECIMAL(20, 6)) as electrovalence, |
| | | CAST(SUM(electrovalence) AS DECIMAL(20, 4)) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getWeekData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getMonthData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getYearData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | <select id="getByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge-coupon_discount_amount) as servicecharge, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(charging_capacity) as electrovalence, |
| | | SUM(electrovalence) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | |
| | | SELECT |
| | | 'today' AS data_type, |
| | | '1' as type, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS time, |
| | | DATE_FORMAT( create_time, '%H:00' ) AS time, |
| | | count(DISTINCT app_user_id) AS counts |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | del_flag = 0 |
| | | AND recharge_payment_status = 2 |
| | | AND ISNULL( refund_status ) |
| | | AND DATE ( create_time ) = CURDATE() |
| | | GROUP BY |
| | | time |
| | |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType ==5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND create_time >= #{statisticsQueryDto.startTime} |
| | | AND DATE(create_time) >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND create_time <= #{statisticsQueryDto.endTime} |
| | | AND DATE(create_time) <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY |
| | |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | WHERE co.del_flag = 0 and |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type = 4 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | WHERE co.del_flag = 0 and |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type in (2,3) |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | </if> |
| | | |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | |
| | | ) and au.del_flag = 0 |
| | | |
| | | </select> |
| | | <select id="countCar" resultType="java.lang.Long"> |
| | | select count(1) |
| | | from |
| | | charging_pile_account.t_app_user_car |
| | | where del_flag = 0 and vehicle_brand not in |
| | | <foreach collection="brands" item="brand" open="(" separator="," close=")"> |
| | | #{brand} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, |
| | | create_time, response_time, del_flag |
| | | from t_order_evaluate |
| | | where order_id in |
| | | (select order_id |
| | | where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | and order_id in |
| | | (select id |
| | | from t_charging_order |
| | | where site_id = #{siteId} |
| | | and del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}) |
| | |
| | | <if test="null != query.siteId"> |
| | | and b.site_id = #{query.siteId} |
| | | </if> |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and b.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | <select id="goodTop" resultType="java.util.Map"> |
| | |
| | | </select> |
| | | <select id="getSumAmout" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(payment_amount) AS paymentAmount |
| | | SUM(payment_amount-refund_amount) AS paymentAmount |
| | | FROM |
| | | t_vip_order |
| | | WHERE |
| | |
| | | |
| | | @GetMapping("/getInfoByType") |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情") |
| | | public R getInfoByType(Integer goodType,Integer id) { |
| | | public R getInfoByType(Integer goodType,Integer id,Integer type) { |
| | | if (goodType==1){ |
| | | TGoods byId = goodsService.getById(id); |
| | | if (byId==null||byId.getStatus()==2){ |
| | |
| | | // for (int i = 0; i < list.size(); i++) { |
| | | // list.get(i).setSalesCount(data.get(i)); |
| | | // } |
| | | |
| | | Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(), 1, type).getData(); |
| | | byId.setSalesCount(data); |
| | | return R.ok(byId); |
| | | } |
| | | else { |
| | |
| | | if (byId==null||byId.getStatus()==2){ |
| | | return R.fail(2,"该商品已不存在"); |
| | | } |
| | | return R.ok(byId); |
| | | Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(),2, type).getData(); |
| | | byId.setSalesCount(data); |
| | | return R.ok(byId); |
| | | } |
| | | } |
| | | |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | String string = stringBuilder.toString(); |
| | | // 订单号加上商品类型 |
| | | String res = string+"-"+basePage.getType(); |
| | | |
| | | List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setSalesCount(data.get(i)); |
| | | for (TGoods tGoods : list) { |
| | | Integer data = orderClient.getSalesCountByGoodsIdgetCount(tGoods.getId(), tGoods.getGoodType(), basePage.getType()).getData(); |
| | | tGoods.setSalesCount(data); |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> |
| | | SELECT |
| | | id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture |
| | | id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture,underlying_sales as underlyingSales |
| | | FROM |
| | | t_goods |
| | | WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | | UNION ALL |
| | | SELECT |
| | | id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture |
| | | id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture,0 as underlyingSales |
| | | FROM |
| | | t_coupon |
| | | WHERE `status`= 1 and del_flag = 0 and ways_to_obtain != #{appGoodQuery.type} |