提交
This commit is contained in:
parent
8de83ac5b7
commit
06adee38b8
|
@ -2,7 +2,6 @@ package com.ruoyi.bst.device.domain;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
@ -29,8 +28,6 @@ public class DeviceVO extends Device {
|
|||
private BigDecimal modelLowVoltage;
|
||||
@ApiModelProperty("车型续航")
|
||||
private BigDecimal modelFullEndurance;
|
||||
@ApiModelProperty("车型套餐ID列表")
|
||||
private List<Long> modelSuitIds;
|
||||
|
||||
// 运营区
|
||||
@ApiModelProperty("运营区名称")
|
||||
|
|
|
@ -50,7 +50,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bm.name as model_name,
|
||||
bm.full_voltage as model_full_voltage,
|
||||
bm.low_voltage as model_low_voltage,
|
||||
bm.suit_ids as model_suit_ids,
|
||||
bm.full_endurance as model_full_endurance,
|
||||
ba.name as area_name,
|
||||
ba.user_id as area_user_id,
|
||||
|
@ -123,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.lastUserId != null">and bd.last_user_id = #{query.lastUserId}</if>
|
||||
<if test="query.lastUserName != null and query.lastUserName != ''">and bul.nick_name like concat('%', #{query.lastUserName}, '%')</if>
|
||||
<if test="query.lastUserPhone != null and query.lastUserPhone != ''">and bul.user_name like concat('%', #{query.lastUserPhone}, '%')</if>
|
||||
<if test="query.mchName != null and query.mchName != ''">and mch.nick_name like concat('%', #{query.mchName}, '%')</if>
|
||||
<if test="query.suitId != null">
|
||||
and find_in_set(#{query.suitId}, bm.suit_ids)
|
||||
</if>
|
||||
|
@ -414,7 +414,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="unbindMch" >
|
||||
update bst_device
|
||||
set mch_id = null
|
||||
set mch_id = null,
|
||||
model_id = null
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
|
|
|
@ -7,10 +7,6 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class ModelVO extends Model {
|
||||
|
||||
@ApiModelProperty("运营区名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="selectModelVo">
|
||||
select
|
||||
bm.id,
|
||||
bm.area_id,
|
||||
bm.user_id,
|
||||
bm.name,
|
||||
bm.full_voltage,
|
||||
|
@ -20,26 +19,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bm.deleted,
|
||||
bm.low_battery_reminder_switch,
|
||||
bm.low_battery_reminder,
|
||||
ba.name as area_name,
|
||||
su.nick_name as user_name
|
||||
from <include refid="searchTables"/>
|
||||
</sql>
|
||||
|
||||
<sql id="searchTables">
|
||||
bst_model bm
|
||||
left join bst_area ba on bm.area_id = ba.id
|
||||
left join sys_user su on bm.user_id = su.user_id
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.id != null "> and bm.id = #{query.id}</if>
|
||||
<if test="query.areaId != null "> and bm.area_id = #{query.areaId}</if>
|
||||
<if test="query.userId != null "> and bm.user_id = #{query.userId}</if>
|
||||
<if test="query.name != null and query.name != ''"> and bm.name like concat('%', #{query.name}, '%')</if>
|
||||
<if test="query.deleted != null "> and bm.deleted = #{query.deleted}</if>
|
||||
<if test="query.deleted == null "> and bm.deleted = false</if>
|
||||
<if test="query.lowBatteryReminderSwitch != null "> and bm.low_battery_reminder_switch = #{query.lowBatteryReminderSwitch}</if>
|
||||
<if test="query.areaName != null and query.areaName != ''"> and ba.name like concat('%', #{query.areaName}, '%')</if>
|
||||
<if test="query.userName != null and query.userName != ''"> and su.nick_name like concat('%', #{query.userName}, '%')</if>
|
||||
<if test="query.ids != null">
|
||||
and bm.id in
|
||||
|
@ -111,7 +106,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
||||
<if test="data.userId != null">user_id = #{data.userId},</if>
|
||||
<if test="data.name != null and data.name != ''">name = #{data.name},</if>
|
||||
<if test="data.fullVoltage != null">full_voltage = #{data.fullVoltage},</if>
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.bst.area.domain.AreaVO;
|
|||
import com.ruoyi.bst.areaJoin.domain.AreaJoinVO;
|
||||
import com.ruoyi.bst.channel.domain.ChannelVO;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.model.domain.ModelVO;
|
||||
import com.ruoyi.bst.order.domain.Order;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderPrePriceVO;
|
||||
|
@ -31,6 +32,9 @@ public class OrderCreateBO {
|
|||
// 设备
|
||||
private DeviceVO device;
|
||||
|
||||
// 车型
|
||||
private ModelVO model;
|
||||
|
||||
// 运营区
|
||||
private AreaVO area;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.bst.order.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -23,6 +24,9 @@ import com.ruoyi.bst.device.service.DeviceIotService;
|
|||
import com.ruoyi.bst.device.service.DeviceService;
|
||||
import com.ruoyi.bst.locationLog.domain.vo.LocationLogPositionVO;
|
||||
import com.ruoyi.bst.locationLog.service.LocationLogService;
|
||||
import com.ruoyi.bst.model.domain.ModelVO;
|
||||
import com.ruoyi.bst.model.service.ModelAssembler;
|
||||
import com.ruoyi.bst.model.service.ModelService;
|
||||
import com.ruoyi.bst.order.domain.Order;
|
||||
import com.ruoyi.bst.order.domain.OrderVO;
|
||||
import com.ruoyi.bst.order.domain.bo.OrderChangeBO;
|
||||
|
@ -102,6 +106,12 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
@Autowired
|
||||
private OrderValidator orderValidator;
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
||||
@Autowired
|
||||
private ModelAssembler modelAssembler;
|
||||
|
||||
@Override
|
||||
public OrderPrePriceVO toOrderPrePriceVO(OrderCalcPrePriceDTO dto) {
|
||||
if (dto == null) {
|
||||
|
@ -134,6 +144,11 @@ public class OrderConverterImpl implements OrderConverter{
|
|||
AreaVO area = areaService.selectAreaById(device.getAreaId());
|
||||
bo.setArea(area);
|
||||
|
||||
// 车型
|
||||
ModelVO model = modelService.selectModelById(device.getModelId());
|
||||
modelAssembler.assembleSuitIds(Collections.singletonList(model));
|
||||
bo.setModel(model);
|
||||
|
||||
// 查询设备所属人的加盟信息
|
||||
AreaJoinVO areaJoin = areaJoinService.selectByUserArea(device.getMchId(), device.getAreaId());
|
||||
bo.setAreaJoin(areaJoin);
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.ruoyi.bst.device.domain.DeviceQuery;
|
|||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
|
||||
import com.ruoyi.bst.device.service.DeviceService;
|
||||
import com.ruoyi.bst.model.domain.ModelVO;
|
||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||
import com.ruoyi.bst.order.domain.OrderVO;
|
||||
import com.ruoyi.bst.order.domain.bo.OrderCreateBO;
|
||||
|
@ -67,7 +68,11 @@ public class OrderValidatorImpl implements OrderValidator{
|
|||
// 套餐
|
||||
SuitVO suit = bo.getSuit();
|
||||
ServiceUtil.assertion(suit == null, "ID为%s的套餐不存在", dto.getSuitId());
|
||||
ServiceUtil.assertion(CollectionUtils.isEmptyElement(device.getModelSuitIds()) || !device.getModelSuitIds().contains(suit.getId()), "ID为%s的套餐不可在ID为%s的车辆使用", dto.getSuitId(), dto.getDeviceId());
|
||||
|
||||
// 车型
|
||||
ModelVO model = bo.getModel();
|
||||
ServiceUtil.assertion(model == null, "ID为%s的车型不存在", device.getModelId());
|
||||
ServiceUtil.assertion(CollectionUtils.isEmptyElement(model.getSuitIds()) || !model.getSuitIds().contains(suit.getId()), "ID为%s的套餐不可在ID为%s的车辆使用", dto.getSuitId(), dto.getDeviceId());
|
||||
ServiceUtil.assertion(suit.getSeconds() == null || suit.getSeconds() <= 0, "ID为%s的套餐时长不能为0或小于0", dto.getSuitId());
|
||||
|
||||
// 用户
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.ruoyi.bst.reconciliationDate.domain.ReconciliationDateQuery;
|
|||
import com.ruoyi.bst.reconciliationDate.domain.ReconciliationDateVO;
|
||||
import com.ruoyi.bst.reconciliationDate.mapper.ReconciliationDateMapper;
|
||||
import com.ruoyi.bst.reconciliationDate.service.ReconciliationDateService;
|
||||
import com.ruoyi.bst.reconciliationDate.utils.ReconciliationDateUtil;
|
||||
import com.ruoyi.bst.refund.domain.RefundQuery;
|
||||
import com.ruoyi.bst.refund.service.RefundDashboard;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
|
@ -190,10 +191,10 @@ public class ReconciliationDateServiceImpl implements ReconciliationDateService
|
|||
// 差额
|
||||
po.setDifference(MathUtils.subtractDecimal(po.getActualAmount(), po.getActualBonus()));
|
||||
|
||||
// if (ReconciliationDateUtil.isEmpty(po)) {
|
||||
// log.error("渠道对账数据为空,date={}, channel={}, areaId={}", date, channel, areaId);
|
||||
// return 0;
|
||||
// }
|
||||
if (ReconciliationDateUtil.isEmpty(po)) {
|
||||
log.error("渠道对账数据为空,date={}, channel={}, areaId={}", date, channel, areaId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.insertReconciliationDate(po);
|
||||
}
|
||||
|
|
|
@ -6,16 +6,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.reconciliationDate.domain.ReconciliationDate;
|
||||
import com.ruoyi.bst.reconciliationDate.domain.ReconciliationDateQuery;
|
||||
import com.ruoyi.bst.reconciliationDate.domain.ReconciliationDateVO;
|
||||
import com.ruoyi.bst.reconciliationDate.service.ReconciliationDateService;
|
||||
|
@ -74,37 +70,4 @@ public class ReconciliationDateController extends BaseController
|
|||
{
|
||||
return success(reconciliationDateService.selectReconciliationDateById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增渠道对账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:reconciliationDate:add')")
|
||||
@Log(title = "渠道对账", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ReconciliationDate reconciliationDate)
|
||||
{
|
||||
return toAjax(reconciliationDateService.insertReconciliationDate(reconciliationDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改渠道对账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:reconciliationDate:edit')")
|
||||
@Log(title = "渠道对账", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ReconciliationDate reconciliationDate)
|
||||
{
|
||||
return toAjax(reconciliationDateService.updateReconciliationDate(reconciliationDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除渠道对账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:reconciliationDate:remove')")
|
||||
@Log(title = "渠道对账", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(reconciliationDateService.deleteReconciliationDateByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user