diff --git a/pom.xml b/pom.xml index 0fa1229..4eccc36 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 2.4 1.12.1 1.9.1 - 4.2.0 + 4.5.0 9.4.47.v20220610 diff --git a/src/main/java/io/v/nutz/base/utils/MsgApi.java b/src/main/java/io/v/nutz/base/utils/MsgApi.java index 513a644..42c88e4 100644 --- a/src/main/java/io/v/nutz/base/utils/MsgApi.java +++ b/src/main/java/io/v/nutz/base/utils/MsgApi.java @@ -1,22 +1,15 @@ package io.v.nutz.base.utils; import cn.hutool.core.util.StrUtil; -import cn.hutool.crypto.SecureUtil; import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import io.v.nutz.base.enums.Env; import io.v.nutz.web.commons.base.Globals; import lombok.extern.slf4j.Slf4j; -import org.nutz.dao.Dao; -import org.nutz.http.Http; import org.nutz.integration.jedis.RedisService; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; import org.nutz.lang.Lang; -import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import java.util.List; @@ -34,7 +27,7 @@ public class MsgApi { /** * token -redis - name */ - private static final String msgTokenName = "msg_token"; + private static final String MSG_TOKEN_NAME = "msg_token"; private static final String APP_KEY = "10c51794-45b8-4de5-ba6f-b1ed843c20f3"; private static final String APP_SECRET = "4acbf17e-4b17-4c47-b4bb-1576a066250a"; @@ -52,7 +45,7 @@ public class MsgApi { /** * @param channels 推送渠道 (INNER:站内消息; SMS:短信; Mail:邮件; WeChat:微信; DingTalk:钉钉;同时推送多个渠道用英文逗号分隔 ) - * @param loginNames + * @param loginNames 字符串,多个工号用英文逗号分隔 "," * @param mtype 消息类型; 0: 图文 1: 文字 2: 外链 * @param title 标题 * @param content 内容 @@ -114,14 +107,14 @@ public class MsgApi { * @return */ private String getMsgToken() { - String token = redisService.get(msgTokenName); + String token = redisService.get(MSG_TOKEN_NAME); if (StrUtil.isBlank(token)) { String body = HttpRequest.post(TOKEN_API + "?appKey=" + APP_KEY + "&appSecret=" + APP_SECRET).execute().body(); NutMap map = Json.fromJson(NutMap.class, body); if (map.getInt("code") == 200) { NutMap data = Json.fromJson(NutMap.class, map.getString("data")); token = data.getString("accessToken"); - redisService.setex(msgTokenName, 3600, token); + redisService.setex(MSG_TOKEN_NAME, 3600, token); } else { token = ""; } diff --git a/src/main/java/io/v/nutz/zhgh/specialstaff/controller/SpecialStaffManageController.java b/src/main/java/io/v/nutz/zhgh/specialstaff/controller/SpecialStaffManageController.java new file mode 100644 index 0000000..2882d72 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/specialstaff/controller/SpecialStaffManageController.java @@ -0,0 +1,163 @@ +package io.v.nutz.zhgh.specialstaff.controller; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.result.Result; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.sys.models.User; +import io.v.nutz.zhgh.specialstaff.model.SpecialStaff; +import io.v.nutz.zhgh.specialstaff.param.SpecialStaffPageForm; +import io.v.nutz.zhgh.specialstaff.service.SpecialStaffManageService; +import io.v.nutz.zhgh.specialstaff.vo.SpecialStaffVo; +import lombok.extern.slf4j.Slf4j; +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.dao.util.cri.SqlExpressionGroup; +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.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.validation.Valid; +import java.util.List; + +/** + * @version 1.0 + * @Author zzr + * @name:SpecialStaffManageController + * @Date 2024/10/25 9:03 + * @注释 特殊人员管理 + */ +@Slf4j +@IocBean +@Ok("json") +@At("/platform/staff/special/manage") +public class SpecialStaffManageController { + + @Inject + private Dao dao; + + @Inject + private SpecialStaffManageService specialStaffManageService; + + + @At("") + @Ok("beetl:/platform/specialstaff/manage/index.html") + @RequiresPermissions("staff.special.manage") + public void index() { + } + + + @At + @RequiresPermissions("staff.special.manage") + public Object pageData(SpecialStaffPageForm pageForm) { + Pagination pagination = specialStaffManageService.pageData(pageForm); + return Result.success(pagination); + } + + + @At + @RequiresPermissions("staff.special.manage") + public Result getUserInfo(String userId) { + NutMap userInfo = specialStaffManageService.getUserInfo(userId); + return Result.success(userInfo); + } + + + @At + @RequiresPermissions("staff.special.manage") + public Result getSpecialStaffUserInfo(String userId) { + NutMap specialStaffUserInfo = specialStaffManageService.getSpecialStaffUserInfo(userId); + return Result.success(specialStaffUserInfo); + } + + + @At + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("staff.special.manage") + public Result addSpecialStaff(@Param("data") SpecialStaffVo specialStaffVo) { + SpecialStaff staff = new SpecialStaff(); + Sys_user user = dao.fetch(Sys_user.class, specialStaffVo.getUserId()); + User viewUser = dao.fetch(User.class, Cnd.where("id", "=", specialStaffVo.getUserId())); + SpecialStaff specialStaff = dao.fetch(SpecialStaff.class, Cnd.where("userId", "=", specialStaffVo.getUserId())); + if (Lang.isNotEmpty(specialStaff)) { + staff = specialStaff; + } + BeanUtil.copyProperties(specialStaffVo, staff); + if (specialStaffVo.getIsManyUnit()!=null && specialStaffVo.getIsManyUnit()) { + // 如果是多单位人员, 更改单位为工会关系 +// user.setUnitid(specialStaffVo.getUnionRelationUnitId()); +// user.setThreeUnitId(specialStaffVo.getUnionRelationThreeUnitId()); +// user.setIsManyUnit(true); + dao.updateIgnoreNull(user); + + staff.setPersonnelRelationUnitId(viewUser.getUnitid()); + staff.setPersonnelRelationUnitName(viewUser.getUnitname()); + staff.setPersonnelRelationUnionId(viewUser.getUnionid()); + staff.setPersonnelRelationUnionName(viewUser.getUnionname()); +// staff.setPersonnelRelationThreeUnitId(viewUser.getThreeUnitId()); +// staff.setPersonnelRelationThreeUnitName(viewUser.getThreeUnitName()); +// staff.setPersonnelRelationUnionGroupId(viewUser.getUnionGroupId()); +// staff.setPersonnelRelationUnionGroupName(viewUser.getUnionGroupName()); + } + staff.setUserId(user.getId()); + dao.insertOrUpdate(staff); + return Result.success(); + } + + + @At + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("staff.special.manage") + public Result removeSpecialStaff(@Valid String userId) { + SpecialStaff staff = dao.fetch(SpecialStaff.class, Cnd.where("userId", "=", userId)); + if (staff.getIsManyUnit()) { + dao.update(Sys_user.class, Chain.make("unitid", staff.getPersonnelRelationUnitId()) + .add("threeUnitId", staff.getPersonnelRelationThreeUnitId()) + .add("isManyUnit", null), Cnd.where("id", "=", userId)); + } + dao.clear(SpecialStaff.class, Cnd.where("userId", "=", userId)); + return Result.success(); + } + + + @At + @RequiresPermissions("staff.special.manage") + public Result queryUser(String keyWord) { + Sql sql = Sqls.create(""" + select + id, + username, + loginname, + unitid AS unitId, + unitname AS unitName, + unionid AS unionId, + unionname AS unionName + from + `user` + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.where("id", "not in", "(select userId from special_staff)"); + if (StrUtil.isNotBlank(keyWord)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("username", keyWord); + seg.orLike("loginname", keyWord); + cnd.and(seg); + } + cnd.limit(0, 10); + sql.setCondition(cnd); + List list = specialStaffManageService.listMap(sql); + return Result.success(list); + } +} diff --git a/src/main/java/io/v/nutz/zhgh/specialstaff/model/SpecialStaff.java b/src/main/java/io/v/nutz/zhgh/specialstaff/model/SpecialStaff.java new file mode 100644 index 0000000..aedb2c5 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/specialstaff/model/SpecialStaff.java @@ -0,0 +1,137 @@ +package io.v.nutz.zhgh.specialstaff.model; + +import io.v.nutz.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +/** + * @version 1.0 + * @Author zzr + * @name:SpecialStaff + * @Date 2024/10/25 9:05 + * @注释 + */ +@Data +@Comment("特别人员") +@Table("special_staff") +@EqualsAndHashCode(callSuper = true) +public class SpecialStaff extends BaseModel { + + @Name + @Comment("ID") + @PrevInsert(uu32 = true) + @ColDefine(type = ColType.VARCHAR, width = 32) + private String id; + + @Column + @Comment("组员对应的用户id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userId; + + /** + * 人事关系 + */ + @Column + @Comment("人事关系部门") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String personnelRelationUnitId; + + @Column + @Comment("人事关系部门名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String personnelRelationUnitName; + + @Column + @Comment("人事关系工会") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String personnelRelationUnionId; + + @Column + @Comment("人事关系工会名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String personnelRelationUnionName; + + @Column + @Comment("人事关系三级单位") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String personnelRelationThreeUnitId; + + @Column + @Comment("人事关系三级单位名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String personnelRelationThreeUnitName; + + @Column + @Comment("人事关系工会小组") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String personnelRelationUnionGroupId; + + @Column + @Comment("人事关系工会小组名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String personnelRelationUnionGroupName; + + + /** + * 工会关系 + */ + @Column + @Comment("工会关系部门") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionRelationUnitId; + + @Column + @Comment("工会关系部门名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionRelationUnitName; + + @Column + @Comment("工会关系工会") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionRelationUnionId; + + @Column + @Comment("工会关系工会名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionRelationUnionName; + + @Column + @Comment("工会关系三级单位") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionRelationThreeUnitId; + + @Column + @Comment("工会关系三级单位名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionRelationThreeUnitName; + + @Column + @Comment("工会关系小组") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionRelationUnionGroupId; + + @Column + @Comment("工会关系小组名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String unionRelationUnionGroupName; + + @Column + @Comment("特殊人员类型") + @ColDefine(type = ColType.BOOLEAN) + @Default("0") + private Boolean isManyUnit; + + @Column + @Comment("特殊人员类型") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String specialStaffType; + + @Column + @Comment("特殊人员备注") + @ColDefine(type = ColType.VARCHAR, width = 200) + private String specialStaffRemark; + + +} diff --git a/src/main/java/io/v/nutz/zhgh/specialstaff/param/SpecialStaffPageForm.java b/src/main/java/io/v/nutz/zhgh/specialstaff/param/SpecialStaffPageForm.java new file mode 100644 index 0000000..4fdf4ce --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/specialstaff/param/SpecialStaffPageForm.java @@ -0,0 +1,31 @@ +package io.v.nutz.zhgh.specialstaff.param; + +import io.v.nutz.base.query.PageForm; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @version 1.0 + * @Author zzr + * @name:SpecialStaffPageForm + * @Date 2024/10/25 9:31 + * @注释 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class SpecialStaffPageForm extends PageForm { + + private String unionId; + + private String unitId; + + private String unionGroupId; + + private String threeUnitId; + + private String personType; + + private String userState; + + private String specialStaffType; +} diff --git a/src/main/java/io/v/nutz/zhgh/specialstaff/service/SpecialStaffManageService.java b/src/main/java/io/v/nutz/zhgh/specialstaff/service/SpecialStaffManageService.java new file mode 100644 index 0000000..c8b850d --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/specialstaff/service/SpecialStaffManageService.java @@ -0,0 +1,38 @@ +package io.v.nutz.zhgh.specialstaff.service; + +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.zhgh.specialstaff.model.SpecialStaff; +import io.v.nutz.zhgh.specialstaff.param.SpecialStaffPageForm; +import org.nutz.lang.util.NutMap; + +/** + * @version 1.0 + * @Author zzr + * @name:SpecialStaffManageService + * @Date 2024/10/25 9:42 + * @注释 + */ +public interface SpecialStaffManageService extends BaseService { + + /** + * 分页查询 + * @param pageForm + * @return + */ + Pagination pageData(SpecialStaffPageForm pageForm); + + /** + * 获取用户信息(人事关系) + * @param userId 用户id + * @return + */ + NutMap getUserInfo(String userId); + + /** + * 获取用户信息(特殊人员) + * @param userId 用户id + * @return + */ + NutMap getSpecialStaffUserInfo(String userId); +} diff --git a/src/main/java/io/v/nutz/zhgh/specialstaff/service/impl/SpecialStaffManageServiceImpl.java b/src/main/java/io/v/nutz/zhgh/specialstaff/service/impl/SpecialStaffManageServiceImpl.java new file mode 100644 index 0000000..7c89363 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/specialstaff/service/impl/SpecialStaffManageServiceImpl.java @@ -0,0 +1,143 @@ +package io.v.nutz.zhgh.specialstaff.service.impl; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.service.impl.BaseServiceImpl; +import io.v.nutz.base.utils.PageUtil; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.specialstaff.model.SpecialStaff; +import io.v.nutz.zhgh.specialstaff.param.SpecialStaffPageForm; +import io.v.nutz.zhgh.specialstaff.service.SpecialStaffManageService; +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.IocBean; +import org.nutz.lang.util.NutMap; + +/** + * @version 1.0 + * @Author zzr + * @name:SpecialStaffManageServiceImpl + * @Date 2024/10/25 9:43 + * @注释 + */ +@IocBean(args = {"refer:dao"}) +public class SpecialStaffManageServiceImpl extends BaseServiceImpl implements SpecialStaffManageService { + public SpecialStaffManageServiceImpl(Dao dao) { + super(dao); + } + + @Override + public Pagination pageData(SpecialStaffPageForm pageForm) { + Sql sql = Sqls.create(""" + SELECT + s.*, + u.loginname, + u.username, + u.sex, + u.member, + u.welfareMember, + u.personType, + u.userState, + u.mobile, + dict.`name` AS distSpecialStaffType, + u.birthday + FROM + `special_staff` s + LEFT JOIN `user` u ON s.userId = u.id + LEFT JOIN `sys_dict` dict ON dict.`code` = s.specialStaffType + $condition + """); + Cnd cnd = Cnd.NEW(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("u.unionId", "=", Vi.getUnionId()); + } + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("u.username", pageForm.getSearchKeyword()); + seg.orLike("u.loginname", pageForm.getSearchKeyword()); + cnd.and(seg); + } + + if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); + } else { + cnd.asc("u.unitcode"); + cnd.asc("u.loginname"); + } + + cnd.andEX("u.unionId", "=", pageForm.getUnionId()); + cnd.andEX("u.unitId", "=", pageForm.getUnitId()); + cnd.andEX("u.personType", "=", pageForm.getPersonType()); + cnd.andEX("u.userState", "=", pageForm.getUserState()); + cnd.andEX("u.personType", "=", pageForm.getPersonType()); + cnd.andEX("s.specialStaffType", "=", pageForm.getSpecialStaffType()); + sql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @Override + public NutMap getUserInfo(String userId) { +// threeUnitId AS personnelRelationThreeUnitId, +// threeUnitName AS personnelRelationThreeUnitName, +// unionGroupId AS personnelRelationUnionGroupId, +// unionGroupName AS personnelRelationUnionGroupName, + Sql sql = Sqls.create(""" + SELECT + id AS userId, + username, + loginname, + unitid AS personnelRelationUnitId, + unitname AS personnelRelationUnitName, + unionname AS personnelRelationUnionName, + threeUnitId AS personnelRelationThreeUnitId, + threeUnitName AS personnelRelationThreeUnitName, + unionGroupId AS personnelRelationUnionGroupId, + unionGroupName AS personnelRelationUnionGroupName, + userState, + personType, + mobile + FROM + `user` + WHERE + id = @userId + """); + sql.setParam("userId", userId); + sql.setCallback(Sqls.callback.map()); + dao().execute(sql); + return (NutMap) sql.getResult(); + } + + + @Override + public NutMap getSpecialStaffUserInfo(String userId) { + Sql sql = Sqls.create(""" + SELECT + s.*, + u.loginname, + u.username, + u.sex, + u.member, + u.welfareMember, + u.personType, + u.userState, + u.unitname AS unionRelationUnitName, + u.unionname AS unionRelationUnionName, + u.mobile, + u.birthday + FROM + `special_staff` s + LEFT JOIN `user` u ON s.userId = u.id + WHERE + s.userId=@userId + """); + sql.setParam("userId", userId); + sql.setCallback(Sqls.callback.map()); + dao().execute(sql); + return (NutMap) sql.getResult(); + } +} diff --git a/src/main/java/io/v/nutz/zhgh/specialstaff/vo/SpecialStaffVo.java b/src/main/java/io/v/nutz/zhgh/specialstaff/vo/SpecialStaffVo.java new file mode 100644 index 0000000..2f8fe0a --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/specialstaff/vo/SpecialStaffVo.java @@ -0,0 +1,37 @@ +package io.v.nutz.zhgh.specialstaff.vo; + +import lombok.Data; + +/** + * @version 1.0 + * @Author zzr + * @name:SpecialStaffVo + * @Date 2024/10/25 9:36 + * @注释 + */ +@Data +public class SpecialStaffVo { + + private String id; + private String userId; + private String personnelRelationUnitId; + private String personnelRelationUnitName; + private String personnelRelationUnionId; + private String personnelRelationUnionName; + private String personnelRelationThreeUnitId; + private String personnelRelationThreeUnitName; + private String personnelRelationUnionGroupId; + private String personnelRelationUnionGroupName; + private String unionRelationUnitId; + private String unionRelationUnitName; + private String unionRelationUnionId; + private String unionRelationUnionName; + private String unionRelationThreeUnitId; + private String unionRelationThreeUnitName; + private String unionRelationUnionGroupId; + private String unionRelationUnionGroupName; + private Boolean isManyUnit; + private String specialStaffType; + private String specialStaffRemark; + +} diff --git a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java index 4177ce3..34239d8 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/controller/WelfareListController.java @@ -127,6 +127,7 @@ public class WelfareListController { """); CndPlus cnd = CndPlus.create(); cnd.and(pageForm); + pageParam.participate(cnd, "wl"); cnd.and("wl.projectId", "=", projectId); cnd.andEX("wus.selectOptionId", "=", optionId); cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit()); @@ -144,7 +145,7 @@ public class WelfareListController { cnd.andEX("wl.userState", "in", userStateArray); } - cnd.andEX("wl.sex", "in", pageParam.getSex()); + cnd.andEX("wl.sex", "=", pageParam.getSex()); cnd.andEX("wcn.courierNumber", "=", courierNumber); diff --git a/src/main/java/io/v/nutz/zhgh/welfare/controller/statistics/WelfareSingleController.java b/src/main/java/io/v/nutz/zhgh/welfare/controller/statistics/WelfareSingleController.java index 4128e3d..07cc6f1 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/controller/statistics/WelfareSingleController.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/controller/statistics/WelfareSingleController.java @@ -732,12 +732,12 @@ public class WelfareSingleController { try { response.setContentType("application/octet-stream"); response.setHeader("content-disposition", "attachment;filename=" - + URLEncoder.encode(sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xlsx", "UTF-8")); + + URLEncoder.encode(sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xls", "UTF-8")); //获取这个福利项目下的所有数据 // List allUser = welfareSingleService.getUserByProjectId(projectId, month, unionGroupId); // List userChoose = welfareSingleService.getUserChooseByProjectId(projectId, month, unionGroupId); welfareSingleService.exportReceiveDetail(projectId, welfareUnitId, new ArrayList<>(), new ArrayList<>(), response.getOutputStream()); - ViTool.excelResponse(response, sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xlsx"); + ViTool.excelResponse(response, sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xls"); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/io/v/nutz/zhgh/welfare/model/template/WelfareExportEntityTc.java b/src/main/java/io/v/nutz/zhgh/welfare/model/template/WelfareExportEntityTc.java index 0a949b3..c4a69ad 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/model/template/WelfareExportEntityTc.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/model/template/WelfareExportEntityTc.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.welfare.model.template; import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -36,7 +37,7 @@ public class WelfareExportEntityTc { @Excel(name = "快递单号", width = 40d) private String courierNumber; - @Excel(name = "实名签字", width = 20d, type = 2 , imageType = 2) + @Excel(name = "实名签字", width = 20d, type = 2 , imageType = 2, height = 12d) private byte[] qzBytes; private String userSign; diff --git a/src/main/java/io/v/nutz/zhgh/welfare/service/impl/WelfareSingleServiceImpl.java b/src/main/java/io/v/nutz/zhgh/welfare/service/impl/WelfareSingleServiceImpl.java index 832257c..1965ea1 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/service/impl/WelfareSingleServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/service/impl/WelfareSingleServiceImpl.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.welfare.service.impl; -import cn.afterturn.easypoi.entity.ImageEntity; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.entity.ExportParams; @@ -23,6 +22,7 @@ import io.v.nutz.zhgh.welfare.model.WelfareProject; import io.v.nutz.zhgh.welfare.model.template.WelfareExportEntityTc; import io.v.nutz.zhgh.welfare.service.WelfareSingleService; import lombok.Data; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; @@ -45,7 +45,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.*; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -200,7 +199,7 @@ public class WelfareSingleServiceImpl extends ViServiceImpl impl * @return */ @Override - public NutMap pageData(String projectId, String month, String welfareUnitCode, String unionGroupId, String personType) { + public NutMap pageData(String projectId, String month, String welfareUnitCode, String unionGroupId, String personType) { boolean isThreeUnit = Globals.MyConfig.getBoolean("isThreeUnit"); Sql welfareUnitSql = Sqls.create(""" SELECT @@ -676,23 +675,25 @@ public class WelfareSingleServiceImpl extends ViServiceImpl impl SELECT u.loginname, u.username, - vwl.welfareUnitId as unionid, - gh.unionname as unionname, + IF(staffUnion.id IS NOT NULL, staffUnion.id, vwl.welfareUnitId) AS unionid, + IF(staffUnion.id IS NOT NULL, staffUnion.unionname, gh.unionname) AS unionname, vwl.welfareSecondLevelUnitId as unitid, dw.`name` as unitname, wpus.userSign, wpus.selectOptionId, - wpus.selectNum\s + wpus.selectNum FROM welfare_list vwl - LEFT join sys_user u on u.id = vwl.userId - left join sys_union gh on gh.id = vwl.welfareUnitId - left join sys_unit dw on dw.id = vwl.welfareSecondLevelUnitId - LEFT JOIN welfare_project_user_selection wpus ON wpus.selectUserId = vwl.userId\s - AND wpus.welfareId = @projectId\s + LEFT JOIN special_staff staff ON staff.userId = vwl.userId + LEFT JOIN sys_union staffUnion ON staff.unionRelationUnionId = staffUnion.id + LEFT JOIN sys_user u ON u.id = vwl.userId + LEFT JOIN sys_union gh ON gh.id = vwl.welfareUnitId + LEFT JOIN sys_unit dw ON dw.id = vwl.welfareSecondLevelUnitId + LEFT JOIN welfare_project_user_selection wpus ON wpus.selectUserId = vwl.userId + AND wpus.welfareId = @projectId WHERE projectId = @projectId - AND vwl.welfareUnitId = @unionId + AND (vwl.welfareUnitId = @unionId OR staffUnion.id = @unionId) order by vwl.welfareUnitId,vwl.welfareSecondLevelUnitId """); @@ -721,7 +722,9 @@ public class WelfareSingleServiceImpl extends ViServiceImpl impl exportEntities.add(new ExcelExportEntity("姓名", "username", 10)); exportEntities.add(new ExcelExportEntity("工号", "loginname", 15)); // exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 20)); - exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 20)); + ExcelExportEntity excelExportEntity1 = new ExcelExportEntity("所在单位", "unitname", 20); + excelExportEntity1.setWrap(true); + exportEntities.add(excelExportEntity1); for (NutMap option : options) { exportEntities.add(new ExcelExportEntity(option.getString("optionName"), option.getString("id"), 10)); @@ -729,10 +732,10 @@ public class WelfareSingleServiceImpl extends ViServiceImpl impl ExcelExportEntity excelExportEntity = new ExcelExportEntity(); excelExportEntity.setName("签字"); excelExportEntity.setKey("qzBytes"); - excelExportEntity.setHeight(20); + excelExportEntity.setHeight(12); excelExportEntity.setWidth(20); excelExportEntity.setType(2); - excelExportEntity.setExportImageType(1); + excelExportEntity.setExportImageType(2); exportEntities.add(excelExportEntity); List loginnames = list.stream().map(v -> v.getString("loginname")).distinct().collect(Collectors.toList()); @@ -770,18 +773,18 @@ public class WelfareSingleServiceImpl extends ViServiceImpl impl totalMap.put(option.getString("id"), selectNum); } dataList.add(totalMap); - ExportParams exportParams = new ExportParams(); + /*ExportParams exportParams = new ExportParams(); exportParams.setType(ExcelType.XSSF); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, dataList); - workbook.write(outputStream); - - /*Workbook workbook = new XSSFWorkbook(); - ExcelExportService service = new ExcelExportService(); - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); - service.createSheetForMap(workbook, exportParams, exportEntities, dataList); workbook.write(outputStream);*/ + Workbook workbook = new HSSFWorkbook(); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.HSSF); + ExcelExportService service = new ExcelExportService(); + service.createSheetForMap(workbook, exportParams, exportEntities, dataList); + workbook.write(outputStream); + // List result = new ArrayList<>(); // //查询这个福利下有哪些礼品 // WelfareProject welfareProject = dao().fetch(WelfareProject.class, projectId); @@ -1196,14 +1199,21 @@ public class WelfareSingleServiceImpl extends ViServiceImpl impl } }); ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); + exportParams.setType(ExcelType.HSSF); exportParams.setSheetName(project.getName()); try { - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList); - ViTool.excelResponse(response, (project.getName() + (flag ? "已选名单" : "未选名单")) + ".xlsx"); + ViTool.excelResponse(response, (project.getName() + (flag ? "已选名单" : "未选名单")) + ".xls"); + Workbook workbook = new HSSFWorkbook(); + ExcelExportService service = new ExcelExportService(); + service.createSheet(workbook, exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList); ServletOutputStream outputStream = response.getOutputStream(); workbook.write(outputStream); - outputStream.close(); + + +// Workbook workbook = ExcelExportUtil.exportExcel(exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList); +// ServletOutputStream outputStream = response.getOutputStream(); +// workbook.write(outputStream); +// outputStream.close(); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/resources/static/components/sign/sign.vue b/src/main/resources/static/components/sign/sign.vue index 6726ceb..f3078f3 100644 --- a/src/main/resources/static/components/sign/sign.vue +++ b/src/main/resources/static/components/sign/sign.vue @@ -81,8 +81,8 @@ module.exports = { clearInterval(signatureInterval) const ts = new Date().getTime() + (Math.floor(Math.random() * (1000 - 1 + 1)) + 1).toString() console.log(ts) - this.postAddress = location.protocol + '//' + location.host + '/signature?prefix=' + this.prefix + '&id=' + ts + "&is_value_base64=" + this.is_value_base64 - //this.postAddress = 'https://zhgh.hmc.edu.cn/signature?prefix=' + this.prefix + '&id=' + ts + "&is_value_base64=" + this.is_value_base64 + // this.postAddress = location.protocol + '//' + location.host + '/signature?prefix=' + this.prefix + '&id=' + ts + "&is_value_base64=" + this.is_value_base64 + this.postAddress = 'https://zhgh.hmc.edu.cn/signature?prefix=' + this.prefix + '&id=' + ts + "&is_value_base64=" + this.is_value_base64 this.showQrCode = true diff --git a/src/main/resources/views/platform/specialstaff/manage/index.html b/src/main/resources/views/platform/specialstaff/manage/index.html new file mode 100644 index 0000000..3840ad5 --- /dev/null +++ b/src/main/resources/views/platform/specialstaff/manage/index.html @@ -0,0 +1,482 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 关闭 + 提交 + + + + + +
+ + diff --git a/src/main/resources/views/platform/welfare/statistics/single.html b/src/main/resources/views/platform/welfare/statistics/single.html index 79dabbc..ffa0ff3 100644 --- a/src/main/resources/views/platform/welfare/statistics/single.html +++ b/src/main/resources/views/platform/welfare/statistics/single.html @@ -112,7 +112,7 @@ layout("/layouts/platform.html"){ type="primary">按品牌导出全部(蛋糕券) --> -