租车套餐设置调整
This commit is contained in:
@ -125,12 +125,22 @@ public class ZcRentBatteyRuleController extends BaseController
|
||||
@ResponseBody
|
||||
public List<ZcRentBatteyRule> listByLeaseType(@RequestParam("leaseType") Long leaseType) {
|
||||
ZcRentBatteyRule zcRentBatteyRule = new ZcRentBatteyRule();
|
||||
// 租车套餐的租赁类型2标识日租,3标识按天租;租电套餐1标识日租,2标识按天租
|
||||
Long durationType = 1L;
|
||||
if(leaseType == 3L) {
|
||||
durationType = 2L;
|
||||
/**
|
||||
* 租车套餐的租赁类型2标识日租,3标识按天租;
|
||||
*
|
||||
* 租电套餐1标识日租(且租赁天数只能为1天),
|
||||
*
|
||||
* 2标识按天租,或者租电套餐1标识日租中租赁天数大于1天也为按天租
|
||||
*
|
||||
*/
|
||||
|
||||
zcRentBatteyRule.setQueryDurationType(leaseType.toString());
|
||||
List<ZcRentBatteyRule> list = zcRentBatteyRuleService.selectZcRentBatteyRuleList(zcRentBatteyRule);
|
||||
for (ZcRentBatteyRule zrbr : list){
|
||||
if(zrbr.getDurationType() == 2) {
|
||||
zrbr.setDuration(zrbr.getDuration() * 30);
|
||||
}
|
||||
zcRentBatteyRule.setDurationType(durationType);
|
||||
return zcRentBatteyRuleService.selectZcRentBatteyRuleList(zcRentBatteyRule);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +121,12 @@ public class ZcRentCarRuleController extends BaseController
|
||||
.toArray(String[]::new);
|
||||
List<ZcRentBatteyRule> batteyRuleList = zcRentBatteyRuleService.selectZcRentBatteyRuleByIds(stringArray);
|
||||
for (ZcRentBatteyRule batteyRule : batteyRuleList) {
|
||||
if(!String.valueOf(batteyRule.getDuration()*30).equals(String.valueOf(zcRentCarRule.getRentalDays()))){
|
||||
//2标识按天租,或者租电套餐1标识日租中租赁天数大于1天也为按天租
|
||||
Long duration= batteyRule.getDuration();
|
||||
if(batteyRule.getDurationType() == 2){
|
||||
duration = duration * 30;
|
||||
}
|
||||
if(!String.valueOf(duration).equals(String.valueOf(zcRentCarRule.getRentalDays()))){
|
||||
return error("选择租电套餐的租赁天数与租车套餐的租赁天数不一致。");
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
/**
|
||||
* 租电套餐对象 zc_rent_battey_rule
|
||||
@ -123,6 +124,9 @@ public class ZcRentBatteyRule extends BaseEntity
|
||||
@Excel(name = "购买限制类型")
|
||||
private Long buyLimitType;
|
||||
|
||||
@Transient
|
||||
private String queryDurationType;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -367,6 +371,14 @@ public class ZcRentBatteyRule extends BaseEntity
|
||||
return buyLimitType;
|
||||
}
|
||||
|
||||
public String getQueryDurationType() {
|
||||
return queryDurationType;
|
||||
}
|
||||
|
||||
public void setQueryDurationType(String queryDurationType) {
|
||||
this.queryDurationType = queryDurationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
||||
@ -67,6 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isJoinInvite != null "> and is_join_invite = #{isJoinInvite}</if>
|
||||
<if test="mealChannel != null "> and meal_channel = #{mealChannel}</if>
|
||||
<if test="buyLimitType != null "> and buy_limit_type = #{buyLimitType}</if>
|
||||
<if test="queryDurationType != null and queryDurationType != '' and queryDurationType == 2">
|
||||
AND duration_type = 1
|
||||
AND duration = 1
|
||||
</if>
|
||||
<if test="queryDurationType != null and queryDurationType != '' and queryDurationType == 3">
|
||||
AND (duration_type = 2 OR (duration_type = 1 AND duration <![CDATA[ > ]]> 1))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -74,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectZcRentBatteyRuleVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectZcRentBatteyRuleByIds" resultType="com.ruoyi.operation.domain.ZcRentBatteyRule">
|
||||
<select id="selectZcRentBatteyRuleByIds" resultMap="ZcRentBatteyRuleResult">
|
||||
select * from zc_rent_battey_rule where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
|
||||
@ -167,11 +167,7 @@
|
||||
$.modal.alert("未找到与租赁类型相同的租电套餐");
|
||||
}
|
||||
data.forEach(function(rule) {
|
||||
if(newRentalType === '3'){
|
||||
html += `<div class="checkbox"><label><input type="checkbox" id="batteryRules" name="batteryRules" value="${rule.id}"> ${rule.title},电压${rule.voltage},电容${rule.ah},租赁${rule.duration*30}天</label></div>`;
|
||||
}else{
|
||||
html += `<div class="checkbox"><label><input type="checkbox" id="batteryRules" name="batteryRules" value="${rule.id}"> ${rule.title},电压${rule.voltage},电容${rule.ah},租赁${rule.duration}天</label></div>`;
|
||||
}
|
||||
});
|
||||
$('#batteryRuleList').html(html);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user