diff --git a/src/main/java/io/v/nutz/base/utils/PinyinUtil.java b/src/main/java/io/v/nutz/base/utils/PinyinUtil.java new file mode 100644 index 0000000..2ebaaff --- /dev/null +++ b/src/main/java/io/v/nutz/base/utils/PinyinUtil.java @@ -0,0 +1,68 @@ +package io.v.nutz.base.utils; + +import net.sourceforge.pinyin4j.PinyinHelper; +import org.nutz.ioc.loader.annotation.IocBean; + +/** + * Created by wizzer on 2017/5/24. + */ +@IocBean +public class PinyinUtil { + /** + * 将汉字转换为全拼 + */ + public static String getPingYin(String name) { + char[] charArray = name.toCharArray(); + StringBuilder pinyin = new StringBuilder(); + for (int i = 0; i < charArray.length; i++) { + if (Character.toString(charArray[i]).matches("[\\u4E00-\\u9FA5]+")) { + pinyin.append(PinyinHelper.toHanyuPinyinStringArray(charArray[i])[0]); + } else { + pinyin.append(charArray[i]); + } + } + return pinyin.toString(); + } + + /** + * 返回中文的首字母 + * + * @param str + * @return + */ + public static String getPinYinHeadChar(String str) { + + String convert = ""; + for (int j = 0; j < str.length(); j++) { + char word = str.charAt(j); + String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word); + if (pinyinArray != null) { + convert += pinyinArray[0].charAt(0); + } else { + convert += word; + } + } + return convert; + } + + /** + * 将字符串转移为ASCII码 + * + * @param cnStr + * @return + */ + public static String getCnASCII(String cnStr) { + StringBuffer strBuf = new StringBuffer(); + byte[] bGBK = cnStr.getBytes(); + for (int i = 0; i < bGBK.length; i++) { + strBuf.append(Integer.toHexString(bGBK[i] & 0xff)); + } + return strBuf.toString(); + } + +// public static void main(String[] args) { +// System.out.println(getPingYin("綦江qq县")); +// System.out.println(getPinYinHeadChar("綦江县")); +// System.out.println(getCnASCII("綦江县")); +// } +} diff --git a/src/main/java/io/v/nutz/sys/models/Sys_club_user.java b/src/main/java/io/v/nutz/sys/models/Sys_club_user.java index 24a10e0..e7eedf8 100644 --- a/src/main/java/io/v/nutz/sys/models/Sys_club_user.java +++ b/src/main/java/io/v/nutz/sys/models/Sys_club_user.java @@ -128,7 +128,7 @@ public class Sys_club_user extends BaseModel { @Column @Comment("工作部门") - @ColDefine(type = ColType.VARCHAR, width = 100) + @ColDefine(type = ColType.VARCHAR, width = 200) private String unitName; @Column diff --git a/src/main/java/io/v/nutz/sys/models/Sys_user.java b/src/main/java/io/v/nutz/sys/models/Sys_user.java index 3970300..4af4bf5 100644 --- a/src/main/java/io/v/nutz/sys/models/Sys_user.java +++ b/src/main/java/io/v/nutz/sys/models/Sys_user.java @@ -661,6 +661,42 @@ public class Sys_user extends BaseModel implements Serializable { @Comment("专业技术级别") @ColDefine(type = ColType.VARCHAR, width = 50) private String professionalTechnicalLevel; + + @Column + @Comment("退休性质(针对退休人员)") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String retireNature; + + @Column + @Comment("待遇") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String treatment; + + @Column + @Comment("医疗证号") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String medicalCertificateNumber; + + @Column + @Comment("原部门") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String originalDepartment; + + @Column + @Comment("家属姓名") + @ColDefine(type = ColType.VARCHAR, width = 20) + private String familyName; + + @Column + @Comment("备注(针对退休人员)") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String retireNotes; + + @Column + @Comment("基础病信息") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String basicDiseaseInfo; + /** * 前端菜单 */ diff --git a/src/main/java/io/v/nutz/web/commons/base/Globals.java b/src/main/java/io/v/nutz/web/commons/base/Globals.java index 928b9a4..212085c 100644 --- a/src/main/java/io/v/nutz/web/commons/base/Globals.java +++ b/src/main/java/io/v/nutz/web/commons/base/Globals.java @@ -55,7 +55,7 @@ public class Globals { //项目域名 (设置一个默认的 为优先级考虑) public static String AppDomain = "http://zhgh.zjitc.edu.cn"; //cas地址 - public static String CasAddress = "http://sso.zjitc.edu.cn/"; + public static String CasAddress = "https://sso.zjitc.edu.cn"; //文件访问域名 public static String AppFileDomain = ""; //文件上传路径 diff --git a/src/main/java/io/v/nutz/zhgh/jf/controller/activitybx/DivisionCon.java b/src/main/java/io/v/nutz/zhgh/jf/controller/activitybx/DivisionCon.java index 92f9c12..04aeb47 100644 --- a/src/main/java/io/v/nutz/zhgh/jf/controller/activitybx/DivisionCon.java +++ b/src/main/java/io/v/nutz/zhgh/jf/controller/activitybx/DivisionCon.java @@ -76,7 +76,7 @@ public class DivisionCon { act.*, u.loginname bxr_loginname, u.unionname bxr_unionname, - s.state_name, + s.stateName, s.state_color, abs.`name` absName FROM @@ -84,7 +84,7 @@ public class DivisionCon { LEFT JOIN `user` u ON act.user_id = u.id LEFT JOIN sys_unit su ON su.id = u.unitid LEFT JOIN sys_union un ON su.unionid = un.id - LEFT JOIN state s ON act.state_id = s.state_id + LEFT JOIN audit_state s ON act.stateId = s.state_id LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode $condition """); diff --git a/src/main/java/io/v/nutz/zhgh/mobile/therapyRecuperation/MobileTheRapyRecuperationEnrollController.java b/src/main/java/io/v/nutz/zhgh/mobile/therapyRecuperation/MobileTheRapyRecuperationEnrollController.java index c6a9592..3292792 100644 --- a/src/main/java/io/v/nutz/zhgh/mobile/therapyRecuperation/MobileTheRapyRecuperationEnrollController.java +++ b/src/main/java/io/v/nutz/zhgh/mobile/therapyRecuperation/MobileTheRapyRecuperationEnrollController.java @@ -64,4 +64,11 @@ public class MobileTheRapyRecuperationEnrollController { public void myRecuperation() { } + + @At("/userSignInfo") + @Ok("beetl:/mobile/therapyRecuperation/userSignInfo.html") + @RequiresAuthentication + public void userSignInfo() { + + } } diff --git a/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupManageController.java b/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupManageController.java index 2c1212b..3e7db5b 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupManageController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupManageController.java @@ -4,12 +4,13 @@ import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.query.PageForm; -import io.v.nutz.zhgh.retired.group.model.RetiredGroup; -import io.v.nutz.zhgh.retired.group.model.RetiredGroupUnit; +import io.v.nutz.base.result.Result; import io.v.nutz.sys.models.Sys_unit; import io.v.nutz.sys.models.Sys_user_role; import io.v.nutz.sys.services.SysUserService; import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.retired.group.model.RetiredGroup; +import io.v.nutz.zhgh.retired.group.model.RetiredGroupUnit; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.aop.interceptor.ioc.TransAop; @@ -54,8 +55,8 @@ public class RetiredGroupManageController { } @At - @RequiresPermissions("retired.group.manage") @ViReturn + @RequiresPermissions("retired.group.manage") public Object getTree() { HashMap topMap = new HashMap<>(); topMap.put("label", "离退办小组"); @@ -82,16 +83,16 @@ public class RetiredGroupManageController { * @return {@link Object} */ @At - @RequiresPermissions("retired.group.manage") @ViReturn + @RequiresPermissions("retired.group.manage") public Object doSetGroup(RetiredGroup retiredGroup) { dao.insertOrUpdate(retiredGroup); return null; } @At - @RequiresPermissions("retired.group.manage") @ViReturn + @RequiresPermissions("retired.group.manage") public Object groupPageData(PageForm pageForm) { Sql sql = Sqls.create("select * from retired_group $condition"); Cnd cnd = Cnd.NEW(); @@ -121,8 +122,8 @@ public class RetiredGroupManageController { * @return {@link Object} */ @At - @RequiresPermissions("retired.group.manage") @ViReturn + @RequiresPermissions("retired.group.manage") @Aop(TransAop.READ_COMMITTED) public Object deleteGroup(String id) { dao.clear(RetiredGroup.class, Cnd.where("id", "=", id)); @@ -131,8 +132,8 @@ public class RetiredGroupManageController { } @At - @RequiresPermissions("retired.group.manage") @ViReturn + @RequiresPermissions("retired.group.manage") public Object componentUnitPageData(PageForm pageForm, String groupId) { Sql sql = Sqls.create("select * from sys_unit $condition"); Cnd cnd = Cnd.NEW(); @@ -150,8 +151,8 @@ public class RetiredGroupManageController { * @return {@link Object} */ @At - @RequiresPermissions("retired.group.manage") @ViReturn + @RequiresPermissions("retired.group.manage") public Object groupComponentUnit(String groupId) { Sql sql = Sqls.create("select unitId from retired_group_unit where retiredGroupId = @groupId").setParam("groupId", groupId); return Daos.query(dao, sql.toString(), Sqls.callback.strs()); @@ -184,8 +185,8 @@ public class RetiredGroupManageController { */ @At @RequiresPermissions("retired.group.manage") - @ViReturn @Aop(TransAop.READ_COMMITTED) + @ViReturn public Object doSetComponentUnit(String groupId, @Param(value = "units", required = false) String[] units) { dao.clear(RetiredGroupUnit.class, Cnd.where("retiredGroupId", "=", groupId)); List insertGroupUnits = Arrays.stream(units).map(v -> { @@ -231,8 +232,9 @@ public class RetiredGroupManageController { """); sql.setParam("groupId", groupId); Cnd cnd = Cnd.NEW(); - cnd.and("u.userState", "=", "退休"); - cnd.and("u.personType", "=", "退休人员"); + cnd.and("u.userState", "=", "不在职"); +// cnd.and("u.personType", "=", "退休人员"); + cnd.and("u.unitid", "in", Sqls.create("select unitId from retired_group_unit where retiredGroupId = @retiredGroupId").setParam("retiredGroupId", groupId)); if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { SqlExpressionGroup seg = new SqlExpressionGroup(); @@ -256,8 +258,8 @@ public class RetiredGroupManageController { */ @At @RequiresPermissions("retired.group.manage") - @ViReturn @Aop(TransAop.READ_COMMITTED) + @ViReturn public Object setGroupLeader(String userId, String groupId) { dao.clear(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", "32752cd07253419b98f32ca14b9915f1")); dao.insert(Sys_user_role.class, Chain.make("userId", userId).add("roleId", "32752cd07253419b98f32ca14b9915f1").add("ltbGroupId", groupId)); diff --git a/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupStatisticsController.java b/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupStatisticsController.java index d70d8e4..473cb91 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupStatisticsController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/group/controller/RetiredGroupStatisticsController.java @@ -1,9 +1,10 @@ package io.v.nutz.zhgh.retired.group.controller; + import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.zhgh.retired.group.model.RetiredGroup; import io.v.nutz.sys.services.SysUserService; import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.retired.group.model.RetiredGroup; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; @@ -48,7 +49,7 @@ public class RetiredGroupStatisticsController { LEFT JOIN retired_group_unit rgu ON rgu.retiredGroupId = g.id LEFT JOIN sys_unit n on n.id = rgu.unitId LEFT JOIN sys_user u ON u.unitid = rgu.unitId - AND u.userState = '退休' + AND u.userState = '不在职' $condition """); Cnd cnd = Cnd.NEW(); diff --git a/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchManageController.java b/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchManageController.java index cce97e3..318d3c2 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchManageController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchManageController.java @@ -4,9 +4,9 @@ import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.query.PageForm; +import io.v.nutz.sys.services.SysUserService; import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranchUser; -import io.v.nutz.sys.services.SysUserService; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Chain; @@ -161,8 +161,8 @@ public class RetiredPartyBranchManageController { $condition """); Cnd cnd = Cnd.NEW(); - cnd.and("u.userState", "=", "退休"); - cnd.and("u.political", "=", "中共党员"); + cnd.and("u.retired", "=", 1); +// cnd.and("u.political", "=", "中共党员"); cnd.and("u.id", "not in", Sqls.create("select userId from retired_party_branch_user")); if (StrUtil.isNotBlank(val)) { SqlExpressionGroup seg = new SqlExpressionGroup(); diff --git a/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchStatisticsController.java b/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchStatisticsController.java index edc498b..c7f98f1 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchStatisticsController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/partyBranch/controller/RetiredPartyBranchStatisticsController.java @@ -1,8 +1,9 @@ package io.v.nutz.zhgh.retired.partyBranch.controller; + import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import io.v.nutz.sys.services.SysUserService; +import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; @@ -57,7 +58,7 @@ public class RetiredPartyBranchStatisticsController { @At @ViReturn public Object retiredPartyBranch() { - return sysUserService.dao().query(RetiredPartyBranch.class, Cnd.NEW().asc("partyBranchCode")); + return sysUserService.dao().query(RetiredPartyBranch.class,Cnd.NEW().asc("partyBranchCode")); } } diff --git a/src/main/java/io/v/nutz/zhgh/retired/user/contants/RetiredUserChangeType.java b/src/main/java/io/v/nutz/zhgh/retired/user/contants/RetiredUserChangeType.java index 7d1bd70..3fcf0cf 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/user/contants/RetiredUserChangeType.java +++ b/src/main/java/io/v/nutz/zhgh/retired/user/contants/RetiredUserChangeType.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.retired.user.contants; + import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserHistoryController.java b/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserHistoryController.java index bb95519..dc8f789 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserHistoryController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserHistoryController.java @@ -4,10 +4,10 @@ import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.query.PageForm; -import io.v.nutz.zhgh.retired.group.model.RetiredGroup; -import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import io.v.nutz.sys.services.SysUserService; import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.retired.group.model.RetiredGroup; +import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; @@ -105,7 +105,7 @@ public class RetiredUserHistoryController { @At @ViReturn public Object retiredGroup() { - return dao.query(RetiredGroup.class, Cnd.NEW().asc("groupCode")); + return dao.query(RetiredGroup.class,Cnd.NEW().asc("groupCode")); } @At diff --git a/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserListController.java b/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserListController.java index 115178f..18db4f6 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserListController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserListController.java @@ -1,20 +1,33 @@ package io.v.nutz.zhgh.retired.user.controller; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.result.Result; +import io.v.nutz.base.utils.PinyinUtil; +import io.v.nutz.base.utils.ViTool; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.sys.models.Sys_user_role; +import io.v.nutz.sys.services.SysUserService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.activity.models.ActivityUserScope; import io.v.nutz.zhgh.retired.group.model.RetiredGroup; import io.v.nutz.zhgh.retired.group.model.RetiredUserHistory; import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import io.v.nutz.zhgh.retired.user.contants.RetiredUserChangeType; +import io.v.nutz.zhgh.retired.user.mode.RetiredUserTemplate; import io.v.nutz.zhgh.retired.user.model.RetiredUserChange; -import io.v.nutz.sys.models.Sys_user; -import io.v.nutz.sys.services.SysUserService; -import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.staffmanage.member.UserMode; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Chain; @@ -29,14 +42,21 @@ import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; 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; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; +import org.nutz.mvc.upload.TempFile; +import org.nutz.mvc.upload.UploadAdaptor; import org.springframework.beans.BeanUtils; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.function.Function; import java.util.stream.Collectors; @IocBean @@ -69,12 +89,7 @@ public class RetiredUserListController { @At @RequiresPermissions("retired.user.list") @ViReturn - public Object pageData(PageForm pageForm, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "retiredGroupId", required = false) String retiredGroupId, - @Param(value = "retiredPartyBranchId", required = false) String retiredPartyBranchId - ) { + public Object pageData(PageForm pageForm, @Param(value = "unitId", required = false) String unitId, @Param(value = "unionId", required = false) String unionId, @Param(value = "retiredGroupId", required = false) String retiredGroupId, @Param(value = "retiredPartyBranchId", required = false) String retiredPartyBranchId) { Sql sql = Sqls.create(""" SELECT u.id, @@ -96,10 +111,11 @@ public class RetiredUserListController { LEFT JOIN retired_group rg ON rg.id = rgu.retiredGroupId LEFT JOIN retired_party_branch_user rpbu ON rpbu.userId = u.id LEFT JOIN retired_party_branch rpb ON rpb.id = rpbu.partyBranchId - $condition + $condition """); Cnd cnd = Cnd.NEW(); cnd.and("u.retired", "=", 1); +// cnd.and("u.userState", "=", "不在岗"); cnd.andEX("u.unitId", "=", unitId); cnd.andEX("u.unionId", "=", unionId); cnd.andEX("rg.id", "=", retiredGroupId); @@ -134,10 +150,7 @@ public class RetiredUserListController { @ViReturn @Aop(TransAop.READ_COMMITTED) public Object changeToDie(String userId, Date deathDate) { - sysUserService.update(Chain.make("userState", "死亡") - .add("personType", "去世人员") - .add("deathDate", deathDate), - Cnd.where("id", "=", userId)); + sysUserService.update(Chain.make("userState", "死亡").add("personType", "去世人员").add("deathDate", deathDate), Cnd.where("id", "=", userId)); RetiredUserChange retiredUserChange = new RetiredUserChange(); retiredUserChange.setUserId(userId); retiredUserChange.setChangeDate(new Date()); @@ -174,7 +187,6 @@ public class RetiredUserListController { """); Cnd cnd = Cnd.NEW(); cnd.and("u.retired", "=", 0); - cnd.and("u.userState", "=", "在职"); if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup(); @@ -205,10 +217,7 @@ public class RetiredUserListController { @RequiresPermissions("retired.user.list") @Aop(TransAop.READ_COMMITTED) public Object doBatchJoinRetire(@Param("userIds") String[] userIds) { - sysUserService.update(Chain.make("userState", "退休") - .add("personType", "退休人员") - .add("retired", 1), - Cnd.where("id", "in", userIds)); + sysUserService.update(Chain.make("retired", 1), Cnd.where("id", "in", userIds)); List insertRetiredUserChanges = Arrays.stream(userIds).map(v -> { RetiredUserChange retiredUserChange = new RetiredUserChange(); @@ -273,22 +282,7 @@ public class RetiredUserListController { public Object userInfo(String userId) { Sql sql = Sqls.create(""" SELECT - u.username, - u.loginname, - u.sex, - u.threeUnitName, - u.unitname, - u.unionname, - u.political, - u.birthday, - u.nation, - u.education, - u.userState, - u.personType, - u.mobile, - u.idcard, - rg.groupName as retiredGroupName, - rpb.partyBranchName as retiredPartyBranchName + u.* FROM `user` u LEFT JOIN retired_group_unit rgu ON rgu.unitId = u.unitid @@ -301,4 +295,210 @@ public class RetiredUserListController { return Daos.query(sysUserService.dao(), sql.toString(), Sqls.callback.map()); } + /** + * 新增、编辑退休人员 + * + * @param user + * @param userId + * @return {@link Object} + */ + @At + @ViReturn + @RequiresPermissions("retired.user.list") + @Aop(TransAop.READ_COMMITTED) + public Object doSubmit(@Param("user") Sys_user user, @Param(required = false, value = "userId") String userId) { + if (StrUtil.isBlank(userId)) { + UserMode.initUser(user); + dao.insert(user); + UserMode.addPublicRole(user.getId()); + } else { + dao.updateIgnoreNull(user); + } + return null; + } + + @At + @ViReturn + @RequiresPermissions("retired.user.list") + @Aop(TransAop.READ_COMMITTED) + public Object getInfo(String id) { + Sys_user user = dao.fetch(Sys_user.class, id); + return user; + } + + @At + @ViReturn + @RequiresPermissions("retired.user.list") + @Aop(TransAop.READ_COMMITTED) + public Object doDelete(String id) { + dao.clear(Sys_user.class, Cnd.where("id", "=", id)); + dao.clear(Sys_user_role.class, Cnd.where("userId", "=", id)); + return null; + } + + + /** + * 离退休人员,导入下载模版 + * + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("retired.user.list") + public void downloadImport(HttpServletResponse response) { + try { + ViTool.excelResponse(response, "离退休人员导入模版.xlsx"); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook sheets = ExcelExportUtil.exportExcel(exportParams, RetiredUserTemplate.class, new ArrayList<>()); + ServletOutputStream outputStream = response.getOutputStream(); + sheets.write(outputStream); + outputStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @At + @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("retired.user.list") + public Object doImport(TempFile file) { + try { + List retiredUserImportList = ExcelImportUtil.importExcel(file.getFile(), RetiredUserTemplate.class, new ImportParams()); + List users = sysUserService.query(Cnd.where("idcard", "is not", null).and("idcard", "!=", "")); + + Map userMap = users.stream().collect(Collectors.toMap(Sys_user::getIdcard, Function.identity(), (o1, o2) -> o1)); + + List errorInfos = new ArrayList<>(); + //需要新增的离退休人员 + List needInsertUserList = new ArrayList<>(); + //需要修改的离退休人员 + List needUpdateUserList = new ArrayList<>(); + + List userScopeList = new ArrayList<>(); + Sql sql = Sqls.create("SELECT MAX(DISTINCT groupId) AS groupId FROM activity_user_scope"); + NutMap query = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); + Integer groupId = query.getInt("groupId") + 1; + + String groupName = DateUtil.thisYear() + "年" + (DateUtil.thisMonth() + 1) + "月离退休教职工"; + + for (RetiredUserTemplate template : retiredUserImportList) { + if (StrUtil.isBlank(template.getUsername())) { + template.setErrorMsg("获取不到该用户的姓名!"); + errorInfos.add(template); + continue; + } else if (StrUtil.isBlank(template.getIdCard())) { + template.setErrorMsg("获取不到该用户的身份证号!"); + errorInfos.add(template); + continue; + } + + Sys_user user = new Sys_user(); + user.setRetired(true); + user.setRetireNature(template.getRetireNature()); + user.setUsername(template.getUsername().trim()); + user.setSex(template.getSex()); + user.setNation(template.getNation()); +// user.setBirthday(template.getBirthday()); +// user.setPartyJoiningTime(DateUtil.parse(template.getPartyJoiningTime(),"yyyy-MM")); +// user.setWorkStartDate(DateUtil.parse(template.getWorkStartDate(),"yyyy-MM")); +// user.setSchoolTime(template.getSchoolTime()); + user.setEducation(template.getEducation()); + user.setHometown(template.getHometown()); + user.setJobTitle(template.getJobTitle()); + user.setTreatment(template.getTreatment()); +// user.setRetirementTime(DateUtil.parse(template.getRetirementTime(),"yyyy-MM")); + user.setIdcard(template.getIdCard()); + user.setMedicalCertificateNumber(template.getMedicalCertificateNumber()); + user.setOriginalDepartment(template.getOriginalDepartment()); + user.setFamilyName(template.getFamilyName()); + user.setHomeAddress(template.getHomeAddress()); + user.setMobile(template.getRetirePhone()); + user.setRetireNotes(template.getRetireNotes()); + user.setBasicDiseaseInfo(template.getBasicDiseaseInfo()); + + Sys_user sysUser = userMap.get(template.getIdCard()); + + ActivityUserScope userScope = new ActivityUserScope(); + userScope.setGroupName(groupName); + userScope.setGroupId(groupId); + if (Lang.isNotEmpty(sysUser)) { + user.setId(sysUser.getId()); + userScope.setUserId(sysUser.getId()); + needUpdateUserList.add(user); + } else { + String pinYinHeadChar = PinyinUtil.getPinYinHeadChar(template.getUsername().trim()); + String idCardLastSix = template.getIdCard().substring(template.getIdCard().length() - 6); + user.setLoginname(pinYinHeadChar + idCardLastSix); + Sys_user initUser = UserMode.initUser(user); + initUser.setRetired(true); + userScope.setUserId(initUser.getId()); + needInsertUserList.add(initUser); + } + userScopeList.add(userScope); + } + + + if (Lang.isNotEmpty(needInsertUserList)) { + sysUserService.dao().fastInsert(needInsertUserList); + } + + if (Lang.isNotEmpty(needInsertUserList)) { + sysUserService.dao().updateIgnoreNull(needUpdateUserList); + } + + if (Lang.isNotEmpty(userScopeList)) { + sysUserService.dao().insert(userScopeList); + } + + if (Lang.isNotEmpty(errorInfos)) { + NutMap nutMap = NutMap.NEW(); + nutMap.setv("totalCount", retiredUserImportList.size()); + nutMap.setv("successCount", (needUpdateUserList.size() + needUpdateUserList.size())); + nutMap.setv("errorCount", errorInfos.size()); + nutMap.setv("errorList", errorInfos.stream().map(v -> { + return NutMap.NEW().addv("姓名", v.getUsername()).addv("错误原因", v.getErrorMsg()); + }).collect(Collectors.toList())); + return Result.success(nutMap); + } + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + + } + + + + @At + @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("retired.user.list") + public Object doImport1(TempFile file) { + List retiredUserImportList = ExcelImportUtil.importExcel(file.getFile(), RetiredUserTemplate.class, new ImportParams()); + + List retiredUserList = dao.query(Sys_user.class, + Cnd.where("retired", "=", 1).and("username","not in",List.of("雍炳华","凤孟贤","王伟"))); + + Map map = retiredUserList.stream().collect(Collectors.toMap(Sys_user::getUsername, v -> v)); + List needUpdateList = new ArrayList<>(); + + retiredUserImportList.forEach(v->{ + Sys_user sysUser = map.get(v.getUsername()); + if (Lang.isNotEmpty(sysUser)){ + if (!v.getRetirePhone().equals(sysUser.getMobile())){ + sysUser.setMobile(v.getRetirePhone()); + needUpdateList.add(sysUser); + } + } + }); + + dao.updateIgnoreNull(needUpdateList); + + return null; + } } + diff --git a/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserStatisticsController.java b/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserStatisticsController.java index 217186d..1ff160d 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserStatisticsController.java +++ b/src/main/java/io/v/nutz/zhgh/retired/user/controller/RetiredUserStatisticsController.java @@ -4,10 +4,10 @@ import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.query.PageForm; -import io.v.nutz.zhgh.retired.group.model.RetiredGroup; -import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import io.v.nutz.sys.services.SysUserService; import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.retired.group.model.RetiredGroup; +import io.v.nutz.zhgh.retired.partyBranch.model.RetiredPartyBranch; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; diff --git a/src/main/java/io/v/nutz/zhgh/retired/user/mode/RetiredUserTemplate.java b/src/main/java/io/v/nutz/zhgh/retired/user/mode/RetiredUserTemplate.java new file mode 100644 index 0000000..b7ec03a --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/retired/user/mode/RetiredUserTemplate.java @@ -0,0 +1,86 @@ +package io.v.nutz.zhgh.retired.user.mode; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @version 1.0 + * @Author zzr + * @name:RetiredUserTemplate + * @Date 2024/4/29 17:32 + * @注释 离退休人员导入模版 + */ +@Data +public class RetiredUserTemplate { + +// @Excel(name = "工号") + private String loginName; + + @Excel(name = "性质") + private String retireNature; + + @Excel(name = "姓名") + private String username; + + @Excel(name = "性别") + private String sex; + + @Excel(name = "民族") + private String nation; + + @Excel(name = "出生年月",importFormat = "yyyy-MM") + private String birthday; + + @Excel(name = "入党时间",importFormat = "yyyy-MM") + private String partyJoiningTime; + + @Excel(name = "所属支部") + private String belongBranch; + + @Excel(name = "工作时间",importFormat = "yyyy-MM") + private String workStartDate; + + @Excel(name = "进校时间",importFormat = "yyyy-MM") + private String schoolTime; + + @Excel(name = "文化程度") + private String education; + + @Excel(name = "籍贯") + private String hometown; + + @Excel(name = "职称") + private String jobTitle; + + @Excel(name = "待遇") + private String treatment; + + @Excel(name = "退休时间",importFormat = "yyyy-MM") + private String retirementTime; + + @Excel(name = "身份证号码") + private String idCard; + + @Excel(name = "医疗证号") + private String medicalCertificateNumber; + + @Excel(name = "基础病信息") + private String basicDiseaseInfo; + + @Excel(name = "原部门") + private String originalDepartment; + + @Excel(name = "家属姓名") + private String familyName; + + @Excel(name = "家庭住址") + private String homeAddress; + + @Excel(name = "联系方式") + private String retirePhone; + + @Excel(name = "备注") + private String retireNotes; + + private String errorMsg; +} diff --git a/src/main/java/io/v/nutz/zhgh/retired/user/model/RetiredUserChange.java b/src/main/java/io/v/nutz/zhgh/retired/user/model/RetiredUserChange.java index 222622f..57d8d51 100644 --- a/src/main/java/io/v/nutz/zhgh/retired/user/model/RetiredUserChange.java +++ b/src/main/java/io/v/nutz/zhgh/retired/user/model/RetiredUserChange.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.retired.user.model; import io.v.nutz.base.model.BaseModel; -import io.v.nutz.zhgh.retired.user.contants.RetiredUserChangeType; import lombok.Data; import lombok.EqualsAndHashCode; import org.nutz.dao.entity.annotation.*; diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/MemberCommonController.java b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/MemberCommonController.java index d3dbb23..42576a7 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/MemberCommonController.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/MemberCommonController.java @@ -302,7 +302,7 @@ public class MemberCommonController { COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_user' - AND TABLE_SCHEMA = 'zhgh_hmc' + AND TABLE_SCHEMA = 'zhgh_zjitc' """); List userTableColumnInfos = sysUserService.listMap(userColumnSql); diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/change/MemberChangeBranchUnionAuditController.java b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/change/MemberChangeBranchUnionAuditController.java index 6e75870..8c20a58 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/change/MemberChangeBranchUnionAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/change/MemberChangeBranchUnionAuditController.java @@ -5,6 +5,7 @@ import cn.wizzer.framework.base.Result; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.model.Audit; +import io.v.nutz.base.utils.Vi; import io.v.nutz.sys.services.SysLocalProcessService; import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.web.commons.utils.ShiroUtil; @@ -73,6 +74,9 @@ public class MemberChangeBranchUnionAuditController { $condition """); Cnd cnd = Cnd.NEW(); + if (!ShiroUtil.hasAnyRoles("sysadmin, A06, SchoolUnionMemberAdmin")) { + cnd.and("record.allocationUnionId", "=", Vi.getUnionId()); + } pageForm.buildSearch(cnd, "record."); if (pageForm.getAudit()) { cnd.and("record.applyStateId", ">", 10020); diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/specialstaff/controller/SpecialStaffManageController.java b/src/main/java/io/v/nutz/zhgh/staffmanage/specialstaff/controller/SpecialStaffManageController.java index 7abba93..fd8c7c0 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/specialstaff/controller/SpecialStaffManageController.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/specialstaff/controller/SpecialStaffManageController.java @@ -133,7 +133,7 @@ public class SpecialStaffManageController { @At @RequiresPermissions("staff.special.manage") - public Result queryUser(String keyWord) { + public Result queryUser(String keyWord,Boolean con) { Sql sql = Sqls.create(""" select id, @@ -148,7 +148,10 @@ public class SpecialStaffManageController { $condition """); Cnd cnd = Cnd.NEW(); - cnd.and("id", "not in", "(select userId from special_staff)"); + if (con==null||!con){ + cnd.and("id", "not in", "(select userId from special_staff)"); + } + if (StrUtil.isNotBlank(keyWord)) { SqlExpressionGroup seg = new SqlExpressionGroup(); seg.orLike("username", keyWord); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/common/TherapyRecuperationCommon.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/common/TherapyRecuperationCommon.java new file mode 100644 index 0000000..ed15a1c --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/common/TherapyRecuperationCommon.java @@ -0,0 +1,20 @@ +package io.v.nutz.zhgh.therapyRecuperation.common; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; + +public class TherapyRecuperationCommon { + + public static String getRemarkBySchoolTime(String schoolTime) { + if(StrUtil.isNotBlank(schoolTime)) { + DateTime schoolDate = DateUtil.parse(schoolTime); + DateTime time = DateUtil.parse(DateUtil.thisYear() + "-07-01"); + int compareResult = DateUtil.compare(schoolDate, time); + return compareResult >= 0 ? ("入校时间为:" + schoolTime + ",疗休养额度为1500。") : ""; + } else { + return ""; + } + } + +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationJoinUserImportExcelMode.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationJoinUserImportExcelMode.java index 646b3f8..04340b6 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationJoinUserImportExcelMode.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationJoinUserImportExcelMode.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; /** - * @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationJoinUserImportExcelMode + * @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationJoinUserImportExcelMode * @Description: 参加人员导入excel mode * @Author zxc * @Date 2022/6/14:11:10 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java index 879a2d7..49fdf16 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java @@ -1,11 +1,12 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; + import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; /** - * @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationSignUpMode + * @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode * @Description: 线路创建模式 * @Author zxc * @Date 2022/6/2:15:22 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java index ec9dd44..212e2ef 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java @@ -1,11 +1,12 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; + import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; /** - * @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationProvinceType + * @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationProvinceType * @Description: TODO * @Author zxc * @Date 2022/6/2:14:08 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java index abfacc6..58d0543 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java @@ -1,11 +1,12 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; + import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; /** - * @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationSignUpMode + * @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode * @Description: 报名模式 * @Author zxc * @Date 2022/6/2:15:22 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java index b738071..ec1c0e2 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; + import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; @@ -8,7 +9,7 @@ import java.util.HashMap; import java.util.Map; /** - * @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationType + * @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType * @Description: 疗休养分类 * @Author zxc * @Date 2022/6/2:14:02 @@ -31,7 +32,7 @@ public enum TheRapyRecuperationType { /** * 省内旅行社 */ - provinceInTravelAgency("旅行社", 2, TheRapyRecuperationProvinceType.provinceIn.getValue(), "/assets/mobile/img/therapyRecuperation/lxs.png"), + provinceInTravelAgency("自由组团", 2, TheRapyRecuperationProvinceType.provinceIn.getValue(), "/assets/mobile/img/therapyRecuperation/lxs.png"), /** * 酒店 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java index 6deb5ef..bd20a29 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java @@ -2,33 +2,40 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.audit; import cn.hutool.core.util.StrUtil; + import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.utils.RCSCloudAPI; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.model.Audit; import io.v.nutz.base.model.AuditState; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.utils.Vi; import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService; -import io.v.nutz.web.commons.utils.ShiroUtil; +import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.Daos; import org.nutz.dao.util.cri.Static; +import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; -import org.nutz.mvc.annotation.Param; import org.nutz.trans.Trans; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -54,16 +61,15 @@ public class TheRapyRecuperationAuditController { @Inject private Dao dao; + @Inject + private MsgApi msgApi; @At @ViReturn - public Object getXlByUnion(@Param(value = "state", required = false) Integer state, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "year", required = false) String year, - @Param(value = "signUpMode", required = false) Integer signUpMode) { + @RequiresAuthentication + public Object getXlByUnion(Integer state, String unionId, String regionalNature, String year, String endYear, Integer signUpMode) { - List xlByUnion = auditService.getXlByUnion(state, unionId, regionalNature, year, signUpMode); + List xlByUnion = auditService.getXlByUnion(state, unionId, regionalNature, year, endYear, signUpMode); return xlByUnion; } @@ -71,15 +77,44 @@ public class TheRapyRecuperationAuditController { @At @ViReturn + @RequiresAuthentication + public Object getXlByUnionAudit(String unionId, String regionalNature, String year, Integer signUpMode) { + Sql sql = Sqls.create(""" + SELECT + line.id, + line.lineName, + line.regionalNature, + ts.id as selectId, + ts.playStartTime, + ts.playEndTime + FROM + the_rapy_recuperation_line_union_select ts + LEFT JOIN the_rapy_recuperation_line line ON line.id = ts.lineId + $condition + """); + Cnd cnd = Cnd.NEW(); + if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.andEX("ts.unionId", "=", unionId); + } else { + cnd.and("ts.unionId", "=", vi.getUnionId()); + } + cnd.andEX("YEAR(ts.selectTime)", "=", year); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.andEX("line.signUpMode", "=", signUpMode); + cnd.groupBy("line.id"); + sql.setCondition(cnd); + return auditService.listMap(sql); + } + + + @At + @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyAudit") - public Object pageData(PageForm pageForm, @Param(value = "year", required = false) String year, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "state", required = false) String state, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "isAudit", required = false) String isAudit, - @Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "lotId", required = false) String lotId) { + public Object pageData(PageForm pageForm, String year, String unionId, + String unitId, String state, String takePartInLineId, + String isAudit, String regionalNature, String lotId, + String selectId) { Sql sql = Sqls.create(""" SELECT enroll.*, @@ -89,6 +124,7 @@ public class TheRapyRecuperationAuditController { '教职工' userNature, state.stateColor, state.stateName, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, IF ( enroll.takePartInUnionId != enroll.selfUnionId, TRUE, FALSE ) isTransferIn, ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily, @@ -107,9 +143,10 @@ public class TheRapyRecuperationAuditController { cnd.andEX("enroll.selfUnionId", "=", unionId); cnd.and("enroll.takePartInLineId", "is not", null); cnd.andEX("enroll.selfUnitId", "=", unitId); - cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + cnd.andEX("lineu.lineId", "=", takePartInLineId); cnd.andEX("enroll.isNormal", "=", true); cnd.andEX("lineu.signUpMode", "=", 1); + cnd.andEX("lineu.id", "=", selectId); if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword()); } @@ -120,7 +157,7 @@ public class TheRapyRecuperationAuditController { } else if (state.equals("2")) { cnd.andEX("enroll.takePartInUnionId", "!=", Vi.getUnionId()); cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); - } else { + } else if (state.equals("3")) { cnd.andEX("enroll.selfUnionId", "!=", Vi.getUnionId()); cnd.andEX("enroll.takePartInUnionId", "=", Vi.getUnionId()); } @@ -136,11 +173,14 @@ public class TheRapyRecuperationAuditController { ((enroll.stateId = %s OR enroll.stateId=%s )AND enroll.takePartInUnionId='%s') """.formatted(TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId()))); } else { - cnd.and(new Static(""" + /*cnd.and(new Static(""" ((( enroll.stateId = %s OR enroll.stateId = %s OR enroll.stateId = %s ) AND enroll.selfUnionId = '%s' ) OR ((enroll.stateId = %s OR enroll.stateId=%s )AND enroll.takePartInUnionId='%s')) - """.formatted(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNIT, TheRapyRecuperationState.PASS, vi.getUnionId(), TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId()))); + """.formatted(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNIT, TheRapyRecuperationState.PASS, vi.getUnionId(), TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId())));*/ + cnd.and(new Static(""" + ((enroll.stateId = %s OR enroll.stateId=%s )AND enroll.takePartInUnionId='%s') + """.formatted(TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId()))); } } else { cnd.and(new Static(""" @@ -148,12 +188,16 @@ public class TheRapyRecuperationAuditController { """.formatted(TheRapyRecuperationState.UNIT, vi.getUnionId(), TheRapyRecuperationState.LINEUNIT, vi.getUnionId()))); } } else { - cnd.and(Cnd.exps("enroll.selfUnionId", "=", vi.getUnionId()).or("enroll.takePartInUnionId", "=", vi.getUnionId())); + //屏蔽了本工会选择其他工会线路的人员 +// cnd.and(Cnd.exps("enroll.selfUnionId", "=", vi.getUnionId()).or("enroll.takePartInUnionId", "=", vi.getUnionId())); + cnd.and("enroll.takePartInUnionId", "=", vi.getUnionId()); } cnd.desc("enroll.signingUptime"); cnd.desc("enroll.unitName"); + +// cnd.having(Cnd.where("isTransferIn","=",0)); sql.setCondition(cnd); return auditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); @@ -163,6 +207,7 @@ public class TheRapyRecuperationAuditController { @At @ViReturn + @RequiresAuthentication public Object findOne(String id) { NutMap one = auditService.findOne(id); return one; @@ -179,11 +224,9 @@ public class TheRapyRecuperationAuditController { */ @At @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyAudit") - public Object doAudit(@Param(value = "id", required = false) String id, - @Param(value = "flag", required = false) boolean flag, - @Param(value = "isTransferIn", required = false) boolean isTransferIn, - @Param(value = "auditOpinion", required = false) String auditOpinion) { + public Object doAudit(String id, boolean flag, Boolean adjustment, boolean isTransferIn, String auditOpinion) { Trans.exec(() -> { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); Audit audit = new Audit(); @@ -219,8 +262,13 @@ public class TheRapyRecuperationAuditController { enroll.setStateId(TheRapyRecuperationState.LINEUNITFAIL); } } + auditService.updateIgnoreNull(enroll); - //auditMsg(enroll.getStateId(), enroll.getLoginName(), enroll.getTakePartInLineId()); + auditMsg(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId()); + if (adjustment) { +// enroll.setNormal(false); + auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", enroll.getId())); + } }); return null; } @@ -233,9 +281,11 @@ public class TheRapyRecuperationAuditController { */ @At @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyAudit") public Object doRecall(String id) { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); + TheRapyRecuperationLineUnionSelect unionSelect = auditService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", enroll.getTakePartInLineId())); if (enroll.getStateId().equals(TheRapyRecuperationState.UNITFAIL)) { enroll.setStateId(TheRapyRecuperationState.UNIT); enroll.setSelfUnionAuditId(null); @@ -245,10 +295,12 @@ public class TheRapyRecuperationAuditController { } else if (enroll.getStateId().equals(TheRapyRecuperationState.LINEUNITFAIL)) { enroll.setStateId(TheRapyRecuperationState.LINEUNIT); enroll.setSelfUnionAuditId(null); - } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getSelfUnionId().equals(vi.getUnionId())) { +// } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getSelfUnionId().equals(vi.getUnionId())) { + } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getSelfUnionId().equals(unionSelect.getUnionId())) { enroll.setStateId(TheRapyRecuperationState.UNIT); enroll.setSelfUnionAuditId(null); - } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getTakePartInUnionId().equals(vi.getUnionId())) { +// } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getTakePartInUnionId().equals(vi.getUnionId())) { + } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getTakePartInUnionId().equals(unionSelect.getUnionId())) { enroll.setStateId(TheRapyRecuperationState.LINEUNIT); enroll.setJoinLineUnionAuditId(null); } @@ -267,9 +319,10 @@ public class TheRapyRecuperationAuditController { */ @At @ViReturn + @RequiresAuthentication + @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("theRapyRecuperation.TheRapyAudit") - public Object doOnekeyAudit(@Param(value = "ids", required = false) String[] ids, - @Param(value = "auditOpinion", required = false) String auditOpinion, boolean flag) { + public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag, Boolean adjustment) { Audit audit = new Audit(); audit.setAuditOpinion(auditOpinion); audit.setAuditor(ShiroUtil.getUserId()); @@ -278,6 +331,7 @@ public class TheRapyRecuperationAuditController { audit.setAuditTime(new Date()); audit.setAuditPass(flag); Audit insert = auditService.insert(audit); + List enrollIdList = new ArrayList<>(); for (String id : ids) { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); //如果状态等于分工会审核,并且参加的线路分工会也是自己的工会,就代表自己参加自己的工会线路 @@ -292,9 +346,14 @@ public class TheRapyRecuperationAuditController { enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.LINEUNITFAIL); enroll.setJoinLineUnionAuditId(insert.getId()); } + if (adjustment) { +// enroll.setNormal(false); + enrollIdList.add(id); + } auditService.updateIgnoreNull(enroll); -// auditMsg(enroll.getStateId(), enroll.getLoginName(), enroll.getTakePartInLineId()); + auditMsg(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId()); } + auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", enrollIdList)); return null; } @@ -305,19 +364,22 @@ public class TheRapyRecuperationAuditController { * @param loginName * @param takePartInLineId */ - private void auditMsg(Integer stateId, - String loginName, - String takePartInLineId) { + private void auditMsg(Integer stateId, String loginName, Boolean adjustment, String takePartInLineId) { Sys_user user = auditService.dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); - TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", takePartInLineId)); + TheRapyRecuperationLineUnionSelect unionSelect = auditService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", takePartInLineId)); + TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", unionSelect.getLineId())); AuditState auditState = auditService.dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateId)); - if (stateId.equals(TheRapyRecuperationState.UNITFAIL)) { - RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", ""); - } else if (stateId.equals(TheRapyRecuperationState.LINEUNITFAIL)) { - RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", ""); - } else if (stateId.equals(TheRapyRecuperationState.PASS)) { - RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", ""); + + String content = "【智慧工会】%s老师您好,您报名的%s线路因报名人数不足已取消,请尽快进入智慧工会重新选择线路。" + .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); + + List list = List.of(Map.of("type", "User", "userId", user.getLoginname(), "name", user.getUsername())); + if (stateId.equals(TheRapyRecuperationState.PASS)) { + content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。" + .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); + } + //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); } @@ -328,6 +390,7 @@ public class TheRapyRecuperationAuditController { */ @At @ViReturn + @RequiresAuthentication public Object getBmUserUnion() { Sql sql = Sqls.create(""" SELECT @@ -340,7 +403,9 @@ public class TheRapyRecuperationAuditController { Cnd cnd = Cnd.NEW(); if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) { cnd.and("takePartInLineId", "IS NOT", null); + cnd.and("takePartInLineId", "!=", ""); cnd.and(Cnd.exps("takePartInUnionId", "=", vi.getUnionId()).or("selfUnionId", "=", vi.getUnionId())); + //cnd.and("selfUnionId", "=", vi.getUnionId()); } cnd.groupBy("selfUnionId"); sql.setCondition(cnd); @@ -357,18 +422,26 @@ public class TheRapyRecuperationAuditController { */ @At @ViReturn - public Object getApplyNumAudit(@Param(value = "mode", required = false) String mode, - @Param(value = "isAudit", required = false) String isAudit, - @Param(value = "year", required = false) Integer year) { + @RequiresAuthentication + public Object getApplyNumAudit(String takePartInLineId, String mode, String isAudit, Integer year, String selectId) { + TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); String unionId = Vi.getUnionId(); Sql sql = Sqls.create(""" SELECT - COUNT( 1 ) + COUNT(1) as signUpNum, + $val as familyNumber FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId $condition """); + String val = ""; + if (config.getFamilyInfo() == 1) { + val = "IFNULL(sum(familyNumber),0)"; + } else { + val = "IFNULL((select count(1) from the_rapy_recuperation_enroll_companion where trreId = enroll.id),0)"; + } + sql.setVar("val", val); Sql sql2 = sql; Sql sql3 = sql; Sql sql4 = sql; @@ -380,13 +453,16 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 1); + .andEX("signUpMode", "=", 1) + .andEX("lineu.id", "=", selectId); if (StrUtil.isNotBlank(mode)) { cnd1.and("stateId", "=", TheRapyRecuperationState.PASS); } sql.setCondition(cnd1); - int count1 = auditService.count(sql); + NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber", 0))); //本工会人员(其他路线) Cnd cnd2 = Cnd.NEW(); @@ -394,13 +470,16 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 1); + .andEX("signUpMode", "=", 1) + .andEX("lineu.id", "=", selectId); if (StrUtil.isNotBlank(mode)) { cnd2.and("stateId", "=", TheRapyRecuperationState.PASS); } sql2.setCondition(cnd2); - int count2 = auditService.count(sql2); + NutMap map2 = (NutMap) Daos.query(dao, sql2.toString(), Sqls.callback.map()); + int count2 = Integer.parseInt(String.valueOf(map2.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map2.getOrDefault("familyNumber", 0))); //其他工会人员(选我线路) Cnd cnd3 = Cnd.NEW(); @@ -408,26 +487,32 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "!=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 1); + .andEX("signUpMode", "=", 1) + .andEX("lineu.id", "=", selectId); if (StrUtil.isNotBlank(mode)) { cnd3.and("stateId", "=", TheRapyRecuperationState.PASS); } sql3.setCondition(cnd3); - int count3 = auditService.count(sql3); + NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map()); + int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber", 0))); //选择校工会线路人员 Cnd cnd4 = Cnd.NEW(); cnd4.and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 2); + .andEX("signUpMode", "=", 2) + .andEX("lineu.id", "=", selectId); if (StrUtil.isNotBlank(mode)) { cnd4.and("stateId", "=", TheRapyRecuperationState.PASS); } sql4.setCondition(cnd4); - int count4 = auditService.count(sql4); + NutMap map4 = (NutMap) Daos.query(dao, sql4.toString(), Sqls.callback.map()); + int count4 = Integer.parseInt(String.valueOf(map4.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map4.getOrDefault("familyNumber", 0))); return Map.of("count1", count1, "count2", count2, "count3", count3, "count4", count4); } @@ -436,26 +521,29 @@ public class TheRapyRecuperationAuditController { //本公会人员(自己线路) Cnd cnd1 = Cnd.NEW(); cnd1.and("takePartInUnionId", "=", unionId) - .and("selfUnionId", "=", unionId) - .and("isNormal", "=", true) - .and("takePartInLineId", "is not", null). - andEX("YEAR(signingUptime)", "=", year) - .and("stateId", ">", TheRapyRecuperationState.UNIT) - .andEX("signUpMode", "=", 1); - sql.setCondition(cnd1); - int count1 = auditService.count(sql); - - //本工会人员(其他路线) - Cnd cnd2 = Cnd.NEW(); - cnd2.and("takePartInUnionId", "!=", unionId) .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", ">", TheRapyRecuperationState.UNIT) .andEX("signUpMode", "=", 1); - sql2.setCondition(cnd2); - int count2 = auditService.count(sql2); + sql.setCondition(cnd1); + NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber", 0))); + + + //本工会人员(其他路线) +// Cnd cnd2 = Cnd.NEW(); +// cnd2.and("takePartInUnionId", "!=", unionId) +// .and("selfUnionId", "=", unionId) +// .and("isNormal", "=", true) +// .and("takePartInLineId", "is not", null) +// .andEX("YEAR(signingUptime)", "=", year) +// .and("stateId", ">", TheRapyRecuperationState.UNIT) +// .andEX("signUpMode", "=", 1); +// sql2.setCondition(cnd2); +// int count2 = auditService.count(sql2); //其他工会人员(选我线路) Cnd cnd3 = Cnd.NEW(); @@ -463,13 +551,17 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "!=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", ">", TheRapyRecuperationState.LINEUNIT) .andEX("signUpMode", "=", 1); sql3.setCondition(cnd3); - int count3 = auditService.count(sql3); + NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map()); + int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber", 0))); - return Map.of("count1", count1, "count2", count2, "count3", count3); + +// return Map.of("count1", count1, "count2", count2, "count3", count3); + return Map.of("count1", count1, "count3", count3); } if ("false".equals(isAudit)) { @@ -479,23 +571,26 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", "=", TheRapyRecuperationState.UNIT) .andEX("signUpMode", "=", 1); sql.setCondition(cnd1); - int count1 = auditService.count(sql); + NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber", 0))); + //本工会人员(其他路线) - Cnd cnd2 = Cnd.NEW(); - cnd2.and("takePartInUnionId", "!=", unionId) - .and("selfUnionId", "=", unionId) - .and("isNormal", "=", true) - .and("takePartInLineId", "is not", null) - .andEX("YEAR(signingUptime)", "=", year) - .and("stateId", "=", TheRapyRecuperationState.UNIT) - .andEX("signUpMode", "=", 1); - sql2.setCondition(cnd2); - int count2 = auditService.count(sql2); +// Cnd cnd2 = Cnd.NEW(); +// cnd2.and("takePartInUnionId", "!=", unionId) +// .and("selfUnionId", "=", unionId) +// .and("isNormal", "=", true) +// .and("takePartInLineId", "is not", null) +// .andEX("YEAR(signingUptime)", "=", year) +// .and("stateId", "=", TheRapyRecuperationState.UNIT) +// .andEX("signUpMode", "=", 1); +// sql2.setCondition(cnd2); +// int count2 = auditService.count(sql2); //其他工会人员(选我线路) Cnd cnd3 = Cnd.NEW(); @@ -503,12 +598,16 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "!=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) + .andEX("lineu.lineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", "=", TheRapyRecuperationState.LINEUNIT) .andEX("signUpMode", "=", 1); sql3.setCondition(cnd3); - int count3 = auditService.count(sql3); - return Map.of("count1", count1, "count2", count2, "count3", count3); + NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map()); + int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber", 0))); + +// return Map.of("count1", count1, "count2", count2, "count3", count3); + return Map.of("count1", count1, "count3", count3); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationTravelAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationTravelAuditController.java new file mode 100644 index 0000000..579e7cb --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationTravelAuditController.java @@ -0,0 +1,238 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.audit; + +import cn.hutool.core.util.StrUtil; + +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.model.Audit; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.Vi; + +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.Daos; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; +import org.nutz.trans.Trans; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @version 1.0 + * @Author zzr + * @name:TheRapyRecuperationTranlAuditController + * @Date 2024/5/22 9:59 + * @注释 + */ +@IocBean +@At("/platform/theRapyRecuperation/TheRapyTravelAudit") +@Ok("json:full") +public class TheRapyRecuperationTravelAuditController { + + @Inject + private TheRapyRecuperationAuditService theRapyRecuperationAuditService; + + @Inject + private Vi vi; + + @Inject + private Dao dao; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/audit/TheRapyTravelAudit.html") + @RequiresPermissions("theRapyRecuperation.TheRapyTravelAudit") + public void index() { + } + + + @At + @ViReturn + public Object pageData(PageForm pageForm, + @Param(value = "agencyId", required = false) String agencyId, + @Param(value = "year", required = false) String year, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + @Param(value = "isAudit", required = false) String isAudit){ + Sql sql = Sqls.create(""" + SELECT + enroll.*, + state.stateColor, + state.stateName, + ta.travelAgencyName, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + left join the_rapy_recuperation_travel_agency ta on ta.id = enroll.takePartInTravelAgencyId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(enroll.signingUptime)", "=", year); + cnd.and("enroll.selfUnionId", "=", StrUtil.isBlank(unionId) ? Vi.getUnionId() : unionId); + cnd.and("enroll.takePartInTravelAgencyId", "is not", null); + cnd.and("enroll.takePartInTravelAgencyId", "!=", ""); + cnd.andEX("enroll.selfUnitId", "=", unitId); + cnd.andEX("enroll.isNormal", "=", true); + cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); + if (isAudit.equals("true")) { + cnd.and("enroll.stateId", ">", TheRapyRecuperationState.UNIT); + } else if (isAudit.equals("false")){ + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.UNIT); + } + + if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { + cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword()); + } + + cnd.desc("enroll.signingUptime"); + cnd.desc("enroll.unitName"); + + sql.setCondition(cnd); + + return theRapyRecuperationAuditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @At + @ViReturn + @RequiresAuthentication + public Object getBmUserUnion() { + Sql sql = Sqls.create(""" + SELECT + unionName unionname, + selfUnionId id + FROM + `the_rapy_recuperation_enroll` + $condition + """); + Cnd cnd = Cnd.NEW(); + if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) { + cnd.and("takePartInTravelAgencyId", "IS NOT", null); + cnd.and("takePartInTravelAgencyId", "!=", ""); + cnd.and("selfUnionId", "=", vi.getUnionId()); + } + cnd.groupBy("selfUnionId"); + sql.setCondition(cnd); + List unionList = theRapyRecuperationAuditService.listMap(sql); + return unionList; + } + + @At + @ViReturn + @RequiresAuthentication + public Object getApplyNumAudit(String agencyId, String isAudit, Integer year) { + TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + String unionId = Vi.getUnionId(); + Sql sql = Sqls.create(""" + SELECT + count(1) as signUpNum, + $val as familyNumber + FROM + `the_rapy_recuperation_enroll` enroll + $condition + """); + String val = ""; + if(config.getFamilyInfo() == 1) { + val = "IFNULL(sum(familyNumber),0)"; + } else { + val = "IFNULL((select count(1) from the_rapy_recuperation_enroll_companion where trreId = enroll.id),0)"; + } + sql.setVar("val", val); + Cnd cnd = Cnd.NEW(); + if (isAudit.equals("true")) { + cnd.and("enroll.stateId", ">", TheRapyRecuperationState.UNIT); + } else if (isAudit.equals("false")){ + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.UNIT); + } + cnd.andEX("takePartInTravelAgencyId", "=", agencyId); + cnd.andEX("year(signingUptime)", "=", year); + cnd.and("takePartInTravelAgencyId", "is not", null); + cnd.and("takePartInTravelAgencyId", "!=", ""); + cnd.and("selfUnionId", "=", unionId); + cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); + sql.setCondition(cnd); + NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum",0))) + + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0))); + return Map.of("count1", count1); + } + + @At + @ViReturn + @RequiresAuthentication + public Object doAudit(String id, boolean flag,Boolean adjustment, String auditOpinion) { + Trans.exec(() -> { + TheRapyRecuperationEnroll enroll = dao.fetch(TheRapyRecuperationEnroll.class, id); + Audit audit = new Audit(); + audit.setAuditOpinion(auditOpinion); + audit.setAuditor(ShiroUtil.getUserId()); + audit.setLoginname((String) ShiroUtil.getPrincipalProperty("loginname")); + audit.setUsername((String) ShiroUtil.getPrincipalProperty("username")); + audit.setAuditTime(new Date()); + audit.setAuditPass(flag); + Audit insert = dao.insert(audit); + enroll.setSelfUnionAuditId(insert.getId()); + enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.UNITFAIL); + dao.updateIgnoreNull(enroll); +// auditMsg(enroll.getStateId(), enroll.getLoginName(),adjustment, enroll.getTakePartInLineId()); + if (adjustment){ +// enroll.setNormal(false); + dao.clear(TheRapyRecuperationEnroll.class,Cnd.where("id","=",enroll.getId())); + } + }); + return null; + } + + @At + @ViReturn + @RequiresAuthentication + @Aop(TransAop.READ_COMMITTED) + public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag, Boolean adjustment) { + Audit audit = new Audit(); + audit.setAuditOpinion(auditOpinion); + audit.setAuditor(ShiroUtil.getUserId()); + audit.setLoginname((String) ShiroUtil.getPrincipalProperty("loginname")); + audit.setUsername((String) ShiroUtil.getPrincipalProperty("username")); + audit.setAuditTime(new Date()); + audit.setAuditPass(flag); + Audit insert = dao.insert(audit); + List enrollIdList = new ArrayList<>(); + for (String id : ids) { + TheRapyRecuperationEnroll enroll = dao.fetch(TheRapyRecuperationEnroll.class, id); + enroll.setSelfUnionAuditId(insert.getId()); + enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.UNITFAIL); + dao.updateIgnoreNull(enroll); + //auditMsg(enroll.getStateId(), enroll.getLoginName(),adjustment, enroll.getTakePartInLineId()); + } + dao.clear(TheRapyRecuperationEnroll.class,Cnd.where("id","in",enrollIdList)); + return null; + } + + @At + @ViReturn + @RequiresAuthentication + public Object doRecall(String id) { + TheRapyRecuperationEnroll enroll = dao.fetch(TheRapyRecuperationEnroll.class, id); + enroll.setStateId(TheRapyRecuperationState.UNIT); + enroll.setSelfUnionAuditId(null); + dao.update(enroll); + return null; + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java index a48eb68..cc17751 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java @@ -1,30 +1,45 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.audit; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; + import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.service.BaseService; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.model.Audit; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; import io.v.nutz.base.service.ViService; -import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; -import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService; +import io.v.nutz.base.utils.Vi; + import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService; +import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.dao.util.cri.Static; +import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; import org.nutz.trans.Trans; +import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; @IocBean @At("/platform/theRapyRecuperation/TheRapyXghAudit") @@ -53,16 +68,70 @@ public class TheRapyRecuperationXghAuditController { @At @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") - public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) String year, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "state", required = false) String state, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "isAudit", required = false) String isAudit, - @Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "lotId", required = false) String lotId) { + public Object pageData(PageForm pageForm, String year, String unionId, + String unitId, String state, String takePartInLineId, + String isAudit, String regionalNature, String lotId, + String selectId) { + Sql sql = Sqls.create(""" + SELECT + enroll.*, + line.lineName, + line.id as lineId, + line.regionalNature, + '教职工' userNature, + state.stateColor, + state.stateName, + CONCAT(DATE_FORMAT(rs.playStartTime,'%m月%d日'),'-',DATE_FORMAT(rs.playEndTime,'%m月%d日')) AS linePlayTime, + IF + ( enroll.takePartInUnionId != enroll.selfUnionId, TRUE, FALSE ) isTransferIn, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) num + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `the_rapy_recuperation_line_union_select` rs ON rs.id = enroll.takePartInLineId + LEFT JOIN `the_rapy_recuperation_line` line on line.id=rs.lineId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.andEX("YEAR(enroll.signingUptime)", "=", year); + cnd.andEX("enroll.selfUnionId", "=", unionId); + cnd.and("enroll.takePartInLineId", "is not", null); + cnd.andEX("enroll.selfUnitId", "=", unitId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("enroll.isNormal", "=", true); + cnd.andEX("rs.signUpMode", "=", "2"); + cnd.andEX("rs.id", "=", selectId); + if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { + cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword()); + } + if (Strings.isNotBlank(isAudit)) { + if (isAudit.equals("true")) { + cnd.and(new Static("enroll.stateId = %s".formatted(TheRapyRecuperationState.PASS))); + } else { + cnd.and(new Static("enroll.stateId = %s".formatted(TheRapyRecuperationState.SCHOOL))); + } + } else { + cnd.and(new Static("( enroll.stateId = %s OR enroll.stateId = %s OR enroll.stateId = %s)". + formatted(TheRapyRecuperationState.SCHOOL, TheRapyRecuperationState.SCHOOLFAIL, TheRapyRecuperationState.PASS))); + } + cnd.desc("enroll.signingUptime"); + cnd.desc("enroll.unitName"); + sql.setCondition(cnd); + return auditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @At + @ViReturn + @RequiresAuthentication + @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") + public Object getLineNumber(PageForm pageForm, String year, String unionId, + String unitId, String state, String takePartInLineId, + String isAudit, String regionalNature, String lotId, String selectId) { Sql sql = Sqls.create(""" SELECT enroll.*, @@ -93,6 +162,7 @@ public class TheRapyRecuperationXghAuditController { cnd.andEX("line.id", "=", takePartInLineId); cnd.andEX("enroll.isNormal", "=", true); cnd.andEX("rs.signUpMode", "=", "2"); + cnd.andEX("rs.id", "=", selectId); if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword()); } @@ -109,7 +179,9 @@ public class TheRapyRecuperationXghAuditController { cnd.desc("enroll.signingUptime"); cnd.desc("enroll.unitName"); sql.setCondition(cnd); - return auditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List nutMaps = auditService.listMap(sql); + int familyNumber = nutMaps.stream().filter(o -> StrUtil.isNotBlank(o.getString("familyNumber"))).mapToInt(o -> o.getInt("familyNumber")).sum(); + return familyNumber + nutMaps.size(); } @@ -124,11 +196,9 @@ public class TheRapyRecuperationXghAuditController { */ @At @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") - public Object doAudit(@Param(value = "id", required = false) String id, - @Param(value = "flag", required = false) boolean flag, - @Param(value = "isTransferIn", required = false) boolean isTransferIn, - @Param(value = "auditOpinion", required = false) String auditOpinion) { + public Object doAudit(String id, boolean flag, boolean isTransferIn, String auditOpinion, Boolean adjustment) { Trans.exec(() -> { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); Audit audit = new Audit(); @@ -147,6 +217,11 @@ public class TheRapyRecuperationXghAuditController { enroll.setStateId(TheRapyRecuperationState.SCHOOLFAIL); } auditService.updateIgnoreNull(enroll); + auditService.schoolAudit(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId()); + if (adjustment) { +// enroll.setNormal(false); + auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", enroll.getId())); + } }); return null; } @@ -159,6 +234,7 @@ public class TheRapyRecuperationXghAuditController { */ @At @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") public Object doRecall(String id) { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); @@ -178,10 +254,10 @@ public class TheRapyRecuperationXghAuditController { */ @At @ViReturn + @RequiresAuthentication + @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") - public Object doOnekeyAudit(@Param(value = "ids", required = false) String[] ids, - @Param(value = "auditOpinion", required = false) String auditOpinion, - @Param(value = "flag", required = false) boolean flag) { + public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag, Boolean adjustment) { Audit audit = new Audit(); audit.setAuditOpinion(auditOpinion); audit.setAuditor(ShiroUtil.getUserId()); @@ -191,12 +267,19 @@ public class TheRapyRecuperationXghAuditController { audit.setAuditPass(flag); Audit insert = auditService.insert(audit); //List enrollList = auditService.dao().query(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", ids)); + List enrollIdList = new ArrayList<>(); for (String id : ids) { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); - enroll.setStateId(TheRapyRecuperationState.PASS); + enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.SCHOOLFAIL); enroll.setSchoolUnionAuditId(insert.getId()); auditService.updateIgnoreNull(enroll); + auditService.schoolAudit(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId()); + if (adjustment) { +// enroll.setNormal(false); + enrollIdList.add(id); + } } + auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", enrollIdList)); return null; } @@ -208,6 +291,7 @@ public class TheRapyRecuperationXghAuditController { */ @At @ViReturn + @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") public Object getXghLine() { Sql sql = Sqls.create(""" @@ -220,7 +304,57 @@ public class TheRapyRecuperationXghAuditController { LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId where line.signUpMode='2' and line.createMode='2' + group by line.id """); return baseService.listMap(sql); } + + + @At + @ViReturn + @RequiresAuthentication + public Object getLinePlayTimeByLineId(String lineId, + @Param(value = "signUpMode",required = false) Integer signUpMode, + @Param(value = "year",required = false) Integer year, + @Param(value = "startYear",required = false)Integer startYear, + @Param(value = "endYear",required = false)Integer endYear, + @Param(value = "flag",required = false) Boolean flag) { + Cnd cnd = Cnd.NEW(); + cnd.and("lineId", "=", lineId); + if (flag == null || !flag){ + cnd.andEX("signUpMode", "=", signUpMode); + cnd.and("YEAR(selectTime)", "=", year); + } else { + cnd.and("YEAR(selectTime)", ">=", startYear); + cnd.and("YEAR(selectTime)", "<=", endYear); + } + List query = dao.query(TheRapyRecuperationLineUnionSelect.class, cnd); + //.and("selectUserId", "=", ShiroUtil.getUserId()).and("unionId", "=", Vi.getUnionId())); + + TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + List nutMaps = new ArrayList<>(); + query.forEach(v -> { + String startTime = DateUtil.formatChineseDate(v.getPlayStartTime(), false, false).substring(5); + String endTime = DateUtil.formatChineseDate(v.getPlayEndTime(), false, false).substring(5); + NutMap map = new NutMap(); + + List enrollList = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", v.getId()) + .and("isNormal", "=", true) + .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); + + int hasSignNumber; + if (config.getFamilyInfo() == 1) { + int sum = enrollList.stream().mapToInt(TheRapyRecuperationEnroll::getFamilyNumber).sum(); + hasSignNumber = enrollList.size() + sum; + } else { + List list = enrollList.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); + List companions = dao.query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list)); + hasSignNumber = enrollList.size() + companions.size(); + } + map.setv("times", startTime + "-" + endTime + "(报名人数:" + hasSignNumber + ",其中家属:" + (hasSignNumber - enrollList.size()) + "人)"); + map.setv("selectId", v.getId()); + nutMaps.add(map); + }); + return nutMaps; + } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java index b9bd76d..3fc1b86 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java @@ -11,20 +11,19 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.service.BaseService; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.dao.CndPlus; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.ViTool; -import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.zhgh.mobile.selfApplyUser.models.SelfApplyUser; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.baseManage.TheRapyRecuperationBaseManagerService; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.Logical; +import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresRoles; import org.nutz.aop.interceptor.ioc.TransAop; @@ -50,7 +49,7 @@ import java.util.*; import java.util.stream.Collectors; /** - * @FileName io.v.nutz.therapyRecuperation.controller.baseManage.TheBaseManagerController + * @FileName io.v.nutz.zhgh.therapyRecuperation.controller.baseManage.TheBaseManagerController * @Description: 疗休养基地管理 * @Author zzr * @Date 2023/6/5 @@ -93,14 +92,8 @@ public class TheRapyRecuperationBaseManagerController { @POST @Ok("json:full") @ViReturn - @RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR) - public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "lotId", required = false) String lotId, - @Param(value = "baseName", required = false) String baseName, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "travelAgencyId", required = false) String travelAgencyId, - @Param(value = "regionalNature", required = false) String regionalNature) { + @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + public Object pageData(PageForm pageForm, Integer year, String lotId, String baseName, String unionId, String travelAgencyId, String regionalNature) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT @@ -121,7 +114,7 @@ public class TheRapyRecuperationBaseManagerController { tb.files, tb.baseContactPerson, tb.baseContactNumber, - cast( tb.files ->> '$[0].id' AS CHAR ) AS fileId, + tb.files AS fileId, gh.unionname createUnionName, u.username createUserName, ta.travelAgencyName, @@ -146,9 +139,6 @@ public class TheRapyRecuperationBaseManagerController { if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"))) { if (ShiroUtil.hasRole("H04")) { cnd.and("tb.createUnionId", "=", Vi.getUnionId()); - } else { - SelfApplyUser selfApplyUser = baseService.dao().fetch(SelfApplyUser.class, Cnd.where("mobile", "=", ShiroUtil.getPrincipalProperty("loginname"))); - cnd.and("tb.id", "in", selfApplyUser.getBaseManagementIds()); } } else { cnd.andEX("tb.createUnionId", "=", unionId); @@ -167,6 +157,7 @@ public class TheRapyRecuperationBaseManagerController { @At("/openClosedBase/?") @POST @ViReturn + @RequiresAuthentication public Object openClosedBase(String id) { if (StrUtil.isBlank(id)) { return Result.error("参数错误"); @@ -184,6 +175,7 @@ public class TheRapyRecuperationBaseManagerController { */ @At("/selectBaseManageById/?") @ViReturn + @RequiresAuthentication public Object selectBaseManageById(String id) { Assert.notBlank(id); return dao.fetchLinks(dao.fetch(TheRapyRecuperationBaseManagement.class, id), "travelAgency"); @@ -199,8 +191,8 @@ public class TheRapyRecuperationBaseManagerController { @At @POST @ViReturn - @SLog(type = "theRapyRecuperation", tag = "疗休养目的地管理", msg = "添加目的地") - @RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR) + @RequiresAuthentication + @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) public Object doSubmit(@Param("base") TheRapyRecuperationBaseManagement baseManagement) { baseManagement.setOpBy((String) ShiroUtil.getPrincipalProperty("id")); baseManagement.setCreateUnionId((String) ShiroUtil.getPrincipalProperty("unionid")); @@ -218,7 +210,7 @@ public class TheRapyRecuperationBaseManagerController { @At("/deleteBase/?") @POST @ViReturn - @SLog(type = "theRapyRecuperation", tag = "疗休养目的地管理", msg = "删除目的地") + @RequiresAuthentication public Object deleteBase(String id) { if (StrUtil.isBlank(id)) { return Result.error("参数错误"); @@ -235,10 +227,9 @@ public class TheRapyRecuperationBaseManagerController { @At("/listAllBase") @POST @ViReturn - public Object listAllBase(@Param(value = "startYear", required = false) String startYear, - @Param(value = "endYear", required = false) String endYear, - @Param(value = "year", required = false) String year) { - Sql sql = Sqls.create("select * from `the_rapy_recuperation_base_management` tb $condition"); + @RequiresAuthentication + public Object listAllBase(String startYear, String endYear, String year) { + Sql sql = Sqls.create("select * from `the_rapy_recuperation_base_management` tb left join `the_rapy_recuperation_lot` lot on lot.id=tb.lotId $condition"); CndPlus cnd = new CndPlus(); cnd.andEX("tb.`year`", ">=", startYear); @@ -257,6 +248,7 @@ public class TheRapyRecuperationBaseManagerController { @At("/selectBaseAllInfo") @GET @ViReturn + @RequiresAuthentication public Object selectBaseAllInfo(@Param("id") String id) { Assert.notBlank(id); return theRapyRecuperationBaseManagerService.selectBaseAllInfo(id); @@ -329,6 +321,7 @@ public class TheRapyRecuperationBaseManagerController { */ @At @ViReturn + @RequiresAuthentication @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @Aop(TransAop.READ_COMMITTED) public Object importBaseManager(TempFile file) { diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java index ff3b497..7d9bf6f 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java @@ -9,12 +9,14 @@ import cn.hutool.core.io.FileUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; + import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.Vi; + + import io.v.nutz.base.utils.ViTool; import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.zhgh.mobile.selfApplyUser.models.SelfApplyUser; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationLineCreateMode; import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyTravelLineExcelMode; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; @@ -24,6 +26,7 @@ import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.Logical; +import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresRoles; import org.nutz.aop.interceptor.ioc.TransAop; @@ -42,14 +45,11 @@ import javax.servlet.http.HttpServletResponse; import java.lang.reflect.Field; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** - * @FileName io.v.nutz.therapyRecuperation.controller.basicManage.TheRapyRecuperationLineController + * @FileName io.v.nutz.zhgh.therapyRecuperation.controller.basicManage.TheRapyRecuperationLineController * @Description: 疗休养线路管理 * @Author zxc * @Date 2022/5/31:09:34 @@ -76,23 +76,17 @@ public class TheRapyRecuperationLineController { * 页面数据 * * @param pageForm 分页参数 - * @param year 年度 * @return {@link Object} */ @At @POST @Ok("json:full") @ViReturn - @RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR) - public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "keywords", required = false) String keywords, - @Param(value = "travelAgencyId", required = false) String travelAgencyId, - @Param(value = "lineName", required = false) String lineName, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "lotId", required = false) String lotId) { + @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + public Object pageData(PageForm pageForm, Integer startYear , Integer endYear, String keywords, String travelAgencyId, String lineName, String unionId, String lotId) { Cnd cnd = Cnd.NEW(); - cnd.andEX("line.`year`", "=", year); + cnd.andEX("line.`year`", ">=", startYear); + cnd.andEX("line.`year`", "<=", endYear); cnd.andEX("line.travelAgencyId", "=", travelAgencyId); cnd.andEX("line.lotId", "=", lotId); cnd.and(Cnd.likeEX("line.lineName", lineName)); @@ -107,17 +101,25 @@ public class TheRapyRecuperationLineController { if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"))) { if (ShiroUtil.hasRole("H04")) { cnd.and("line.createUnionId", "=", Vi.getUnionId()); - } else { - SelfApplyUser selfApplyUser = lineService.dao().fetch(SelfApplyUser.class, Cnd.where("mobile", "=", ShiroUtil.getPrincipalProperty("loginname"))); - cnd.and("line.id", "in", selfApplyUser.getLineIds()); } } else { cnd.andEX("line.createUnionId", "=", unionId); } - cnd.asc("serialNumber"); + cnd.desc("regionalNature").asc("serialNumber").asc("line.opBy"); return lineService.pageData(pageForm, cnd); } + @At + @POST + @ViReturn + @RequiresAuthentication + @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + public Object getNo() { + Object serialNumber = dao.func2(TheRapyRecuperationLine.class, "max", "serialNumber"); + serialNumber = Objects.requireNonNullElse(serialNumber, 0); + return Integer.parseInt(serialNumber.toString()) + 1; + } + /** * 提交 * @@ -127,8 +129,9 @@ public class TheRapyRecuperationLineController { @At @POST @ViReturn - @RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR) - public Object doSubmit(@Param("line") TheRapyRecuperationLine line) { + @RequiresAuthentication + @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + public Object doSubmit(TheRapyRecuperationLine line) { if (StrUtil.isBlank(line.getId())) { if (lineService.count(Cnd.where("serialNumber", "=", line.getSerialNumber())) > 0) { return Result.error("编号已存在"); @@ -152,6 +155,7 @@ public class TheRapyRecuperationLineController { @At("/openClosedLine/?") @POST @ViReturn + @RequiresAuthentication public Object openClosedLine(String id) { if (StrUtil.isBlank(id)) { return Result.error("参数错误"); @@ -169,6 +173,7 @@ public class TheRapyRecuperationLineController { @At("/deleteLine/?") @POST @ViReturn + @RequiresAuthentication public Object deleteLine(String id) { if (StrUtil.isBlank(id)) { return Result.error("参数错误"); @@ -186,6 +191,7 @@ public class TheRapyRecuperationLineController { */ @At("/selectLineInfoById/?") @ViReturn + @RequiresAuthentication public Object selectLineInfoById(String id) { Assert.notBlank(id); return lineService.selectLineInfoById(id); @@ -201,9 +207,8 @@ public class TheRapyRecuperationLineController { */ @At("/selectLineUser") @ViReturn - public Object selectLineUser(PageForm pageForm, - @Param(value = "id", required = false) String id, - @Param(value = "unionId", required = false) String unionId) { + @RequiresAuthentication + public Object selectLineUser(PageForm pageForm, String id, String unionId) { if (StrUtil.isBlank(id)) { return Result.error("参数错误"); } @@ -212,6 +217,7 @@ public class TheRapyRecuperationLineController { @At("/getCreateMode") @ViReturn + @RequiresAuthentication public Object getCreateMode() { boolean hasSchoolAdminRole = ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06")); if (hasSchoolAdminRole) { @@ -228,6 +234,7 @@ public class TheRapyRecuperationLineController { */ @At("/viewUnionSelectTimeInfo/?") @ViReturn + @RequiresAuthentication public Object viewUnionSelectTimeInfo(String id) { Assert.notBlank(id); return lineService.viewUnionSelectTimeInfo(id); @@ -240,6 +247,7 @@ public class TheRapyRecuperationLineController { */ @At @ViReturn + @RequiresAuthentication public Object hasAnyRoles(@Param("roles") String[] roles) { boolean b = ShiroUtil.hasAnyRoles(roles); return b; @@ -267,6 +275,7 @@ public class TheRapyRecuperationLineController { */ @At @ViReturn + @RequiresAuthentication @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @Aop(TransAop.READ_COMMITTED) public Object travelLineImport(TempFile file) { diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java index c2e0028..2902182 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java @@ -5,9 +5,11 @@ import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; + import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.utils.PageUtil; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.PageUtil; + import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyTravelAgencyExcelMode; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; @@ -69,8 +71,7 @@ public class TheRapyRecuperationTravelAgencyController { @POST @ViReturn @RequiresAuthentication - public Object pageData(PageForm pageForm, @Param(value = "year", required = false) Integer year, - @Param(value = "keywords", required = false) String keywords) { + public Object pageData(PageForm pageForm, Integer year, String keywords) { Cnd cnd = Cnd.NEW(); cnd.andEX("year", "=", year); if (StrUtil.isNotBlank(keywords)) { @@ -83,7 +84,7 @@ public class TheRapyRecuperationTravelAgencyController { if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); } else { - cnd.asc("serialNumber"); + cnd.asc("serialNumber * 1"); } return travelAgencyService.pageData(pageForm, cnd); } @@ -158,7 +159,7 @@ public class TheRapyRecuperationTravelAgencyController { @At("/selectTravelAgency") @ViReturn @RequiresAuthentication - public Object selectTravelAgency(@Param(value = "year", required = false) Integer year) { + public Object selectTravelAgency(Integer year) { Cnd cnd = Cnd.NEW(); cnd.andEX("year", "=", year); return travelAgencyService.selectAllTravelAgencyByYear(cnd); @@ -175,11 +176,14 @@ public class TheRapyRecuperationTravelAgencyController { @At("/selectTravelAgencyByYears") @ViReturn @RequiresAuthentication - public Object selectTravelAgencyByYears(@Param(value = "startYear", required = false) Integer startYear, - @Param(value = "endYear", required = false) Integer endYear) { + public Object selectTravelAgencyByYears(Integer startYear, Integer endYear, Integer year) { Cnd cnd = Cnd.NEW(); - cnd.andEX("year", ">=", startYear); - cnd.andEX("year", "<=", endYear); + if(startYear != null && endYear != null) { + cnd.andEX("year", ">=", startYear); + cnd.andEX("year", "<=", endYear); + }else { + cnd.andEX("year", "=", year); + } return travelAgencyService.selectAllTravelAgencyByYear(cnd); } @@ -246,7 +250,7 @@ public class TheRapyRecuperationTravelAgencyController { List list = new ArrayList<>(); for (TheRapyTravelAgencyExcelMode travel : travelAgency) { TheRapyRecuperationTravelAgency agency = new TheRapyRecuperationTravelAgency(); - if (Strings.isNotBlank(map.get(travel.getTravelAgencyName()))) { + if (Strings.isNotBlank(map.get(travel.getTravelAgencyName()))){ agency.setId(map.get(travel.getTravelAgencyName())); } if (travel.getIsDisabled().equals("是")) { diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java index 4ae5a43..ac437e4 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; +import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; @@ -7,6 +8,8 @@ import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; import io.v.nutz.sys.models.Sys_config; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement; @@ -17,8 +20,6 @@ import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationCommonServi import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; -import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.web.commons.base.Globals; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.nutz.dao.Chain; import org.nutz.dao.Cnd; @@ -88,20 +89,32 @@ public class TheRapyRecuperationEnrollController { @POST @ViReturn @RequiresAuthentication - public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "theRapyRecuperationType", required = false) int theRapyRecuperationType, - @Param(value = "lineUnionType", required = false) Integer lineUnionType) { + public Object pageData(PageForm pageForm, Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType) { return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType); } + @At + @POST + @ViReturn + @RequiresAuthentication + public Object getSelectLineById(String lineId, String unionId, int theRapyRecuperationType, Integer lineUnionType) { + return enrollService.getSelectLineById(lineId, unionId, theRapyRecuperationType, lineUnionType); + } + + @At + @POST + @ViReturn + @RequiresAuthentication + public Object openSignUser(String usId, String travelId, String searchKeyWord) { + return enrollService.openSignUser(usId, travelId, searchKeyWord); + } + //获取设置了公开线路的分工会 @At @ViReturn @RequiresAuthentication - public Object getTheRapyUnions(@Param(value = "year", required = false) Integer year) { - return enrollService.getTheRapyUnions(year); + public Object getTheRapyUnions(Integer year, int theRapyRecuperationType) { + return enrollService.getTheRapyUnions(year, theRapyRecuperationType); } @@ -118,13 +131,14 @@ public class TheRapyRecuperationEnrollController { public Object doSignUpForLine(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) { //省外的线路报名需要判断 // if (lineInfo.getRegionalNature().equals(TheRapyRecuperationProvinceType.provinceOut.getValue())) { - String schoolCode = Globals.schoolCode; - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode")); + Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); Map validResult = new HashMap<>(); - if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) { + if("zjxu".equals(config.getConfigValue())) { validResult = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else { + } else if("zjiet".equals(config.getConfigValue())) { validResult = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); + } else if("zjnu".equals(config.getConfigValue())) { + validResult = enrollService.validSignUpInfoForZJNU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); } if (validResult.containsKey(false)) { return Result.error(validResult.get(false)); @@ -149,13 +163,14 @@ public class TheRapyRecuperationEnrollController { @ViReturn @RequiresAuthentication public Object doSignUpForTravelAgency(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) { - String schoolCode = Globals.schoolCode; - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode")); + Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); Map resultMap = new HashMap<>(); - if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) { + if("zjxu".equals(config.getConfigValue())) { resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else { + } else if("zjiet".equals(config.getConfigValue())) { resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); + } else if("zjnu".equals(config.getConfigValue())) { + resultMap = enrollService.validSignUpInfoForZJNU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); } if (resultMap.containsKey(false)) { return Result.error(resultMap.get(false)); @@ -179,10 +194,9 @@ public class TheRapyRecuperationEnrollController { @ViReturn @RequiresAuthentication public Object doSignUpForBaseManagement(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) { - String schoolCode = Globals.schoolCode; - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode")); + Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); Map resultMap = new HashMap<>(); - if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) { + if("zjxu".equals(config.getConfigValue())) { resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); } else { resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); @@ -221,11 +235,7 @@ public class TheRapyRecuperationEnrollController { @POST @ViReturn @RequiresAuthentication - public Object mySignUpPageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "theRapyRecuperationType", required = false) int theRapyRecuperationType, - @Param(value = "auditStateId", required = false) Integer auditStateId, - @Param(value = "signUpStateId", required = false) int signUpStateId) { + public Object mySignUpPageData(PageForm pageForm, Integer year, int theRapyRecuperationType, Integer auditStateId, int signUpStateId) { Cnd cnd = Cnd.NEW(); cnd.and("e.loginName", "=", ShiroUtil.getPrincipalProperty("loginname")); switch (signUpStateId) { @@ -291,13 +301,18 @@ public class TheRapyRecuperationEnrollController { return Result.error("线路信息不能为空"); } - String schoolCode = Globals.schoolCode; - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode")); + if (StrUtil.isBlank(enrollInfo.getLoginName())){ + enrollInfo.setLoginName(ShiroUtil.getPrincipalProperty("loginname").toString()); + } + + Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); Map resultMap = new HashMap<>(); - if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else { - resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); + if("zjxu".equals(config.getConfigValue())) { + resultMap = enrollService.validSignUpInfoForZJXU(enrollInfo.getLoginName(), enrollInfo); + } else if("zjiet".equals(config.getConfigValue())) { + resultMap = enrollService.validSignUpInfo(enrollInfo.getLoginName(), enrollInfo); + } else if("zjnu".equals(config.getConfigValue())) { + resultMap = enrollService.validSignUpInfoForZJNU(enrollInfo.getLoginName(), enrollInfo); } if (resultMap.containsKey(false)) { return Result.error(resultMap.get(false)); @@ -320,6 +335,22 @@ public class TheRapyRecuperationEnrollController { return null; } + + /** + * 删除我的报名信息 + * + * @param id id + * @return {@link Object} + */ + @At("/doModify/?") + @POST + @ViReturn + @RequiresAuthentication + public Object doModify(String id) { + enrollService.update(Chain.make("isNormal",false),Cnd.where("id","=",id)); + return null; + } + /** * 能取消吗 * @@ -367,11 +398,8 @@ public class TheRapyRecuperationEnrollController { @POST @ViReturn @RequiresAuthentication - public Object doFeedBack(@Param(value = "id", required = false) String id, - @Param(value = "evaluationForTravelAgency", required = false) String evaluationForTravelAgency, - @Param(value = "evaluationForLine", required = false) String evaluationForLine, - @Param(value = "evaluationForJourney", required = false) String evaluationForJourney, - @Param(value = "feedbackContent", required = false) String feedbackContent) { + public Object doFeedBack(String id, String evaluationForTravelAgency, String evaluationForLine, + String evaluationForJourney, String feedbackContent) { Chain chain = Chain.make("evaluationForTravelAgency", evaluationForTravelAgency); chain.add("evaluationForLine", evaluationForLine); chain.add("evaluationForJourney", evaluationForJourney); @@ -398,8 +426,8 @@ public class TheRapyRecuperationEnrollController { Sql sql = Sqls.create(""" select - (select count(1) from the_rapy_recuperation_enroll where takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode) as signUpUserNum, - (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode)) as signUpUserFamilyNum + (select count(1) from the_rapy_recuperation_enroll where isNormal=true and takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode) as signUpUserNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where isNormal=true and takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode)) as signUpUserFamilyNum """); sql.setParam("signUpSuccessCode", TheRapyRecuperationState.PASS); sql.setParam("lineId", lineId); @@ -411,7 +439,7 @@ public class TheRapyRecuperationEnrollController { /** * 手机端线路介绍所有信息 * - * @param usId 行id + * @param usId 行id * @param usUnionId 我们工会id * @return {@link Object} */ @@ -419,9 +447,25 @@ public class TheRapyRecuperationEnrollController { @GET @ViReturn @RequiresAuthentication - public Object selectLineAllInfo(@Param(value = "usId", required = false) String usId, - @Param(value = "usUnionId", required = false) String usUnionId) { + public Object selectLineAllInfo(@Param("usId") String usId, + @Param("usUnionId") String usUnionId, + @Param("year") String year) { Assert.notBlank(usId); - return enrollService.selectLineAllInfo(usId, usUnionId); + return enrollService.selectLineAllInfo(usId, usUnionId, year); + } + + @At + @ViReturn + @RequiresAuthentication + public Object getSchoolTime() { + Sys_user sysUser = dao.fetch(Sys_user.class, ShiroUtil.getUserId()); + if(StrUtil.isNotBlank(sysUser.getSchoolTime())) { + DateTime schoolDate = DateUtil.parse(sysUser.getSchoolTime()); + DateTime time = DateUtil.parse(DateUtil.thisYear() + "-07-01"); + int compareResult = DateUtil.compare(schoolDate, time); + return compareResult >= 0 ? sysUser.getSchoolTime() : null; + } else { + return null; + } } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java index 98f00a6..b7a811f 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java @@ -10,9 +10,9 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.result.Result; +import io.v.nutz.base.utils.ViTool; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollJoinUserImportService; -import io.v.nutz.base.utils.ViTool; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -38,7 +38,7 @@ import java.util.List; import java.util.Map; /** - * @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationEnrollJoinUserImport + * @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationEnrollJoinUserImport * @Description: 导入参加人员 * @Author zxc * @Date 2022/6/14:09:16 @@ -65,17 +65,14 @@ public class TheRapyRecuperationEnrollJoinUserImportController { @At @RequiresPermissions("theRapyRecuperation.joinUser.import") @ViReturn - public Object selectLineAndTravelAgencyList(@Param(value = "year", required = false) Integer year, - @Param(value = "keyword", required = false) String keyword) { + public Object selectLineAndTravelAgencyList(Integer year, String keyword) { return joinUserImportService.selectLineAndTravelAgencyList(year, keyword); } @At @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @RequiresPermissions("theRapyRecuperation.joinUser.import") - public Object readExcel(@Param(value = "file", required = false) TempFile tempFile, - @Param(value = "lineId", required = false) String lineId, - @Param(value = "travelAgencyId", required = false) String travelAgencyId) { + public Object readExcel(@Param("file") TempFile tempFile, @Param("lineId") String lineId, @Param("travelAgencyId") String travelAgencyId) { try { Assert.notNull(tempFile); File file = tempFile.getFile(); @@ -121,7 +118,7 @@ public class TheRapyRecuperationEnrollJoinUserImportController { @At @ViReturn @RequiresPermissions("theRapyRecuperation.joinUser.import") - public Object selectLineOrTravelAgency(@Param(value = "year", required = false) Integer year) { + public Object selectLineOrTravelAgency(Integer year) { return joinUserImportService.selectLineOrTravelAgency(year); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationExamineController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationExamineController.java index 984159a..7f96cad 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationExamineController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationExamineController.java @@ -5,7 +5,7 @@ import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; /** - * @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationExamineController + * @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationExamineController * @Description: 疗休养报名审核 * @Author zxc * @Date 2022/6/1:18:16 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java index 641556e..1fcbef1 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java @@ -4,6 +4,8 @@ import cn.hutool.core.lang.Assert; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.sys.models.Sys_user; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineAdjustmentService; @@ -17,15 +19,23 @@ import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.Daos; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.POST; import org.nutz.mvc.annotation.Param; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationLineAdjustment + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineAdjustment * @Description: 线路及人员调整 * @Author zxc * @Date 2022/6/10:10:00 @@ -40,6 +50,9 @@ public class TheRapyRecuperationLineAdjustmentController { @Inject private Dao dao; + @Inject + private MsgApi msgApi; + @Inject private TheRapyRecuperationLineAdjustmentService adjustmentService; @@ -62,11 +75,13 @@ public class TheRapyRecuperationLineAdjustmentController { @ViReturn @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "lineId", required = false) String lineId, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "keywords", required = false) String keywords) { - return adjustmentService.pageData(pageForm, year, lineId, unionId, keywords); + Integer year, + String lineId, + String unionId, + String keywords, + String regionalNature, + String lotId) { + return adjustmentService.pageData(pageForm, year, lineId, unionId, keywords, regionalNature, lotId); } @@ -81,7 +96,7 @@ public class TheRapyRecuperationLineAdjustmentController { @Ok("json:full") @ViReturn @RequiresAuthentication - public Object findUnionSignUpModeLineList(@Param(value = "year", required = false) Integer year) { + public Object findUnionSignUpModeLineList(Integer year) { Sql sql = Sqls.create(""" select id,lineName from the_rapy_recuperation_line $condition @@ -104,8 +119,7 @@ public class TheRapyRecuperationLineAdjustmentController { @POST @Ok("json:full") @RequiresAuthentication - public Object findUnionSignUpModeUserList(@Param(value = "lineId", required = false) String lineId, - @Param(value = "unionId", required = false) String unionId) { + public Object findUnionSignUpModeUserList(@Param("lineId") String lineId, @Param("unionId") String unionId) { try { Assert.notBlank(lineId); return Result.success().addData(adjustmentService.findUnionSignUpModeUserList(lineId, unionId)); @@ -126,8 +140,7 @@ public class TheRapyRecuperationLineAdjustmentController { @POST @Ok("json:full") @RequiresAuthentication - public Object adjustmentUser(@Param(value = "lineId", required = false) String lineId, - @Param(value = "loginNames", required = false) String[] loginName) { + public Object adjustmentUser(String lineId, @Param("loginNames") String[] loginName) { try { Assert.notBlank(lineId); Assert.notNull(loginName); @@ -142,4 +155,53 @@ public class TheRapyRecuperationLineAdjustmentController { } } + + @At + @POST + @Ok("json:full") + @RequiresAuthentication + public Object smsAlerts(String lineId,@Param("loginNames") String[] loginName){ + try { + Sql sql = Sqls.create(""" + SELECT + rlus.id, + rlus.unionId, + rlus.lineId, + rlus.selectUserId, + DATE_FORMAT( rlus.playStartTime, '%Y-%m-%d' ) AS playStartTime, + DATE_FORMAT( rlus.playEndTime, '%Y-%m-%d' ) AS playEndTime, + rl.lineName, + rl.regionalNature, + lot.lotName + FROM + `the_rapy_recuperation_line_union_select` rlus + LEFT JOIN `the_rapy_recuperation_line` rl ON rlus.lineId = rl.id + LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id + WHERE + rlus.id = @id + """).setParam("id",lineId); + NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); + String lineName = map.getString("lineName"); + String lotName = map.getString("lotName"); + String regionalNature = map.getString("regionalNature"); + String playStartTime = map.getString("playStartTime"); + String playEndTime = map.getString("playEndTime"); + List userList = dao.query(Sys_user.class, Cnd.where("loginname", "in", loginName)); + Map usernameMap = userList.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getUsername)); + if (Lang.isNotEmpty(loginName)){ + Arrays.stream(loginName).forEach(v->{ + String username = usernameMap.get(v); + String content = "%s老师您好,您报名的%s【%s-%s】(%s至%s)线路未达到成团标准,现已解散,请您选择其他线路进行报名!" + .formatted(username,lineName,lotName,regionalNature,playStartTime,playEndTime); + //msgApi.sendWxMsg(content,v); + }); + } + return Result.success(); + } catch (Exception e){ + e.printStackTrace(); + return Result.error(); + } + } + + } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java index 8043891..b32db49 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java @@ -4,10 +4,10 @@ import cn.hutool.core.lang.Assert; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; +import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationClusterMember; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineClusterService; -import io.v.nutz.web.commons.slog.annotation.SLog; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; /** - * @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationLineClusterController + * @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationLineClusterController * @Description: TODO * @Author zxc * @Date 2022/6/17:08:52 @@ -59,10 +59,7 @@ public class TheRapyRecuperationLineClusterController { @POST @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.lineCluster") - public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "keywords", required = false) String keywords, - @Param(value = "unionId", required = false) String unionId) { + public Object pageData(PageForm pageForm, Integer year, String keywords, String unionId) { Pagination pagination = clusterService.pageData(pageForm, year, unionId, keywords); return pagination; } @@ -79,8 +76,7 @@ public class TheRapyRecuperationLineClusterController { @ViReturn @POST @RequiresAuthentication - public Object findClusterInfo(@Param(value = "lineId", required = false) String lineId, - @Param(value = "usUnionId", required = false) String usUnionId) { + public Object findClusterInfo(@Param("lineId") String lineId, @Param("usUnionId") String usUnionId) { Assert.notBlank(lineId); Assert.notBlank(usUnionId); return clusterService.findClusterInfo(lineId, usUnionId); @@ -97,8 +93,7 @@ public class TheRapyRecuperationLineClusterController { @POST @RequiresAuthentication @SLog(tag = "疗休养", msg = "设置组团人员", param = true, result = true) - public Object setClusterMembers(@Param(value = "clusters", required = false) String clusters, - @Param(value = "lineId", required = false) String lineId) { + public Object setClusterMembers(@Param("clusters") String clusters, @Param("lineId") String lineId) { NutMap nutMap = Json.fromJson(NutMap.class, clusters); List clusterList = new ArrayList<>(); nutMap.forEach((k, v) -> { diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java index 216127d..4156d92 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java @@ -1,18 +1,16 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; -import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineUnionSelectService; +import io.v.nutz.base.utils.Vi; import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.model.*; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineUnionSelectService; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresAuthentication; @@ -78,24 +76,30 @@ public class TheRapyRecuperationLineUnionSelectController { @POST @ViReturn @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) - public Object pageData(PageForm pageForm, - @Param(value = "year", required = false) Integer year, - @Param(value = "keywords", required = false) String keywords, - @Param(value = "selectStatus", required = false) int selectStatus, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "lotId", required = false) String lotId, - @Param(value = "travelAgencyId", required = false) String travelAgencyId, - @Param(value = "mode", required = false) Integer mode) { + public Object pageData(PageForm pageForm, Integer year, String keywords, int selectStatus, String unionId, + String lotId, String travelAgencyId, Integer mode, String regionalNature) { + + TheRapyRecuperationConfig config = unionSelectService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); Cnd cnd = Cnd.NEW(); - cnd.andEX("line.year", "=", year); cnd.andEX("line.lotId", "=", lotId); - cnd.andEX("line.travelAgencyId", "=", travelAgencyId); + cnd.andEX("us.travelAgencyId", "=", travelAgencyId); + if (!"全部".equals(regionalNature)) { + cnd.andEX("line.regionalNature", "=", regionalNature); + } //当前登录用户已选择的线路id - Sql hasSelectLineSql = Sqls.createf(""" - select lineId from the_rapy_recuperation_line_union_select where selectUserId = '%s' AND unionId = '%s' - """, ShiroUtil.getPrincipalProperty("id"), Vi.getUnionId()); + Sql hasSelectLineSql; + if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { + cnd.and(Cnd.exps("line.createUnionId", "=", Vi.getUnionId()).or("createMode", "=", 2)); + hasSelectLineSql = Sqls.createf(""" + select lineId from the_rapy_recuperation_line_union_select where selectUserId = '%s' AND unionId = '%s' AND year(selectTime) = %s + """, ShiroUtil.getPrincipalProperty("id"), Vi.getUnionId(), year == null ? DateUtil.thisYear() : year); + } else { + hasSelectLineSql = Sqls.createf(""" + select lineId from the_rapy_recuperation_line_union_select where year(selectTime) = %s + """, year == null ? DateUtil.thisYear() : year); + } /*hasSelectLineSql = Sqls.createf(""" select lineId from the_rapy_recuperation_line_union_select where unionId = '%s' @@ -103,7 +107,10 @@ public class TheRapyRecuperationLineUnionSelectController { switch (selectStatus) { //查询未选择的线路 - case -1 -> cnd.and("line.id", "not in", hasSelectLineSql); + case -1 -> { + cnd.and("line.id", "not in", hasSelectLineSql); + cnd.and("line.year", "in", year == null ? Lang.array(config.getProvinceStartYear(), config.getProvinceStartYear() + 1) : year); + } case 0 -> { SqlExpressionGroup seg = new SqlExpressionGroup(); @@ -123,6 +130,7 @@ public class TheRapyRecuperationLineUnionSelectController { case 1 -> { cnd.and("line.id", "in", hasSelectLineSql); cnd.and("us.signUpMode", "=", mode); + cnd.and("year(us.selectTime)", "=", year == null ? DateUtil.thisYear() : year); } } @@ -137,9 +145,9 @@ public class TheRapyRecuperationLineUnionSelectController { if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().replace("ending", "")); } else { - cnd.desc("year").asc("serialNumber"); + cnd.asc("createUnionId").desc("year").asc("serialNumber"); } - return unionSelectService.pageData(pageForm, cnd); + return unionSelectService.pageData(pageForm, cnd, year); } /** @@ -176,12 +184,14 @@ public class TheRapyRecuperationLineUnionSelectController { //组织形式 int signUpMode = ShiroUtil.hasRole("H04") ? 1 : 2; + TheRapyRecuperationLineUnionSelect theRapyRecuperationLineUnionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", lineUnionSelect.getId())); + for (TheRapyRecuperationLineUnionSelect unionSelect : lineUnionSelects) { unionSelect.setSelectTime(new Date()); unionSelect.setSelectUserId(ShiroUtil.getPlatformUid()); unionSelect.setUnionId(Vi.getUnionId()); - unionSelect.setOpen(true); - unionSelect.setDelFlag(false); + unionSelect.setIsOpen(Lang.isNotEmpty(theRapyRecuperationLineUnionSelect) ? theRapyRecuperationLineUnionSelect.getIsOpen() : true); + //unionSelect.setDelFlag(signUpMode == 2); unionSelect.setSignUpMode(signUpMode); } @@ -199,20 +209,18 @@ public class TheRapyRecuperationLineUnionSelectController { @At @POST @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) - public Object selectLineInfo(@Param(value = "lineId", required = false) String lineId, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "mode", required = false) Integer mode) { + public Object selectLineInfo(@Param("lineId") String lineId, @Param("unionId") String unionId, @Param("mode") Integer mode, @Param("year") Integer year) { try { Assert.notBlank(lineId); Assert.notNull(mode); unionId = StrUtil.emptyToNull(Vi.getUnionId()); - if (mode == 1 && !ShiroUtil.hasRole("H04")) { + if (mode == 1 && !ShiroUtil.hasRole("H04")&&!ShiroUtil.hasRole("sysadmin")) { return Result.error("您没有分工会角色权限!"); - } else if (mode == 2 && !ShiroUtil.hasRole("A06")) { + } else if (mode == 2 && !ShiroUtil.hasRole("SchoolUnionAdmin")&&!ShiroUtil.hasRole("sysadmin")) { return Result.error("您没有校工会角色权限!"); } - return Result.success(unionSelectService.selectLineInfo(lineId, unionId, mode)); + return Result.success(unionSelectService.selectLineInfo(lineId, unionId, mode, year)); } catch (Exception e) { log.error(e.getMessage()); return Result.error(e.getMessage()); @@ -248,8 +256,29 @@ public class TheRapyRecuperationLineUnionSelectController { // enrollCnd.and("takePartInLineId", "=", lineId); Cnd enrollCnd = Cnd.where("unionId", "=", unionId); enrollCnd.and("lineId", "=", lineId); - unionSelectService.clear(enrollCnd); + List unionSelects = unionSelectService.query(enrollCnd); + List list = unionSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList()); + + List enrolls = unionSelectService.dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "in", list)); + List enrollIdList = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); + List bedIdList = enrolls.stream().map(TheRapyRecuperationEnroll::getBedInfoId).collect(Collectors.toList()); + //同伴信息 + List companions = unionSelectService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIdList)); + List comBedIdList = companions.stream().map(TheRapyRecuperationEnrollCompanion::getBedInfoId).collect(Collectors.toList()); + + //删除报名记录 + unionSelectService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", enrollIdList)); + //删除床位记录 + unionSelectService.dao().clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "in", bedIdList)); + //删除同伴信息 + unionSelectService.dao().clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIdList)); + //删除变更记录 + unionSelectService.dao().clear(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "in", enrollIdList)); + //删除同伴床位信息 + unionSelectService.dao().clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "in", comBedIdList)); + + unionSelectService.clear(enrollCnd); return Result.success(); } catch (Exception e) { return Result.error(e.getMessage()); @@ -301,8 +330,52 @@ public class TheRapyRecuperationLineUnionSelectController { Integer cost = Optional.ofNullable(lotInfo).map(v -> v.getActivityCost()).orElse(0); TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); Integer groupNumber = Optional.ofNullable(config).map(TheRapyRecuperationConfig::getGroupNumber).orElse(0); - return Result.success(Map.of("cost", cost, "groupNumber", groupNumber)); + Integer outsideQuota = Optional.ofNullable(config).map(TheRapyRecuperationConfig::getOutsideQuota).orElse(0); + return Result.success(Map.of("cost", cost, "groupNumber", groupNumber, "outsideQuota", outsideQuota)); } + + /** + * 一键统赋时间,针对于已选择的线路 + * + * @param lineIds 线路Id数组 + * @param lineUnionSelects 出行时段 + * @return {@link Object} + */ + @At("/setGiveLineTimes") + @POST + @ViReturn + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @Aop(TransAop.READ_COMMITTED) + @SLog(type = "普惠疗休养", tag = "分工会/校工会选择线路", msg = "一键统赋时间,针对于已选择的线路", param = true, result = true) + public Object setGiveLineTimes(@Param("lineIds") String[] lineIds, @Param("lineUnionSelects") TheRapyRecuperationLineUnionSelect[] lineUnionSelects) { + if (Lang.isNotEmpty(lineUnionSelects) && Lang.isNotEmpty(lineIds)) { + TheRapyRecuperationLineUnionSelect lineUnionSelect = lineUnionSelects[0]; + + Chain chain = Chain.make("enable", 1); + if (lineUnionSelect.getSignUpStartTime() != null) + chain.add("signUpStartTime", lineUnionSelect.getSignUpStartTime()); + if (lineUnionSelect.getSignUpEndTime() != null) + chain.add("signUpEndTime", lineUnionSelect.getSignUpEndTime()); + if (lineUnionSelect.getChangeEndTime() != null) + chain.add("changeEndTime", lineUnionSelect.getChangeEndTime()); + if (lineUnionSelect.getPlayStartTime() != null) + chain.add("playStartTime", lineUnionSelect.getPlayStartTime()); + if (lineUnionSelect.getPlayEndTime() != null) chain.add("playEndTime", lineUnionSelect.getPlayEndTime()); + + dao.update(TheRapyRecuperationLineUnionSelect.class, chain, Cnd.where("id", "in", lineIds)); + } + return null; + } + + + @At + @ViReturn + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @SLog(type = "普惠疗休养", tag = "分工会/校工会选择线路", msg = "是否开放对外报名", param = true, result = true) + public Object doEditOpen(String id) { + dao.update(TheRapyRecuperationLineUnionSelect.class, Chain.makeSpecial("isOpen", "isOpen ^ 1"), Cnd.where("id", "=", id)); + return null; + } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java index cd6bb22..fdb31cf 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java @@ -1,5 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; + + import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.service.BaseService; import org.apache.shiro.authz.annotation.RequiresAuthentication; @@ -13,7 +15,6 @@ import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; -import org.nutz.mvc.annotation.Param; import java.util.List; import java.util.Map; @@ -42,12 +43,11 @@ public class TheRapyRecuperationStatisticsController { @At @ViReturn @RequiresAuthentication - public Object getLineBar(@Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "year", required = false) Integer year) { + public Object getLineBar(String regionalNature, Integer year) { Sql sql = Sqls.create(""" SELECT line.lineName, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE line.id = takePartInLineId ) AS enrollNum, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE isNormal=true and line.id = takePartInLineId ) AS enrollNum, ( SELECT COUNT( 1 ) @@ -123,7 +123,7 @@ public class TheRapyRecuperationStatisticsController { Sql sql = Sqls.create(""" SELECT agency.travelAgencyName, - ( SELECT AVG( evaluationForTravelAgency ) FROM the_rapy_recuperation_enroll where agency.id=takePartInTravelAgencyId) AS avg + ( SELECT AVG( evaluationForTravelAgency ) FROM the_rapy_recuperation_enroll where isNormal=true and agency.id=takePartInTravelAgencyId) AS avg FROM `the_rapy_recuperation_travel_agency` agency WHERE @@ -140,7 +140,7 @@ public class TheRapyRecuperationStatisticsController { Sql sql = Sqls.create(""" SELECT line.lineName, - ( SELECT AVG( evaluationForLine ) FROM the_rapy_recuperation_enroll where line.id=takePartInLineId) AS avg + ( SELECT AVG( evaluationForLine ) FROM the_rapy_recuperation_enroll where isNormal=true and line.id=takePartInLineId) AS avg FROM `the_rapy_recuperation_line` line WHERE diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java index 4201926..3036754 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java @@ -7,23 +7,26 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; + import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.EmailUtil; import io.v.nutz.base.utils.Vi; -import io.v.nutz.base.query.PageForm; + +import io.v.nutz.base.utils.ViTool; import io.v.nutz.sys.models.Sys_union; import io.v.nutz.sys.models.Sys_user; -import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; -import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; -import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.base.utils.ViTool; + +import io.v.nutz.web.commons.base.Globals; import io.v.nutz.web.commons.slog.annotation.SLog; + +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.common.TherapyRecuperationCommon; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.*; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -79,18 +82,24 @@ public class TheRapyRecuperationUnionQueryController { @ViReturn @RequiresAuthentication public Object getXlData(PageForm pageForm, - @Param(value = "year", required = false) String year, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "lotId", required = false) String lotId) { + String year, + String unionId, + String takePartInLineId, + String regionalNature, + String lotId, + String state, + String selectId) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT - lot.lotName, - lot.lotValue, - line.*, + enroll.id as enrollId, + lineu.id, + line.lineName, + line.regionalNature, lineu.lineId, + lineu.signUpMode, + YEAR(lineu.selectTime) as `year`, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, lineu.playStartTime as playStartTime1, lineu.playEndTime as playEndTime2, lxs.travelAgencyName, @@ -98,14 +107,17 @@ public class TheRapyRecuperationUnionQueryController { lxs.contactMobileNumber, enroll.takePartInUnionId AS usUnionId, un.unionname, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=@stateId $unionCnd) lineNum, - (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInLineId = lineu.id $unionCnd)) as signUpUserFamilyNum + lot.lotName, + lot.lotValue, + enroll.familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE isNormal=true and takePartInLineId = lineu.id and stateId=@stateId $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where isNormal=true and stateId=2750 and takePartInLineId = lineu.id $unionCnd)) as signUpUserFamilyNum FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId - LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lineu.travelAgencyId = lxs.id LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId $condition """).setParam("stateId", TheRapyRecuperationState.PASS); @@ -115,8 +127,11 @@ public class TheRapyRecuperationUnionQueryController { cnd.andEX("YEAR(enroll.signingUptime)", "=", year); if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) { - sql.setVar("unionCnd", "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId())); +// sql.setVar("unionCnd", "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId())); + String unionCndSql = StrUtil.isBlank(year) ? "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId()) : "and (takePartInUnionId='%s' or selfUnionId='%s') and YEAR(signingUptime)='%s'".formatted(Vi.getUnionId(), Vi.getUnionId(), year); + sql.setVar("unionCnd", unionCndSql); cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + //cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); /* if (Strings.isNotBlank(unionId)) { cnd.andEX("enroll.selfUnionId", "=", unionId); //cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); @@ -127,36 +142,47 @@ public class TheRapyRecuperationUnionQueryController { } else { if (Strings.isNotBlank(unionId)) { cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + //cnd.and("enroll.selfUnionId", "=", unionId); } } if (Strings.isNotBlank(regionalNature)) { sql.setVar("regionalNature", "AND line.regionalNature='%s'".formatted(regionalNature)); } + if(state.equals("2")) { + cnd.and("enroll.takePartInTravelAgencyId", "is not", null) + .and("enroll.takePartInTravelAgencyId", "!=", ""); + } else { + cnd.and("enroll.takePartInLineId", "is not", null) + .and("enroll.takePartInLineId", "!=", ""); + } cnd.andEX("line.lotId", "=", lotId); - cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.lineId", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); cnd.andEX("line.regionalNature", "=", regionalNature); cnd.groupBy("enroll.takePartInLineId"); cnd.desc("un.unioncode"); sql.setCondition(cnd); - return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + list.forEach(v -> { + List companionList = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("enrollId"))); + for (TheRapyRecuperationEnrollCompanion enrollCompanion : companionList) { + baseService.dao().fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + return pagination; } @At @ViReturn @RequiresAuthentication - public Object getRyData(PageForm pageForm, - @Param(value = "year", required = false) String year, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "state", required = false) String state, - @Param(value = "state2", required = false) String state2, - @Param(value = "agencyId", required = false) String agencyId, - @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId, - @Param(value = "lotId", required = false) String lotId) { + public Object getRyData(PageForm pageForm, String year, String unionId, String unitId, + String takePartInLineId, String regionalNature, String state, + String state2, String agencyId, String takePartInBaseManagementId, + String lotId, String selectId) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT @@ -167,6 +193,7 @@ public class TheRapyRecuperationUnionQueryController { agency.travelAgencyName, ma.baseName, enroll.*, + IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lineu.lineId, lineu.playStartTime, lineu.playEndTime, @@ -202,6 +229,7 @@ public class TheRapyRecuperationUnionQueryController { if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { if (Strings.isNotBlank(unionId) && state.equals("1")) { cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + //cnd.and("enroll.selfUnionId", "=", unionId); } cnd.andEX("enroll.selfUnionId", "=", unionId); } else { @@ -222,16 +250,20 @@ public class TheRapyRecuperationUnionQueryController { } } else { cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + //cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); } } cnd.andEX("enroll.selfUnitId", "=", unitId); - cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.lineId", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); if (state.equals("1")) { cnd.andEX("line.regionalNature", "=", regionalNature); cnd.and("enroll.takePartInLineId", "is not", null); + cnd.and("enroll.takePartInLineId", "!=", ""); sql.setVar("lotSql", ",(select lotName from the_rapy_recuperation_lot where id = line.lotId) as lotName"); } else if (state.equals("2")) { cnd.and("enroll.takePartInTravelAgencyId", "is not", null); + cnd.and("enroll.takePartInTravelAgencyId", "!=", ""); cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); } else if ("3".equals(state)) { cnd.and("enroll.takePartInBaseManagementId", "is not", null); @@ -255,13 +287,12 @@ public class TheRapyRecuperationUnionQueryController { @At @ViReturn @RequiresAuthentication - public Object getLxsData(PageForm pageForm, @Param(value = "year", required = false) String year, - @Param(value = "agencyId", required = false) String agencyId) { + public Object getLxsData(PageForm pageForm, String year, String agencyId) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT *, - cast( files ->> '$[0].id' AS CHAR ) AS fileId, + files AS fileId, ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE agency.id = takePartInTravelAgencyId and isNormal=true and stateId=@stateId $unionCnd $yearCnd) agencyNum FROM the_rapy_recuperation_travel_agency agency @@ -286,9 +317,7 @@ public class TheRapyRecuperationUnionQueryController { @At @ViReturn @RequiresAuthentication - public Object getJdData(PageForm pageForm, - @Param(value = "year", required = false) String year, - @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId) { + public Object getJdData(PageForm pageForm, String year, String takePartInBaseManagementId) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT @@ -321,18 +350,14 @@ public class TheRapyRecuperationUnionQueryController { @At @ViReturn @RequiresAuthentication - public Object getSelfUnionUser(PageForm pageForm, - @Param(value = "year", required = false) String year, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "state", required = false) String state, - @Param(value = "state2", required = false) String state2) { + public Object getSelfUnionUser(PageForm pageForm, String year, String unitId, String unionId, String state, String state2) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT state.stateName, state.stateColor, enroll.*, + IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lineu.lineId, lineu.playStartTime, lineu.playEndTime, @@ -365,10 +390,12 @@ public class TheRapyRecuperationUnionQueryController { cnd.and("enroll.selfUnionId", "=", unionId); } else { cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + //cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); } } else { if (StrUtil.isNotBlank(unionId)) { cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + //cnd.and("enroll.selfUnionId", "=", unionId); } } cnd.desc("enroll.stateId"); @@ -396,15 +423,8 @@ public class TheRapyRecuperationUnionQueryController { @Ok("void") @ViReturn @RequiresAuthentication - public void doExport(@Param(value = "state", required = false) String state, - @Param(value = "year", required = false) Integer year, - @Param(value = "searchName", required = false) String searchName, - @Param(value = "searchKeyword", required = false) String searchKeyword, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "agencyId", required = false) String agencyId, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "lotId", required = false) String lotId, + public void doExport(String state, Integer year, String searchName, String searchKeyword, String unionId, + String unitId, String agencyId, String takePartInLineId, String lotId, HttpServletResponse response) throws IOException { Cnd cnd = Cnd.NEW(); if (StrUtil.isNotBlank(state)) { @@ -418,12 +438,7 @@ public class TheRapyRecuperationUnionQueryController { cnd.andEX("YEAR(signingUptime)", "=", year); cnd.andEX("takePartInTravelAgencyId", "=", agencyId); cnd.and("takePartInTravelAgencyId", "is not", null); - } - - - } else { - } if (Strings.isNotBlank(searchKeyword) && Strings.isNotBlank(searchName)) { @@ -437,6 +452,9 @@ public class TheRapyRecuperationUnionQueryController { baseService.dao().fetchLinks(v, "companionList"); baseService.dao().fetchLinks(v, "bedInfo"); }); + + TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + List arrayList = new ArrayList<>(); enrollList.forEach(v -> { arrayList.add(new NutMap() {{ @@ -447,6 +465,7 @@ public class TheRapyRecuperationUnionQueryController { addv("unionName", v.getUnionName()); addv("idCard", v.getIdCard()); addv("mobile", v.getMobile()); + addv("familyNumber", v.getFamilyNumber()); addv("relation", "本人"); addv("bedType", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getBedType() : null); addv("bedNum", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getBedNum() : null); @@ -476,14 +495,19 @@ public class TheRapyRecuperationUnionQueryController { exportEntities.add(new ExcelExportEntity("姓名", "userName", 20)); exportEntities.add(new ExcelExportEntity("工号", "loginName", 20)); exportEntities.add(new ExcelExportEntity("性别", "sex", 20)); - exportEntities.add(new ExcelExportEntity("单位", "unitName", 40)); - exportEntities.add(new ExcelExportEntity("工会", "unionName", 40)); - exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 60)); - exportEntities.add(new ExcelExportEntity("手机号", "mobile", 60)); - exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 60)); - exportEntities.add(new ExcelExportEntity("床型", "bedType", 20)); - exportEntities.add(new ExcelExportEntity("床位数", "bedNum", 20)); - exportEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 20)); + exportEntities.add(new ExcelExportEntity("单位", "unitName", 20)); + exportEntities.add(new ExcelExportEntity("工会", "unionName", 20)); + exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + exportEntities.add(new ExcelExportEntity("手机号", "mobile", 10)); + if (config.getFamilyInfo() == 2) { + exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 10)); + exportEntities.add(new ExcelExportEntity("床型", "bedType", 10)); + exportEntities.add(new ExcelExportEntity("床位数", "bedNum", 10)); + exportEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 10)); + } else { + exportEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 10)); + + } exportEntities.add(new ExcelExportEntity("备注", "bz", 20)); response.setContentType("application/octet-stream"); @@ -512,12 +536,7 @@ public class TheRapyRecuperationUnionQueryController { @At @ViReturn @RequiresAuthentication - public Object getApplyNum(@Param(value = "state", required = false)String state, - @Param(value = "state2", required = false)String state2, - @Param(value = "unionId", required = false)String unionId, - @Param(value = "year", required = false)Integer year, - @Param(value = "regionalNature", required = false)String regionalNature, - @Param(value = "takePartInLineId", required = false)String takePartInLineId) { + public Object getApplyNum(String state, String state2, String unionId, Integer year, String regionalNature, String takePartInLineId, String selectId) { Cnd cnd1 = Cnd.NEW(); Sql sql1 = Sqls.create(""" SELECT @@ -533,12 +552,16 @@ public class TheRapyRecuperationUnionQueryController { if (Strings.isNotBlank(state)) { if (state.equals("1")) { cnd1.andEX("line.regionalNature", "=", regionalNature); - cnd1.and("enroll.takePartInTravelAgencyId", "is", null); + cnd1.and("enroll.takePartInLineId", "is not", null); + cnd1.and("enroll.takePartInLineId", "!=", ""); if (StrUtil.isBlank(state2)) { cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + //cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else if (state.equals("2")) { - cnd1.and("enroll.takePartInTravelAgencyId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); + cnd1.and("enroll.takePartInTravelAgencyId", "is not", null) + .and("enroll.takePartInTravelAgencyId", "!=", "") + .and("enroll.selfUnionId", "=", Vi.getUnionId()); } else { cnd1.and("enroll.takePartInBaseManagementId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); } @@ -560,6 +583,7 @@ public class TheRapyRecuperationUnionQueryController { } } else { cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + //cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else { if (Strings.isNotBlank(state)) { @@ -569,8 +593,10 @@ public class TheRapyRecuperationUnionQueryController { } cnd1.andEX("line.regionalNature", "=", regionalNature); cnd1.and("enroll.takePartInLineId", "is not", null); + cnd1.and("enroll.takePartInLineId", "!=", ""); } else if (state.equals("2")) { cnd1.and("enroll.takePartInTravelAgencyId", "is not", null); + cnd1.and("enroll.takePartInTravelAgencyId", "!=", ""); cnd1.andEX("enroll.selfUnionId", "=", unionId); } else if (state.equals("3")) { cnd1.and("enroll.takePartInBaseManagementId", "is not", null); @@ -580,37 +606,52 @@ public class TheRapyRecuperationUnionQueryController { } else { if (Strings.isNotBlank(unionId)) { cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId)); + //cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId)); } } } - cnd1.andEX("line.id", "=", takePartInLineId); + cnd1.andEX("lineu.lineId", "=", takePartInLineId); + cnd1.andEX("lineu.id", "=", selectId); cnd1.andEX("YEAR(enroll.signingUptime)", "= ", year); cnd1.andEX("enroll.isNormal", "= ", true); cnd1.andEX("enroll.stateId", "= ", TheRapyRecuperationState.PASS); + TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + Sql sql2 = null; + if (config.getFamilyInfo() == 2) { + sql2 = Sqls.create(""" + SELECT + count( 1 ) + FROM + the_rapy_recuperation_enroll_companion + WHERE + trreId IN ( SELECT enroll.id FROM the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId $condition ) + """); + } else { + sql2 = Sqls.create(""" + SELECT sum(familyNumber) FROM the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId $condition + """); + } Cnd cnd2 = Cnd.NEW(); - Sql sql2 = Sqls.create(""" - SELECT - count( 1 ) - FROM - the_rapy_recuperation_enroll_companion - WHERE - trreId IN ( SELECT enroll.id FROM the_rapy_recuperation_enroll enroll - LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId - LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId $condition ) - """); - if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) { if (Strings.isNotBlank(state)) { if (state.equals("1")) { cnd2.andEX("line.regionalNature", "=", regionalNature); cnd2.and("enroll.takePartInLineId", "is not", null); + cnd2.and("enroll.takePartInLineId", "!=", ""); if (StrUtil.isBlank(state2)) { cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + //cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else if (state.equals("2")) { - cnd2.and("enroll.takePartInTravelAgencyId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); + cnd2.and("enroll.takePartInTravelAgencyId", "is not", null) + .and("enroll.takePartInTravelAgencyId", "!=", "") + .and("enroll.selfUnionId", "=", Vi.getUnionId()); } else { cnd2.and("enroll.takePartInBaseManagementId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); } @@ -631,17 +672,21 @@ public class TheRapyRecuperationUnionQueryController { } } else { cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + //cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else { if (Strings.isNotBlank(state)) { if (state.equals("1")) { if (Strings.isNotBlank(unionId)) { cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId)); + //cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId)); } cnd2.andEX("line.regionalNature", "=", regionalNature); cnd2.and("enroll.takePartInLineId", "is not", null); + cnd2.and("enroll.takePartInLineId", "!=", ""); } else if (state.equals("2")) { cnd2.and("enroll.takePartInTravelAgencyId", "is not", null); + cnd2.and("enroll.takePartInTravelAgencyId", "!=", ""); cnd2.andEX("enroll.selfUnionId", "=", unionId); } else { cnd2.and("enroll.takePartInBaseManagementId", "is not", null); @@ -650,7 +695,8 @@ public class TheRapyRecuperationUnionQueryController { cnd2.andEX("enroll.selfUnionId", "=", unionId); } } - cnd2.andEX("line.id", "=", takePartInLineId); + cnd2.andEX("lineu.lineId", "=", takePartInLineId); + cnd2.andEX("lineu.id", "=", selectId); cnd2.andEX("YEAR(enroll.signingUptime)", "=", year); cnd2.andEX("enroll.isNormal", "=", true); cnd2.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); @@ -659,7 +705,14 @@ public class TheRapyRecuperationUnionQueryController { sql1.setCondition(cnd1); int count1 = baseService.count(sql1); sql2.setCondition(cnd2); - int count2 = baseService.count(sql2); + int count2 = 0; + if (config.getFamilyInfo() == 2) { + count2 = baseService.count(sql2); + } else { + Sql sql = Sqls.fetchInt(sql2.toString()); + baseService.dao().execute(sql); + count2 = sql.getInt(); + } return Map.of("count1", count1, "count2", count2); } @@ -678,12 +731,19 @@ public class TheRapyRecuperationUnionQueryController { .and("YEAR(signingUptime)", "=", year) .and("stateId", "=", TheRapyRecuperationState.PASS)); TheRapyRecuperationTravelAgency travelAgency = baseService.dao().fetch(TheRapyRecuperationTravelAgency.class, Cnd.where("id", "=", id)); + + List sysUsers = baseService.dao().query(Sys_user.class, Cnd.NEW()); + Map userMap = sysUsers.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getSchoolTime)); + if (travelAgency != null) { enrollList.forEach(v -> { baseService.dao().fetchLinks(v, "companionList"); }); List arrayList = new ArrayList<>(); enrollList.forEach(v -> { + String schoolTime = userMap.getOrDefault(v.getLoginName(), ""); + String sTime = TherapyRecuperationCommon.getRemarkBySchoolTime(schoolTime); + arrayList.add(new NutMap() {{ addv("userName", v.getUserName()); addv("loginName", v.getLoginName()); @@ -693,6 +753,7 @@ public class TheRapyRecuperationUnionQueryController { addv("idCard", v.getIdCard()); addv("relation", "本人"); addv("bz", v.getUserName()); + addv("remark", sTime); }}); v.getCompanionList().forEach(c -> { arrayList.add(new NutMap() {{ @@ -717,7 +778,7 @@ public class TheRapyRecuperationUnionQueryController { exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 60)); exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 60)); exportEntities.add(new ExcelExportEntity("备注", "bz", 20)); - + exportEntities.add(new ExcelExportEntity("备注2", "remark", 30)); File xls = new File("C:\\疗休养报名信息表.xls"); FileOutputStream fileOutputStream = null; @@ -737,7 +798,6 @@ public class TheRapyRecuperationUnionQueryController { return null; } - @At @ViReturn public Object doAttend(@Param("data") String multipleSelection) { @@ -789,7 +849,7 @@ public class TheRapyRecuperationUnionQueryController { left join `the_rapy_recuperation_line` rl on rs.lineId=rl.id LEFT JOIN `the_rapy_recuperation_travel_agency` ta ON rl.travelAgencyId = ta.id LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id - where rs.signUpMode='1' and rl.year=@year + where rs.signUpMode='1' and YEAR(rs.selectTime)=@year """); sql.setParam("year", DateUtil.thisYear()); List lineAllList = baseService.listMap(sql); @@ -855,7 +915,7 @@ public class TheRapyRecuperationUnionQueryController { WHERE rl.lineName IS NOT NULL and rs.signUpMode='1' and re.isNormal='1' and re.takePartInUnionId=@unionid - and rl.year=@year + and YEAR(re.signingUptime)=@year and re.stateId=@stateId """); String unionid = ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getId(); @@ -874,6 +934,8 @@ public class TheRapyRecuperationUnionQueryController { } }); map.put("unionName", ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getUnionname()); + map.put("year", DateUtil.thisYear()); + map.put("schoolName", Globals.MyConfig.getString("GxName")); map.put("maplist", list); Sys_user user = baseService.dao().fetch(Sys_user.class, Cnd.where("id", "=", ShiroUtil.getPrincipalProperty("id"))); map.put("filler", user.getUsername()); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java index 2744e01..d38a3f3 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java @@ -1,24 +1,34 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; +import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONUtil; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.Vi; -import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.ViTool; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.common.TherapyRecuperationCommon; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyRecuperationEnrollExcelMode; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; +import io.v.nutz.zhgh.therapyRecuperation.model.*; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresAuthentication; 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.Sqls; import org.nutz.dao.sql.Sql; @@ -28,6 +38,7 @@ import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -36,10 +47,18 @@ import org.nutz.mvc.upload.TempFile; import org.nutz.mvc.upload.UploadAdaptor; import org.springframework.util.CollectionUtils; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; @IocBean @At("/platform/theRapyRecuperation/user/query") @@ -62,16 +81,10 @@ public class TheRapyRecuperationUserQueryController { @At @ViReturn @RequiresAuthentication - public Object pageData(@Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "state", required = false) Integer state, PageForm pageForm, - @Param(value = "startYear", required = false) Integer startYear, - @Param(value = "endYear", required = false) Integer endYear, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "agencyId", required = false) String agencyId, - @Param(value = "lotId", required = false) String lotId, - @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId) { + public Object pageData(String regionalNature, Integer state, PageForm pageForm, + Integer startYear, Integer endYear, String unionId, + String unitId, String takePartInLineId, String agencyId, String lotId, + String takePartInBaseManagementId, String signUpMode) { Cnd cnd = Cnd.NEW(); if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { @@ -83,14 +96,17 @@ public class TheRapyRecuperationUserQueryController { sql = Sqls.create(""" SELECT enroll.*, + IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lxs.travelAgencyName, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId $condition """); - cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); + if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { + cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); + } cnd.andEX("lxs.`year`", ">=", startYear); cnd.andEX("lxs.`year`", "<=", endYear); cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); @@ -103,10 +119,11 @@ public class TheRapyRecuperationUserQueryController { line.lineName, ma.baseName, enroll.*, + IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lineu.lineId, lineu.playStartTime, - lineu.playEndTime, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId @@ -121,6 +138,7 @@ public class TheRapyRecuperationUserQueryController { cnd.andEX("enroll.selfUnitId", "=", unitId); cnd.andEX("line.id", "=", takePartInLineId); cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.andEX("lineu.signUpMode", "=", signUpMode); if (state == 3) { sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = ma.lotId) as lotName"); cnd.and("enroll.takePartInBaseManagementId", "is not", null); @@ -128,6 +146,7 @@ public class TheRapyRecuperationUserQueryController { } else { sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = line.lotId) as lotName"); cnd.and("enroll.takePartInLineId", "is not", null); + cnd.and("enroll.takePartInLineId", "!=", ""); } if (StrUtil.isNotBlank(lotId)) { SqlExpressionGroup seg = new SqlExpressionGroup(); @@ -139,9 +158,9 @@ public class TheRapyRecuperationUserQueryController { if (StrUtil.isNotBlank(unionId)) { cnd.and("enroll.selfUnionId", "=", unionId); } - cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); } cnd.and("enroll.isNormal", "=", true); + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); cnd.desc("enroll.unionName"); sql.setCondition(cnd); return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); @@ -149,9 +168,7 @@ public class TheRapyRecuperationUserQueryController { @At @ViReturn - public Object getXlLxsUserCount(@Param(value = "unionId", required = false) String unionId, - @Param(value = "startYear", required = false) Integer startYear, - @Param(value = "endYear", required = false) Integer endYear) { + public Object getXlLxsUserCount(String unionId, Integer startYear, Integer endYear, Integer signUpMode) { Cnd cnd = Cnd.NEW(); cnd.andEX("YEAR(signingUptime)", ">=", startYear); cnd.andEX("YEAR(signingUptime)", "<=", endYear); @@ -160,18 +177,25 @@ public class TheRapyRecuperationUserQueryController { } cnd.and("isNormal", "=", true); cnd.and("takePartInLineId", "is not", null); + cnd.and("takePartInLineId", "!=", ""); cnd.and("stateId", "=", TheRapyRecuperationState.PASS); + cnd.andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode); int count = baseService.dao().count(TheRapyRecuperationEnroll.class, cnd); int count1 = baseService.dao().count(TheRapyRecuperationEnroll.class, Cnd.where("takePartInTravelAgencyId", "is not", null) + .and("takePartInTravelAgencyId", "!=", "") .andEX("selfUnionId", "=", unionId) .andEX("YEAR(signingUptime)", ">=", startYear) .andEX("YEAR(signingUptime)", "<=", endYear) - .andEX("isNormal", "=", true)); + .andEX("stateId", "=", TheRapyRecuperationState.PASS) + .andEX("isNormal", "=", true) + .andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode)); int count2 = baseService.dao().count(TheRapyRecuperationEnroll.class, Cnd.where("takePartInBaseManagementId", "is not", null) .andEX("selfUnionId", "=", unionId) .andEX("YEAR(signingUptime)", ">=", startYear) .andEX("YEAR(signingUptime)", "<=", endYear) - .andEX("isNormal", "=", true)); + .andEX("stateId", "=", TheRapyRecuperationState.PASS) + .andEX("isNormal", "=", true) + .andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode)); return Map.of("xlCount", count, "lxsCount", count1, "jdCount", count2); } @@ -259,4 +283,616 @@ public class TheRapyRecuperationUserQueryController { return null; } + + @At + @ViReturn + public Object doEdit(TheRapyRecuperationEnroll enroll) { + enroll.setNormal(true); + baseService.dao().updateIgnoreNull(enroll); + return null; + } + + @At + @ViReturn + public Object getUnionSelectLine(Integer startYear, Integer endYear, Integer signUpMode, String regionalNature, Boolean flag, String disPlayUnionSelectId) { + Sql sql = Sqls.create(""" + SELECT + rlus.id, + rlus.unionId, + rlus.lineId, + rlus.selectUserId, + DATE_FORMAT( rlus.playStartTime, '%Y-%m-%d' ) AS playStartTime, + DATE_FORMAT( rlus.playEndTime, '%Y-%m-%d' ) AS playEndTime, + rl.lineName, + rl.regionalNature, + if(rlus.signUpMode=2,'校工会','分工会') AS signUpMode, + lot.lotName + FROM + `the_rapy_recuperation_line_union_select` rlus + LEFT JOIN `the_rapy_recuperation_line` rl ON rlus.lineId = rl.id + LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id + $condition + """); + Cnd cnd = Cnd.NEW(); + if (flag == null || !flag) { + SqlExpressionGroup group = new SqlExpressionGroup(); + if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + group.and("rlus.isOpen", "=", 1); + //cnd.and(Cnd.exps("rlus.isOpen", "=", 1)); + } else { + group.or("rlus.isOpen", "=", 1).or("rlus.unionId", "=", Vi.getUnionId()); + //cnd.and(Cnd.exps("rlus.isOpen", "=", 1).or(); + } + if(StrUtil.isNotBlank(disPlayUnionSelectId)) { + group.or("rlus.id", "=", disPlayUnionSelectId); + } + cnd.and(group); + } else { + cnd.andEX("YEAR(rlus.selectTime)", ">=", startYear); + cnd.andEX("YEAR(rlus.selectTime)", "<=", endYear); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and(Cnd.exps("rlus.selectUserId", "=", ShiroUtil.getUserId()).or("rlus.unionId", "=", Vi.getUnionId())); + } + cnd.andEX("rl.regionalNature", "=", regionalNature); + cnd.groupBy("rlus.lineId"); + } + cnd.and("YEAR(rlus.selectTime)", "in", startYear != null ? Lang.array(startYear) : Lang.array(DateUtil.thisYear())); + cnd.andEX("rlus.signUpMode", "=", signUpMode); + cnd.desc("lot.lotValue"); + cnd.desc("rl.lineName"); + sql.setCondition(cnd); + return baseService.listMap(sql); + } + + @At + @Ok("void") + @ViReturn + @RequiresAuthentication + public void doExportExcel(@Param(value = "regionalNature", required = false) String regionalNature, + @Param(value = "state", required = false) Integer state, + @Param(value = "searchName", required = false) String searchName, + @Param(value = "searchKeyword", required = false) String searchKeyword, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + @Param(value = "takePartInLineId", required = false) String takePartInLineId, + @Param(value = "agencyId", required = false) String agencyId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "types", required = false) String[] types, + @Param(value = "satisfyPeople", required = false) Boolean satisfyPeople, + HttpServletResponse response) throws IOException { + + Cnd commonCnd = Cnd.NEW(); + if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { + commonCnd.and(Cnd.likeEX(searchName, searchKeyword)); + } + if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { + commonCnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + } + commonCnd.and("enroll.isNormal", "=", true); + commonCnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); + + //线路的查询 + Sql lineSql = Sqls.create(""" + SELECT + line.regionalNature, + lxs.travelAgencyName, + line.lineName, + enroll.*, + date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat, + date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime, + lineu.lineId, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount, + u.schoolTime + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `user` u on enroll.loginName = u.loginname + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = lineu.travelAgencyId + $condition + """); + Cnd lineCnd = commonCnd.clone(); + lineCnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear); + lineCnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); + lineCnd.andEX("enroll.selfUnitId", "=", unitId); + lineCnd.andEX("line.id", "=", takePartInLineId); + lineCnd.andEX("line.regionalNature", "=", regionalNature); + lineCnd.andEX("lineu.signUpMode", "=", signUpMode); + lineCnd.andEX("enroll.selfUnionId", "=", unionId); + lineCnd.and("enroll.takePartInLineId", "is not", null); + lineCnd.and("enroll.takePartInLineId", "!=", ""); + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + lineCnd.and(seg); + } + lineCnd.asc("lineName").asc("playStartTime").asc("unionName"); + lineSql.setCondition(lineCnd); + List lineEnroll = baseService.listMap(lineSql); + lineEnroll.forEach(item -> { + String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); + item.put("remark", remark); + }); + + //自由组团的查询 + Sql travelSql = Sqls.create(""" + SELECT + enroll.*, + lxs.travelAgencyName, + u.schoolTime + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `user` u on enroll.loginName = u.loginname + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId + $condition + """); + Cnd travelCnd = commonCnd.clone(); + travelCnd.andEX("enroll.selfUnionId", "=", unionId); + travelCnd.andEX("lxs.`year`", ">=", startYear); + travelCnd.andEX("lxs.`year`", "<=", endYear); + travelCnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); + travelCnd.and("enroll.takePartInTravelAgencyId", "is not", null); + travelCnd.and("enroll.takePartInTravelAgencyId", "!=", ""); + travelCnd.asc("travelAgencyName").desc("enroll.unionName"); + travelSql.setCondition(travelCnd); + List travelEnroll = baseService.listMap(travelSql); + travelEnroll.forEach(item -> { + String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); + item.put("remark", remark); + }); + + //公共的导出表头 + ArrayList commonEntities = new ArrayList<>(); + commonEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + commonEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + commonEntities.add(new ExcelExportEntity("性别", "sex", 10)); + commonEntities.add(new ExcelExportEntity("所属单位", "unitName", 20)); + commonEntities.add(new ExcelExportEntity("所属工会", "unionName", 20)); + commonEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + commonEntities.add(new ExcelExportEntity("手机号", "mobile", 15)); + ExcelExportEntity entity = new ExcelExportEntity("报名时间", "signingUptime", 15); + entity.setFormat("yyyy-MM-dd HH:mm:ss"); + commonEntities.add(entity); + + //线路表头 + ArrayList lineEntities = new ArrayList<>(commonEntities); + lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20)); + lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20)); + lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); + lineEntities.add(new ExcelExportEntity("家属人数", "familyCount", 20)); + + //自由组团表头 + ArrayList travelEntities = new ArrayList<>(commonEntities); + travelEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); + + commonEntities.add(new ExcelExportEntity("备注", "remark", 30)); + + try { + ViTool.excelResponse(response, "人员名单.xlsx"); + if(Arrays.asList(types).contains("line")) { + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, lineEnroll); + workbook.write(response.getOutputStream()); + } + if(Arrays.asList(types).contains("travel")) { + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, travelEntities, travelEnroll); + workbook.write(response.getOutputStream()); + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + @At + @Ok("void") + @ViReturn + @RequiresAuthentication + public void doExport(@Param(value = "regionalNature", required = false) String regionalNature, + @Param(value = "state", required = false) Integer state, + @Param(value = "searchName", required = false) String searchName, + @Param(value = "searchKeyword", required = false) String searchKeyword, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + @Param(value = "takePartInLineId", required = false) String takePartInLineId, + @Param(value = "agencyId", required = false) String agencyId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "types", required = false) String[] types, + @Param(value = "satisfyPeople", required = false) Boolean satisfyPeople, + HttpServletResponse response) throws IOException { + + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + + URLEncoder.encode("疗休养报名人员名单.zip", StandardCharsets.UTF_8)); + + Cnd commonCnd = Cnd.NEW(); + if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { + commonCnd.and(Cnd.likeEX(searchName, searchKeyword)); + } + if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { + commonCnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + } + commonCnd.and("enroll.isNormal", "=", true); + commonCnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); + + //线路的查询 + Sql lineSql = Sqls.create(""" + SELECT + line.regionalNature, + lxs.travelAgencyName, + line.lineName, + enroll.*, + date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat, + date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime, + lineu.lineId, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount, + u.schoolTime + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `user` u on enroll.loginName = u.loginname + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = lineu.travelAgencyId + $condition + """); + Cnd lineCnd = commonCnd.clone(); + lineCnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear); + lineCnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); + lineCnd.andEX("enroll.selfUnitId", "=", unitId); + lineCnd.andEX("line.id", "=", takePartInLineId); + lineCnd.andEX("line.regionalNature", "=", regionalNature); + lineCnd.andEX("lineu.signUpMode", "=", signUpMode); + lineCnd.andEX("enroll.selfUnionId", "=", unionId); + lineCnd.and("enroll.takePartInLineId", "is not", null); + lineCnd.and("enroll.takePartInLineId", "!=", ""); + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + lineCnd.and(seg); + } + lineCnd.asc("playStartTime").asc("unionName"); + lineSql.setCondition(lineCnd); + List lineEnroll = baseService.listMap(lineSql); + + if (satisfyPeople) { + //按照选择线路id分组,便于判断是否成团 + Map> enrollGroup = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInLineId"))); + + List unionSelects = + baseService.dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("enable", "=", true)); + Map selectMap = unionSelects.stream().collect(Collectors.toMap(TheRapyRecuperationLineUnionSelect::getId, o -> o)); + + lineEnroll = enrollGroup.entrySet().stream() + .filter(entry -> selectMap.containsKey(entry.getKey()) && (entry.getValue().size() + entry.getValue().stream().mapToInt(o -> o.getInt("familyCount")).sum()) >= selectMap.get(entry.getKey()).getEstimatedFamilyNumbers()) + .flatMap(entry -> entry.getValue().stream()) + .collect(Collectors.toList()); + } + + Map> lineGroupMap = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("lineId"))); + //查询所有的线路 + List lineList = baseService.dao().query(TheRapyRecuperationLine.class, Cnd.NEW()); + Map lineMap = lineList.stream().collect(Collectors.toMap(TheRapyRecuperationLine::getId, TheRapyRecuperationLine::getLineName)); + + //自由组团的查询 + Sql travelSql = Sqls.create(""" + SELECT + enroll.*, + lxs.travelAgencyName, + u.schoolTime + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `user` u on enroll.loginName = u.loginname + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId + $condition + """); + Cnd travelCnd = commonCnd.clone(); + travelCnd.andEX("enroll.selfUnionId", "=", unionId); + travelCnd.andEX("lxs.`year`", ">=", startYear); + travelCnd.andEX("lxs.`year`", "<=", endYear); + travelCnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); + travelCnd.and("enroll.takePartInTravelAgencyId", "is not", null); + travelCnd.and("enroll.takePartInTravelAgencyId", "!=", ""); + travelCnd.desc("enroll.unionName"); + travelSql.setCondition(travelCnd); + List travelEnroll = baseService.listMap(travelSql); + Map> travelGroupMap = travelEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInTravelAgencyId"))); + //查询所有的旅行社 + List travelList = baseService.dao().query(TheRapyRecuperationTravelAgency.class, Cnd.NEW()); + Map travelMap = travelList.stream().collect(Collectors.toMap(TheRapyRecuperationTravelAgency::getId, TheRapyRecuperationTravelAgency::getTravelAgencyName)); + + //公共的导出表头 + ArrayList commonEntities = new ArrayList<>(); + commonEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + commonEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + commonEntities.add(new ExcelExportEntity("性别", "sex", 10)); + commonEntities.add(new ExcelExportEntity("所属单位", "unitName", 20)); + commonEntities.add(new ExcelExportEntity("所属工会", "unionName", 20)); + commonEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + commonEntities.add(new ExcelExportEntity("手机号", "mobile", 15)); + ExcelExportEntity entity = new ExcelExportEntity("报名时间", "signingUptime", 15); + entity.setFormat("yyyy-MM-dd HH:mm:ss"); + commonEntities.add(entity); + + //线路表头 + ArrayList lineEntities = new ArrayList<>(commonEntities); + lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20)); + lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20)); + lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); + lineEntities.add(new ExcelExportEntity("家属人数", "familyCount", 20)); + + //自由组团表头 + ArrayList travelEntities = new ArrayList<>(commonEntities); + travelEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); + + commonEntities.add(new ExcelExportEntity("备注", "remark", 30)); + + ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream())); + + try { + if(Arrays.asList(types).contains("line")) { + for (String key : lineGroupMap.keySet()) { + List enrollList = lineGroupMap.get(key); + enrollList.forEach(item -> { + String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); + item.put("remark", remark); + }); + String fileName = "线路报名人员/" + lineMap.get(key) + ".xlsx"; + zipOutputStream.putNextEntry(new ZipEntry(fileName)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, enrollList); + workbook.write(zipOutputStream); + zipOutputStream.closeEntry(); + response.flushBuffer(); + } + } + if(Arrays.asList(types).contains("travel")) { + for (String key : travelGroupMap.keySet()) { + List enrollList = travelGroupMap.get(key); + enrollList.forEach(item -> { + String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); + item.put("remark", remark); + }); + String fileName = "自由组团报名人员/" + travelMap.get(key) + ".xlsx"; + zipOutputStream.putNextEntry(new ZipEntry(fileName)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, travelEntities, enrollList); + workbook.write(zipOutputStream); + zipOutputStream.closeEntry(); + response.flushBuffer(); + } + } + zipOutputStream.flush(); + zipOutputStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @At + @Ok("void") + @ViReturn + @RequiresAuthentication + public void doExport1(String regionalNature, Integer state, String searchName, String searchKeyword, + Integer startYear, Integer endYear, String unionId, + String unitId, String takePartInLineId, String agencyId, String lotId, + String takePartInBaseManagementId, String signUpMode, + HttpServletResponse response) throws IOException { + + Cnd cnd = Cnd.NEW(); + + if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { + cnd.and(Cnd.likeEX(searchName, searchKeyword)); + } + + Sql sql; + if (state != null && state == 2) { + sql = Sqls.create(""" + SELECT + enroll.*, + lxs.travelAgencyName, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId + $condition + """); + cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); + cnd.andEX("lxs.`year`", ">=", startYear); + cnd.andEX("lxs.`year`", "<=", endYear); + cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); + cnd.and("enroll.takePartInTravelAgencyId", "is not", null); + cnd.and("enroll.takePartInTravelAgencyId", "!=", ""); + } else { + sql = Sqls.create(""" + SELECT + $lotSql, + line.regionalNature, + lxs.travelAgencyName, + line.lineName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId + $condition + """); + cnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear); + cnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); + cnd.andEX("enroll.selfUnitId", "=", unitId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.andEX("lineu.signUpMode", "=", signUpMode); + cnd.and("enroll.takePartInLineId", "is not", null); + cnd.and("enroll.takePartInLineId", "!=", ""); + if (state == 3) { + sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = ma.lotId) as lotName"); + cnd.and("enroll.takePartInBaseManagementId", "is not", null); + cnd.andEX("enroll.takePartInBaseManagementId", "=", takePartInBaseManagementId); + } else { + sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = line.lotId) as lotName"); + cnd.and("enroll.takePartInLineId", "is not", null); + } + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); +// seg.or("agency.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + if (StrUtil.isNotBlank(unionId)) { + cnd.and("enroll.selfUnionId", "=", unionId); + } + } + cnd.and("enroll.isNormal", "=", true); + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); + cnd.desc("enroll.unionName"); + sql.setCondition(cnd); + + List list = baseService.listMap(sql); + List enrollList = Lang.collection2list(list, TheRapyRecuperationEnroll.class); + + TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + + enrollList.forEach(v -> { + baseService.dao().fetchLinks(v, "companionList"); + baseService.dao().fetchLinks(v, "bedInfo"); + baseService.dao().fetchLinks(v, "managementInfo"); + if (StrUtil.isNotBlank(v.getLineId())) { + TheRapyRecuperationLine line = baseService.dao().fetch(TheRapyRecuperationLine.class, v.getLineId()); + v.setLineInfo(line); + } + }); + List arrayList = new ArrayList<>(); + String takePartInLineId2 = ""; + String takePartInBaseManagementId2 = ""; + String agencyName = ""; + String lotName = ""; + for (TheRapyRecuperationEnroll v : enrollList) { + if (StrUtil.isNotBlank(v.getTakePartInLineId()) && !v.getTakePartInLineId().equals(takePartInLineId2)) { + TheRapyRecuperationLine line = baseService.dao().fetch(TheRapyRecuperationLine.class, v.getLineId()); + TheRapyRecuperationLineUnionSelect unionSelect = baseService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, v.getTakePartInLineId()); + TheRapyRecuperationLot lot = baseService.dao().fetch(TheRapyRecuperationLot.class, line.getLotId()); + TheRapyRecuperationTravelAgency agency = baseService.dao().fetch(TheRapyRecuperationTravelAgency.class, unionSelect.getTravelAgencyId()); + agencyName = agency.getTravelAgencyName(); + lotName = lot.getLotName(); + } else { + if (StrUtil.isNotBlank(v.getTakePartInBaseManagementId()) && !v.getTakePartInBaseManagementId().equals(takePartInBaseManagementId2)) { + TheRapyRecuperationBaseManagement management = baseService.dao().fetch(TheRapyRecuperationBaseManagement.class, v.getTakePartInBaseManagementId()); + TheRapyRecuperationLot lot = baseService.dao().fetch(TheRapyRecuperationLot.class, management.getLotId()); + TheRapyRecuperationTravelAgency agency = baseService.dao().fetch(TheRapyRecuperationTravelAgency.class, management.getTravelAgencyId()); + agencyName = agency.getTravelAgencyName(); + lotName = lot.getLotName(); + } + } + String finalAgencyName = agencyName; + String finalLotName = lotName; + arrayList.add(new NutMap() {{ + addv("userName", v.getUserName()); + addv("loginName", v.getLoginName()); + addv("sex", v.getSex()); + addv("unitName", v.getUnitName()); + addv("unionName", v.getUnionName()); + addv("idCard", v.getIdCard()); + addv("mobile", v.getMobile()); + addv("relation", "本人"); + addv("familyNumber", v.getFamilyNumber()); + addv("bedType", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getBedType() : null); + addv("bedNum", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getBedNum() : null); + addv("otherSleepUser", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getOtherSleepUser() : null); + addv("baseName", Lang.isNotEmpty(v.getManagementInfo()) ? v.getManagementInfo().getBaseName() : v.getLineInfo().getLineName()); + addv("signingUptime", DateUtil.formatDateTime(v.getSigningUptime())); + addv("agencyName", finalAgencyName); + addv("lotName", finalLotName); + addv("bz", v.getUserName()); + }}); + v.getCompanionList().forEach(c -> { + baseService.dao().fetchLinks(c, "bedInfo"); + arrayList.add(new NutMap() {{ + addv("userName", c.getUserName()); + addv("loginName", c.getLoginName()); + addv("sex", c.getSex()); + addv("unitName", null); + addv("unionName", null); + addv("idCard", c.getIdCard()); + addv("mobile", c.getMobile()); + addv("relation", c.getRelation()); + addv("bedType", Lang.isNotEmpty(c.getBedInfo()) ? c.getBedInfo().getBedType() : null); + addv("bedNum", Lang.isNotEmpty(c.getBedInfo()) ? c.getBedInfo().getBedNum() : null); + addv("otherSleepUser", Lang.isNotEmpty(c.getBedInfo()) ? c.getBedInfo().getOtherSleepUser() : null); + addv("baseName", Lang.isNotEmpty(v.getManagementInfo()) ? v.getManagementInfo().getBaseName() : v.getLineInfo().getLineName()); + addv("signingUptime", DateUtil.formatDateTime(v.getSigningUptime())); + addv("agencyName", finalAgencyName); + addv("lotName", finalLotName); + addv("bz", v.getUserName()); + }}); + }); + } + + ArrayList exportEntities = new ArrayList<>(); + exportEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + exportEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + exportEntities.add(new ExcelExportEntity("性别", "sex", 10)); + exportEntities.add(new ExcelExportEntity("单位", "unitName", 20)); + exportEntities.add(new ExcelExportEntity("工会", "unionName", 20)); + exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + exportEntities.add(new ExcelExportEntity("手机号", "mobile", 15)); + if (config.getFamilyInfo() == 2) { + exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 10)); + exportEntities.add(new ExcelExportEntity("床型", "bedType", 20)); + exportEntities.add(new ExcelExportEntity("床位数", "bedNum", 20)); + exportEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 20)); + } else { + exportEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 20)); + } + exportEntities.add(new ExcelExportEntity("疗休养时长", "lotName", 20)); + exportEntities.add(new ExcelExportEntity("集中/目的地", "baseName", 20)); + exportEntities.add(new ExcelExportEntity("旅行社", "agencyName", 20)); + exportEntities.add(new ExcelExportEntity("报名时间", "signingUptime", 20)); + exportEntities.add(new ExcelExportEntity("备注", "bz", 20)); + + try { + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("报名人员.xls").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, arrayList); + workbook.write(response.getOutputStream()); + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @At + @ViReturn + @RequiresAuthentication + public Object doReimbursement(@Param("data") String data) { + JSONArray objects = JSONUtil.parseArray(data); + List enrollIds = objects.toList(String.class); + if (Lang.isNotEmpty(enrollIds)) { + baseService.dao().update(TheRapyRecuperationEnroll.class, Chain.make("isReimbursement", 1), Cnd.where("id", "in", enrollIds)); + } + return null; + } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java new file mode 100644 index 0000000..a58a5e9 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java @@ -0,0 +1,254 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.statistics; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.*; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +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; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.Strings; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @version 1.0 + * @Author zzr + * @name:TheRapyRecuperationStatisticsController + * @Date 2024/6/3 17:32 + * @注释 查看报名情况 + */ +@IocBean +@At("/platform/theRapyRecuperation/statistics") +@Ok("json:full") +@Slf4j +public class TheRapyRecuperationLineStatisticsController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + + @Inject + private MsgApi msgApi; + + @Inject + private Dao dao; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/statistics/lineStatistics.html") + @RequiresPermissions("theRapyRecuperation.statistics") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.statistics") + public Object pageData(PageForm pageForm, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param(value = "unionId", required = false) String unionId, + @Param("takePartInLineId") String takePartInLineId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "selectId",required = false) String selectId, + @Param(value = "regionalNature", required = false) String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + line.id, + line.lineName, + line.regionalNature, + lineu.lineId, + lineu.id as lineUId, + lineu.signUpMode, + lineu.minimumGroupSize, + lineu.estimatedFamilyNumbers, + YEAR(lineu.selectTime) as `year`, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, + lineu.playStartTime as playStartTime1, + lineu.playEndTime as playEndTime2, + lxs.travelAgencyName, + lxs.contact, + lxs.contactMobileNumber, + enroll.takePartInUnionId AS usUnionId, + if(lineu.signUpMode = 2, '校工会', un.unionname) as unionname, + lot.lotName, + lot.lotValue, + enroll.familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=2750 and isNormal = true $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where stateId=2750 and takePartInLineId = lineu.id and isNormal = true $unionCnd)) as signUpUserFamilyNum + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lineu.travelAgencyId = lxs.id + LEFT JOIN sys_union un ON un.id = lineu.unionId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(lineu.selectTime)", ">=", startYear); + cnd.andEX("YEAR(lineu.selectTime)", "<=", endYear); + cnd.andEX("lineu.signUpMode","=",signUpMode); + if (!ShiroUtil.hasAnyRoles("sysadmin,H06")){ + String unionCndSql = "and (selfUnionId='%s' or takePartInUnionId = '%s')".formatted(Vi.getUnionId(), Vi.getUnionId()); + sql.setVar("unionCnd", unionCndSql); + cnd.and("lineu.unionId", "=", Vi.getUnionId()); + } else { + if (Strings.isNotBlank(unionId)) { + cnd.and("lineu.unionId", "=", unionId); + } + } + + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.groupBy("enroll.takePartInLineId"); + cnd.asc("line.serialNumber").asc("lineu.playStartTime"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + /** + * 根据线路查询报名详情 + * @param searchKeyword + * @param unionId + * @param unitId + * @return + */ + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.statistics") + public Object getUserDateByLine(PageForm pageForm, + @Param(value = "takePartLineId",required = false) String takePartLineId, + @Param(value = "searchKeyword", required = false) String searchKeyword, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId) { + Sql sql = Sqls.create(""" + SELECT + enroll.*, + line.lineName, + line.id as lineId, + line.regionalNature, + '教职工' userNature, + state.stateColor, + state.stateName, + CONCAT(DATE_FORMAT(rs.playStartTime,'%m月%d日'),'-',DATE_FORMAT(rs.playEndTime,'%m月%d日')) AS linePlayTime, + IF + ( enroll.takePartInUnionId != enroll.selfUnionId, TRUE, FALSE ) isTransferIn, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) num + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `the_rapy_recuperation_line_union_select` rs ON rs.id = enroll.takePartInLineId + LEFT JOIN `the_rapy_recuperation_line` line on line.id=rs.lineId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("enroll.takePartInLineId","=",takePartLineId); + cnd.and("enroll.stateId","=",2750); + cnd.andEX("enroll.selfUnionId", "=", unionId); + cnd.andEX("enroll.selfUnitId", "=", unitId); + cnd.and("enroll.takePartInLineId", "is not", null); + cnd.andEX("enroll.isNormal", "=", true); + if (StrUtil.isNotBlank(searchKeyword)){ + cnd.and(Cnd.exps("enroll.loginName","like","%"+searchKeyword+"%").or("enroll.userName","like","%"+searchKeyword+"%")); + } + cnd.desc("enroll.signingUptime"); + cnd.desc("enroll.unitName"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @At + @ViReturn + @RequiresAuthentication + public Object sendSuccess(String id) { + + TheRapyRecuperationLineUnionSelect unionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, id); + TheRapyRecuperationLine line = dao.fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); + if (DateUtil.compare(new Date(), unionSelect.getSignUpEndTime()) < 0) { + return Result.error("报名还未结束,不能发送"); + } + //找出报名人员 + List enrolls = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", id) + .and("isNormal", "=", true).and("year(signingUptime)", "=", DateUtil.thisYear()) + .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); + + //发短信 + enrolls.forEach(item -> { + String content = "%s老师,您好!您报名的%s线路,出行时间为%s,达到成团条件,请准时参加疗休养活动。".formatted( + item.getUserName(), + line.getLineName(), + DateUtil.format(unionSelect.getPlayStartTime(), "yyyy-MM-dd") + ); + List list = List.of(Map.of("type", "User", "userId", item.getLoginName(), "name", item.getUserName())); + //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + }); + return null; + } + + @At + @ViReturn + @RequiresAuthentication + @Aop(TransAop.READ_COMMITTED) + public Object sendFail(String id, Boolean type) { + + TheRapyRecuperationLineUnionSelect unionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, id); + TheRapyRecuperationLine line = dao.fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); + if (DateUtil.compare(new Date(), unionSelect.getSignUpEndTime()) < 0) { + return Result.error("报名还未结束,不能发送"); + } + //找出报名人员 + List enrolls = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", id) + .and("isNormal", "=", true).and("year(signingUptime)", "=", DateUtil.thisYear()) + .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); + + //发短信 + enrolls.forEach(item -> { + String content = "%s老师,您好!您报名的%s线路,出行时间为%s,因报名人数不足未达到成团条件,请尽快进入疗休养管理系统重新选择线路。".formatted( + item.getUserName(), + line.getLineName(), + DateUtil.format(unionSelect.getPlayStartTime(), "yyyy-MM-dd") + ); + List list = List.of(Map.of("type", "User", "userId", item.getLoginName(), "name", item.getUserName())); + //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + }); + + if(!type) { + List enrollIds = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); + List bedIds = enrolls.stream().map(TheRapyRecuperationEnroll::getBedInfo).collect(Collectors.toList()); + dao.clear(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", id)); + dao.clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIds)); + dao.clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "in", bedIds)); + } else { + List idList = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); + dao.update(TheRapyRecuperationEnroll.class, Chain.make("isNormal", false), Cnd.where("id", "in", idList)); + } + return null; + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java index fb055d3..1585bf3 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.theRapyConfig; + import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; @@ -17,7 +18,6 @@ import org.nutz.lang.Lang; import org.nutz.lang.Strings; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; -import org.nutz.mvc.annotation.Param; import org.nutz.trans.Trans; import org.springframework.util.CollectionUtils; @@ -53,8 +53,7 @@ public class TheRapyRecuperationConfigController { @ViReturn @RequiresAuthentication @Aop(TransAop.READ_COMMITTED) - public Object operation(TheRapyRecuperationConfig config, - @Param(value = "lotDeleteList", required = false) String[] lotDeleteList) { + public Object operation(TheRapyRecuperationConfig config, String[] lotDeleteList) { if (Strings.isNotBlank(config.getId())) { if (Lang.isNotEmpty(lotDeleteList)) { dao.clear(TheRapyRecuperationLot.class, Cnd.where("id", "in", lotDeleteList)); @@ -75,32 +74,31 @@ public class TheRapyRecuperationConfigController { @ViReturn @RequiresAuthentication public Object findOne() { - return dao.fetchLinks(dao.fetch(TheRapyRecuperationConfig.class), "lots", Cnd.NEW().desc("lotValue")); + return dao.fetchLinks(dao.fetch(TheRapyRecuperationConfig.class), "lots",Cnd.NEW().desc("lotValue")); } /** * 查使用该标段的线路和目的地 - * * @param lotId * @return */ @At @ViReturn @RequiresAuthentication - public Object getLotsById(String lotId) { + public Object getLotsById(String lotId){ List lineNames = new ArrayList<>(); List baseNames = new ArrayList<>(); Map> map = new HashMap<>(); List lineList = dao.query(TheRapyRecuperationLine.class, Cnd.where("lotId", "=", lotId)); - if (!CollectionUtils.isEmpty(lineList)) { - lineList.forEach(v -> lineNames.add(v.getLineName())); - map.put("line", lineNames); + if (!CollectionUtils.isEmpty(lineList)){ + lineList.forEach(v-> lineNames.add(v.getLineName())); + map.put("line",lineNames); } List managementList = dao.query(TheRapyRecuperationBaseManagement.class, Cnd.where("lotId", "=", lotId)); - if (!CollectionUtils.isEmpty(managementList)) { - managementList.forEach(v -> baseNames.add(v.getBaseName())); - map.put("base", baseNames); + if (!CollectionUtils.isEmpty(managementList)){ + managementList.forEach(v-> baseNames.add(v.getBaseName())); + map.put("base",baseNames); } return map; } @@ -108,16 +106,15 @@ public class TheRapyRecuperationConfigController { /** * 强制删除标段时长,会删除已绑定的线路和目的地 - * * @param lotId * @return */ @At @ViReturn @RequiresAuthentication - public Object deleteLotById(String lotId) { - Trans.exec(() -> { - dao.clear(TheRapyRecuperationLot.class, Cnd.where("id", "=", lotId)); + public Object deleteLotById(String lotId){ + Trans.exec(()->{ + dao.clear(TheRapyRecuperationLot.class, Cnd.where("id","=",lotId)); List lineList = dao.query(TheRapyRecuperationLine.class, Cnd.where("lotId", "=", lotId)); if (!CollectionUtils.isEmpty(lineList)) { lineList.forEach(v -> v.setLotId(null)); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/mode/TheRapyTravelLineExcelMode.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/mode/TheRapyTravelLineExcelMode.java index a924598..5f80baf 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/mode/TheRapyTravelLineExcelMode.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/mode/TheRapyTravelLineExcelMode.java @@ -10,7 +10,7 @@ public class TheRapyTravelLineExcelMode { private Integer year; @Excel(name = "排序编号") - private String serialNumber; + private Integer serialNumber; @Excel(name = "线路名称") private String lineName; @@ -21,7 +21,7 @@ public class TheRapyTravelLineExcelMode { @Excel(name = "活动范围") private String regionalNature; - @Excel(name = "最少成团人数") + @Excel(name = "最少参与教工") private Integer minimumGroupSize; // @Excel(name = "创建模式(分工会/校工会)") diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java index 7a8cc35..4263695 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.model; import cn.afterturn.easypoi.excel.annotation.Excel; + import io.v.nutz.sys.models.Sys_file; import lombok.Data; import lombok.experimental.Accessors; @@ -11,7 +12,7 @@ import java.util.Date; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationBaseManagement + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement * @Description: TODO * @Author zzr * @Date 2023/6/5 @@ -128,6 +129,14 @@ public class TheRapyRecuperationBaseManagement { @Excel(name = "组织形式(分工会/校工会)") private int createMode; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("基地联系人") + @Excel(name = "目的地联系人") + private String baseContactPerson; + + @Column @ColDefine(type = ColType.VARCHAR, width = 50) @Comment("基地联系人电话") diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationCluster.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationCluster.java index 1dafe0f..cfe0034 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationCluster.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationCluster.java @@ -8,7 +8,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationCluster + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster * @Description: TODO * @Author zxc * @Date 2022/6/17:09:30 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationClusterMember.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationClusterMember.java index f84bc18..35d8a77 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationClusterMember.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationClusterMember.java @@ -6,7 +6,7 @@ import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationClusterMember + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationClusterMember * @Description: TODO * @Author zxc * @Date 2022/6/17:09:30 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java index f2d61e6..9db3cc1 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java @@ -67,13 +67,21 @@ public class TheRapyRecuperationConfig { @Column @ColDefine(type = ColType.BOOLEAN) @Comment("省内线路是否审核") + @Default(value = "0") private Boolean isSnLine; @Column @ColDefine(type = ColType.BOOLEAN) @Comment("省外线路是否审核") + @Default(value = "0") private Boolean isSwLine; + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("旅行社是否审核") + @Default(value = "0") + private Boolean travelAudit; + @Column @ColDefine(type = ColType.MYSQL_JSON) @Comment("标段") @@ -93,11 +101,20 @@ public class TheRapyRecuperationConfig { @Comment("疗休养服务须知") private String notice; - @Column @ColDefine(type = ColType.INT) @Comment("省内起始年份") private Integer provinceStartYear; + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("床位信息") + @Default(value = "0") + private Boolean bedInfo; + @Column + @ColDefine(type = ColType.INT) + @Comment("家属信息") + @Default(value = "0") + private Integer familyInfo; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java index 1f1801c..75057f7 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java @@ -12,7 +12,7 @@ import java.util.Date; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnroll + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll * @Description: 疗休养报名登记表 * @Author zxc * @Date 2022/5/31:16:58 @@ -143,6 +143,20 @@ public class TheRapyRecuperationEnroll extends BaseModel { @Many(field = "trreId") private List companionList; + /** + * 酒店信息 + */ + @One(field = "takePartInBaseManagementId") + private TheRapyRecuperationBaseManagement managementInfo; + + /** + * 线路信息 + */ +// @One(field = "takePartInLineId") + private TheRapyRecuperationLine lineInfo; + + private String lineId; + /** * 床位信息 */ @@ -179,4 +193,15 @@ public class TheRapyRecuperationEnroll extends BaseModel { @Comment("校工会审核Id") private String schoolUnionAuditId; + @Column + @ColDefine(type = ColType.INT) + @Comment("家属数量") + private Integer familyNumber; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否报销") + private Boolean isReimbursement; + + private String firstLetter; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollBed.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollBed.java index 9f521be..03a12cc 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollBed.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollBed.java @@ -8,7 +8,7 @@ import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollBed + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollBed * @Description: 报名拼床信息 * @Author zxc * @Date 2022/6/2:14:44 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollChangeRecord.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollChangeRecord.java index fd7cffe..270c28a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollChangeRecord.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollChangeRecord.java @@ -8,7 +8,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert; import java.util.Date; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollChangeRecord + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollChangeRecord * @Description: 疗休养登记变更记录表 * @Author zxc * @Date 2022/5/31:17:10 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java index 9db4c6a..9d6386a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java @@ -8,7 +8,7 @@ import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollFamily + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollFamily * @Description: TODO * @Author zxc * @Date 2022/5/31:17:07 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java index 6df8035..90c69fb 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.model; import cn.wizzer.framework.base.model.BaseModel; -import io.v.nutz.sys.models.Sys_file; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -9,10 +8,9 @@ import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; import java.util.Date; -import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationLine + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine * @Description: 疗休养线路管理 * @Author zxc * @Date 2022/5/31:09:13 @@ -30,9 +28,9 @@ public class TheRapyRecuperationLine extends BaseModel { private String id; @Column - @ColDefine(type = ColType.VARCHAR, width = 50) + @ColDefine(type = ColType.INT) @Comment("编号") - private String serialNumber; + private Integer serialNumber; @Column @ColDefine(type = ColType.VARCHAR, width = 50) @@ -61,7 +59,7 @@ public class TheRapyRecuperationLine extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("最少成团人数") + @Comment("最少参与教工") private Integer minimumGroupSize; @Column @@ -116,13 +114,13 @@ public class TheRapyRecuperationLine extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("预计人数(含家属)") + @Comment("成团人数包括家属") private Integer estimatedFamilyNumbers; @Column - @ColDefine(type = ColType.MYSQL_JSON) + @ColDefine(type = ColType.VARCHAR, width = 30) @Comment("缩略图") - private List files; + private String files; @Column @ColDefine(type = ColType.INT) diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java index d7a4b4c..d1cd5b7 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java @@ -92,11 +92,11 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel { @Column @ColDefine(type = ColType.BOOLEAN) @Comment("是否公开") - private boolean isOpen; + private Boolean isOpen; @Column @ColDefine(type = ColType.INT) - @Comment("最少成团人数") + @Comment("最少参与教工") private Integer minimumGroupSize; @@ -112,7 +112,7 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("预计人数(含家属)") + @Comment("成团人数包括家属") private Integer estimatedFamilyNumbers; @Column @@ -125,5 +125,8 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel { @Comment("是否启用") private Boolean enable; - + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("旅行社id") + private String travelAgencyId; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLot.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLot.java index 0a1d7d9..72f84c4 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLot.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLot.java @@ -6,7 +6,7 @@ import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationLot + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot * @Description: TODO * @Author zzr * @Date 2023/6/6 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java index 03e20d4..e5460ce 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java @@ -1,17 +1,14 @@ package io.v.nutz.zhgh.therapyRecuperation.model; import cn.wizzer.framework.base.model.BaseModel; -import io.v.nutz.sys.models.Sys_file; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; -import java.util.List; - /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationTravelAgency + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency * @Description: 疗休养旅行社管理 * @Author zxc * @Date 2022/5/31:14:39 @@ -75,7 +72,12 @@ public class TheRapyRecuperationTravelAgency extends BaseModel { private boolean isDisabled; @Column - @ColDefine(type = ColType.MYSQL_JSON) + @ColDefine(type = ColType.VARCHAR, width = 100) @Comment("缩略图") - private List files; + private String files; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否自由组团") + private Boolean signUpTravelAgency; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java index 5eaec8a..ef24dd9 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; + import io.v.nutz.base.model.Audit; import io.v.nutz.base.service.ViService; import org.nutz.lang.util.NutMap; @@ -18,7 +19,7 @@ public interface TheRapyRecuperationAuditService extends ViService { * @param year 可为空 * @return */ - List getXlByUnion(Integer state, String unionId, String regionalNature, String year, Integer signUpMode); + List getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode); /** @@ -29,5 +30,12 @@ public interface TheRapyRecuperationAuditService extends ViService { NutMap findOne(String id); - + /** + * 校工会审核 + * @param stateId + * @param loginName + * @param adjustment + * @param takePartInLineId + */ + void schoolAudit(Integer stateId, String loginName,Boolean adjustment, String takePartInLineId); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java index a997664..98d0172 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; + import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java index 2e27718..4e41312 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; + import io.v.nutz.base.service.ViService; import org.nutz.lang.util.NutMap; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java index 0f4b1bf..3cfd8b0 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java @@ -1,8 +1,10 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; + import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; + import io.v.nutz.sys.models.Sys_union; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import org.nutz.dao.Cnd; @@ -29,6 +31,10 @@ public interface TheRapyRecuperationEnrollService extends ViService getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType); + + Object openSignUser(String usId, String travelId, String searchKeyWord); + /** * 线路报名 * @@ -78,6 +84,7 @@ public interface TheRapyRecuperationEnrollService extends ViService validSignUpInfoForZJXU(String loginName, TheRapyRecuperationEnroll enrollInfo); + Map validSignUpInfoForZJNU(String loginName, TheRapyRecuperationEnroll enrollInfo); /** * 我报名的页面数据 @@ -113,7 +120,7 @@ public interface TheRapyRecuperationEnrollService extends ViService getTheRapyUnions(Integer year); + List getTheRapyUnions(Integer year, int theRapyRecuperationType); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java index b612d40..d5cbad6 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java @@ -1,15 +1,17 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; + import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; + import java.util.List; public interface TheRapyRecuperationLineAdjustmentService extends ViService { - Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords); + Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, String regionalNature, String lotId); List findUnionSignUpModeUserList(String lineId, String unionId); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java index 616d652..bde0d5b 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; + import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java index 254b5c9..e2f45bc 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; + import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; @@ -10,7 +11,7 @@ import org.nutz.lang.util.NutMap; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.service.TheRapyRecuperationLineService + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService * @Description: 疗休养线路管理service * @Author zxc * @Date 2022/5/31:09:45 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java index ec5be49..a2f937a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; + import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; @@ -24,7 +25,7 @@ public interface TheRapyRecuperationLineUnionSelectService extends ViService implements TheRapyRecuperationAuditService { @@ -23,12 +30,16 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im super(dao); } + @Inject + private MsgApi msgApi; + @Override - public List getXlByUnion(Integer state, String unionId, String regionalNature, String year, Integer signUpMode) { + public List getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode) { Sql sql = Sqls.create(""" - SELECT + SELECT line.*, + lineu.id as selectId, un.unionname, DATE_FORMAT(lineu.playStartTime,'%Y-%m-%d') as playStartTime1 FROM @@ -51,11 +62,18 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im } cnd.andEX("lineu.signUpMode", "=", signUpMode); cnd.andEX("line.regionalNature", "=", regionalNature); - cnd.andEX("YEAR(enroll.signingUptime)", "=", year); + if (StrUtil.isNotBlank(endYear)){ + cnd.andEX("YEAR(enroll.signingUptime)", ">=", year); + cnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); + } else { + cnd.andEX("YEAR(enroll.signingUptime)", "=", year); + } cnd.and("enroll.takePartInLineId", "is not", null); + cnd.and("enroll.takePartInLineId", "!=", ""); cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); - cnd.groupBy("enroll.takePartInLineId"); - cnd.asc("un.unionname"); + cnd.groupBy("line.id"); + cnd.having(Cnd.where("playStartTime1", "is not", null)); + cnd.asc("un.unionname").asc("lineu.lineId").asc("lineu.playStartTime"); sql.setCondition(cnd); return listMap(sql); } @@ -65,6 +83,7 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im Sql sql = Sqls.create(""" SELECT lxs.travelAgencyName, + ta.travelAgencyName as joinTravelAgencyName, enroll.*, line.lineName, if(enroll.takePartInUnionId!=enroll.selfUnionId,true,false) isTransferIn, @@ -73,7 +92,8 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId - LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = lineu.travelAgencyId + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = enroll.takePartInTravelAgencyId where enroll.id=@id """).setParam("id", id); @@ -104,4 +124,22 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im return map; } + + + @Override + public void schoolAudit(Integer stateId, String loginName, Boolean adjustment, String takePartInLineId) { + Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); + TheRapyRecuperationLineUnionSelect unionSelect = dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", takePartInLineId)); + TheRapyRecuperationLine theRapyRecuperationLine = dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", unionSelect.getLineId())); + + String content = "【智慧工会】%s老师您好,您报名的%s线路因报名人数不足已取消,请尽快进入智慧工会重新选择线路。" + .formatted(user.getUsername(),theRapyRecuperationLine.getLineName()); + + List list = List.of(Map.of("type", "User", "userId", user.getLoginname(), "name", user.getUsername())); + if (stateId.equals(TheRapyRecuperationState.PASS)) { + content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。" + .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); + } + //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java index 57ac6f0..a0a4c83 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java @@ -1,7 +1,8 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; -import io.v.nutz.base.utils.DateUtil; +import io.v.nutz.base.model.Audit; import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.DateUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; @@ -12,7 +13,7 @@ import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.ioc.loader.annotation.IocBean; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationCommonServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationCommonServiceImpl * @Description: TODO * @Author zxc * @Date 2022/6/6:10:46 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java index 93c6796..5bb4110 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java @@ -1,7 +1,8 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.Vi; + import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollJoinUserImportService; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; @@ -13,7 +14,7 @@ import java.util.List; import java.util.Map; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationEnrollJoinUserImportServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationEnrollJoinUserImportServiceImpl * @Description: TODO * @Author zxc * @Date 2022/6/14:09:57 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java index 08734d0..c8d04dd 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java @@ -1,19 +1,29 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.pinyin.PinyinUtil; import cn.wizzer.framework.page.Pagination; -import io.v.nutz.zhgh.activity.models.ActivityUserScope; -import io.v.nutz.base.service.BaseService; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.EmailUtil; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.utils.Vi; + import io.v.nutz.sys.models.Sys_union; import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.sys.models.User; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.activity.models.ActivityUserScope; import io.v.nutz.zhgh.therapyRecuperation.constant.*; import io.v.nutz.zhgh.therapyRecuperation.model.*; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService; -import io.v.nutz.web.commons.utils.ShiroUtil; +import org.apache.poi.ss.usermodel.Workbook; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; @@ -26,6 +36,8 @@ import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; +import java.io.File; +import java.io.FileOutputStream; import java.time.LocalDate; import java.time.Period; import java.util.*; @@ -44,6 +56,12 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, + us.estimatedFamilyNumbers, + line.files AS fileId, usgh.unionname AS usUnionName, usgh.id AS takePartInUnionId, u.username AS createUserName, @@ -88,25 +106,34 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' as char) as fileId + files as fileId, + (select count(1) from the_rapy_recuperation_enroll where takePartInTravelAgencyId=ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as signUpUserNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInTravelAgencyId = ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInTravelAgencyId=ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber from - the_rapy_recuperation_travel_agency $condition - """); + the_rapy_recuperation_travel_agency ta $condition + """).setParam("year", DateUtil.thisYear()); taSql.setCondition(cnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); } else if (TheRapyRecuperationType.provinceInHotel.getValue() == trrt) { - cnd.andEX("b.year", "=", year); + cnd.andEX("b.year", "=", year != null ? year : DateUtil.thisYear()); cnd.and("b.isDisabled", "=", false); Sql taSql = Sqls.create(""" select b.*, - cast(b.files ->> '$[0].id' as char) as fileId, + b.files as fileId, l.lotName, t.travelAgencyName from @@ -147,6 +178,101 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType) { + Sql lineSql = Sqls.create(""" + SELECT + us.id as usId, + line.id as lineId, + line.serialNumber, + line.lineName, + line.regionalNature, + us.minimumGroupSize, + line.`year`, + us.enable, + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.playStartTime, + us.playEndTime, + us.signUpMode, + us.estimatedFamilyNumbers, + line.files AS fileId, + usgh.unionname AS usUnionName, + usgh.id AS takePartInUnionId, + u.username AS createUserName, + ta.travelAgencyName, + us.contact, + us.contactPhone, + lot.lotName, + lot.lotValue, + lot.activityCost as lotActivityCost, + (select count(1) from the_rapy_recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as signUpUserNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber + FROM + `the_rapy_recuperation_line_union_select` us + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId + LEFT JOIN the_rapy_recuperation_lot lot on lot.id = line.lotId + LEFT JOIN sys_union usgh ON usgh.id = us.unionId + LEFT JOIN sys_user u ON u.id = line.opBy + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = line.travelAgencyId + $lineCnd + ORDER BY us.lineId, playStartTime ASC + """).setParam("lineId", lineId).setParam("year", DateUtil.thisYear()); + Cnd lineCnd = Cnd.NEW(); + lineCnd.and("lineId", "=", lineId); + lineCnd.and("us.enable", "=", true); + lineCnd.and("year(us.selectTime)", "=", DateUtil.thisYear()); + lineCnd.and("line.regionalNature", "=", TheRapyRecuperationType.typeMap.get(trrt)); + //本公会 + if (lineUnionType == 1) { + lineCnd.and("us.signUpMode", "=", TheRapyRecuperationSignUpMode.UNION.getValue()); +// lineCnd.and("us.isOpen", "=", true); + lineCnd.and("us.unionId", "=", unionId); + } else if (lineUnionType == 2) { + lineCnd.and("us.signUpMode", "=", TheRapyRecuperationSignUpMode.UNION.getValue()); + lineCnd.and("us.isOpen", "=", true); + lineCnd.and("us.unionId", "=", unionId); + } else if (lineUnionType == 3) { + //校工会 + lineCnd.and("us.signUpMode", "=", TheRapyRecuperationSignUpMode.FREE.getValue()); + } + lineSql.setVar("lineCnd", lineCnd); + return (List) Daos.query(dao(), lineSql.toString(), Sqls.callback.maps()); + } + + @Override + public Object openSignUser(String usId, String travelId, String searchKeyWord) { + List enrolls = new ArrayList<>(); + if(StrUtil.isNotBlank(usId)) { + enrolls = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", usId) + .and("isNormal", "=", true) + .and("stateId", "=", 2750) + .and(Cnd.likeEX("userName", searchKeyWord)) + .asc("unionName")); + } + if(StrUtil.isNotBlank(travelId)) { + enrolls = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInTravelAgencyId", "=", travelId) + .and("isNormal", "=", true) + .and("stateId", "=", 2750) + .and(Cnd.likeEX("userName", searchKeyWord)) + .asc("unionName")); + } + enrolls.forEach(item -> { + String firstLetter = PinyinUtil.getFirstLetter(StrUtil.sub(item.getUserName(), 0, 1), ""); + item.setFirstLetter(firstLetter.toUpperCase()); + }); + + Map> listMap = enrolls.stream().collect(Collectors.groupingBy(TheRapyRecuperationEnroll::getFirstLetter)); + + // 对分组结果的键进行排序 + return listMap.entrySet().stream() + .sorted(Comparator.comparing(Map.Entry::getKey)) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, + (oldValue, newValue) -> oldValue, LinkedHashMap::new)); + } + /** * 线路报名 * @@ -180,24 +306,34 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0) { + if (DateUtil.compare(new Date(), changeEndTime) > 0) { return Map.of(false, "报名时间已过,抱歉不能报名"); } TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); @@ -457,9 +606,10 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0 && enrollInfo.isNormal()) { + if (DateUtil.compare(new Date(), changeEndTime) > 0 && enrollInfo.isNormal()) { return Map.of(false, "报名时间已过,抱歉不能报名"); } + TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { + //获取标段中的最大费用 List lotList = dao().query(TheRapyRecuperationLot.class, Cnd.NEW()); //最大费用 @@ -500,7 +653,13 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); + if(map != null) { + return map; + } + }*/ //获取起始年份到当前时间,是否报名 Sql sql = Sqls.create(""" @@ -557,16 +716,16 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl threeYearOutMapList = listMap(threeYearOutSql); //今年是否报名,不管报省内还是省外 - if(nowYearMapList.size() > 0) { + if (nowYearMapList.size() > 0) { NutMap nowYearMap = nowYearMapList.get(0); //判断当前报名的线路是否和今年第一次报名的线路重复 - if(nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) { + if (nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) { return Map.of(false, "您已报名过当前线路,请选择其他线路"); } //获取第一次报名线路对应的标段的费用 int lastLineCost = nowYearMap.getInt("activityCost"); if ((lastLineCost + currentLineCost) > maxCost) { - return Map.of(false, "您已报名过省内线路,预算超过" + maxCost + "元"); + return Map.of(false, "您已报名过省内或省外线路"); } } //省内线路判断 @@ -581,7 +740,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0) { int hasCost = twoYearInMapList.get(0).getInt("activityCost"); if ((hasCost + currentLineCost) > maxCost) { - return Map.of(false, "您已参加过省内线路,预算超过" + maxCost + "元"); + return Map.of(false, "您已参加过省内线路"); } } } @@ -605,7 +764,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl enrollList = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "in", selectIds) .and("isNormal", "=", true).and("signingUptime", "=", DateUtil.thisYear()) - .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL,TheRapyRecuperationState.LINEUNITFAIL,TheRapyRecuperationState.SCHOOLFAIL))); + .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); //活动范围总人数 List userScopes = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId)); int result = (int) Math.floor((double) userScopes.size() / 3); @@ -617,6 +776,14 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "edit"); + if(map != null) { + return map; + } + }*/ + int changeCount = dao().count(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", enrollInfo.getId())); if (changeCount >= modifyNumber) { @@ -633,29 +800,245 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl validSignUpInfoForZJNU(String loginName, TheRapyRecuperationEnroll enrollInfo) { + + //配置信息 + TheRapyRecuperationConfig config = dao().fetch(TheRapyRecuperationConfig.class); + + Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); + //判断是否在报名范围内 + int count = dao().count("activity_user_scope", Cnd.NEW().and("groupId", "=", config.getActivityGroupId()) + .and("userId", "=", user.getId() )); + if (count == 0) { + return Map.of(false, "抱歉,您不在报名范围内!"); + } + + //每年旅行频率 + Integer travelFrequency = config.getTravelFrequency(); + //省外几年去一次 + Integer outsideNumber = config.getOutsideNumber(); + //可以修改几次 + Integer modifyNumber = config.getModifyNumber(); + //活动范围 + Integer activityGroupId = config.getActivityGroupId(); + + //如果报旅行社 + if (StrUtil.isNotBlank(enrollInfo.getTakePartInTravelAgencyId())) { + if(StrUtil.isNotBlank(enrollInfo.getId())) { + return Map.of(true, "成功"); + } + Map oneYear = this.validCountOneYear(loginName, travelFrequency); + if (oneYear != null) { + return oneYear; + } + } + + //如果报酒店 + if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId()) && StrUtil.isBlank(enrollInfo.getId())) { + Map oneYear = this.validCountOneYear(loginName, travelFrequency); + if (oneYear != null) { + return oneYear; + } + } + + //线路信息 + TheRapyRecuperationLineUnionSelect lineUnionSelect = dao().fetch(TheRapyRecuperationLineUnionSelect.class, enrollInfo.getTakePartInLineId()); + TheRapyRecuperationLine lineInfo = dao().fetch(TheRapyRecuperationLine.class, lineUnionSelect.getLineId()); + + Date signUpStartTime = lineUnionSelect.getSignUpStartTime(); + Date signUpEndTime = lineUnionSelect.getSignUpEndTime(); + Date changeEndTime = lineUnionSelect.getChangeEndTime(); + //线路人数,省外线路最多报名数 + //Integer estimatedFamilyNumbers = config.getOutsideQuota(); + if (DateUtil.compare(new Date(), signUpStartTime) < 0) { + return Map.of(false, "报名未开始,请耐心等待"); + } + if (DateUtil.compare(new Date(), signUpEndTime) > 0) { + return Map.of(false, "报名时间已过,抱歉不能报名"); + } + + TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); + + if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { + + Map oneYear = this.validCountOneYear(loginName, travelFrequency); + if (oneYear != null) { + return oneYear; + } + + //省外线路判断报名人数 + /*if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { + Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); + if(map != null) { + return map; + } + }*/ + + //获取起始年份到当前时间,是否报名 + Sql sql = Sqls.create(""" + SELECT + r.*, + l.regionalNature, + (select activityCost from the_rapy_recuperation_lot where id = l.lotId) as activityCost + FROM + the_rapy_recuperation_enroll r + LEFT JOIN the_rapy_recuperation_line_union_select us on us.id = r.takePartInLineId + LEFT JOIN the_rapy_recuperation_line l ON l.id = us.lineId + $condition + """); + Sql threeYearOutSql = sql; + Sql nowYearSql = sql; + + Cnd commonCnd = Cnd.NEW(); + commonCnd.and("r.takePartInLineId", "is not", null); + commonCnd.and("r.takePartInLineId", "!=", ""); + commonCnd.and("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")); + commonCnd.and("r.isNormal", "=", true); + commonCnd.and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL)); + commonCnd.and("signingUptime", "<=", DateUtil.now()); + + //今年是否报名,不管省内省外 + Cnd nowYearCnd = commonCnd.clone(); + nowYearCnd.and("signingUptime", ">=", DateUtil.thisYear() + "-01-01"); + nowYearSql.setCondition(nowYearCnd); + List nowYearMapList = listMap(nowYearSql); + + //三年参加省外 + Cnd threeYearOutCnd = commonCnd.clone(); + threeYearOutCnd.and("signingUptime", ">=", (DateUtil.thisYear() - outsideNumber) + "-01-01"); + threeYearOutCnd.and("regionalNature", "=", "省外"); + threeYearOutCnd.and("isTakePartIn", "=", true); + threeYearOutSql.setCondition(threeYearOutCnd); + List threeYearOutMapList = listMap(threeYearOutSql); + + //今年是否报名,不管报省内还是省外,还是旅行社 + if (nowYearMapList.size() >= travelFrequency) { + return Map.of(false, "您已经选择%s条线路,并审核通过,不能再次选择。".formatted(travelFrequency)); + } + //省外线路判断 + if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) { + //三年内有没有参加过省外 + if (threeYearOutMapList.size() > 0) { + return Map.of(false, "近%s年内您已参加过省外线路,不能再次报名".formatted(outsideNumber)); + } + + //zzr2024-04-25修改,删除下面的,取消注释上面的 + List lineList = dao().query(TheRapyRecuperationLine.class, Cnd.NEW().and("isDisabled", "=", false)); + List lineIds = lineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()); + //获取这些线路在选择表中的选择id,因为报名表存的是选择id + List selectList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", lineIds)); + + List userScopes = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId)); + List userIdList = userScopes.stream().map(ActivityUserScope::getUserId).collect(Collectors.toList()); + List userList = dao().query(User.class, Cnd.where("unionid", "=", Vi.getUnionId())); + //分工会所有人数 + List unionUserList = userList.stream().filter(v -> userIdList.contains(v.getId())).collect(Collectors.toList()); + + List outLineIdLIst = selectList.stream().filter(v -> v.getSignUpMode() == 2).map(v -> v.getId()).collect(Collectors.toList()); + + //分工会参加省外线路人数 + List selfUnionIdTakePartInUserList = dao().query(TheRapyRecuperationEnroll.class, + Cnd.where("selfUnionId", "=", Vi.getUnionId()).and("takePartInLineId", "in", outLineIdLIst) + .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); + + int selfUnionTakePartNum = selfUnionIdTakePartInUserList.size(); + int selfUnionNum = unionUserList.size(); + + double bili = (double) selfUnionTakePartNum / selfUnionNum; + + /*if (bili >= 0.33) { + return Map.of(false, "本分工会已报省外线路的人数超过三分之一,不能报名"); + }*/ + } + } + + //变更操作 + if (StrUtil.isNotBlank(enrollInfo.getId())) { + + //省外线路判断报名人数 + /*if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { + Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); + if(map != null) { + return map; + } + }*/ + + int changeCount = dao().count(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", enrollInfo.getId())); + + if (changeCount >= modifyNumber) { + return Map.of(false, "只能变更" + changeCount + "次!"); + } + + if (DateUtil.compare(new Date(), changeEndTime) > 0) { + return Map.of(false, "超过变更截至时间,无法变更!"); + } else { + return Map.of(true, "验证成功"); + } + } + + return Map.of(true, "验证成功"); + } + + public Map validSignCount(TheRapyRecuperationEnroll enrollInfo, TheRapyRecuperationConfig config, int estimatedFamilyNumbers, String type) { + int hasSignNumber = 0;//已经报名的人数 + int currentSignNumber = 1;//当前报名人数,1表示自己,下面的if是加家属人数 + Cnd cnd = Cnd.where("takePartInLineId", "=", enrollInfo.getTakePartInLineId()) + .and("stateId", "in", Lang.array(TheRapyRecuperationState.UNIT, TheRapyRecuperationState.LINEUNIT, TheRapyRecuperationState.SCHOOL, TheRapyRecuperationState.PASS)) + .and("isNormal", "=", true); + //如果是修改,排除自己的报名记录 + if("edit".equals(type)) { + cnd.and("loginName", "!=", ShiroUtil.getPlatformLoginname()); + } + List enrolls = dao().query(TheRapyRecuperationEnroll.class, cnd); + + //1表示在配置页面的家属配置的是数量,2是家属的List + /*if (config.getFamilyInfo() == 1) { + currentSignNumber += enrollInfo.getFamilyNumber() != null ? enrollInfo.getFamilyNumber() : 0; + int sum = enrolls.stream().mapToInt(TheRapyRecuperationEnroll::getFamilyNumber).sum(); + hasSignNumber = enrolls.size() + sum; + } else { + currentSignNumber += enrollInfo.getCompanionList() != null ? enrollInfo.getCompanionList().size() : 0; + List list = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); + List companions = dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", list)); + hasSignNumber = enrolls.size() + companions.size(); + }*/ + //省外报名限制,不包含家属 +// hasSignNumber += currentSignNumber + enrolls.size(); + if ((currentSignNumber + enrolls.size()) > estimatedFamilyNumbers) { + return Map.of(false, "报名人数已满"); + } else { + return null; + } + } + //判断一年报几次 public Map validCountOneYear(String loginName, int travelFrequency) { Cnd cnd = Cnd.NEW(); cnd.and("loginName", "=", loginName); + cnd.and("isNormal", "=", true); cnd.and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear()); int joinCount = dao().count(TheRapyRecuperationEnroll.class, cnd); if (joinCount >= travelFrequency) { List inList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省内")); + List unionInSelects = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", inList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()))); List outList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省外")); + List unionOutSelects = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", outList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()))); //是否选择省外 int inCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) - .and("takePartInLineId", "in", inList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList())) + .and("takePartInLineId", "in", unionInSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList())) .and("isNormal", "=", true) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报省外 int outCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) - .and("takePartInLineId", "in", outList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList())) + .and("takePartInLineId", "in", unionOutSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList())) .and("isNormal", "=", true) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报旅行社 int travelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) - .and("takePartInLineId", "is", null).and("isNormal", "=", true) + .and(Cnd.exps("takePartInLineId", "is", null).or("takePartInLineId", "=", "")) + .and("isNormal", "=", true) .and("takePartInTravelAgencyId", "is not", null) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报酒店 @@ -742,7 +1125,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, + line.files AS fileId, gh.unionname AS signUpUnionName, ta.travelAgencyName, ta.contact, @@ -780,15 +1163,18 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId + ta.files AS fileId, + (select count(1) from the_rapy_recuperation_enroll where takePartInTravelAgencyId=ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as signUpUserNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInTravelAgencyId = ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInTravelAgencyId=ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as totalFamilyNumber FROM the_rapy_recuperation_enroll e LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = e.takePartInTravelAgencyId $condition - """); + """).setParam("year", year == null ? DateUtil.thisYear() : year); cnd.and("e.takePartInTravelAgencyId", "is not", null); cnd.and("e.isNormal", "=", true); - cnd.andEX("ta.year", "=", year); + cnd.and("YEAR(e.signingUptime)", "=", year == null ? DateUtil.thisYear() : year); taSql.setCondition(cnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); } @@ -800,7 +1186,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, + ta.files AS fileId, l.lotName, ta.regionalNature, t.travelAgencyName, @@ -828,7 +1214,11 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl { + fetchLinks(item, "bedInfo"); + }); + return recuperationEnroll; } /** @@ -841,48 +1231,60 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl getTheRapyUnions(Integer year) { + public List getTheRapyUnions(Integer year, int theRapyRecuperationType) { //查询某个年份公开线路了的工会 - List openList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("isOpen", "=", true) - .and("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear())); - if (Lang.isNotEmpty(openList)) { - List unionIds = openList.stream().map(TheRapyRecuperationLineUnionSelect::getUnionId).distinct().collect(Collectors.toList()); + Sql sql = Sqls.create(""" + SELECT + rr.unionId + FROM + the_rapy_recuperation_line_union_select rr left join the_rapy_recuperation_line l on rr.lineId = l.id + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("rr.isOpen", "=", true); + cnd.and("year(rr.selectTime)", "=", DateUtil.thisYear()); + cnd.and("rr.unionId", "!=", Vi.getUnionId()); + cnd.and("rr.signUpMode", "=", 1); + cnd.and("l.regionalNature", "=", TheRapyRecuperationType.typeMap.get(theRapyRecuperationType)); + sql.setCondition(cnd); + List listMap = baseService.listMap(sql); + /*List openList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("isOpen", "=", true) + .and("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear()).and("unionId", "!=", Vi.getUnionId()));*/ + +// List openList = dao().query(TheRapyRecuperationLineUnionSelect.class, +// Cnd.where("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear())); + + if (Lang.isNotEmpty(listMap)) { + List unionIds = listMap.stream().map(o -> o.getString("unionId")).distinct().collect(Collectors.toList()); return dao().query(Sys_union.class, Cnd.where("id", "in", unionIds)); } return new ArrayList<>(); } + + + /** + * 自由组团取消报名,发送给旅行社 + * @param enroll + */ + private void cancelTravelSendEmail(TheRapyRecuperationEnroll enroll){ + TheRapyRecuperationTravelAgency travelAgency = dao().fetch(TheRapyRecuperationTravelAgency.class, Cnd.where("id", "=", enroll.getTakePartInTravelAgencyId())); + NutMap enrollMap = Lang.obj2nutmap(enroll); + enrollMap.setv("travelAgencyName",travelAgency.getTravelAgencyName()); + enrollMap.setv("remark","该教师自由出行取消报名本旅行社,请从出行名单中移除此教师"); + List nutMaps = new ArrayList<>(); + nutMaps.add(enrollMap); + if (StrUtil.isNotBlank(travelAgency.getEmail())){ + List entityList = new ArrayList<>(); + entityList.add(new ExcelExportEntity("姓名", "userName", 20)); + entityList.add(new ExcelExportEntity("身份证号", "idCard", 20)); + entityList.add(new ExcelExportEntity("联系电话", "mobile", 20)); + entityList.add(new ExcelExportEntity("所属工会", "unionName", 20)); + entityList.add(new ExcelExportEntity("旅行社名称", "travelAgencyName", 20)); + entityList.add(new ExcelExportEntity("备注", "remark", 50)); + + File xls = new File("C:/temp/"+travelAgency.getTravelAgencyName()+"疗休养自由组团出行人员名单.xlsx"); + FileOutputStream fileOutputStream = null; + try { + fileOutputStream = new FileOutputStream(xls); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, nutMaps); + workbook.write(fileOutputStream); + fileOutputStream.close(); + emailUtil.send(travelAgency.getEmail(), travelAgency.getTravelAgencyName() + "疗休养自由组团出行人员名单", false, xls); + if (xls.exists()) { + xls.delete(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java index 709e2e5..5b361c7 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java @@ -2,12 +2,13 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.page.Pagination; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.Vi; + +import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineAdjustmentService; -import io.v.nutz.web.commons.utils.ShiroUtil; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; @@ -20,7 +21,7 @@ import org.nutz.lang.util.NutMap; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineAdjustmentServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineAdjustmentServiceImpl * @Description: TODO * @Author zxc * @Date 2022/6/10:10:04 @@ -34,14 +35,14 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl } @Override - public Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords) { + public Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, String regionalNature, String lotId) { Sql sql = Sqls.create(""" SELECT line.id, line.serialNumber, line.lineName, line.regionalNature, - line.minimumGroupSize, + us.minimumGroupSize, line.`year`, line.isDisabled, line.playNumberOfDays, @@ -51,16 +52,17 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl line.changeEndTime, line.signUpMode, line.createMode, + us.id as usId, us.playStartTime, us.playEndTime, - line.files, - cast( line.files ->> '$[0].id' AS CHAR ) AS fileId, + line.files AS fileId, create_gh.unionname AS createUnionName, ta.travelAgencyName, us.unionId, select_gh.unionname AS selectUnionName, - (select count(1) from the_rapy_recuperation_enroll where takePartInUnionId = us.unionId AND takePartInLineId = line.id and isNormal=true) as signUpUserNum, - (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInUnionId = us.unionId AND takePartInLineId = line.id and isNormal=true)) as signUpUserFamilyNum + (select count(1) from the_rapy_recuperation_enroll where if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) AND takePartInLineId = us.id and isNormal=true) as signUpUserNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) AND takePartInLineId = us.id and isNormal=true)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber FROM the_rapy_recuperation_line_union_select us LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId @@ -70,11 +72,14 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl $condition """); sql.setParam("signUpSuccessCode", TheRapyRecuperationState.PASS); + sql.setParam("year", year); Cnd cnd = Cnd.NEW(); + cnd.andEX("line.regionalNature","=",regionalNature); + cnd.andEX("line.lotId", "=", lotId); //cnd.and("line.signUpMode", "=", TheRapyRecuperationSignUpMode.UNION.getValue()); cnd.and("us.playStartTime", "is not", null); - cnd.andEX("line.year", "=", year); + //cnd.andEX("line.year", "=", year); cnd.andEX("line.id", "=", lineId); if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { cnd.andEX("us.unionId", "=", unionId); @@ -92,6 +97,7 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl if (Vi.isNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy()); } + cnd.and("year(selectTime)", "=", year); sql.setCondition(cnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); } @@ -108,13 +114,15 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl e.unionName, e.signingUptime, e.isNormal, - count(c.id) as companionCount + count(c.id) as companionCount, + e.familyNumber FROM the_rapy_recuperation_enroll e LEFT JOIN the_rapy_recuperation_enroll_companion c ON c.trreId = e.id + left join the_rapy_recuperation_line_union_select us on e.takePartInLineId = us.id WHERE e.takePartInLineId = @lineId - AND e.takePartInUnionId = @unionId + and if(us.signUpMode = 1, e.takePartInUnionId = @unionId, 1=1) GROUP BY e.id """); // AND (e.stateId = @passStateCode or e.stateId is null) diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java index 9d0a180..9de9247 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java @@ -1,14 +1,15 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.wizzer.framework.page.Pagination; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; + import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationClusterMember; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineClusterService; -import io.v.nutz.web.commons.utils.ShiroUtil; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; @@ -25,7 +26,7 @@ import java.util.Map; import java.util.stream.Collectors; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineClusterServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineClusterServiceImpl * @Description: 组团 * @Author zxc * @Date 2022/6/17:09:04 @@ -180,6 +181,7 @@ public class TheRapyRecuperationLineClusterServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, - gh.unionname AS createUnionName, + line.files AS fileId, + ifnull(gh.unionname, '校工会') AS createUnionName, u.username AS createUserName, ta.travelAgencyName, ta.contact, @@ -218,12 +215,13 @@ public class TheRapyRecuperationLineServiceImpl extends ViServiceImpl list = pagination.getList(); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java index 94808df..bbe6b1a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java @@ -1,14 +1,16 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.page.Pagination; -import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.Vi; + +import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineUnionSelectService; -import io.v.nutz.web.commons.utils.ShiroUtil; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; @@ -24,7 +26,7 @@ import java.util.List; import java.util.stream.Collectors; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineUnionSelectServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineUnionSelectServiceImpl * @Description: 分工会选择线路 * @Author zxc * @Date 2022/6/1:10:18 @@ -46,7 +48,7 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl * @return {@link Pagination} */ @Override - public Pagination pageData(PageForm pageForm, Cnd cnd) { + public Pagination pageData(PageForm pageForm, Cnd cnd, Integer year) { Sql sql = Sqls.create(""" select line.id, @@ -58,7 +60,7 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl line.isDisabled, line.playNumberOfDays, line.createUnionId, - GROUP_CONCAT(us.playStartTime,'至',us.playEndTime) as playTimes, + GROUP_CONCAT(us.playStartTime,'至',us.playEndTime,ifnull(concat('(', ta.travelAgencyName, ')'), '') order by us.playStartTime) as playTimes, us.signUpStartTime, us.signUpEndTime, us.playStartTime, @@ -77,19 +79,23 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl us.unionId as usUnionId, us.id as usId, usUnion.unionname as belongUnionName, - (SELECT COUNT(*) FROM the_rapy_recuperation_enroll WHERE takePartInLineId=line.id AND takePartInUnionId=@unionId) applyCount + (SELECT COUNT(*) FROM the_rapy_recuperation_enroll WHERE takePartInLineId=us.id and isNormal=true) applyCount from the_rapy_recuperation_line line - LEFT JOIN the_rapy_recuperation_travel_agency ta on ta.id = line.travelAgencyId LEFT JOIN sys_union gh ON gh.id = line.createUnionid LEFT JOIN sys_user u ON u.id = line.opBy - LEFT JOIN the_rapy_recuperation_line_union_select us on us.lineId = line.id AND us.unionId = @unionId AND us.selectUserId = @userId + LEFT JOIN the_rapy_recuperation_line_union_select us on us.lineId = line.id AND year(selectTime) = @year $us + LEFT JOIN the_rapy_recuperation_travel_agency ta on ta.id = us.travelAgencyId LEFT JOIN sys_union usUnion on usUnion.id = us.unionId LEFT JOIN the_rapy_recuperation_lot lot on lot.id = line.lotId $condition """); - sql.setParam("unionId", Vi.getUnionId()); - sql.setParam("userId", ShiroUtil.getPrincipalProperty("id")); + if(!ShiroUtil.hasAnyRoles("sysadmin, A06")) { + sql.setVar("us", "AND us.unionId = '%s' AND us.selectUserId = '%s'".formatted(Vi.getUnionId(), ShiroUtil.getPlatformUid())); + } + //sql.setParam("unionId", Vi.getUnionId()); + //sql.setParam("userId", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id")); + sql.setParam("year", year == null ? DateUtil.thisYear() : year); /*SqlExpressionGroup seg = new SqlExpressionGroup(); seg.or("line.createUnionId", "=", Vi.getUnionId()); @@ -151,36 +157,41 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl * @return {@link Object} */ @Override - public Object selectLineInfo(String lineId, String unionId, Integer mode) { + public Object selectLineInfo(String lineId, String unionId, Integer mode, Integer year) { Sql sql; sql = Sqls.create(""" select - id, + us.id, lineId, signUpStartTime, signUpEndTime, changeEndTime, playStartTime, playEndTime, - contact, - contactPhone, + us.contact, + us.contactPhone, minimumGroupSize, trafficTools, estimatedCost, estimatedFamilyNumbers, + us.travelAgencyId, signUpMode, - enable + enable, + ta.travelAgencyName from - the_rapy_recuperation_line_union_select + the_rapy_recuperation_line_union_select us + left join the_rapy_recuperation_travel_agency ta on ta.id = us.travelAgencyId where unionId = @unionId and lineId = @lineId and signUpMode = @mode - ORDER BY signUpStartTime ASC + and year(selectTime) = @year + ORDER BY signUpStartTime,playStartTime ASC """); sql.setParam("unionId", unionId); sql.setParam("lineId", lineId); sql.setParam("mode", mode); + sql.setParam("year", year == null ? DateUtil.thisYear() : year); return listMap(sql); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java index 8c7edfc..3421057 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java @@ -3,6 +3,9 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.base.utils.Vi; + + import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; import org.nutz.dao.Chain; @@ -15,7 +18,7 @@ import org.nutz.ioc.loader.annotation.IocBean; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationTravelAgencyServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationTravelAgencyServiceImpl * @Description: 疗休养旅行社 * @Author zxc * @Date 2022/5/31:14:46 @@ -81,7 +84,7 @@ public class TheRapyRecuperationTravelAgencyServiceImpl extends ViServiceImpl> '$[0].id' as char) as fileId + files as fileId from the_rapy_recuperation_travel_agency $condition """); @@ -116,7 +119,8 @@ public class TheRapyRecuperationTravelAgencyServiceImpl extends ViServiceImpl +
+ + + + 下载模板 + + + + + + + + + + 清空更新 + 追加 + + + + + 选择文件 + +
+ 只能上传 xls/xlsx 文件 +
+
+
+
+
+ + +

