diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/TIccardDeviceMapper.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/TIccardDeviceMapper.java index 7ffdfbcf..e48472fa 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/TIccardDeviceMapper.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/TIccardDeviceMapper.java @@ -39,6 +39,7 @@ public interface TIccardDeviceMapper { */ void updateCardDeviceStatusIsDel(Integer deviceId); + void deleteIccardDeviceId(Integer deviceId); /** * query specified card grant device delete status * diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java index e5e292ec..4d99042f 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java @@ -162,6 +162,8 @@ public class XhpcCardServiceImpl implements IXhpcCardService { String log = JSONUtil.toJsonStr(deviceLogInfo); tIccardLog.setLog(log); tIccardLogMapper.insertSelective(tIccardLog); + + tIccardDeviceMapper.deleteIccardDeviceId(deviceId); return R.ok(); } diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/IXhpcCardClientUsersMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/IXhpcCardClientUsersMapper.xml index 409bc3d7..a5af3c32 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/IXhpcCardClientUsersMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/IXhpcCardClientUsersMapper.xml @@ -29,7 +29,7 @@ ccu.usersTime as usersTime, ccu.status as status from t_iccard_client_users ccu - join xhpc_operator ope on ope.corp_no = ccu.corpNo + join xhpc_operator ope on ope.corp_no = ccu.corpNo and ccu.usersCorp =ope.operator_id where ccu.del_flag=0 and ccu.usersName like concat('%', #{userName}, '%') @@ -122,6 +122,7 @@ diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/TIccardDeviceMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/TIccardDeviceMapper.xml index 06f7d0dd..13b15988 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/TIccardDeviceMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/TIccardDeviceMapper.xml @@ -131,9 +131,14 @@ tenant_id = #{tenantId,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} - + update t_iccard_device set del_flag = 1 where id = #{deviceId} - + + + + delete from t_iccard_device where id = #{deviceId} + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index 1f7709da..88174af3 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -784,128 +784,50 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe BigDecimal decimal1= activityPowerPriceTotal.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP); BigDecimal decimal2= activityServicePriceTotal.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP); Integer discountType = activity.getDiscountType(); - long between = activity.getEndTime().getTime()-endTime.getTime(); //说明活动时间大于用户充电结束时间 - if(between>0){ - if(discountType.equals(1)){ - if(promotionDiscount1.compareTo(decimal1.add(decimal2))<0){ - promotionDiscount1 =decimal1.add(decimal2); - activityPowerPrice1 = decimal1; + if(discountType.equals(1)){ + if(promotionDiscount1.compareTo(decimal1.add(decimal2))<0){ + promotionDiscount1 =decimal1.add(decimal2); + activityPowerPrice1 = decimal1; + activityServicePrice1 = decimal2; + activityId =activity.getActivityId()+""; + } + }else if(discountType.equals(2)){ + //服务费 + if(activityServicePriceTotal.compareTo(decimal2)<0){ + if(promotionDiscount1.compareTo(activityServicePriceTotal)<0){ + promotionDiscount1 =activityServicePriceTotal; + activityServicePrice1 = activityServicePriceTotal; + activityId =activity.getActivityId()+""; + } + }else{ + if(promotionDiscount1.compareTo(decimal2)<0){ + promotionDiscount1 =decimal2; activityServicePrice1 = decimal2; activityId =activity.getActivityId()+""; } - }else if(discountType.equals(2)){ - //服务费 - if(activityServicePriceTotal.compareTo(decimal2)<0){ - if(promotionDiscount1.compareTo(activityServicePriceTotal)<0){ - promotionDiscount1 =activityServicePriceTotal; - activityServicePrice1 = activityServicePriceTotal; - activityId =activity.getActivityId()+""; - } - }else{ - if(promotionDiscount1.compareTo(decimal2)<0){ - promotionDiscount1 =decimal2; - activityServicePrice1 = decimal2; - activityId =activity.getActivityId()+""; - } - } - }else{ - //电量抽成 - BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree(); - //电量的钱 - BigDecimal bigDecimal = chargingDegree.multiply(discountRate).setScale(2, BigDecimal.ROUND_HALF_UP); - //当电量的折扣大于服务费时,电量==服务费 - if(activityServicePriceTotal.compareTo(bigDecimal)<0){ - if(promotionDiscount1.compareTo(activityServicePriceTotal)<0){ - promotionDiscount1 =activityServicePriceTotal; - activityServicePrice1 = activityServicePriceTotal; - activityId =activity.getActivityId()+""; - } - }else{ - if(promotionDiscount1.compareTo(bigDecimal)<0){ - promotionDiscount1 =bigDecimal; - activityServicePrice1 = bigDecimal; - activityId =activity.getActivityId()+""; - } - } } }else{ - - List> reatTimeList = xhpcHistoryOrderService.getReatTimeList(start, "23:59:59", xhpcChargeOrder.getRateModelId()); - for (int j = 0; j < reatTimeList.size(); j++) { - BigDecimal powerFee = new BigDecimal(0); - BigDecimal serviceFee = new BigDecimal(0); - Map map = reatTimeList.get(i); - String startTime1 = start; - String endTime1 ="23:59:59"; - if (reatTimeList.size() == 1) { - powerFee = new BigDecimal(map.get("powerFee").toString()); - serviceFee = new BigDecimal(map.get("serviceFee").toString()); - } else if (i == 0) { - powerFee = new BigDecimal(map.get("powerFee").toString()); - serviceFee = new BigDecimal(map.get("serviceFee").toString()); - if ("00:00:00".equals(endTime1)) { - endTime1 = "23:59:59"; - } - } else if (i != reatTimeList.size() - 1) { - powerFee = new BigDecimal(map.get("powerFee").toString()); - serviceFee = new BigDecimal(map.get("serviceFee").toString()); - startTime1 = map.get("startTime").toString(); - endTime1 = map.get("endTime").toString(); - if ("00:00:00".equals(endTime1)) { - endTime1 = "23:59:59"; - } - } else { - powerFee = new BigDecimal(map.get("powerFee").toString()); - serviceFee = new BigDecimal(map.get("serviceFee").toString()); - startTime1 = map.get("startTime").toString(); + //电量抽成 + BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree(); + //电量的钱 + BigDecimal bigDecimal = chargingDegree.multiply(discountRate).setScale(2, BigDecimal.ROUND_HALF_UP); + //当电量的折扣大于服务费时,电量==服务费 + if(activityServicePriceTotal.compareTo(bigDecimal)<0){ + if(promotionDiscount1.compareTo(activityServicePriceTotal)<0){ + promotionDiscount1 =activityServicePriceTotal; + activityServicePrice1 = activityServicePriceTotal; + activityId =activity.getActivityId()+""; } - //这个时段的电量 - BigDecimal degree =getRealOrderTime(chargeOrderId, parse2+" "+startTime1, parse2+" "+endTime1); - BigDecimal decimal3= activityPowerPrice1.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP); - BigDecimal decimal4= activityServicePrice1.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP); - if(discountType.equals(1)){ - if(promotionDiscount1.compareTo(decimal3.add(decimal4))<0){ - promotionDiscount1 =decimal3.add(decimal4); - activityPowerPrice1 = decimal4; - activityServicePrice1 = decimal3; - activityId =activity.getActivityId()+""; - } - }else if(discountType.equals(2)){ - //服务费 - if(activityServicePriceTotal.compareTo(decimal4)<0){ - if(promotionDiscount1.compareTo(activityServicePriceTotal)<0){ - promotionDiscount1 =activityServicePriceTotal; - activityServicePrice1 = activityServicePriceTotal; - activityId =activity.getActivityId()+""; - } - }else{ - if(promotionDiscount1.compareTo(decimal4)<0){ - promotionDiscount1 =decimal4; - activityServicePrice1 = decimal4; - activityId =activity.getActivityId()+""; - } - } - }else{ - //电量的钱 - BigDecimal bigDecimal = degree.multiply(discountRate).setScale(2, BigDecimal.ROUND_HALF_UP); - //当电量的折扣大于服务费时,电量==服务费 - if(activityServicePriceTotal.compareTo(bigDecimal)<0){ - if(promotionDiscount1.compareTo(activityServicePriceTotal)<0){ - promotionDiscount1 =activityServicePriceTotal; - activityServicePrice1 = activityServicePriceTotal; - activityId =activity.getActivityId()+""; - } - }else{ - if(promotionDiscount1.compareTo(bigDecimal)<0){ - promotionDiscount1 =bigDecimal; - activityServicePrice1 = bigDecimal; - activityId =activity.getActivityId()+""; - } - } + }else{ + if(promotionDiscount1.compareTo(bigDecimal)<0){ + promotionDiscount1 =bigDecimal; + activityServicePrice1 = bigDecimal; + activityId =activity.getActivityId()+""; } } } + } //得到最大的折扣进行计算 promotionDiscount = promotionDiscount1; diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index d85e7dff..93543055 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -866,6 +866,9 @@ co.erro_remark as erroRemark, ho.power_price_total as powerPriceTotal, ho.service_price_total as servicePriceTotal, + ho.activity_power_price_total as activityPowerPriceTotal, + ho.activity_service_price_total as activityServicePriceTotal, + ho.activity_total_price as activityTotalPrice, ho.internet_commission as internetCommission, ho.internet_svc_commission as internetSvcCommission, ho.internet_degree_commission as internetDegreeCommission, diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInvoiceController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInvoiceController.java index 1f23b222..21634255 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInvoiceController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInvoiceController.java @@ -139,6 +139,7 @@ public class XhpcInvoiceController extends BaseController { xhpcInvoiceService.failInvoiceToUser(requestData); return AjaxResult.success(); } catch (Exception e) { + e.printStackTrace(); return AjaxResult.error("开失败发票失败"); } } else { diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java index 906d4484..029eb3d6 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java @@ -213,7 +213,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { if (redisService.getCacheObject(redisKey) == null) { redisService.setCacheObject(redisKey, 1); } else { - Integer noReadCount = redisService.getCacheObject(redisKey); + Long noReadCount = redisService.getCacheObject(redisKey); noReadCount = noReadCount + 1; redisService.setCacheObject(redisKey, noReadCount); } @@ -424,6 +424,9 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { return specificInvoicedResponse; } //如果用户已经查看了该发票,却再次调用该接口,那么就直接返回数据。 + if(xhpcInvoice.getIsRead()==null){ + return specificInvoicedResponse; + } if (xhpcInvoice.getIsRead().equals(IsReadStatusConst.READED)) { return specificInvoicedResponse; } @@ -616,10 +619,12 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { totalServicePrice += (xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().doubleValue()); totalActPrice += xhpcHistoryOrder.getTotalPrice().doubleValue(); } - System.out.println("<<<<<<<<<<111<<<<<<<<发票 totalActPrice>>>>>>>>>>111>>>>>>>>"+totalActPrice); + BigDecimal bigDecimal = saveInvoiceInfoRequest.getInvoiceMoney().setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal bigDecimal2 = new BigDecimal(totalActPrice).setScale(2, BigDecimal.ROUND_HALF_UP); + System.out.println("<<<<<<<<<<111<<<<<<<<发票 bigDecimal2>>>>>>>>>>111>>>>>>>>"+bigDecimal2); System.out.println("<<<<<<<<<<111<<<<<<<<发票 bigDecimal>>>>>>>>>>111>>>>>>>>"+bigDecimal); - if (!BigDecimal.valueOf(totalActPrice).equals(bigDecimal)) { + if (!bigDecimal2.equals(bigDecimal)) { throw new Exception("传入的发票金额与实际包含的历史订单总金额参数不匹配"); } xhpcInvoice.setInvoiceOrderEletricTotalMoney(BigDecimal.valueOf(totalPowerPrice));