diff --git a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareCommonController.java b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareCommonController.java index cd3e12c..2d4bf71 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareCommonController.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareCommonController.java @@ -523,6 +523,7 @@ public class WelfareCommonController { Sql sql = Sqls.create(""" SELECT id, + mobile, loginname, username, personType, @@ -571,8 +572,9 @@ public class WelfareCommonController { List entityList = new ArrayList<>(); entityList.add(new ExcelExportEntity("工号", "loginname", 20)); entityList.add(new ExcelExportEntity("姓名", "username", 20)); + entityList.add(new ExcelExportEntity("联系电话", "mobile", 20)); entityList.add(new ExcelExportEntity("在职状态", "userState", 20)); - entityList.add(new ExcelExportEntity("人员性质", "personType", 20)); +// entityList.add(new ExcelExportEntity("人员类型", "personType", 20)); entityList.add(new ExcelExportEntity("所属工会", "unionname", 50)); entityList.add(new ExcelExportEntity("所属单位", "unitname", 50)); diff --git a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java index 58f5756..649334c 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java @@ -44,6 +44,7 @@ import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; import org.nutz.lang.Lang; +import org.nutz.lang.random.R; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.At; @@ -97,6 +98,7 @@ public class WelfareListController { @Param(value = "provideMode", required = false) Integer provideMode, @Param(value = "optionId", required = false) String optionId, @Param(value = "month", required = false) String month, + @Param(value = "isChoose", required = false) Integer isChoose, @Param(value = "courierNumber", required = false) String courierNumber) { Sql sql = Sqls.create(""" SELECT @@ -141,6 +143,14 @@ public class WelfareListController { cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit()); cnd.andEX("wl.unitid", "=", pageParam.getUnit()); + if (isChoose != null) { + if (isChoose.equals(1)) { + cnd.and("wus.selectUserId", "is not", null); + } else if (isChoose.equals(2)) { + cnd.and("wus.selectUserId", "is", null); + } + } + if (Lang.isNotEmpty(pageParam.getPersonTypes())) { String personTypes = pageParam.getPersonTypes(); String[] personTypeArray = Json.fromJsonAsArray(String.class, personTypes); @@ -665,6 +675,36 @@ public class WelfareListController { } + @At + @ViReturn + @RequiresPermissions("welfare.list.mange") + public Object queryNotWelfareListUsers(@Param("projectId") String projectId, @Param("query") String query){ + if (StrUtil.isBlank(query)) { + return null; + } + Sql sql = Sqls.create(""" + SELECT + id, + loginname, + username, + unitid, + unitname + FROM + `user` + $condition + AND id not in (select userId from welfare_list where projectId = @projectId) + """).setParam("projectId", projectId); + Cnd cnd = Cnd.NEW(); + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("loginname", query); + seg.orLike("username", query); + cnd.and(seg); + sql.setCondition(cnd); + Pagination pagination = welfareListService.listPageMap(1, 10, sql); + return pagination; + } + + @At @ViReturn @RequiresPermissions("welfare.list.mange") @@ -682,4 +722,36 @@ public class WelfareListController { } return null; } + + + @At + @ViReturn + @RequiresPermissions("welfare.list.mange") + public Object addWelfareList(@Param("projectId") String projectId, @Param("userIds") String[] userIds) { + List userIdList = Arrays.stream(userIds).collect(Collectors.toList()); + + Sql sql = Sqls.create("select id,loginname,username,unionid,unitid,userState,personType from `user` where id in (@userIdList)") + .setParam("userIdList", userIdList); + sql.setCallback(Sqls.callback.maps()); + dao.execute(sql); + List userInfoList = (List) sql.getResult(); + + List welfareLists = userInfoList.stream().map(v -> { + WelfareList welfareList = new WelfareList(); + welfareList.setId(R.UU32()); + welfareList.setProjectId(projectId); + welfareList.setUserId(v.getString("id")); + welfareList.setWelfareUnitId(v.getString("unionid")); + welfareList.setWelfareSecondLevelUnitId(v.getString("unitid")); + welfareList.setIsReceive(null); + welfareList.setIsAutoSelect(null); + welfareList.setUserState(v.getString("userState")); + welfareList.setPersonType(v.getString("personType")); + return welfareList; + }).collect(Collectors.toList()); + + dao.fastInsert(welfareLists); + return null; + } + } diff --git a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareUserChooseController.java b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareUserChooseController.java index c6fb5c6..8916373 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareUserChooseController.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareUserChooseController.java @@ -1,10 +1,13 @@ package io.v.nutz.zhgh.welfare.controller; +import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.SimpleService; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.sys.services.SysUserService; import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.welfare.model.WelfareList; @@ -14,6 +17,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Chain; import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.ioc.aop.Aop; @@ -27,6 +31,7 @@ import org.nutz.mvc.annotation.Param; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.locks.ReentrantLock; /** * @ClassName WelfareChooseController @@ -39,12 +44,17 @@ import java.util.List; @At("/platform/welfare/userChoose") public class WelfareUserChooseController { + @Inject + private Dao dao; @Inject private SimpleService simpleService; - + @Inject + private SysUserService sysUserService; @Inject private WelfareProjectService welfareProjectService; + private final ReentrantLock lock = new ReentrantLock(true); + @At("") @Ok("beetl:/platform/welfare/userChoose.html") @RequiresPermissions("welfare.user.choose") @@ -94,30 +104,44 @@ public class WelfareUserChooseController { @Aop(TransAop.READ_COMMITTED) @SLog(type = "welfare", tag = "pc电脑选福利", msg = "福利") @RequiresPermissions("welfare.user.choose") - public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress) { - //删除上次选择的 - simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId) - .and("selectUserId", "=", ShiroUtil.getUserId())); + public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress, + @Param(value = "mobile",required = false) String mobile) { + try { + lock.lock(); + String userId = ShiroUtil.getUserId(); + //删除上次选择的 + simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId) + .and("selectUserId", "=", userId)); - List insertList = new ArrayList<>(); - List ids = Json.fromJsonAsList(String.class, chooseIds); - ids.forEach(s -> { - WelfareUserSelection selection = new WelfareUserSelection(); - selection.setWelfareId(projectId); - selection.setSubjectId(subjectId); - selection.setSelectUserId(ShiroUtil.getUserId()); - selection.setSelectTime(new Date()); - selection.setSelectOptionId(s); - selection.setReceiveAddress(receiveAddress); - insertList.add(selection); - }); - simpleService.dao().insert(insertList); - simpleService.dao().update(WelfareList.class, - Chain.make("isReceive", true), - Cnd.where("projectId", "=", projectId) - .and("userId", "=", ShiroUtil.getUserId())); - return null; + List insertList = new ArrayList<>(); + List ids = Json.fromJsonAsList(String.class, chooseIds); + ids.forEach(s -> { + WelfareUserSelection selection = new WelfareUserSelection(); + selection.setWelfareId(projectId); + selection.setSubjectId(subjectId); + selection.setSelectUserId(userId); + selection.setSelectTime(new Date()); + selection.setSelectOptionId(s); + selection.setReceiveAddress(receiveAddress); + insertList.add(selection); + }); + simpleService.dao().insert(insertList); + simpleService.dao().update(WelfareList.class, + Chain.make("isReceive", true), + Cnd.where("projectId", "=", projectId) + .and("userId", "=", userId)); + + if (StrUtil.isNotBlank(mobile)) { + dao.update(Sys_user.class, Chain.make("mobile", mobile), Cnd.where("id", "=", userId)); + } + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } finally { + lock.unlock(); + } } @@ -127,31 +151,55 @@ public class WelfareUserChooseController { @SLog(type = "welfare", tag = "选择福利", msg = "福利") @RequiresPermissions("welfare.user.choose") public Result confirmSelect(@Param("welfareUserSelections") WelfareUserSelection[] welfareUserSelections, - String projectId) { + String projectId, @Param(value = "mobile",required = false) String mobile) { - int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getUserId())); - if (count == 0) { - return Result.error("您暂无权限!"); + try { + lock.lock(); + String userId = ShiroUtil.getUserId(); + + int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", userId)); + if (count <= 0) { + return Result.error("您不在此次选择名单中,如有疑问请及时联系校工会"); + } + + //删除上次选择的 + simpleService.dao().clear(WelfareUserSelection.class, + Cnd.where("welfareId", "=", projectId) + .and("selectUserId", "=", userId)); + + for (WelfareUserSelection welfareUserSelection : welfareUserSelections) { + welfareUserSelection.setSelectUserId(userId); + welfareUserSelection.setSelectTime(new Date()); + } + + simpleService.dao().insert(welfareUserSelections); + + simpleService.dao().update(WelfareList.class, + Chain.make("isReceive", true), + Cnd.where("projectId", "=", projectId) + .and("userId", "=", userId)); + + if (StrUtil.isNotBlank(mobile)) { + dao.update(Sys_user.class, Chain.make("mobile", mobile), Cnd.where("id", "=", userId)); + } + + return Result.success("选择成功"); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } finally { + lock.unlock(); } - - //删除上次选择的 - simpleService.dao().clear(WelfareUserSelection.class, - Cnd.where("welfareId", "=", projectId) - .and("selectUserId", "=", ShiroUtil.getUserId())); - - for (WelfareUserSelection welfareUserSelection : welfareUserSelections) { - welfareUserSelection.setSelectUserId(ShiroUtil.getUserId()); - welfareUserSelection.setSelectTime(new Date()); - } - - simpleService.dao().insert(welfareUserSelections); - - simpleService.dao().update(WelfareList.class, - Chain.make("isReceive", true), - Cnd.where("projectId", "=", projectId) - .and("userId", "=", ShiroUtil.getUserId())); - return Result.success("选择成功"); } + @At + @ViReturn + @RequiresPermissions("welfare.user.choose") + public Object getUserMobile() { + Sql sql = Sqls.create("SELECT mobile FROM sys_user WHERE id = @userId").setParam("userId", ShiroUtil.getUserId()); + sql.setCallback(Sqls.callback.str()); + dao.execute(sql); + return sql.getResult(); + } } diff --git a/src/main/resources/views/mobile/welfare/list/receive.html b/src/main/resources/views/mobile/welfare/list/receive.html index 15b275a..5a7aebb 100644 --- a/src/main/resources/views/mobile/welfare/list/receive.html +++ b/src/main/resources/views/mobile/welfare/list/receive.html @@ -322,6 +322,9 @@ layout("/mobile/platform.html"){ style="border-radius: 8px; background: #ffffff" >
+ + + @@ -420,7 +423,8 @@ layout("/mobile/platform.html"){ optionIndex: null, optionData: {}, - clickUpOrDown: false + clickUpOrDown: false, + mobile: "" } }, computed: { @@ -613,6 +617,12 @@ layout("/mobile/platform.html"){ return } } + + if (!this.mobile || !this.mobile.match(/^1[3-9]\d{9}$/)) { + this.$modal.msg("请填写正确的手机号码") + return + } + const notReceiveAddress = [] const formData = this.projectInfo.welfareProjectSubjects[0].options .filter((v) => v.selectNum >= 1) @@ -639,11 +649,15 @@ layout("/mobile/platform.html"){ }) if (code === 0) { this.getUserSelection(this.projectId) - this.$modal.msgSuccess(msg) + // this.$modal.msgSuccess(msg) + pjaxReplace("/mobile/welfare/list/receive_success?projectId=" + this.projectId + "&provideMode=" + this.projectInfo.provideMode) } else { - this.$modal.msgError(msg) + vant.Dialog.alert({ + title: "温馨提示", + message: msg + }) } - this.confirmPopup = false + // this.confirmPopup = false }, //查看详情 @@ -714,6 +728,12 @@ layout("/mobile/platform.html"){ async getShoppingType() { const resp = await $.get("/platform/shoppingType/apply/getShoppingType") return resp.data + }, + async getUserMobile() { + const resp = await $.post("/platform/welfare/userChoose/getUserMobile") + if (resp.code === 0) { + this.$set(this, "mobile", resp.data) + } } }, async created() { @@ -739,8 +759,15 @@ layout("/mobile/platform.html"){ window.sessionStorage.removeItem("welfareProjectSelectInfo" + loginname) // this.selectAddressPopup = true } else { + const flag = localStorage.getItem("reload") + if (flag) { + window.location.reload() + localStorage.removeItem("reload") + } this.getProjectInfo() } + + await this.getUserMobile() } }) window.addEventListener("pageshow", (e) => { diff --git a/src/main/resources/views/mobile/welfare/list/receive_success.html b/src/main/resources/views/mobile/welfare/list/receive_success.html index ad21267..4c1da7e 100644 --- a/src/main/resources/views/mobile/welfare/list/receive_success.html +++ b/src/main/resources/views/mobile/welfare/list/receive_success.html @@ -8,38 +8,47 @@ layout("/mobile/platform.html"){
- + -
- - - - +
+ + + + -
{{code=='2' ? '您已领取' : '您已选择'}}
-
- 福利品: {{selectOptionNames}} -
- 返回 - +
{{code=='2' ? '您已领取' : '您已选择'}}
+
福利品: {{selectOptionNames}}
+ 返回
- -
diff --git a/src/main/resources/views/platform/welfare/list/ListMange.html b/src/main/resources/views/platform/welfare/list/ListMange.html index 8c10799..bd7e390 100644 --- a/src/main/resources/views/platform/welfare/list/ListMange.html +++ b/src/main/resources/views/platform/welfare/list/ListMange.html @@ -4,7 +4,7 @@ layout("/layouts/platform.html"){ -
- 搜索 - + 搜索
@@ -227,14 +220,22 @@ layout("/layouts/platform.html"){ @@ -390,70 +423,66 @@ layout("/layouts/platform.html"){ - - + + - - {{item.optionName}} + + {{item.optionName}} - + - + - + :key="index" + :label="data.address" + :value="data.address" + v-for="(data,index) in item.offlineStores" + > - -
+
- + - + :key="item.id" + :label="item.name+' '+item.defaultName" + :value="item.id" + v-for="item in addressOptions" + >
- 添加收货地址 - + 添加收货地址
-
- - + + @@ -465,38 +494,35 @@ layout("/layouts/platform.html"){ - + - 下载选择数据 - - + 下载选择数据 - + -
将文件拖到此处,或点击上传
+
+ 将文件拖到此处,或 + 点击上传 +
只能上传xls,xlsx文件
@@ -508,87 +534,101 @@ layout("/layouts/platform.html"){
- - - + + - + + :options="dzOptions" + :props="{ expandTrigger: 'hover' }" + @change="handleChange" + clearable + placeholder="请选择地址信息" + style="width: 100%" + v-model="formData.addressList" + > - - + + - - + + - - + + - 取 消 - 保存 - + 取 消 + 保存 + + + + + + + + + + + + + + 取消 + 确定 + +
diff --git a/src/main/resources/views/platform/welfare/userChoose.html b/src/main/resources/views/platform/welfare/userChoose.html index 9a5fa82..a41b5fd 100644 --- a/src/main/resources/views/platform/welfare/userChoose.html +++ b/src/main/resources/views/platform/welfare/userChoose.html @@ -29,7 +29,7 @@ layout("/layouts/platform.html"){ } .desc_label { - width: 75px; + /*width: 75px;*/ -webkit-flex-shrink: 0; flex-shrink: 0; padding-right: 4px; @@ -56,12 +56,12 @@ layout("/layouts/platform.html"){
年  度:
@@ -77,34 +77,34 @@ layout("/layouts/platform.html"){