1.订单增加活动计算、支付重复提交3秒限制,金额充值最多200元

This commit is contained in:
yuyang 2022-04-21 16:10:35 +08:00
parent a7111aa1cf
commit 8dcb1efec4
36 changed files with 1506 additions and 420 deletions

View File

@ -96,7 +96,7 @@ public class CDChargeOrderInfo4BonusReq {
this.totalElecMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
this.totalSeviceMoney = xhpcHistoryOrder.getServicePriceTotal().doubleValue();
this.totalMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
//this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
this.sumPeriod = xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList().size();
this.chargeDetails = translate(xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList());
this.userName = xhpcHistoryOrder.getUserNameEvcs();

View File

@ -95,7 +95,7 @@ public class ChargeOrderInfo {
this.totalElecMoney = xhpcHistoryOrder.getPowerPriceTotal().doubleValue();
this.totalSeviceMoney = xhpcHistoryOrder.getServicePriceTotal().doubleValue();
this.totalMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
//this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
this.sumPeriod = xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList().size();
this.chargeDetails = calcemChargeDetails;//translate(xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList());
Date starttime = xhpcHistoryOrder.getStartTime();
@ -122,7 +122,7 @@ public class ChargeOrderInfo {
this.totalSeviceMoney = servicePriceTotal == null ? 0.0 : servicePriceTotal.doubleValue();
final BigDecimal totalPrice = xhpcHistoryOrder.getTotalPrice();
this.totalMoney = totalPrice == null ? 0.0 : totalPrice.doubleValue();
this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
//this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
final List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList =
xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList();
this.sumPeriod = xhpcStatisticsTimeIntervalList == null ? 0 : xhpcStatisticsTimeIntervalList.size();

View File

@ -136,7 +136,7 @@ public class QueryStartChargeController {
emptyHorder.setEndTime(now);
emptyHorder.setCreateTime(now);
emptyHorder.setUpdateTime(now);
emptyHorder.setStopReasonEvcs(9);
emptyHorder.setStopReasonEvcs("平台停止");
String sn = genOrder(connectorId);
etOrderMapping.setXhOrderNo(sn);
emptyHorder.setSerialNumber(sn);

View File

@ -103,13 +103,4 @@ public class XhpcActivityInternetController extends BaseController {
return R.ok(internetService.deleteByPk(activityId));
}
@GetMapping("/getActivityStationTime")
public R getActivityStationTime(Long internetUserId,String startTime,String endTime,Long chargingStationId,String tenantId){
return R.ok(internetService.getActivityStationTime(internetUserId, startTime,endTime, chargingStationId, tenantId));
}
@GetMapping("/getActivityFormulaTime")
public R getActivityFormulaTime(Integer activityId,String startTime,String endTime){
return R.ok(internetService.getActivityFormulaTime(activityId, startTime, endTime));
}
}

View File

@ -19,9 +19,4 @@ public interface XhpcActivityFormulaMapper {
List<XhpcActivityFormulaDomain> selectByActivityId(Integer activityId);
int deleteByActivityId(Integer activityId);
/**
* 查询该时段的计费公式
*/
List<XhpcActivityFormulaDomain> getActivityFormulaTime(@Param("activityId") Integer activityId,@Param("startTime") String startTime,@Param("endTime") String endTime);
}

View File

@ -29,9 +29,4 @@ public interface XhpcActivityInternetMapper {
List<XhpcActivityInternetDomain> selectByDateBetween(@Param("startTime")String startTime, @Param("endTime")String endTime);
/**
* 查询该时间段是否有流量方活动
*/
List<XhpcActivityInternetDomain> getActivityStationTime(@Param("internetUserId")Long internetUserId,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("chargingStationId")Long chargingStationId,@Param("tenantId")String tenantId);
}

View File

@ -24,15 +24,4 @@ public interface XhpcActivityInternetService {
boolean deleteByPk(Integer activityId);
/**
* 查询该时间段是否有流量方活动
*/
List<XhpcActivityInternetDomain> getActivityStationTime(Long internetUserId,String startTime,String endTime,Long chargingStationId,String tenantId);
/**
* 查询该时段的计费公式
*/
List<XhpcActivityFormulaDomain> getActivityFormulaTime(Integer activityId,String startTime,String endTime);
}

View File

@ -156,27 +156,4 @@ public class XhpcActivityInternetServiceImpl implements XhpcActivityInternetServ
return internetMapper.deleteLogicByPrimaryKey(activityId) > 0;
}
/**
* 查询该时间段是否有流量方活动
*
* @param internetUserId
* @param time
* @param chargingStationId
*/
@Override
public List<XhpcActivityInternetDomain> getActivityStationTime(Long internetUserId,String startTime,String endTime, Long chargingStationId ,String tenantId) {
return internetMapper.getActivityStationTime(internetUserId,startTime,endTime, chargingStationId,tenantId);
}
/**
* 查询该时段的计费公式
*
* @param activityId
* @param startTime
* @param endTime
*/
@Override
public List<XhpcActivityFormulaDomain> getActivityFormulaTime(Integer activityId, String startTime, String endTime) {
return formulaMapper.getActivityFormulaTime(activityId, startTime, endTime);
}
}

View File

@ -87,13 +87,4 @@
where activity_formula_id = #{activityComputeId,jdbcType=BIGINT}
</update>
<select id="getActivityFormulaTime" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_formula
where
activity_id = #{activityId}
and activity_formula_id &gt;= (SELECT activity_formula_id FROM xhpc_activity_formula WHERE start_time &lt;= #{startTime} AND end_time &gt;= #{startTime})
and activity_formula_id &lt;= (SELECT activity_formula_id FROM xhpc_activity_formula WHERE start_time &lt;= #{endTime} AND end_time &gt;= #{endTime})
</select>
</mapper>

View File

@ -140,21 +140,4 @@
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<select id="getActivityStationTime" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_internet
where tenant_id =#{tenantId}
and find_in_set(#{chargingStationId}, station_list)
and internet_name = (select name from xhpc_internet_user where internet_user_id =#{internetUserId} and del_flag =0)
and status =3 and del_flag=0
and activity_id &gt;= (
SELECT activity_id FROM xhpc_activity_internet WHERE start_time &lt;= #{startTime} AND end_time &gt;= #{startTime}
)
AND activity_id &lt;= (
SELECT activity_id FROM xhpc_activity_internet WHERE start_time &lt;= #{endTime} AND end_time &gt;= #{endTime}
)
order by end_time desc
</select>
</mapper>

View File

@ -27,7 +27,6 @@ public class XhpcDownCodeController extends BaseController {
@GetMapping(value = "/listStations")
public TableDataInfo listStations(String stationName){
startPage();
return getDataTable(iXhpcDownCodeService.listStations(stationName));
}

View File

@ -14,7 +14,7 @@ import java.util.Map;
@Mapper
public interface XhpcDownCodeMapper {
List<Map<String, Object>> selectStationsBy(@Param(value = "stationName") String stationName,@Param("tenantId") String tenantId);
List<Map<String, Object>> selectStationsBy(@Param(value = "stationName") String stationName,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId") String tenantId);
List<Map<String, Object>> selectPilesBy(@Param(value = "stationId") Long stationId);

View File

@ -2,7 +2,10 @@ package com.xhpc.charging.station.service;
import com.xhpc.charging.station.mapper.XhpcDownCodeMapper;
import com.xhpc.charging.station.utils.img.DownMaterialUtil;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
@ -17,6 +20,7 @@ import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -26,7 +30,7 @@ import java.util.Map;
* Date:2021-09-30 15
*/
@Service
public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
public class XhpcDownCodeServiceImpl extends BaseService implements IXhpcDownCodeService {
@Autowired
private XhpcDownCodeMapper xhpcDownCodeMapper;
@ -41,7 +45,25 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
@Override
public List<Map<String, Object>> listStations(String stationName) {
LoginUser loginUser = tokenService.getLoginUser();
return xhpcDownCodeMapper.selectStationsBy(stationName,loginUser.getTenantId());
List<Map<String, Object>> list =new ArrayList<>();
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
startPage();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcDownCodeMapper.selectStationsBy(stationName,1,logOperatorId,loginUser.getTenantId());
}else{
//查询赋值的场站
list = xhpcDownCodeMapper.selectStationsBy(stationName,2,sysUserId,loginUser.getTenantId());
}
}else{
startPage();
list = xhpcDownCodeMapper.selectStationsBy(stationName,0,sysUserId,loginUser.getTenantId());
}
return list;
}
@Override

View File

@ -18,6 +18,12 @@
<if test="null != tenantId and '' != tenantId">
and xcs.tenant_id =#{tenantId}
</if>
<if test="type==1">
and xcs.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="type==2">
and xcs.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
group by xcs.charging_station_id, xcs.name, xo.name
</select>

View File

@ -5,6 +5,7 @@ package com.xhpc.common.util;
import cn.hutool.Hutool;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import java.math.BigDecimal;
import java.text.DateFormat;
@ -496,9 +497,38 @@ public class DateUtil {
// DateUtil.isWeekend(DateUtil.string2Date("2016-06-12", "yyyy-MM-dd"));
// DateUtil.isWeekend(DateUtil.string2Date("2016-06-13", "yyyy-MM-dd"));
// DateUtil.isWeekend(DateUtil.string2Date("2016-06-14", "yyyy-MM-dd"));
String data = DateUtil.week(new Date());
// String data = DateUtil.week(new Date());
//
// System.out.println("data"+data);
//
// String dateStr = "2017-03-01 22:33:23";
// Date date = cn.hutool.core.date.DateUtil.parse(dateStr);
//
// String formatDate = cn.hutool.core.date.DateUtil.formatDate(date);
// System.out.println("formatDate:"+formatDate);
//
//
// //跨天
// DateTime tomorrow = cn.hutool.core.date.DateUtil.offsetDay(date,1);
// Date startTime3 = cn.hutool.core.date.DateUtil.beginOfDay(tomorrow);
// //yyyy-mm-dd
// String parse2 = cn.hutool.core.date.DateUtil.formatDate(startTime3);
// System.out.println("parse2:"+parse2);
String dateStr1 = "2017-03-01 22:33:23";
Date date1 = cn.hutool.core.date.DateUtil.parse(dateStr1);
String dateStr2 = "2017-04-01 20:33:23";
Date date2 =cn.hutool.core.date.DateUtil.parse(dateStr2);
long between = cn.hutool.core.date.DateUtil.between(date1, date2, DateUnit.MINUTE);
String formatDate = cn.hutool.core.date.DateUtil.format(date2, "yyyy-MM-dd HH:mm:ss");
System.out.println("formatDate:"+formatDate);
System.out.println("data"+data);
}
}

View File

@ -164,6 +164,21 @@ public class XhpcHistoryOrder extends BaseEntity {
*/
private BigDecimal servicePriceTotal;
/**
* 活动总电费
*/
private BigDecimal activityPowerPriceTotal;
/**
* 活动总服务费
*/
private BigDecimal activityServicePriceTotal;
/**
* 活动总金额
*/
private BigDecimal activityTotalPrice;
/**
* 0未统计 1已统计
*/
@ -193,7 +208,7 @@ public class XhpcHistoryOrder extends BaseEntity {
* 4:连接器断开
* 5-99 自定义
*/
private Integer stopReasonEvcs = 0;
private String stopReasonEvcs ;
/**
* 运营商/场站OperatorID
@ -263,6 +278,11 @@ public class XhpcHistoryOrder extends BaseEntity {
*/
private Integer source;
/**
* 活动id
*/
private String activityId;
public Integer getConfirmResult() {
return confirmResult;
@ -626,12 +646,12 @@ public class XhpcHistoryOrder extends BaseEntity {
this.startTime = startTime;
}
public Integer getStopReasonEvcs() {
public String getStopReasonEvcs() {
return stopReasonEvcs == null ? 0 : stopReasonEvcs;
return stopReasonEvcs = stopReasonEvcs;
}
public void setStopReasonEvcs(Integer stopReasonEvcs) {
public void setStopReasonEvcs(String stopReasonEvcs) {
this.stopReasonEvcs = stopReasonEvcs;
}
@ -739,4 +759,40 @@ public class XhpcHistoryOrder extends BaseEntity {
public void setSource(Integer source) {
this.source = source;
}
public BigDecimal getActivityPowerPriceTotal() {
return activityPowerPriceTotal;
}
public void setActivityPowerPriceTotal(BigDecimal activityPowerPriceTotal) {
this.activityPowerPriceTotal = activityPowerPriceTotal;
}
public BigDecimal getActivityServicePriceTotal() {
return activityServicePriceTotal;
}
public void setActivityServicePriceTotal(BigDecimal activityServicePriceTotal) {
this.activityServicePriceTotal = activityServicePriceTotal;
}
public BigDecimal getActivityTotalPrice() {
return activityTotalPrice;
}
public void setActivityTotalPrice(BigDecimal activityTotalPrice) {
this.activityTotalPrice = activityTotalPrice;
}
public void setChargeModelEvcs(Integer chargeModelEvcs) {
this.chargeModelEvcs = chargeModelEvcs;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
}

View File

@ -110,6 +110,7 @@
<if test="null!=phone and ''!=phone">
and phone like concat('%',#{phone},'%')
</if>
order by create_time desc
</select>
<select id="querySumOfFailMessage" resultType="java.lang.Long">

View File

@ -443,25 +443,9 @@ public class XhpcPileOrderController extends BaseController {
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
//停止原因
try{
if(!"".equals(stopReason) && stopReason!=null){
xhpcChargeOrder.setType(Integer.parseInt(stopReason));
if("40".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(40);
}else if("42".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(42);
}else if("43".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(43);
}else if("44".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(44);
}else if("41".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(41);
}else if("48".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(48);
}else if("45".equals(stopReason)){
xhpcChargeOrder.setStopReasonEvcs(45);
}else{
xhpcChargeOrder.setStopReasonEvcs(49);
}
if(cacheMap.get("stopReason") !=null){
String stopReason1 = cacheMap.get("stopReason").toString();
xhpcChargeOrder.setType(stopReason1);
}
}catch (Exception e){}
//历史订单
@ -471,7 +455,7 @@ public class XhpcPileOrderController extends BaseController {
xhpcHistoryOrder.setEndTime(endTime);
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
xhpcHistoryOrder.setTotalPower(totalPower.doubleValue()/10000);
xhpcHistoryOrder.setTotalPower(totalPower.doubleValue()/10000);
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
Map<String, Object> userMessage =new HashMap<>();

View File

@ -135,7 +135,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 日期统计\场站统计\终端统计
*/
@GetMapping("/test1")
@Scheduled(cron = "0 0/2 * * * ?")
//@Scheduled(cron = "0 0/2 * * * ?")
public void test1(){
add(3000,1);
}
@ -425,7 +425,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 小时统计
*/
@GetMapping("/test")
@Scheduled(cron = "0 0/2 * * * ?")
//@Scheduled(cron = "0 0/2 * * * ?")
public void test(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
//小时统计
@ -875,7 +875,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 24小时异常订单自动结算
*/
@GetMapping("/test4")
@Scheduled(cron = "0 0/5 * * * ?")
//@Scheduled(cron = "0 0/5 * * * ?")
public void test4(){
//获取异常的订单 24小时之外的异常订单
List<XhpcChargeOrder> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2, 0);
@ -930,7 +930,7 @@ public class XhpcHistoryOrderController extends BaseController {
* @param
*/
@GetMapping("/test5")
@Scheduled(cron = "0 0/5 * * * ?")
//@Scheduled(cron = "0 0/5 * * * ?")
public void test5(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>");
chargeOrderService.updateStatus();

View File

@ -155,6 +155,16 @@ public class XhpcStatisticsController extends BaseController {
return xhpcStatisticsService.getChargingStationList(request,operatorId, userId, type);
}
@GetMapping("/getChargingPileList")
public AjaxResult getChargingPileList(HttpServletRequest request,Long chargingStationId,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{
if (type == null || type==3) {
return AjaxResult.success();
}
return xhpcStatisticsService.getChargingPileList(request,chargingStationId,operatorId, userId, type);
}
/**
* 运营商列表
* @param operatorId 运营商id
@ -364,9 +374,9 @@ public class XhpcStatisticsController extends BaseController {
* 今日订单量、今日订电量、今日营收、今日充电枪状态
*/
@GetMapping("/getToday")
public AjaxResult getToday(Long operatorId,Long chargingStationId,Long chargingPileId)
public AjaxResult getToday(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type)
{
return AjaxResult.success(xhpcStatisticsService.getToday(operatorId,chargingStationId,chargingPileId));
return AjaxResult.success(xhpcStatisticsService.getToday(operatorId,chargingStationId,chargingPileId,type));
}
/**

View File

@ -91,7 +91,7 @@ public class XhpcChargeOrder extends BaseEntity {
private BigDecimal chargingDegree;
/** 0桩停止充电 1 远程停止充电 */
private Integer type;
private String type;
/**
* 异常备注
@ -385,12 +385,12 @@ public class XhpcChargeOrder extends BaseEntity {
this.endSoc = endSoc;
}
public Integer getType() {
public String getType() {
return type;
}
public void setType(Integer type) {
public void setType(String type) {
this.type = type;
}

View File

@ -0,0 +1,122 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author yuyang
* @date 2022/4/19 13:57
*/
@Data
public class XhpcActivityDiscountDto implements Serializable {
/**
* 活动ID
*/
private Integer activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 模板ID
*/
private Integer templateId;
/**
* C端用户列表(以逗号分隔,-1表示全部用户)
*/
private String appUserList;
/**
* 社区用户列表(以逗号分隔,-1表示全部用户)
*/
private String comUserList;
/**
* B端用户列表(以逗号分隔,-1表示全部用户)
*/
private String cusUserList;
/**
* 场站列表
*/
private String stationList;
/**
* 租户ID
*/
private String tenantId;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 状态(0-编辑,1-提交待审核,2-审核失败,3-审核通过,4-立即失效)
*/
private Short status = 0;
/**
* 删除标识(0-正常,2-删除)
*/
private Short delFlag = 0;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 审核人
*/
private String checkBy;
/**
* 审核时间
*/
private Date checkTime;
/**
* 优惠类型(1-总金额,2-服务费,3-电量)
*/
private Integer discountType;
/**
* 优惠比率
*/
private BigDecimal discountRate;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,71 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author yuyang
* @date 2022/4/12 13:31
*/
@Data
public class XhpcActivityFormulaDomainDto implements Serializable {
/**
* 活动计算ID
*/
private Long activityFormulaId;
/**
* 活动ID
*/
private Integer activityId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 服务费
*/
private BigDecimal servicePrice;
/**
* 服务费
*/
private BigDecimal powerPrice;
/**
* 计算公式
*/
private String computeFormula;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,108 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author yuyang
* @date 2022/4/12 13:36
*/
@Data
public class XhpcActivityInternetDomainDto implements Serializable {
/**
* 活动ID
*/
private Integer activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 流量方名称
*/
private String internetName;
/**
* 计算类型(1-总金额,2-服务费,3-电量)
*/
private Short computeType;
/**
* 服务费
*/
private BigDecimal servicePrice;
/**
* 计算公式
*/
private String computeFormula;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 参与场站列表
*/
private String stationList;
/**
* 租户ID
*/
private String tenantId;
/**
* 状态(0-编辑,1-提交审核,2-审核失败,3-审核成功,4-失效)
*/
private Short status;
/**
* 删除标志(0-正常,2-删除)
*/
private Short delFlag;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 审核人
*/
private String checkBy;
/**
* 审核时间
*/
private Date checkTime;
private static final long serialVersionUID = 1L;
}

View File

@ -4,6 +4,9 @@ import com.xhpc.order.domain.XhpcChargeOrderCurrent;
import com.xhpc.order.domain.XhpcChargeOrderSoc;
import com.xhpc.order.domain.XhpcChargeOrderVoltage;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import com.xhpc.order.dto.XhpcActivityDiscountDto;
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
@ -121,6 +124,17 @@ public interface XhpcRealTimeOrderMapper {
*/
XhpcRealTimeOrder getChargingOrderId(@Param("chargingOrderId")Long chargingOrderId,@Param("type")Integer type);
/**
* 获取该时段的电量
* @param
* @return
*/
double getRealTimeOrderTime(@Param("chargingOrderId")Long chargingOrderId,@Param("startTime") String startTime, @Param("endTime") String endTime);
int getDifferenceTime(@Param("chargingOrderId")Long chargingOrderId,@Param("time") String time);
double getChargingDegreeTime(@Param("chargingOrderId")Long chargingOrderId,@Param("time") String time);
Map<String,Object> getChargeOrderById(@Param("chargingOrderId")Long chargingOrderId);
@ -130,4 +144,28 @@ public interface XhpcRealTimeOrderMapper {
* @return
*/
Map<String, Object> getOperatorIdEvcs(String operatorIdEvcs);
/**
* 查询该时段的计费公式
*/
List<XhpcActivityFormulaDomainDto> getActivityFormulaTime(@Param("activityId") Integer activityId, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 查询该时间段是否有流量方活动
*/
List<XhpcActivityInternetDomainDto> getActivityStationTime(@Param("internetUserId")Long internetUserId, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("chargingStationId")Long chargingStationId, @Param("tenantId")String tenantId);
/**
* 查询开始时间是否在活动中
*/
List<XhpcActivityDiscountDto> getActivityDiscountTime(@Param("internetUserId")Long internetUserId, @Param("startTime")String startTime, @Param("userType")Integer userType, @Param("chargingStationId")Long chargingStationId, @Param("tenantId")String tenantId);
}

View File

@ -99,6 +99,15 @@ public interface XhpcStatisticsServiceMapper {
*/
List<Map<String, Object>> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
/**
* 电桩列表
* @param operatorId 运营商id
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String, Object>> getChargingPileList(@Param("chargingStationId")Long chargingStationId,@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
/**
* 运营商列表
* @param operatorId 运营商id
@ -172,7 +181,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId);
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("tenantId")Long sysUserId,@Param("tenantId")Integer number);
/**
* 获取登陆用户信息
@ -181,7 +190,9 @@ public interface XhpcStatisticsServiceMapper {
//今日订单量
List<Map<String,Object>> getTodayStatusNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
List<Map<String,Object>> getTodayStatusNumber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
int getTodayOrderNumber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
int getTodayNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
//今日订单量

View File

@ -108,6 +108,15 @@ public interface IXhpcStatisticsService {
*/
AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId,Long userId,Integer type);
/**
* 电桩列表
* @param operatorId 运营商id
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
AjaxResult getChargingPileList(HttpServletRequest request,Long chargingStationId,Long operatorId,Long userId,Integer type);
/**
* 运营商列表
* @param operatorId 运营商id
@ -278,7 +287,7 @@ public interface IXhpcStatisticsService {
/**
* 今日订单量、今日订电量、今日营收、今日充电枪状态
*/
Map<String, Object> getToday(Long operatorId,Long chargingStationId,Long chargingPileId);
Map<String, Object> getToday(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type);
/**
* 今日电枪实时状态

View File

@ -283,7 +283,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
xhpcChargeOrder.setChargingMode("支付宝");
}
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
xhpcChargeOrder.setType(40);
xhpcChargeOrder.setType("平台停止");
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
executorService.execute(new Runnable() {
@ -771,7 +771,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
xhpcChargeOrder.setChargingMode("刷卡");
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
xhpcChargeOrder.setType(40);
xhpcChargeOrder.setType("平台停止");
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
//插一帧实时数据

View File

@ -483,7 +483,8 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
Integer source = xhpcChargeOrder.getSource();
String tenantId = xhpcChargeOrder.getTenantId();
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
xhpcHistoryOrder.setStopReasonEvcs(5);
xhpcChargeOrder.setType("平台停止");
xhpcHistoryOrder.setStopReasonEvcs("平台停止");
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
xhpcHistoryOrder.setTotalPower(cacheRealtimeData.getAmountCharged().doubleValue() / 10000);
@ -666,7 +667,6 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
xhpcHistoryOrder.setUserId(userId);
xhpcHistoryOrder.setTerminalId(xhpcChargeOrder.getTerminalId());
xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime());
xhpcHistoryOrder.setStopReasonEvcs(xhpcChargeOrder.getStopReasonEvcs());//todo 从头开始设置所有evcs字段
xhpcHistoryOrder.setChargeModelEvcs(xhpcChargeOrder.getChargeModelEvcs());
xhpcHistoryOrder.setSerialNumber(xhpcChargeOrder.getSerialNumber());
xhpcHistoryOrder.setRateModelId(xhpcChargeOrder.getRateModelId());

View File

@ -3,6 +3,7 @@ package com.xhpc.order.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.xhpc.common.api.ActivityInternetService;
import com.xhpc.common.api.RefundOrderService;
import com.xhpc.common.api.SmsService;
import com.xhpc.common.api.UserTypeService;
@ -17,6 +18,9 @@ import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.EvcsUtil;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.*;
import com.xhpc.order.dto.XhpcActivityDiscountDto;
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService;
@ -65,13 +69,16 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
@Autowired
private TokenService tokenService;
@Autowired
private ActivityInternetService activityInternetService;
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
private static final Logger logger = LoggerFactory.getLogger(XhpcRealTimeOrderServiceImpl.class);
@Override
public List<Map<String, Object>> list(String phone, String transactionNumber, Integer source, String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber) {
@ -228,7 +235,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
chargeOrder.setEndSoc(endData.getSoc().toString());
chargeOrder.setChargingTimeNumber(tiem);
chargeOrder.setChargingDegree(chargingDegree);
chargeOrder.setType(0);
chargeOrder.setType("平台停止");
chargeOrder.setAmountCharged(new BigDecimal(endData.getAmountCharged()).divide(new BigDecimal(10000),2,BigDecimal.ROUND_HALF_UP));
}else{
//当没有缓存数据时,查询数据库
@ -268,7 +275,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
chargeOrder.setChargingTimeNumber(0L);
}
chargeOrder.setChargingDegree(chargingDegree);
chargeOrder.setType(0);
chargeOrder.setType("平台停止");
chargeOrder.setAmountCharged(endRealTimeOrder.getAmountCharged());
}
@ -411,137 +418,481 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
try{
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setVinNormal(vinNormal);
//电站活动抵扣--抵扣的总金额
BigDecimal promotionDiscount = new BigDecimal(0);
//实际价格-用户支付的钱
BigDecimal actPrice =money;
//流量方总金额抽成
//活动的订单总价
BigDecimal activityTotalPriceTotal=new BigDecimal(0);
//活动的订单总服务费
BigDecimal activityServicePriceTotal=new BigDecimal(0);
//活动的订单总电费
BigDecimal activityPowerPriceTotal=new BigDecimal(0);
//活动的订单服务费(抽成后)
BigDecimal activityServicePrice=new BigDecimal(0);
//活动的订单电费(抽成后)
BigDecimal activityPowerPrice=new BigDecimal(0);
//流量方总金额抽成(折扣后)
BigDecimal internetCommission =new BigDecimal(0);
//流量方服务费抽成
//流量方服务费抽成(折扣后)
BigDecimal internetSvcCommission =new BigDecimal(0);
//流量方电量抽成
//流量方电量抽成(折扣后)
BigDecimal internetDegreeCommission =new BigDecimal(0);
//平台总金额抽成
//平台总金额抽成(折扣后)
BigDecimal platformCommission =new BigDecimal(0);
//平台服务费抽成
//平台服务费抽成(折扣后)
BigDecimal platformSvcCommission =new BigDecimal(0);
//运维总抽成
//运维总抽成(折扣后)
BigDecimal operationCommission =new BigDecimal(0);
//运维服务费抽成
//运维服务费抽成(折扣后)
BigDecimal operationSvcCommission =new BigDecimal(0);
//判断是C端用户还是流量端用户
//先计算第三方优惠力度
//判断第三方是否有活动
Long internetUserId = xhpcChargeOrder.getUserId();
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
//最后一条实时数据
Date startTime = xhpcChargeOrder.getStartTime();
Date endTime = xhpcChargeOrder.getEndTime();
Integer source = xhpcChargeOrder.getSource();
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
//判断是否有活动
boolean judge =false;
if(source==UserTypeUtil.INTERNET_TYPE && internetSerialNumber!=null){
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+"");
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
// //判断第三方是否有活动
// Long internetUserId = xhpcChargeOrder.getUserId();
// //最后一条实时数据
// XhpcRealTimeOrder xhpcRealTimeOrder = xhpcRealTimeOrderMapper.getChargingOrderId(xhpcChargeOrder.getChargeOrderId(), 2);
// boolean judge =false;
// if(xhpcRealTimeOrder !=null && !"".equals(xhpcRealTimeOrder.getChargingTime()) && xhpcRealTimeOrder.getChargingTime()!=null){
// R<Map<String, Object>> activityStationTime = activityInternetService.getActivityStationTime(internetUserId, xhpcRealTimeOrder.getChargingTime(), xhpcChargeOrder.getChargingStationId(), xhpcChargeOrder.getTenantId());
// if(activityStationTime !=null && activityStationTime.getData() !=null){
// judge =true;
// }
// }
// if(judge){
//
//
//
//
//
// }
Double totalPower = xhpcHistoryOrder.getTotalPower();
//yyyy-mm-dd(当前时间)
String parse2 = DateUtil.formatDate(startTime);
long time1 = xhpcChargeOrder.getStartTime().getTime();
long time2 = xhpcChargeOrder.getEndTime().getTime();
String substring = internetSerialNumber.substring(0, 9);
Map<String, Object> operatorIdEvcs = xhpcRealTimeOrderMapper.getOperatorIdEvcs(substring);
if(operatorIdEvcs !=null){
if(operatorIdEvcs.get("operatorIdEvcs")!=null && operatorIdEvcs.get("commissionType")!=null && operatorIdEvcs.get("commissionRate")!=null){
BigDecimal commissionRate = new BigDecimal(operatorIdEvcs.get("commissionRate").toString()).divide(new BigDecimal(100));
String commissionType = operatorIdEvcs.get("commissionType").toString();
if(operatorIdEvcs.get("internetUserId") !=null){
xhpcHistoryOrder.setChargingMode(operatorIdEvcs.get("internetUserId").toString());
}
//0总金额提成 1服务费提成
if(new BigDecimal(0).compareTo(commissionRate)==-1){
if("0".equals(commissionType) || "1".equals(commissionType)|| "2".equals(commissionType)){
//流量方的钱
if("0".equals(commissionType)){
BigDecimal decimal1 = surplusPowerPrice.multiply(commissionRate).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal decimal2 = surplusServicePrice.multiply(commissionRate).setScale(2, BigDecimal.ROUND_HALF_UP);
internetCommission = decimal1.add(decimal2);
surplusPowerPrice =surplusPowerPrice.subtract(decimal1);
surplusServicePrice =surplusServicePrice.subtract(decimal2);
}else if("1".equals(commissionType)){
BigDecimal decimal2 = surplusServicePrice.multiply(commissionRate).setScale(2, BigDecimal.ROUND_HALF_UP);
internetSvcCommission = decimal2;
surplusServicePrice = surplusServicePrice.subtract(decimal2);
}else{
//电量抽成
BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree();
internetDegreeCommission = chargingDegree.multiply(new BigDecimal(operatorIdEvcs.get("commissionRate").toString())).setScale(2, BigDecimal.ROUND_HALF_UP);
//减服务费
surplusServicePrice = surplusServicePrice.subtract(internetDegreeCommission);
}
if( time1 != time2){
List<XhpcActivityInternetDomainDto> activityStationTime = xhpcRealTimeOrderMapper.getActivityStationTime(internetUserId, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), xhpcChargeOrder.getChargingStationId(), xhpcChargeOrder.getTenantId());
//activityInternetTime 用户充电时间大于活动时间:快电、恒大不做活动计算
boolean activityInternetTime =true;
// activityTime 用户充电开始时间是否活动时间
boolean activityTime =false;
if(activityStationTime !=null && activityStationTime.size()>0){
XhpcActivityInternetDomainDto activityInternet1 =activityStationTime.get(0);
if(time1-activityInternet1.getStartTime().getTime()>0){
activityTime =true;
if(xhpcChargeOrder.getUserId()==1L || xhpcChargeOrder.getUserId()==2L){
activityInternetTime =false;
}
}
}
if(activityStationTime !=null && activityStationTime.size()>0 && activityStationTime.size()<=2 && activityInternetTime){
judge =true;
int number = activityStationTime.size();
String start = DateUtil.formatTime(startTime);
String end = DateUtil.formatTime(endTime);
String activityId ="";
BigDecimal chargingDegree = new BigDecimal(0);
Map<String, Double> params =new HashMap<>();
List<XhpcActivityFormulaDomainDto> activityFormulaTime1 =new ArrayList<>();
List<XhpcActivityFormulaDomainDto> activityFormulaTime2 =new ArrayList<>();
XhpcActivityInternetDomainDto activityInternet1 =new XhpcActivityInternetDomainDto();
XhpcActivityInternetDomainDto activityInternet2 =new XhpcActivityInternetDomainDto();
Long rateModelId = xhpcChargeOrder.getRateModelId();
if(number==2){
activityInternet1 = activityStationTime.get(0);
activityInternet2 = activityStationTime.get(1);
if(activityTime){
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), "00:00:00", "24:00:00");
activityFormulaTime2 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet2.getActivityId(), "00:00:00", end);
}else{
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), start, "24:00:00");
activityFormulaTime2 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet2.getActivityId(), "00:00:00", end);
}
activityId =activityInternet1.getActivityId()+","+activityInternet2.getActivityId();
}else{
activityInternet1 = activityStationTime.get(0);
if(activityTime){
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), "00:00:00", end);
}else{
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), start, end);
}
activityId =activityInternet1.getActivityId()+"";
}
if(activityTime){
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(start, "00:00:00", rateModelId);
if(reatTimeList.size()>0){
String substring = internetSerialNumber.substring(0, 9);
Map<String, Object> operatorIdEvcs = xhpcRealTimeOrderMapper.getOperatorIdEvcs(substring);
if(operatorIdEvcs !=null){
if(operatorIdEvcs.get("operatorIdEvcs")!=null && operatorIdEvcs.get("commissionType")!=null && operatorIdEvcs.get("commissionRate")!=null){
BigDecimal commissionRate = new BigDecimal(operatorIdEvcs.get("commissionRate").toString()).divide(new BigDecimal(100));
String commissionType = operatorIdEvcs.get("commissionType").toString();
for (int i = 0; i < reatTimeList.size(); i++) {
Map<String, Object> map = reatTimeList.get(i);
BigDecimal powerFee =new BigDecimal(map.get("powerFee").toString());
BigDecimal serviceFee =new BigDecimal(map.get("serviceFee").toString());
String startTime1 =map.get("startTime").toString();
String endTime1 =map.get("endTime").toString();
BigDecimal degree =new BigDecimal(xhpcRealTimeOrderMapper.getRealTimeOrderTime(chargeOrderId, startTime1, endTime1));
//挡前服务费
BigDecimal activityServicePrice1 = serviceFee.multiply(degree);
//活动总服务费
activityServicePriceTotal = activityServicePriceTotal.add(activityServicePrice1);
//挡前电费
BigDecimal activityPowerPrice1 = powerFee.multiply(degree);
//活动总电费
activityPowerPriceTotal = activityPowerPriceTotal.add(activityPowerPrice1);
//活动总金额
activityTotalPriceTotal = activityTotalPriceTotal.add(activityServicePrice1.add(activityPowerPrice1));
if(new BigDecimal(0).compareTo(commissionRate)==-1){
if("0".equals(commissionType) || "1".equals(commissionType)|| "2".equals(commissionType)){
//流量方的钱
if("0".equals(commissionType)){
BigDecimal decimal1 = activityPowerPrice1.multiply(commissionRate).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal decimal2 = activityServicePrice1.multiply(commissionRate).setScale(2, BigDecimal.ROUND_HALF_UP);
internetCommission = internetCommission.add(decimal1.add(decimal2));
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1.subtract(decimal1));
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(decimal2));
}else if("1".equals(commissionType)){
BigDecimal decimal2 = activityServicePrice1.multiply(commissionRate).setScale(2, BigDecimal.ROUND_HALF_UP);
internetSvcCommission = internetSvcCommission.add(decimal2);
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(decimal2));
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
}else{
//电量抽成
BigDecimal commissionRate1 = degree.multiply(new BigDecimal(operatorIdEvcs.get("commissionRate").toString())).setScale(2, BigDecimal.ROUND_HALF_UP);
internetDegreeCommission = internetDegreeCommission.add(commissionRate1);
//减服务费
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(internetDegreeCommission));
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
}
}
}
chargingDegree = chargingDegree.add(degree);
}
}
}
}
}
for (int j = 0; j < activityFormulaTime1.size(); j++) {
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime1.get(j);
//计费类型
int computeType = activityInternet1.getComputeType();
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
//计算公式
String computeFormula = activityFormula.getComputeFormula();
BigDecimal degree =new BigDecimal(0);
if (activityFormulaTime2.size()==0 && activityFormulaTime1.size()-1==j) {
degree = new BigDecimal(totalPower).subtract(chargingDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
}else{
degree =getRealOrderTime(chargeOrderId, parse2+" "+activityFormula.getStartTime(), parse2+" "+activityFormula.getEndTime());
}
//挡前服务费
BigDecimal activityServicePrice1 = activityServicePriceFormula.multiply(degree).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总服务费
activityServicePriceTotal = activityServicePriceTotal.add(activityServicePrice1).setScale(2, BigDecimal.ROUND_HALF_UP);
//挡前电费
BigDecimal activityPowerPrice1 = activityPowerPriceFormula.multiply(degree).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总电费
activityPowerPriceTotal = activityPowerPriceTotal.add(activityPowerPrice1).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总金额
activityTotalPriceTotal = activityTotalPriceTotal.add(activityServicePrice1.add(activityPowerPrice1));
params.put("T",activityPowerPrice1.add(activityServicePrice1).doubleValue());
params.put("P",activityPowerPrice1.doubleValue());
params.put("S",activityServicePrice1.doubleValue());
params.put("E",degree.doubleValue());
//支付给流量方的钱
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params));
if(computeType==1){
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
internetCommission = internetCommission.add(eval);
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1.subtract(decimal1));
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(decimal1));
}else if(computeType==2){
internetSvcCommission = internetSvcCommission.add(eval);
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1);
}else{
//电量抽成
internetDegreeCommission = internetDegreeCommission.add(eval);
//减服务费
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1);
}
chargingDegree = chargingDegree.add(degree);
}
if(activityFormulaTime2.size()>0){
for (int j = 0; j < activityFormulaTime2.size(); j++) {
//计费类型
int computeType = activityInternet2.getComputeType();
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime1.get(j);
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
//计算公式
String computeFormula = activityFormula.getComputeFormula();
BigDecimal degree =new BigDecimal(0);
if (activityFormulaTime2.size()-1==j) {
degree = new BigDecimal(totalPower).subtract(chargingDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
}else{
degree =getRealOrderTime(chargeOrderId, parse2+" "+activityFormula.getStartTime(), parse2+" "+activityFormula.getEndTime());
}
//挡前服务费
BigDecimal activityServicePrice1 = activityServicePriceFormula.multiply(degree).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总服务费
activityServicePriceTotal = activityServicePriceTotal.add(activityServicePrice1).setScale(2, BigDecimal.ROUND_HALF_UP);
//挡前电费
BigDecimal activityPowerPrice1 = activityPowerPriceFormula.multiply(degree).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总电费
activityPowerPriceTotal = activityPowerPriceTotal.add(activityPowerPrice1).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总金额
activityTotalPriceTotal = activityTotalPriceTotal.add(activityServicePrice1.add(activityPowerPrice1));
params.put("T",activityPowerPrice1.add(activityServicePrice1).doubleValue());
params.put("P",activityPowerPrice1.doubleValue());
params.put("S",activityServicePrice1.doubleValue());
params.put("E",degree.doubleValue());
//支付给流量方的钱
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params));
if(computeType==1){
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
internetCommission = internetCommission.add(eval);
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1.subtract(decimal1));
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(decimal1));
}else if(computeType==2){
internetSvcCommission = internetSvcCommission.add(eval);
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1);
}else{
//电量抽成
internetDegreeCommission = internetDegreeCommission.add(eval);
//减服务费
activityServicePrice =activityServicePrice.add(activityServicePrice1.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPrice1);
}
chargingDegree = chargingDegree.add(degree);
}
}
xhpcHistoryOrder.setActivityId(activityId);
}else{
if(activityStationTime.size()>2){
xhpcHistoryOrder.setActivityId("活动有问题");
}else{
xhpcHistoryOrder.setActivityId("无活动");
}
}
}else{
xhpcHistoryOrder.setActivityId("充电开始结束时间相等不做活动");
}
}
logger.info("<<<<<<<<<<<<<<<<111111>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<111111>>>>>>>>>>>>>>>>>");
//
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
if(UserTypeUtil.COMMUNIT_TYPE.equals(source) || UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
//折扣(机构用户),没有活动时计算
if(xhpcChargeOrder.getChargingStationId()!=null){
R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId(),xhpcChargeOrder.getChargingStationId());
if(mechanismDiscount !=null && mechanismDiscount.getData() !=null) {
Map<String, Object> userDiscount = (Map<String, Object>) mechanismDiscount.getData();
if (userDiscount != null && userDiscount.get("commissionType") != null && userDiscount.get("servicePreferential") != null) {
String commissionType = userDiscount.get("commissionType").toString();
BigDecimal servicePreferential =new BigDecimal(userDiscount.get("servicePreferential").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP);
if(servicePreferential.compareTo(new BigDecimal(0))==1){
if("0".equals(commissionType) || "1".equals(commissionType) || "2".equals(commissionType)){
BigDecimal decimal1 = surplusPowerPrice.multiply(servicePreferential).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal decimal2 = surplusServicePrice.multiply(servicePreferential).setScale(2, BigDecimal.ROUND_HALF_UP);
if("0".equals(commissionType)){
//总金额
actPrice =actPrice.subtract(decimal1.add(decimal2));
//折扣的钱
promotionDiscount = decimal1.add(decimal2);
surplusPowerPrice = surplusPowerPrice.subtract(decimal1);
surplusServicePrice= surplusServicePrice.subtract(decimal2);
}else if("1".equals(commissionType)){
//服务费
if(surplusServicePrice.compareTo(decimal2) > -1){
surplusServicePrice =surplusServicePrice.subtract(decimal2);
actPrice =actPrice.subtract(decimal2);
}else{
promotionDiscount = surplusServicePrice;
actPrice =actPrice.subtract(surplusServicePrice);
surplusServicePrice =new BigDecimal(0);
//查询是否有活动
List<XhpcActivityDiscountDto> activityDiscountTime = xhpcRealTimeOrderMapper.getActivityDiscountTime(userId, DateUtil.formatDateTime(startTime), source, xhpcChargeOrder.getChargingStationId(), xhpcChargeOrder.getTenantId());
if(activityDiscountTime !=null && activityDiscountTime.size()>0){
judge =true;
int size = activityDiscountTime.size();
activityServicePriceTotal = surplusServicePrice;
activityPowerPriceTotal = surplusPowerPrice;
String parse2 = DateUtil.formatDate(startTime);
//折扣电费、服务费
BigDecimal promotionDiscount1 =new BigDecimal(0);
BigDecimal activityServicePrice1 = new BigDecimal(0);
BigDecimal activityPowerPrice1 = new BigDecimal(0);
String activityId ="";
String start = DateUtil.formatTime(startTime);
for (int i = 0; i < size; i++) {
XhpcActivityDiscountDto activity = activityDiscountTime.get(i);
BigDecimal discountRate = activity.getDiscountRate().divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
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;
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<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(start, "00:00:00", xhpcChargeOrder.getRateModelId());
for (int j = 0; j < reatTimeList.size(); j++) {
BigDecimal powerFee = new BigDecimal(0);
BigDecimal serviceFee = new BigDecimal(0);
Map<String, Object> 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 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{
//电量抽成
BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree();
//电量的钱
promotionDiscount = chargingDegree.multiply(new BigDecimal(userDiscount.get("servicePreferential").toString())).setScale(2, BigDecimal.ROUND_HALF_UP);
logger.info("=============电量优惠==="+promotionDiscount);
logger.info("=============服务费==="+surplusServicePrice);
//当电量的折扣大于服务费时,电量==服务费
if(surplusServicePrice.compareTo(promotionDiscount)>-1){
surplusServicePrice= surplusServicePrice.subtract(promotionDiscount);
actPrice =actPrice.subtract(promotionDiscount);
}else{
promotionDiscount = surplusServicePrice;
actPrice =actPrice.subtract(surplusServicePrice);
surplusServicePrice =new BigDecimal(0);
if(promotionDiscount1.compareTo(decimal4)<0){
promotionDiscount1 =decimal4;
activityServicePrice1 = decimal4;
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()+"";
}
}
}
}
}
}
//得到最大的折扣进行计算
promotionDiscount = promotionDiscount1;
activityServicePriceTotal = activityServicePriceTotal.subtract(activityServicePrice1);
activityPowerPriceTotal = activityPowerPriceTotal.subtract(activityPowerPrice1);
activityTotalPriceTotal = money.subtract(promotionDiscount);
actPrice = activityTotalPriceTotal;
activityServicePrice = activityServicePriceTotal;
activityPowerPrice = activityPowerPriceTotal;
activityTotalPriceTotal = activityServicePriceTotal.add(activityPowerPriceTotal);
xhpcHistoryOrder.setActivityId(activityId);
}else{
if(UserTypeUtil.COMMUNIT_TYPE.equals(source) || UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
//折扣(机构用户),没有活动时计算
if(xhpcChargeOrder.getChargingStationId()!=null){
R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId(),xhpcChargeOrder.getChargingStationId());
if(mechanismDiscount !=null && mechanismDiscount.getData() !=null) {
Map<String, Object> userDiscount = (Map<String, Object>) mechanismDiscount.getData();
if (userDiscount != null && userDiscount.get("commissionType") != null && userDiscount.get("servicePreferential") != null) {
String commissionType = userDiscount.get("commissionType").toString();
BigDecimal servicePreferential =new BigDecimal(userDiscount.get("servicePreferential").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP);
if(servicePreferential.compareTo(new BigDecimal(0))==1){
if("0".equals(commissionType) || "1".equals(commissionType) || "2".equals(commissionType)){
BigDecimal decimal1 = surplusPowerPrice.multiply(servicePreferential).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal decimal2 = surplusServicePrice.multiply(servicePreferential).setScale(2, BigDecimal.ROUND_HALF_UP);
if("0".equals(commissionType)){
//总金额
actPrice =actPrice.subtract(decimal1.add(decimal2));
//折扣的钱
promotionDiscount = decimal1.add(decimal2);
surplusPowerPrice = surplusPowerPrice.subtract(decimal1);
surplusServicePrice= surplusServicePrice.subtract(decimal2);
}else if("1".equals(commissionType)){
//服务费
if(surplusServicePrice.compareTo(decimal2) > -1){
surplusServicePrice =surplusServicePrice.subtract(decimal2);
actPrice =actPrice.subtract(decimal2);
promotionDiscount = decimal2;
}else{
promotionDiscount = surplusServicePrice;
actPrice =actPrice.subtract(surplusServicePrice);
surplusServicePrice =new BigDecimal(0);
}
}else{
//电量抽成
BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree();
//电量的钱
promotionDiscount = chargingDegree.multiply(new BigDecimal(userDiscount.get("servicePreferential").toString())).setScale(2, BigDecimal.ROUND_HALF_UP);
logger.info("=============电量优惠==="+promotionDiscount);
logger.info("=============服务费==="+surplusServicePrice);
//当电量的折扣大于服务费时,电量==服务费
if(surplusServicePrice.compareTo(promotionDiscount)>-1){
surplusServicePrice= surplusServicePrice.subtract(promotionDiscount);
actPrice =actPrice.subtract(promotionDiscount);
}else{
promotionDiscount = surplusServicePrice;
actPrice =actPrice.subtract(surplusServicePrice);
surplusServicePrice =new BigDecimal(0);
}
}
}
}
}
@ -549,7 +900,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
}
}
}
}
}
//获取运营商
Map<String, Object> operatorMessage = xhpcChargeOrderService.getOperatorMessage(xhpcChargeOrder.getChargingStationId());
@ -568,39 +918,76 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
BigDecimal maintenanceCommissionRate = new BigDecimal(operatorMessage.get("maintenanceCommissionRate").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP);
//平台提成
BigDecimal platformCommissionRate = new BigDecimal(operatorMessage.get("platformCommissionRate").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP);
//提成类型(0总金额提成 1服务费提成)
if(commissionType==0){
//平台总抽成
BigDecimal multiply1 = surplusPowerPrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//运维总抽成
BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
if(judge){
//提成类型(0总金额提成 1服务费提成)
if(commissionType==0){
//平台总抽成
BigDecimal multiply1 = activityPowerPrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = activityServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//运维总抽成
BigDecimal multiply3 = activityPowerPrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply4 = activityServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//平台总金额抽成
platformCommission = multiply1.add(multiply2);
//剩下的钱电费和服务
surplusPowerPrice = surplusPowerPrice.subtract(multiply1);
surplusServicePrice = surplusServicePrice.subtract(multiply2);
//平台总金额抽成
platformCommission = multiply1.add(multiply2);
//剩下的钱电费和服务
activityPowerPrice = activityPowerPrice.subtract(multiply1);
activityServicePrice = activityServicePrice.subtract(multiply2);
//运维总金额抽成
operationCommission = multiply3.add(multiply4);
//剩下的钱电费和服务
surplusPowerPrice = surplusPowerPrice.subtract(multiply3);
surplusServicePrice = surplusServicePrice.subtract(multiply4);
//运维总金额抽成
operationCommission = multiply3.add(multiply4);
//剩下的钱电费和服务
activityPowerPrice = activityPowerPrice.subtract(multiply3);
activityServicePrice = activityServicePrice.subtract(multiply4);
}else if(commissionType==1){
BigDecimal multiply1 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//平台服务费抽成金额
platformSvcCommission=multiply1;
//剩下的服务费钱
surplusServicePrice = surplusServicePrice.subtract(multiply1);
}else if(commissionType==1){
BigDecimal multiply1 = activityServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = activityServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//平台服务费抽成金额
platformSvcCommission=multiply1;
//剩下的服务费钱
activityServicePrice = activityServicePrice.subtract(multiply1);
//运维服务费抽成金额
operationCommission = multiply2;
//剩下的钱
surplusServicePrice = surplusServicePrice.subtract(multiply2);
//运维服务费抽成金额
operationCommission = multiply2;
//剩下的钱
activityServicePrice = activityServicePrice.subtract(multiply2);
}
}else{
//提成类型(0总金额提成 1服务费提成)
if(commissionType==0){
//平台总抽成
BigDecimal multiply1 = surplusPowerPrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//运维总抽成
BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//平台总金额抽成
platformCommission = multiply1.add(multiply2);
//剩下的钱电费和服务
surplusPowerPrice = surplusPowerPrice.subtract(multiply1);
surplusServicePrice = surplusServicePrice.subtract(multiply2);
//运维总金额抽成
operationCommission = multiply3.add(multiply4);
//剩下的钱电费和服务
surplusPowerPrice = surplusPowerPrice.subtract(multiply3);
surplusServicePrice = surplusServicePrice.subtract(multiply4);
}else if(commissionType==1){
BigDecimal multiply1 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_HALF_UP);
//平台服务费抽成金额
platformSvcCommission=multiply1;
//剩下的服务费钱
surplusServicePrice = surplusServicePrice.subtract(multiply1);
//运维服务费抽成金额
operationCommission = multiply2;
//剩下的钱
surplusServicePrice = surplusServicePrice.subtract(multiply2);
}
}
if("微信".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("微信");
@ -623,7 +1010,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
logger.info("<<<<<<<<<<<<<<<<22222>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<22222>>>>>>>>>>>>>>>>>");
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
xhpcHistoryOrder.setStopReasonEvcs(xhpcChargeOrder.getType());
xhpcHistoryOrder.setChargeOrderId(chargeOrderId);
xhpcHistoryOrder.setChargingStationId(xhpcChargeOrder.getChargingStationId());
xhpcHistoryOrder.setUserId(userId);
@ -635,18 +1022,24 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
}else{
xhpcHistoryOrder.setChargeModelEvcs(xhpcChargeOrder.getChargeModelEvcs());
}
xhpcHistoryOrder.setStopReasonEvcs(xhpcChargeOrder.getStopReasonEvcs());
xhpcHistoryOrder.setSerialNumber(xhpcChargeOrder.getSerialNumber());
xhpcHistoryOrder.setRateModelId(xhpcChargeOrder.getRateModelId());
xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc());
xhpcHistoryOrder.setReconciliationStatus(0);
xhpcHistoryOrder.setSortingStatus(0);
//订单总价---运维服务费抽成
xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_HALF_UP));
if(judge){
xhpcHistoryOrder.setActivityTotalPrice(activityTotalPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActivityPowerPriceTotal(activityPowerPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActivityServicePriceTotal(activityServicePriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPrice(activityTotalPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPowerPrice(activityPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActServicePrice(activityServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP));
}else{
xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP));
}
xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetDegreeCommission(internetDegreeCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
@ -727,43 +1120,43 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
public void run() {
try{
logger.info("<<<<<<<<<<<<<<<<进行入短信发送>>>>>>>>>>>>>>>>>");
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
if(userMessage !=null && userMessage.get("phone") != null){
if("1".equals(xhpcChargingPile.get("type").toString())){
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
paramMap.put("sumMoney", balance.toString());
paramMap.put("phone", userMessage.get("phone").toString());
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询小华充电小程序,谢谢。");
smsService.sendNotice(paramMap);
}else {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("sumMoney", balance.toString());
paramMap.put("phone", userMessage.get("phone").toString());
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + balance.toString() + "元,充电费用明细,请查询小华充电小程序,谢谢。");
smsService.sendNotice(paramMap);
}
}
}
// if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
// if(userMessage !=null && userMessage.get("phone") != null){
// if("1".equals(xhpcChargingPile.get("type").toString())){
// HashMap<String, String> paramMap = new HashMap<>();
// paramMap.put("elec", xhpcChargeOrder.getEndSoc());
// paramMap.put("sumMoney", balance.toString());
// paramMap.put("phone", userMessage.get("phone").toString());
// paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询小华充电小程序,谢谢。");
// smsService.sendNotice(paramMap);
// }else {
// HashMap<String, String> paramMap = new HashMap<>();
// paramMap.put("sumMoney", balance.toString());
// paramMap.put("phone", userMessage.get("phone").toString());
// paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + balance.toString() + "元,充电费用明细,请查询小华充电小程序,谢谢。");
// smsService.sendNotice(paramMap);
// }
// }
// }
}catch (Exception e){
logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>");
}
addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
try{
//充电结算后自动申请退款
if(userMessage !=null && "1".equals(userMessage.get("isRefund").toString()) && map !=null){
if(UserTypeUtil.CHARGING_MODE_WX.equals(xhpcChargeOrder.getChargingMode()) ||UserTypeUtil.CHARGING_MODE_ZFB.equals(xhpcChargeOrder.getChargingMode()) ){
if(UserTypeUtil.USER_TYPE.equals(source) || UserTypeUtil.COMMUNIT_TYPE.equals(source)){
refundOrderService.sendNotice(balance2,openids,xhpcChargeOrder.getSource(),refundTypes,xhpcChargeOrder.getUserId().toString(),xhpcChargeOrder.getTenantId(),"充电结算自动申请退款");
}
}
}
}catch (Exception e){
e.printStackTrace();
logger.info("<<<<<<<<<<<<<<<<自动退款失败>>>>>>>>>>>>>>>>>");
}
}
// if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
// try{
// //充电结算后自动申请退款
// if(userMessage !=null && "1".equals(userMessage.get("isRefund").toString()) && map !=null){
// if(UserTypeUtil.CHARGING_MODE_WX.equals(xhpcChargeOrder.getChargingMode()) ||UserTypeUtil.CHARGING_MODE_ZFB.equals(xhpcChargeOrder.getChargingMode()) ){
// if(UserTypeUtil.USER_TYPE.equals(source) || UserTypeUtil.COMMUNIT_TYPE.equals(source)){
// refundOrderService.sendNotice(balance2,openids,xhpcChargeOrder.getSource(),refundTypes,xhpcChargeOrder.getUserId().toString(),xhpcChargeOrder.getTenantId(),"充电结算自动申请退款");
// }
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// logger.info("<<<<<<<<<<<<<<<<自动退款失败>>>>>>>>>>>>>>>>>");
// }
// }
}
});
}catch (Exception e){
@ -1040,7 +1433,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
xhpcHistoryOrder.setEndTime(xhpcChargeOrder.getStartTime());
}
xhpcHistoryOrder.setStopReasonEvcs(45);
xhpcHistoryOrder.setStopReasonEvcs("平台停止");
if(UserTypeUtil.COMMUNIT_TYPE.equals(xhpcChargeOrder.getSource()) || UserTypeUtil.CUSTOMERS_TYPE.equals(xhpcChargeOrder.getSource())){
xhpcHistoryOrder.setChargeModelEvcs(2);
}else{
@ -1088,4 +1481,31 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
return bigDecimal;
}
private BigDecimal getRealOrderTime(Long chargingOrderId,String startTime,String endTime){
//结束时间差时间
int differenceEndTime = xhpcRealTimeOrderMapper.getDifferenceTime(chargingOrderId, endTime);
double endTimeChargingDegree =0.0;
if(differenceEndTime>0){
//时间差度数
double chargingDegreeTime = xhpcRealTimeOrderMapper.getChargingDegreeTime(chargingOrderId, endTime);
endTimeChargingDegree = differenceEndTime*chargingDegreeTime/15;
}
//开始时间差度数
int differenceStartTime = xhpcRealTimeOrderMapper.getDifferenceTime(chargingOrderId, startTime);
double startTimeChargingDegree =0.0;
if(differenceStartTime>0){
//时间差度数
double chargingDegreeTime = xhpcRealTimeOrderMapper.getChargingDegreeTime(chargingOrderId, startTime);
startTimeChargingDegree = differenceStartTime*chargingDegreeTime/15;
}
double realTimeOrderTime = xhpcRealTimeOrderMapper.getRealTimeOrderTime(chargingOrderId, startTime, endTime);
BigDecimal chargingDegree = new BigDecimal(realTimeOrderTime+endTimeChargingDegree-startTimeChargingDegree).setScale(2,BigDecimal.ROUND_HALF_UP);
return chargingDegree;
}
}

View File

@ -337,6 +337,37 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
}
}
/**
* 电桩列表
*
* @param request
* @param chargingStationId
* @param operatorId 运营商id
* @param userId 用户id
* @param type 1 平台 2 运营商 3流量方
* @return
*/
@Override
public AjaxResult getChargingPileList(HttpServletRequest request, Long chargingStationId, Long operatorId, Long userId, Integer type) {
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
//获取登陆用户
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, logOperatorId, 1,tenantId));
}else{
//查询赋值的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 2,tenantId));
}
}else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 0,tenantId));
}
}
@Override
public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, Long userId, Integer type) {
//获取登陆用户
@ -427,7 +458,23 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId);
List<Map<String, Object>> list =new ArrayList<>();
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
startPage();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,logOperatorId,1);
}else{
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,sysUserId,2);
}
}else{
startPage();
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,sysUserId,0);
}
return list;
}
@ -981,8 +1028,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
* @param chargingPileId
*/
@Override
public Map<String, Object> getToday(Long operatorId, Long chargingStationId, Long chargingPileId) {
public Map<String, Object> getToday(Long operatorId, Long chargingStationId, Long chargingPileId,Integer type) {
//* 今日订单量、今日订电量、今日营收、今日充电枪状态
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
Long logUserId = SecurityUtils.getUserId();
@ -1001,8 +1048,6 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
if ("01".equals(sysUser.getUserType())) {
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
//---------------------------
//今日订单量
extracted(1,operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, lastBeginOfDay, lastEndOfDay, weekBeginOfDay, weekEndOfDay, map, logOperatorId);
//今日电量
@ -1011,8 +1056,6 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
//今日营收
extracted(1,operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, map, logOperatorId);
}else{
//查询赋值的场站
//--------
//今日订单量
extracted(2,operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, lastBeginOfDay, lastEndOfDay, weekBeginOfDay, weekEndOfDay, map, logUserId);
//今日电量
@ -1093,8 +1136,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
String conditionBeginOfDay = null;
String conditionEndOfDay = null;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(type==null || type ==1){d:
if(type==null || type ==1){
conditionBeginOfDay = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -30));
conditionEndOfDay = DateUtil.formatDateTime(endOfDay);
}else if(type ==2){
@ -1233,26 +1275,107 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
private void extracted(Integer status,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId, String beginOfDay, String endOfDay, Map<String, Object> map, Long logOperatorId) {
double t1 = xhpcStatisticsServiceMapper.getTodayAmount(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
double t2 = xhpcStatisticsServiceMapper.getTodayAmount(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.parse(beginOfDay), -1)), DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.parse(endOfDay), -1)));
BigDecimal divide1 = new BigDecimal(t1 - t2).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
BigDecimal divide2 = new BigDecimal(t2 - t1).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
Map<String, Object> map1 =new HashMap<>();
map1.put("todayAmount",t1);
map1.put("yesterdayAmount",t2);
map1.put("weekNumber",t1-t2>0?divide1:divide2);
map1.put("type", t1 - t2 > 0);
map.put("todayAmount", map1);
if(t1==0.0 && t2==0.0){
map1.put("todayAmount",0);
map1.put("yesterdayAmount",0);
map1.put("weekNumber",0);
map1.put("type",true);
map.put("todayAmount", map1);
}else if (t1==0.0){
BigDecimal divide2 = new BigDecimal(t2 - t1).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
map1.put("todayAmount",0);
map1.put("yesterdayAmount",t2);
map1.put("weekNumber",divide2);
map1.put("type",false);
map.put("todayAmount", map1);
}else if(t2==0.0){
BigDecimal divide1 = new BigDecimal(t1 - t2).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
map1.put("todayAmount",t1);
map1.put("yesterdayAmount",0);
map1.put("weekNumber",divide1);
map1.put("type",true);
map.put("todayAmount", map1);
}else{
BigDecimal divide1 = new BigDecimal(t1 - t2).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
BigDecimal divide2 = new BigDecimal(t2 - t1).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
map1.put("todayAmount",t1);
map1.put("yesterdayAmount",t2);
map1.put("weekNumber",t1-t2>0?divide1:divide2);
map1.put("type",t1-t2>0?true:false);
map.put("todayAmount", map1);
}
}
private void extracted(Integer status, Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId, String beginOfDay, String endOfDay, String lastBeginOfDay, String lastEndOfDay, String weekBeginOfDay, String weekEndOfDay, Map<String, Object> map, Long logOperatorId) {
List<Map<String,Object>> list = xhpcStatisticsServiceMapper.getTodayStatusNUmber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
List<Map<String,Object>> list = xhpcStatisticsServiceMapper.getTodayStatusNumber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
int todayOrderCount = xhpcStatisticsServiceMapper.getTodayOrderNumber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
int t1 = xhpcStatisticsServiceMapper.getTodayNUmber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, lastBeginOfDay, lastEndOfDay);
int t2 = xhpcStatisticsServiceMapper.getTodayNUmber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, weekBeginOfDay, weekEndOfDay);
Map<String,Object> todayStatusNUmber = new HashMap<>();
BigDecimal divide1 = new BigDecimal(t1 - t2).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
BigDecimal divide2 = new BigDecimal(t2 - t1).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
todayStatusNUmber.put("weekNumber",t1-t2>0?divide1:divide2);
todayStatusNUmber.put("type", t1 - t2 > 0);
map.put("todayOrder",list);
if(t1==0.0 && t2==0.0){
todayStatusNUmber.put("weekNumber",0);
todayStatusNUmber.put("type",true);
}else if (t1==0.0){
BigDecimal divide2 = new BigDecimal(t2).multiply(new BigDecimal(100));
todayStatusNUmber.put("weekNumber",divide2);
todayStatusNUmber.put("type",false);
}else if(t2==0.0){
todayStatusNUmber.put("weekNumber",100);
todayStatusNUmber.put("type",true);
}else{
BigDecimal divide1 = new BigDecimal(t1 - t2).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
BigDecimal divide2 = new BigDecimal(t2 - t1).divide(new BigDecimal(t1),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
todayStatusNUmber.put("weekNumber",t1-t2>0?divide1:divide2);
todayStatusNUmber.put("type",t1-t2>0?true:false);
}
if(list ==null || list.size()==0){
List<Map<String,Object>> mapList =new ArrayList<>();
Map<String,Object> objectMap =new HashMap<>();
objectMap.put("name","无效订单");
objectMap.put("value",0);
mapList.add(objectMap);
List<Map<String,Object>> mapList1 =new ArrayList<>();
Map<String,Object> objectMap1 =new HashMap<>();
objectMap1.put("name","充电中订单");
objectMap1.put("value",0);
mapList1.add(objectMap1);
mapList.addAll(mapList1);
List<Map<String,Object>> mapList2 =new ArrayList<>();
Map<String,Object> objectMap2 =new HashMap<>();
objectMap2.put("name","自动结算订单");
objectMap2.put("value",0);
mapList2.add(objectMap2);
mapList.addAll(mapList2);
List<Map<String,Object>> mapList3 =new ArrayList<>();
Map<String,Object> objectMap3 =new HashMap<>();
objectMap3.put("name","异常订单");
objectMap3.put("value",0);
mapList3.add(objectMap3);
mapList.addAll(mapList3);
List<Map<String,Object>> mapList4 =new ArrayList<>();
Map<String,Object> objectMap4 =new HashMap<>();
objectMap4.put("name","平台结算订单");
objectMap4.put("value",0);
mapList4.add(objectMap4);
mapList.addAll(mapList4);
List<Map<String,Object>> mapList5 =new ArrayList<>();
Map<String,Object> objectMap5 =new HashMap<>();
objectMap5.put("name","其他订单");
objectMap5.put("value",0);
mapList5.add(objectMap5);
mapList.addAll(mapList5);
map.put("todayOrder",mapList);
}else{
map.put("todayOrder",list);
}
map.put("todayOrderCount",todayOrderCount);
map.put("todayOrderWeek",todayStatusNUmber);
}
@ -1363,25 +1486,4 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
return c;
}
public static void main(String[] args) {
String firstDay;
String lastDay;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal_1=Calendar.getInstance();//获取当前日期
cal_1.add(Calendar.MONTH, -12);
cal_1.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
firstDay = format.format(cal_1.getTime());
System.out.println("-----1------firstDay:"+firstDay);
//获取前月的最后一天
Calendar cale = Calendar.getInstance();
cale.set(Calendar.DAY_OF_MONTH,0);//设置为1号,当前日期既为本月第一天
lastDay = format.format(cale.getTime());
System.out.println("-----2------lastDay:"+lastDay);
}
}

View File

@ -15,6 +15,9 @@
<result column="power_price_total" jdbcType="DECIMAL" property="powerPriceTotal"/>
<result column="service_price_total" jdbcType="DECIMAL" property="servicePriceTotal"/>
<result column="total_price" jdbcType="DECIMAL" property="totalPrice"/>
<result column="activity_power_price_total" jdbcType="DECIMAL" property="activityPowerPriceTotal"/>
<result column="activity_service_price_total" jdbcType="DECIMAL" property="activityServicePriceTotal"/>
<result column="activity_total_price" jdbcType="DECIMAL" property="activityTotalPrice"/>
<result column="promotion_discount" jdbcType="DECIMAL" property="promotionDiscount"/>
<result column="act_price" jdbcType="DECIMAL" property="actPrice"/>
<result column="act_power_price" jdbcType="DECIMAL" property="actPowerPrice"/>
@ -55,6 +58,7 @@
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="internet_degree_commission" jdbcType="DECIMAL" property="internetDegreeCommission"/>
<result column="source" jdbcType="INTEGER" property="source"/>
<result column="activity_id" jdbcType="VARCHAR" property="activityId"/>
</resultMap>
<sql id="Base_Column_List">
history_order_id, charging_station_id, charge_order_id, user_id, terminal_id, serial_number,
@ -221,6 +225,18 @@
<if test="internetDegreeCommission != null">
internet_degree_commission,
</if>
<if test="activityPowerPriceTotal != null">
activity_power_price_total,
</if>
<if test="activityServicePriceTotal != null">
activity_service_price_total,
</if>
<if test="activityTotalPrice != null">
activity_total_price,
</if>
<if test="activityId != null and activityId !=''">
activity_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">
@ -373,6 +389,18 @@
<if test="internetDegreeCommission != null">
#{internetDegreeCommission},
</if>
<if test="activityPowerPriceTotal != null">
#{activityPowerPriceTotal},
</if>
<if test="activityServicePriceTotal != null">
#{activityServicePriceTotal},
</if>
<if test="activityTotalPrice != null">
#{activityTotalPrice},
</if>
<if test="activityId != null and activityId !=''">
#{activityId},
</if>
</trim>
</insert>
@ -583,18 +611,7 @@
DATE_FORMAT(ho.end_time,'%H:%i:%s') as timeTwo,
co.status as status,
co.type as type,
case when co.type=40 then "APP远程停止"
when co.type=41 then "SOC达到100%"
when co.type=42 then "充电电量满足设定条件"
when co.type=43 then "充电金额满足设定条件"
when co.type=44 then "充电时间满足设定条件"
when co.type=45 then "手动停止充电"
when co.type=46 then "手动停止充电."
when co.type=47 then "手动停止充电.."
when co.type=48 then "急停停止充电"
when co.type=49 then "手动停止充电..."
else "手动停止充电!"
end typeName
ho.StopReasonEvcs as typeName
FROM xhpc_history_order as ho
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
@ -640,7 +657,7 @@
ho.act_price as actPrice,
ho.confirm_Result as confirmResult,
co.charging_time as chargingTime,
co.charging_degree as chargingDegree,
ho.total_power as chargingDegree,
co.start_time as startTime,
co.end_time as endTime,
co.update_time as updateTime,
@ -805,11 +822,11 @@
from xhpc_rate_time as rt
left join xhpc_rate ra on rt.rate_id =ra.rate_id
WHERE
rt.rate_time_id &gt;= (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime}
rt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime} AND del_flag=0
)
AND rt.rate_time_id &lt;= (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime}
AND rt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime} AND del_flag=0
)
</select>
@ -862,18 +879,7 @@
(SELECT account from xhpc_customers_personnel where customers_personnel_id = co.user_id and ho.source=3) as customersAccount,
co.Plate_num as plateNum,
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source =1) as internetName,
case when ho.stop_reason_evcs=40 then "APP远程停止"
when ho.stop_reason_evcs=41 then "SOC达到100%"
when ho.stop_reason_evcs=42 then "充电电量满足设定条件"
when ho.stop_reason_evcs=43 then "充电金额满足设定条件"
when ho.stop_reason_evcs=44 then "充电时间满足设定条件"
when ho.stop_reason_evcs=45 then "手动停止充电"
when ho.stop_reason_evcs=46 then "手动停止充电."
when ho.stop_reason_evcs=47 then "手动停止充电.."
when ho.stop_reason_evcs=48 then "急停停止充电"
when ho.stop_reason_evcs=49 then "手动停止充电..."
else "手动停止充电!"
end stopReasonRvcsName
ho.StopReasonEvcs as stopReasonRvcsName
from xhpc_history_order ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
@ -947,30 +953,7 @@
co.type AS type,
cs. NAME AS chargingStationName,
te. NAME AS terminalName,
CASE
WHEN co.type = 40 THEN
"APP远程停止"
WHEN co.type = 41 THEN
"SOC达到100%"
WHEN co.type = 42 THEN
"充电电量满足设定条件"
WHEN co.type = 43 THEN
"充电金额满足设定条件"
WHEN co.type = 44 THEN
"充电时间满足设定条件"
WHEN co.type = 45 THEN
"手动停止充电"
WHEN co.type = 46 THEN
"手动停止充电."
WHEN co.type = 47 THEN
"手动停止充电.."
WHEN co.type = 48 THEN
"急停停止充电"
WHEN co.type = 49 THEN
"手动停止充电..."
ELSE
"手动停止充电!"
END typeName
co.type as typeName
from xhpc_charge_order co
LEFT JOIN xhpc_terminal AS te ON te.terminal_id = co.terminal_id
LEFT JOIN xhpc_charging_station AS cs ON cs.charging_station_id = co.charging_station_id
@ -1128,7 +1111,7 @@
where internet_serial_number = #{internetSerialNumber}
</update>
<select id="getHistoryOrderById" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
<select id="getHistoryOrderById" resultType="com.xhpc.order.domain.XhpcHistoryOrder">
select * from xhpc_history_order where history_order_id=#{historyOrderId}
</select>
</mapper>

View File

@ -649,6 +649,55 @@
limit 1
</select>
<select id="getRealTimeOrderTime" resultType="double">
select IFNULL((
(SELECT
max(charging_degree)
FROM
xhpc_real_time_order
WHERE
charging_order_id =#{chargingOrderId}
and create_time &lt;=#{endTime} )-(SELECT
min(charging_degree)
FROM
xhpc_real_time_order
WHERE
charging_order_id =#{chargingOrderId}
and create_time &gt;=#{startTime})),0) number from xhpc_real_time_order WHERE
charging_order_id =#{chargingOrderId}
limit 1
</select>
<select id="getDifferenceTime" resultType="int">
SELECT IFNULL(TIMESTAMPDIFF(SECOND,
(SELECT
max(create_time)
FROM
xhpc_real_time_order
WHERE
charging_order_id =#{chargingOrderId}
and create_time &lt;=#{time} ),
#{time}
),0) time from xhpc_real_time_order WHERE charging_order_id =#{chargingOrderId} limit 1
</select>
<select id="getChargingDegreeTime" resultType="double">
SELECT IFNULL((SELECT
min(charging_degree)
FROM
xhpc_real_time_order
WHERE
charging_order_id =#{chargingOrderId}
and create_time &gt;=#{time} )-
(SELECT
max(charging_degree)
FROM
xhpc_real_time_order
WHERE
charging_order_id =#{chargingOrderId}
and create_time &lt;=#{time} ),0)time from xhpc_real_time_order WHERE charging_order_id =#{chargingOrderId} limit 1
</select>
<select id="getChargeOrderById" resultType="map">
select
co.serial_number as serialNumber,
@ -689,4 +738,87 @@
from xhpc_internet_user
where del_flag =0 and operator_id_evcs=#{operatorIdEvcs} limit 1
</select>
<select id="getActivityFormulaTime" resultType="com.xhpc.order.dto.XhpcActivityFormulaDomainDto">
select
activity_formula_id as activityFormulaId,
activity_id as activityId,
start_time as startTime,
end_time as endTime,
service_price as servicePrice,
power_price as powerPrice,
compute_formula as computeFormula
from xhpc_activity_formula
where
activity_id = #{activityId}
and activity_formula_id &gt;= (SELECT activity_formula_id FROM xhpc_activity_formula WHERE start_time &lt;= #{startTime} AND end_time &gt;= #{startTime} and activity_id = #{activityId})
and activity_formula_id &lt;= (SELECT activity_formula_id FROM xhpc_activity_formula WHERE start_time &lt;= #{endTime} AND end_time &gt;= #{endTime} and activity_id = #{activityId})
order by activity_formula_id
</select>
<select id="getActivityStationTime" resultType="com.xhpc.order.dto.XhpcActivityInternetDomainDto" >
select
activity_id as activityId,
activity_name as activityName,
internet_name as internetName,
compute_type as computeType,
service_price as servicePrice,
compute_formula as computeFormula,
start_time as startTime,
end_time as endTime,
station_list as stationList,
tenant_id as tenantId,
`status`,
del_flag as delFlag
from xhpc_activity_internet
where tenant_id =#{tenantId}
and find_in_set(#{chargingStationId}, station_list)
and internet_name = (select name from xhpc_internet_user where internet_user_id =#{internetUserId} and del_flag =0)
and status =3 and del_flag=0
and activity_id in (
SELECT activity_id FROM xhpc_activity_internet WHERE start_time &lt;= #{startTime} AND end_time &gt;= #{startTime} and status =3 and del_flag=0)
or activity_id in (
SELECT activity_id FROM xhpc_activity_internet WHERE start_time &lt;= #{endTime} AND end_time &gt;= #{endTime} and status =3 and del_flag=0)
order by end_time
</select>
<select id="getActivityDiscountTime" resultType="com.xhpc.order.dto.XhpcActivityDiscountDto">
select
xad.activity_id as activityId,
xad.activity_name as activityName,
xad.template_id as templateId,
xad.app_user_list as appUserList,
xad.com_user_list as comUserList,
xad.cus_user_list as cusUserList,
xad.station_list as stationList,
xad.tenant_id as tenantId,
xad.start_time as startTime,
xad.end_time as endTime,
xad.status as status,
xad.del_flag as delFlag,
xad.create_by as createBy,
xad.create_time as createTime,
xad.update_by as updateBy,
xad.update_time as updateTime,
xad.check_by as checkBy,
xad.check_time as checkTime,
xat.discount_type discountType,
xat.discount_rate discountRate
from xhpc_activity_discount as xad
join xhpc_activity_template as xat on xat.activity_template_id = xad.template_id and xat.del_flag =0 and xat.status=1
where xad.tenant_id=#{tenantId} and xad.status=3 and xad.del_flag =0
and find_in_set(#{chargingStationId}, xad.station_list)
<if test="userType ==0">
and (find_in_set(#{internetUserId}, xad.app_user_list) or xad.app_user_list='-1')
</if>
<if test="userType ==2">
and (find_in_set(#{internetUserId}, xad.com_user_list) or xad.app_user_list='-1')
</if>
<if test="userType ==3">
and (find_in_set(#{internetUserId}, xad.cus_user_list) or xad.app_user_list='-1')
</if>
and xad.start_time &lt;=#{startTime} and xad.end_time &gt; #{startTime}
order by xad.start_time asc
</select>
</mapper>

View File

@ -83,7 +83,7 @@
when status=24 then "23:00-24:00"
end time
from xhpc_statistics_time_interval
where del_flag=0
where del_flag=0 and total_price &gt;=0
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
and charging_station_id in
<foreach collection="chargingStationIds" open="(" item="chargingStationId" separator="," close=")" >
@ -131,7 +131,7 @@
format(sum(act_power_price + act_service_price), 2) actTotalPrice,
DATE_FORMAT(create_time,'%Y-%m-%d') createTime
from xhpc_statistics_station
where del_flag=0 and type=1
where del_flag=0 and type=1 and total_price &gt;=0
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
and charging_station_id in
<foreach collection="chargingStationIds" open="(" item="chargingStationId" separator="," close=")" >
@ -183,7 +183,7 @@
from xhpc_statistics_station as ss
left join xhpc_charging_station as cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator as op on op.operator_id = ss.operator_id
where ss.del_flag=0 and ss.type=2
where ss.del_flag=0 and ss.type=2 and ss.total_price &gt;=0
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
@ -238,7 +238,7 @@
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
from xhpc_statistics_station as ss
left join xhpc_operator as op on op.operator_id = ss.operator_id
where ss.del_flag=0 and ss.type=2
where ss.del_flag=0 and ss.type=2 and ss.total_price &gt;=0
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
@ -286,7 +286,7 @@
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
from xhpc_statistics_station as ss
left join xhpc_internet_user as iu on iu.internet_user_id = ss.internet_user_id
where ss.del_flag=0 and ss.type=2 and ss.internet_user_id is not null
where ss.del_flag=0 and ss.type=2 and ss.internet_user_id is not null and ss.total_price &gt;=0
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
@ -334,7 +334,7 @@
from xhpc_statistics_station as ss
left join xhpc_charging_station as cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_terminal as te on te.terminal_id = ss.terminal_id
where ss.del_flag=0 and ss.type=3
where ss.del_flag=0 and ss.type=3 and ss.total_price &gt;=0
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
@ -376,6 +376,27 @@
</if>
</select>
<select id="getChargingPileList" resultType="map">
select
concat(cp.name,"号桩--",cs.name) as chargingPileName,
cp.charging_pile_id as chargingPileId
from xhpc_charging_pile as cp
left join xhpc_charging_station cs on cs.charging_station_id = cp.charging_station_id
where 1=1
<if test="type==1">
and cp.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="type==2">
and cp.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
<if test="tenantId !=null and tenantId !=''">
and cp.tenant_id = #{tenantId}
</if>
<if test="chargingStationId !=null">
and cp.charging_station_id = #{chargingStationId}
</if>
order by cp.serial_number asc
</select>
<select id="getOperatorList" resultType="map">
select
@ -922,6 +943,12 @@
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
<if test="number==1">
and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="number==2">
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
and ss.charging_mode is not null
group by ss.charging_mode
</select>
@ -933,7 +960,7 @@
select count(statistics_station_id) from xhpc_statistics_station where history_order_id=#{historyOrderId} and type=#{type}
</select>
<select id="getTodayStatusNUmber" resultType="map">
<select id="getTodayStatusNumber" resultType="map">
SELECT
COUNT(status) value,
case when status=-1 then "无效订单"
@ -968,6 +995,34 @@
group by status
</select>
<select id="getTodayOrderNumber" resultType="int">
SELECT
COUNT(charge_order_id) number
FROM
xhpc_charge_order
WHERE
create_time &gt;=#{beginOfDay} and create_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
<if test="chargingStationId !=null">
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getTodayNUmber" resultType="int">
SELECT
COUNT(charge_order_id) number
@ -997,7 +1052,7 @@
<select id="getTodayDegreeNUmber" resultType="int">
SELECT
sum(total_power) number
IFNULL(sum(total_power),0) number
FROM
xhpc_history_order
WHERE
@ -1098,7 +1153,7 @@
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and charging_pile_id=#{chargingPileId}
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
@ -1113,7 +1168,7 @@
<select id="getDateOrderNUmber" resultType="int">
select
sum(total_power) totalPower
IFNULL(sum(total_power),0) totalPower
from xhpc_history_order
where end_time &gt;=#{beginOfDay} and end_time &lt;= #{endOfDay}
<if test="operatorId !=null and ''!=operatorId">
@ -1126,7 +1181,7 @@
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and charging_pile_id=#{chargingPileId}
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
@ -1157,7 +1212,7 @@
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and charging_pile_id=#{chargingPileId}
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
@ -1184,7 +1239,7 @@
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and charging_pile_id=#{chargingPileId}
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})

View File

@ -76,7 +76,7 @@ public class AlipayPaymentController {
private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class);
@Log(title = "支付宝-支付", businessType = BusinessType.INSERT)
@NoRepeatSubmit
@NoRepeatSubmit(lockTime = 3)
@PostMapping("/payment")
@ApiOperation(value = "支付宝支付")
public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
@ -92,6 +92,9 @@ public class AlipayPaymentController {
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
}
if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
}
}
//用户信息id
String userId = StringUtils.valueOf(map.get("userId"));
@ -104,7 +107,7 @@ public class AlipayPaymentController {
Integer userType = loginUser.getUserType();
String tenantId = loginUser.getTenantId();
if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持充值");
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持充值,请让管理员在平台充值");
}
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);
if (StringUtils.isNotNull(refundOrder)) {

View File

@ -78,7 +78,7 @@ public class WxPaymentController {
private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class);
@Log(title = "微信-支付", businessType = BusinessType.INSERT)
@NoRepeatSubmit
@NoRepeatSubmit(lockTime = 3)
@PostMapping("/payment")
@ApiOperation(value = "微信支付")
public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
@ -94,6 +94,9 @@ public class WxPaymentController {
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
}
if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
}
}
//用户信息id
if(map.get("userId") ==null || "".equals(map.get("userId").toString())){
@ -107,7 +110,7 @@ public class WxPaymentController {
String tenantId = loginUser.getTenantId();
if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持充值");
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持充值,请让管理员在平台充值");
}
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);