总记录数:{{ errorInfoData.totalCount }}

+

成功数:{{ errorInfoData.successCount }}

+

错误数:{{ errorInfoData.errorCount }}

+ 下载错误记录 + +
+
+
+
+ + + 确 定 + +
+ +
+ + + + + diff --git a/src/main/resources/static/components/retiredUser/userEdit.vue b/src/main/resources/static/components/retiredUser/userEdit.vue new file mode 100644 index 0000000..cf68f69 --- /dev/null +++ b/src/main/resources/static/components/retiredUser/userEdit.vue @@ -0,0 +1,240 @@ +/** +*Desc: +*Create by: jug +*Create time:2023/11/20/16:49 +*/ + + + + + diff --git a/src/main/resources/static/components/retiredUser/userInfo.vue b/src/main/resources/static/components/retiredUser/userInfo.vue index 98ad8f3..5d65e17 100644 --- a/src/main/resources/static/components/retiredUser/userInfo.vue +++ b/src/main/resources/static/components/retiredUser/userInfo.vue @@ -4,26 +4,112 @@ *Create time:2023/7/25/9:14 */ diff --git a/src/main/resources/views/platform/retired/partyBranch/manage.html b/src/main/resources/views/platform/retired/partyBranch/manage.html index edc9f5c..293a5b8 100644 --- a/src/main/resources/views/platform/retired/partyBranch/manage.html +++ b/src/main/resources/views/platform/retired/partyBranch/manage.html @@ -136,7 +136,7 @@ layout("/layouts/platform.html"){ - + + + - - - - - - - - - - - - - - - + + + + + 下载模板 + + + + + + + + + 选择文件 + +
+ 只能上传 xls/xlsx 文件 +
+
+
+
+
+ + +

总记录数:{{errorInfoData.totalCount}}

+

成功数:{{errorInfoData.successCount}}

+

错误数:{{errorInfoData.errorCount}}

+ 下载错误记录 + +
+
+
+ - 取消 - 确定 - + 取 消 + 确定 +
+ + + diff --git a/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyTravelAudit.html b/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyTravelAudit.html new file mode 100644 index 0000000..0b988b2 --- /dev/null +++ b/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyTravelAudit.html @@ -0,0 +1,806 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 返 回 + 调 整 + 拒 绝 + 通 过 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取 消 + 确 定 + + +
+ + + + + + diff --git a/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyXghAudit.html b/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyXghAudit.html index 5c14463..fc36a35 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyXghAudit.html +++ b/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyXghAudit.html @@ -42,7 +42,7 @@ layout("/layouts/platform.html"){ type="year" value-format="yyyy" placeholder="选择年" - style="width: 80%" @change="doSearch"> + style="width: 80%" @change="getLineSignNumber(); doSearch()"> @@ -54,7 +54,7 @@ layout("/layouts/platform.html"){ placeholder="查询类型" style="width: 110px;"> - + 搜索 @@ -63,24 +63,24 @@ layout("/layouts/platform.html"){ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -140,7 +140,7 @@ layout("/layouts/platform.html"){ 选择路线: + style="width: 80%" @change="lineChange"> + + + 出行时间: + + + + + + @@ -179,13 +193,23 @@ layout("/layouts/platform.html"){
- + @@ -288,17 +348,24 @@ layout("/layouts/platform.html"){ - - - - + + + + + + + - 退回 + 返回 - 通过 + + 拒绝 + + 通过 @@ -308,7 +375,6 @@ layout("/layouts/platform.html"){ - - - - + + + + + + + - 取 消 - 确 定 - + 返 回 + 调 整 + 拒 绝 + 通 过 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取 消 + 确 定 + + @@ -379,7 +573,7 @@ layout("/layouts/platform.html"){ searchName: "userName", }, tableColumns: [ - {prop: 'loginName', label: '工号'}, + {prop: 'loginName', label: '一卡通号'}, {prop: 'userName', label: '姓名'}, {prop: 'unitName', label: '单位', sortable: true}, {prop: 'unionName', label: '工会', sortable: true}, @@ -388,10 +582,35 @@ layout("/layouts/platform.html"){ // {prop: 'userNature', label: '人员性质'}, {prop: 'isFamily', label: '是否携带家属'}, // {prop: 'num', label: '人数'}, - {prop: 'isTransferIn', label: '是否转入转出', sortable: true}, + // {prop: 'isTransferIn', label: '是否转入转出', sortable: true}, + {prop: 'linePlayTime', label: '出行时间', sortable: true}, {prop: 'stateId', label: '审核状态', sortable: true}, ], - modifyConfig: {} + modifyConfig: {}, + selectLine: { + lineName: '全部' + }, + lineSignNumber: 0, + + times: null, + linePlayTimes: [], + + editVisible: false, + editFormData: {}, + rules: { + loginName: [{required: true, message: '请填写工号', trigger: ['blur', 'change']}], + userName: [{required: true, message: '请填写姓名', trigger: ['blur', 'change']}], + unionName: [{required: true, message: '请选择工会', trigger: ['blur', 'change']}], + unitName: [{required: true, message: '请选择单位', trigger: ['blur', 'change']}], + // travelName: [{required: true, message: '请选择旅行社', trigger: ['blur', 'change']}], + specificTime: [{required: true, message: '请选择出行时间', trigger: ['blur', 'change']}], + // travelLine: [{required: true, message: '必填', trigger: ['blur', 'change']}], + }, + editSpecificTimes: [], + labelName: '', + unionSelectLines: [], + lineLabelName: '', + activeNames:[] } }, components: { @@ -400,8 +619,134 @@ layout("/layouts/platform.html"){ }, methods: { - async doOnekeyAudit(flag) { - const confirm = await this.$confirm('您确定要一键审核您所勾选的信息吗, 是否继续?', '提示', { + async validateLine() { + const resp = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo' + , {enroll: JSON.stringify(this.editFormData)}) + if (resp.code !== 0) { + this.$message.warning(resp.msg) + this.editFormData.takePartInLineId = '' + } + }, + dropdownCommand(command) { + const {type, data} = command + if (type === 'view') { + this.openView(data) + } else if (type === 'recall') { + this.doRecall(data) + } else if (type === 'handle') { + this.openEdit(data) + } else if (type === 'modify') { + this.openModify(data) + } else if (type === 'delete') { + this.doDelete(data) + } + }, + async doDelete(row){ + this.$confirm("您确定要删除【" + row.userName + "】的此条报名信息吗?", '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + dangerouslyUseHTMLString: true, + type: 'warning', + callback: async (a, b) => { + if ("confirm" === a) {//确认后再执行 + const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doDeleteMyEnrollInfoById/' + row.id) + if (resp.code === 0) { + await this.doSearch() + this.$message.success('删除成功') + await this.getLineSignNumber(); + } else { + this.$message.warning(resp.msg) + } + } + } + }) + }, + async openModify(row) { + this.getUnionSelectLine(row.takePartInLineId) + this.editFormData = {}; + const resp = await $.get("/platform/theRapyRecuperation/TheRapyAudit/findOne", {id: row.id}) + if (resp.code === 0) { + this.editFormData = {...resp.data.viewData} + if (this.modifyConfig.familyInfo == 2) { + this.editFormData.companionList = resp.data.viewData.companionList + this.labelName = "家属信息" + } else { + this.editFormData.bedType = resp.data.viewData.familyNumber + this.labelName = "家属数量" + } + } + if (row.takePartInBaseManagementId) { + this.editSpecificTime(row.takePartInBaseManagementId); + this.lineLabelName = "酒店" + } else if (row.takePartInLineId) { + this.lineLabelName = '线路' + } + this.editVisible = true + }, + async doEdit() { + this.$refs['editForm'].validate().then(async () => { + const confirm = await this.$confirm('您确定要修改这位老师的报名信息吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + if (confirm === "confirm") { + if (!this.editFormData.takePartInLineId && !this.editFormData.takePartInBaseManagementId){ + this.$message.warning('请选择线路') + return + } + const resp = await $.post('/platform/theRapyRecuperation/user/query/doEdit', this.editFormData) + if (resp.code === 0) { + this.$notify.success(resp.msg) + this.editVisible = false + await this.doSearch(); + await this.getLineSignNumber(); + } else { + this.$notify.error(resp.msg) + } + } + }) + }, + async lineChange(val) { + console.log(val) + this.pageForm.selectId = '' + if (val) { + this.selectLine = this.takePartInLines.find(o => o.id === val) + await this.getLinePlayTimeByLineId(val); + } else { + this.selectLine.lineName = '' + } + await this.getLineSignNumber() + await this.doSearch() + }, + async playChange() { + await this.getLineSignNumber() + await this.doSearch() + }, + async getLinePlayTimeByLineId(id) { + const resp = await $.get(loc() + '/getLinePlayTimeByLineId', { + lineId: id, + year: this.pageForm.year, + signUpMode: 2, + }) + if (resp.code === 0) { + this.linePlayTimes = resp.data + } + }, + async getLineSignNumber() { + const resp = await $.get('/platform/theRapyRecuperation/TheRapyXghAudit/getLineNumber', this.pageForm) + this.lineSignNumber = resp.data + }, + async doOnekeyAudit(flag, adjustment) { + let msg = ''; + if (adjustment && !flag) { + msg = '您确定要一键【调整】您所勾选的报名信息吗,调整后该报名信息将不会在审核列表中展示, 是否继续?' + } else if (!adjustment && !flag) { + msg = '您确定要一键【拒绝】您所勾选的报名信息吗,是否继续?' + } else if (!adjustment && flag) { + msg = '您确定要一键【通过】您所勾选的报名信息吗,是否继续?' + } + const confirm = await this.$confirm(msg, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -410,13 +755,14 @@ layout("/layouts/platform.html"){ const resp = await $.post(loc() + "/doOnekeyAudit", { ids: JSON.stringify(this.tableSelection), flag: flag, + adjustment: adjustment, auditOpinion: this.formData.auditOpinion }) - if (resp.code === 0){ + if (resp.code === 0) { this.$notify.success({title: '成功', message: resp.msg}); await this.doSearch() this.dialogVisible = false - }else { + } else { this.$notify.warning({title: '失败', message: resp.msg}); this.dialogVisible = false } @@ -461,17 +807,25 @@ layout("/layouts/platform.html"){ }) if (confirm === "confirm") { const resp = await $.post(loc() + "/doRecall", {id: row.id}) - if (resp.code === 0){ + if (resp.code === 0) { this.$notify.success({title: '成功', message: resp.msg}); await this.doSearch() - }else { + } else { this.$notify.warning({title: '失败', message: resp.msg}); } } }, - async doAudit(flag) { - const confirm = await this.$confirm('您确定要' + (flag ? '通过' : '退回') + '吗, 是否继续?', '提示', { + async doAudit(flag, adjustment) { + let msg = ''; + if (adjustment && !flag) { + msg = '您确定要【调整】该报名信息吗,调整后该报名信息将不会在审核列表中展示, 是否继续?' + } else if (!adjustment && !flag) { + msg = '您确定要【拒绝】该报名信息吗,是否继续?' + } else if (!adjustment && flag) { + msg = '您确定要【通过】该报名信息吗,是否继续?' + } + const confirm = await this.$confirm(msg, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -479,15 +833,16 @@ layout("/layouts/platform.html"){ if (confirm === "confirm") { const resp = await $.post(loc() + "/doAudit", { flag: flag, + adjustment: adjustment, id: this.formData.id, isTransferIn: this.formData.isTransferIn, auditOpinion: this.formData.auditOpinion }) - if (resp.code === 0){ + if (resp.code === 0) { this.$notify.success({title: '成功', message: resp.msg}); await this.doSearch() this.$refs.guava.index() - }else { + } else { this.$notify.warning({title: '失败', message: resp.msg}); } @@ -591,12 +946,24 @@ layout("/layouts/platform.html"){ this.modifyConfig = res.data } }, + async getUnionSelectLine(disPlayUnionSelectId = null) { + const resp = await $.post('/platform/theRapyRecuperation/user/query/getUnionSelectLine', { + startYear: this.pageForm.year, + //signUpMode: 1, + disPlayUnionSelectId: disPlayUnionSelectId + }) + if (resp.code === 0) { + this.unionSelectLines = resp.data + } + }, }, async created() { await this.getBmUserUnion() await this.getModifyConfig() this.takePartInLines = await this.getXlByUnion() await this.doSearch() + await this.getLineSignNumber() + await this.getUnionSelectLine() } }) diff --git a/src/main/resources/views/platform/theRapyRecuperation/baseManage/baseManagement.html b/src/main/resources/views/platform/theRapyRecuperation/baseManage/baseManagement.html index 97a0da5..9128d64 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/baseManage/baseManagement.html +++ b/src/main/resources/views/platform/theRapyRecuperation/baseManage/baseManagement.html @@ -28,47 +28,45 @@ layout("/layouts/platform.html"){ - +
搜索
@@ -78,19 +76,14 @@ layout("/layouts/platform.html"){ -