工会关系人员

This commit is contained in:
Paidax
2024-12-30 16:19:04 +08:00
parent b776b4ebe0
commit 6445645597
15 changed files with 1082 additions and 46 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
<commons-io.version>2.4</commons-io.version>
<jsoup.veision>1.12.1</jsoup.veision>
<poitl.version>1.9.1</poitl.version>
<easypoi.version>4.2.0</easypoi.version>
<easypoi.version>4.5.0</easypoi.version>
<jetty.version>9.4.47.v20220610</jetty.version>
</properties>
+4 -11
View File
@@ -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 = "";
}
@@ -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
* @nameSpecialStaffManageController
* @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<NutMap> list = specialStaffManageService.listMap(sql);
return Result.success(list);
}
}
@@ -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
* @nameSpecialStaff
* @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;
}
@@ -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
* @nameSpecialStaffPageForm
* @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;
}
@@ -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
* @nameSpecialStaffManageService
* @Date 2024/10/25 9:42
* @注释
*/
public interface SpecialStaffManageService extends BaseService<SpecialStaff> {
/**
* 分页查询
* @param pageForm
* @return
*/
Pagination pageData(SpecialStaffPageForm pageForm);
/**
* 获取用户信息(人事关系)
* @param userId 用户id
* @return
*/
NutMap getUserInfo(String userId);
/**
* 获取用户信息(特殊人员)
* @param userId 用户id
* @return
*/
NutMap getSpecialStaffUserInfo(String userId);
}
@@ -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
* @nameSpecialStaffManageServiceImpl
* @Date 2024/10/25 9:43
* @注释
*/
@IocBean(args = {"refer:dao"})
public class SpecialStaffManageServiceImpl extends BaseServiceImpl<SpecialStaff> 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();
}
}
@@ -0,0 +1,37 @@
package io.v.nutz.zhgh.specialstaff.vo;
import lombok.Data;
/**
* @version 1.0
* @Author zzr
* @nameSpecialStaffVo
* @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;
}
@@ -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);
@@ -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<NutMap> allUser = welfareSingleService.getUserByProjectId(projectId, month, unionGroupId);
// List<NutMap> 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();
}
@@ -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;
@@ -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<WelfareProject> 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<WelfareProject> 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<WelfareProject> 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<WelfareProject> 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<String> loginnames = list.stream().map(v -> v.getString("loginname")).distinct().collect(Collectors.toList());
@@ -770,18 +773,18 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> 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<NutMap> result = new ArrayList<>();
// //查询这个福利下有哪些礼品
// WelfareProject welfareProject = dao().fetch(WelfareProject.class, projectId);
@@ -1196,14 +1199,21 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> 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();
}
@@ -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
@@ -0,0 +1,482 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名/工号</div>
<div class="search-item-option">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"></el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会</div>
<div class="search-item-option">
<el-select @change="flushUnits" @clear="flushUnits" clearable filterable
placeholder="所属工会" style="width: 100%;" v-model="pageForm.unionId">
<el-option :key="item.id" :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位</div>
<div class="search-item-option">
<el-select clearable filterable placeholder="请选择" style="width: 100%"
v-model="pageForm.unitId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属类型</div>
<div class="search-item-option">
<dict-select v-model="pageForm.specialStaffType" placeholder="特别人员所属类型" @change="doSearch"
style="width: 100%" code="SPECIAL_STAFF_TYPE"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态</div>
<div class="search-item-option">
<dict-select v-model="pageForm.userState" placeholder="在职状态" @change="doSearch"
style="width: 100%" code="UserState"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">人员类型</div>
<div class="search-item-option">
<dict-select v-model="pageForm.personType" placeholder="人员类型" @change="doSearch"
style="width: 100%" code="UserType"></dict-select>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool :app="this" label="人员列表" ref="tableTool">
<template #func>
<el-button size="small" type="primary" @click="personnelAdd">新增人员</el-button>
</template>
</table-tool>
<el-table ref="table" :data="tableData" :size="tableSize" row-key="id"
style="width: 100%" @sort-change="pageOrder">
<el-table-column :index="indexMethod" header-align="center" label="序号" type="index" width="80px"></el-table-column>
<el-table-column v-for="column in tableColumns"
:key="column.prop"
:label="column.label"
:prop="column.prop"
:width="column.width"
:sortable="column.sortable"
header-align="center"
show-overflow-tooltip>
<template scope="{row}" v-if="column.prop==='personnelRelationUnionName'">
<el-tag effect="plain">
{{row.personnelRelationUnionName || '无工会'}}
</el-tag>
</template>
<template scope="{row}" v-else-if="column.prop==='unionRelationUnionName'">
<el-tag>
{{row.unionRelationUnionName || '无工会'}}
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" header-align="center" label="操作">
<template scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="el-icon-s-tools"></i>
<i class="el-icon-arrow-down"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:scope.row}">
查看
</el-dropdown-item>
<el-dropdown-item :command="{type:'edit',data:scope.row}">
编辑
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:scope.row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit_func>
<el-button v-if="!isView" style="width: 100px" type="primary" class="submit-btn" @click="doSubmit">提交</el-button>
</template>
<el-dialog :title="specialStaffTitle" :visible.sync="specialStaffDialog"
:close-on-click-modal="false" width="50%">
<el-form ref="form" :model="formData" :rules="formRules" label-width="145px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="工号" prop="userId">
<el-select v-model="formData.userId"
:remote-method="queryUser"
filterable
remote
:disabled="isView"
reserve-keyword
placeholder="请输入工号或者姓名查找"
style="width: 100%"
@change="getUserInfo">
<el-option v-for="item in users"
:key="item.id"
:label="item.username+'('+item.loginname+')' + '--' + (item.unionName || '无工会') + '('+item.unitName + ')'"
:value="item.id"></el-option>
</el-select>
<!-- <el-input v-model="formData.userName" :disabled="formData.userId!=null" placeholder="工号"></el-input>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名" prop="username">
<el-input v-model="formData.username" placeholder="请输入工号查询,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="所属单位(人事关系)" prop="personnelRelationUnitName">
<el-input v-model="formData.personnelRelationUnitName" placeholder="请输入工号或姓名查询,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属工会(人事关系)" prop="personnelRelationUnionName">
<el-input v-model="formData.personnelRelationUnionName" placeholder="请输入工号或姓名查询,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<template v-if="isThreeUnit">
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="所属科室(人事关系)" prop="personnelRelationThreeUnitName">
<el-input v-model="formData.personnelRelationThreeUnitName" placeholder="请输入工号或姓名查询,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工会小组(人事关系)" prop="personnelRelationUnionGroupName">
<el-input v-model="formData.personnelRelationUnionGroupName" placeholder="请输入工号或姓名查询,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
</template>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="特殊人员类型" prop="specialStaffType">
<dict-select v-model="formData.specialStaffType" placeholder="特别人员所属类型" @change="changeType"
style="width: 100%" :disabled="isView" code="SPECIAL_STAFF_TYPE"></dict-select>
</el-form-item>
</el-col>
</el-row>
<template v-if="formData.isManyUnit">
<el-row :gutter="10">
<el-col :span=12>
<el-form-item label="所属单位(工会关系)" prop="unionRelationUnitId">
<el-select
v-model="formData.unionRelationUnitId"
filterable
clearable
:disabled="isView"
placeholder="请选择工会关系单位"
style="width: 100%"
@change="unionRelationUnitChange">
<el-option v-for="unit in units" :key="unit.id"
:label="unit.name" :value="unit.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span=12>
<el-form-item label="所属工会(工会关系)" prop="unionRelationUnionName">
<el-input v-model="formData.unionRelationUnionName" placeholder="请选择工会关系单位查询,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<template v-if="isThreeUnit">
<el-row :gutter="10">
<el-col :span=12>
<el-form-item label="所属科室(工会关系)" prop="unionRelationThreeUnitId">
<el-select
v-model="formData.unionRelationThreeUnitId"
filterable
clearable
:disabled="isView"
placeholder="请选择工会关系所属科室"
style="width: 100%"
@change="unionRelationThreeUnitChange"
>
<el-option
v-for="unit in threeUnits"
:key="unit.id"
:label="unit.name"
:value="unit.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span=12>
<el-form-item label="工会小组(工会关系)" prop="unionRelationUnionGroupName">
<el-input :value="formData.unionRelationUnionGroupName" placeholder="请选择工会关系所属科室,查询后自动读取" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
</template>
</template>
<!-- 杭州医学院多单位人员 -->
<template v-if="formData.specialStaffType == 'HMC_RELATION'">
<el-row :gutter="10">
<el-col :span="24">
<el-form-item label="所属工会(工会关系)" prop="unionRelationUnionId">
<el-select v-model="formData.unionRelationUnionId" filterable
:disabled="isView" @change="unionRelationUnionChange"
clearable placeholder="请选择工会关系所属工会" style="width: 100%">
<el-option v-for="item in unionRelationUnionOptions" :key="item.id"
:label="item.unionname" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</template>
<el-row :gutter="10">
<el-col :span=24>
<el-form-item label="备注" prop="specialStaffRemark">
<el-input type="textarea" :rows="3" placeholder="请输入人员备注"
v-model="formData.specialStaffRemark" maxlength="200" show-word-limit></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row v-if="!isView" :gutter="10" style="text-align: right">
<el-button class="submit-btn" @click="specialStaffDialog = false">关闭</el-button>
<el-button class="submit-btn" @click="doSubmit" type="primary">提交</el-button>
</el-row>
</el-dialog>
</guava>
</div>
<script>
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return{
isView: true,
isThreeUnit: false,
tableColumns: [
{ prop: 'loginname', label: '工号' },
{ prop: 'username', label: '姓名' },
{ prop: 'sex', label: '性别' },
{ prop: 'mobile', label: '联系电话' },
{ prop: 'personType', label: '人员类型', sortable: true },
{ prop: 'userState', label: '在职状态', sortable: true },
{ prop: 'personnelRelationUnionName', label: '人事关系工会', sortable: true, width: 150 },
{ prop: 'personnelRelationUnitName', label: '人事关系单位', sortable: true },
{ prop: 'unionRelationUnionName', label: '工会关系工会', sortable: true, width: 150 },
{ prop: 'distSpecialStaffType', label: '特别人员类型', sortable: true },
// { prop: 'specialStaffRemark', label: '多单位人员备注', sortable: true, checked: 0 }
],
unions: [],
units: [],
threeUnits: [],
formData: {
personnelRelationThreeUnitName: '',
personnelRelationUnionGroupName: '',
},
specialStaffTypeList: [],
users: [],
formRules: {
userId: [{ required: true, message: "请输入工号", trigger: "change" }],
specialStaffType: [{ required: true, message: "请选择人员类型", trigger: "change" }],
unionRelationUnionId: [{ required: true, message: "请选择工会关系所属工会", trigger: "change" }],
specialStaffRemark: [{ required: true, message: "请填写多单位人员备注", trigger: "change" }]
},
specialStaffDialog: false,
specialStaffTitle: '',
// HMC工会关系工会
unionRelationUnionOptions: []
}
},
methods: {
unionRelationUnionChange(val){
const unionInfo = this.unionRelationUnionOptions.find(v=> v.id === val)
this.formData.unionRelationUnionName = unionInfo.unionname
},
dropdownCommand(command) {
const { type, data } = command
if (type === 'view') {
this.openView(data.userId)
} else if (type === 'edit') {
this.openEdit(data.userId)
} else if (type === 'delete') {
this.doDelete(data)
}
},
doDelete(obj) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post('/platform/staff/special/manage/removeSpecialStaff', {userId:obj.userId}).then(res => {
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
}
})
})
},
openEdit(userId) {
this.isView = false
this.formData = {}
this.getUserInfo(userId)
// this.$refs.guava.edit()
this.specialStaffDialog = true
this.specialStaffTitle = "修改人员"
},
openView(userId) {
this.isView = true
this.formData = {}
this.getUserInfo(userId)
// this.$refs.guava.edit()
this.specialStaffDialog = true
this.specialStaffTitle = "查看人员信息"
},
personnelAdd() {
this.isView = false
this.formData = {}
// this.$refs.guava.edit()
this.specialStaffDialog = true
this.specialStaffTitle = "新增人员"
},
getUserInfo(id) {
if (!id && !this.formData.userId) {
return
}
const url = !this.formData.userId
? "/platform/staff/special/manage/getSpecialStaffUserInfo"
: "/platform/staff/special/manage/getUserInfo"
const param = id ? id : this.formData.userId
$.post(url, { userId: param }).then((resp) => {
if (resp.code === 0) {
this.formData = resp.data
if (resp.data && resp.data.unionRelationThreeUnitId) {
this.getThreeUnits(resp.data.unionRelationUnitId)
}
this.queryUser(this.formData.loginname)
}
})
},
changeType() {
const data = this.specialStaffTypeList.find((v) => v.code === this.formData.specialStaffType)
if (data && data.code === "MANY_UNIT") {
this.formData.isManyUnit = true
}
},
unionRelationUnitChange(v) {
this.$set(this.formData, 'unionRelationThreeUnitId', null)
this.$set(this.formData, 'unionRelationUnionGroupName', null)
this.threeUnits = []
if (v) {
this.getThreeUnits(v)
}
const unit = this.units.find((item) => item.id === v)
if (unit) {
this.$set(this.formData, "unionRelationUnitId", unit.id)
this.$set(this.formData, "unionRelationUnitName", unit.name)
this.$set(this.formData, "unionRelationUnionId", unit.unionid)
this.$set(this.formData, "unionRelationUnionName", unit.unionname)
} else {
this.$set(this.formData, "unionRelationUnionId", null)
this.$set(this.formData, "unionRelationUnionName", null)
}
},
unionRelationThreeUnitChange(val) {
if (val) {
const threeUnit = this.threeUnits.find(v => v.id === val)
const groupName = threeUnit.groupname ? threeUnit.groupname : null
this.$set(this.formData, 'unionRelationThreeUnitId', threeUnit.id)
this.$set(this.formData, 'unionRelationThreeUnitName', threeUnit.name)
this.$set(this.formData, 'unionRelationUnionGroupId', threeUnit.uniongroupid)
this.$set(this.formData, 'unionRelationUnionGroupName', groupName)
} else {
this.$set(this.formData, 'unionRelationUnionGroupName', null)
}
},
async getThreeUnits(val) {
this.threeUnits = await threeUnitsByUnionGroupOrUnitId(val)
},
queryUser(keyWord) {
if (!keyWord) {
return
}
$.post("/platform/staff/special/manage/queryUser", { keyWord }).then((res) => {
this.users = res.data
})
},
doSubmit() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
$.post("/platform/staff/special/manage/addSpecialStaff", {
data: JSON.stringify(this.formData)
})
.then((resp) => {
if (resp.code === 0) {
this.$message.success(resp.msg)
this.formData = {}
this.specialStaffDialog = false
this.pageData()
// this.$refs.guava.index()
}
})
}
})
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
this.units = []
if (this.pageForm.unionId) {
this.unions = await getUnions()
}
},
async initData() {
// if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}") {
// this.unions = await getUnions(this.pageForm.unionId)
// this.units = await getUnits()
// } else {
// const unionId = "${@shiro.getPrincipalProperty('unit').getUnionid()}"
// this.unions = await getUnions(unionId)
// this.units = await this.getUnits(unionId)
// }
this.unionRelationUnionOptions = await getUnions()
this.specialStaffTypeList = await getDictByCode('SPECIAL_STAFF_TYPE')
},
},
async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
this.initData()
this.pageData()
},
});
</script>
<!--#
}
#-->
@@ -112,7 +112,7 @@ layout("/layouts/platform.html"){
type="primary">按品牌导出全部(蛋糕券)
</el-button>-->
<template v-if="judgmentAuthority || ${@shiro.hasRole('H04') || @shiro.hasRole('gh12')}">
<template v-if="judgmentAuthority || ${@shiro.hasRole('H04') || @shiro.hasRole('gh01') || @shiro.hasRole('gh12')}">
<el-button :disabled="!pageForm.projectId"
@click="exportReceiveDetail(true)"
icon="el-icon-printer"