From 1c805dcd51fb7ef2538d0876258056a1aabc527f Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 1 Sep 2025 17:53:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=90=E5=A5=B3=E4=BF=A1=E6=81=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UnionReimburseMineController.java | 1 + .../ChildManageManageController.java | 202 ++++++++++ .../controller/ChildManageMineController.java | 74 ++++ .../ChildManageWriteController.java | 120 ++++++ .../user/childManage/models/ChildManage.java | 186 +++++++++ .../service/ChildManageService.java | 10 + .../service/impl/ChildManageServiceImpl.java | 62 +++ .../childManage/vo/ChildManagePageForm.java | 14 + .../zhgh/unionReimburse/apply/index.html | 84 ++-- .../platform/zhgh/user/childManage/info.js | 57 +++ .../zhgh/user/childManage/manage/index.html | 228 +++++++++++ .../zhgh/user/childManage/mine/index.html | 173 +++++++++ .../zhgh/user/childManage/write/index.html | 358 ++++++++++++++++++ 13 files changed, 1537 insertions(+), 32 deletions(-) create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageManageController.java create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageMineController.java create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageWriteController.java create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/models/ChildManage.java create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/service/ChildManageService.java create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/service/impl/ChildManageServiceImpl.java create mode 100644 src/main/java/com/budwk/app/zhgh/user/childManage/vo/ChildManagePageForm.java create mode 100644 src/main/resources/views/platform/zhgh/user/childManage/info.js create mode 100644 src/main/resources/views/platform/zhgh/user/childManage/manage/index.html create mode 100644 src/main/resources/views/platform/zhgh/user/childManage/mine/index.html create mode 100644 src/main/resources/views/platform/zhgh/user/childManage/write/index.html diff --git a/src/main/java/com/budwk/app/zhgh/unionReimburse/controller/UnionReimburseMineController.java b/src/main/java/com/budwk/app/zhgh/unionReimburse/controller/UnionReimburseMineController.java index 81da1f02..e414a65e 100644 --- a/src/main/java/com/budwk/app/zhgh/unionReimburse/controller/UnionReimburseMineController.java +++ b/src/main/java/com/budwk/app/zhgh/unionReimburse/controller/UnionReimburseMineController.java @@ -99,6 +99,7 @@ public class UnionReimburseMineController { cnd.and("info.userName", "like", "%" + userName + "%"); } cnd.desc("info.createTime"); + cnd.and("info.userId", "=", SecurityUtil.getUserId()); sql.setCondition(cnd); Pagination pagination = unionReimburseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); return Result.success(pagination); diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageManageController.java b/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageManageController.java new file mode 100644 index 00000000..831abc84 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageManageController.java @@ -0,0 +1,202 @@ +package com.budwk.app.zhgh.user.childManage.controller; + + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.sys.models.Sys_dict; +import com.budwk.app.sys.services.SysDictService; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.enrollmentRegistration.vo.EnrollmentRegistrationPageForm; +import com.budwk.app.zhgh.user.childManage.models.ChildManage; +import com.budwk.app.zhgh.user.childManage.service.ChildManageService; +import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +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.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +@IocBean +@At("/platform/childManage/manage") +@Ok("json:full") +@Slf4j +@Api("子女信息管理") +public class ChildManageManageController { + + @Inject + private ChildManageService childManageService; + @Inject + private SysDictService sysDictService; + + @At("") + @Ok("beetl:/platform/zhgh/user/childManage/manage/index.html") + @SaCheckPermission + public void index() {} + + @At + @ApiOperation("分页查询") + @SaCheckPermission("childManage.manage") + public Result pageData(PageForm pageForm, + Integer year, + String searchName, + String searchKeyword, + String childrenSex, + String unionId, + String unitId, + String childrenGrade) { + Sql sql = Sqls.create(""" + SELECT + info.* + FROM + child_manage info + $condition + """); + Cnd cnd = Cnd.NEW(); + // 模糊查询 + if (searchName != null && !searchName.isEmpty() && searchKeyword != null && !searchKeyword.isEmpty()) { + switch (searchName) { + case "info.childrenName": + cnd.and("info.childrenName", "like", "%" + searchKeyword + "%"); + break; + case "info.guardianUserName": // 合并后的监护人查询 + cnd.and(Cnd.exps("info.guardianUserName1", "like", "%" + searchKeyword + "%") + .or("info.guardianUserName2", "like", "%" + searchKeyword + "%")); + break; + } + } + + // 工会筛选 (查询两个监护人的工会) + if (unionId != null && !unionId.isEmpty()) { + cnd.and(Cnd.exps("info.guardianUnionId1", "=", unionId) + .or("info.guardianUnionId2", "=", unionId)); + } + // 所属单位筛选 (查询两个监护人的单位) + if (unitId != null && !unitId.isEmpty()) { + cnd.and(Cnd.exps("info.guardianUnitId1", "=", unitId) + .or("info.guardianUnitId2", "=", unitId)); + } + + cnd.andEX("YEAR(info.applyTime)", "=", year); + cnd.andEX("info.childrenSex", "=", childrenSex); + cnd.andEX("info.childrenGrade", "=", childrenGrade); + sql.setCondition(cnd); + Pagination pagination = childManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + @At + @ApiOperation("删除子女信息") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission("childManage.manage") + @SLog(tag = "子女信息-我的填报", msg = "删除id: ${args[0]}") + public Result doDelete(String id) { + childManageService.dao().delete(ChildManage.class, id); + return Result.success(); + } + + @At + @Ok("void") + @SaCheckPermission("childManage.manage") + public void doExportExcel(@Param("data") ChildManagePageForm pageForm, HttpServletResponse response) { + try { + Sql sql = childManageService.getSql(pageForm); + List map = childManageService.listMap(sql); + + List dictList = sysDictService.getSubListByCode("CHILD_MANAGE_GRADE"); + + map.forEach(item -> { + // 年龄计算 + String birthday = item.getString("childrenBirthday"); + if (birthday != null && !birthday.isEmpty()) { + item.put("age", calculateAge(birthday)); + } + Sys_dict dict = dictList.stream().filter(sys_dict -> sys_dict.getCode().equals(item.getString("childrenGrade"))).findFirst().orElse(null); + item.put("childrenGrade", dict.getName()); + }); + + List entityList = new ArrayList<>(); + ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10); + no.setFormat("isAddIndex"); + entityList.add(no); + + entityList.add(new ExcelExportEntity("年级", "childrenGrade", 20)); + entityList.add(new ExcelExportEntity("子女姓名", "childrenName", 20)); + entityList.add(new ExcelExportEntity("性别", "childrenSex", 20)); + entityList.add(new ExcelExportEntity("出生日期", "childrenBirthday", 20)); + entityList.add(new ExcelExportEntity("年龄", "age", 20)); + entityList.add(new ExcelExportEntity("就读学校", "childrenCurrentSchool", 20)); + entityList.add(new ExcelExportEntity("监护人1", "guardianUserName1", 20)); + entityList.add(new ExcelExportEntity("手机号码", "guardianMobile1", 20)); + entityList.add(new ExcelExportEntity("所在单位", "guardianUnitName1", 20)); + entityList.add(new ExcelExportEntity("监护人2", "guardianUserName2", 20)); + entityList.add(new ExcelExportEntity("手机号码", "guardianMobile2", 20)); + entityList.add(new ExcelExportEntity("所在单位", "guardianUnitName2", 20)); + + + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("子女信息管理汇总.xlsx", "UTF-8")); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, map); + workbook.write(response.getOutputStream()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + /** + * 计算年龄 + * @param birthday 出生日期 + * @return 年龄 + */ + private String calculateAge(String birthday) { + if (birthday == null || birthday.isEmpty()) { + return ""; + } + + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date birthDate = sdf.parse(birthday); + Calendar birthCal = Calendar.getInstance(); + birthCal.setTime(birthDate); + + Calendar today = Calendar.getInstance(); + int age = today.get(Calendar.YEAR) - birthCal.get(Calendar.YEAR); + + // 检查是否还没过生日 + if (today.get(Calendar.DAY_OF_YEAR) < birthCal.get(Calendar.DAY_OF_YEAR)) { + age--; + } + + return String.valueOf(age >= 0 ? age : 0); + } catch (Exception e) { + log.error("计算年龄失败", e); + return ""; + } + } +} diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageMineController.java b/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageMineController.java new file mode 100644 index 00000000..7e8ff689 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageMineController.java @@ -0,0 +1,74 @@ +package com.budwk.app.zhgh.user.childManage.controller; + + +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.enrollmentRegistration.model.EnrollmentRegistration; +import com.budwk.app.zhgh.user.childManage.models.ChildManage; +import com.budwk.app.zhgh.user.childManage.service.ChildManageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +@IocBean +@At("/platform/childManage/mine") +@Ok("json:full") +@Slf4j +@Api("子女信息管理我的") +public class ChildManageMineController { + + @Inject + private ChildManageService childManageService; + + @At("") + @Ok("beetl:/platform/zhgh/user/childManage/mine/index.html") + @SaCheckPermission + public void index() {} + + @At + @ApiOperation("分页查询") + @SaCheckPermission("childManage.mine") + public Result pageData(PageForm pageForm, Integer year) { + Sql sql = Sqls.create(""" + SELECT + info.* + FROM + child_manage info + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(info.applyTime)", "=", year); + // 使用 or 条件查询两个监护人字段 + cnd.and(Cnd.exps("info.guardianUserId1", "=", SecurityUtil.getUserId()) + .or("info.guardianUserId2", "=", SecurityUtil.getUserId())); + sql.setCondition(cnd); + Pagination pagination = childManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + + @At + @ApiOperation("删除子女信息") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission("childManage.mine") + @SLog(tag = "子女信息-我的填报", msg = "删除id: ${args[0]}") + public Result doDelete(String id) { + childManageService.dao().delete(ChildManage.class, id); + return Result.success(); + } + + +} diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageWriteController.java b/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageWriteController.java new file mode 100644 index 00000000..ce7a2df5 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/controller/ChildManageWriteController.java @@ -0,0 +1,120 @@ +package com.budwk.app.zhgh.user.childManage.controller; + + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.constant.RoleConstant; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.result.Result; +import com.budwk.app.sys.views.View_user; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.enrollmentRegistration.model.EnrollmentRegistration; +import com.budwk.app.zhgh.user.childManage.models.ChildManage; +import com.budwk.app.zhgh.user.childManage.service.ChildManageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +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.SqlExpressionGroup; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +@IocBean +@At("/platform/childManage/write") +@Ok("json:full") +@Slf4j +@Api("子女信息管理信息填写") +public class ChildManageWriteController { + + @Inject + private Dao dao; + @Inject + private ChildManageService childManageService; + + + @At("") + @Ok("beetl:/platform/zhgh/user/childManage/write/index.html") + @SaCheckPermission + public void index() {} + + @At + @ApiOperation("保存子女信息") + @SaCheckPermission("childManage.write") + @SLog(tag = "子女信息管理-信息填写", msg = "保存子女信息") + public Result save(@Param("data") ChildManage childManage) { + if(StrUtil.isBlank(childManage.getId())) childManage.setApplyTime(DateUtil.now()); + dao.insertOrUpdate(childManage); + return Result.success(); + } + + @At + @ApiOperation("查询用户") + @SaCheckPermission("childManage.write") + @SLog(tag = "查询用户", msg = "查询用户") + public Object listUser(String keyword) { + Sql sql = Sqls.create(""" + select + id, + username as userName, + loginname as loginName, + sex, + mobile, + technicalTitle, + IFNULL(unitname, '暂无') as unitName, + unitid as unitId, + unionid as unionId, + unionname as unionName + from + vw_user + $condition + """); + Cnd cnd = Cnd.NEW(); + if (StrUtil.isNotBlank(keyword)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or(View_user::getLoginname, "like", "%" + keyword + "%"); + seg.or(View_user::getUsername, "like", "%" + keyword + "%"); + cnd.and(seg); + } + if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { + if(AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { + cnd.and(View_user::getUnionId, "=", SecurityUtil.getUnionId()); + } else { + cnd.and(View_user::getId, "=", SecurityUtil.getUserId()); + } + + } + sql.setCondition(cnd); + Pagination pagination = childManageService.listPageMap(1, 50, sql); + return Result.success(pagination.getList()); + } + + @At + @SaCheckLogin + @ApiOperation("查询身份证是否重复") + public Result getIsRepeatByIdCard(String idCard, String id) { + int count = childManageService.dao().count(ChildManage.class, + Cnd.where(ChildManage::getChildrenIdCard, "=", idCard) + .and("YEAR(applyTime)", "=", DateUtil.thisYear()) + .andEX(ChildManage::getId, "!=", id)); + + + return Result.success(count); + } + + @At + @SaCheckLogin + public Result findOne(String id) { + return Result.success(childManageService.dao().fetch(ChildManage.class, id)); + } + +} diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/models/ChildManage.java b/src/main/java/com/budwk/app/zhgh/user/childManage/models/ChildManage.java new file mode 100644 index 00000000..83955f5c --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/models/ChildManage.java @@ -0,0 +1,186 @@ +package com.budwk.app.zhgh.user.childManage.models; + + +import cn.hutool.json.JSONObject; +import com.budwk.app.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName ChildManage + * @Author hongqiwei + * @Date 2025/8/30 10:23 + * @Version 1.0 + * @Description TODO + */ + + +@Data +@EqualsAndHashCode(callSuper = true) +@Table("child_manage") +@TableMeta("{'mysql-charset':'utf8mb4'}") +@Comment("子女信息管理") +public class ChildManage extends BaseModel implements Serializable { + + + @Column + @Name + @Comment("id") + @ColDefine(type = ColType.VARCHAR, width = 32) + @Prev(els = {@EL("uuid()")}) + private String id; + + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("guardianUserId1") + private String guardianUserId1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("监护人1(教工)姓名") + private String guardianUserName1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("工号") + private String guardianLoginName1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("所在工会Id") + private String guardianUnionId1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("所在工会") + private String guardianUnionName1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("手机号码") + private String guardianMobile1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("所在单位Id") + private String guardianUnitId1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("所在单位") + private String guardianUnitName1; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("guardianUserId2") + private String guardianUserId2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("监护人2(教工)姓名") + private String guardianUserName2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("工号") + private String guardianLoginName2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("所在工会Id") + private String guardianUnionId2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("所在工会") + private String guardianUnionName2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("手机号码") + private String guardianMobile2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("所在单位Id") + private String guardianUnitId2; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("所在单位") + private String guardianUnitName2; + + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("子女姓名") + private String childrenName; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("就读年级") + private String childrenGrade; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("入学年份") + private String childrenYear; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("身份证号") + private String childrenIdCard; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("出身年月") + private String childrenBirthday; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("性别") + private String childrenSex; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 30) + @Comment("国籍") + private String childrenCountry; + + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("现就读学校") + private String childrenCurrentSchool; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("中考总成绩") + private String childrenMiddleScore; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("学科组合") + private String childrenSubjectCombination; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 100) + @Comment("子女户籍所在地") + private String childrenHuKouAddress; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 200) + @Comment("备注") + private String note; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 50) + @Comment("填写时间") + private String applyTime; + + +} diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/service/ChildManageService.java b/src/main/java/com/budwk/app/zhgh/user/childManage/service/ChildManageService.java new file mode 100644 index 00000000..bbc30ce5 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/service/ChildManageService.java @@ -0,0 +1,10 @@ +package com.budwk.app.zhgh.user.childManage.service; + +import com.budwk.app.base.service.BaseService; +import com.budwk.app.zhgh.user.childManage.models.ChildManage; +import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm; +import org.nutz.dao.sql.Sql; + +public interface ChildManageService extends BaseService { + Sql getSql(ChildManagePageForm pageForm); +} diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/service/impl/ChildManageServiceImpl.java b/src/main/java/com/budwk/app/zhgh/user/childManage/service/impl/ChildManageServiceImpl.java new file mode 100644 index 00000000..17de89e3 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/service/impl/ChildManageServiceImpl.java @@ -0,0 +1,62 @@ +package com.budwk.app.zhgh.user.childManage.service.impl; + +import com.budwk.app.base.service.impl.BaseServiceImpl; +import com.budwk.app.zhgh.user.childManage.models.ChildManage; +import com.budwk.app.zhgh.user.childManage.service.ChildManageService; +import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm; +import lombok.extern.slf4j.Slf4j; +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.loader.annotation.IocBean; + + +@Slf4j +@IocBean(args = {"refer:dao"}) +public class ChildManageServiceImpl extends BaseServiceImpl implements ChildManageService { + + public ChildManageServiceImpl(Dao dao) { + super(dao); + } + + @Override + public Sql getSql(ChildManagePageForm pageForm) { + Sql sql = Sqls.create(""" + SELECT + info.* + FROM + child_manage info + $condition + """); + Cnd cnd = Cnd.NEW(); + // 模糊查询 + if (pageForm.getSearchName() != null && !pageForm.getSearchName().isEmpty() && pageForm.getSearchKeyword() != null && !pageForm.getSearchKeyword().isEmpty()) { + switch (pageForm.getSearchName()) { + case "info.childrenName": + cnd.and("info.childrenName", "like", "%" + pageForm.getSearchKeyword() + "%"); + break; + case "info.guardianUserName": // 合并后的监护人查询 + cnd.and(Cnd.exps("info.guardianUserName1", "like", "%" + pageForm.getSearchKeyword() + "%") + .or("info.guardianUserName2", "like", "%" + pageForm.getSearchKeyword() + "%")); + break; + } + } + + // 工会筛选 (查询两个监护人的工会) + if (pageForm.getUnionId() != null && !pageForm.getUnionId().isEmpty()) { + cnd.and(Cnd.exps("info.guardianUnionId1", "=", pageForm.getUnionId()) + .or("info.guardianUnionId2", "=", pageForm.getUnionId())); + } + // 所属单位筛选 (查询两个监护人的单位) + if (pageForm.getUnitId() != null && !pageForm.getUnitId().isEmpty()) { + cnd.and(Cnd.exps("info.guardianUnitId1", "=", pageForm.getUnitId()) + .or("info.guardianUnitId2", "=", pageForm.getUnitId())); + } + + cnd.andEX("YEAR(info.applyTime)", "=", pageForm.getYear()); + cnd.andEX("info.childrenGrade", "=", pageForm.getChildrenGrade()); + sql.setCondition(cnd); + return sql; + } +} diff --git a/src/main/java/com/budwk/app/zhgh/user/childManage/vo/ChildManagePageForm.java b/src/main/java/com/budwk/app/zhgh/user/childManage/vo/ChildManagePageForm.java new file mode 100644 index 00000000..9fb907a1 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/user/childManage/vo/ChildManagePageForm.java @@ -0,0 +1,14 @@ +package com.budwk.app.zhgh.user.childManage.vo; +import com.budwk.app.base.param.PageForm; +import lombok.Data; + +@Data +public class ChildManagePageForm extends PageForm { + + private Integer year; + private String unionId; + private String unitId; + private String childrenGrade; + private String searchName; + private String searchKeyword; +} diff --git a/src/main/resources/views/platform/zhgh/unionReimburse/apply/index.html b/src/main/resources/views/platform/zhgh/unionReimburse/apply/index.html index b917a08d..748c0d08 100644 --- a/src/main/resources/views/platform/zhgh/unionReimburse/apply/index.html +++ b/src/main/resources/views/platform/zhgh/unionReimburse/apply/index.html @@ -303,11 +303,14 @@ layout("/layouts/platform.html"){ }, //查询慰问对象 selectQueryUser(keyword, options) { - options.length = 0 - this.$axios.post("/platform/UnionReimburse/apply/listUser", {keyword: keyword}).then((res) => { - if (res.code === 0) { - options.push(...res.data) - } + return new Promise((resolve) => { + options.length = 0 + this.$axios.post("/platform/UnionReimburse/apply/listUser", {keyword: keyword}).then((res) => { + if (res.code === 0) { + options.push(...res.data) + } + resolve() + }) }) }, userChange(val) { @@ -403,31 +406,6 @@ layout("/layouts/platform.html"){ }) }) }, - // 初始化 - async init() { - this.reimburseProjectList = await this.$businessTool.getDictOptions("UNION_REIMBURSE_PROJECT") - if (this.bizId) { - this.$axios.post("/platform/unionReimburse/apply/info", {id: this.bizId}).then((res) => { - if (res.code === 0) { - this.formData = res.data - this.selectQueryUser(this.formData.loginName, this.userOptions) - this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) - } - }) - } else { - const { username, loginname, id, unit, union, mobile } = this.$store.state.user - this.formData = { - userName: username, - loginName: loginname, - unitId: unit?.id, - unitName: unit?.name, - unionId: union?.id, - unionName: union?.name, - reimburseType: "UNION_REIMBURSE_TYPE_1", - mobile: mobile - } - } - }, //慰问类型查询 queryCondolenceType() { this.$axios.post("/platform/unionReimburse/apply/queryCondolenceType") @@ -499,8 +477,50 @@ layout("/layouts/platform.html"){ this.$set(this.formData, 'fundBalance', '查询失败'); this.$message.error("经费余额查询失败"); }); - } - + }, + // 初始化 + async init() { + this.reimburseProjectList = await this.$businessTool.getDictOptions("UNION_REIMBURSE_PROJECT") + if (this.bizId) { + this.$axios.post("/platform/unionReimburse/apply/info", {id: this.bizId}).then(async (res) => { + if (res.code === 0) { + this.formData = res.data + // 确保在加载用户列表后再设置默认值 + await this.selectQueryUser('', this.userOptions) + // 如果有慰问对象ID,确保userOptions中有对应数据 + if (this.formData.condolenceId) { + // 检查userOptions中是否已存在该用户 + const existingUser = this.userOptions.find(user => user.id === this.formData.condolenceId); + if (!existingUser && this.formData.condolenceName) { + // 如果不存在但有名称信息,则手动添加 + this.userOptions.unshift({ + id: this.formData.condolenceId, + userName: this.formData.condolenceName, + mobile: this.formData.condolenceMobile || '', + loginName: this.formData.condolenceLoginName || '', + unitName: this.formData.condolenceUnitName || '', + sex: this.formData.condolenceSex || '' + }); + } + } + this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) + } + }) + } else { + const { username, loginname, id, unit, union, mobile } = this.$store.state.user + this.formData = { + userName: username, + loginName: loginname, + unitId: unit?.id, + unitName: unit?.name, + unionId: union?.id, + unionName: union?.name, + reimburseType: "UNION_REIMBURSE_TYPE_1", + mobile: mobile, + userId: id, + } + } + }, }, created() { this.queryCondolenceType() diff --git a/src/main/resources/views/platform/zhgh/user/childManage/info.js b/src/main/resources/views/platform/zhgh/user/childManage/info.js new file mode 100644 index 00000000..bbb87ed8 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/user/childManage/info.js @@ -0,0 +1,57 @@ +const childManageInfo = { + template: /*language=HTML*/ ` + +
+
+ 子女信息 +
+ + + + + {{viewData.childrenYear}} + {{viewData.childrenName}} + {{viewData.childrenIdCard}} + {{viewData.childrenBirthday}} + {{viewData.childrenSex}} + {{viewData.childrenCountry}} + {{viewData.childrenCurrentSchool}} + {{viewData.childrenMiddleScore}} + {{viewData.childrenSubjectCombination}} + {{viewData.childrenHuKouAddress}} + {{viewData.guardianUserName1}} + {{viewData.guardianMobile1}} + {{viewData.guardianUnitName1}} + {{viewData.guardianUserName2}} + {{viewData.guardianMobile2}} + {{viewData.guardianUnitName2}} + {{viewData.note}} + + + +
+ `, + dicts: ["CHILD_MANAGE_GRADE"], + data() { + return { + viewData: {}, + row: null + } + }, + methods: { + // 打开 + onOpen(row) { + this.row = row + this.getInfo() + }, + // 获取申请信息 + getInfo() { + this.$axios.post('/platform/childManage/write/findOne', {id: this.row.id}).then((res) => { + if (res.code === 0) { + this.viewData = res.data + } + }) + }, + } +} diff --git a/src/main/resources/views/platform/zhgh/user/childManage/manage/index.html b/src/main/resources/views/platform/zhgh/user/childManage/manage/index.html new file mode 100644 index 00000000..31163cb2 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/user/childManage/manage/index.html @@ -0,0 +1,228 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 导出汇总名单 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+ + + + + + diff --git a/src/main/resources/views/platform/zhgh/user/childManage/mine/index.html b/src/main/resources/views/platform/zhgh/user/childManage/mine/index.html new file mode 100644 index 00000000..1edfdbe0 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/user/childManage/mine/index.html @@ -0,0 +1,173 @@ + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+
+ + + + + + + diff --git a/src/main/resources/views/platform/zhgh/user/childManage/write/index.html b/src/main/resources/views/platform/zhgh/user/childManage/write/index.html new file mode 100644 index 00000000..97452d26 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/user/childManage/write/index.html @@ -0,0 +1,358 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{formData.guardianLoginName1}} + + + + + + + + + + + + + + + + + + + + + + {{formData.guardianLoginName2}} + + + + + + + + + + + + + + + + + + + + 保存 + + +
+ + + + + +