Commit ef5217b0 by caosy

抵扣劵领取日起

parent af17ca9c
......@@ -45,6 +45,7 @@ import com.ctrip.fun.common.vo.basic.MallProductRuleConditionBean;
import com.ctrip.fun.common.vo.basic.MultipleCourseConditionBean;
import com.ctrip.fun.common.vo.basic.PhysicalVoucherRuleConditionBean;
import com.ctrip.fun.common.vo.basic.TicketVoucherRuleConditionBean;
import com.ctrip.fun.common.vo.basic.TimeTypeEnum;
import com.ctrip.fun.common.vo.basic.TrainVoucherRuleConditionBean;
import com.ctrip.fun.common.vo.basic.UserGradeAndVipGradeEnum;
import com.ctrip.fun.common.vo.basic.VipVoucherRuleConditionBean;
......@@ -211,7 +212,7 @@ public class VoucherRuleController {
dto.setMultipleCourseConditionBean(multipleBean);
}
}
dto.setTimeTypeMsg(TimeTypeEnum.valueOf(dto.getTimeType()).getMsg());
model.addAttribute("dto", dto);
model.addAttribute("page", request.getParameter("page"));
return "basic/voucherRule/view";
......@@ -302,30 +303,41 @@ public class VoucherRuleController {
bindingResult.addError(fieldError2);
}
//验证有效期
if (dto.getStartUseDate() != null && dto.getEndUseDate() != null) {
// 有效期结束时间定为当天结束时间
dto.setEndUseDate(DateUtil.getEndTime4Day(dto.getEndUseDate()));
if (dto.getStartUseDate().compareTo(dto.getEndUseDate()) > 0) {
FieldError fieldError1 = new FieldError("dto", "startUseDate",
dto.getStartUseDate(), false, null, null, "结束时间不能小于开始时间!");
FieldError fieldError2 = new FieldError("dto", "endUseDate", dto.getEndUseDate(),
false, null, null, "");
bindingResult.addError(fieldError1);
bindingResult.addError(fieldError2);
} else if (dto.getEndUseDate().compareTo(new Date()) <= 0) {
FieldError fieldError1 = new FieldError("dto", "startUseDate",
dto.getStartUseDate(), false, null, null, "结束时间不能小于当前时间!");
FieldError fieldError2 = new FieldError("dto", "endUseDate", dto.getEndUseDate(),
false, null, null, "");
if(dto.getTimeType() == 1){
if (dto.getStartUseDate() != null && dto.getEndUseDate() != null) {
// 有效期结束时间定为当天结束时间
dto.setEndUseDate(DateUtil.getEndTime4Day(dto.getEndUseDate()));
if (dto.getStartUseDate().compareTo(dto.getEndUseDate()) > 0) {
FieldError fieldError1 = new FieldError("dto", "startUseDate",
dto.getStartUseDate(), false, null, null, "结束时间不能小于开始时间!");
FieldError fieldError2 = new FieldError("dto", "endUseDate", dto.getEndUseDate(),
false, null, null, "");
bindingResult.addError(fieldError1);
bindingResult.addError(fieldError2);
} else if (dto.getEndUseDate().compareTo(new Date()) <= 0) {
FieldError fieldError1 = new FieldError("dto", "startUseDate",
dto.getStartUseDate(), false, null, null, "结束时间不能小于当前时间!");
FieldError fieldError2 = new FieldError("dto", "endUseDate", dto.getEndUseDate(),
false, null, null, "");
bindingResult.addError(fieldError1);
bindingResult.addError(fieldError2);
}
} else {
FieldError fieldError1 = new FieldError("dto", "startUseDate", "有效期区间有误!");
FieldError fieldError2 = new FieldError("dto", "endUseDate", "");
bindingResult.addError(fieldError1);
bindingResult.addError(fieldError2);
}
} else {
FieldError fieldError1 = new FieldError("dto", "startUseDate", "有效期区间有误!");
FieldError fieldError2 = new FieldError("dto", "endUseDate", "");
bindingResult.addError(fieldError1);
bindingResult.addError(fieldError2);
}else{
if (dto.getTimeDay() <= 0 ) {
FieldError fieldError1 = new FieldError("dto", "timeDay", "有效期时间需大于0!");
// FieldError fieldError2 = new FieldError("dto", "endUseDate", "");
bindingResult.addError(fieldError1);
// bindingResult.addError(fieldError2);
}
}
//立刻发送--手动输入用户UID, 拼接UID转换成List<String>类型
if (dto.getVoucherRuleType() == VoucherRuleTypeEnum.EXECUTE_RULE.getValue()
&& dto.getSendToUserType() == 2) {
......
......@@ -126,7 +126,9 @@ public class VoucherRuleDto {
*/
private int status;
/**
/**
* 是否多球场抵用券
*/
private int multiple;
......@@ -135,8 +137,38 @@ public class VoucherRuleDto {
* 发送规则是否有效
*/
private int validFlag;
/**
* 发放时间类型
* 1 时间段 2领取日起
*/
private int timeType;
/**
* 领取日时间
*/
private int timeDay;
/**
* 发放时间类型msg
*/
private String timeTypeMsg;
// /**
// * 发放用户类型对应value - 发放用户类型
// */
// private String sendToUserValue1;
//
// /**
// * 发放用户类型对应value - 用户UID
// */
// private String sendToUserValue2;
//
private CourseRuleConditionBean courseRuleConditionBean = new CourseRuleConditionBean();
private CourseRuleConditionBean courseRuleConditionBean = new CourseRuleConditionBean();
private EventActivityRuleConditionBean eventActivityRuleConditionBean = new EventActivityRuleConditionBean();
......@@ -614,7 +646,28 @@ public class VoucherRuleDto {
this.generalVoucherRuleConditionBean = generalVoucherRuleConditionBean;
}
public int getTimeType() {
return timeType;
}
public void setTimeType(int timeType) {
this.timeType = timeType;
}
public int getTimeDay() {
return timeDay;
}
public void setTimeDay(int timeDay) {
this.timeDay = timeDay;
}
public String getTimeTypeMsg() {
return timeTypeMsg;
}
public void setTimeTypeMsg(String timeTypeMsg) {
this.timeTypeMsg = timeTypeMsg;
}
}
......@@ -153,6 +153,7 @@ $(function(){
$("#notCanShareInput").click(function(){
$("#userGetLimit").css('display','none');
});
//添加行
$("#addRowBtn").click(function(){
var tableObj = document.getElementById("conditions");
......@@ -255,6 +256,24 @@ $(function(){
if(sendToUserTypeJQ && sendToUserTypeJQ.length>0){
sendToUserTypeJQ.trigger("click");
}
//日期类型选择
$("input[type=radio][name='timeType']").click(function(){
if($(this).val()==1){
$("#timeType2value").hide();
$("#timeValue2").val("");
$("#timeType1value").show();
}else{
$("#timeType1value").hide();
$("#timeType2value").show();
}
});
//发放用户类型radio对象
var timeTypeJQ=$("input[type=radio][name='timeType']:checked");
if(timeTypeJQ && timeTypeJQ.length>0){
timeTypeJQ.trigger("click");
}
</#if>
<#if dto.voucherType == 5 ||dto.voucherType == 6 ||dto.voucherType == 7 || dto.voucherType == 8 || dto.voucherType == 9 >
......@@ -691,6 +710,8 @@ $(function(){
</div>
</#if>
<#if dto.voucherRuleType == 2>
<input type="hidden" name="sendToUserType" value="3">
<@form.singleSelect path="dto.sendToUserValue" options=UserGradeAndVipGradeList label="发放用户类型(触发条件)" required=true/>
......@@ -698,7 +719,32 @@ $(function(){
<@form.textInput path="dto.expireDate" attributes="class=\"input-medium\" style='width:207px'" label="过期时间" required = true type="date"/>
<@form.singleSelect path="dto.validFlag" options=enums["com.ctrip.fun.common.vo.basic.VourcherRuleValidFlagEnum"] label="状态" required=true/>
<#else>
<@form.textInputTwoDate path1="dto.startUseDate" path2="dto.endUseDate" attributes="" label="有效期" required = true/>
<div class="long_content_div control-group" id="canTimeDiv">
<label class="control-label" for="type">有效期类型</label>
<div class="controls">
<#if dto.timeType==2>
<input style="margin-bottom: 5px;" type="radio" id="timeType1" name="timeType" value="1">
<span style="padding-right: 20px;">时间段</span>
<input style="margin-bottom: 5px;" type="radio" id="timeType2" name="timeType" value="2" checked="">
<span style="padding-right: 20px;">领取日起</span>
<#else>
<input style="margin-bottom: 5px;" type="radio" id="timeType1" name="timeType" value="1" checked="">
<span style="padding-right: 20px;">时间段</span>
<input style="margin-bottom: 5px;" type="radio" id="timeType2" name="timeType" value="2">
<span style="padding-right: 20px;">领取日起</span>
</#if>
</div>
</div>
<div id="timeType1value">
<@form.textInputTwoDate path1="dto.startUseDate" path2="dto.endUseDate" attributes="" label="有效期" required = true/>
</div>
<div id="timeType2value">
<@form.textInput path="dto.timeDay" attributes="class=\"input-medium\"" label="有效期(月)" required = true />
</div>
</#if>
</div>
<button id="submitCheck" type="button" class="btn btn-primary pull-left bottom_margin">发送</button>
......
......@@ -7,7 +7,7 @@
<style>
.table th, .table td{ text-align:center;vertical-align:middle;}
.widthShow {
width: 1100px;
width: 1200px;
}
</style>
</#assign>
......@@ -18,6 +18,7 @@
<@com.singleSelectQuery "dto.status" enums["com.ctrip.fun.common.vo.basic.VoucherRuleStatusEnum"] "" "现金券状态"/>
<@com.textInput "dto.id" "style=\"margin-left: 5px;\"" "现金券ID"/>
<@com.textInput "dto.description" "style=\"margin-left: 5px;\"" "现金券名称"/>
<@com.singleSelectQuery "dto.timeType" enums["com.ctrip.fun.common.vo.basic.TimeTypeEnum"] "" "有效期类型"/>
<@com.textInputTwoDate "dto.endUseDateStart" "dto.endUseDateEnd" "style=\"margin-left: 5px;\"" "过期时间"/>
<@com.textInputTwoDate "dto.createdTimeStart" "dto.createdTimeEnd" "style=\"margin-left: 5px;\"" "创建时间"/>
<button type="submit" class="btn btn-primary">查询</button>
......@@ -27,15 +28,16 @@
<thead>
<tr>
<th style="width:5%">ID</th>
<th style="width:20%">描述</th>
<th style="width:15%">发放时间</th>
<th style="width:18%">描述</th>
<th style="width:15%">创建时间</th>
<th style="width:15%">到期时间</th>
<th style="width:5%">张数</th>
<th style="width:5%">金额</th>
<th style="width:5%">人数</th>
<th style="width:10%">有效期类型</th>
<th style="width:10%">现金券类型</th>
<th style="width:10%">发放类型</th>
<th style="width:7%">状态</th>
<th style="width:8%">状态</th>
<th style="width:8%">操作人</th>
<th style="width:10%">操作</th>
</tr>
......@@ -45,11 +47,12 @@
<tr>
<td>${item.id!}</td>
<td style="text-align:left">${item.description!}</td>
<td>${item.createdTime?string("yyyy-MM-dd HH:mm:ss")}</td>
<td>${item.endUseDate?string("yyyy-MM-dd HH:mm:ss")}</td>
<td>${(item.createdTime?string("yyyy-MM-dd HH:mm:ss"))!''}</td>
<td>${(item.endUseDate?string("yyyy-MM-dd HH:mm:ss"))!''}</td>
<td style="text-align:left">${item.quantityAll!}</td>
<td>${item.amountAll!}</td>
<td>${item.countUser!}</td>
<td>${item.timeTypeMsg!}</td>
<td>${item.voucherTypeMsg!}</td>
<td>${item.voucherRuleTypeMsg!}</td>
<td>${item.statusMsg!}</td>
......
......@@ -383,6 +383,10 @@ function getResourceList(page){
<td style="text-align:left">状态</td>
<td style="text-align:left">${dto.statusMsg!}</td>
</tr>
<tr>
<td style="text-align:left">有效期类型</td>
<td style="text-align:left">${dto.timeTypeMsg!}</td>
</tr>
<#if dto.voucherType == 1 || dto.voucherType == 4 >
<tr>
<td style="text-align:left">多球场抵用券</td>
......@@ -841,6 +845,7 @@ function getResourceList(page){
<td style="text-align:left">${dto.sendToUserValueMsg!}</td>
</#if>
</tr>
<#if dto.timeType == 1>
<tr>
<td style="text-align:left">有效期</td>
......@@ -849,6 +854,16 @@ function getResourceList(page){
</td>
</tr>
<#elseif dto.timeType == 2>
<tr>
<td style="text-align:left">有效期(月)</td>
<td style="text-align:left">
<@form.textInput path="dto.timeDay" attributes="class=\"input-medium\"" label="" required = true />
</td>
</tr>
</#if>
<#if dto.voucherRuleType == 2>
<tr>
<td style="text-align:left">过期时间</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment