1.运营区增加字段
2.预约费,调度费等参数在运营区中查询
This commit is contained in:
parent
1ff1327d28
commit
d7c391c4bb
|
@ -67,7 +67,7 @@ public class AppVerifyController extends BaseController
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysConfigService sysConfigService;
|
private IEtOperatingAreaService etOperatingAreaService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,7 +235,8 @@ public class AppVerifyController extends BaseController
|
||||||
throw new ServiceException("提现失败,用户还有未完成订单");
|
throw new ServiceException("提现失败,用户还有未完成订单");
|
||||||
}
|
}
|
||||||
EtOrder etOrder1 = etOrders.get(0);
|
EtOrder etOrder1 = etOrders.get(0);
|
||||||
BigDecimal deposit = new BigDecimal(sysConfigService.selectConfigByKey("deposit"));//押金
|
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etOrder1.getAreaId());
|
||||||
|
BigDecimal deposit = new BigDecimal(area.getDeposit());
|
||||||
if(deposit.compareTo(etOrder1.getTotalFee())!=0){
|
if(deposit.compareTo(etOrder1.getTotalFee())!=0){
|
||||||
throw new ServiceException("订单充值金额与系统押金不相等");
|
throw new ServiceException("订单充值金额与系统押金不相等");
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.ruoyi.common.mybatis.MyGeometryTypeHandler;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,4 +135,20 @@ public class EtOperatingArea implements Serializable
|
||||||
|
|
||||||
@Excel(name = "超出电子围栏多少时长断电(s)")
|
@Excel(name = "超出电子围栏多少时长断电(s)")
|
||||||
private Integer outage;
|
private Integer outage;
|
||||||
|
|
||||||
|
/** 预约服务费 */
|
||||||
|
private BigDecimal appointmentServiceFee;
|
||||||
|
|
||||||
|
/** 调度费 */
|
||||||
|
private BigDecimal dispatchFee;
|
||||||
|
|
||||||
|
/** 管理费*/
|
||||||
|
private BigDecimal vehicleManagementFee;
|
||||||
|
|
||||||
|
/** 预约超时保留分钟*/
|
||||||
|
private Integer timeoutMinutes;
|
||||||
|
|
||||||
|
/** 电量低于多少值自动生成换电订单*/
|
||||||
|
private Integer autoReplacementOrder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,10 +137,17 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
// JSONObject data =jsonObject.getJSONObject("data");
|
// JSONObject data =jsonObject.getJSONObject("data");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
Long areaId = asDevice.getAreaId();
|
||||||
|
EtOperatingArea etOperatingArea;
|
||||||
|
if (ObjectUtil.isNotNull(areaId)) {
|
||||||
|
etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||||
|
}else{
|
||||||
|
throw new ServiceException("区域信息不存在");
|
||||||
|
}
|
||||||
/** TODO 电量低于系统设置值时,自动生成换电工单 唯一 */
|
/** TODO 电量低于系统设置值时,自动生成换电工单 唯一 */
|
||||||
String replacementOrder = sysConfigService.selectConfigByKey("auto.replacement.order");//车辆里程数
|
Integer replacementOrder = etOperatingArea.getAutoReplacementOrder();
|
||||||
Boolean aBoolean = etAdminOrderService.checkOrderUnique(asDevice.getSn());
|
Boolean aBoolean = etAdminOrderService.checkOrderUnique(asDevice.getSn());
|
||||||
if (Integer.parseInt(asDevice.getRemainingPower()) < Integer.parseInt(replacementOrder) && !aBoolean) {
|
if (Integer.parseInt(asDevice.getRemainingPower()) < replacementOrder && !aBoolean) {
|
||||||
Boolean execute = transactionTemplate.execute(e -> {
|
Boolean execute = transactionTemplate.execute(e -> {
|
||||||
/** 生成换电工单 */
|
/** 生成换电工单 */
|
||||||
EtAdminOrder adminOrder = new EtAdminOrder();
|
EtAdminOrder adminOrder = new EtAdminOrder();
|
||||||
|
@ -182,7 +189,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
Integer remainingPower = Integer.parseInt(asDevice.getRemainingPower());
|
Integer remainingPower = Integer.parseInt(asDevice.getRemainingPower());
|
||||||
// mileage与remainingPower相乘
|
// mileage与remainingPower相乘
|
||||||
asDevice.setRemainingMileage(mileage * remainingPower/100);//剩余里程
|
asDevice.setRemainingMileage(mileage * remainingPower/100);//剩余里程
|
||||||
EtOperatingArea etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(asDevice.getAreaId());
|
|
||||||
if(ObjectUtil.isNotNull(etOperatingArea)){
|
if(ObjectUtil.isNotNull(etOperatingArea)){
|
||||||
asDevice.setAreaName(etOperatingArea.getAreaName());
|
asDevice.setAreaName(etOperatingArea.getAreaName());
|
||||||
}
|
}
|
||||||
|
@ -861,14 +867,15 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
BigDecimal divide = new BigDecimal(minutes).divide(new BigDecimal(10));
|
BigDecimal divide = new BigDecimal(minutes).divide(new BigDecimal(10));
|
||||||
BigDecimal result = divide.setScale(0, RoundingMode.UP);
|
BigDecimal result = divide.setScale(0, RoundingMode.UP);
|
||||||
//BigDecimal divide 取整 有小数点则+1
|
//BigDecimal divide 取整 有小数点则+1
|
||||||
String appointmentServiceFee = sysConfigService.selectConfigByKey("appointment.service.fee");//预约服务费
|
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
|
||||||
String timeoutMinutes = sysConfigService.selectConfigByKey("timeout.minutes");//预约超时保留分钟
|
BigDecimal appointmentServiceFee = area.getAppointmentServiceFee();
|
||||||
if(minutes>Integer.parseInt(timeoutMinutes)){
|
Integer timeoutMinutes = area.getTimeoutMinutes();
|
||||||
|
if(minutes>timeoutMinutes){
|
||||||
//预约分钟数超过最多保留时间
|
//预约分钟数超过最多保留时间
|
||||||
throw new ServiceException("预约时间超过最多保留分钟");
|
throw new ServiceException("预约时间超过最多保留分钟");
|
||||||
}else{
|
}else{
|
||||||
//根据开始时间和结束时间计算费用 预约费 = (预约结束时间 - 开始时间) * 预约服务费
|
//根据开始时间和结束时间计算费用 预约费 = (预约结束时间 - 开始时间) * 预约服务费
|
||||||
BigDecimal appointmentFee = new BigDecimal(appointmentServiceFee).multiply(result);
|
BigDecimal appointmentFee = appointmentServiceFee.multiply(result);
|
||||||
log.info("【计算预约费】:预约分钟数:"+minutes+",取整:"+result+",预约费:"+appointmentFee);
|
log.info("【计算预约费】:预约分钟数:"+minutes+",取整:"+result+",预约费:"+appointmentFee);
|
||||||
order.setAppointmentFee(appointmentFee);
|
order.setAppointmentFee(appointmentFee);
|
||||||
}
|
}
|
||||||
|
@ -989,17 +996,18 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
|
||||||
/** 管理费*/
|
/** 管理费*/
|
||||||
// 根据车辆的定位判断是否在停车区内
|
// 根据车辆的定位判断是否在停车区内
|
||||||
if(!isParkingZone(order.getSn(), order.getAreaId())){
|
if(!isParkingZone(order.getSn(), order.getAreaId())){
|
||||||
String vehicleManagementFee = sysConfigService.selectConfigByKey("vehicle.management.fee");//车辆管理费
|
BigDecimal vehicleManagementFee = area.getVehicleManagementFee();//车辆管理费
|
||||||
order.setManageFee(new BigDecimal(vehicleManagementFee));
|
order.setManageFee(vehicleManagementFee);
|
||||||
}
|
}
|
||||||
/** 调度费*/
|
/** 调度费*/
|
||||||
//判断是否在运营区内
|
//判断是否在运营区内
|
||||||
if(!isAreaZone(order.getSn(), order.getAreaId())){
|
if(!isAreaZone(order.getSn(), area)){
|
||||||
String dispatchFee = sysConfigService.selectConfigByKey("dispatch.fee");//调度费
|
BigDecimal dispatchFee = area.getDispatchFee();//调度费
|
||||||
order.setDispatchFee(new BigDecimal(dispatchFee));
|
order.setDispatchFee(dispatchFee);
|
||||||
}
|
}
|
||||||
BigDecimal totalFee = BigDecimal.ZERO;
|
BigDecimal totalFee = BigDecimal.ZERO;
|
||||||
if (order != null) {
|
if (order != null) {
|
||||||
|
@ -1182,9 +1190,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
/**
|
/**
|
||||||
* 是否在运营区内
|
* 是否在运营区内
|
||||||
*/
|
*/
|
||||||
private Boolean isAreaZone(String sn,Long areaId) {
|
private Boolean isAreaZone(String sn,EtOperatingArea area) {
|
||||||
Boolean inCircle = false;
|
Boolean inCircle = false;
|
||||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
|
||||||
AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
|
AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
|
||||||
String latitude = device.getLatitude();
|
String latitude = device.getLatitude();
|
||||||
String longitude = device.getLongitude();
|
String longitude = device.getLongitude();
|
||||||
|
|
|
@ -33,6 +33,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="agreement" column="agreement" />
|
<result property="agreement" column="agreement" />
|
||||||
<result property="deposit" column="deposit" />
|
<result property="deposit" column="deposit" />
|
||||||
<result property="outage" column="outage" />
|
<result property="outage" column="outage" />
|
||||||
|
<result property="appointmentServiceFee" column="appointment_service_fee" />
|
||||||
|
<result property="dispatchFee" column="dispatch_fee" />
|
||||||
|
<result property="vehicleManagementFee" column="vehicle_management_fee" />
|
||||||
|
<result property="timeoutMinutes" column="timeout_minutes" />
|
||||||
|
<result property="autoReplacementOrder" column="auto_replacement_order" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEtOperatingAreaVo">
|
<sql id="selectEtOperatingAreaVo">
|
||||||
|
@ -40,7 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
boundary_str, longitude, latitude, create_by, create_time,
|
boundary_str, longitude, latitude, create_by, create_time,
|
||||||
contact, phone, status, area_time, service_phone, slogan, province,city,
|
contact, phone, status, area_time, service_phone, slogan, province,city,
|
||||||
county, area_out_outage, parking_out_dispatch, area_out_dispatch,
|
county, area_out_outage, parking_out_dispatch, area_out_dispatch,
|
||||||
no_riding_outage, authentication, msg_switch, undercharge, error, agreement, deposit, outage from et_operating_area
|
no_riding_outage, authentication, msg_switch, undercharge, error, agreement, deposit,
|
||||||
|
outage, appointment_service_fee, dispatch_fee, vehicle_management_fee, timeout_minutes, auto_replacement_order from et_operating_area
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEtOperatingAreaList" parameterType="EtOperatingArea" resultMap="EtOperatingAreaResult">
|
<select id="selectEtOperatingAreaList" parameterType="EtOperatingArea" resultMap="EtOperatingAreaResult">
|
||||||
|
@ -55,55 +61,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where area_id = #{areaId}
|
where area_id = #{areaId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <select id="selectAreaAll" resultMap="EtOperatingAreaResult">-->
|
|
||||||
<!-- <include refid="selectEtOperatingAreaVo"/>-->
|
|
||||||
<!-- </select>-->
|
|
||||||
|
|
||||||
<!-- <insert id="insertEtOperatingArea" parameterType="EtOperatingArea" useGeneratedKeys="true" keyProperty="areaId">-->
|
|
||||||
<!-- insert into et_operating_area-->
|
|
||||||
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
|
|
||||||
<!-- <if test="areaName != null">area_name,</if>-->
|
|
||||||
<!-- <if test="boundary != null">boundary,</if>-->
|
|
||||||
<!-- <if test="longitude != null">longitude,</if>-->
|
|
||||||
<!-- <if test="latitude != null">latitude,</if>-->
|
|
||||||
<!-- <if test="createBy != null">create_by,</if>-->
|
|
||||||
<!-- <if test="createTime != null">create_time,</if>-->
|
|
||||||
<!-- </trim>-->
|
|
||||||
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
|
|
||||||
<!-- <if test="areaName != null">#{areaName},</if>-->
|
|
||||||
<!-- <if test="boundary != null">#{boundary},</if>-->
|
|
||||||
<!-- <if test="longitude != null">#{longitude},</if>-->
|
|
||||||
<!-- <if test="latitude != null">#{latitude},</if>-->
|
|
||||||
<!-- <if test="createBy != null">#{createBy},</if>-->
|
|
||||||
<!-- <if test="createTime != null">#{createTime},</if>-->
|
|
||||||
<!-- </trim>-->
|
|
||||||
<!-- </insert>-->
|
|
||||||
|
|
||||||
<!-- <update id="updateEtOperatingArea" parameterType="EtOperatingArea">-->
|
|
||||||
<!-- update et_operating_area-->
|
|
||||||
<!-- <trim prefix="SET" suffixOverrides=",">-->
|
|
||||||
<!-- <if test="areaName != null">area_name = #{areaName},</if>-->
|
|
||||||
<!-- <if test="boundary != null">boundary = #{boundary},</if>-->
|
|
||||||
<!-- <if test="longitude != null">longitude = #{longitude},</if>-->
|
|
||||||
<!-- <if test="latitude != null">latitude = #{latitude},</if>-->
|
|
||||||
<!-- <if test="createBy != null">create_by = #{createBy},</if>-->
|
|
||||||
<!-- <if test="createTime != null">create_time = #{createTime},</if>-->
|
|
||||||
<!-- </trim>-->
|
|
||||||
<!-- where area_id = #{areaId}-->
|
|
||||||
<!-- </update>-->
|
|
||||||
|
|
||||||
<!-- <select id="checkAreaNameUnique" parameterType="String" resultMap="EtOperatingAreaResult">-->
|
|
||||||
<!-- select area_id, area_name from et_operating_area where area_name = #{areaName} limit 1-->
|
|
||||||
<!-- </select>-->
|
|
||||||
|
|
||||||
<!-- <delete id="deleteEtOperatingAreaByAreaId" parameterType="Long">-->
|
|
||||||
<!-- delete from et_operating_area where area_id = #{areaId}-->
|
|
||||||
<!-- </delete>-->
|
|
||||||
|
|
||||||
<!-- <delete id="deleteEtOperatingAreaByAreaIds" parameterType="String">-->
|
|
||||||
<!-- delete from et_operating_area where area_id in-->
|
|
||||||
<!-- <foreach item="areaId" collection="array" open="(" separator="," close=")">-->
|
|
||||||
<!-- #{areaId}-->
|
|
||||||
<!-- </foreach>-->
|
|
||||||
<!-- </delete>-->
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user