增加拓展属性

This commit is contained in:
wanggeng 2024-06-14 14:27:09 +08:00
parent b7239d2b96
commit af68a3956d
5 changed files with 260 additions and 27 deletions

View File

@ -1,5 +1,7 @@
package cn.com.tenlion.operator.pojo.dtos.user.expand;
import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
import ink.wgink.pojo.dtos.user.UserDTO;
/**
@ -17,6 +19,10 @@ public class UserExpandDTO extends UserDTO {
private Long priceMaterial;
private Long priceMaterialAgent;
private Long priceMaterialAgentUrgent;
private String availableProjType;
private String postpaid;
private Integer freeProjCount;
private Integer correctionCount;
public Long getPriceAdditionalPkg() {
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
@ -65,4 +71,36 @@ public class UserExpandDTO extends UserDTO {
public void setPriceMaterialAgentUrgent(Long priceMaterialAgentUrgent) {
this.priceMaterialAgentUrgent = priceMaterialAgentUrgent;
}
public String getAvailableProjType() {
return availableProjType == null ? "PRICE_ALL,PRICE_MATERIAL,PRICE_FREE" : availableProjType.trim();
}
public void setAvailableProjType(String availableProjType) {
this.availableProjType = availableProjType;
}
public String getPostpaid() {
return postpaid == null ? "" : postpaid.trim();
}
public void setPostpaid(String postpaid) {
this.postpaid = postpaid;
}
public Integer getFreeProjCount() {
return freeProjCount == null ? 3 : freeProjCount;
}
public void setFreeProjCount(Integer freeProjCount) {
this.freeProjCount = freeProjCount;
}
public Integer getCorrectionCount() {
return correctionCount == null ? 3 : correctionCount;
}
public void setCorrectionCount(Integer correctionCount) {
this.correctionCount = correctionCount;
}
}

View File

@ -15,6 +15,10 @@ public class UserExpandPO {
private Long priceMaterial;
private Long priceMaterialAgent;
private Long priceMaterialAgentUrgent;
private String availableProjType;
private String postpaid;
private Integer freeProjCount;
private Integer correctionCount;
public Long getPriceAdditionalPkg() {
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
@ -63,4 +67,36 @@ public class UserExpandPO {
public void setPriceMaterialAgentUrgent(Long priceMaterialAgentUrgent) {
this.priceMaterialAgentUrgent = priceMaterialAgentUrgent;
}
public String getAvailableProjType() {
return availableProjType == null ? "PRICE_ALL,PRICE_MATERIAL,PRICE_FREE" : availableProjType.trim();
}
public void setAvailableProjType(String availableProjType) {
this.availableProjType = availableProjType;
}
public String getPostpaid() {
return postpaid == null ? "" : postpaid.trim();
}
public void setPostpaid(String postpaid) {
this.postpaid = postpaid;
}
public Integer getFreeProjCount() {
return freeProjCount == null ? 3 : freeProjCount;
}
public void setFreeProjCount(Integer freeProjCount) {
this.freeProjCount = freeProjCount;
}
public Integer getCorrectionCount() {
return correctionCount == null ? 3 : correctionCount;
}
public void setCorrectionCount(Integer correctionCount) {
this.correctionCount = correctionCount;
}
}

View File

@ -1,5 +1,6 @@
package cn.com.tenlion.operator.pojo.vos.user.expand;
import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
/**
@ -19,10 +20,17 @@ public class UserExpandVO {
private Double priceAll;
@CheckNumberAnnotation(name = "写材料价格", min = 0)
private Double priceMaterial;
@CheckNumberAnnotation(name = "写材料+代理价格", min = 0)
// @CheckNumberAnnotation(name = "写材料+代理价格", min = 0)
private Double priceMaterialAgent;
@CheckNumberAnnotation(name = "写材料+代理(加急)价格", min = 0)
// @CheckNumberAnnotation(name = "写材料+代理(加急)价格", min = 0)
private Double priceMaterialAgentUrgent;
@CheckEmptyAnnotation(name = "可用项目类型")
private String availableProjType;
private String postpaid;
@CheckNumberAnnotation(name = "免费项目个数", min = 0, max = 10)
private Integer freeProjCount;
@CheckNumberAnnotation(name = "资料补正次数", min = 0, max = 10)
private Integer correctionCount;
public Double getPriceAdditionalPkg() {
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
@ -71,4 +79,36 @@ public class UserExpandVO {
public void setPriceMaterialAgentUrgent(Double priceMaterialAgentUrgent) {
this.priceMaterialAgentUrgent = priceMaterialAgentUrgent;
}
public String getAvailableProjType() {
return availableProjType == null ? "" : availableProjType.trim();
}
public void setAvailableProjType(String availableProjType) {
this.availableProjType = availableProjType;
}
public String getPostpaid() {
return postpaid == null ? "" : postpaid.trim();
}
public void setPostpaid(String postpaid) {
this.postpaid = postpaid;
}
public Integer getFreeProjCount() {
return freeProjCount == null ? 3 : freeProjCount;
}
public void setFreeProjCount(Integer freeProjCount) {
this.freeProjCount = freeProjCount;
}
public Integer getCorrectionCount() {
return correctionCount == null ? 3 : correctionCount;
}
public void setCorrectionCount(Integer correctionCount) {
this.correctionCount = correctionCount;
}
}

View File

@ -9,6 +9,10 @@
<result column="price_material" property="priceMaterial"/>
<result column="price_material_agent" property="priceMaterialAgent"/>
<result column="price_material_agent_urgent" property="priceMaterialAgentUrgent"/>
<result column="available_proj_type" property="availableProjType"/>
<result column="postpaid" property="postpaid"/>
<result column="free_proj_count" property="freeProjCount"/>
<result column="correction_count" property="correctionCount"/>
</resultMap>
<resultMap id="userExpandPO" type="cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO">
@ -18,6 +22,10 @@
<result column="price_material" property="priceMaterial"/>
<result column="price_material_agent" property="priceMaterialAgent"/>
<result column="price_material_agent_urgent" property="priceMaterialAgentUrgent"/>
<result column="available_proj_type" property="availableProjType"/>
<result column="postpaid" property="postpaid"/>
<result column="free_proj_count" property="freeProjCount"/>
<result column="correction_count" property="correctionCount"/>
</resultMap>
<insert id="save" parameterType="map">
@ -28,7 +36,11 @@
price_all,
price_material,
price_material_agent,
price_material_agent_urgent
price_material_agent_urgent,
available_proj_type,
postpaid,
free_proj_count,
correction_count
) VALUES (
#{userId},
#{priceAdditionalPkg},
@ -36,7 +48,11 @@
#{priceAll},
#{priceMaterial},
#{priceMaterialAgent},
#{priceMaterialAgentUrgent}
#{priceMaterialAgentUrgent},
#{availableProjType},
#{postpaid},
#{freeProjCount},
#{correctionCount}
)
</insert>
@ -49,7 +65,11 @@
price_all = #{priceAll},
price_material = #{priceMaterial},
price_material_agent = #{priceMaterialAgent},
price_material_agent_urgent = #{priceMaterialAgentUrgent}
price_material_agent_urgent = #{priceMaterialAgentUrgent},
available_proj_type = #{availableProjType},
postpaid = #{postpaid},
free_proj_count = #{freeProjCount},
correction_count = #{correctionCount}
WHERE
user_id = #{userId}
</update>
@ -61,7 +81,11 @@
price_all,
price_material,
price_material_agent,
price_material_agent_urgent
price_material_agent_urgent,
available_proj_type,
postpaid,
free_proj_count,
correction_count
FROM
sys_user_expand
WHERE
@ -77,7 +101,11 @@
price_all,
price_material,
price_material_agent,
price_material_agent_urgent
price_material_agent_urgent,
available_proj_type,
postpaid,
free_proj_count,
correction_count
FROM
sys_user_expand
WHERE

View File

@ -13,6 +13,11 @@
.layui-form-item {margin-bottom: 0;}
.layui-form-label-new {width: 180px !important;}
.layui-input-block-new {margin-left: 180px !important;}
.slide {width: 100%}
.slide .layui-slider {height: 38px;}
.slide .layui-slider .layui-slider-step {height: 100%;}
.slide .layui-slider .layui-slider-wrap {height: 100%; top: 0;}
.slide .layui-slider .layui-slider-wrap .layui-slider-wrap-btn {width: 20px; height: 20px;}
</style>
</head>
<body>
@ -38,28 +43,27 @@
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">写材料+代理</label>
<div class="layui-input-block layui-input-block-new">
<input type="number" id="priceMaterialAgent" name="priceMaterialAgent" class="layui-input" value="" placeholder="写材料+代理价格" maxlength="50">
<!-- <div class="layui-col-xs6">-->
<!-- <div class="layui-form-item">-->
<!-- <label class="layui-form-label layui-form-label-new">写材料+代理</label>-->
<!-- <div class="layui-input-block layui-input-block-new">-->
<!-- <input type="number" id="priceMaterialAgent" name="priceMaterialAgent" class="layui-input" value="" placeholder="写材料+代理价格" maxlength="50">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="layui-col-xs6">-->
<!-- <div class="layui-form-item">-->
<!-- <label class="layui-form-label layui-form-label-new">写材料+代理(加急)</label>-->
<!-- <div class="layui-input-block layui-input-block-new">-->
<!-- <input type="number" id="priceMaterialAgentUrgent" name="priceMaterialAgentUrgent" class="layui-input" value="" placeholder="写材料+代理(加急)价格" maxlength="50">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">写材料+代理(加急)</label>
<div class="layui-input-block layui-input-block-new">
<input type="number" id="priceMaterialAgentUrgent" name="priceMaterialAgentUrgent" class="layui-input" value="" placeholder="写材料+代理(加急)价格" maxlength="50">
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote" style="margin-top: 15px;">【项目附加费用】单位为<b>元(¥)</b>可保留两位小数如要使用系统默认金额设置为0即可</blockquote>
<div class=" layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">安装包</label>
<label class="layui-form-label layui-form-label-new">安装包(附加)</label>
<div class="layui-input-block layui-input-block-new">
<input type="number" id="priceAdditionalPkg" name="priceAdditionalPkg" class="layui-input" value="" placeholder="安装包价格" maxlength="50">
</div>
@ -67,13 +71,54 @@
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">视频教程</label>
<label class="layui-form-label layui-form-label-new">视频教程(附加)</label>
<div class="layui-input-block layui-input-block-new">
<input type="number" id="priceAdditionalVideoDemo" name="priceAdditionalVideoDemo" class="layui-input" value="" placeholder="视频教程价格" maxlength="50">
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote" style="margin-top: 15px;">其他设置</blockquote>
<div class=" layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">可用项目类型</label>
<div class="layui-input-block layui-input-block-new">
<input type="checkbox" name="availableProjType[PRICE_ALL]" title="全托管">
<input type="checkbox" name="availableProjType[PRICE_MATERIAL]" title="写材料">
<input type="checkbox" name="availableProjType[PRICE_FREE]" title="免费">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">后付费用户</label>
<div class="layui-input-block layui-input-block-new">
<input type="checkbox" name="postpaid[ACTIVE]" title="开启">
</div>
</div>
</div>
</div>
<div class=" layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">免费项目个数</label>
<div class="layui-input-block layui-input-block-new">
<input type="hidden" id="freeProjCount" name="freeProjCount">
<div id="freeProjCountSlide" class="slide"></div>
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">补正次数</label>
<div class="layui-input-block layui-input-block-new">
<input type="hidden" id="correctionCount" name="correctionCount">
<div id="correctionCountSlide" class="slide"></div>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
@ -92,9 +137,11 @@
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
}).use(['index', 'form', 'laydate', 'slider'], function(){
var $ = layui.$;
var form = layui.form;
var slider = layui.slider;
var common = layui.common;
var userId = top.restAjax.params(window.location.href).userId;
function init() {
@ -106,12 +153,43 @@
data.priceMaterialAgentUrgent = (data.priceMaterialAgentUrgent / 100).toFixed(2)
data.priceAdditionalPkg = (data.priceAdditionalPkg / 100).toFixed(2)
data.priceAdditionalVideoDemo = (data.priceAdditionalVideoDemo / 100).toFixed(2)
var availableProjTypeArray = data.availableProjType.split(',');
availableProjTypeArray.forEach(function(item) {
data[`availableProjType[${item}]`] = true
});
if(data.postpaid) {
data['postpaid[ACTIVE]'] = true;
}
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
slider.render({
elem: '#freeProjCountSlide',
max: 10,
min: 0,
step: 1,
showstep: true,
value: data.freeProjCount,
range: false,
change: function(value) {
$('#freeProjCount').val(value);
}
})
slider.render({
elem: '#correctionCountSlide',
max: 10,
min: 0,
step: 1,
showstep: true,
value: data.correctionCount,
range: false,
change: function(value) {
$('#correctionCount').val(value);
}
})
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
@ -126,6 +204,19 @@
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
console.log(formData.field)
var availableProjTypeArray = [];
var postpaidArray = [];
for(var key in formData.field) {
if(key.indexOf('availableProjType') === 0) {
availableProjTypeArray.push(key.split('[')[1].split(']')[0]);
}
if(key.indexOf('postpaid') === 0) {
postpaidArray.push(key.split('[')[1].split(']')[0]);
}
}
formData.field.availableProjType = availableProjTypeArray.join(',');
formData.field.postpaid = postpaidArray.join(',');
top.restAjax.post(`api/user/expand/save-or-update/${userId}`, formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,