This commit is contained in:
Paidax
2025-04-23 16:36:50 +08:00
parent 04bd746a5f
commit 9349eddf5d
74 changed files with 5029 additions and 1344 deletions
@@ -36,7 +36,9 @@ public class WxHttpUtil {
private final MediaType formData = MediaType.parse("multipart/form-data");
private final NutMap jsonHeader = NutMap.NEW().setv("Content-Type", "application/json");
public static String env = "jiangnan-7g769v4nce8a4fd2";
public String env = "hj-2ggpsf3t8a32c4eb";
public String queryUrl = "https://api.weixin.qq.com/tcb/databasequery?access_token=ACCESS_TOKEN";
@@ -19,36 +19,28 @@ import java.util.HashMap;
* @date 2024/01/15
*/
@IocBean
@Slf4j
public class WxTokenUtil {
private static final Log log = Logs.get();
@Inject
private RedisService redisService;
private static final String APPID = "wxffb8d1c4eef5da73";
private final String APPID = "wx2efb6a8555f1c030";
private static final String APP_SECRET = "393e63d77631af9b883c1f1e116d41d3";
private final String APPSECRET = "3039135e9fe0882259db8822b9be5d6c";
private String getTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
/**
* 获取token
*
* @return {@link String}
*/
private final String TOKEN_KEY = "weapp_access_token";
public String getAccessToken() {
String token = redisService.get(RedisConstant.REDIS_KEY_WE_APP_ACCESS_TOKEN);
if (StrUtil.isNotBlank(token)) {
return token;
}
String url = getTokenUrl.replace("APPID", APPID).replace("APPSECRET", APP_SECRET);
String url = getTokenUrl.replace("APPID", APPID).replace("APPSECRET", APPSECRET);
String result = Http.get(url).getContent();
HashMap<String, Object> tokenObject = Json.fromJson(HashMap.class, result);
if (tokenObject.containsKey("errcode")) {
log.error("获取token失败------" + tokenObject.get("errmsg"));
throw new RuntimeException("获取token失败------" + tokenObject.get("errmsg"));
}
redisService.setex(RedisConstant.REDIS_KEY_WE_APP_ACCESS_TOKEN, 7200 - 200, (String) tokenObject.get("access_token"));
return (String) tokenObject.get("access_token");
}
@@ -281,54 +281,4 @@ public class SysLoginController {
}
}
@At(value = "/platform/jsz/login",top = true)
public Object index(String username, String loginname) {
try {
Sql sql = Sqls.create("""
SELECT
u.id userid,
u.username,
u.loginname,
u.sex,
u.mobile,
u.birthday,
unit.`name` unitname,
u.unitid,
u.member,
unit.unionid,
un.unionname,
group_concat(sr.`code`) roles,
'$schoolCode' as schoolCode
FROM
sys_user u
LEFT JOIN sys_unit unit ON u.unitid = unit.id
LEFT JOIN sys_union un ON unit.unionid = un.id
LEFT JOIN sys_user_role sur ON sur.userId = u.id
LEFT JOIN sys_role sr ON sr.id = sur.roleId
$condition
""").setParam("loginname", loginname).setParam("username", username);
sql.setVar("schoolCode", Globals.schoolCode);
Cnd cnd = Cnd.NEW();
// cnd.and("LOWER(u.loginname)", "=", loginname.trim().toLowerCase());
cnd.and(Cnd.exps("LOWER(u.loginname)", "=", loginname.trim().toLowerCase()).or("LOWER(u.mobile)", "=", loginname.trim().toLowerCase()));
cnd.and("LOWER(u.username)", "=", username.trim().toLowerCase());
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.map());
sysUserService.dao().execute(sql);
NutMap user = (NutMap) sql.getResult();
if (StrUtil.isBlank(user.getString("userid"))) {
return cn.wizzer.framework.base.Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
}
// if(user.getInt("member",0)==0){
// return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
// }
/*if (user.getInt("member", 0) != 1 && !user.getString("sex", "").equals("女")) {
return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
}*/
return cn.wizzer.framework.base.Result.success().addData(user);
} catch (Exception e) {
return cn.wizzer.framework.base.Result.error();
}
}
}
@@ -266,6 +266,7 @@ public class Sys_user extends BaseModel implements Serializable {
@Column
@Comment("会员加入时间")
@ColDefine(type = ColType.DATETIME)
private Date memberJoinTime;
/**
@@ -53,15 +53,16 @@ public class Globals {
//项目短名称
public static String AppShrotName = "";
//项目域名 (设置一个默认的 为优先级考虑)
public static String AppDomain = "https://zhgh.hmc.edu.cn";
public static String AppDomain = "https://zhgh.ecjtu.edu.cn";
// public static String AppDomain = "http://172.16.11.80";
//cas地址
public static String CasAddress = "https://newca.hmc.edu.cn/cas";
public static String CasAddress = "http://cas.ecjtu.edu.cn/cas";
//文件访问域名
public static String AppFileDomain = "";
//文件上传路径
public static String AppUploadBase = "";
//学校代码
public static String schoolCode = "zufe";
public static String schoolCode = "ecjtu";
//系统自定义参数
public static NutMap MyConfig = NutMap.NEW();
//自定义路由
@@ -69,7 +70,7 @@ public class Globals {
//微信map
public static NutMap WxMap = NutMap.NEW();
//高校名称
public static String schoolName = "杭州医学院";
public static String schoolName = "华东交通大学";
public static String BrandActivityName = "";
@@ -74,21 +74,7 @@ public class NutShiroProcessor extends AbstractProcessor {
"/platform/home/(500|403|404|UnknownAccountError|LockedAccountError)",
"/mobile/login",
"/mobile/login/doLogin",
"/platform/jsz/login",
"/platform/activity/basic/scope/getScopeUser",
"/platform/fitnessWalk/stepManage/getActivityDateStep",
"/platform/fitnessWalk/stepManage/winningRecord",
"/platform/fitnessWalk/stepManage/updateStepMonth",
"/platform/fitnessWalk/stepRanking/getUserStepRanking",
"/platform/fitnessWalk/stepManage/getActivityQualifyProgressBar",
"/platform/fitnessWalk/stepWining/getUserStepWining",
"/platform/fitnessWalk/punchLottery/judgeWinningToPunch",
"/platform/fitnessWalk/punchLottery/getLotteryRecord",
"/platform/fitnessWalk/punchLottery/doExchange",
"/platform/fitnessWalk/punchLottery/getPunchWining",
"/platform/fitnessWalk/punchLottery/doReadLottery",
"/platform/fitnessWalk/stepWining/prizeOption",
"/platform/fitnessWalk/stepWining/prizeUsers"
"/platform/jsz/login"
);
if (Arrays.stream(authIgnoreUrlArr).noneMatch(v -> Pattern.compile(v).matcher(requestURI).matches())) {
if (match) {
@@ -1,19 +1,26 @@
package io.v.nutz.zhgh.data.constant;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.v.nutz.base.expression.Exp4;
import io.v.nutz.sys.models.Sys_unit;
import io.v.nutz.zhgh.data.model.UserSource;
import org.apache.http.client.utils.URIBuilder;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.springframework.util.Assert;
import wiremock.org.apache.commons.codec.binary.Base64;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
/**
* 获取源数据配置
@@ -25,83 +32,61 @@ import java.util.Map;
*/
public interface SourceData {
/**
* 获取单位的地址
*/
String DATA_URL = "https://zt.hmc.edu.cn/datacenter/dataServiceQuery";
//加密算法
String SIGNATURE_METHOD = "HmacSHA256";
//私钥
String PRIVATE_SECRET = "7lootinws7rm5ifhinvm6b2twgbakwtt ";
//公钥
String PUBLIC_SECRET = "5yxqtb49f8yztg22sadu5n24zobb9qfw";
String URL = "http://172.16.12.92:8020/exchange/api/requestHttp";
/**
* 断言是否成功
*
* @param jsonResult 接口返回数据
*/
private static void checkSuccess(NutMap jsonResult) {
// Assert.isTrue(jsonResult.getBoolean("success"), jsonResult.getString("data"));
private static void checkSuccess(JSONObject jsonResult) {
Assert.isTrue(jsonResult.getInteger("code") == 200, jsonResult.getString("message"));
}
/**
* 不进系统人员类型
*/
List<String> NOT_ENTERING_PERSON_TYPE = List.of("退休人员", "兼职教师", "非全日用工(项目临聘)", "服务外包和其他人员",
"教学编制2", "教学教师(附属医院)", "教学编制", "离休人员", "临时人员", "非全日制工", "博士后(在职)");
/**
* 不进系统在职状态
* 01 退休
* 05 调出
* 06 辞职
* 07 离职
* @see io.v.nutz.zhgh.data.constant.HMCFieldCode#USER_STATE_CODE
*/
List<String> NOT_ENTERING_USER_STATE = List.of("01", "05", "06", "07");
Map<String, String> sexCode = new HashMap<>() {{
put("0", "未知的性别");
put("1", "男");
put("2", "女");
put("9", "未说明的性别");
}};
List<String> NOT_ENTERING_USER_LOGIN_NAME = List.of("2020000410", "2008000010");
/**
* 接口中的数据跟SourceUser的对应关系
* <p>
* SourceUser [username,loginname]
* Result [name,code]
* <p>
* 例:{'name':['username'],'code':['loginname']}
*/
Map<String, String[]> USER_FIELD_RELATION = new HashMap() {{
put("GH", new String[]{"loginname"}); // 工号
put("XM", new String[]{"username"}); // 姓名
put("XBM", new String[]{"sex"});// 性别码
put("MZMC", new String[]{"nation"});// 民族码
put("SJ", new String[]{"mobile"}); // 手机号
put("ZZMMM", new String[]{"political"}); // 政治面貌码
put("DQZTM", new String[]{"userState"}); // 在职状态码
put("RYFLMC", new String[]{"personType"}); // 人员类型码
put("ZGXLM", new String[]{"education"}); // 最高学历码
put("ZGXWM", new String[]{"academicDegree"}); // 最高学位码
put("DWH", new String[]{"unitid"}); // 单位id
put("CSRQ", new String[]{"birthday"}); // 出生日期
put("DZZWMC", new String[]{"position"}); // 党政职务
put("XQMC", new String[]{"campus"}); // 校区
put("DZZWJBM", new String[]{"administrativeLevel"}); // 行政职务级别
put("ZYJSZWDJ", new String[]{"professionalTechnicalLevel"}); // 专业技术等级
put("JZGLBM", new String[]{"userCategory"}); // 教职工类别
put("GWLBM", new String[]{"jobCategory"}); // 岗位类别
put("gh", new String[]{"loginname"});//工号
put("dwh", new String[]{"unitid"});//所在单位编码
put("xm", new String[]{"username"});//姓名
put("xb", new String[]{"sex"});//性别码
put("CSRQ", new String[]{"birthday"});//出生日期
put("jg", new String[]{"hometown"});//籍贯
put("mz", new String[]{"nation"});//民族
put("sfzjh", new String[]{"idcard"});//身份证件号
put("sfzjlx", new String[]{"idType"});//身份证件有效期
put("zzmmmc", new String[]{"political"});//政治面貌码
put("cjgzny", new String[]{"workStartDate"});//参加工作年月
put("rylb", new String[]{"personType"});//教职工类别码
put("ryzt", new String[]{"userState"});//教职工当前状态码
put("ZGXLM", new String[]{"education"});//最高学历码
put("lxdh", new String[]{"mobile"});//移动电话
put("dzyx", new String[]{"email"});//电子邮箱
}};
/**
* 字段插件
*/
Map<String, Exp4> USER_FIELD_PLUGIN = new HashMap<String, Exp4>() {{
// put("ZZZTMC", v -> Strings.sBlank(USER_STATE_CODE.get(v), ""));
put("XBM", v -> Strings.sBlank(HMCFieldCode.SEX_CODE.get(v), ""));
put("ZZMMM", v -> Strings.sBlank(HMCFieldCode.POLITICAL_CODE.get(v), ""));
put("DQZTM", v -> Strings.sBlank(HMCFieldCode.USER_STATE_CODE.get(v), ""));
put("ZGXLM", v -> Strings.sBlank(HMCFieldCode.EDUCATION_CODE.get(v), ""));
put("ZGXWM", v -> Strings.sBlank(HMCFieldCode.ACADEMIC_DEGREE_CODE.get(v), ""));
put("XQMC", v -> Strings.sBlank(HMCFieldCode.CAMPUS_CODE.get(v), ""));
put("DZZWJBM", v -> Strings.sBlank(HMCFieldCode.ADMINISTRATIVE_LEVEL_CODE.get(v), ""));
put("ZYJSZWDJ", v -> Strings.sBlank(HMCFieldCode.PROFESSIONAL_TECHNICAL_LEVEL_CODE.get(v), ""));
put("JZGLBM", v -> Strings.sBlank(HMCFieldCode.USER_CATEGORY.get(v), ""));
put("GWLBM", v -> Strings.sBlank(HMCFieldCode.JOB_CATEGORY.get(v), ""));
}};
/**
* 获取源用户数据
*
@@ -109,25 +94,20 @@ public interface SourceData {
*/
static List<UserSource> users() {
List<UserSource> users = new ArrayList<>();
int page = 1;
String apiAuthUserCode = "SJK2023112916218839";
int pageNo = 1;
int pageSize = 100;
boolean hasRecords = true;
int maxPage;
while (hasRecords) {
String body = HttpUtil.createPost(DATA_URL).body(JSON.toJSONString(new NutMap().addv("address", "jzgjbxx").addv("params", new NutMap())
.addv("token", "3318a5a9-c2f2-4c8b-a8ea-e99dd68c165c").addv("pageIndex", page).addv("pageSize", 500))).execute().body();
NutMap map = Json.fromJson(NutMap.class, body);
// checkSuccess(map);
List<NutMap> data = map.getAsList("data", NutMap.class);
for (NutMap row : data) {
// if (NOT_ENTERING_PERSON_TYPE.contains(row.getString("RYFLMC"))
// || NOT_ENTERING_USER_LOGIN_NAME.contains(row.getString("GH"))
// || NOT_ENTERING_USER_STATE.contains(row.getString("DQZTM"))) {
// continue;
// }
Map entity = new HashMap(500);
HttpRequest httpRequest = getData(apiAuthUserCode, pageNo, pageSize);
JSONObject jsonObject = JSON.parseObject(httpRequest.execute().body());
checkSuccess(jsonObject);
List<JSONObject> data = jsonObject.getJSONObject("data").getJSONArray("lists").toJavaList(JSONObject.class);
for (JSONObject row : data) {
Map entity = new HashMap(10);
row.forEach((k, v) -> {
if (USER_FIELD_RELATION.containsKey(k)) {
if(USER_FIELD_RELATION.containsKey(k)) {
Object value = v;
if (USER_FIELD_PLUGIN.containsKey(k)) {
value = USER_FIELD_PLUGIN.get(k).run(v);
@@ -139,10 +119,9 @@ public interface SourceData {
});
users.add(BeanUtil.mapToBean(entity, UserSource.class, true));
}
int totalCount = map.getInt("totalCount");
maxPage = (int) Math.ceil((double) totalCount / 500);
page++;
if (page > maxPage) {
pageNo++;
int totalPage = (int) Math.ceil((double) jsonObject.getJSONObject("data").getInteger("totalCount") / pageSize);
if (pageNo > totalPage) {
hasRecords = false;
}
}
@@ -153,10 +132,9 @@ public interface SourceData {
* 单位对应接口字段
*/
Map<String, String[]> UNIT_FIELD_RELATION = new HashMap() {{
put("DWH", new String[]{"id", "unitcode"});
put("DWMC", new String[]{"name"});
put("SJDWH", new String[]{"parentId"});
put("PX", new String[]{"location"});
put("dwh", new String[]{"id", "unitcode"});
put("dwmc", new String[]{"name"});
put("lsdwh", new String[]{"parentId"});
}};
/**
@@ -172,31 +150,108 @@ public interface SourceData {
*/
static List<Sys_unit> units() {
List<Sys_unit> units = new ArrayList<>();
int page = 1;
String body = HttpUtil.createPost(DATA_URL).body(JSON.toJSONString(new NutMap().addv("address", "rsxt_dwjbsj").addv("params", new NutMap())
.addv("token", "3318a5a9-c2f2-4c8b-a8ea-e99dd68c165c").addv("pageIndex", page).addv("pageSize", 100))).execute().body();
// String body = HttpUtil.get(DATA_URL, new NutMap().addv("address", "rsxt_dwjbsj").addv("params", new NutMap())
// .addv("token", "3318a5a9-c2f2-4c8b-a8ea-e99dd68c165c").addv("pageIndex", page).addv("pageSize", 1000));
NutMap map = Json.fromJson(NutMap.class, body);
// checkSuccess(map);
List<NutMap> data = map.getAsList("data", NutMap.class);
for (NutMap row : data) {
Map entity = new HashMap(5);
row.forEach((k, v) -> {
if (UNIT_FIELD_RELATION.containsKey(k)) {
Object value = v;
/* if (UNIT_FIELD_PLUGIN.containsKey(k)) {
value = UNIT_FIELD_PLUGIN.get(k).run(v);
}*/
for (String key : UNIT_FIELD_RELATION.get(k)) {
entity.put(key, value);
}
String apiAuthUnitCode = "SJK2023112915232278";
int pageNo = 1;
int pageSize = 100;
boolean hasRecords = true;
while (hasRecords) {
HttpRequest httpRequest = getData(apiAuthUnitCode,pageNo,pageSize);
JSONObject jsonObject = JSON.parseObject(httpRequest.execute().body());
checkSuccess(jsonObject);
List<JSONObject> data = jsonObject.getJSONObject("data").getJSONArray("lists").toJavaList(JSONObject.class);
for (JSONObject row : data) {
if ("1".equals(row.getString("sfcxm"))){
continue;
}
});
units.add(BeanUtil.mapToBean(entity, Sys_unit.class, true));
Map entity = new HashMap(5);
row.forEach((k, v) -> {
if(UNIT_FIELD_RELATION.containsKey(k)) {
Object value = v;
if (UNIT_FIELD_PLUGIN.containsKey(k)) {
value = UNIT_FIELD_PLUGIN.get(k).run(v);
}
for (String key : UNIT_FIELD_RELATION.get(k)) {
entity.put(key, value);
}
}
});
units.add(BeanUtil.mapToBean(entity, Sys_unit.class, true));
}
pageNo++;
int totalPage = (int) Math.ceil((double) jsonObject.getJSONObject("data").getInteger("totalCount") / pageSize);
if (pageNo > totalPage) {
hasRecords = false;
}
}
return units;
}
/**
* 获取InputStreamReader
*
* @param codePath
* @return
*/
static InputStreamReader getIsReaderByCodePath(String codePath) {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(codePath);
return new InputStreamReader(is);
}
/**
* 华交通过签名获取单位、人员数据
*
* @param apiAuthCode
* @return
*/
private static HttpRequest getData(String apiAuthCode,Integer pageNo,Integer pageSize){
NutMap header = new NutMap();
header.put("Accept", "application/json");
header.put("Content-Type", "application/json;charset=utf-8");
header.put("Date", String.valueOf(new Date()));
header.put("x-ca-key", PUBLIC_SECRET);
header.put("x-ca-signature-method", SIGNATURE_METHOD);
header.put("x-ca-timestamp", String.valueOf(System.currentTimeMillis()));
HttpRequest httpRequest = HttpUtil.createPost(URL);
header.forEach((k, v) -> {
httpRequest.header(k, (String) v);
});
try {
StringBuffer signatureStrBuffer = new StringBuffer();
signatureStrBuffer.append(httpRequest.getMethod().name().toUpperCase()).append("\n")
.append(header.get("Accept")).append("\n")
.append(header.get("Content-Type")).append("\n")
.append(header.get("Date")).append("\n")
.append("x-ca-key").append(":").append(PUBLIC_SECRET).append("\n")
.append("x-ca-signature-method").append(":").append(SIGNATURE_METHOD).append("\n")
.append("x-ca-timestamp").append(":").append(header.get("x-ca-timestamp")).append("\n")
.append(new URIBuilder(URL).getPath());
// 签名字符串
String signatureStr = signatureStrBuffer.toString();
Mac hmac = Mac.getInstance(SIGNATURE_METHOD);
byte[] keyBytes = PUBLIC_SECRET.getBytes("UTF-8");
hmac.init(new SecretKeySpec(PRIVATE_SECRET.getBytes("UTF-8"), 0, keyBytes.length, SIGNATURE_METHOD));
byte[] md5Result = hmac.doFinal(signatureStr.getBytes("UTF-8"));
String sign = Base64.encodeBase64String(md5Result);
//将签名添加到请求头x-ca-signature
httpRequest.header("x-ca-signature", sign);
NutMap parameter = new NutMap();
parameter.put("apiAuthCode", apiAuthCode);
parameter.put("pageNo", pageNo);
parameter.put("pageSize", pageSize);
httpRequest.body(JSONUtil.toJsonStr(parameter));
return httpRequest;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
@@ -72,9 +72,9 @@ public class SourceUserController {
CndPlus cnd = CndPlus.create();
cnd.and(pageForm);
cnd.andEx("unitid", "=", unitId);
cnd.andEx("personType", "=", personType);
cnd.andEx("userState", "=", userState);
cnd.andEX("unitid", "=", unitId);
cnd.andEX("personType", "=", personType);
cnd.andEX("userState", "=", userState);
if(!StringUtils.isEmpty(importDate)){
cnd.and("DATE(u.pullTime)", "=", importDate);
@@ -3,6 +3,7 @@ package io.v.nutz.zhgh.data.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.ViResource;
@@ -77,12 +78,14 @@ public class UpdateUserController {
CndPlus cnd = CndPlus.create();
cnd.and(pageForm);
cnd.andEx("u.unitid", "=", unitId);
cnd.andEx("u.personType", "=", personType);
cnd.andEx("u.userState", "=", userState);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEx("Date(his.changeTime)", "=", changeDate);
cnd.andEx("his.changeType", "=", changeType);
if (StrUtil.isNotBlank(changeDate)) {
cnd.and("DATE(his.changeTime)", "=", changeDate);
}
cnd.andEX("his.changeType", "=", changeType);
sql.setCondition(cnd);
@@ -0,0 +1,60 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.base.Globals;
import org.nutz.dao.Cnd;
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 java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@IocBean
@At("/platform/jsz/cxtj/union")
@Ok("json:full")
public class JszUniontjController {
@Inject
private WxHttpUtil wxHttpUtil;
@Inject
private BaseService baseService;
@At("")
@Ok("re")
public String index(){
return "beetl:/platform/jsz/cxtj/hdunion.html";
}
@At
public Object getAllUnion(){
return Result.success().addData(baseService.dao().query("sys_union", Cnd.NEW()));
}
@At
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param("hdid") String hdid){
//hdid="65825b355f562cf500f37a2667b36e3c";
Map<String,Object> reqBody = new HashMap<String,Object>();
reqBody.put("activity_id", hdid);
reqBody.put("schoolCode", Globals.schoolCode);
try {
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getBmInfo", reqBody);
NutMap resp_data = result.getAs("resp_data", NutMap.class);
return Result.success().addData(resp_data);
} catch (IOException e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,42 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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;
@IocBean
@At("/platform/jsz/cxtj/phbtj")
@Ok("json:full")
public class JszptphbController {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("re")
@RequiresPermissions("jsz.cxtj.phbtj")
public String index(){
return "beetl:/platform/jsz/cxtj/phb.html";
}
@At
@RequiresPermissions("jsz.cxtj.phbtj")
public Object data(){
try {
NutMap rankAll = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "rankAll", NutMap.NEW().addv("schoolCode", Globals.schoolCode));
return Result.success().addData(rankAll);
// List<NutMap> yearlist = yearMap.getAs("resp_data", NutMap.class).getAs("data", NutMap.class).getAsList("list", NutMap.class);
// return Result.success().addData(NutMap.NEW().addv("daylist",daylist).addv("weeklist",weeklist)
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,97 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 java.util.Map;
/**
* @Author JyuHsin
* @Date 2022/9/7
* @Description 排行榜
*/
@At("/jsz/leaderboard")
@Ok("json:full")
@IocBean
public class LeaderboardController {
@Inject
private JszWxStepService jszWxStepService;
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("re")
@RequiresPermissions("jsz.cxtj.leaderboard")
public String index() {
return "beetl:/platform/jsz/cxtj/leaderboard.html";
}
/**
* 获取排行榜数据
*
* @param hdid: 活动id
* @param type: 0-当日榜 1-累计排行榜 2-当日中奖榜
* @return java.lang.Object
* @author JyuHsin
* @date 2022/9/7
*/
@At
@ViReturn
@RequiresPermissions("jsz.cxtj.leaderboard")
public Object getData(@Param(value = "hdid",required = false) String hdid,
@Param(value = "type",required = false) Integer type,
@Param(value = "userId",required = false) String userId) {
if (type == null) {
return Result.error("参数错误");
}
switch (type) {
case 0:
case 1:
return jszWxStepService.getDataOfLeaderboard(hdid, type, userId, "", "", "", "");
case 2:
return jszWxStepService.getDataOfPrize(hdid, "", "", "", "");
default:
break;
}
return null;
}
@At
@ViReturn
@RequiresPermissions("jsz.cxtj.leaderboard")
public Object pageData(@Param(value = "hdid",required = false) String hdid,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId) {
if (StrUtil.isBlank(hdid)) {
return Result.error("参数错误!");
}
String userId = ShiroUtil.getPrincipalProperty("id").toString();
Object today = jszWxStepService.getDataOfLeaderboard(hdid, 0, userId, unionId, unitId, searchName, searchKeyword);
Object summary = jszWxStepService.getDataOfLeaderboard(hdid, 1, userId, unionId, unitId, searchName, searchKeyword);
Object yesterday = jszWxStepService.getDataOfPrize(hdid, unionId, unitId, searchName, searchKeyword);
NutMap map = NutMap.NEW();
map.put("today", Map.of("list", today));
map.put("summary", Map.of("list", summary));
map.put("yesterday", Map.of("list", yesterday));
return map;
}
}
@@ -0,0 +1,739 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
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.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.services.SysUnionService;
import lombok.Data;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;
/**
* @Author: 1V
* @DateTime: 2020/9/19 14:55
* @Description: 工会报名参与信息
*/
@At("/platform/jsz/union/registerInfo")
@Ok("json:full")
@IocBean
@RequiresAuthentication
public class UnionRegisterInfoCon {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("beetl:/platform/jsz/cxtj/unionRegisterInfo.html")
@RequiresPermissions("jsz.union.registerInfo")
public void index() {
}
@Inject
private SysUnionService sysUnionService;
@At
@ViReturn
@RequiresPermissions("jsz.union.registerInfo")
public Object getData(String activity_id, @Param("activity_tag[]") String[] activity_tag) throws IOException {
return data(activity_id, activity_tag);
}
private List data(String activity_id, String[] activity_tag) throws IOException {
List<Sys_union> unions = sysUnionService.query();
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("unions", unions);
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", activity_tag);
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getRegisterInfo", reqBody);
List resp_data = result.getAs("resp_data", List.class);
return resp_data;
}
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void exportAllUnionData(String activity_id, String activity_name, String activity_tag, HttpServletResponse response) throws IOException {
try {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity_name + "院级工会报名统计表.xls").getBytes("utf-8"), "ISO8859-1"));
ArrayList<E> list = new ArrayList<>();
List data = data(activity_id, activity_tag.split(","));
data.forEach(val -> {
Map v = (Map) val;
E e = new E();
e.setName((String) v.get("unionname"));
e.setReg_num((Integer) v.get("reg_num"));
e.setSign_num((Integer) v.get("sign_num"));
list.add(e);
});
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), E.class, list);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
@At
@RequiresPermissions("jsz.union.registerInfo")
public void regExport(String activity_id, String activity_tag, String unionname, String unionid, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((unionname + "报名名单.xls").getBytes("utf-8"), "ISO8859-1"));
Map<String, Object> reqBody = new HashMap<String, Object>();
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
reqBody.put("unionid", unionid);
// NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getRegisterUsers", reqBody);
// List data = result.getAs("resp_data", List.class);
Integer pageSize = 20;
Integer pageNum = 1;
List<Map> allRegister = new ArrayList<>();
List<Map> oneData = getAllRegister(unionid, activity_id, activity_tag, pageNum, pageSize);
while (oneData.size() > 0) {
allRegister.addAll(oneData);
pageNum++;
oneData = getAllRegister(unionid, activity_id, activity_tag, pageNum, pageSize);
}
System.out.println(allRegister);
ArrayList<RegE> list = new ArrayList<>();
allRegister.forEach(v -> {
RegE e = new RegE();
e.setActivity_name(StrUtil.isBlank((String) v.get("activity_tag")) ? (String) v.get("activity_name") : v.get("activity_tag") + "-" + v.get("activity_name"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setSex((String) v.get("sex"));
e.setUnitname((String) v.get("unitname"));
list.add(e);
});
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegE.class, list);
workbook.write(response.getOutputStream());
// ArrayList<RegE> list = new ArrayList<>();
// data.forEach(val -> {
// Map v = (Map) val;
// RegE e = new RegE();
// e.setActivity_name((String) v.get("activity_name"));
// e.setLoginname((String) v.get("loginname"));
// e.setUsername((String) v.get("username"));
// e.setSex((String) v.get("sex"));
// e.setUnitname((String) v.get("unitname"));
// list.add(e);
// });
//
// Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegE.class, list);
// workbook.write(response.getOutputStream());
}
private List<Map> getAllRegister(String unionid, String activity_id, String activity_tag, Integer pageNumber, Integer pageSize) throws IOException {
String s = String.format(
"""
db.collection('register')
.aggregate()
.lookup({
from: 'activity',
localField: 'activity_id',
foreignField: '_id',
as: 'activity'
})
.addFields({
activity_name: $.arrayElemAt(['$activity.name',0]),
activity_tag: $.arrayElemAt(['$activity.tag',0])
})
.match({
unionid:'%s',
'activity._id':_.in(%s)
}).project({
loginname: true,
sex: true,
username: true,
unionname: true,
unionid: true,
unitname: true,
unitid: true,
mobile: true,
register_time: true,
activity_name: true,
activity_tag:true
}).sort({ 'unitid': 1, 'register_time': -1 }).skip(%d).limit(%d).end()
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag)), (pageNumber - 1) * pageSize, pageSize
);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
List<Map> data = result.getList("data", Map.class);
return data;
}
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void signExport(String activity_id, String activity_tag, String unionname, String unionid, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((unionname + "参与名单.xlsx").getBytes("utf-8"), "ISO8859-1"));
Map<String, Object> reqBody = new HashMap<String, Object>();
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
reqBody.put("unionid", unionid);
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUsers", reqBody);
List<NutMap> data = result.getAs("resp_data", List.class);
ArrayList<SignE> list = new ArrayList<>();
for (NutMap v : data) {
SignE e = new SignE();
// e.setActivity_name((String) v.get("activity_name"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setSex((String) v.get("sex"));
e.setMobile((String) v.get("mobile"));
e.setUnitname((String) v.get("unitname"));
e.setSignnum(v.getInt("sign_size"));
list.add(e);
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SignE.class, list);
workbook.write(response.getOutputStream());
}
public class RegE implements Serializable {
@Excel(name = "活动", width = 40.0D)
private String activity_name;
public String getActivity_name() {
return activity_name;
}
public void setActivity_name(String activity_name) {
this.activity_name = activity_name;
}
@Excel(name = "工号", width = 20.0D)
private String loginname;
@Excel(name = "姓名", width = 20.0D)
private String username;
@Excel(name = "性别", width = 20.0D)
private String sex;
@Excel(name = "电话", width = 20.0D)
private String mobile;
@Excel(name = "单位", width = 60.0D)
private String unitname;
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getUnitname() {
return unitname;
}
public void setUnitname(String unitname) {
this.unitname = unitname;
}
}
@Data
public static class SignE implements Serializable {
@Excel(name = "工号", width = 20.0D)
private String loginname;
@Excel(name = "姓名", width = 20.0D)
private String username;
@Excel(name = "性别", width = 20.0D)
private String sex;
@Excel(name = "电话", width = 20.0D)
private String mobile;
@Excel(name = "单位", width = 60.0D)
private String unitname;
@Excel(name = "工会", width = 60.0D)
private String unionname;
@Excel(name = "签到点位数", width = 20.0D)
private Integer signnum;
}
@Data
public static class E implements Serializable {
@Excel(name = "院级工会", width = 60.0D)
private String name;
@Excel(name = "报名人数", width = 20.0D)
private Integer reg_num;
@Excel(name = "参加人数", width = 20.0D)
private Integer sign_num;
}
@At
@ViReturn
@RequiresPermissions("jsz.union.registerInfo")
public Object getRegisterUser(String activity_id, @Param("activity_tag[]") String[] activity_tag, String unionid, Integer pageNumber, Integer pageSize) throws IOException {
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
Map<String, String> map = new HashMap<>() {{
put("unionid", unionid);
}};
/*if (Strings.isNotBlank(activity_tag)) {
map.put("activity.tag", activity_tag);
}*/
if (Strings.isNotBlank(activity_id)) {
map.put("activity._id", activity_id);
}
String match = Json.toJson(map);
String s = String.format(
"""
db.collection('register')
.aggregate()
.lookup({
from: 'activity',
localField: 'activity_id',
foreignField: '_id',
as: 'activity'
})
.addFields({
activity_name: $.arrayElemAt(['$activity.name',0]),
activity_tag: $.arrayElemAt(['$activity.tag',0])
})
.match({
unionid:'%s',
'activity._id':_.in(%s)
}).project({
loginname: true,
sex: true,
username: true,
unionname: true,
unionid: true,
unitname: true,
mobile: true,
unitid: true,
register_time: true,
activity_name: true,
activity_tag:true
}).sort({ 'unitid': 1, 'register_time': -1 }).skip(%d).limit(%d).end()
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag), skip, pageSize
);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
String count_s = String.format(
"""
db.collection('register').where(
{
unionid:'%s',
activity_id:_.in(%s)
}
).count()
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag)
);
NutMap countResult = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count_s);
return new Pagination(pageNumber, pageSize, countResult.getInt("count"), result.getList("data", Map.class));
}
@At
@ViReturn
@RequiresPermissions("jsz.union.registerInfo")
public Object getSignUser(String activity_id, @Param("activity_tag[]") String[] activity_tag, String unionid, Integer pageNumber, Integer pageSize) throws IOException {
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
String s = """
db.collection('sign').aggregate().match({
activity_id: _.in(%s),
unionid:"%s"}).group({
_id: {
activity_id: '$activity_id',
loginname: '$loginname'
},
num: $.sum(1),
data: $.first('$$ROOT')
}).lookup({
from: 'activity',
localField: 'data.activity_id',
foreignField: '_id',
as: 'activity'
}).addFields({
activity: $.arrayElemAt(['$activity', 0])
}).project({
loginname: '$data.loginname',
sex: '$data.sex',
username: '$data.username',
unitname: '$data.unitname',
unionname: '$data.unionname',
pts_size: $.size('$activity.pts'),
sign_size: '$num'
}).skip(%d).limit(%d)
.end()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag),
unionid, skip, pageSize);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
String count_s = """
db.collection('sign').aggregate().match({
activity_id:_.in(%s),
unionid:'%s'
}).group({
_id:'$userid',
count: $.sum(1),
}).end()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag),
unionid);
NutMap countResult = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, count_s);
return new Pagination(pageNumber, pageSize, countResult.getList("data", Map.class).size(), result.getList("data", Map.class));
}
final Integer LIMIT = 1000;
@At
@RequiresPermissions("jsz.union.registerInfo")
public void doGiftExport(String activity_id, String activity_tag, Boolean flag, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
String fileName = flag ? "已领取礼品的用户" : "未领取礼品的用户";
response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes("utf-8"), "ISO8859-1"));
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("activity_id", activity_id);
String count = """
db.collection('gift_voucher').where({activity_id: _.in(%s),used:%b}).count()
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))),
flag);
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
int count1 = wxResultCount.getInt("count");
List<Map> list2 = new ArrayList<>();
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
for (int i = 0; i < ceil; i++) {
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
String query = """
db.collection('gift_voucher')
.where({
activity_id: _.in(%s),
used: %s
})
.orderBy('use_time', 'desc')
.skip(%s)
.limit(%s)
.get()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
, flag, i * LIMIT, num);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
list2.addAll(data);
}
List<giftE> giftEList = list2.stream().map(v -> {
giftE e = new giftE();
e.set_openid((String) v.get("_openid"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setUnitname((String) v.get("unitname"));
e.setUnionname((String) v.get("unionname"));
return e;
}).collect(Collectors.toList());
ArrayList<giftE> collect = giftEList.stream().collect(
collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
ArrayList::new));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), giftE.class, collect);
workbook.write(response.getOutputStream());
}
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void doExportSummary(String activity_id, String activity_tag, HttpServletResponse response) throws Exception {
NutMap cloudResult = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "findActivityInfo", Map.of("activity_id", activity_id, "activity_tag", Json.fromJsonAsArray(String.class, activity_tag)));
NutMap resp_data = cloudResult.getAs("resp_data", NutMap.class);
List<NutMap> pts = resp_data.getList("pts", NutMap.class);
int ptsLength = pts.size();
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("activity_id", activity_id);
String count = """
db.collection('register').where({activity_id: _.in(%s)}).count()
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))));
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
int count1 = wxResultCount.getInt("count");
List<NutMap> list2 = new ArrayList<>();
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
for (int i = 0; i < ceil; i++) {
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
String query = """
db.collection('register')
.where({
activity_id: _.in(%s)
})
.orderBy('unitid', 'desc')
.skip(%s)
.limit(%s)
.get()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
, i * LIMIT, num);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<NutMap> data = wxResult.getList("data", NutMap.class);
list2.addAll(data);
}
Map<String, Object> signReqBody = new HashMap<String, Object>();
signReqBody.put("activity_id", activity_id);
signReqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
//签到数据
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUserAll", signReqBody);
List<NutMap> signData = result.getAs("resp_data", List.class);
for (NutMap val : signData) {
NutMap v = val.getAs("data", NutMap.class);
val.setv("loginname", v.getString("loginname"));
}
List<ExcelExportEntity> excelExportEntities = new ArrayList<>();
excelExportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
excelExportEntities.add(new ExcelExportEntity("姓名", "username", 20));
excelExportEntities.add(new ExcelExportEntity("性别", "sex", 20));
excelExportEntities.add(new ExcelExportEntity("电话", "mobile", 20));
excelExportEntities.add(new ExcelExportEntity("工会", "unionname", 20));
excelExportEntities.add(new ExcelExportEntity("单位", "unitname", 20));
excelExportEntities.add(new ExcelExportEntity("是否参加", "isTakePartIn", 20));
excelExportEntities.add(new ExcelExportEntity("签到点位数", "signNum", 20));
for (NutMap nutMap : list2) {
String loginname = nutMap.getString("loginname");
Optional<NutMap> signDataMap = signData.stream().filter(v -> StrUtil.isNotBlank(v.getString("loginname")) && v.getString("loginname").equals(loginname)).findFirst();
if (signDataMap.isPresent()) {
int signNum = signDataMap.get().getInt("num", 0);
nutMap.setv("isTakePartIn", signNum > 0 ? "是" : "否");
nutMap.setv("signNum", Math.min(signNum, ptsLength));
} else {
nutMap.setv("isTakePartIn", "否");
nutMap.setv("signNum", 0);
}
}
//
// ArrayList<giftE> collect = giftEList.stream().collect(
// collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
// ArrayList::new));
ViTool.excelResponse(response, "活动汇总表.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), excelExportEntities, list2);
workbook.write(response.getOutputStream());
}
@Data
public static class giftE implements Serializable {
private String _openid;
@Excel(name = "工号", width = 20D)
private String loginname;
@Excel(name = "姓名", width = 20D)
private String username;
@Excel(name = "单位", width = 20D)
private String unitname;
@Excel(name = "工会", width = 20D)
private String unionname;
}
@Inject
private BaseService baseService;
//导出全部人员excel列数据
private static final List<ExcelExportEntity> excelExportEntityList = new ArrayList<>() {{
add(new ExcelExportEntity("姓名", "username", 20));
add(new ExcelExportEntity("工号", "loginname", 20));
add(new ExcelExportEntity("单位", "unitname", 20));
add(new ExcelExportEntity("工会", "unionname", 20));
}};
/**
* 导出活动报名人员
*
* @param activity_id
*/
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void doExportRegsiter(String activity_id, String activity_tag, HttpServletResponse response) throws IOException {
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("activity_id", activity_id);
String count = """
db.collection('register').where({activity_id: _.in(%s)}).count()
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))));
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
int count1 = wxResultCount.getInt("count");
List<Map> list2 = new ArrayList<>();
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
for (int i = 0; i < ceil; i++) {
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
String query = """
db.collection('register')
.where({
activity_id: _.in(%s)
})
.orderBy('unitid', 'desc')
.skip(%s)
.limit(%s)
.get()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
, i * LIMIT, num);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
list2.addAll(data);
List<giftE> giftEList = list2.stream().map(v -> {
giftE e = new giftE();
e.set_openid((String) v.get("_openid"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setUnitname((String) v.get("unitname"));
e.setUnionname((String) v.get("unionname"));
return e;
}).collect(Collectors.toList());
ArrayList<giftE> collect = giftEList.stream().collect(
collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
ArrayList::new));
ViTool.excelResponse(response, "活动报名人员.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), giftE.class, collect);
workbook.write(response.getOutputStream());
}
}
/**
* 导出活动参与人员
*
* @param activity_id
*/
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void doExportSign(String activity_id, String activity_tag, HttpServletResponse response) {
try {
Map<String, Object> reqBody = new HashMap<String, Object>();
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUserAll", reqBody);
List<NutMap> data = result.getAs("resp_data", List.class);
ArrayList<SignE> list = new ArrayList<>();
for (NutMap val : data) {
NutMap v = val.getAs("data", NutMap.class);
SignE e = new SignE();
// e.setActivity_name((String) v.get("activity_name"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setSex((String) v.get("sex"));
e.setMobile((String) v.get("mobile"));
e.setUnitname((String) v.get("unitname"));
e.setUnionname(v.getString("unionname"));
e.setSignnum(val.getInt("num"));
list.add(e);
}
ViTool.excelResponse(response, "活动参与人员.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), SignE.class, list);
workbook.write(response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,35 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
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 java.util.List;
/**
* @Author: 1V
* @DateTime: 2020/9/4 10:37
* @Description: TODO
*/
@At("/jsz/api")
@Ok("json:full")
@IocBean
public class JszApiCon {
@Inject
private SysUserService sysUserService;
@At
@ViReturn
public Object getUserDataByLoginName(String loginname) {
Sql sql = Sqls.create("SELECT u.id userid,u.username,u.loginname,u.sex,u.mobile,u.birthday,unit.`name` unitname,u.unitid,unit.unionid,un.unionname from sys_user u left join sys_unit unit on u.unitid = unit.id left join sys_union un on unit.unionid = un.id WHERE u.loginname = @loginname").setParam("loginname", loginname);
List<Record> list = sysUserService.list(sql);
return list.size() > 0 ? list.get(0) : new Object();
}
}
@@ -0,0 +1,57 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
import io.v.nutz.zhgh.jsz.services.JszFillCheckService;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Cnd;
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.POST;
/**
* @Author: 1V
* @DateTime: 2020/9/24 10:14
* @Description: 补签
*/
@At("/jsz/fillcheck")
@Ok("json:full")
@IocBean
public class JszFillCheckCon {
@At("")
@Ok("beetl:/platform/jsz/mobile/FillCheck.html")
public void index() {
}
@Inject
private JszFillCheckService jszFillCheckService;
@Inject
private SysUserService sysUserService;
@At
@POST
public Object doSubmit(Jsz_fillcheck fillcheck) {
try {
if (sysUserService.count(Cnd.where("username", "=", fillcheck.getUsername()).and("loginname", "=", fillcheck.getLoginname()).and("zzzt", "=", "在职")) == 0) {
return Result.error("姓名或工号错误");
}
if (jszFillCheckService.count(Cnd.where("username", "=", fillcheck.getUsername()).and("loginname", "=", fillcheck.getLoginname())) > 0) {
return Result.error("存在已提交的签到记录");
}
fillcheck.setCheck_time(DateUtil.getDateTime());
jszFillCheckService.insert(fillcheck);
return Result.success("提交成功");
} catch (Exception e) {
return Result.error("系统错误");
}
}
}
@@ -0,0 +1,100 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
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 java.util.Date;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/6 15:18
*/
@At("/jsz/my/step")
@Ok("json:full")
@IocBean
public class jszWxStepController {
@Inject
private JszWxStepService jszWxStepService;
/**
* 获取今天当前用户最新步数
*
* @param userId
* @return
*/
@At
@ViReturn
public Object getStepByUserId(String userId) {
return jszWxStepService.getStepByUserId(userId);
}
/**
* 获取今天当前用户最新步数
*
* @param userId
* @return
*/
@At
@ViReturn
public Object getStepRankingByUserId(String userId) {
List<JszWxStep> query = jszWxStepService.query(Cnd.where("applyDate", "=", DateUtil.getDate()).desc("step"));
int k = 0;
for (int i = 0; i < query.size(); i++) {
if (query.get(i).getUserId().equals(userId)) {
k = i + 1;
}
}
return k;
}
/**
* 添加步数
*
* @param userId
* @param step
* @return
*/
@At
@ViReturn
public Object addStep(String userId, Integer step) {
JszWxStep jszWxStep = new JszWxStep();
jszWxStep.setUserId(userId);
jszWxStep.setStep(step);
jszWxStep.setApplyDate(new Date());
jszWxStepService.insert(jszWxStep);
return null;
}
/**
* 修改步数
*
* @param userId
* @param step
* @return
*/
@At
@ViReturn
public Object editStep(String userId, Integer step) {
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", userId).and("applyDate", "=", DateUtil.getDate());
jszWxStepService.update(Chain.make("step", step), cnd);
return null;
}
}
@@ -0,0 +1,77 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.base.Globals;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
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;
/**
* @author: Aaron
* @create: 2020-09-11 13:50
* @description: 小程序登录
**/
@At("/platform/jsz/login")
@Ok("json:full")
@IocBean
public class loginController {
@Inject
private SysUserService sysUserService;
@At("/")
public Object index(String username, String loginname) {
try {
Sql sql = Sqls.create("""
SELECT
u.id userid,
u.username,
u.loginname,
u.sex,
u.mobile,
u.birthday,
unit.`name` unitname,
u.unitid,
u.member,
unit.unionid,
un.unionname,
group_concat(sr.`code`) roles,
'$schoolCode' as schoolCode
FROM
sys_user u
LEFT JOIN sys_unit unit ON u.unitid = unit.id
LEFT JOIN sys_union un ON unit.unionid = un.id
LEFT JOIN sys_user_role sur ON sur.userId = u.id
LEFT JOIN sys_role sr ON sr.id = sur.roleId
$condition
""").setParam("loginname", loginname).setParam("username", username);
sql.setVar("schoolCode", Globals.schoolCode);
Cnd cnd = Cnd.NEW();
cnd.and("LOWER(u.loginname)", "=", loginname.trim().toLowerCase());
cnd.and("LOWER(u.username)", "like", "%" + username.trim().toLowerCase() + "%");
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.map());
sysUserService.dao().execute(sql);
NutMap user = (NutMap) sql.getResult();
if (StrUtil.isBlank(user.getString("userid"))) {
return Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
}
// if(user.getInt("member",0)==0){
// return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
// }
/*if (user.getInt("member", 0) != 1 && !user.getString("sex", "").equals("女")) {
return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
}*/
return Result.success().addData(user);
} catch (Exception e) {
return Result.error();
}
}
}
@@ -0,0 +1,610 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.sys.models.Sys_task;
import io.v.nutz.sys.services.SysTaskService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.task.services.TaskPlatformService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemove;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: 1V
* @DateTime: 2020/9/1 9:48
* @Description: 健身走活动管理
*/
@At("/platform/jsz/hdMange")
@Ok("json")
@IocBean
@RequiresAuthentication
@CacheDefaults(cacheName = "jsz_activity")
public class HdMangeCon {
private static final Log log = Logs.get();
@Inject
private WxHttpUtil wxHttpUtil;
private final String JOB_CLASS = "io.v.nutz.task.job.jszLotteryJob"; //调用类
@Inject
private TaskPlatformService taskPlatformService;
@Inject
private SysTaskService sysTaskService;
@At("")
@Ok("beetl:/platform/jsz/pc/HdMange.html")
@RequiresPermissions("jsz.hdmange")
public void index() {
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("jsz.hdmange")
public Object doAdd(String data, TempFile file) {
try {
String picid = null;
// if (Objects.nonNull(file)) {
// NutMap picmap = wxHttpUtil.getUploadFile("activity/" + file.getSubmittedFileName());
// picid = wxHttpUtil.uploadFile(picmap, file, "activity/" + file.getSubmittedFileName());
// }
NutMap map = Json.fromJson(NutMap.class, data);
StringBuilder ptsBuffer = new StringBuilder("");
NutMap[] pts = map.getArray("pts", NutMap.class);
for (int i = 0; i < pts.length; i++) {
NutMap pt = pts[i];
ptsBuffer.append("{")
.append("issueIds:").append(pt.getAsList("issueIds", String.class).stream().map(v -> "'" + v + "'").collect(Collectors.toList())).append(",")
.append("code:'").append(pt.getString("code")).append("',")
.append("name:'").append(pt.getString("name")).append("',")
.append("radius:").append(pt.getInt("radius")).append(",")
.append("interval:").append(pt.getInt("interval", 0)).append(",")
.append("location:new db.Geo.Point(")
.append(pt.getDouble("lng")).append(",")
.append(pt.getDouble("lat")).append(")")
.append("}");
if (i < pts.length - 1) {
ptsBuffer.append(",");
}
}
StringBuilder lpBuffer = new StringBuilder("");
ArrayList[] linePoints = map.getArray("linePoints", ArrayList.class);
for (int i = 0; i < linePoints.length; i++) {
ArrayList linePoint = linePoints[i];
lpBuffer.append("new db.Geo.Point(" + linePoint.get(0) + "," + linePoint.get(1) + ")");
if (i < linePoints.length - 1) {
lpBuffer.append(",");
}
}
// String pic = Strings.isNotBlank(picid) ? picid : map.getString("pic");
String pic = "cloud://hj-2ggpsf3t8a32c4eb.686a-hj-2ggpsf3t8a32c4eb-1317134219/activity/健身走1.jpg";
String query = """
db.collection('activity')
.add({
data:
[{
groupId:%s,
questionId:'%s',
hasAnswer:%b,
tag:'%s',
name:'%s',
activityModel:'%s',
dailyLottery:'%d',
walkingStepCount:'%d',
lotteryChance:%b,
repeatedlyLottery:%b,
leaderboardNum:'%d',
drawTime:%d,
lotteryTime:'%s',
address:'%s',
note:'%s',
apply_start_time:%d,
apply_end_time:%d,
start_time:%d,
end_time:%d,
pts:[%s],
linePoints:[%s],
toast_num:%d,
toast_msg: '%s',
check_all_msg: '%s',
checkControl:%d,
pic:'%s',
showGift:%b,
gift_name:'%s',
schoolCode:'%s',
activity_apply_user:'%s'
}]
})
""".formatted(
map.getString("groupId"),
map.getString("questionId", ""),
map.getBoolean("hasAnswer"),
map.getString("tag", ""),
map.getString("name"),
map.getString("activityModel"),
map.getInt("dailyLottery"),
map.getInt("walkingStepCount"),
map.getBoolean("lotteryChance"),
map.getBoolean("repeatedlyLottery"),
map.getInt("leaderboardNum"),
map.getLong("drawTime"),
map.getString("lotteryTime"),
map.getString("address"),
map.getString("note").replaceAll("\r|\n", ""),
map.getLong("apply_start_time"),
map.getLong("apply_end_time"),
map.getLong("start_time"),
map.getLong("end_time"),
ptsBuffer.toString(),
lpBuffer.toString(),
map.get("toast_num") == null ? 0 : map.getInt("toast_num"),
map.getString("toast_msg", ""),
map.getString("check_all_msg", ""),
map.getInt("checkControl"),
pic,
map.getBoolean("showGift"),
map.getString("gift_name"),
Globals.schoolCode,
ShiroUtil.getUserId()
);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.insertUrl, query);
log.debug(query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
// addTask(map);
return Result.success();
}
return Result.error();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@Inject
private SysUserService sysUserService;
@At
@ViReturn
@RequiresPermissions("jsz.hdmange")
public Object pageData(@Param(value = "year",required = false) Integer year,
@Param(value = "type",required = false) String type,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
@Param(value = "pageOrderName",required = true) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy) throws IOException {
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
String query = """
db.collection('activity')
.where(%s)
.skip(%d)
.limit(%d)
.orderBy('start_time','desc').get()
""";
List<String> and = new ArrayList<>();
String search_sql = "";
String ts_sql = "";
StringBuilder s = new StringBuilder();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
search_sql = """
_.or([
{
name:{$regex:'%s',$options: 'i'}
},
{
tag:{$regex:'%s',$options: 'i'}
}
])
""".formatted(searchKeyword, searchKeyword);
}
if (year != null) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
long start_ts = calendar.getTimeInMillis();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
long end_ts = calendar.getTimeInMillis();
String activity_apply_user_cnd = "_.neq(null)";
if (!ShiroUtil.hasRole("sysadmin")) {
activity_apply_user_cnd = "'" + ShiroUtil.getUserId() + "'";
}
ts_sql = "{apply_start_time:_.and(_.gte(%d),_.lte(%d)),schoolCode:'%s',activity_apply_user:%s}".formatted(start_ts, end_ts, Globals.schoolCode, activity_apply_user_cnd);
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
s.append(search_sql);
if (year != null) {
s.append(".and(");
s.append(ts_sql);
s.append(")");
}
}
if (year != null && Strings.isBlank(searchKeyword)) {
s.append(ts_sql);
}
query = query.formatted(s, skip, pageSize);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
NutMap pager = result.getAs("pager", NutMap.class);
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), result.getList("data", Map.class));
}
@At
@ViReturn
@RequiresPermissions("jsz.hdmange")
public Object getData(String id) throws IOException {
String query = "db.collection('activity').doc('%s').get()".formatted(id);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return data.size() > 0 ? data.get(0) : new Object();
}
@At
@Ok("json")
@RequiresPermissions("jsz.hdmange")
public Object getFile(String pic) {
try {
NutMap res = NutMap.NEW();
String imgurl = wxHttpUtil.getWxFileUrl(pic);
HashMap<String, Object> imgmap = new HashMap<>();
imgmap.put("status", "success");
imgmap.put("name", imgurl.substring(imgurl.lastIndexOf("/") + 1));
imgmap.put("id", imgurl);
imgmap.put("url", imgurl);
res.setv("img", imgmap);
return Result.success().addData(res);
} catch (Exception e) {
return Result.error();
}
}
@At
@CacheRemoveAll
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("jsz.hdmange")
public Object doEdit(String data, TempFile file) {
try {
String picid = "";
if (file != null) {
NutMap picmap = wxHttpUtil.getUploadFile("activity/" + file.getSubmittedFileName());
picid = wxHttpUtil.uploadFile(picmap, file, "activity/" + file.getSubmittedFileName());
}
NutMap map = Json.fromJson(NutMap.class, data);
StringBuilder ptsBuffer = new StringBuilder("");
NutMap[] pts = map.getArray("pts", NutMap.class);
for (int i = 0; i < pts.length; i++) {
NutMap pt = pts[i];
ptsBuffer.append("{")
.append("issueIds:").append(pt.getAsList("issueIds", String.class).stream().map(v -> "'" + v + "'").collect(Collectors.toList())).append(",")
.append("code:'").append(pt.getString("code")).append("',")
.append("name:'").append(pt.getString("name")).append("',")
.append("radius:").append(pt.getInt("radius")).append(",")
.append("interval:").append(pt.getInt("interval", 0)).append(",")
.append("location:new db.Geo.Point(").append(pt.getDouble("lng")).append(",")
.append(pt.getDouble("lat")).append(")").append("}");
if (i < pts.length - 1) {
ptsBuffer.append(",");
}
}
StringBuilder lpBuffer = new StringBuilder("");
ArrayList[] linePoints = map.getArray("linePoints", ArrayList.class);
for (int i = 0; i < linePoints.length; i++) {
ArrayList linePoint = linePoints[i];
lpBuffer.append("new db.Geo.Point(").append(linePoint.get(0)).append(",")
.append(linePoint.get(1)).append(")");
if (i < linePoints.length - 1) {
lpBuffer.append(",");
}
}
String picSql = "";
if (Strings.isNotBlank(picid)) {
picSql = String.format("pic:'%s'", picid);
}
String query = """
db.collection('activity').doc('%s')
.update({
data:
{
groupId:%s,
questionId:'%s',
hasAnswer:%b,
showGift:%b,
gift_name:'%s',
tag:'%s',
name:'%s',
activityModel:'%s',
dailyLottery:'%d',
walkingStepCount:'%d',
lotteryChance:%b,
repeatedlyLottery:%b,
leaderboardNum:'%d',
drawTime:%d,
lotteryTime:'%s',
address:'%s',
note:'%s',
apply_start_time:%d,
apply_end_time:%d,
start_time:%d,
end_time:%d,
pts:[%s],
linePoints:[%s],
toast_num:%d,
toast_msg: '%s',
check_all_msg: '%s',
checkControl:%d,
schoolCode:'%s',
activity_apply_user:'%s',
%s
}
})
""".formatted(
map.getString("_id"),
map.getString("groupId"),
map.getString("questionId"),
map.getBoolean("hasAnswer"),
map.getBoolean("showGift"),
map.getString("gift_name"),
map.getString("tag"),
map.getString("name"),
map.getString("activityModel"),
map.getInt("dailyLottery"),
map.getInt("walkingStepCount"),
map.getBoolean("lotteryChance"),
map.getBoolean("repeatedlyLottery"),
map.getInt("leaderboardNum"),
map.getLong("drawTime"),
map.getString("lotteryTime"),
map.getString("address"),
map.getString("note").replaceAll("\r|\n", ""),
map.getLong("apply_start_time"),
map.getLong("apply_end_time"),
map.getLong("start_time"),
map.getLong("end_time"),
ptsBuffer.toString(),
lpBuffer.toString(),
map.get("toast_num") == null ? 0 : map.getInt("toast_num"),
map.getString("toast_msg"),
map.getString("check_all_msg"),
map.getInt("checkControl"),
Globals.schoolCode,
ShiroUtil.getUserId(),
picSql
);
log.debug(query);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.updateUrl, query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
// addTask(map);
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
public void addTask(NutMap map) {
// Trans.exec(() -> {
// try {
// if (map.getInt("dailyLottery") > 0) {
// //先删除在添加
// List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", map.getString("_id")));
// if (sys_tasks != null) {
// sys_tasks.forEach(v -> {
// taskPlatformService.delete(v.getId(), v.getId());
// sysTaskService.delete(v.getId());
// });
//
// }
//
//
// Sys_task sys_task = new Sys_task();
// sys_task.setName(map.getString("name"));
// sys_task.setNote(map.getString("_id"));
// sys_task.setJobClass(JOB_CLASS);
// sys_task.setData(Json.toJson(new HashMap<String, Object>() {{
// put("id", map.getString("_id"));
// }}));
// sys_task.setDisabled(false);
// if (!map.getBoolean("repeatedlyLottery")) {
// Date drawTime = new Date(map.getLong("drawTime"));
// String cron = io.v.nutz.base.utils.DateUtil.getCron(drawTime);
// sys_task.setCron(cron);
// List<String> cronExeTimes = taskPlatformService.getCronExeTimes(cron);
// if (cronExeTimes.size() == 0) {
// return;
// }
// sys_task = sysTaskService.insert(sys_task);
// taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
// } else {
// String lotteryTime = map.getString("lotteryTime");
// long start_time_long = map.getLong("start_time");
// long end_time_long = map.getLong("end_time");
//
// List<Date> taskDates = new ArrayList<>();
// int offsetDay = 0;
// while (DateUtil.offsetDay(new Date(start_time_long), offsetDay).compareTo(new Date(end_time_long)) < 0 ||
// DateUtil.offsetDay(new Date(start_time_long), offsetDay).compareTo(new Date(end_time_long)) == 0) {
// taskDates.add(DateUtil.offsetDay(new Date(start_time_long), offsetDay));
// offsetDay++;
// }
//
// for (Date taskDate : taskDates) {
// Calendar instance = Calendar.getInstance();
// instance.setTime(taskDate);
// int year = instance.get(Calendar.YEAR);
// int month = instance.get(Calendar.MONTH) + 1;
// int day = instance.get(Calendar.DATE);
// String[] time = lotteryTime.split(":");
// String cron = time[2] + " " + time[1] + " " + time[0] + " " + day + " " + month + " " + " ? " + year + " ";
// sys_task.setCron(cron);
// List<String> cronExeTimes = taskPlatformService.getCronExeTimes(cron);
// if (cronExeTimes.size() == 0) {
// return;
// }
// sys_task = sysTaskService.insert(sys_task);
// taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
// }
//
//
// }
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// });
}
@At
@ViReturn
@CacheRemove
@RequiresPermissions("jsz.hdmange")
public Object delete(String id) throws IOException {
String query = "db.collection('activity').doc('" + id + "').remove()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, query);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
String s1 = "db.collection('register').where({\n" +
" activity_id: '" + id + "'\n" +
"}).remove()\n";
String s2 = "db.collection('sign').where({\n" +
" activity_id: '" + id + "'\n" +
"}).remove()\n";
wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s1);
wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s2);
List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", id));
if (sys_tasks != null) {
sys_tasks.forEach(v -> {
taskPlatformService.delete(v.getId(), v.getId());
sysTaskService.delete(v.getId());
});
}
return Result.success();
}
return Result.error();
}
@At
@ViReturn
public Object getFitnessData() throws IOException {
String query = "db.collection('activity').where({schoolCode:'%s'}).orderBy('apply_start_time', 'desc').get()".formatted(Globals.schoolCode);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<NutMap> data = result.getList("data", NutMap.class);
return data.size() > 0 ? data : new ArrayList<>();
//return Collections.emptyList();
}
@At
@ViReturn
public Object getActivityData() throws IOException {
Long yearStartTime = getYearStartTime();
Long yearEndTime = getYearEndTime();
String query = "db.collection('activity')\n" +
" .where({\n" +
" apply_start_time: _.and(_.gte(" + yearStartTime + "), _.lte(" + yearEndTime + "))\n" +
" }).get()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return data;
}
/**
* 获取当年的开始时间戳
*
* @return
*/
public static Long getYearStartTime() {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.DATE, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取当年的最后时间戳
*
* @return
*/
public static Long getYearEndTime() {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
calendar.setTimeInMillis(System.currentTimeMillis());
int year = calendar.get(Calendar.YEAR);
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return calendar.getTimeInMillis();
}
}
@@ -0,0 +1,101 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.jsz.services.JszTypeService;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
/**
* @Author: 1V
* @DateTime: 2020/9/1 10:02
* @Description: TODO
*/
@At("/platform/jsz/common")
@Ok("json")
@IocBean
@RequiresAuthentication
public class JszCommonCon {
@Inject
private JszTypeService jszTypeService;
@Inject
private WxHttpUtil wxHttpUtil;
/**
* 获取类型
*
* @return
*/
@At
@ViReturn
public Object getTypes() {
return jszTypeService.query(Cnd.NEW().asc("location"));
}
/**
* 获取所有的活动
*
* @return
*/
@At
public Object getAllHd(Integer year, String beforeTime, String endTime) {
try {
String str = "";
if (Strings.isNotBlank(beforeTime) && Strings.isNotBlank(endTime)) {
str = "start_time:_.gt(" + beforeTime + "),start_time:_.lt(" + endTime + "),schoolCode:'" + Globals.schoolCode + "'";
} else {
str = "schoolCode:'" + Globals.schoolCode + "'";
}
if (year != null) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
long start_ts = calendar.getTimeInMillis();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
long end_ts = calendar.getTimeInMillis();
String activity_apply_user_cnd = "_.neq(null)";
if (!ShiroUtil.hasRole("sysadmin")) {
activity_apply_user_cnd = "'" + ShiroUtil.getUserId() + "'";
}
str = "apply_start_time:_.and(_.gte(%d),_.lte(%d)),schoolCode:'%s',activity_apply_user:%s".formatted(start_ts, end_ts, Globals.schoolCode, activity_apply_user_cnd);
}
String query = "db.collection('activity').where({\n" +
str +
"}).field({\n" +
"tag: true,\n" +
"name: true,\n" +
"start_time: true,\n" +
"end_time: true,\n" +
"activityModel: true,\n" +
"schoolCode: '" + Globals.schoolCode + "'\n" +
"}).orderBy('start_time', 'desc').get()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return Result.success().addData(data);
} catch (IOException e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,121 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @Author: 1V
* @DateTime: 2020/9/24 15:32
* @Description: TODO
*/
@At("/platform/jsz/login/record")
@Ok("json")
@IocBean
@RequiresAuthentication
public class JszLoginRecordCon {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("beetl:/platform/jsz/pc/LoginRecord.html")
@RequiresPermissions("jsz.login.record")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("jsz.login.record")
public Object pageData(@Param(value = "keyWord",required = false) String keyWord,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy) throws IOException {
String cnd = "";
if (Strings.isNotBlank(keyWord)) {
cnd = " _.or([{\n" +
" loginname: db.RegExp({\n" +
" regexp: '" + keyWord + "',\n" +
" options: 'i',\n" +
" })},{\n" +
" username: db.RegExp({\n" +
" regexp: '" + keyWord + "',\n" +
" options: 'i',\n" +
" })\n" +
" }])";
} else {
// cnd = "{schoolCode:'" + Globals.schoolCode + "'}";
}
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
String query = "db.collection('login_record')" + ( StrUtil.isNotBlank(cnd) ? (".where(" + cnd + ")") : "" )
+ ".field({ data: false }).skip(" + skip + ").limit(" + pageSize + ").get()";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
NutMap pager = result.getAs("pager", NutMap.class);
List<Map> list = result.getList("data", Map.class);
list.forEach(v -> {
String openid = (String) v.get("openid");
v.put("openid", openid.substring(0, 3) + "******" + openid.substring(openid.length() - 3));
});
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), list);
}
@At
@RequiresPermissions("jsz.login.record")
public Object delete(String[] ids) throws IOException {
try {
String s = "db.collection('login_record').where({_id:_.in(" + Json.toJson(ids) + ")}).remove()\n";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("jsz.login.record")
public Object deleteAll() throws IOException {
try {
String s = "db.collection('login_record').where({schoolCode: _.eq('" + Globals.schoolCode + "')}).remove()\n";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
}
@@ -0,0 +1,124 @@
package io.v.nutz.zhgh.jsz.controller.pc;
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.hutool.core.date.DateUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.ViTool;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.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.util.*;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.zhgh.jsz.controller.pc.JszPrizeController
* @Description: TODO
* @Author zxc
* @Date 2022/9/8:15:06
* @Version V1.0
**/
@IocBean
@At("/platform/jsz/prize")
public class JszPrizeController {
@At("")
@Ok("beetl:/platform/jsz/pc/prize.html")
@RequiresAuthentication
public void index() {
}
@Inject
private Dao dao;
private String getSql() {
return """
SELECT
u.loginname,
u.username,
u.unionname,
u.unitname,
al.applyDate,
date_format(al.applyDate,'%Y-%m-%d') as prizeData
FROM
`jsz_award_list` al
LEFT JOIN `user` u ON u.id = al.userId
$condition
""";
}
@At("/prizeDataList")
@Ok("json:full")
@ViReturn
public Object prizeDataList(@Param("activityId") String activityId) {
Date toDay = new Date();
Sql sql = Sqls.create(getSql());
Cnd cnd = Cnd.NEW();
cnd.and("activityId", "=", activityId);
sql.setCondition(cnd);
List<NutMap> list = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
List<NutMap> yesterdayList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(DateUtil.offsetDay(toDay, -1), "yyyy-MM-dd"))).collect(Collectors.toList());
// List<NutMap> toDayList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(toDay, "yyyy-MM-dd"))).collect(Collectors.toList());
return Map.of("toDayList", Collections.emptyList(), "yesterdayList", yesterdayList, "totalList", list);
}
@At("/exportExcel")
@Ok("void")
@RequiresAuthentication
public void exportExcel(@Param("activityId") String activityId,
@Param("currentSelectedType") String currentSelectedType,
HttpServletResponse response) {
Date toDay = new Date();
Sql sql = Sqls.create(getSql());
Cnd cnd = Cnd.NEW();
cnd.and("activityId", "=", activityId);
sql.setCondition(cnd);
List<NutMap> exportList = new ArrayList<>();
List<NutMap> list = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
if ("yesterdayList".equals(currentSelectedType)) {
exportList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(DateUtil.offsetDay(toDay, -1), "yyyy-MM-dd"))).collect(Collectors.toList());
} else {
exportList = list;
}
List<ExcelExportEntity> entityList = new ArrayList<>() {{
add(new ExcelExportEntity("姓名", "username", 20));
add(new ExcelExportEntity("工号", "loginname", 20));
add(new ExcelExportEntity("单位", "unitname", 20));
add(new ExcelExportEntity("分工会", "unionname", 20));
add(new ExcelExportEntity("日期", "prizeData", 20));
}};
try {
ViTool.excelResponse(response, "导出数据.xlsx");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, exportList);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,140 @@
package io.v.nutz.zhgh.jsz.controller.pc;
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 io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.ViTool;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
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.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/9 14:07
*/
@IocBean
@At("/platform/jsz/StepCountingRank")
public class JszStepCountingRankCon {
@At("")
@Ok("beetl:/platform/jsz/pc/stepCountingRank.html")
@RequiresPermissions("jsz.StepCountingRank")
public void index() {
}
@Inject
private BaseService baseService;
private String getSql() {
return """
SELECT
u.loginname,
u.username,
u.unionname,
u.unitname,
al.applyDate,
al.step,
date_format(al.applyDate,'%Y-%m-%d') as prizeData
FROM
`jsz_wx_step` al
LEFT JOIN `user` u ON u.id = al.userId
$condition
""";
}
@At
@Ok("json:full")
@ViReturn
@RequiresPermissions("jsz.StepCountingRank")
public Object pageData(PageForm pageForm,
@Param(value = "year",required = false) Integer year,
@Param(value = "hdid",required = false) String hdid,
@Param(value = "activityDate",required = false) String[] activityDate,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create(getSql());
if (Lang.isNotEmpty(activityDate)) {
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[0]);
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[1]);
}
cnd.andEX("YEAR(al.applyDate)", "=", year);
cnd.andEX("al.activityId", "=", hdid);
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitId", "=", unitId);
cnd.desc("al.step");
cnd.desc("u.unioncode");
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return pagination;
}
@At("/exportExcel")
@Ok("void")
@RequiresAuthentication
@RequiresPermissions("jsz.StepCountingRank")
public void exportExcel(@Param(value = "hdid",required = false) String hdid,
@Param(value = "activityDate",required = false) String[] activityDate,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId, HttpServletResponse response) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create(getSql());
if (activityDate.length > 0) {
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[0]);
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[1]);
}
cnd.andEX("al.activityId", "=", hdid);
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitId", "=", unitId);
cnd.desc("al.step");
cnd.desc("u.unioncode");
List<NutMap> exportList = baseService.listMap(sql);
List<ExcelExportEntity> entityList = new ArrayList<>() {{
add(new ExcelExportEntity("姓名", "username", 20));
add(new ExcelExportEntity("工号", "loginname", 20));
add(new ExcelExportEntity("单位", "unitname", 20));
add(new ExcelExportEntity("分工会", "unionname", 20));
add(new ExcelExportEntity("当前步数", "step", 20));
add(new ExcelExportEntity("日期", "prizeData", 20));
}};
try {
ViTool.excelResponse(response, "导出数据.xlsx");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, exportList);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,178 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemove;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import org.nutz.plugins.wkcache.annotation.CacheResult;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author: Aaron
* @create: 2020-09-03 14:12
* @description: 健身走题库管理
**/
@At("/platform/jsz/tkMange")
@Ok("json")
@IocBean
@RequiresAuthentication
@CacheDefaults(cacheName = "jsz_topic")
public class TkMangeController {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("beetl:/platform/jsz/pc/TkMange.html")
@RequiresPermissions("jsz.tkmange")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("jsz.tkmange")
public Object pageData(@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize) {
try {
List and = new ArrayList<>();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
and.add("" + searchName + ":{$regex:'" + searchKeyword + "',$options: 'i'}");
}
int skip = pageNumber == 1 ? 0 : (pageNumber - 1) * pageSize;
String query = "db.collection('topic')\n" +
" .where({" + StringUtils.join(and, ",") + "})\n" +
" .skip(0)\n" +
" .limit(10)\n" +
" .get()";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
NutMap pager = result.getAs("pager", NutMap.class);
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), result.getList("data", Map.class));
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("jsz.tkmange")
public Object doAdd(String issue) {
try {
NutMap map = Json.fromJson(NutMap.class, issue);
StringBuffer optionsBuffer = new StringBuffer("");
NutMap[] options = map.getArray("options", NutMap.class);
for (int i = 0; i < options.length; i++) {
NutMap op = options[i];
optionsBuffer.append("{" +
"option_name:'" + op.getString("option_name") + "'," +
"option_iswor:" + op.getBoolean("option_iswor") + "" +
"}");
if (i < options.length - 1) {
optionsBuffer.append(",");
}
}
String query = "db.collection('topic')\n" +
" .add({\n" +
" data: [\n" +
" {\n" +
" issue_multiple: " + map.getBoolean("issue_multiple") + ",\n" +
" issue_name: '" + map.getString("issue_name") + "',\n" +
" options: [" + optionsBuffer.toString() + "]\n" +
" }\n" +
" ]\n" +
" })";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.insertUrl, query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
@CacheResult
@RequiresPermissions("jsz.tkmange")
public Object findOne(String id) throws IOException {
String query = "db.collection('topic').doc('" + id + "').get()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return data.size() > 0 ? data.get(0) : new Object();
}
@At
@CacheRemoveAll
@RequiresPermissions("jsz.tkmange")
public Object doEdit(String issue) {
try {
NutMap map = Json.fromJson(NutMap.class, issue);
StringBuffer optionsBuffer = new StringBuffer("");
NutMap[] options = map.getArray("options", NutMap.class);
for (int i = 0; i < options.length; i++) {
NutMap op = options[i];
optionsBuffer.append("{" +
"option_name:'" + op.getString("option_name") + "'," +
"option_iswor:" + op.getBoolean("option_iswor") + "" +
"}");
if (i < options.length - 1) {
optionsBuffer.append(",");
}
}
String query = "db.collection('topic').doc('" + map.getString("_id") + "')\n" +
" .update({\n" +
" data: {\n" +
" issue_multiple: " + map.getBoolean("issue_multiple") + ",\n" +
" issue_name: '" + map.getString("issue_name") + "',\n" +
" options: [" + optionsBuffer.toString() + "]\n" +
" }\n" +
" })";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.updateUrl, query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
@CacheRemove
@RequiresPermissions("jsz.tkmange")
public Object delete(String id) throws IOException {
String query = "db.collection('topic').doc('" + id + "').remove()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, query);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
}
}
@@ -0,0 +1,170 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.io.IOException;
import java.util.*;
/**
* @FileName io.v.nutz.zhgh.jsz.controller.pc.stepCountingController
* @Description: TODO
* @Author zxc
* @Date 2022/9/6:14:39
* @Version V1.0
**/
@IocBean
@At("/platform/jsz/stepCounting")
public class stepCountingController {
// @Inject
// private SendMsg sendMsg;
@Inject
private Dao dao;
@Inject
private SysUserService sysUserService;
@At("/sendSmsCode")
@Ok("json:full")
public Object sendSmsCode(@Param("loginName") String loginName) {
int count = dao.count(Sys_user.class, Cnd.where("loginName", "=", loginName));
if (count == 0) {
return Result.error("系统中查询不到您的工号!");
}
RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
String code = randomGenerator.generate();
// try {
// sendMsg.sendTextMesg(loginName, "健步走验证码:" + code);
// return Result.success().addData(code);
// } catch (IOException e) {
// e.printStackTrace();
// return Result.error();
// }
return null;
}
@At("/getUserInfo")
@Ok("json:full")
public Object getUserInfo(@Param("loginName") String loginName) {
Sql sql = Sqls.create("""
SELECT
u.id userid,
u.username,
u.loginname,
u.sex,
u.mobile,
u.birthday,
unit.`name` unitname,
u.unitid,
u.member,
unit.unionid,
un.unionname,
group_concat(sr.`code`) roles
FROM
sys_user u
LEFT JOIN sys_unit unit ON u.unitid = unit.id
LEFT JOIN sys_union un ON unit.unionid = un.id
LEFT JOIN sys_user_role sur ON sur.userId = u.id
LEFT JOIN sys_role sr ON sr.id = sur.roleId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("LOWER(u.loginname)", "=", loginName.toLowerCase());
sql.setCondition(cnd);
NutMap userMap = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
if (StrUtil.isBlank(userMap.getString("userid"))) {
return Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
}
return Result.success().addData(userMap);
}
/**
* get week step
*
* @param userId user id
* @return {@link Object}
*/
@At("/getWeekStep")
@Ok("json:full")
@ViReturn
public Object getWeekStep(@Param("userId") String userId, @Param("activityId") String activityId) {
Assert.notBlank(activityId);
Assert.notBlank(userId);
Cnd cnd = Cnd.where("userId", "=", userId);
cnd.and("activityId", "=", activityId);
cnd.and("applyDate", ">", DateUtil.offsetDay(new Date(), -7));
cnd.asc("applyDate");
List<JszWxStep> wxSteps = dao.query(JszWxStep.class, cnd);
List<HashMap> results = new ArrayList<>();
for (int i = 7; i >= 0; i--) {
int offset = (i) * -1;
DateTime offsetDay = DateUtil.offsetDay(new Date(), offset);
String dateStr = offsetDay.toString("yyyy-MM-dd");
Optional<JszWxStep> jszWxStepOptional = wxSteps.stream().filter(v -> DateUtil.format(v.getApplyDate(), "yyyy-MM-dd").equals(dateStr)).findFirst();
results.add(new HashMap<>() {{
put("day", dateStr);
put("step", jszWxStepOptional.isPresent() ? jszWxStepOptional.get().getStep() : 0);
}});
}
return results;
}
/**
* 更新步数
*
* @param activityId 活动id
* @param userId 用户id
* @param step 一步
* @return {@link Object}
*/
@At
@Ok("json:full")
@ViReturn
public Object updateStep(String activityId, String userId, Integer step) {
Assert.notBlank(activityId);
Assert.notBlank(userId);
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", userId);
cnd.and("applyDate", "=", io.v.nutz.base.utils.DateUtil.getDate());
cnd.and("activityId", "=", activityId);
JszWxStep wxStep = dao.fetch(JszWxStep.class, cnd);
if (Lang.isEmpty(wxStep)) {
wxStep = new JszWxStep();
wxStep.setActivityId(activityId);
wxStep.setUserId(userId);
wxStep.setApplyDate(new Date());
}
wxStep.setStep(step);
dao.insertOrUpdate(wxStep);
return null;
}
}
@@ -0,0 +1,44 @@
package io.v.nutz.zhgh.jsz.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* TODO
* 健身走获奖名单
*
* @Author zhf
* @Date 2022/9/8 9:24
*/
@Table
@Data
public class JszAwardList {
@Column
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR)
@Comment("活动")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("姓名Id")
private String userId;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("时间")
private Date applyDate;
}
@@ -0,0 +1,45 @@
package io.v.nutz.zhgh.jsz.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/6 15:06
*/
@Table
@Data
public class JszWxStep {
@Column
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR)
@Comment("时间")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("姓名Id")
private String userId;
@Column
@ColDefine(customType = "int")
@Comment("步数")
private Integer step;
@Column
@ColDefine(type = ColType.DATE)
@Comment("时间")
private Date applyDate;
}
@@ -0,0 +1,78 @@
package io.v.nutz.zhgh.jsz.models;
import org.nutz.dao.entity.annotation.*;
/**
* @Author: 1V
* @DateTime: 2020/9/24 10:04
* @Description: TODO
*/
@Table("Jsz_fillcheck")
public class Jsz_fillcheck {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("用户名")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String loginname;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String username;
@Column
@Comment("校区")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String campus;
@Column
@Comment("签到时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String check_time;
public String getCheck_time() {
return check_time;
}
public void setCheck_time(String check_time) {
this.check_time = check_time;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getCampus() {
return campus;
}
public void setCampus(String campus) {
this.campus = campus;
}
}
@@ -0,0 +1,57 @@
package io.v.nutz.zhgh.jsz.models;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
/**
* @Author: 1V
* @DateTime: 2020/9/1 9:42
* @Description: 活动类型
*/
@Table("Jsz_type")
public class Jsz_type {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("类型名称")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String name;
@Column
@Comment("排序")
@Prev({
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM Jsz_type"),
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM Jsz_type")
})
private Integer location;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getLocation() {
return location;
}
public void setLocation(Integer location) {
this.location = location;
}
}
@@ -0,0 +1,11 @@
package io.v.nutz.zhgh.jsz.services;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
/**
* @author 1V
*/
public interface JszFillCheckService extends BaseService<Jsz_fillcheck> {
}
@@ -0,0 +1,8 @@
package io.v.nutz.zhgh.jsz.services;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.zhgh.jsz.models.Jsz_type;
public interface JszTypeService extends BaseService<Jsz_type> {
}
@@ -0,0 +1,36 @@
package io.v.nutz.zhgh.jsz.services;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
public interface JszWxStepService extends ViService<JszWxStep> {
/**
* 获取今天当前用户最新步数
*/
Object getStepByUserId(String userId);
/**
* 获取当日榜或者累计排榜榜
*
* @param hdid: 活动id
* @param type: 0-当日榜, 1-累计排行榜
* @return null
* @author JyuHsin
* @date 2022/9/7
*/
Object getDataOfLeaderboard(String hdid, Integer type, String userId, String unionId, String unitId, String searchName, String searchKeyword);
/**
* 获取当日中奖榜
*
* @param hdid: 活动id
* @return java.lang.Object
* @author JyuHsin
* @date 2022/9/7
*/
Object getDataOfPrize(String hdid, String unionId, String unitId, String searchName, String searchKeyword);
}
@@ -0,0 +1,20 @@
package io.v.nutz.zhgh.jsz.services.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
import io.v.nutz.zhgh.jsz.services.JszFillCheckService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author 1V
*/
@IocBean(args = {"refer:dao"})
public class JszFillCheckServiceImpl extends BaseServiceImpl<Jsz_fillcheck> implements JszFillCheckService {
public JszFillCheckServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.zhgh.jsz.services.impl;
import io.v.nutz.base.service.impl.BaseServiceImpl;
import io.v.nutz.zhgh.jsz.models.Jsz_type;
import io.v.nutz.zhgh.jsz.services.JszTypeService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
@IocBean(args = {"refer:dao"})
@CacheDefaults(cacheName = "jsz_type")
public class JszTypeServiceImpl extends BaseServiceImpl<Jsz_type> implements JszTypeService {
public JszTypeServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,119 @@
package io.v.nutz.zhgh.jsz.services.impl;
import cn.hutool.core.date.DateUtil;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
import io.v.nutz.sys.models.Sys_user;
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;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import java.util.Date;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/6 15:12
*/
@IocBean(args = {"refer:dao"})
public class JszWxStepServiceImpl extends ViServiceImpl<JszWxStep> implements JszWxStepService {
public JszWxStepServiceImpl(Dao dao) {
super(dao);
}
@Override
public Object getStepByUserId(String userId) {
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", userId).and("applyDate", "=", DateUtil.today());
return fetch(cnd);
}
@Override
public Object getDataOfLeaderboard(String hdid, Integer type, String userId, String unionId, String unitId, String searchName, String searchKeyword) {
Sys_user user = dao().fetch(Sys_user.class, userId);
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
userId,
sum(step) as step,
u.username,
u.loginname
FROM
`jsz_wx_step` step
LEFT JOIN sys_user u ON step.userId = u.id
$condition
""");
//0查当日
if (type == 0) {
cnd.and("left(applyDate, 10)", "=", DateUtil.today());
}
cnd.and("activityId", "=", hdid);
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.unionId", "=", unionId);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
cnd.groupBy("userId");
cnd.desc("step");
sql.setCondition(cnd);
List<NutMap> lists = listMap(sql);
Sql sqlMy = sql.duplicate().setCondition(cnd.clone().and("userId", "=", userId));
List<NutMap> myStep = listMap(sqlMy);
if (Lang.isEmpty(myStep)) {
NutMap map = NutMap.NEW().setv("username", user.getUsername())
.setv("loginname", user.getLoginname())
.setv("userId", user.getId())
.setv("step", 0);
myStep.add(map);
}
lists.addAll(0, myStep);
return lists;
}
@Override
public Object getDataOfPrize(String hdid, String unionId, String unitId, String searchName, String searchKeyword) {
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
userId,
u.username,
u.loginname,
un.`name` as unitname
FROM
`jsz_award_list` award
LEFT JOIN sys_user u ON award.userId = u.id
LEFT JOIN sys_unit un ON un.id = u.unitid
$condition
""");
cnd.and("activityId", "=", hdid);
cnd.and("left(applyDate, 10)", "=", DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd"));
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.unionId", "=", unionId);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
cnd.groupBy("userId");
sql.setCondition(cnd);
List<NutMap> nutMaps = listMap(sql);
return nutMaps;
}
}
@@ -22,11 +22,10 @@ public enum MemberChangeType {
WITHDRAWAL("WITHDRAWAL","退会"),
WORK("WORK","在职"),
LEAVE_SCHOOL("LEAVE_SCHOOL","离校"),
RETIRE("RETIRE","退休"),
RESIGN("RESIGN","辞职"),
OUT("OUT","调出"),
LEAVE_OFFICE("LEAVE_OFFICE","离职"),
OTHER("OTHER","其他"),
RETIRE("RETIRE","离退休"),
DIE("DIE","去世"),
REPORTING("REPORTING","报到中"),
NO_REPORTING("NO_REPORTING","不报到"),
UNIT_CHANGE("UNIT_CHANGE","单位异动"),
UNION_CHANGE("UNION_CHANGE","工会关系异动"),
BASIC_CHANGE("BASIC_CHANGE","基本信息异动");
@@ -7,11 +7,14 @@ import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.model.Audit;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.User;
import io.v.nutz.sys.services.SysLocalProcessService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
@@ -35,6 +38,8 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @version 1.0
* @Author zzr
@@ -50,6 +55,10 @@ public class MemberApplyBranchUnionAuditController {
@Inject
private Dao dao;
@Inject
private MsgApi msgApi;
@Inject
private SysUserService sysUserService;
@Inject
private MemberCommonService memberCommonService;
@Inject
private SysLocalProcessService localProcessService;
@@ -85,9 +94,9 @@ public class MemberApplyBranchUnionAuditController {
cnd.and("record.allocationUnionId", "=", Vi.getUnionId());
}
if (pageForm.getAudit()) {
cnd.and("record.applyStateId", ">", 50);
cnd.and("record.applyStateId", ">", 20);
} else {
cnd.and("record.applyStateId", "=", 50);
cnd.and("record.applyStateId", "=", 20);
}
cnd.desc("record.applyDateTime");
sql.setCondition(cnd);
@@ -112,53 +121,28 @@ public class MemberApplyBranchUnionAuditController {
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
if (audit.getAuditType() == 2) {
// 退回修改
record.setApplyStateId(60);
record.setApplyStateId(30);
} else if (audit.getAuditType() == 1) {
// 通过
record.setApplyStateId(80);
record.setApplyStateId(50);
} else {
// 拒绝
record.setApplyStateId(70);
record.setApplyStateId(40);
}
record.setBranchUnionAuditId(audit.getId());
dao.updateIgnoreNull(record);
MemberApplyToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
// 获取分配工会信息
Sys_union union = dao.fetch(Sys_union.class, Cnd.where("id", "=", record.getAllocationUnionId()));
if (audit.getAuditType() == 2) {
MemberApplyToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, null);
} else if (audit.getAuditType() == 1) {
MemberApplyToDoHandler.COMPLETE_PROCESS.exec(record, null);
// 判断是否改变了工会关系
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
if (!ObjectUtil.equals(user.getUnionid(), record.getAllocationUnionId())) {
if (dao.count(SpecialStaff.class, Cnd.where("userId", "=", record.getUserId())) > 0) {
dao.clear(SpecialStaff.class, Cnd.where("userId", "=", record.getUserId()));
user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
}
if (!ObjectUtil.equals(user.getUnionid(), record.getAllocationUnionId())) {
Sys_union union = dao.fetch(Sys_union.class, Cnd.where("id", "=", record.getAllocationUnionId()));
SpecialStaff staff = new SpecialStaff();
staff.setUserId(record.getUserId());
staff.setPersonnelRelationUnitId(user.getUnitid());
staff.setPersonnelRelationUnitName(user.getUnitname());
staff.setUnionRelationUnionId(union.getId());
staff.setUnionRelationUnionName(union.getUnionname());
staff.setIsManyUnit(false);
staff.setSpecialStaffType("HMC_RELATION");
dao.insert(staff);
}
}
Sys_user sysUser = new Sys_user();
BeanUtil.copyProperties(record, sysUser);
sysUser.setId(user.getId());
dao.updateIgnoreNull(sysUser);
MemberApplyToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
} else {
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核拒绝"));
}
MemberApplyToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
return null;
}
@@ -174,7 +158,7 @@ public class MemberApplyBranchUnionAuditController {
.add("branchUnionAuditId", null), Cnd.where("id", "=", id));
dao.clear(Audit.class, Cnd.where("id", "=", record.getBranchUnionAuditId()));
// 待办撤回
localProcessService.revokeTask("MEMBER_APPLY@" + id, "分工会审核");
localProcessService.revokeTask("MEMBER_APPLY@" + id, "待分工会审核");
return null;
}
}
@@ -3,7 +3,10 @@ package io.v.nutz.zhgh.staffmanage.member.controller.apply;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.models.User;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
@@ -101,6 +104,12 @@ public class MemberApplyController {
@RequiresPermissions("member.apply.submit")
@SLog(tag = "会员入会申请", msg = "提交申请")
public Object doSubmit(MemberApplyRecord record){
int count = dao.count(Sys_user_role.class, Cnd.where("userId", "=", record.getUserId()).and("roleId", "=", Roles.MEMBER));
if (count > 0) {
return Result.error("您已经是会员,请勿重复申请");
}
record.setMember(true);
record.setUserId(ShiroUtil.getUserId());
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
@@ -110,20 +119,14 @@ public class MemberApplyController {
if (record.getApplyStateId() != null && List.of(30, 60).contains(record.getApplyStateId())) {
MemberApplyToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(record, NutMap.NEW().addv("nodeName", "重新修改申请"));
}
// 待校工会审核
// 待分工会审核
record.setApplyStateId(20);
dao.insertOrUpdate(record);
// 审核流程开始
MemberApplyToDoHandler.START_PROCESS.exec(record, null);
MemberApplyToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
MemberApplyToDoHandler.CREATE_UNION_TASK.exec(record, null);
// 短信通知
// List<String> schoolLoginNameList = commonService.getSchoolOrBranchUnionMemberAdminLoginNames("school", null);
// String schoolLoginNameListStr = schoolLoginNameList.stream().distinct().collect(Collectors.joining(","));
//
// String content = "%s老师正申请加入工会,请您点击此条消息或前往智慧工会进行审核";
// msgApi.sendMsg(List.of("DingTalk"), schoolLoginNameListStr, 2, "协会入会邀请", content, "", "");
return null;
}
@@ -1,11 +1,15 @@
package io.v.nutz.zhgh.staffmanage.member.controller.apply;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.model.Audit;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.sys.models.User;
import io.v.nutz.sys.services.SysLocalProcessService;
import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.web.commons.utils.ShiroUtil;
@@ -28,6 +32,13 @@ import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @version 1.0
* @Author zzr
@@ -145,4 +156,28 @@ public class MemberApplyMineController {
}
return nutMap;
}
@At
@Ok("void")
@RequiresPermissions("member.apply.mine")
@SLog(tag = "会员入会申请", msg = "导出开卡证明")
public void doExportProve(HttpServletResponse response){
try {
User user = dao.fetch(User.class, Cnd.where("id","=",ShiroUtil.getUserId()));
Map<String, Object> map = new HashMap<String, Object>();
map.put("userName", user.getUsername());
map.put("unitName", user.getUnitname());
map.put("idCard", user.getIdcard());
map.put("date", DateUtil.format(new Date(),"yyyy年MM月dd日"));
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String("办卡申请".getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
Configure config = Configure.newBuilder().build();
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/member/addIdCard.docx");
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,11 +1,19 @@
package io.v.nutz.zhgh.staffmanage.member.controller.apply;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.model.Audit;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.models.User;
import io.v.nutz.sys.services.SysLocalProcessService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.staffmanage.member.handle.MemberApplyToDoHandler;
@@ -22,6 +30,7 @@ import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@@ -44,6 +53,10 @@ public class MemberApplySchoolUnionAuditController {
@Inject
private Dao dao;
@Inject
private MsgApi msgApi;
@Inject
private SysUserService sysUserService;
@Inject
private MemberCommonService memberCommonService;
@Inject
private SysLocalProcessService localProcessService;
@@ -51,16 +64,18 @@ public class MemberApplySchoolUnionAuditController {
@At("/")
@Ok("beetl:/platform/member/apply/schoolUnionAudit/index.html")
@RequiresPermissions("member.apply.schoolUnion.audit")
public void index() {}
public void index() {
}
@At("/h5")
@Ok("beetl:/mobile/member/apply/schoolUnionAudit/index.html")
@RequiresPermissions("member.apply.schoolUnion.audit")
public void h5() {}
public void h5() {
}
@At
@RequiresPermissions("member.apply.schoolUnion.audit")
public Object pageData(MemberApplyPageForm pageForm){
public Object pageData(MemberApplyPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
record.*,
@@ -75,9 +90,9 @@ public class MemberApplySchoolUnionAuditController {
Cnd cnd = Cnd.NEW();
pageForm.buildSearch(cnd, "record.");
if (pageForm.getAudit()) {
cnd.and("record.applyStateId", ">", 20);
cnd.and("record.applyStateId", ">", 50);
} else {
cnd.and("record.applyStateId", "=", 20);
cnd.and("record.applyStateId", "=", 50);
}
cnd.desc("record.applyDateTime");
sql.setCondition(cnd);
@@ -91,7 +106,7 @@ public class MemberApplySchoolUnionAuditController {
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.apply.schoolUnion.audit")
@SLog(type = "memberApply", tag = "会员入会申请", msg = "校工会审核")
public Object approval(@Param("audit") Audit audit, String id, String unionId){
public Object approval(@Param("audit") Audit audit, String id) {
audit.setAuditor(ShiroUtil.getUserId());
audit.setLoginname(ShiroUtil.getPlatformLoginname());
audit.setUsername(ShiroUtil.getPlatformUsername());
@@ -101,52 +116,43 @@ public class MemberApplySchoolUnionAuditController {
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
if (audit.getAuditType() == 2) {
// 退回修改
record.setApplyStateId(30);
record.setApplyStateId(60);
} else if (audit.getAuditType() == 1) {
// 通过
record.setApplyStateId(50);
record.setApplyStateId(80);
} else {
// 拒绝
record.setApplyStateId(40);
record.setApplyStateId(70);
}
record.setAllocationUnionId(unionId);
record.setSchoolUnionAuditId(audit.getId());
dao.updateIgnoreNull(record);
MemberApplyToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
if (audit.getAuditType() == 2) {
MemberApplyToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, null);
// 短信通知
// String content = "%s老师您好,您的入会申请被校工会退回,您可根据退回原因修改后再次提交,如有疑问请及时联系校工会".formatted(record.getUsername());
} else if (audit.getAuditType() == 1) {
Sql sql = Sqls.create("""
SELECT
u.loginname,
u.username
FROM
`sys_user_role` userRole
LEFT JOIN sys_role role ON role.id = userRole.roleId
LEFT JOIN `user` u ON u.id = userRole.userId
WHERE
role.`code` = 'BranchUnionMemberAdmin' and u.unionid = @unionId
group by u.loginname
""").setParam("unionId", unionId);
List<NutMap> list = memberCommonService.listMap(sql);
MemberApplyToDoHandler.COMPLETE_PROCESS.exec(record, null);
// 将填写内容修改到用户表
User user = dao.fetch(User.class, Cnd.where("id", "=", record.getUserId()));
Sys_user sysUser = new Sys_user();
BeanUtil.copyProperties(record, sysUser);
sysUser.setId(user.getId());
dao.updateIgnoreNull(sysUser);
List<String> unionLeaderLoginNames = list.stream().map(v -> v.getString("loginname")).toList();
MemberApplyToDoHandler.CREATE_UNION_TASK.exec(record, NutMap.NEW().addv("unionLeaderLoginNames", unionLeaderLoginNames));
// 还要设置会员角色
int count = dao.count(Sys_user_role.class, Cnd.where("userId", "=", user.getId()).and("roleId", "=", Roles.MEMBER));
if (count == 0) {
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(user.getId());
userRole.setRoleId(Roles.MEMBER);
dao.insert(userRole);
}
// 短信通知
// for (NutMap map : list) {
// String content = "%s老师您好,%s老师的入会申请校工会已通过,现将工会关系划入本工会,请您点击此消息或前往智慧工会进行接收"
// .formatted(map.getString("username"), record.getUsername());
// }
sysUserService.deleteCacheAndUpdate(user.getId());
} else {
MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核拒绝"));
// 短信通知
// String content = "%s老师您好,您的入会申请被校工会拒绝,如有疑问请及时联系校工会".formatted(record.getUsername());
}
MemberApplyToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
return null;
}
@@ -156,13 +162,13 @@ public class MemberApplySchoolUnionAuditController {
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.apply.schoolUnion.audit")
@SLog(type = "memberApply", tag = "会员入会申请", msg = "校工会撤回")
public Object doRevoke(String id){
public Object doRevoke(String id) {
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
dao.update(MemberApplyRecord.class, Chain.make("applyStateId", 20)
dao.update(MemberApplyRecord.class, Chain.make("applyStateId", 50)
.add("schoolUnionAuditId", null), Cnd.where("id", "=", id));
dao.clear(Audit.class, Cnd.where("id", "=", record.getSchoolUnionAuditId()));
// 待办撤回
localProcessService.revokeTask("MEMBER_APPLY@" + id, "校工会审核");
localProcessService.revokeTask("MEMBER_APPLY@" + id, "待校工会审核");
return null;
}
}
@@ -11,8 +11,6 @@ import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.staffmanage.member.handle.MemberChangeToDoHandler;
import io.v.nutz.zhgh.staffmanage.member.model.MemberChangeRecord;
import io.v.nutz.zhgh.staffmanage.member.param.pageForm.MemberChangePageForm;
import io.v.nutz.zhgh.staffmanage.member.param.vo.MemberChangeBranchUnionAuditVo;
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -29,6 +27,8 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @version 1.0
* @Author zzr
@@ -96,7 +96,7 @@ public class MemberChangeBranchUnionAuditController {
audit.setLoginname(ShiroUtil.getPlatformLoginname());
audit.setUsername(ShiroUtil.getPlatformUsername());
audit.setAuditTime(DateUtil.date());
audit = dao.insert(audit);
dao.insert(audit);
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
if (audit.getAuditType() == 2) {
@@ -124,28 +124,41 @@ public class MemberChangeBranchUnionAuditController {
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.change.branchUnion.audit")
@SLog(type = "memberChange", tag = "会员变更", msg = "分工会批量审核")
public Object allApproval(MemberChangeBranchUnionAuditVo memberChangeBranchUnionAuditVo){
Audit audit = memberChangeBranchUnionAuditVo.getAudit();
public Object doBatchApproval(@Param("data") String[] ids){
if (ids.length == 0) {
return Result.error("未获取到选择数据");
}
// 批量审核,那就只有一条审核的记录
Audit audit = new Audit();
audit.setAuditor(ShiroUtil.getUserId());
audit.setLoginname(ShiroUtil.getPlatformLoginname());
audit.setUsername(ShiroUtil.getPlatformUsername());
audit.setAuditTime(DateUtil.date());
audit.setAuditOpinion("通过");
audit = dao.insert(audit);
for (String id : memberChangeBranchUnionAuditVo.getIds()) {
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
// 通过
record.setApplyStateId(10050);
record.setBranchUnionAuditId(audit.getId());
dao.updateIgnoreNull(record);
audit.setAuditOpinion("分工会批量审核通过");
dao.insert(audit);
// 查询要审核的变更记录
List<MemberChangeRecord> recordList = dao.query(MemberChangeRecord.class, Cnd.where("id", "in", ids));
for (MemberChangeRecord record : recordList) {
// 批量推送待办
MemberChangeToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
MemberChangeToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
// 推送短信
}
dao.update(MemberChangeRecord.class,
Chain.make("applyStateId", 10050).add("branchUnionAuditId", audit.getId()),
Cnd.where("id", "in", ids));
return null;
}
@@ -37,6 +37,7 @@ import io.v.nutz.zhgh.staffmanage.member.template.MemberTemp;
import io.v.nutz.zhgh.staffmanage.member.utils.MemberUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
@@ -72,33 +73,32 @@ import java.util.stream.Collectors;
@Slf4j
public class MemberChangeManageController {
@Inject
private MemberCommonService memberService;
@Inject
private AuditService auditService;
@Inject("MemberChangeRecord")
private ViService<MemberChangeRecord> recordViService;
@Inject
private Vi vi;
@Inject
private Dao dao;
@Inject
private SysUnitService sysUnitService;
@Inject
private SysUserService sysUserService;
@At("")
@Ok("beetl:/platform/member/change/manage/index.html")
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public void index() {
}
@Inject
private MemberCommonService memberService;
@Inject
private AuditService auditService;
@Inject("MemberChangeRecord")
private ViService<MemberChangeRecord> recordViService;
@Inject
private Vi vi;
@Inject
private Dao dao;
@Inject
private SysUnitService sysUnitService;
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object pageData(@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "threeUnitId", required = false) String threeUnitId,
@@ -276,7 +276,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
@SLog(tag = "会员高级管理-会员变更", msg = "分工会/校工会会员管理员提交变更")
public Object doSubmitChange(MemberChangeRecord record) {
// 检验是否有变更
@@ -340,7 +340,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object sendSms(String userid) {
Sys_user user = userService.fetch(userid);
/*if (Strings.isNotBlank(user.getMobile())) {
@@ -356,10 +356,13 @@ public class MemberChangeManageController {
*/
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object allIsWelfareMember(PageForm pageForm,
@Param(value = "startDate", required = false) String startDate,
@Param(value = "endDate", required = false) String endDate,
@Param(value = "commonStartDate", required = false) String commonStartDate,
@Param(value = "commonEndDate", required = false) String commonEndDate,
@Param(value = "birthMonth", required = false) String birthMonth,
@Param(value = "year", required = false) Integer year,
@Param(value = "unionId", required = false) String[] unionId,
@Param(value = "unitId", required = false) String[] unitId,
@@ -378,9 +381,11 @@ public class MemberChangeManageController {
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord,
@Param(value = "isAppendWelfareMember", required = false) Boolean isAppendWelfareMember) {
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
Cnd cnd = MemberUtils.getCnd(pageForm, startDate, endDate, unionId, unitId, personTypes, userStates, null, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
Cnd cnd = MemberUtils.getCnd(pageForm, startDate, endDate, birthMonth, commonStartDate, commonEndDate, unionId, unitId,
personTypes, userStates, null, memberTypes, sexTypes, age, null, roleIds, null,
null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
Sql sql = Sqls.create("""
SELECT u.* from $table
SELECT u.id from $table
LEFT JOIN sys_user_role sur ON sur.userid = u.id
$condition
""");
@@ -396,10 +401,6 @@ public class MemberChangeManageController {
if (StrUtil.isNotBlank(memberSearchName)) {
cnd.and(new SqlExpressionGroup().andLike(memberSearchName, memberSearchKeyWord));
}
List<Integer> status = new ArrayList<>();
// status.add(MemberStatus.NORMAL.getCode());
// status.add(MemberStatus.TURN_IN.getCode());
// status.add(MemberStatus.RESTORE.getCode());
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
cnd.and("unionid", "=", Vi.getUnionId());
@@ -409,13 +410,24 @@ public class MemberChangeManageController {
}
cnd.groupBy("u.id");
sql.setCondition(cnd);
List<String> ids = memberService.list(sql).stream().map(v -> v.getString("id")).collect(Collectors.toList());
sql.setCallback(Sqls.callback.strList());
dao.execute(sql);
List<String> ids = sql.getList(String.class);
// 杭医特有,他们有一个福利享受截止时间,在这个时间之前的退休人员,也需要享受福利
Sql welfareSql = Sqls.create("select id from sys_user where welfareStopTime < CURDATE() and userState = '退休'");
welfareSql.setCallback(Sqls.callback.strList());
dao.execute(welfareSql);
ids.addAll(welfareSql.getList(String.class));
Trans.exec(() -> {
if (!isAppendWelfareMember) {
memberService.update(Chain.make("welfareMember", WelfareMemberMode.NONE.getCode()), Cnd.where("welfareMember", "=", WelfareMemberMode.NORMAL.getCode()));
}
memberService.update(Chain.make("welfareMember", WelfareMemberMode.NORMAL.getCode()), Cnd.where("member", "=", MemberMode.NORMAL.getCode()).and("id", "in", ids));
// memberService.update(Chain.make("welfareMember", WelfareMemberMode.NORMAL.getCode()), Cnd.where("member", "=", MemberMode.NORMAL.getCode()).and("id", "in", ids));
dao.update(Sys_user.class, Chain.make("welfareMember", true), Cnd.where("id", "in", ids));
});
return null;
}
@@ -428,7 +440,7 @@ public class MemberChangeManageController {
*/
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object userUnitMove(String threeUnitId, String unitId, @Param("userId[]") String[] userId) {
Sys_unit unit = memberService.dao().fetch(Sys_unit.class, unitId);
@@ -465,7 +477,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object userPageData(PageForm pageForm,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "unionId", required = false) String unionId,
@@ -504,7 +516,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object joinWelfareMember(String[] userIds, String taskId,
@Param(value = "threeUnitId", required = false) String threeUnitId,
@Param(value = "unitId", required = false) String unitId) {
@@ -547,7 +559,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object units() {
Cnd cnd = Cnd.NEW();
cnd.and("unitlevel", "=", 2);
@@ -559,7 +571,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object batchUpdatePersonType(@Param("users") String data) {
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
for (Sys_user user : users) {
@@ -570,7 +582,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object batchUpdateUserState(@Param("users") String data) {
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
for (Sys_user user : users) {
@@ -582,7 +594,7 @@ public class MemberChangeManageController {
@At
@Ok("void")
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public void downloadImport(HttpServletResponse response) {
try {
ViTool.excelResponse(response, "会员导入模版.xlsx");
@@ -612,7 +624,7 @@ public class MemberChangeManageController {
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@SLog(type = "会员管理系统", tag = "信息维护-会员高级管理", msg = "导入会员", param = true, result = true)
public Object doImport(TempFile file) {
@@ -726,7 +738,7 @@ public class MemberChangeManageController {
@At
@ViReturn
@RequiresPermissions("member.change.mange")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object getAllChangeMemberInfo(String userId){
List<NutMap> mapList = memberService.getAllChangeInfo(userId);
if (Lang.isEmpty(mapList)) {
@@ -739,4 +751,49 @@ public class MemberChangeManageController {
map.put("allChangeInfo", mapList);
return map;
}
/**
* 验证工号是否重复
* @param loginName
* @return
*/
@At
@ViReturn
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object validLoginName(String loginName){
return dao.count(Sys_user.class, Cnd.where("loginname", "=", loginName));
}
@At
@SLog(type = "memberChangeMember", tag = "会员高级管理", msg = "添加非库内人员")
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"}, logical = Logical.OR)
public Object doAddUser(Sys_user user){
try {
if (Lang.isEmpty(user)) {
return Result.error("用户信息为空!");
}
int count = dao.count(Sys_user.class, Cnd.where("loginname", "=", user.getLoginname()));
if (count > 0) {
return Result.error("工号已存在!");
}
// 初始化用户并添加到系统
Sys_user sysUser = UserMode.initUser(user);
dao.insert(sysUser);
// 添加公共角色
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(sysUser.getId());
userRole.setRoleId(Roles.PUBLIC);
dao.insert(userRole);
sysUserService.deleteCacheAndUpdate(sysUser.getId());
return Result.success();
} catch (Exception e) {
log.error(e.getMessage());
return Result.error();
}
}
}
@@ -27,6 +27,8 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @version 1.0
* @Author zzr
@@ -116,7 +118,7 @@ public class MemberChangeSchoolUnionAuditController {
MemberChangeToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会退回"));
} else if (audit.getAuditType() == 1) {
MemberChangeToDoHandler.COMPLETE_PROCESS.exec(record, null);
memberCommonService.compareChangeInfoAndUpdateMember(record.getId());
memberCommonService.compareChangeInfoAndUpdateMember(record);
} else {
MemberChangeToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核拒绝"));
}
@@ -124,6 +126,44 @@ public class MemberChangeSchoolUnionAuditController {
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("member.change.schoolUnion.audit")
@SLog(type = "memberChange", tag = "会员变更", msg = "校工会批量审核")
public Object doBatchApproval(@Param("data") String[] ids){
if (ids.length == 0) {
return Result.error("未获取到选择数据");
}
// 批量审核,那就只有一条审核的记录
Audit audit = new Audit();
audit.setAuditor(ShiroUtil.getUserId());
audit.setLoginname(ShiroUtil.getPlatformLoginname());
audit.setUsername(ShiroUtil.getPlatformUsername());
audit.setAuditTime(DateUtil.date());
audit.setAuditOpinion("校工会批量审核通过");
dao.insert(audit);
// 查询要审核的变更记录
List<MemberChangeRecord> recordList = dao.query(MemberChangeRecord.class, Cnd.where("id", "in", ids));
for (MemberChangeRecord record : recordList) {
// 批量完成待办
MemberChangeToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
MemberChangeToDoHandler.COMPLETE_PROCESS.exec(record, null);
memberCommonService.compareChangeInfoAndUpdateMember(record.getId());
// 推送短信
}
dao.update(MemberChangeRecord.class,
Chain.make("applyStateId", 10080).add("schoolUnionAuditId", audit.getId()),
Cnd.where("id", "in", ids));
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@@ -52,8 +52,8 @@ public class MemberAnalysisController {
gh.unioncode as unionCode,
gh.unionname as unionName,
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unionid = gh.id ) AS '往年会员人数',
( SELECT count( 1 ) FROM member_change_record WHERE currentUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我工会人数',
( SELECT count( 1 ) FROM member_change_record WHERE originUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我工会减少人数',
( SELECT count( 1 ) FROM member_change_record WHERE unitId = gh.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动变动到我工会人数',
( SELECT count( 1 ) FROM member_change_record WHERE changeOrigin = gh.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动我工会减少人数',
(
SELECT
count( 1 )
@@ -61,9 +61,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 2, 7 )
mcr.`changeType` IN ( 2, 7 )
AND u.unionid = gh.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '新入职、恢复人数',
(
SELECT
@@ -72,9 +72,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 3, 4, 5, 6, 8 )
mcr.`changeType` IN ( 3, 4, 5, 6, 8 )
AND u.unionid = gh.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '离职、去世、退休、开除、退会人数',
(select count(1) from `user` where member = 1 and unionid = gh.id) as currentYearMemberNum
FROM
@@ -123,8 +123,8 @@ public class MemberAnalysisController {
dw.unitcode as unitCode,
dw.`name` as unitName,
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unitid = dw.id ) AS '往年会员人数',
( SELECT count( 1 ) FROM member_change_record WHERE currentUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我单位人数',
( SELECT count( 1 ) FROM member_change_record WHERE originUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我单位减少人数',
( SELECT count( 1 ) FROM member_change_record WHERE unitId = dw.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动变动到我单位人数',
( SELECT count( 1 ) FROM member_change_record WHERE changeOrigin = dw.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动我单位减少人数',
(
SELECT
count( 1 )
@@ -132,9 +132,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 2, 7 )
mcr.`changeType` IN ( 2, 7 )
AND u.unitid = dw.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '新入职、恢复人数',
(
SELECT
@@ -143,9 +143,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 3, 4, 5, 6, 8 )
mcr.`changeType` IN ( 3, 4, 5, 6, 8 )
AND u.unitid = dw.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '离职、去世、退休、开除、退会人数',
(select count(1) from `user` where member = 1 and unitid = dw.id) as currentYearMemberNum
FROM
@@ -192,8 +192,8 @@ public class MemberAnalysisController {
dw.unitcode as unitCode,
dw.`name` as unitName,
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unitid = dw.id ) AS '往年会员人数',
( SELECT count( 1 ) FROM member_change_record WHERE currentUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我单位人数',
( SELECT count( 1 ) FROM member_change_record WHERE originUnitId = dw.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我单位减少人数',
( SELECT count( 1 ) FROM member_change_record WHERE unitId = dw.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动变动到我单位人数',
( SELECT count( 1 ) FROM member_change_record WHERE changeOrigin = dw.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动我单位减少人数',
(
SELECT
count( 1 )
@@ -201,9 +201,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 2, 7 )
mcr.`changeType` IN ( 2, 7 )
AND u.unitid = dw.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '新入职、恢复人数',
(
SELECT
@@ -212,9 +212,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 3, 4, 5, 6, 8 )
mcr.`changeType` IN ( 3, 4, 5, 6, 8 )
AND u.unitid = dw.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '离职、去世、退休、开除、退会人数',
(select count(1) from `user` where member = 1 and unitid = dw.id) as currentYearMemberNum
FROM
@@ -228,8 +228,8 @@ public class MemberAnalysisController {
gh.unioncode as unionCode,
gh.unionname as unionName,
( SELECT count( 1 ) FROM member_his WHERE `year` = @lastYear AND unionid = gh.id ) AS '往年会员人数',
( SELECT count( 1 ) FROM member_change_record WHERE currentUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动变动到我单位人数',
( SELECT count( 1 ) FROM member_change_record WHERE originUnionId = gh.id AND currentUnitId != originUnitId AND YEAR ( applyTime ) = @currentYear ) AS '校内异动我单位减少人数',
( SELECT count( 1 ) FROM member_change_record WHERE unitId = gh.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动变动到我单位人数',
( SELECT count( 1 ) FROM member_change_record WHERE changeOrigin = gh.id AND unitId != changeOrigin AND YEAR ( applyDateTime ) = @currentYear ) AS '校内异动我单位减少人数',
(
SELECT
count( 1 )
@@ -237,9 +237,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 2, 7 )
mcr.`changeType` IN ( 2, 7 )
AND u.unionid = gh.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '新入职、恢复人数',
(
SELECT
@@ -248,9 +248,9 @@ public class MemberAnalysisController {
member_change_record mcr
LEFT JOIN `user` u ON u.id = mcr.userId
WHERE
mcr.`type` IN ( 3, 4, 5, 6, 8 )
mcr.`changeType` IN ( 3, 4, 5, 6, 8 )
AND u.unionid = gh.id
AND YEAR ( mcr.applyTime ) = @currentYear
AND YEAR ( mcr.applyDateTime ) = @currentYear
) AS '离职、去世、退休、开除、退会人数',
(select count(1) from `user` where member = 1 and unionid = gh.id) as currentYearMemberNum
FROM
@@ -73,6 +73,9 @@ public class MemberInquireIntegrateController {
@Param(value = "isUnion", required = false) String isUnion,
@Param(value = "startDate", required = false) String startDate,
@Param(value = "endDate", required = false) String endDate,
@Param(value = "commonStartDate", required = false) String commonStartDate,
@Param(value = "commonEndDate", required = false) String commonEndDate,
@Param(value = "birthMonth", required = false) String birthMonth,
@Param(value = "year", required = false) Integer year,
@Param(value = "unionId", required = false) String[] unionId,
@Param(value = "unitId", required = false) String[] unitId,
@@ -93,7 +96,9 @@ public class MemberInquireIntegrateController {
@Param(value = "memberSearchKeyWord", required = false) String memberSearchKeyWord) {
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
Cnd cnd = MemberUtils.getCnd(pageForm, startDate, endDate, unionId, unitId, personTypes, userStates, preparedBys, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
Cnd cnd = MemberUtils.getCnd(pageForm, startDate, endDate, commonStartDate, commonEndDate, birthMonth, unionId,
unitId, personTypes, userStates, preparedBys, memberTypes, sexTypes, age, null, roleIds,
null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
Sql sql = Sqls.create("""
SELECT u.* from $table
@@ -442,6 +447,9 @@ public class MemberInquireIntegrateController {
@Param(value = "searchKeyword", required = false) String searchKeyword,
@Param(value = "startDate", required = false) String startDate,
@Param(value = "endDate", required = false) String endDate,
@Param(value = "commonStartDate", required = false) String commonStartDate,
@Param(value = "commonEndDate", required = false) String commonEndDate,
@Param(value = "birthMonth", required = false) String birthMonth,
@Param(value = "year", required = false) Integer year,
@Param(value = "unionId", required = false) String[] unionId,
@Param(value = "unitId", required = false) String[] unitId,
@@ -464,7 +472,9 @@ public class MemberInquireIntegrateController {
try {
int yyyy = Calendar.getInstance().get(Calendar.YEAR);
Cnd cnd = MemberUtils.getCnd(null, startDate, endDate, unionId, unitId, personTypes, userStates, preparedBys, memberTypes, sexTypes, age, null, roleIds, null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
Cnd cnd = MemberUtils.getCnd(null, startDate, endDate, commonStartDate, commonEndDate, birthMonth,
unionId, unitId, personTypes, userStates, preparedBys, memberTypes, sexTypes, age, null, roleIds,
null, null, memberStatus, threeUnitId, unionGroupId, reverseSelection, null, null, campus);
Sql sql = Sqls.create("""
SELECT u.* from $table
@@ -92,6 +92,44 @@ public enum MemberApplyToDoHandler {
}
},
/**
* 创建分工会任务
*/
CREATE_UNION_TASK() {
@Override
public void exec(MemberApplyRecord record, NutMap extra) {
List<String> unionLeaderLoginNames = memberService.getSchoolOrBranchUnionMemberAdminLoginNames("branch", record.getUserId());
localProcessService.createTask(
"MEMBER_APPLY@" + record.getId(),
"MEMBER_APPLY_UNION_AUDIT",
"待分工会审核",
ShiroUtil.getUserId(),
unionLeaderLoginNames,
"/platform/member/apply/branchUnion/audit",
"/platform/member/apply/branchUnion/audit",
"/platform/member/apply/branchUnion/audit",
"/platform/member/apply/branchUnion/audit"
);
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "待分工会审核");
}
},
/**
* 分工会完成
*/
COMPLETE_UNION_TASK() {
@Override
public void exec(MemberApplyRecord record, NutMap extra) {
String nodeName = extra.getString("nodeName");
localProcessService.completeTask(
"MEMBER_APPLY_UNION_AUDIT",
"MEMBER_APPLY@" + record.getId(),
ShiroUtil.getUserId(),
nodeName
);
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), nodeName);
}
},
/**
* 创建校工会任务
@@ -117,7 +155,6 @@ public enum MemberApplyToDoHandler {
}
},
/**
* 校工会完成
*/
@@ -136,46 +173,6 @@ public enum MemberApplyToDoHandler {
},
/**
* 创建分工会任务
*/
CREATE_UNION_TASK() {
@Override
public void exec(MemberApplyRecord record, NutMap extra) {
List<String> unionLeaderLoginNames = extra.getAsList("unionLeaderLoginNames", String.class);
localProcessService.createTask(
"MEMBER_APPLY@" + record.getId(),
"MEMBER_APPLY_UNION_AUDIT",
"分工会审核",
ShiroUtil.getUserId(),
unionLeaderLoginNames,
"/platform/member/apply/branchUnion/audit",
"/platform/member/apply/branchUnion/audit",
"/platform/member/apply/branchUnion/audit",
"/platform/member/apply/branchUnion/audit"
);
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "分工会审核");
}
},
/**
* 分工会完成
*/
COMPLETE_UNION_TASK() {
@Override
public void exec(MemberApplyRecord record, NutMap extra) {
String nodeName = extra.getString("nodeName");
localProcessService.completeTask(
"MEMBER_APPLY_UNION_AUDIT",
"MEMBER_APPLY@" + record.getId(),
ShiroUtil.getUserId(),
nodeName
);
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), nodeName);
}
},
/**
* 审核拒绝
*/
@@ -196,6 +193,17 @@ public enum MemberApplyToDoHandler {
localProcessService.completeProcess("MEMBER_APPLY@" + record.getId());
localProcessService.updateProcessNodeName("MEMBER_APPLY@" + record.getId(), "审核通过");
}
},
/**
* 删除流程
*/
DELETE_PROCESS() {
@Override
public void exec(MemberApplyRecord record, NutMap extra) {
localProcessService.deleteProcessInstance("MEMBER_APPLY@" + record.getId());
}
};
@@ -217,4 +217,14 @@ public class MemberApplyRecord {
@Comment("分配的工会关系")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String allocationUnionId;
@Column
@Comment("是否自愿加入工会")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isVoluntary;
@Column
@Comment("签字")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sign;
}
@@ -239,5 +239,15 @@ public class MemberChangeRecord {
@PrevInsert(now = true)
private Date applyDateTime;
@Column
@Comment("会员加入时间")
@ColDefine(type = ColType.DATETIME)
private Date memberJoinTime;
@Column
@Comment("离校日期")
@ColDefine(type = ColType.DATE)
private Date leaveSchoolDate;
private Boolean edit;
}
@@ -1,16 +0,0 @@
package io.v.nutz.zhgh.staffmanage.member.param.vo;
import io.v.nutz.base.model.Audit;
import lombok.Data;
import java.util.List;
/**
* @author hpf
*/
@Data
public class MemberChangeBranchUnionAuditVo {
private Audit audit;
private List<String> ids;
}
@@ -78,6 +78,11 @@ public interface MemberCommonService extends ViService<Sys_user> {
* @param recordId
*/
void compareChangeInfoAndUpdateMember(String recordId);
/**
* 存储比较变更信息并更新会员信息
* @param record
*/
void compareChangeInfoAndUpdateMember(MemberChangeRecord record);
/**
* 获取会员的变更信息
@@ -3,6 +3,7 @@ package io.v.nutz.zhgh.staffmanage.member.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.dao.CndPlus;
@@ -23,10 +24,12 @@ import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
import io.v.nutz.zhgh.welfare.model.WelfareList;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
@@ -76,7 +79,7 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
@Override
public List<NutMap> memberChangeRecords(String userId) {
Sql sql = Sqls.create(MEMBER_CHANGE_RECORDS);
sql.setCondition(Cnd.where("mcr.userId", "=", userId).desc("mcr.applyTime"));
sql.setCondition(Cnd.where("mcr.userId", "=", userId).desc("mcr.applyDateTime"));
return listMap(sql);
}
@@ -108,13 +111,13 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
his.lastHistoryId,
u.unitname,
u.unionname,
mcr.stateId,
mcr.applyStateId,
state.stateName,
state.stateColor
FROM
`user_history` his
LEFT JOIN member_change_record mcr ON mcr.id = his.memberChangeRecordId
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
LEFT JOIN audit_state state ON mcr.applyStateId = state.stateId
LEFT JOIN `user` u ON u.loginname = his.loginname
$condition
""");
@@ -159,10 +162,10 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
List<Sys_dict> dictList = sysDictService.getSubListByCode("ALLOW_CHANGE_FIELDS");
Set<String> allowChangeFieldNames = dictList.stream().map(Sys_dict::getCode).collect(Collectors.toSet());
allowChangeFieldNames.add("member");
allowChangeFieldNames.add("welfareMember");
// allowChangeFieldNames.add("welfareMember");
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
dictMap.put("member", "会员状态");
dictMap.put("welfareMember", "福利会员状态");
// dictMap.put("welfareMember", "福利会员状态");
return NutMap.NEW().addv("allowChangeFieldNames", allowChangeFieldNames).addv("dictMap", dictMap);
}
@@ -234,6 +237,14 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
@Override
public void compareChangeInfoAndUpdateMember(String recordId) {
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, recordId);
compareChangeInfoAndUpdateMember(record);
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void compareChangeInfoAndUpdateMember(MemberChangeRecord record) {
// 记录变更时间
Date now = DateUtil.date();
List<NutMap> changeList = getChangeInfos(record);
// 如果有工会关系人员,这个user用来存储数据
@@ -247,12 +258,11 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
}
if (Lang.isNotEmpty(history)) {
history.setRecordId(recordId);
history.setRecordId(record.getId());
history.setChangeTime(DateUtil.date());
history.setChangeTypes(record.getChangeTypes());
history.setChangeOrigin(record.getChangeOrigin());
// 加入会员
if (record.getMember()) {
int activityCount = dao().count(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
@@ -268,20 +278,34 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
}
}
if (memberCount <= 0) {
// 赋予会员角色
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(userId);
userRole.setRoleId(Roles.MEMBER);
dao().insert(userRole);
// 记录入会时间,要判断user表里有没有存储会员加入时间的字段
if (info.getMemberJoinTime() == null) {
record.setMemberJoinTime(now);
}
}
// 杭医特有,其他学校请删除
record.setPreparedBy("会员");
} else {
if (record.getIsExitActivityMemberScope() != null && record.getIsExitActivityMemberScope()) {
dao().clear(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
}
dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", Roles.MEMBER));
// 杭医特有,其他学校请删除
record.setPreparedBy("教职工");
// 看这个人的在职状态是退休或者是离职,记录退休时间和离职时间
switch (record.getUserState()) {
case "退休" -> {
if (info.getRetireDate() == null) {
record.setRetireDate(now);
}
}
case "离职" -> {
if (info.getLeaveSchoolDate() == null) {
record.setLeaveSchoolDate(now);
}
}
}
}
// 加入福利会员 是否加入福利项目
@@ -348,10 +372,11 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
sysUserService.clearCache();
sysRoleService.clearCache();
sysUserService.deleteCacheAndUpdate(info.getId());
}
}
/**
* 获取所有变更记录
* @param userId
@@ -406,9 +431,14 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
Object currentValue = this.booleanVerification(newMap.get(fieldName));
Object previousValue = this.booleanVerification(sourceMap.get(fieldName));
if ("unitId".equals(fieldName)) {
currentValue = (newMap.get(fieldName) == null ? this.booleanVerification(newMap.get("unitid")) : currentValue);
previousValue = (sourceMap.get(fieldName) == null ? this.booleanVerification(sourceMap.get("unitid")) : previousValue);
}
if (!ObjectUtil.equals(currentValue, previousValue)) {
String name = fieldsMap.getOrDefault(fieldName, fieldName);
if ("unitId".equals(fieldName)) {
if ("unitId".equals(fieldName) || "unitid".equals(fieldName)) {
List<Sys_unit> unitList = dao().query(Sys_unit.class,
Cnd.where("id", "in", List.of(previousValue, currentValue)));
Object finalPreviousValue = previousValue;
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.staffmanage.member.utils;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.activity.models.ActivityUserCnd;
@@ -12,6 +13,9 @@ import org.nutz.dao.util.cri.Static;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import java.util.Arrays;
import java.util.List;
/**
* @author: Aaron
* @create: 2021-05-19 13:41
@@ -22,6 +26,9 @@ public class MemberUtils {
public static Cnd getCnd(PageForm pageForm,
String startDate,
String endDate,
String commonStartDate,
String commonEndDate,
String birthMonth,
String[] unionId,
String[] unitId,
String[] personTypes,
@@ -117,13 +124,47 @@ public class MemberUtils {
cnd.and(group);*/
}
if (StrUtil.isNotBlank(birthMonth)) {
cnd.and("MONTH(birthday)", EQ_OR_NEQ_OP, NumberUtil.parseInt(birthMonth));
}
if (Lang.isNotEmpty(userStates)) {
List<String> userStateList = Arrays.stream(userStates).toList();
if (StrUtil.isAllNotBlank(commonStartDate, commonEndDate)) {
for (String userState : userStateList) {
switch (userState) {
case "在职" -> {
cnd.and("DATE(u.memberJoinTime)",GE_OR_NGE_OP, commonStartDate);
cnd.and("DATE(u.memberJoinTime)",LE_OR_NLE_OP, commonEndDate);
}
case "离退休" -> {
cnd.and("DATE(u.retireDate)",GE_OR_NGE_OP, commonStartDate);
cnd.and("DATE(u.retireDate)",LE_OR_NLE_OP, commonEndDate);
}
case "离校" -> {
cnd.and("DATE(u.leaveSchoolDate)",GE_OR_NGE_OP, commonStartDate);
cnd.and("DATE(u.leaveSchoolDate)",LE_OR_NLE_OP, commonEndDate);
}
}
}
} else {
cnd.andEX("u.userState", IN_OR_NIN_OP, userStates);
}
}
cnd.andEX("u.unionid", IN_OR_NIN_OP, unionId);
cnd.andEX("u.unitid", IN_OR_NIN_OP, unitId);
cnd.andEX("u.threeUnitId", IN_OR_NIN_OP, threeUnitId);
cnd.andEX("u.unionGroupId", IN_OR_NIN_OP, unionGroupId);
cnd.andEX("u.campus", EQ_OR_NEQ_OP, campus);
cnd.andEX("u.personType", IN_OR_NIN_OP, personTypes);
cnd.andEX("u.userState", IN_OR_NIN_OP, userStates);
cnd.andEX("u.preparedBy", IN_OR_NIN_OP, preparedBys);
cnd.andEX("u.sex", IN_OR_NIN_OP, sexTypes);
cnd.andEX("sur.jdhid", EQ_OR_NEQ_OP, teacherMeetingId);
Binary file not shown.
@@ -71,7 +71,7 @@ layout("/mobile/platform.html"){
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="分工会入会接收" left-text="返回" left-arrow @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
<van-nav-bar title="分工会入会审核" left-text="返回" left-arrow @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
<van-search
v-model="pageForm.searchKeyword"
placeholder="请输入工号或者姓名进行查询"
@@ -103,7 +103,6 @@ layout("/mobile/platform.html"){
<van-row>
<van-col span="24"><span style="color: grey">工作单位:</span>{{item.unitName}}</van-col>
<van-col span="24"><span style="color: grey">所属工会:</span><span>{{item.unionName}}</span></van-col>
<van-col span="24"><span style="color: grey">分配工会:</span><span>{{item.allocationUnionName}}</span></van-col>
<van-col span="24"><span style="color: grey">在职状态:</span>{{item.userState}}</van-col>
<van-col span="24"><span style="color: grey">人员类型:</span><span>{{item.personType}}</span></van-col>
</van-row>
@@ -121,12 +120,12 @@ layout("/mobile/platform.html"){
type="info" style="margin-right: 4px">查看
</van-button>
<van-button size="small" type="primary"
v-if="item.applyStateId === 50"
v-if="item.applyStateId === 20"
@click="openApproval(item)"
style="margin-right: 4px">审核
</van-button>
<van-button size="small" type="danger"
v-if="[70].includes(item.applyStateId)"
v-if="[30, 40].includes(item.applyStateId)"
@click="openRevoke(item.id)"
style="margin-right: 4px">撤回
</van-button>
@@ -145,7 +144,7 @@ layout("/mobile/platform.html"){
</van-sticky>
<member-apply-audit-info ref="memberApplyAuditInfoRef"></member-apply-audit-info>
<div v-if="showApprovalForm">
<div class="process-title">{{ '分工会接收' }}</div>
<div class="process-title">{{ '分工会审核' }}</div>
<van-form>
<van-field label="审核人员" readonly name="username" v-model="formData.username" required></van-field>
<van-field label="审核时间" readonly name="auditTime" v-model="formData.auditTime" required></van-field>
@@ -153,7 +152,7 @@ layout("/mobile/platform.html"){
</van-form>
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button type="default" block @click="infoShow=false">取消</van-button>
<van-button type="danger" block @click.submit="doApproval(2)">退回申请</van-button>
<!-- <van-button type="danger" block @click.submit="doApproval(2)">退回申请</van-button>-->
<van-button type="danger" block @click.submit="doApproval(0)">拒绝接收</van-button>
<van-button type="primary" block @click.submit="doApproval(1)">同意接收</van-button>
</div>
@@ -74,23 +74,20 @@ const MEMBER_APPLY_AUDIT_INFO = {
</van-cell-group>
</van-tab>
<van-tab title="分工会审核信息" name="branch" v-if="viewData.branchAudit">
<van-cell-group>
<van-cell title="审核人员">{{ viewData.branchAudit.username }}</van-cell>
<van-cell title="审核时间">{{ viewData.branchAudit.auditTime }}</van-cell>
<van-cell title="审核意见">{{ viewData.branchAudit.auditOpinion }}</van-cell>
</van-cell-group>
</van-tab>
<van-tab title="校工会审核信息" name="school" v-if="viewData.schoolAudit">
<van-cell-group>
<van-cell title="审核人员">{{ viewData.schoolAudit.username }}</van-cell>
<van-cell title="审核时间">{{ viewData.schoolAudit.auditTime }}</van-cell>
<van-cell title="分配工会">{{ viewData.allocationUnionName }}</van-cell>
<van-cell title="审核意见">{{ viewData.schoolAudit.auditOpinion }}</van-cell>
</van-cell-group>
</van-tab>
<van-tab title="分工会接收信息" name="branch" v-if="viewData.branchAudit">
<van-cell-group>
<van-cell title="审核人员">{{ viewData.branchAudit.username }}</van-cell>
<van-cell title="审核时间">{{ viewData.branchAudit.auditTime }}</van-cell>
<van-cell title="审核意见">{{ viewData.branchAudit.auditOpinion }}</van-cell>
</van-cell-group>
</van-tab>
</van-tabs>
</div>
`,
@@ -2,229 +2,229 @@
layout("/mobile/platform.html"){
#-->
<style>
.van-doc-card {
margin: 14px;
padding: 12px 12px 12px 12px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 20px;
font-size: 15px;
position: relative;
}
.van-divider {
margin: 6px 0 6px 0;
}
.van-button--small {
border-radius: 8px;
height: 26px;
font-size: 16px;
}
.van-col {
line-height: 35px;
}
.title_span {
font-size: 16px;
font-weight: bold;
position: absolute;
left: -1px;
top: 11px;
color: #1867b0;
}
.title {
font-size: 18px;
font-weight: bold;
flex: 1;
overflow: hidden;
white-space: nowrap;
color: #1867b0;
}
p {
margin: 0 !important;
}
.info_tab .van-doc-card > div:first-child {
border: 2px #0e78c5 solid;
width: 26px;
border-radius: 6px;
position: absolute;
top: 0;
left: 20px;
}
.van-doc-card {
margin: 14px;
padding: 12px 12px 12px 12px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 20px;
font-size: 15px;
position: relative;
}
.van-divider {
margin: 6px 0 6px 0;
}
.van-button--small {
border-radius: 8px;
height: 26px;
font-size: 16px;
}
.van-col {
line-height: 35px;
}
.title_span {
font-size: 16px;
font-weight: bold;
position: absolute;
left: -1px;
top: 11px;
color: #1867b0;
}
.title {
font-size: 18px;
font-weight: bold;
flex: 1;
overflow: hidden;
white-space: nowrap;
color: #1867b0;
}
p {
margin: 0 !important;
}
.info_tab .van-doc-card > div:first-child {
border: 2px #0e78c5 solid;
width: 26px;
border-radius: 6px;
position: absolute;
top: 0;
left: 20px;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="我的入会申请" left-text="返回" left-arrow @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
<van-search
v-model="pageForm.searchKeyword"
placeholder="请输入工号或者姓名进行查询"
:show-action="false"
:reverse-color="false"
input-align="left"
@search="doSearch"
></van-search>
<van-dropdown-menu v-if="$auth.hasRoleOr('sysadmin, SchoolUnionMemberAdmin, BranchUnionMemberAdmin')" :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="unionList" @change="doSearch();flushUnits(pageForm.unionId)" v-model="pageForm.unionId"></van-dropdown-item>
<van-dropdown-item :options="unitList" @change="doSearch" v-model="pageForm.unitId"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<div>
<van-list v-if="tableData.length>0" v-model="tableLoading" :finished="tableFinished" finished-text="没有更多了" @load="pageData">
<div v-for="item in tableData" :key="item.id" class="van-doc-card">
<div>
<div style="display: flex; justify-content: space-between">
<div style="width: 74%">
<div class="van-ellipsis title">
<span class="title_span">|</span>
<span>{{item.username + '(' + item.loginname + ')'}}</span>
</div>
</div>
</div>
<div style="margin-top: 4px">
<van-row>
<van-col span="24"><span style="color: grey">工作单位:</span>{{item.unitName}}</van-col>
<van-col span="24"><span style="color: grey">所属工会:</span><span>{{item.unionName}}</span></van-col>
<van-col span="24"><span style="color: grey">在职状态:</span>{{item.userState}}</van-col>
<van-col span="24"><span style="color: grey">人员类型:</span><span>{{item.personType}}</span></van-col>
</van-row>
</div>
<van-divider></van-divider>
<div style="display: flex; justify-content: space-between; align-items: center">
<div>
<span style="color: grey">当前状态:</span>
<span>{{item.stateName}}</span>
</div>
<div>
<van-button size="small" @click="openView(item)"
type="info" style="margin-right: 4px">查看
</van-button>
<van-button size="small" @click="pjaxReplace('/platform/member/apply/submit/h5?id=' + item.id)"
v-if="[10,30,60].includes(item.applyStateId) && item.userId == user.id"
type="info" style="margin-right: 4px">编辑</van-button>
</div>
</div>
</div>
</div>
</van-list>
<van-empty v-else class="custom-image" image="/none.svg" description="暂无数据"></van-empty>
</div>
<van-popup v-model="infoShow" position="right" :style="{ height: '100%', width: '100%' }" safe-area-inset-bottom>
<van-sticky>
<van-nav-bar @click-left="infoShow=false" left-arrow
title="申请详情"></van-nav-bar>
</van-sticky>
<member-apply-audit-info ref="memberApplyAuditInfoRef"></member-apply-audit-info>
</van-popup>
<van-sticky>
<van-nav-bar title="我的入会申请" left-text="返回" left-arrow @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
<van-search
v-model="pageForm.searchKeyword"
placeholder="请输入工号或者姓名进行查询"
:show-action="false"
:reverse-color="false"
input-align="left"
@search="doSearch"
></van-search>
<van-dropdown-menu v-if="$auth.hasRoleOr('sysadmin, SchoolUnionMemberAdmin, BranchUnionMemberAdmin')" :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="unionList" @change="doSearch();flushUnits(pageForm.unionId)" v-model="pageForm.unionId"></van-dropdown-item>
<van-dropdown-item :options="unitList" @change="doSearch" v-model="pageForm.unitId"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<div>
<van-list v-if="tableData.length>0" v-model="tableLoading" :finished="tableFinished" finished-text="没有更多了" @load="pageData">
<div v-for="item in tableData" :key="item.id" class="van-doc-card">
<div>
<div style="display: flex; justify-content: space-between">
<div style="width: 74%">
<div class="van-ellipsis title">
<span class="title_span">|</span>
<span>{{item.username + '(' + item.loginname + ')'}}</span>
</div>
</div>
</div>
<div style="margin-top: 4px">
<van-row>
<van-col span="24"><span style="color: grey">工作单位:</span>{{item.unitName}}</van-col>
<van-col span="24"><span style="color: grey">所属工会:</span><span>{{item.unionName}}</span></van-col>
<van-col span="24"><span style="color: grey">在职状态:</span>{{item.userState}}</van-col>
<van-col span="24"><span style="color: grey">人员类型:</span><span>{{item.personType}}</span></van-col>
</van-row>
</div>
<van-divider></van-divider>
<div style="display: flex; justify-content: space-between; align-items: center">
<div>
<span style="color: grey">当前状态:</span>
<span>{{item.stateName}}</span>
</div>
<div>
<van-button size="small" @click="openView(item)"
type="info" style="margin-right: 4px">查看
</van-button>
<van-button size="small" @click="pjaxReplace('/platform/member/apply/submit/h5?id=' + item.id)"
v-if="[10,30,60].includes(item.applyStateId) && item.userId == user.id"
type="info" style="margin-right: 4px">编辑</van-button>
</div>
</div>
</div>
</div>
</van-list>
<van-empty v-else class="custom-image" image="/none.svg" description="暂无数据"></van-empty>
</div>
<van-popup v-model="infoShow" position="right" :style="{ height: '100%', width: '100%' }" safe-area-inset-bottom>
<van-sticky>
<van-nav-bar @click-left="infoShow=false" left-arrow
title="申请详情"></van-nav-bar>
</van-sticky>
<member-apply-audit-info ref="memberApplyAuditInfoRef"></member-apply-audit-info>
</van-popup>
</div>
<script>
<!--#include('../common/memberApplyAuditInfo.js'){}#-->
new Vue({
el: '#app',
mixins: [mobileMixins],
data(){
return{
user: {},
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
unionId: "",
unitId: "",
isAudit: false
},
unionList: [],
unitList: [],
tableLoading: false,
tableFinished: false,
infoShow: false,
}
},
components: {
'member-apply-audit-info': MEMBER_APPLY_AUDIT_INFO
},
methods: {
openView(item) {
this.infoShow = true
this.$nextTick(() => {
this.$refs.memberApplyAuditInfoRef.onOpen(item.id)
})
},
doSearch() {
this.pageForm.pageNumber = 1
this.tableData = []
this.finished = false
this.pageData()
},
pageData() {
this.tableLoading = true
$.post('/platform/member/apply/mine/pageData', this.pageForm)
.then(res => {
if (res.code === 0) {
this.tableData = this.tableData.concat(res.data.list)
this.pageForm.totalCount = res.data.totalCount
if (this.tableData.length >= this.pageForm.totalCount) {
this.tableFinished = true
} else {
this.pageForm.pageNumber++
}
this.tableLoading = false
} else {
this.$toast(res.msg)
}
})
},
async initUnion(unionId) {
this.unionList = await getUnionList(unionId)
this.unionList.forEach(v => {
v.text = v.unionname
v.value = v.id
})
if (this.unionList && this.unionList.length > 0) {
this.unionList.unshift({ text: "全部工会", value: null })
this.$set(this.pageForm, "unionId", this.unionList[0].value)
}
},
async flushUnits(unionId) {
this.unitList = await getUnits(unionId)
this.unitList.forEach(v => {
v.text = v.name
v.value = v.id
})
if (this.unitList && this.unitList.length > 0) {
this.unitList.unshift({ text: "全部单位", value: null })
this.$set(this.pageForm, "unitId", this.unitList[0].value)
}
},
async initData() {
this.user = JSON.parse(window.sessionStorage.getItem('user'))
if (this.$auth.hasRoleOr("sysadmin, SchoolUnionMemberAdmin")) {
await this.initUnion()
await this.flushUnits()
} else {
await this.initUnion(this.user.union.id)
await this.flushUnits(this.user.union.id)
}
this.doSearch()
},
},
created() {
this.initData()
}
})
<!--#include('../common/memberApplyAuditInfo.js'){}#-->
new Vue({
el: '#app',
mixins: [mobileMixins],
data(){
return{
user: {},
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
unionId: "",
unitId: "",
isAudit: false
},
unionList: [],
unitList: [],
tableLoading: false,
tableFinished: false,
infoShow: false,
}
},
components: {
'member-apply-audit-info': MEMBER_APPLY_AUDIT_INFO
},
methods: {
openView(item) {
this.infoShow = true
this.$nextTick(() => {
this.$refs.memberApplyAuditInfoRef.onOpen(item.id)
})
},
doSearch() {
this.pageForm.pageNumber = 1
this.tableData = []
this.finished = false
this.pageData()
},
pageData() {
this.tableLoading = true
$.post('/platform/member/apply/mine/pageData', this.pageForm)
.then(res => {
if (res.code === 0) {
this.tableData = this.tableData.concat(res.data.list)
this.pageForm.totalCount = res.data.totalCount
if (this.tableData.length >= this.pageForm.totalCount) {
this.tableFinished = true
} else {
this.pageForm.pageNumber++
}
this.tableLoading = false
} else {
this.$toast(res.msg)
}
})
},
async initUnion(unionId) {
this.unionList = await getUnionList(unionId)
this.unionList.forEach(v => {
v.text = v.unionname
v.value = v.id
})
if (this.unionList && this.unionList.length > 0) {
this.unionList.unshift({ text: "全部工会", value: null })
this.$set(this.pageForm, "unionId", this.unionList[0].value)
}
},
async flushUnits(unionId) {
this.unitList = await getUnits(unionId)
this.unitList.forEach(v => {
v.text = v.name
v.value = v.id
})
if (this.unitList && this.unitList.length > 0) {
this.unitList.unshift({ text: "全部单位", value: null })
this.$set(this.pageForm, "unitId", this.unitList[0].value)
}
},
async initData() {
this.user = JSON.parse(window.sessionStorage.getItem('user'))
if (this.$auth.hasRoleOr("sysadmin, SchoolUnionMemberAdmin")) {
await this.initUnion()
await this.flushUnits()
} else {
await this.initUnion(this.user.union.id)
await this.flushUnits(this.user.union.id)
}
this.doSearch()
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
@@ -105,7 +105,6 @@ layout("/mobile/platform.html"){
<van-row>
<van-col span="24"><span style="color: grey">工作单位:</span>{{item.unitName}}</van-col>
<van-col span="24"><span style="color: grey">所属工会:</span><span>{{item.unionName}}</span></van-col>
<van-col span="24"><span style="color: grey">分配工会:</span><span>{{item.allocationUnionName}}</span></van-col>
<van-col span="24"><span style="color: grey">在职状态:</span>{{item.userState}}</van-col>
<van-col span="24"><span style="color: grey">人员类型:</span><span>{{item.personType}}</span></van-col>
</van-row>
@@ -123,12 +122,12 @@ layout("/mobile/platform.html"){
type="info" style="margin-right: 4px">查看
</van-button>
<van-button size="small" type="primary"
v-if="[20, 70].includes(item.applyStateId)"
v-if="[50].includes(item.applyStateId)"
@click="openApproval(item)"
style="margin-right: 4px">审核
</van-button>
<van-button size="small" type="danger"
v-if="[30, 50].includes(item.applyStateId)"
v-if="[60, 70].includes(item.applyStateId)"
@click="openRevoke(item.id)"
style="margin-right: 4px">撤回
</van-button>
@@ -152,22 +151,11 @@ layout("/mobile/platform.html"){
<van-field label="审核人员" readonly name="username" v-model="formData.username" required></van-field>
<van-field label="审核时间" readonly name="auditTime" v-model="formData.auditTime" required></van-field>
<van-field label="当前工会" readonly name="unionName" v-model="unionName" required></van-field>
<van-field label="分配工会" v-model="formData.unionName" readonly clickable required
@click="unionPicker = true" placeholder="请选择分配工会"
:rules="[{ required:true, message: '请选择分配工会' }]"></van-field>
<van-popup v-model="unionPicker" position="bottom">
<van-picker
show-toolbar
:columns="unions"
@confirm="doSetAllocationUnion"
@cancel="unionPicker = false"
></van-picker>
</van-popup>
<van-field label="审核意见" name="auditOpinion" v-model="formData.auditOpinion" placeholder="请输入审核意见" required></van-field>
</van-form>
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button type="default" block @click="infoShow=false">取消</van-button>
<van-button type="danger" block @click.submit="doApproval(2)">退回申请</van-button>
<!-- <van-button type="danger" block @click.submit="doApproval(2)">退回申请</van-button>-->
<van-button type="danger" block @click.submit="doApproval(0)">拒绝申请</van-button>
<van-button type="primary" block @click.submit="doApproval(1)">同意申请</van-button>
</div>
@@ -258,11 +246,6 @@ layout("/mobile/platform.html"){
this.$toast.fail('请填写审核意见')
return
}
if (!this.formData.unionId) {
this.$toast.fail('请选择分配工会')
return
}
let msg = '确定要通过此条申请吗?'
if (approvalType === 0) {
msg = '拒绝后不可撤回,确定要拒绝此条申请吗?'
@@ -278,7 +261,6 @@ layout("/mobile/platform.html"){
const resp = await $.post('/platform/member/apply/schoolUnion/audit/approval', {
audit: JSON.stringify(this.formData),
id: this.id,
unionId: this.formData.unionId
})
if (resp.code === 0) {
this.$toast.success(resp.msg)
@@ -2,404 +2,430 @@
layout("/mobile/platform.html"){
#-->
<style>
.up_down > .van-cell {
flex-flow: column;
}
.up_down > .van-cell > .van-field__label {
width: 100%;
}
.van-cell, .van-picker button, .submit .van-button--normal {
font-size: 16px;
}
.van-divider {
margin: 10px 0;
}
.direction-column-field {
display: flex;
flex-direction: column;
row-gap: 10px;
}
.direction-column-field {
max-width: 100%;
padding-right: 0;
}
.up_down > .van-cell {
flex-flow: column;
}
.up_down > .van-cell > .van-field__label {
width: 100%;
}
.van-cell, .van-picker button, .submit .van-button--normal {
font-size: 16px;
}
.van-divider {
margin: 10px 0;
}
.direction-column-field {
display: flex;
flex-direction: column;
row-gap: 10px;
}
.direction-column-field {
max-width: 100%;
padding-right: 0;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="会员入会申请" left-arrow placeholder fixed @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
</van-sticky>
<van-cell-group>
<van-form ref="form" @submit="doSubmit" validate-trigger="onSubmit"
class="mt5"
scroll-to-error
input-align="right"
:show-error-message="false">
<van-field label="工号" :value="formData.loginname" readonly></van-field>
<van-field label="姓名" :value="formData.username" readonly></van-field>
<van-field label="性别" v-model="formData.sex" readonly
@click="sexPicker = true"
placeholder="请选择性别"
clickable></van-field>
<van-popup v-model="sexPicker" position="bottom">
<van-picker
show-toolbar
:columns="['男','女']"
@confirm="(val)=>{this.formData.sex = val;sexPicker=false}"
@cancel="sexPicker = false"
></van-picker>
</van-popup>
<van-field label="民族" v-model="formData.nation" readonly clickable
@click="nationPicker = true" placeholder="请选择民族"
:rules="[{ required:true, message: '请选择民族' }]"></van-field>
<van-popup v-model="nationPicker" position="bottom">
<van-picker
show-toolbar
:columns="nationColumns"
@confirm="(v)=>{formData.nation = v;nationPicker = false}"
@cancel="nationPicker = false"
></van-picker>
</van-popup>
<van-field
v-model="formData.birthday"
label="出生年月"
is-link
@click="datePicker = true"
:rules="[{ required: true, message: '请填写出生年月' }]"
></van-field>
<van-popup v-model="datePicker" position="bottom">
<van-datetime-picker
type="date"
:min-date="new Date(1900, 0, 1)"
:max-date="new Date()"
@confirm="onDateConfirm"
@cancel="datePicker=false"
></van-datetime-picker>
</van-popup>
<van-field label="政治面貌" v-model="formData.political" readonly clickable
@click="politicalPicker = true" placeholder="请选择政治面貌"
:rules="[{ required:true, message: '请选择政治面貌' }]"></van-field>
<van-popup v-model="politicalPicker" position="bottom">
<van-picker
show-toolbar
:columns="politicalColumns"
@confirm="(v)=>{formData.political = v;politicalPicker = false}"
@cancel="politicalPicker = false"
></van-picker>
</van-popup>
<van-field label="学历" v-model="formData.education" readonly clickable
@click="educationPicker = true" placeholder="请选择学历"
:rules="[{ required:true, message: '请选择学历' }]"></van-field>
<van-popup v-model="educationPicker" position="bottom">
<van-picker
show-toolbar
:columns="educationColumns"
@confirm="(v)=>{formData.education = v;educationPicker = false}"
@cancel="educationPicker = false"
></van-picker>
</van-popup>
<van-field label="学位" v-model="formData.academicDegree" readonly clickable
@click="academicDegreePicker = true" placeholder="请选择学位"
:rules="[{ required:true, message: '请选择学位' }]"></van-field>
<van-popup v-model="academicDegreePicker" position="bottom">
<van-picker
show-toolbar
:columns="academicDegreeColumns"
@confirm="(v)=>{formData.academicDegree = v;academicDegreePicker = false}"
@cancel="academicDegreePicker = false"
></van-picker>
</van-popup>
<van-field label="党政职务" v-model="formData.position"
placeholder="请填写党政职务"
:rules="[{ required:true, message: '请填写党政职务' }]"></van-field>
<van-field label="工作单位" :value="formData.unitName" readonly></van-field>
<van-field label="所属工会" :value="formData.unionName" readonly></van-field>
<van-field label="所属校区" v-model="formData.campus" readonly clickable
@click="campusPicker = true" placeholder="请选择所属校区"
:rules="[{ required:true, message: '请选择所属校区' }]"></van-field>
<van-popup v-model="campusPicker" position="bottom">
<van-picker
show-toolbar
:columns="campusColumns"
@confirm="(v)=>{formData.campus = v;campusPicker = false}"
@cancel="campusPicker = false"
></van-picker>
</van-popup>
<van-field label="在职状态" :value="formData.userState" readonly></van-field>
<van-field label="人员类型" :value="formData.personType" readonly></van-field>
<van-field label="身份证号码" v-model="formData.idCard" placeholder="请输入身份证号码"
:rules="[{ pattern :/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/, message: '身份证号码格式错误' }]"></van-field>
<van-field label="联系电话" v-model="formData.mobile" type="tel" placeholder="请输入联系电话"
:rules="[{ pattern :/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, message: '联系电话格式错误' }]"></van-field>
<van-field label="电子邮箱" v-model="formData.email" placeholder="请输入电子邮箱"
:rules="[{ pattern :/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, message: '邮箱格式错误' }]"></van-field>
<van-cell-group inset class="mt10 up_down">
<div class="van-cell">
<div style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div style="width: 100%">
<span style="margin-left: -15px">家庭主要成员及联系方式</span>
</div>
</div>
<van-button v-if="formData.families && formData.families.length>0 && formData.families.length<5" style="width: 40px"
icon="plus" type="primary" round size="mini"
@click="formData.families.push({})"
native-type="button"></van-button>
</div>
<van-divider></van-divider>
<template v-if="formData.families && formData.families.length>0">
<div v-for="o,i in formData.families" class="mt5">
<div style="font-weight: 700;display: flex;justify-content: space-between">
<span>成员{{toChinesNum(i+1)}}</span>
<van-button style="width: 40px"
icon="cross" type="danger" round size="mini"
@click="formData.families.splice(i,1)"
native-type="button"></van-button>
</div>
<van-field label="关系" v-model="o.relation" placeholder="请填写与本人关系"
:rules="[{ required:true, message: '请填写与本人关系' }]"></van-field>
<van-field label="姓名" v-model="o.name" placeholder="请填写姓名"
:rules="[{ required:true, message: '请填写姓名' }]"></van-field>
<van-field label="工作单位" v-model="o.unit" placeholder="请填写工作单位"
:rules="[{ required:true, message: '请填写工作单位' }]"></van-field>
<van-field label="备注" v-model="o.remark" placeholder="请填写备注"
:rules="[{ required:true, message: '请填写备注' }]"></van-field>
</div>
</template>
<template v-else>
<div style="padding: 50px;text-align: center">
<van-button style="width: 50px"
icon="plus" type="primary" round size="mini"
@click="formData.families.push({})"
native-type="button"></van-button>
</div>
</template>
</div>
</van-cell-group>
<van-field
label="个人简历"
name="vita"
v-model="formData.vita"
class="direction-column-field">
<template #input>
<text-editor style="z-index: 1" v-model="formData.vita"></text-editor>
</template>
</van-field>
</van-form>
<div v-if="!user.member" style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button block v-if="formData.id" type="default" @click.submit="pjaxReplace('/platform/member/apply/mine/h5')">返 回</van-button>
<van-button block type="info" @click="doSave">保存申请</van-button>
<van-button block type="info" @click="doSubmit">提交申请</van-button>
</div>
</van-cell-group>
<van-sticky>
<van-nav-bar title="会员入会申请" left-arrow placeholder fixed @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
</van-sticky>
<van-cell-group>
<van-form ref="form" @submit="doSubmit" validate-trigger="onSubmit"
class="mt5"
scroll-to-error
input-align="right"
:show-error-message="false">
<van-field label="工号" :value="formData.loginname" readonly></van-field>
<van-field label="姓名" :value="formData.username" readonly></van-field>
<van-field label="性别" v-model="formData.sex" readonly
@click="sexPicker = true"
placeholder="请选择性别"
clickable></van-field>
<van-popup v-model="sexPicker" position="bottom">
<van-picker
show-toolbar
:columns="['男','女']"
@confirm="(val)=>{this.formData.sex = val;sexPicker=false}"
@cancel="sexPicker = false"
></van-picker>
</van-popup>
<van-field label="民族" v-model="formData.nation" readonly clickable
@click="nationPicker = true" placeholder="请选择民族"
:rules="[{ required:true, message: '请选择民族' }]"></van-field>
<van-popup v-model="nationPicker" position="bottom">
<van-picker
show-toolbar
:columns="nationColumns"
@confirm="(v)=>{formData.nation = v;nationPicker = false}"
@cancel="nationPicker = false"
></van-picker>
</van-popup>
<van-field
v-model="formData.birthday"
label="出生年月"
is-link
@click="datePicker = true"
:rules="[{ required: true, message: '请填写出生年月' }]"
></van-field>
<van-popup v-model="datePicker" position="bottom">
<van-datetime-picker
type="date"
:min-date="new Date(1900, 0, 1)"
:max-date="new Date()"
@confirm="onDateConfirm"
@cancel="datePicker=false"
></van-datetime-picker>
</van-popup>
<van-field label="政治面貌" v-model="formData.political" readonly clickable
@click="politicalPicker = true" placeholder="请选择政治面貌"
:rules="[{ required:true, message: '请选择政治面貌' }]"></van-field>
<van-popup v-model="politicalPicker" position="bottom">
<van-picker
show-toolbar
:columns="politicalColumns"
@confirm="(v)=>{formData.political = v;politicalPicker = false}"
@cancel="politicalPicker = false"
></van-picker>
</van-popup>
<van-field label="学历" v-model="formData.education" readonly clickable
@click="educationPicker = true" placeholder="请选择学历"
:rules="[{ required:true, message: '请选择学历' }]"></van-field>
<van-popup v-model="educationPicker" position="bottom">
<van-picker
show-toolbar
:columns="educationColumns"
@confirm="(v)=>{formData.education = v;educationPicker = false}"
@cancel="educationPicker = false"
></van-picker>
</van-popup>
<van-field label="学位" v-model="formData.academicDegree" readonly clickable
@click="academicDegreePicker = true" placeholder="请选择学位"
:rules="[{ required:true, message: '请选择学位' }]"></van-field>
<van-popup v-model="academicDegreePicker" position="bottom">
<van-picker
show-toolbar
:columns="academicDegreeColumns"
@confirm="(v)=>{formData.academicDegree = v;academicDegreePicker = false}"
@cancel="academicDegreePicker = false"
></van-picker>
</van-popup>
<van-field label="党政职务" v-model="formData.position"
placeholder="请填写党政职务"
:rules="[{ required:true, message: '请填写党政职务' }]"></van-field>
<van-field label="工作单位" :value="formData.unitName" readonly></van-field>
<van-field label="所属工会" :value="formData.unionName" readonly></van-field>
<van-field label="所属校区" v-model="formData.campus" readonly clickable
@click="campusPicker = true" placeholder="请选择所属校区"
:rules="[{ required:true, message: '请选择所属校区' }]"></van-field>
<van-popup v-model="campusPicker" position="bottom">
<van-picker
show-toolbar
:columns="campusColumns"
@confirm="(v)=>{formData.campus = v;campusPicker = false}"
@cancel="campusPicker = false"
></van-picker>
</van-popup>
<van-field label="在职状态" :value="formData.userState" readonly></van-field>
<van-field label="人员类型" :value="formData.personType" readonly></van-field>
<van-field label="身份证号码" disabled v-model="formData.idCard" placeholder="请输入身份证号码"
:rules="[{ pattern :/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/, message: '身份证号码格式错误' }]"></van-field>
<van-field label="联系电话" disabled v-model="formData.mobile" type="tel" placeholder="请输入联系电话"
:rules="[{ pattern :/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, message: '联系电话格式错误' }]"></van-field>
<van-field label="电子邮箱" v-model="formData.email" placeholder="请输入电子邮箱"
:rules="[{ pattern :/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, message: '邮箱格式错误' }]"></van-field>
<van-cell-group inset class="mt10 up_down">
<div class="van-cell">
<div style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div style="width: 100%">
<span style="margin-left: -15px">家庭主要成员及联系方式</span>
</div>
</div>
<van-button v-if="formData.families && formData.families.length>0 && formData.families.length<5" style="width: 40px"
icon="plus" type="primary" round size="mini"
@click="formData.families.push({})"
native-type="button"></van-button>
</div>
<van-divider></van-divider>
<template v-if="formData.families && formData.families.length>0">
<div v-for="o,i in formData.families" class="mt5">
<div style="font-weight: 700;display: flex;justify-content: space-between">
<span>成员{{toChinesNum(i+1)}}</span>
<van-button style="width: 40px"
icon="cross" type="danger" round size="mini"
@click="formData.families.splice(i,1)"
native-type="button"></van-button>
</div>
<van-field label="关系" v-model="o.relation" placeholder="请填写与本人关系"
:rules="[{ required:true, message: '请填写与本人关系' }]"></van-field>
<van-field label="姓名" v-model="o.name" placeholder="请填写姓名"
:rules="[{ required:true, message: '请填写姓名' }]"></van-field>
<van-field label="工作单位" v-model="o.unit" placeholder="请填写工作单位"
:rules="[{ required:true, message: '请填写工作单位' }]"></van-field>
<van-field label="备注" v-model="o.remark" placeholder="请填写备注"
:rules="[{ required:true, message: '请填写备注' }]"></van-field>
</div>
</template>
<template v-else>
<div style="padding: 50px;text-align: center">
<van-button style="width: 50px"
icon="plus" type="primary" round size="mini"
@click="formData.families.push({})"
native-type="button"></van-button>
</div>
</template>
</div>
</van-cell-group>
<van-field
label="个人简历"
name="vita"
v-model="formData.vita"
class="direction-column-field">
<template #input>
<text-editor style="z-index: 1" v-model="formData.vita"></text-editor>
</template>
</van-field>
<van-cell title="入会意愿">
<template #label>
<van-checkbox style="font-size: 16px;color: #F56C6C" icon-size="24px"
v-model="formData.isVoluntary" shape="square">
我自愿加入中华全国总工会,遵守工会章程,执行工会决议,积极参加工会活动,为全面建成小康社会、把我国建设成为富强民主文明和谐的社会主义现代化国家、实现中华民族伟大复兴的中国梦而奋斗。
</van-checkbox>
</template>
</van-cell>
<!-- <van-cell title="签字">-->
<!-- <template #label>-->
<!-- <mobile-sign :is_value_base64="false" v-model="formData.sign" prefix="MEMBER_APPLY"-->
<!-- ref="signature"></mobile-sign>-->
<!-- </template>-->
<!-- </van-cell>-->
</van-form>
<div v-if="!user.member" style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button block v-if="formData.id" type="default" @click.submit="pjaxReplace('/platform/member/apply/mine/h5')">返 回</van-button>
<van-button block type="info" @click="doSave">保存申请</van-button>
<van-button block type="info" @click="doSubmit">提交申请</van-button>
</div>
</van-cell-group>
</div>
<script>
new Vue({
el: '#app',
mixins: [mobileMixins],
dicts:['USER_NATION', 'USER_POLITICAL', 'USER_EDUCATION','USER_ACADEMIC_DEGREE', 'USER_CAMPUS'],
data() {
return{
id: GetQueryString('id'),
formData: {
families: [],
},
user: {},
sexPicker: false,
nationPicker: false,
datePicker: false,
politicalPicker: false,
educationPicker: false,
academicDegreePicker: false,
campusPicker: false,
}
},
methods: {
doSave(){
this.$dialog.confirm({
title: "保存",
message: "保存后可在我的申请里面再次编辑,您确定要保存吗?",
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(async () => {
const formData = this.formData
if (this.formData.families) {
formData.families = JSON.stringify(this.formData.families)
}
const resp = await $.post('/platform/member/apply/submit/doSave', formData)
if (resp.code === 0) {
this.$toast.success('操作成功')
this.user.member = true
pjaxReplace('/platform/member/apply/mine/h5')
} else {
this.$toast.fail(resp.msg)
}
})
},
doSubmit(){
this.$dialog.confirm({
title: "保存",
message: "提交后将进入审核流程,无法再进行编辑,您确定要提交申请吗?",
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(async () => {
const formData = this.formData
if (this.formData.families) {
formData.families = JSON.stringify(this.formData.families)
}
const resp = await $.post('/platform/member/apply/submit/doSubmit', formData)
if (resp.code === 0) {
this.$toast.success('操作成功')
this.user.member = true
pjaxReplace('/platform/member/apply/mine/h5')
} else {
this.$toast.fail(resp.msg)
}
})
},
onDateConfirm(value) {
this.formData.birthday = value;
this.showDatePicker = false;
},
async validateApply() {
if (this.id) {
return
}
const resp = await $.post('/platform/member/apply/submit/validateApply')
if (resp.code === 0 && resp.data > 0) {
vant.Dialog.confirm({
title: '提示',
message: '您有其他入会流程正在进行中,请勿重复申请,如需查看详情,可前往我的申请界面,是否前往?',
})
.then(() => {
this.user.member = true
pjaxReplace('/platform/member/apply/mine/h5')
})
.catch(() => {
this.user.member = true
})
}
},
init(){
this.user = JSON.parse(window.sessionStorage.getItem('user'))
if (this.user.member) {
vant.Dialog.alert({
title: '提示',
message: '您已是会员,请勿重复入会',
})
}
if (this.id) {
$.post("/platform/member/apply/submit/findApplyById", { id: this.id }).then((res) => {
if (res.code === 0) {
this.formData = res.data
}
})
} else {
const {
id,
username,
loginname,
sex,
nation,
birthday,
political,
education,
academicDegree,
position,
unit,
union,
campus,
userState,
personType,
idCard,
mobile,
email,
families,
vita
} = this.user
this.$set(this.formData, "userId", id)
this.$set(this.formData, "username", username)
this.$set(this.formData, "loginname", loginname)
this.$set(this.formData, "birthday", birthday)
this.$set(this.formData, "sex", sex)
this.$set(this.formData, "idCard", idCard)
this.$set(this.formData, "nation", nation)
this.$set(this.formData, "political", political)
this.$set(this.formData, "position", position)
this.$set(this.formData, "education", education)
this.$set(this.formData, "academicDegree", academicDegree)
this.$set(this.formData, "campus", campus)
this.$set(this.formData, "userState", userState)
this.$set(this.formData, "personType", personType)
this.$set(this.formData, "unitName", unit ? unit.name : null)
this.$set(this.formData, "unitId", unit ? unit.id : null)
this.$set(this.formData, "unionName", union ? union.unionname : null)
this.$set(this.formData, "unionId", union ? union.id : null)
this.$set(this.formData, "mobile", mobile)
this.$set(this.formData, "email", email)
this.$set(this.formData, "families", families ? families : [])
this.$set(this.formData, "vita", vita)
}
},
},
computed:{
nationColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_NATION){
return this.dict.type.USER_NATION.map(v=>v.value)
}
return []
},
politicalColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_POLITICAL){
return this.dict.type.USER_POLITICAL.map(v=>v.value)
}
return []
},
educationColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_EDUCATION){
return this.dict.type.USER_EDUCATION.map(v=>v.value)
}
return []
},
academicDegreeColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_ACADEMIC_DEGREE){
return this.dict.type.USER_ACADEMIC_DEGREE.map(v=>v.value)
}
return []
},
campusColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_CAMPUS){
return this.dict.type.USER_CAMPUS.map(v=>v.value)
}
return []
}
},
async created(){
this.init()
await this.validateApply()
}
})
new Vue({
el: '#app',
mixins: [mobileMixins],
dicts:['USER_NATION', 'USER_POLITICAL', 'USER_EDUCATION','USER_ACADEMIC_DEGREE', 'USER_CAMPUS'],
data() {
return{
id: GetQueryString('id'),
formData: {
families: [],
},
user: {},
sexPicker: false,
nationPicker: false,
datePicker: false,
politicalPicker: false,
educationPicker: false,
academicDegreePicker: false,
campusPicker: false,
}
},
methods: {
doSave(){
this.$dialog.confirm({
title: "保存",
message: "保存后可在我的申请里面再次编辑,您确定要保存吗?",
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(async () => {
const formData = this.formData
if (this.formData.families) {
formData.families = JSON.stringify(this.formData.families)
}
const resp = await $.post('/platform/member/apply/submit/doSave', formData)
if (resp.code === 0) {
this.$toast.success('操作成功')
this.user.member = true
pjaxReplace('/platform/member/apply/mine/h5')
} else {
this.$toast.fail(resp.msg)
}
})
},
doSubmit(){
if (!this.formData.isVoluntary) {
this.$toast.fail('请同意入会意愿')
return
}
// if (!this.formData.sign) {
// this.$toast.fail('请签字')
// return
// }
this.$dialog.confirm({
title: "保存",
message: "提交后将进入审核流程,无法再进行编辑,您确定要提交申请吗?",
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(async () => {
const formData = this.formData
if (this.formData.families) {
formData.families = JSON.stringify(this.formData.families)
}
const resp = await $.post('/platform/member/apply/submit/doSubmit', formData)
if (resp.code === 0) {
this.$toast.success('操作成功')
this.user.member = true
pjaxReplace('/platform/member/apply/mine/h5')
} else {
this.$toast.fail(resp.msg)
}
})
},
onDateConfirm(value) {
this.formData.birthday = value;
this.showDatePicker = false;
},
async validateApply() {
if (this.id) {
return
}
const resp = await $.post('/platform/member/apply/submit/validateApply')
if (resp.code === 0 && resp.data > 0) {
vant.Dialog.confirm({
title: '提示',
message: '您有其他入会流程正在进行中,请勿重复申请,如需查看详情,可前往我的申请界面,是否前往?',
})
.then(() => {
this.user.member = true
pjaxReplace('/platform/member/apply/mine/h5')
})
.catch(() => {
this.user.member = true
})
}
},
init(){
this.user = JSON.parse(window.sessionStorage.getItem('user'))
if (this.user.member) {
vant.Dialog.alert({
title: '提示',
message: '您已是会员,请勿重复入会',
})
}
if (this.id) {
$.post("/platform/member/apply/submit/findApplyById", { id: this.id }).then((res) => {
if (res.code === 0) {
this.formData = res.data
}
})
} else {
const {
id,
username,
loginname,
sex,
nation,
birthday,
political,
education,
academicDegree,
position,
unit,
union,
campus,
userState,
personType,
idCard,
mobile,
email,
families,
vita
} = this.user
this.$set(this.formData, "userId", id)
this.$set(this.formData, "username", username)
this.$set(this.formData, "loginname", loginname)
this.$set(this.formData, "birthday", birthday)
this.$set(this.formData, "sex", sex)
this.$set(this.formData, "idCard", idCard)
this.$set(this.formData, "nation", nation)
this.$set(this.formData, "political", political)
this.$set(this.formData, "position", position)
this.$set(this.formData, "education", education)
this.$set(this.formData, "academicDegree", academicDegree)
this.$set(this.formData, "campus", campus)
this.$set(this.formData, "userState", userState)
this.$set(this.formData, "personType", personType)
this.$set(this.formData, "unitName", unit ? unit.name : null)
this.$set(this.formData, "unitId", unit ? unit.id : null)
this.$set(this.formData, "unionName", union ? union.unionname : null)
this.$set(this.formData, "unionId", union ? union.id : null)
this.$set(this.formData, "mobile", mobile)
this.$set(this.formData, "email", email)
this.$set(this.formData, "families", families ? families : [])
this.$set(this.formData, "vita", vita)
}
},
},
computed:{
nationColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_NATION){
return this.dict.type.USER_NATION.map(v=>v.value)
}
return []
},
politicalColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_POLITICAL){
return this.dict.type.USER_POLITICAL.map(v=>v.value)
}
return []
},
educationColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_EDUCATION){
return this.dict.type.USER_EDUCATION.map(v=>v.value)
}
return []
},
academicDegreeColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_ACADEMIC_DEGREE){
return this.dict.type.USER_ACADEMIC_DEGREE.map(v=>v.value)
}
return []
},
campusColumns(){
if(this.dict && this.dict.type && this.dict.type.USER_CAMPUS){
return this.dict.type.USER_CAMPUS.map(v=>v.value)
}
return []
}
},
async created(){
this.init()
await this.validateApply()
}
})
</script>
<!--#
}
@@ -285,6 +285,7 @@ layout("/layouts/platform.html"){
const resp = await $.post(loc() + '/pull')
this.pullLoading = false
if(resp.code===0){
await this.getLatelyUpdateTimes()
this.pageData()
}else{
this.notifyWarning(resp.msg)
@@ -35,12 +35,18 @@ layout("/layouts/platform.html"){
<el-tag v-if="row.allocationUnionName">{{ row.allocationUnionName }}</el-tag>
<el-tag v-else type="danger">未分配</el-tag>
</template>
<template scope="{row}" v-else-if="column.prop=='sign'">
<el-image :src="CREATE_PREVIEW_URL(row.sign)"
fit="cover"
style="height: 60px" v-if="row.sign"></el-image>
<el-tag type="warning" v-else>暂无</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="220">
<template slot-scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button v-if="[50].includes(row.applyStateId)" @click="openAudit(row)" size="mini" type="primary">审核</el-button>
<el-button v-if="[70].includes(row.applyStateId)" @click="doRevoke(row)" size="mini" type="danger">撤回</el-button>
<el-button v-if="[20].includes(row.applyStateId)" @click="openAudit(row)" size="mini" type="primary">审核</el-button>
<el-button v-if="[30,40,50].includes(row.applyStateId)" @click="doRevoke(row)" size="mini" type="danger">撤回</el-button>
</template>
</el-table-column>
</el-table>
@@ -51,7 +57,7 @@ layout("/layouts/platform.html"){
<template #view>
<member-apply-audit-info ref="memberApplyAuditInfoRef"></member-apply-audit-info>
<div v-if="showApprovalForm">
<div class="process-title" style="margin: 20px 0">分工会接收</div>
<div class="process-title" style="margin: 20px 0">分工会审核</div>
<el-form :model="formData" ref="approvalFormRef" label-position="left" label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
@@ -82,9 +88,9 @@ layout("/layouts/platform.html"){
</el-form>
<el-row type="flex" justify="end">
<el-button plain @click="$refs.guava.index()">取消</el-button>
<el-button type="danger" @click="doApproval(2)">退回申请</el-button>
<el-button type="danger" @click="doApproval(0)">拒绝接收</el-button>
<el-button type="primary" @click="doApproval(1)">同意接收</el-button>
<!-- <el-button type="danger" @click="doApproval(2)">退回申请</el-button>-->
<el-button type="danger" @click="doApproval(0)">拒绝申请</el-button>
<el-button type="primary" @click="doApproval(1)">同意申请</el-button>
</el-row>
</div>
</template>
@@ -110,7 +116,7 @@ layout("/layouts/platform.html"){
{ prop: "personType", label: "人员类型", sortable: true },
{ prop: "unionName", label: "所属工会", sortable: true },
{ prop: "unitName", label: "所属单位", sortable: true },
{ prop: "allocationUnionName", label: "分配工会", sortable: true },
// { prop: "sign", label: "签字" },
{ prop: "stateName", label: "当前节点", sortable: true }
],
@@ -145,7 +151,7 @@ layout("/layouts/platform.html"){
doApproval(approvalType){
let msg = '确定要通过此条申请吗?'
if (approvalType === 0) {
msg = '拒绝后不可撤回,确定要拒绝此条申请吗?'
msg = '确定要拒绝接收此教工的工会关系吗?'
} else if (approvalType === 2) {
msg = '确定要退回此条申请吗?'
}
@@ -28,9 +28,9 @@ const MEMBER_APPLY_AUDIT_INFO = {
<el-descriptions-item label="人员类型">{{ viewData.personType }}</el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
<el-descriptions-item label="会员状态">{{ viewData.member ? '会员' : '非会员' }}</el-descriptions-item>
<el-descriptions-item label="福利会员状态">{{ viewData.welfareMember ? '福利会员' : '非福利会员' }}</el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
<!-- <el-descriptions-item label="会员状态">{{ viewData.member ? '会员' : '非会员' }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="福利会员状态">{{ viewData.welfareMember ? '福利会员' : '非福利会员' }}</el-descriptions-item>-->
<!-- <el-descriptions-item></el-descriptions-item>-->
<el-descriptions-item label="家庭主要成员" :span="3">
<el-table v-if="viewData.families&&viewData.families.length"
@@ -49,37 +49,39 @@ const MEMBER_APPLY_AUDIT_INFO = {
<el-empty v-else :image-size="50" description="暂无家庭成员信息"></el-empty>
</el-descriptions-item>
<el-descriptions-item label="个人简况" :span="3">
<template slot="label">个人简况</template>
<div v-if="viewData.vita" class="text-left" v-html="viewData.vita"></div>
<span v-else>无数据</span>
<el-tag type="warning" v-else>暂无</el-tag>
</el-descriptions-item>
<!--<el-descriptions-item label="签字信息" :span="3">
<el-image v-if="viewData.sign"
:src="CREATE_PREVIEW_URL(viewData.sign)"
fit="contain"
style="width: 300px; height: 100px"></el-image>
<el-tag type="warning" v-else>暂无</el-tag>
</el-descriptions-item>-->
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="分工会审核信息" name="branch" v-if="viewData.branchAudit">
<el-descriptions :column="2" border class="table_fixed">
<el-descriptions-item label="审核人员">{{ viewData.branchAudit.username }}
</el-descriptions-item>
<el-descriptions-item label="审核时间">{{ viewData.branchAudit.auditTime }}
</el-descriptions-item>
<el-descriptions-item label="审核意见" :span="2">{{ viewData.branchAudit.auditOpinion }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="校工会审核信息" name="school" v-if="viewData.schoolAudit">
<div class="process-title">校工会审核信息</div>
<el-descriptions :column="2" border class="table_fixed">
<el-descriptions-item label="审核人员">{{ viewData.schoolAudit.username }}
</el-descriptions-item>
<el-descriptions-item label="审核时间">{{ viewData.schoolAudit.auditTime }}
</el-descriptions-item>
<el-descriptions-item label="分配工会" :span="2">
<el-tag>{{ viewData.allocationUnionName }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="审核意见" :span="2">{{ viewData.schoolAudit.auditOpinion }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="分工会接收信息" name="branch" v-if="viewData.branchAudit">
<div class="process-title">分工会接收信息</div>
<el-descriptions :column="2" border class="table_fixed">
<el-descriptions-item label="审核人员">{{ viewData.branchAudit.username }}
</el-descriptions-item>
<el-descriptions-item label="审核时间">{{ viewData.branchAudit.auditTime }}
</el-descriptions-item>
<el-descriptions-item label="审核意见" :span="2">{{ viewData.branchAudit.auditOpinion }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
</el-tabs>
</div>
`,
@@ -94,7 +96,6 @@ const MEMBER_APPLY_AUDIT_INFO = {
},
methods: {
async onOpen(id){
this.activeName="basicInfo"
const resp = await $.post('/platform/member/apply/mine/findMemberApplyRecord', {id})
if (resp.code === 0) {
this.viewData = resp.data
@@ -25,13 +25,20 @@ layout("/layouts/platform.html"){
<template scope="{row}" v-if="column.prop=='loginname'">
<el-link @click="openView(row)" type="primary">{{row.loginname}}</el-link>
</template>
<template scope="{row}" v-else-if="column.prop=='sign'">
<el-image :src="CREATE_PREVIEW_URL(row.sign)"
fit="cover"
style="height: 60px" v-if="row.sign"></el-image>
<el-tag type="warning" v-else>暂无</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="220">
<el-table-column label="操作" width="340">
<template slot-scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button v-if="[10, 30, 60].includes(row.applyStateId) && row.userId == user.id"
@click="sublime.jumpPagePjax('/platform/member/apply/submit?id=' + row.id)"
size="mini" type="primary">编辑</el-button>
<el-button @click="doExportProve" size="mini" type="primary">导出开卡证明</el-button>
<!-- <el-button v-if="row.applyStateId === 20" @click="doRevoke(row)" size="mini" type="warning">撤销</el-button>-->
<el-button v-if="row.applyStateId === 10" @click="doDelete(row)" size="mini" type="danger">删除</el-button>
</template>
@@ -63,6 +70,7 @@ layout("/layouts/platform.html"){
{ prop: "personType", label: "人员类型", sortable: true },
{ prop: "unionName", label: "所属工会", sortable: true },
{ prop: "unitName", label: "所属单位", sortable: true },
// { prop: "sign", label: "签字" },
{ prop: "stateName", label: "当前节点", sortable: true }
],
}
@@ -72,6 +80,12 @@ layout("/layouts/platform.html"){
'member-apply-audit-info': MEMBER_APPLY_AUDIT_INFO
},
methods: {
/**
* 导出开卡证明
*/
doExportProve(){
window.open("/platform/member/apply/mine/doExportProve")
},
openView(row){
this.$refs.guava.view()
this.$nextTick(() => {
@@ -35,12 +35,18 @@ layout("/layouts/platform.html"){
<el-tag v-if="row.allocationUnionName">{{ row.allocationUnionName }}</el-tag>
<el-tag v-else type="danger">未分配</el-tag>
</template>
<template scope="{row}" v-else-if="column.prop=='sign'">
<el-image :src="CREATE_PREVIEW_URL(row.sign)"
fit="cover"
style="height: 60px" v-if="row.sign"></el-image>
<el-tag type="warning" v-else>暂无</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="220">
<template slot-scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button v-if="[20, 70].includes(row.applyStateId)" @click="openAudit(row)" size="mini" type="primary">审核</el-button>
<el-button v-if="[30, 50].includes(row.applyStateId)" @click="doRevoke(row)" size="mini" type="danger">撤回</el-button>
<el-button v-if="[50].includes(row.applyStateId)" @click="openAudit(row)" size="mini" type="primary">审核</el-button>
<el-button v-if="[60, 70].includes(row.applyStateId)" @click="doRevoke(row)" size="mini" type="danger">撤回</el-button>
</template>
</el-table-column>
</el-table>
@@ -66,23 +72,6 @@ layout("/layouts/platform.html"){
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="分配工会关系" prop="unionId">
<el-select clearable filterable placeholder="请选择工会" style="width: 100%;"
v-model="formData.unionId">
<el-option :key="item.id" :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="当前所在工会" prop="unionName">
<el-input v-model="unionName" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="审核意见" prop="auditOpinion" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
@@ -99,7 +88,7 @@ layout("/layouts/platform.html"){
</el-form>
<el-row type="flex" justify="end">
<el-button plain @click="$refs.guava.index()">取消</el-button>
<el-button type="danger" @click="doApproval(2)">退回申请</el-button>
<!-- <el-button type="danger" @click="doApproval(2)">退回申请</el-button>-->
<el-button type="danger" @click="doApproval(0)">拒绝申请</el-button>
<el-button type="primary" @click="doApproval(1)">同意申请</el-button>
</el-row>
@@ -129,7 +118,7 @@ layout("/layouts/platform.html"){
{ prop: "personType", label: "人员类型", sortable: true },
{ prop: "unionName", label: "所属工会", sortable: true },
{ prop: "unitName", label: "所属单位", sortable: true },
{ prop: "allocationUnionName", label: "分配工会", sortable: true },
// { prop: "sign", label: "签字" },
{ prop: "stateName", label: "当前节点", sortable: true }
],
@@ -166,11 +155,6 @@ layout("/layouts/platform.html"){
})
},
doApproval(approvalType){
if (approvalType === 1 && !this.formData.unionId) {
this.$message.warning('请分配工会关系')
return
}
let msg = '确定要通过此条申请吗?'
if (approvalType === 0) {
msg = '拒绝后不可撤回,确定要拒绝此条申请吗?'
@@ -3,7 +3,7 @@ layout("/layouts/platform.html"){
#-->
<div id="app">
<el-card shadow="never">
<div class="process-title">入会申请</div>
<div class="process-title">入会申请</div> <span style="color: #0a84ff">提示:字段前带有 <span style="color: red">" * "</span> 号的请务必填写</span>
<el-form :model="formData" ref="formRef" label-width="0" :rules="formRules" size="small">
<el-descriptions :column="3" border class="descriptions-form">
<el-descriptions-item label="工号">
@@ -106,12 +106,12 @@ layout("/layouts/platform.html"){
<el-descriptions-item label="身份证号码">
<el-form-item prop="idCard">
<el-input v-model="formData.idCard" placeholder="请输入身份证号码" maxlength="18"></el-input>
<el-input v-model="formData.idCard" disabled placeholder="请输入身份证号码" maxlength="18"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="联系电话">
<el-form-item prop="mobile">
<el-input v-model="formData.mobile" placeholder="请输入联系电话" maxlength="32"></el-input>
<el-input v-model="formData.mobile" disabled placeholder="请输入联系电话" maxlength="32"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="电子邮箱">
@@ -171,6 +171,25 @@ layout("/layouts/platform.html"){
<text-editor v-model="formData.vita"></text-editor>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="入会意愿" :span="3">
<el-form-item prop="isVoluntary">
<el-checkbox
size="medium"
style="width: 70%;color: #F56C6C;white-space: nowrap"
v-model="formData.isVoluntary">
我自愿加入中华全国总工会,遵守工会章程,执行工会决议,积极参加工会活动,为全面建成小康社会、把我国建设成为富强民主文明和谐的社会主义现代化国家、实现中华民族伟大复兴的中国梦而奋斗。
</el-checkbox>
</el-form-item>
</el-descriptions-item>
<!--<el-descriptions-item label="签字" :span="3">
<el-form-item prop="sign">
<sign :is_value_base64="false" :qz.sync="formData.sign"
prefix="MEMBER_APPLY"
ref="sign"></sign>
</el-form-item>
</el-descriptions-item>-->
</el-descriptions>
</el-form>
<el-row v-if="!member" justify="end" type="flex" class="mt10">
@@ -196,6 +215,15 @@ layout("/layouts/platform.html"){
formRules: {
username: [{required: false, message: "必填", trigger: ["change", "blur"]}],
sex: [{required: false, message: "必填", trigger: ["change", "blur"]}],
isVoluntary: [{required: true, message: "必填", trigger: ["change", "blur"]}],
sign: [{required: true, message: "必填", trigger: ["change", "blur"]}],
phone: [
{
validator: (rule, value, callback) => {
},
trigger: ["change", "blur"]
}
],
email: [
{
validator: (rule, value, callback) => {
@@ -280,6 +308,16 @@ layout("/layouts/platform.html"){
.catch()
},
doSubmit() {
if (!this.formData.isVoluntary) {
this.$message.error("请勾选入会意愿")
return
}
// if (!this.formData.sign) {
// this.$message.error("请使用手机钉钉扫描二维码签字")
// return
// }
this.$refs.formRef.validate((valid) => {
if (valid) {
this.$confirm("提交后将进入审核流程,无法再进行编辑,您确定要提交申请吗?", "提示", { type: "warning" })
@@ -320,6 +358,13 @@ layout("/layouts/platform.html"){
},
init(){
const user = JSON.parse(window.sessionStorage.getItem('user'))
if (user.member) {
this.$message.warning({
duration: 10000,
showClose: true,
message: '您已加入会员,请勿重复申请'
});
}
this.member = user.member
if (this.id) {
$.post("/platform/member/apply/submit/findApplyById", { id: this.id }).then((res) => {
@@ -12,21 +12,17 @@ layout("/layouts/platform.html"){
<el-card shadow="never" class="mt10">
<table-tool :app="this" label="审核列表">
<template #func>
<el-button size="small" type="primary" @click="doBatchApproval" class="mr10">批量审核</el-button>
<el-radio-group @change="search" class="mr5" size="small" v-model="pageForm.audit">
<el-radio-button label="true">已审核</el-radio-button>
<el-radio-button label="false">未审核</el-radio-button>
</el-radio-group>
<el-button size="small" type="primary" @click="openAllAudit">批量审核</el-button>
</template>
</table-tool>
<el-table :data="tableData" @selection-change="handleSelectionChange" row-key="id" :reserve-selection="true" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table :data="tableData" @selection-change="handleSelectionChange" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%">
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="column.label"
:prop="column.prop"
:sortable="column.sortable"
@@ -133,7 +129,7 @@ layout("/layouts/platform.html"){
showApprovalForm: false,
changeTypeData: [],
multipleSelection:[]
multipleSelection: []
}
},
components: {
@@ -145,6 +141,29 @@ layout("/layouts/platform.html"){
handleSelectionChange(val) {
this.multipleSelection = val;
},
doBatchApproval() {
if (this.multipleSelection.length === 0){
this.$message.warning('请勾选需要审核的人员数据')
return
}
this.$confirm('确定要将勾选的数据全部审核通过吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const ids = this.multipleSelection.map((v) => v.id)
const resp = await $.post('/platform/member/change/branchUnion/audit/doBatchApproval', {
data: JSON.stringify(ids)
})
if (resp.code === 0) {
this.$message.success(resp.msg)
this.pageData()
} else {
this.$message.error(resp.msg)
}
})
},
openView(row){
this.$refs.guava.view()
this.$nextTick(() => {
@@ -232,33 +251,6 @@ layout("/layouts/platform.html"){
.join(",")
}
return null
},
openAllAudit(){
if (this.multipleSelection.length === 0){
this.$message.warning('请选择一条记录')
return
}
this.$confirm('确定要批量审批吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const user = JSON.parse(window.sessionStorage.getItem('user'))
this.formData.username = user.username
this.formData.auditTime = moment().format('YYYY-MM-DD HH:mm:ss')
this.formData.auditType = 1
const ids = this.multipleSelection.map((v) => v.id)
const resp = await $.post('/platform/member/change/branchUnion/audit/allApproval', {
audit: JSON.stringify(this.formData),
ids: JSON.stringify(ids)
})
if (resp.code === 0) {
this.$message.success(resp.msg)
this.pageData()
} else {
this.$message.error(resp.msg)
}
})
}
},
async created() {
@@ -26,7 +26,11 @@ const MEMBER_ALL_CHANGE_INFO = {
<el-descriptions-item label="在职状态">{{ viewData.userState }}</el-descriptions-item>
<el-descriptions-item label="人员类型">{{ viewData.personType }}</el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
<el-descriptions-item label="进校时间">{{ viewData.schoolTime ? moment(viewData.schoolTime).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="退休日期">{{ viewData.retireDate ? moment(viewData.retireDate).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="离校日期">{{ viewData.leaveSchoolDate ? moment(viewData.leaveSchoolDate).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="会员状态">{{ viewData.member ? '会员' : '非会员' }}</el-descriptions-item>
<el-descriptions-item label="福利会员状态">{{ viewData.welfareMember ? '福利会员' : '非福利会员' }}</el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
@@ -66,44 +66,24 @@ const MEMBER_CHANGE = {
:disabled="allowFields('position')" maxlength="50"></el-input>
</el-form-item>
</el-descriptions-item>
<template v-if="$auth.hasRoleOr('sysadmin, SchoolUnionMemberAdmin, SchoolUnionAdmin')">
<el-descriptions-item label="工作单位">
<el-form-item prop="unitId">
<el-select clearable filterable placeholder="请选择工作单位" style="width: 100%"
v-model="formData.unitId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属工会">
<el-form-item prop="unionId">
<el-select clearable filterable placeholder="请选择所属工会" style="width: 100%"
v-model="formData.unionId">
<el-option :key="item.id" :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
</template>
<template v-else>
<el-descriptions-item label="工作单位">
<el-form-item prop="unitId">
<el-select clearable filterable placeholder="请选择工作单位" style="width: 100%"
:disabled="allowFields('unitId')" @change="getUnionName(formData.unitId)"
v-model="formData.unitId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属工会">
<el-form-item prop="unionName">
<el-input v-model="formData.unionName" disabled placeholder="请输入所属工会"></el-input>
</el-form-item>
</el-descriptions-item>
</template>
<el-descriptions-item label="工作单位">
<el-form-item prop="unitId">
<el-select clearable filterable placeholder="请选择工作单位" style="width: 100%"
:disabled="!$auth.hasRoleOr('sysadmin,SchoolUnionMemberAdmin,BranchUnionMemberAdmin')"
@change="getUnionName"
v-model="formData.unitId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属工会">
<el-form-item prop="unionName">
<el-input v-model="formData.unionName" disabled placeholder="请输入所属工会"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属校区">
<el-form-item prop="campus">
<dict-select style="width: 100%" placeholder="请选择所属校区" v-model="formData.campus"
@@ -134,25 +114,13 @@ const MEMBER_CHANGE = {
:disabled="allowFields('userState')" style="width: 100%"></dict-select>
</el-form-item>
</el-descriptions-item>
<template v-if="formData.userState == '退休'">
<el-descriptions-item label="退休日期">
<el-form-item prop="retireDate">
<el-date-picker v-model="formData.retireDate"
type="date"
placeholder="请选择出生日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
</template>
<el-descriptions-item label="人员类型">
<el-form-item prop="personType">
<dict-select v-model="formData.personType" code="PERSON_TYPE"
:disabled="allowFields('personType')" style="width: 100%"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item v-if="formData.userState == null || formData.userState != '退休'"></el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
<el-descriptions-item label="会员状态">
<el-form-item prop="member">
@@ -163,69 +131,68 @@ const MEMBER_CHANGE = {
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="福利会员状态">
<el-form-item prop="welfareMember">
<el-radio-group v-model="formData.welfareMember" size="small">
<el-radio border :label="true">福利会员</el-radio>
<el-radio border :label="false">非福利会员</el-radio>
</el-radio-group>
<el-descriptions-item label="会员服务卡号">
<el-form-item prop="cardNum">
<el-input v-model.trim="formData.cardNum" :disabled="allowFields('cardNum')"
oninput="value = value.replace(/\\s/g, '')" show-word-limit type="text"
placeholder="请输入会员服务卡号" maxlength="19"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
<template v-if="formData.member == 1">
<el-descriptions-item label="是否加入会员组别">
<el-form-item prop="member">
<el-radio-group v-model="formData.isJoinActivityMemberScope" size="small">
<el-radio border :label="true">是</el-radio>
<el-radio border :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
</template>
<template v-if="formData.member == 0">
<el-descriptions-item label="是否退出会员组别">
<el-form-item prop="member">
<el-radio-group v-model="formData.isExitActivityMemberScope" size="small">
<el-radio border :label="true">是</el-radio>
<el-radio border :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
</template>
<template v-if="formData.member != null && !formData.welfareMember">
<el-descriptions-item></el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
</template>
<template v-if="formData.welfareMember == true">
<el-descriptions-item label="是否加入福利项目">
<el-form-item prop="isJoinWelfareProject">
<el-radio-group v-model="formData.isJoinWelfareProject" size="small">
<el-radio border :label="true">是</el-radio>
<el-radio border :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<!-- <template v-if="formData.member == 1">-->
<!-- <el-descriptions-item label="是否加入会员组别">-->
<!-- <el-form-item prop="member">-->
<!-- <el-radio-group v-model="formData.isJoinActivityMemberScope" size="small">-->
<!-- <el-radio border :label="true">是</el-radio>-->
<!-- <el-radio border :label="false">否</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-descriptions-item>-->
<!-- </template>-->
<!-- <template v-if="formData.member == 0">-->
<!-- <el-descriptions-item label="是否退出会员组别">-->
<!-- <el-form-item prop="member">-->
<!-- <el-radio-group v-model="formData.isExitActivityMemberScope" size="small">-->
<!-- <el-radio border :label="true">是</el-radio>-->
<!-- <el-radio border :label="false">否</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-descriptions-item>-->
<!-- </template>-->
<!-- -->
<!-- <template v-if="formData.member != null && !formData.welfareMember">-->
<!-- <el-descriptions-item></el-descriptions-item>-->
<!-- <el-descriptions-item></el-descriptions-item>-->
<!-- </template>-->
<!-- -->
<!-- <template v-if="formData.welfareMember == true">-->
<!-- <el-descriptions-item label="是否加入福利项目">-->
<!-- <el-form-item prop="isJoinWelfareProject">-->
<!-- <el-radio-group v-model="formData.isJoinWelfareProject" size="small">-->
<!-- <el-radio border :label="true">是</el-radio>-->
<!-- <el-radio border :label="false">否</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-descriptions-item>-->
<template v-if="formData.isJoinWelfareProject">
<el-descriptions-item label="选择福利项目">
<el-form-item prop="welfareProjectId">
<el-select clearable filterable placeholder="请选择福利项目" style="width: 100%"
v-model="formData.welfareProjectId">
<el-option v-for="item in welfareProjectList"
:key="id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
</template>
<template v-else>
<el-descriptions-item></el-descriptions-item>
</template>
</template>
<!-- <template v-if="formData.isJoinWelfareProject">-->
<!-- <el-descriptions-item label="选择福利项目">-->
<!-- <el-form-item prop="welfareProjectId">-->
<!-- <el-select clearable filterable placeholder="请选择福利项目" style="width: 100%"-->
<!-- v-model="formData.welfareProjectId">-->
<!-- <el-option v-for="item in welfareProjectList"-->
<!-- :key="id" :label="item.name" :value="item.id"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-descriptions-item>-->
<!-- </template>-->
<!-- <template v-else>-->
<!-- <el-descriptions-item></el-descriptions-item>-->
<!-- </template>-->
<!-- </template>-->
<el-descriptions-item label="家庭主要成员" :span="3">
@@ -366,13 +333,19 @@ const MEMBER_CHANGE = {
},
trigger: ["change", "blur"]
}
]
],
cardNum: [{ required: false, message: "请填写会员服务卡卡号", trigger: ["change", "blur"] },
{ pattern: /^\d{19}$/, message: "会员服务卡卡号必须为19位数字", trigger: ["change", "blur"] }]
},
welfareProjectList: []
}
},
methods: {
getUnionName(val){
const data = this.units.find(v => v.id === val)
this.$set(this.formData, 'unionName', data ? data.unionname : '')
},
allowFields(prop) {
return !this.allowChangeFields.map(v => v.code).includes(prop)
},
@@ -411,7 +384,6 @@ const MEMBER_CHANGE = {
this.user = JSON.parse(window.sessionStorage.getItem('user'))
}
this.getFormDataValue(this.id)
console.log(this.formData)
this.allowChangeFields = await getDictOptions("ALLOW_CHANGE_FIELDS")
if (this.$auth.hasRoleOr('sysadmin, SchoolUnionMemberAdmin, SchoolUnionAdmin')) {
this.units = await getUnits()
@@ -26,13 +26,11 @@ const MEMBER_CHANGE_AUDIT_INFO = {
<el-descriptions-item label="在职状态">{{ viewData.userState }}</el-descriptions-item>
<el-descriptions-item label="人员类型">{{ viewData.personType }}</el-descriptions-item>
<template v-if="viewData.retireDate">
<el-descriptions-item label="退休日期">{{ viewData.retireDate }}</el-descriptions-item>
</template>
<template v-else>
<el-descriptions-item></el-descriptions-item>
</template>
<el-descriptions-item></el-descriptions-item>
<el-descriptions-item label="进校时间">{{ viewData.schoolTime ? moment(viewData.schoolTime).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="退休日期">{{ viewData.retireDate ? moment(viewData.retireDate).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="离校日期">{{ viewData.leaveSchoolDate ? moment(viewData.leaveSchoolDate).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="会员状态">{{ viewData.member ? '会员' : '非会员' }}</el-descriptions-item>
<el-descriptions-item label="福利会员状态">{{ viewData.welfareMember ? '福利会员' : '非福利会员' }}</el-descriptions-item>
@@ -114,7 +112,6 @@ const MEMBER_CHANGE_AUDIT_INFO = {
},
methods: {
async onOpen(id){
this.activeName="basicInfo"
const resp = await $.post('/platform/member/change/mine/findMemberChangeRecord', {id})
if (resp.code === 0) {
this.viewData = resp.data
@@ -0,0 +1,236 @@
const ADD_USER = {
template: /*language=HTML*/ `
<div>
<el-form :model="formData" ref="formRef" label-width="0" :rules="formRules" size="small">
<el-descriptions :column="3" border class="descriptions-form">
<el-descriptions-item label="工号">
<el-form-item prop="loginname">
<el-input v-model="formData.loginname" @blur="validLoginName" placeholder="请输入工号" size="small"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="姓名">
<el-form-item prop="username">
<el-input v-model="formData.username" placeholder="请输入姓名" size="small"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="性别">
<el-form-item prop="sex">
<el-radio-group v-model="formData.sex" size="small">
<el-radio border label="男"></el-radio>
<el-radio border label="女"></el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="民族">
<el-form-item prop="nation">
<dict-select style="width: 100%" placeholder="请选择民族" v-model="formData.nation"
code="USER_NATION"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="出生日期">
<el-form-item prop="birthday">
<el-date-picker v-model="formData.birthday"
type="date"
placeholder="请选择出生日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="政治面貌">
<el-form-item prop="political">
<dict-select style="width: 100%" placeholder="请选择政治面貌" v-model="formData.political"
code="USER_POLITICAL"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="学历">
<el-form-item prop="education">
<dict-select style="width: 100%" placeholder="请选择学历" v-model="formData.education"
code="USER_EDUCATION"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="学位">
<el-form-item prop="academicDegree">
<dict-select style="width: 100%" placeholder="请选择学位" v-model="formData.academicDegree"
code="USER_ACADEMIC_DEGREE"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="党政职务">
<el-form-item prop="position">
<el-input v-model="formData.position" placeholder="请输入党政职务"
maxlength="50"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="工作单位">
<el-form-item prop="unitid">
<el-select clearable filterable placeholder="请选择工作单位" style="width: 100%"
@change="getUnionName"
v-model="formData.unitid">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属工会">
<el-form-item prop="unionName">
<el-input v-model="formData.unionName" disabled placeholder="选择单位后自动填充"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属校区">
<el-form-item prop="campus">
<dict-select style="width: 100%" placeholder="请选择所属校区" v-model="formData.campus"
code="USER_CAMPUS"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="身份证号码">
<el-form-item prop="idCard">
<el-input v-model="formData.idCard"
placeholder="请输入身份证号码" maxlength="18"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="联系电话">
<el-form-item prop="mobile">
<el-input v-model="formData.mobile"
placeholder="请输入联系电话" maxlength="15"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="电子邮箱">
<el-form-item prop="email">
<el-input v-model="formData.email"
placeholder="请输入电子邮箱" maxlength="50"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="在职状态">
<el-form-item prop="userState">
<dict-select v-model="formData.userState" code="USER_STATE"
style="width: 100%"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="人员类型">
<el-form-item prop="personType">
<dict-select v-model="formData.personType" code="PERSON_TYPE"
style="width: 100%"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item></el-descriptions-item>
</el-descriptions>
</el-form>
<el-row justify="end" type="flex" class="mt10">
<el-button @click="$emit('do-close')" type="primary">关 闭</el-button>
<el-button @click="doSubmit" type="primary">提 交</el-button>
</el-row>
</div>
`,
data() {
return {
formData: {},
units: [],
formRules: {
loginname: [{required: true, message: '请输入工号', trigger: ['blur', 'change']}],
username: [{required: true, message: '请输入姓名', trigger: ['blur', 'change']}],
sex: [{required: true, message: '请输入性别', trigger: ['blur', 'change']}],
userState: [{required: true, message: '请选择在职状态', trigger: ['blur', 'change']}],
personType: [{required: true, message: '请选择人员类型', trigger: ['blur', 'change']}],
unitid: [{required: true, message: '请选择工作单位', trigger: ['blur', 'change']}],
email: [
{
validator: (rule, value, callback) => {
if (!value) {
callback();
} else if (/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value)) {
callback();
} else {
callback(new Error("邮箱格式错误"));
}
},
trigger: ["change", "blur"]
}
],
idCard: [
{
validator: (rule, value, callback) => {
if (!value) {
// 如果值为空,直接通过校验
callback();
} else if (/^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/.test(value)) {
// 18位身份证号码格式正确
callback();
} else if (/^[1-9]\d{7}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
// 15位身份证号码格式正确
callback();
} else if (/^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
// 外国人身份证号码格式正确(18位)
callback();
} else if (/^[1-9]\d{7}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
// 外国人身份证号码格式正确(15位)
callback();
} else {
// 格式错误,返回错误信息
callback(new Error("身份证号码格式错误"));
}
},
trigger: ["change", "blur"]
}
],
mobile: [
{
validator: (rule, value, callback) => {
if (!value) {
// 如果值为空,直接通过校验
callback();
} else if (/^[1][345789][0-9]{9}$/.test(value)) {
// 手机号格式正确
callback();
} else if (/^\d+-\d+$/.test(value) && value.length <= 16) {
// 座机号格式正确
callback();
} else {
// 格式错误,返回错误信息
callback(new Error(value.includes('-') ? '座机号码格式错误' : '手机号码格式错误'));
}
},
trigger: ["change", "blur"]
}
],
}
}
},
methods: {
getUnionName(val){
const data = this.units.find(v => v.id === val)
this.$set(this.formData, 'unionName', data ? data.unionname : '')
},
doSubmit() {
this.$refs.formRef.validate((valid) => {
if (valid) {
// 确认要提交吗?
this.$confirm('请您确保人员信息准确无误,您确定要提交吗?', '提示', {
type: 'warning'
}).then(() => {
this.$emit('do-submit', this.formData)
})
}
});
},
// 校验工号是否存在
async validLoginName(){
const resp = await $.post('/platform/member/change/mange/validLoginName', {loginName: this.formData.loginname})
if (resp.code === 0) {
if (resp.data > 0) {
this.$message.warning('该工号已存在,请重新输入')
this.$set(this.formData, 'loginname', '')
}
} else {
this.$message.warning('操作失败')
this.$set(this.formData, 'loginname', '')
}
},
}
}
@@ -87,16 +87,16 @@ layout("/layouts/platform.html"){
</div>
</div>
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<!--<div class="search-item">
<div class="search-item-label">人员性质:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.preparedBy"
style="width: 100%"
clearable
placeholder="人员类型"
placeholder="人员性质"
code="PREPARED_BY"></dict-select>
</div>
</div>
</div>-->
<div class="search-item">
<div class="search-item-label">变更类型:</div>
@@ -194,17 +194,17 @@ layout("/layouts/platform.html"){
</el-radio-button>
</el-radio-group>-->
<!-- <el-dropdown style="margin: 0 10px" @command="pushDropdownCommand">-->
<!-- <el-button type="primary" size="small" icon="el-icon-plus">-->
<!-- 添加-->
<!-- </el-button>-->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- <el-dropdown-item :command="{type:'select'}">选择加入-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item :command="{type:'add'}">新增用户-->
<!-- </el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
<!-- <el-dropdown style="margin: 0 10px" @command="pushDropdownCommand">-->
<!-- <el-button type="primary" size="small" icon="el-icon-plus">-->
<!-- 添加-->
<!-- </el-button>-->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- <el-dropdown-item :command="{type:'select'}">选择加入-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item :command="{type:'add'}">新增用户-->
<!-- </el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
<!-- <el-button :disabled="!checkUsers.length" type="primary" size="small"
icon="el-icon-edit"
@@ -218,6 +218,7 @@ layout("/layouts/platform.html"){
<!-- 单位调整-->
<!-- </el-button>-->
<el-button type="primary" size="small" @click="openAddUser">添加非库内人员</el-button>
</template>
</table-tool>
@@ -524,13 +525,18 @@ layout("/layouts/platform.html"){
:loading="selectUserLoading">确定</el-button>
</span>
</el-drawer>
<el-dialog :visible.sync="addUserVisible" title="添加非库内人员" :close-on-click-modal="false">
<add-user ref="addUserRef" @do-submit="doAddUser" @do-close="addUserVisible = false"></add-user>
</el-dialog>
</div>
<script>
<!--#include("../common/memberAllChangeInfo.js"){}#-->
<!--#include("../../common/memberInfo.js"){}#-->
<!--#include("../common/memberChange.js"){}#-->
<!--#include("addUser.js"){}#-->
new Vue({
el: '#app',
@@ -603,7 +609,7 @@ layout("/layouts/platform.html"){
{prop: 'birthday', label: '出生年月', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'preparedBy', label: '人员性质', sortable: true},
// {prop: 'preparedBy', label: '人员性质', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
@@ -628,6 +634,9 @@ layout("/layouts/platform.html"){
isThreeUnit: false,
changeTypeData: [],
// 添加非库内人员相关
addUserVisible: false,
}
},
components: {
@@ -635,8 +644,31 @@ layout("/layouts/platform.html"){
'member-all-change-info': MEMBER_ALL_CHANGE_INFO,
'member-info': MEMBER_INFO,
'member-change': MEMBER_CHANGE,
'add-user': ADD_USER,
},
methods: {
/**
* 添加非库内人员相关
*/
openAddUser(){
this.addUserVisible = true
this.$nextTick(() => {
this.$refs.addUserRef.units = this.units
})
},
async doAddUser(addUserData){
const resp = await $.post('/platform/member/change/mange/doAddUser', addUserData)
if (resp.code === 0) {
this.addUserVisible = false
this.pageData()
this.$message.success(resp.msg)
this.$nextTick(() => {
this.$refs.addUserRef.formData = {}
})
} else {
this.$message.error(resp.msg)
}
},
openAllChangeView(row){
this.$refs.guava.public()
this.$nextTick(() => {
@@ -668,22 +700,22 @@ layout("/layouts/platform.html"){
this.notifyWarning(resp.msg)
}
},
pushDropdownCommand({type}) {
if (type == 'select') {
this.selectUsers = []
this.selectUserVisible = true
this.$nextTick(() => {
this.$refs.userSelect.init()
})
} else if (type == 'add') {
this.userId = ""
this.$refs.guava.public()
if (!this.userId) {
this.$refs.member.id = null
this.$refs.member.getUserInfo()
}
}
},
// pushDropdownCommand({type}) {
// if (type == 'select') {
// this.selectUsers = []
// this.selectUserVisible = true
// this.$nextTick(() => {
// this.$refs.userSelect.init()
// })
// } else if (type == 'add') {
// this.userId = ""
// this.$refs.guava.public()
// if (!this.userId) {
// this.$refs.member.id = null
// this.$refs.member.getUserInfo()
// }
// }
// },
async threeUnitChange(val) {
if (val) {
const threeUnit = this.threeUnits.find(v => v.id === val)
@@ -919,9 +951,10 @@ layout("/layouts/platform.html"){
this.pageData();
this.getNumData()
if (this.$auth.hasRoleOr("sysadmin,SchoolUnionMemberAdmin,H03")) {
this.unions = await getUnionList(null, false)
this.unions = await getUnionList()
this.units = await getUnits()
} else {
this.unions = await getUnionList(null, true)
this.unions = await getUnionList()
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)
this.flushUnits()
}
@@ -167,7 +167,7 @@ layout("/layouts/platform.html"){
label="操作"
width="100px" fixed="right">
<template scope="{row}">
<el-button size="mini" type="primary" @click="openView(row)">查看</el-button>
<el-button size="mini" type="primary" @click="openView(row.userId)">查看</el-button>
</template>
</el-table-column>
</el-table>
@@ -12,13 +12,15 @@ layout("/layouts/platform.html"){
<el-card shadow="never" class="mt10">
<table-tool :app="this" label="审核列表">
<template #func>
<el-button size="small" type="primary" @click="doBatchApproval" class="mr10">批量审核</el-button>
<el-radio-group @change="search" class="mr5" size="small" v-model="pageForm.audit">
<el-radio-button label="true">已审核</el-radio-button>
<el-radio-button label="false">未审核</el-radio-button>
</el-radio-group>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%">
<el-table :data="tableData" @selection-change="handleSelectionChange" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%">
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="column.label"
@@ -127,6 +129,7 @@ layout("/layouts/platform.html"){
showApprovalForm: false,
changeTypeData: [],
multipleSelection: [],
}
},
components: {
@@ -135,6 +138,32 @@ layout("/layouts/platform.html"){
'member-change-audit-info': MEMBER_CHANGE_AUDIT_INFO
},
methods: {
handleSelectionChange(val) {
this.multipleSelection = val;
},
doBatchApproval() {
if (this.multipleSelection.length === 0){
this.$message.warning('请勾选需要审核的人员数据')
return
}
this.$confirm('确定要将勾选的数据全部审核通过吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const ids = this.multipleSelection.map((v) => v.id)
const resp = await $.post('/platform/member/change/schoolUnion/audit/doBatchApproval', {
data: JSON.stringify(ids)
})
if (resp.code === 0) {
this.$message.success(resp.msg)
this.pageData()
} else {
this.$message.error(resp.msg)
}
})
},
openView(row){
this.$refs.guava.view()
this.$nextTick(() => {
@@ -26,12 +26,11 @@ const MEMBER_INFO = {
<el-descriptions-item label="在职状态">{{ viewData.userState }}</el-descriptions-item>
<el-descriptions-item label="人员类型">{{ viewData.personType }}</el-descriptions-item>
<template v-if="viewData.retireDate">
<el-descriptions-item label="退休日期">{{ viewData.retireDate }}</el-descriptions-item>
</template>
<template v-else>
<el-descriptions-item></el-descriptions-item>
</template>
<el-descriptions-item></el-descriptions-item>
<el-descriptions-item label="进校时间">{{ viewData.schoolTime ? moment(viewData.schoolTime).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="退休日期">{{ viewData.retireDate ? moment(viewData.retireDate).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="离校日期">{{ viewData.leaveSchoolDate ? moment(viewData.leaveSchoolDate).format("YYYY-MM-DD") : '暂无' }}</el-descriptions-item>
<el-descriptions-item label="会员状态">{{ viewData.member ? '会员' : '非会员' }}</el-descriptions-item>
<el-descriptions-item label="福利会员状态">{{ viewData.welfareMember ? '福利会员' : '非福利会员' }}</el-descriptions-item>
@@ -33,7 +33,7 @@ layout("/layouts/platform.html"){
<el-button type="primary" @click="$refs.member.save()"
style="position: absolute;right: 20px;top: 30px;z-index: 100">提交
</el-button>
<member ref="member" :id="'${@shiro.getPrincipalProperty('id')}'"></member>
<member ref="member" :id="user.id"></member>
</el-card>
</div>
</template>
@@ -45,14 +45,16 @@ layout("/layouts/platform.html"){
const vue = new Vue({
el: '#app',
data() {
return {}
return {
user: {},
}
},
components: {
'member': httpVueLoader('/components/member/MemberInfo.vue?v=' + new Date().getTime()),
},
methods: {},
async created() {
this.user = JSON.parse(window.sessionStorage.getItem('user'))
}
})
</script>
@@ -255,8 +255,29 @@ layout("/layouts/platform.html"){
</el-link>
</el-col>
</el-row>
<el-row type="flex" align="middle" class="query-row">
<el-row class="query-row" type="flex" align="middle"
v-if="(is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true) && ['在职','离退休','离校'].some(item => pageForm.userStates.includes(item))">
<el-col class="query-row-title">查询时间:</el-col>
<el-col class="query-row-content">
<el-date-picker
v-model="pageForm.commonDate"
type="datetimerange"
:picker-options="pickerOptions"
range-separator="至"
@change="doSetCommonDate"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
align="right">
</el-date-picker>
<span style="color: #bc2a25">在职状态选择时,在职查询入会时间;离退休查询退休时间;离校查询离校时间;同时选择多个状态将同时查询三种时间</span>
</el-col>
</el-row>
<!--<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">人员性质:</el-col>
<el-col class="query-row-content">
<el-tag
@@ -279,7 +300,7 @@ layout("/layouts/platform.html"){
type="success">全部
</el-link>
</el-col>
</el-row>
</el-row>-->
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">系统角色:</el-col>
@@ -342,6 +363,15 @@ layout("/layouts/platform.html"){
@change="determineEndDate"
placeholder="选择结束日期">
</el-date-picker>
<el-date-picker
v-model="pageForm.birthMonth"
popper-class="monthStyle"
value-format="MM"
format="MM"
@change="doSearch"
type="month"
placeholder="请选择月度">
</el-date-picker>
</el-col>
</el-row>
@@ -573,6 +603,10 @@ layout("/layouts/platform.html"){
startDate: '',
endDate: '',
memberType:2,
birthMonth: '',
commonDate: [],
commonStartDate: '',
commonEndDate: '',
},
personTypeOptions: [],
@@ -625,6 +659,16 @@ layout("/layouts/platform.html"){
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'),
},
methods: {
doSetCommonDate(val){
if(val && ['在职','离退休','离校'].some(item => this.pageForm.userStates.includes(item))){
this.pageForm.commonStartDate = val[0]
this.pageForm.commonEndDate = val[1]
} else {
this.pageForm.commonStartDate = ''
this.pageForm.commonEndDate = ''
}
this.doSearch()
},
async allIsWelfareMember() {
this.welfareTitle = "提醒:您将【" + this.pageForm.totalCount + "】位会员设置为福利会员"
this.addWelfareDialogVisible = true
@@ -669,6 +713,7 @@ layout("/layouts/platform.html"){
const preparedBys = JSON.stringify(this.pageForm.preparedBys)
window.location.href = loc() + "/doExport?unionId=" + this.pageForm.unionId + "&unitId=" + this.pageForm.unitId
+ "&year=" + this.pageForm.year
+ "&birthMonth=" + this.pageForm.birthMonth
+ "&memberStatus=" + memberStatus
+ "&personTypes=" + personTypes
+ "&userStates=" + userStates
@@ -695,7 +740,10 @@ layout("/layouts/platform.html"){
const {
startDate,
endDate,
birthMonth,
campus,
commonStartDate,
commonEndDate,
memberType,
reverseSelection,
memberSearchName,
@@ -705,8 +753,9 @@ layout("/layouts/platform.html"){
window.location.href = loc() + "/doExportByUnion?=searchName=" + this.pageForm.searchName
+ "&searchKeyword=" + this.pageForm.searchKeyword + "&unitId=" + unitId + "&unionId=" + unionId
+ "&unionGroupId=" + unionGroupId + "&threeUnitId=" + threeUnitId + "&sexTypes=" + sexTypes + "&memberType=" + memberType
+ "&roleIds=" + roleIds + "&age=" + age + "&year=" + this.pageForm.year + "&memberStatus=" + memberStatus
+ "&startDate=" + (startDate ? this.getDate(startDate) : '') + "&endDate=" + (endDate ? this.getDate(endDate) : '') + "&campus=" + (campus ? campus : '')
+ "&roleIds=" + roleIds + "&age=" + age + "&year=" + this.pageForm.year + "&memberStatus=" + memberStatus + "&birthMonth=" + birthMonth
+ "&startDate=" + (startDate ? this.getDate(startDate) : '') + "&endDate=" + (endDate ? this.getDate(endDate) : '')
+ "&campus=" + (campus ? campus : '') + "&commonStartDate=" + commonStartDate + "&commonEndDate=" + commonEndDate
+ "&reverseSelection=" + (reverseSelection ? reverseSelection : '') + "&memberSearchName=" + (memberSearchName ? memberSearchName : '')
+ "&memberSearchKeyWord=" + (memberSearchKeyWord ? memberSearchKeyWord : '') + "&personTypes=" + personTypes
+ "&userStates=" + userStates + "&preparedBys=" + preparedBys + "&props=" + JSON.stringify(props)
@@ -858,6 +907,10 @@ layout("/layouts/platform.html"){
this.pageForm.reverseSelection = false
this.pageForm.startDate = ''
this.pageForm.endDate = ''
this.pageForm.commonDate = ''
this.pageForm.commonStartDate = ''
this.pageForm.commonEndDate = ''
this.doSearch()
},
tagClick(key, val) {