会员不能重复申请入会
This commit is contained in:
+50
@@ -14,6 +14,7 @@ import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.sys.models.Sys_union_group;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
@@ -164,6 +165,55 @@ public class MemberApplyController {
|
||||
return Result.success(dao.fetch(MemberApplyRecord.class,id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询申请记录
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("根据 userid 查询是否能申请入会")
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
public Result findOne(String id) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", id));
|
||||
if (user == null) {
|
||||
return Result.error("用户不存在");
|
||||
}
|
||||
|
||||
Dict result = Dict.create();
|
||||
result.set("id", user.getId());
|
||||
result.set("username", user.getUsername());
|
||||
result.set("loginname", user.getLoginname());
|
||||
|
||||
boolean isAlreadyMember = false;
|
||||
if (user.getMember() != null) {
|
||||
isAlreadyMember = Boolean.TRUE.equals(user.getMember());
|
||||
}
|
||||
|
||||
//1、已经是会员无法申请
|
||||
if (isAlreadyMember) {
|
||||
result.set("canApply", false);
|
||||
result.set("msg", "您已是工会会员,无需重复申请");
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
long doingProcessCount = dao.count(ProcessInstance.class,
|
||||
Cnd.where("businessNo", "in",
|
||||
Sqls.create("SELECT id FROM member_apply_record WHERE userId = @userId")
|
||||
.setParam("userId", id)
|
||||
).and("state", "=", 10)
|
||||
);
|
||||
|
||||
//2、已经有申请中的,不能申请
|
||||
if (doingProcessCount > 0) {
|
||||
result.set("canApply", false);
|
||||
result.set("msg", "您有一份入会申请流程正在审批中,请勿重复提交");
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
result.set("canApply", true);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class MemberApplyMineController {
|
||||
} else {
|
||||
cnd.orderBy("info." + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = memberCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
|
||||
@@ -204,8 +204,12 @@ layout("/layouts/platform.html"){
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end" class="mt20">
|
||||
<el-button type="primary" plain @click="onSave">保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
|
||||
<el-button type="primary" plain @click="onSave" v-if="!taskId"
|
||||
:disabled="!canApply"
|
||||
:title="applyDisableMsg">保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit" v-if="!taskId" v-if="!taskId"
|
||||
:disabled="!canApply"
|
||||
:title="applyDisableMsg">提交</el-button>
|
||||
<el-button type="primary" @click="onFinishTask" v-else>提交</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
@@ -221,6 +225,8 @@ layout("/layouts/platform.html"){
|
||||
id: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
units: [],
|
||||
canApply: true,
|
||||
applyDisableMsg: '',
|
||||
formData: {
|
||||
families: []
|
||||
},
|
||||
@@ -293,6 +299,23 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkApplyPermission() {
|
||||
if (this.id || this.taskId) {
|
||||
this.canApply = true;
|
||||
this.applyDisableMsg = '';
|
||||
return;
|
||||
}
|
||||
this.$axios.post("/platform/member/apply/submit/findOne", { id: this.formData.userId }).then(res => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.canApply = res.data.canApply;
|
||||
this.applyDisableMsg = res.data.msg || '';
|
||||
|
||||
if (!this.canApply) {
|
||||
this.$message.warning(this.applyDisableMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onSave() {
|
||||
this.$confirm("您确定保存吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -425,6 +448,8 @@ layout("/layouts/platform.html"){
|
||||
this.$set(this.formData, "email", email)
|
||||
this.$set(this.formData, "families", families ? families : [])
|
||||
this.$set(this.formData, "personalData", personalData)
|
||||
|
||||
this.checkApplyPermission();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
+23
-3
@@ -243,9 +243,9 @@ layout("/layouts/platform_h5.html"){
|
||||
</van-checkbox>
|
||||
</van-cell-group>
|
||||
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
|
||||
<van-button block type="primary" @click.submit="onSave">保存</van-button>
|
||||
<van-button v-if="!taskId" block type="primary" @click.submit="onSubmit">提交</van-button>
|
||||
<van-button v-else block type="primary" @click.submit="onFinishTask">提交</van-button>
|
||||
<van-button block type="primary" @click.submit="onSave" :disabled="!canApply">保存</van-button>
|
||||
<van-button v-if="!taskId" block type="primary" @click.submit="onSubmit" :disabled="!canApply">提交</van-button>
|
||||
<van-button v-else block type="primary" @click.submit="onFinishTask" >提交</van-button>
|
||||
</div>
|
||||
</van-form>
|
||||
</div>
|
||||
@@ -258,6 +258,8 @@ layout("/layouts/platform_h5.html"){
|
||||
return {
|
||||
id: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
canApply: true,
|
||||
applyDisableMsg: '',
|
||||
formData: {
|
||||
families: [],
|
||||
},
|
||||
@@ -278,7 +280,23 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
methods: {
|
||||
historyBack,
|
||||
checkApplyPermission() {
|
||||
if (this.id || this.taskId) {
|
||||
this.canApply = true;
|
||||
this.applyDisableMsg = '';
|
||||
return;
|
||||
}
|
||||
this.$axios.post("/platform/member/apply/submit/findOne", { id: this.formData.userId }).then(res => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.canApply = res.data.canApply;
|
||||
this.applyDisableMsg = res.data.msg || '';
|
||||
|
||||
if (!this.canApply) {
|
||||
this.$message.warning(this.applyDisableMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onSave() {
|
||||
this.$dialog.confirm({
|
||||
title: "提示",
|
||||
@@ -441,6 +459,8 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$set(this.formData, "families", families ? families : [])
|
||||
this.$set(this.formData, "personalData", personalData)
|
||||
|
||||
this.checkApplyPermission();
|
||||
|
||||
// 处理校区信息
|
||||
if (campus) {
|
||||
this.$set(this.formData, "campus", campus) // 保存校区代码值
|
||||
|
||||
Reference in New Issue
Block a user