Merge remote-tracking branch 'origin/master'
| | |
| | | TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>() |
| | | .eq(TChargingPile::getCode, code).eq(TChargingPile::getDelFlag, 0)); |
| | | if(null != chargingPile){ |
| | | if(chargingPile.getStatus() == 1){ |
| | | //充电桩正常,返回异常,处理充电桩状态和添加故障记录 |
| | | if(chargingPile.getStatus() == 1 && 1 == status){ |
| | | TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) |
| | | .eq(TFaultMessage::getStatus, 2).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); |
| | | if(null == faultMessage){ |
| | |
| | | one.setEndTime(LocalDateTime.now()); |
| | | faultMessageService.updateById(one); |
| | | } |
| | | |
| | | chargingPile.setStatus(0 == status ? 1 : 3); |
| | | chargingPileService.updateById(chargingPile); |
| | | } |
| | | if(0 == status){ |
| | | redisService.getCacheMap("charging_pile_online").put(code, System.currentTimeMillis()); |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | | |
| | | @Resource |
| | | private IntegrationClient integrationClient; |
| | | |
| | | |
| | | |
| | |
| | | tChargingGun.setAccountingStrategyId(setAccountingStrategy.getAccountingStrategyId()); |
| | | } |
| | | chargingGunService.updateBatchById(list); |
| | | //下发硬件更新计费模板 |
| | | for (TChargingPile chargingPile : this.listByIds(id)) { |
| | | integrationClient.setupBillingModel1(chargingPile.getCode()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | if(datas.size() > 0){ |
| | | for (TChargingPile data : datas) { |
| | | if(data.getStatus() == 1){ |
| | | TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, data.getId()) |
| | | .eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); |
| | | if(null == faultMessage){ |
| | |
| | | faultMessage.setDelFlag(false); |
| | | faultMessage.setContent("设备离线"); |
| | | faultMessageService.save(faultMessage); |
| | | } |
| | | } |
| | | } |
| | | this.updateBatchById(datas); |
| | |
| | | </if> |
| | | AND status = 3 |
| | | </where> |
| | | group by create_time |
| | | ORDER BY create_time DESC |
| | | |
| | | </select> |
| | | <select id="parkingData" resultType="java.util.Map"> |
| | | SELECT |
| | |
| | | */ |
| | | @PostMapping("/getDataByOrderCode") |
| | | public R<ChargingHandshake> getDataByOrderCode(@RequestParam("code") String code){ |
| | | ChargingHandshake chargingHandshake = chargingHandshakeService.findById(code); |
| | | ChargingHandshake chargingHandshake = chargingHandshakeService.getDataByOrderCode(code); |
| | | return R.ok(chargingHandshake); |
| | | } |
| | | } |
| | |
| | | |
| | | public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { |
| | | |
| | | |
| | | ChargingHandshake getDataByOrderCode(String code); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.ChargingHandshakeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<ChargingHandshake> findAll() { |
| | | return mongoTemplate.findAll(ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake getDataByOrderCode(String code) { |
| | | List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); |
| | | return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; |
| | | } |
| | | } |
| | |
| | | chargingBillPayExport.setPlatformPay("支付宝小程序支付"); |
| | | |
| | | } |
| | | TChargingOrderRefund one = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).one(); |
| | | if (one!=null){ |
| | | chargingBillRefundExport.setRechargeSerialNumber(one.getSerailNumber()); |
| | | chargingBillRefundExport.setCode(one.getCode()); |
| | | chargingBillRefundExport.setPayTime(tChargingOrder.getPayTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime())):""); |
| | | List<TChargingOrderRefund> one1 = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); |
| | | for (TChargingOrderRefund one : one1) { |
| | | chargingBillRefundExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); |
| | | chargingBillRefundExport.setCode(tChargingOrder.getCode()); |
| | | chargingBillRefundExport.setPayTime(tChargingOrder.getCreateTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getCreateTime())):""); |
| | | if (tChargingOrder.getRefundTime()!=null){ |
| | | chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getRefundTime()))); |
| | | } |
| | |
| | | chargingBillRefundExport.setRefundSerialNumber(one.getRefundSerialNumber()); |
| | | chargingBillRefundExports.add(chargingBillRefundExport); |
| | | } |
| | | |
| | | // 支付信息 |
| | | chargingBillPayExport.setId(i+""); |
| | | chargingBillPayExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); |
| | |
| | | ChargingOrderAndUploadRealTimeMonitoringDataDto dataDto = new ChargingOrderAndUploadRealTimeMonitoringDataDto(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData,dataDto); |
| | | ChargingOrderQuery dto = new ChargingOrderQuery(); |
| | | dto.setCode(uploadRealTimeMonitoringData.getTransaction_serial_number()); |
| | | TCharingOrderVO vo = chargingOrderService.chargingOrder(dto); |
| | | if (!vo.getList().getRecords().isEmpty()) { |
| | | ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); |
| | |
| | | //查询各个分数 |
| | | List<Map<String,Object>> evaluate = chargingOrderService.getLevelEvaluate(siteIds); |
| | | //查询差评回复数 |
| | | Long count = orderEvaluateService.lambdaQuery().isNotNull(TOrderEvaluate::getResponseTime).count(); |
| | | List<Integer> mark = new ArrayList<>(); |
| | | mark.add(1); |
| | | mark.add(2); |
| | | Long count = orderEvaluateService.lambdaQuery().in(TOrderEvaluate::getMark, mark).isNotNull(TOrderEvaluate::getResponseTime).count(); |
| | | TCharingUserEvaluateVO tCharingUserEvaluateVO = new TCharingUserEvaluateVO(); |
| | | tCharingUserEvaluateVO.setAver(aver); |
| | | tCharingUserEvaluateVO.setEvaluate(evaluate); |
| | |
| | | chargingOrder.setRechargePaymentStatus(2); |
| | | chargingOrder.setRechargeSerialNumber(transaction_id); |
| | | chargingOrder.setStatus(2); |
| | | chargingOrder.setPayTime(LocalDateTime.now()); |
| | | |
| | | //添加安全检测数据到缓存中,每步安全检测完成后需要更新缓存数据 |
| | | PreChargeCheck preChargeCheck = new PreChargeCheck(); |
| | |
| | | if(times > m){ |
| | | //充电时间跨度两个计费策略,需要继续对下一个策略进行计算 |
| | | serviceCharge = s_server_amount.multiply(new BigDecimal(m)); |
| | | discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); |
| | | rechargeAmount1 = rechargeAmount1.subtract(s_total_amount.multiply(new BigDecimal(m))); |
| | | if(null != discount){ |
| | | discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); |
| | | } |
| | | nowTimeMillis = null; |
| | | }else{ |
| | | serviceCharge = s_server_amount.multiply(new BigDecimal(times)); |
| | | if(null != discount){ |
| | | discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | |
| | | one.setRefundStatus(2); |
| | | one.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefundService.updateById(one); |
| | | |
| | | TChargingOrder chargingOrder = this.getById(one.getChargingOrderId()); |
| | | chargingOrder.setPayTime(LocalDateTime.now()); |
| | | chargingOrder.setRefundStatus(2); |
| | | chargingOrder.setRefundSerialNumber(refund_id); |
| | | chargingOrder.setRefundTime(LocalDateTime.now()); |
| | | this.updateById(chargingOrder); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | Integer m = Integer.valueOf(data.getCumulative_charging_time() % 60); |
| | | chargingDetails.setChargedTime(String.format("%02d", h) + ":" + String.format("%02d", m)); |
| | | } |
| | | //转换成UTC时间 |
| | | ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData(); |
| | | if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){ |
| | | BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity(); |
| | |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); |
| | | if(success.isSuccess()){ |
| | | chargingOrder.setPayTime(LocalDateTime.now()); |
| | | this.updateById(chargingOrder); |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | |
| | | tSettlementConfirm.setIncomePercentage(0+"%"); |
| | | tSettlementConfirm.setIncomePercentage(0+"%"); |
| | | }else{ |
| | | BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome).setScale(2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome,2,RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | |
| | |
| | | title, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | order_amount as payment_amount , |
| | | create_time, |
| | | end_time, |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | (order_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(order_amount) * 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.0006, 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> |
| | |
| | | GROUP BY vehicle_use |
| | | </select> |
| | | <select id="carUserBrand" resultType="java.util.Map"> |
| | | |
| | | SELECT |
| | | count(1) as counts,vehicle_brand |
| | | from charging_pile_account.t_app_user_car |
| | | where del_flag = 0 |
| | | |
| | | GROUP BY vehicle_brand |
| | | ORDER BY counts DESC |
| | | limit 5 |
| | | </select> |
| | | <select id="countLocalCar" resultType="java.util.Map"> |
| | | SELECT |
| | |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | 864 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | 6048 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | 25920 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | |
| | | 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> |
| | | cp.type = 1 |
| | | cp.type = 1 and co.need_elec != 0 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | |
| | | and DATE(co.create_time) >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | |
| | | and DATE(co.create_time) <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | |
| | | <select id="sixBefore" resultType="com.ruoyi.order.dto.SixShopDto"> |
| | | SELECT |
| | | DATE_FORMAT( subquery.create_time, '%m' ) AS MONTH, |
| | | count(1) AS orderNum, |
| | | count(1) AS count, |
| | | SUM(payment_amount) AS paymentAmount |
| | | FROM |
| | | ( |
| | |
| | | SELECT |
| | | vip_id, |
| | | create_time, |
| | | payment_amount |
| | | (payment_amount - refund_amount) as payment_amount |
| | | FROM |
| | | t_vip_order |
| | | <where> |
| | |
| | | GROUP BY |
| | | DATE_FORMAT(subquery.create_time, '%Y-%m'), |
| | | tp.`name` |
| | | |
| | | ORDER BY MONTH asc |
| | | |
| | | </select> |
| | | <select id="getSumAmout" resultType="java.math.BigDecimal"> |
| | |
| | | t_vip_order |
| | | WHERE |
| | | del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND |
| | | payment_status = 2 AND |
| | | refund_amount IS NULL |
| | | payment_status = 2 |
| | | <if test="sixBefore != null"> |
| | | AND create_time > #{sixBefore} |
| | | </if> |