This commit is contained in:
Paidax
2025-06-04 15:27:27 +08:00
parent d046c3be5d
commit 2409b3ddfe
116 changed files with 12202 additions and 1804 deletions
@@ -22,4 +22,6 @@ public class RedisConstant {
//健步走小程序TOKEN
public final static String REDIS_KEY_WE_APP_ACCESS_TOKEN = "weapp:token:";
// 疗休养配置缓存
public final static String REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE = PLATFORM_REDIS_PREFIX + "theRapyRecuConfig:";
}
+67 -22
View File
@@ -1,10 +1,12 @@
package io.v.nutz.base.utils;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import io.v.nutz.base.enums.Env;
import io.v.nutz.web.commons.base.Globals;
import lombok.extern.slf4j.Slf4j;
@@ -15,7 +17,9 @@ import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zxy
@@ -73,36 +77,77 @@ public class MsgApi {
return;
}
String msgToken = getMsgToken();
NutMap map = new NutMap();
map.put("channel", String.join(",", channels));
//推送范围(1:普通模式;2:全体教师;3:全体学生;4:全体人员)
map.put("objScope", 1);
map.put("objIds", loginNameStr);
map.put("mtype", mtype);
map.put("sendStatus", 1);
map.put("title", title);
map.put("content", content);
map.put("imageUrl", imageUrl);
map.put("link", link);
List<String> loginNamesList = Arrays.stream(loginNameStr.split(",")).map(String::trim).filter(s -> !s.isEmpty()).toList();
HttpRequest request = HttpUtil.createPost(MSG_API)
.header("token", msgToken)
.body(Json.toJson(map));
JSONObject jsonObject = JSON.parseObject(request.execute().body());
int status = jsonObject.getInteger("code");
if (Lang.isNotEmpty(loginNamesList)) {
List<List<String>> splitList = ListUtil.split(loginNamesList, 100);
if (status == 200) {
log.info("发送成功>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
} else {
log.info("发送失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
throw new RuntimeException("Message sending failed with status code: " + status + ", Message: " + jsonObject.getString("message"));
for (List<String> sublist : splitList) {
// 获取token
String msgToken = getMsgToken();
// 封装发送消息的参数
NutMap map = createMessageMap(channels, sublist, mtype, title, content, imageUrl, link);
System.out.println(map);
// 发送请求
JSONObject jsonObject = sendRequest(msgToken, map);
// 判断发送结果
int status = jsonObject.getInteger("code");
if (status == 200) {
log.info("=================================================================================================发送成功: {}", jsonObject.toJSONString());
} else {
log.error("=================================================================================================发送失败: {}", jsonObject.toJSONString());
throw new RuntimeException("Message sending failed with status code: " + status + ", Message: " + jsonObject.getString("message"));
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 封装发送消息的参数
* @param channels
* @param loginNameList
* @param mtype
* @param title
* @param content
* @param imageUrl
* @param link
* @return
*/
private static NutMap createMessageMap(List<String> channels, List<String> loginNameList,
int mtype, String title, String content, String imageUrl, String link) {
NutMap map = new NutMap();
map.put("channel", String.join(",", channels));
//推送范围(1:普通模式;2:全体教师;3:全体学生;4:全体人员)
map.put("objScope", 1);
map.put("objIds", String.join(",", loginNameList));
map.put("mtype", mtype);
map.put("sendStatus", 1);
map.put("title", title);
map.put("content", content);
map.put("imageUrl", imageUrl);
map.put("link", link);
return map;
}
/**
* 发送请求
* @param msgToken
* @param map
* @return
*/
private static JSONObject sendRequest(String msgToken, NutMap map) {
HttpRequest request = HttpUtil.createPost(MSG_API)
.header("token", msgToken)
.body(Json.toJson(map));
return JSON.parseObject(request.execute().body());
}
/**
* 获取token
@@ -303,10 +303,10 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
userPatUpService.renewUserState();
// 修改不在人事库的人员,删除角色
// userPatUpService.deleteNotInSourceUser(true);
// userPatUpService.deleteNotInSourceUser(true);
//清除缓存
sysUserService.clearCache();
sysRoleService.clearCache();
// sysUserService.clearCache();
// sysRoleService.clearCache();
} else {
List<String> loginNameList = middleTables.stream().map(SourceChangeMiddleTable::getLoginname).toList();
@@ -529,7 +529,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
// 变更记录
List<NutMap> changeList = new ArrayList<>();
for (String fieldName : allowChangeFieldNames) {
if (allowChangeFieldNames.contains("retireDate") || allowChangeFieldNames.contains("welfareStopDate")) {
if (List.of("retireDate", "welfareStopDate").contains(fieldName)) {
continue;
}
memberCommonService.extractChange(newMap, sourceMap, fieldName, dictMap, changeList);
@@ -577,7 +577,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
NutMap sourceMap = Lang.obj2nutmap(user);
List<NutMap> changeList = new ArrayList<>();
for (String fieldName : allowChangeFieldNames) {
if (allowChangeFieldNames.contains("retireDate") || allowChangeFieldNames.contains("welfareStopDate")) {
if (List.of("retireDate", "welfareStopDate").contains(fieldName)) {
continue;
}
memberCommonService.extractChange(newMap, sourceMap, fieldName, dictMap, changeList);
@@ -97,6 +97,16 @@ public class ProposalConfig {
@ColDefine(type = ColType.TIMESTAMP)
private Date remindProposalCreatorDate;
@Column
@Comment("开始撰写时间")
@ColDefine(type = ColType.DATETIME)
private Date startWriteTime;
@Column
@Comment("结束撰写时间")
@ColDefine(type = ColType.DATETIME)
private Date endWriteTime;
@One(field = "masterUnitConfigId")
private ProposalReplyConfig masterUnitConfig;
@@ -183,7 +183,6 @@ public class MemberApplyBranchUnionAuditController {
String content = "尊敬的%s老师,您已正式成为杭医工会会员,会员关系在%s,欢迎您的加入!"
.formatted(user.getUsername(), union.getUnionname());
System.out.println(content);
sysUserService.deleteCacheAndUpdate(record.getUserId());
msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 1, "入会结果通知", content, "", "");
} else {
// 杭州医学院,分工会拒绝接收,还要去创建校工会的审核任务
@@ -82,6 +82,11 @@ public class MemberApplyController {
@RequiresPermissions("member.apply.submit")
@SLog(tag = "会员入会申请", msg = "保存申请")
public Object doSave(MemberApplyRecord record){
if (record.getPersonType().contains("劳务派遣")) {
return Result.error("当前暂未开放劳务派遣教工申请,请您及时关注校工会通知!");
}
record.setMember(true);
record.setUserId(ShiroUtil.getUserId());
// 变更来源 个人
@@ -105,6 +110,10 @@ public class MemberApplyController {
@SLog(tag = "会员入会申请", msg = "提交申请")
public Object doSubmit(MemberApplyRecord record){
if (record.getPersonType().contains("劳务派遣")) {
return Result.error("当前暂未开放劳务派遣教工申请,请您及时关注校工会通知!");
}
int count = dao.count(Sys_user_role.class, Cnd.where("userId", "=", record.getUserId()).and("roleId", "=", Roles.MEMBER));
if (count > 0) {
return Result.error("您已经是会员,请勿重复申请");
@@ -414,7 +414,7 @@ public class MemberChangeManageController {
// 杭医特有,他们有一个福利享受截止时间,在这个时间之前的退休人员,也需要享受福利
Sql welfareSql = Sqls.create("select id from sys_user where welfareStopTime < CURDATE() and userState = '退休'");
Sql welfareSql = Sqls.create("select id from sys_user where welfareStopDate > CURDATE() and userState = '退休'");
welfareSql.setCallback(Sqls.callback.strList());
dao.execute(welfareSql);
ids.addAll(welfareSql.getList(String.class));
@@ -73,13 +73,14 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
if ("退休".equals(middleTable.getUserState())) {
middleTable.setMember(0);
middleTable.setIsExitActivityMemberScope(true);
if (DateUtil.parseDate(middleTable.getWelfareStopDate()).isAfter(DateUtil.date())) {
middleTable.setWelfareMember(1);
} else {
middleTable.setWelfareMember(0);
}
middleTable.setWelfareMember(0);
// if (middleTable.getWelfareStopDate() != null) {
// if (DateUtil.parseDate(middleTable.getWelfareStopDate()).isAfter(DateUtil.date())) {
// middleTable.setWelfareMember(1);
// } else {
// middleTable.setWelfareMember(0);
// }
// }
}
// 记录当前操作的时间,用于后续区分短信通知
@@ -269,10 +270,13 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
*/
@Override
public void sendMsgToNewTeacher(SourceChangeMiddleTable middleTable) {
String context = "尊敬的%s老师,欢迎您加入杭州医学院大家庭,请您点击此条信息或登录“智慧工会”平台申请成为杭医工会会员!"
.formatted(middleTable.getUsername());
String link = Globals.AppDomain + "/platform/member/apply/submit/h5";
msgApi.sendMsg(List.of("DingTalk"), middleTable.getLoginname(), 2, "入会邀请", context, "", link);
if (middleTable.getPersonType().contains("劳务派遣") || middleTable.getUserState().contains("退休")) {
return;
}
String context = "尊敬的%s老师,欢迎您加入杭州医学院大家庭,请您点击此条信息或登录“智慧工会”平台申请成为杭医工会会员!"
.formatted(middleTable.getUsername());
String link = Globals.AppDomain + "/platform/member/apply/submit/h5";
msgApi.sendMsg(List.of("DingTalk"), middleTable.getLoginname(), 2, "入会邀请", context, "", link);
}
@@ -6,7 +6,7 @@ import lombok.Data;
import java.util.Date;
/**
* @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationJoinUserImportExcelMode
* @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationJoinUserImportExcelMode
* @Description: 参加人员导入excel mode
* @Author zxc
* @Date 2022/6/14:11:10
@@ -5,7 +5,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationSignUpMode
* @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode
* @Description: 线路创建模式
* @Author zxc
* @Date 2022/6/2:15:22
@@ -5,7 +5,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationProvinceType
* @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationProvinceType
* @Description: TODO
* @Author zxc
* @Date 2022/6/2:14:08
@@ -5,7 +5,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationSignUpMode
* @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode
* @Description: 报名模式
* @Author zxc
* @Date 2022/6/2:15:22
@@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* @FileName io.v.nutz.therapyRecuperation.constant.TheRapyRecuperationType
* @FileName io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType
* @Description: 疗休养分类
* @Author zxc
* @Date 2022/6/2:14:02
@@ -36,7 +36,7 @@ public enum TheRapyRecuperationType {
/**
* 酒店
*/
provinceInHotel("目的地疗休养", 3, TheRapyRecuperationProvinceType.provinceIn.getValue(), "/assets/mobile/img/therapyRecuperation/lxs.png");
provinceInHotel("定点疗休养", 3, TheRapyRecuperationProvinceType.provinceIn.getValue(), "/assets/mobile/img/therapyRecuperation/lxs.png");
/**
* 学校自由组织
@@ -0,0 +1,412 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.analysis;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.result.Result;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.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.*;
import java.util.stream.Collectors;
/**
* @version 1.0
* @Author zzr
* @nameTheRapyRecuperationAnnualAnalysisController
* @Date 2025/2/10 9:16
* @注释
*/
@IocBean
@At("/platform/theRapyRecuperation/annualAnalysis")
@Ok("json:full")
public class TheRapyRecuperationAnnualAnalysisController {
@Inject
private Dao dao;
@Inject
private TheRapyRecuperationLineService lineService;
@At("")
@Ok("beetl:/platform/theRapyRecuperation/analysis/annualAnalysis.html")
@RequiresPermissions("theRapyRecuperation.annualAnalysis")
public void index() {
}
/**
* 获取年度出行人数、线路数、省内、省外、校工会组织线路数、校省内、校省外线路数
* @param year
* @param lineType
* @return
*/
@At
@RequiresPermissions("theRapyRecuperation.annualAnalysis")
public Object getNumData(@Param(value = "year", required = false) Integer year,
@Param(value = "lineType", required = false) String lineType){
// 对于嘉兴来说,这一坨吊用没有,直接去报名记录里边找线路
// Cnd cnd = Cnd.NEW();
// cnd.and("delFlag", "=", false);
// cnd.and("YEAR(selectTime)", "=", year);
// // 本年选择的所有线路
// List<TheRapyRecuperationLineUnionSelect> selectLineList = dao.query(TheRapyRecuperationLineUnionSelect.class, cnd);
// 获取选择线路表的id,后面发现了,报名表里有线路id不在线路表的情况,这类人员要排除掉
Sql selectIdSql = Sqls.create("select id from the_rapy_recuperation_line_union_select");
selectIdSql.setCallback(Sqls.callback.strList());
dao.execute(selectIdSql);
List<String> selectIdList = selectIdSql.getList(String.class);
// 获取今年报名的所有人数,还要确保报名线路是属于上面选择线路的id
Sql sql = Sqls.create("""
SELECT
takePartInLineId
FROM
`the_rapy_recuperation_enroll`
WHERE
YEAR(signingUptime) = @thisYear
AND isNormal = 1
AND stateId = @stateId
AND takePartInLineId in (@selectIdList)
""");
sql.setParam("thisYear", year);
sql.setParam("stateId", TheRapyRecuperationState.PASS);
sql.setParam("selectIdList", selectIdList);
sql.setCallback(Sqls.callback.strList());
dao.execute(sql);
// 今年的报名记录
List<String> enrollTakePartLineIdList = sql.getList(String.class);
List<String> takePartInLineIdList = enrollTakePartLineIdList.stream().distinct().collect(Collectors.toList());
// 今年报名的线路
List<TheRapyRecuperationLineUnionSelect> selectLineList = dao.query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "in", takePartInLineIdList));
// 找出选择的线路详情,用于区分省内还是省外
List<String> lineIdList = selectLineList.stream().map(TheRapyRecuperationLineUnionSelect::getLineId).distinct().collect(Collectors.toList());
List<TheRapyRecuperationLine> lineList = dao.query(TheRapyRecuperationLine.class, Cnd.where("id", "in", lineIdList));
// 如果不是全部,按搜索条件查询省内还是省外
if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) {
lineList = lineList.stream().filter(line -> line.getRegionalNature().equals(lineType)).collect(Collectors.toList());
List<String> lineTypeIdList = lineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList());
selectLineList = selectLineList.stream().filter(v-> lineTypeIdList.contains(v.getLineId())).collect(Collectors.toList());
}
// 省内线路
List<TheRapyRecuperationLine> inLineList = lineList.stream().filter(line -> "省内".equals(line.getRegionalNature())).collect(Collectors.toList());
Set<String> inLineIds = inLineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toSet());
// 选择省内的线路
List<String> selectInLineIds = selectLineList.stream().filter(v -> inLineIds.contains(v.getLineId()))
.map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList());
// 省外线路
List<TheRapyRecuperationLine> outLineList = lineList.stream().filter(line -> "省外".equals(line.getRegionalNature())).collect(Collectors.toList());
Set<String> outLineIds = outLineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toSet());
// 选择省外的线路
List<String> selectOutLineIds = selectLineList.stream().filter(v -> outLineIds.contains(v.getLineId()))
.map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList());
// List<TheRapyRecuperationEnroll> enrollList = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("YEAR(signingUptime)", "=", year).and("isNormal", "=", true));
// List<String> enrollTakePartLineIdList = enrollList.stream().map(TheRapyRecuperationEnroll::getTakePartInLineId).collect(Collectors.toList());
// 返回前端的数据展示
NutMap nutMap = NutMap.NEW();
// 总出行人数
int allNum = enrollTakePartLineIdList.size();
// 省内出行人数
int provinceNum = (int) enrollTakePartLineIdList.stream().filter(selectInLineIds::contains).count();
// 省外出行人数
int outProvinceNum = (int) enrollTakePartLineIdList.stream().filter(selectOutLineIds::contains).count();
nutMap.addv("allNum", allNum).addv("provinceNum", provinceNum).addv("outProvinceNum", outProvinceNum);
// 总线路数
int lineNum = selectLineList.size();
// 总省内
int inLineNum = selectInLineIds.size();
// 总省外
int outLineNum = selectOutLineIds.size();
nutMap.addv("lineNum", lineNum).addv("inLineNum", inLineNum).addv("outLineNum", outLineNum);
// 校工会组织线路
List<TheRapyRecuperationLineUnionSelect> schoolSelectLineList = selectLineList.stream().filter(v -> v.getSignUpMode() == 2).collect(Collectors.toList());
int schoolUnionLineNum = schoolSelectLineList.size();
// 校省内
int schoolInLineNum = (int) schoolSelectLineList.stream().filter(s -> inLineIds.contains(s.getLineId())).count();
// 校省外
int schoolOutLineNum = (int) schoolSelectLineList.stream().filter(s -> outLineIds.contains(s.getLineId())).count();
nutMap.addv("schoolUnionLineNum", schoolUnionLineNum).addv("schoolInLineNum", schoolInLineNum).addv("schoolOutLineNum", schoolOutLineNum);
// 分工会组织线路
List<TheRapyRecuperationLineUnionSelect> unionSelectLineList = selectLineList.stream().filter(v -> v.getSignUpMode() == 1).collect(Collectors.toList());
int unionLineNum = unionSelectLineList.size();
// 分省内
int unionInLineNum = (int) unionSelectLineList.stream().filter(s -> inLineIds.contains(s.getLineId())).count();
// 分省外
int unionOutLineNum = (int) unionSelectLineList.stream().filter(s -> outLineIds.contains(s.getLineId())).count();
nutMap.addv("unionLineNum", unionLineNum).addv("unionInLineNum", unionInLineNum).addv("unionOutLineNum", unionOutLineNum);
return Result.success().addData(nutMap);
}
/**
* 出行时间标段统计
* @param year
* @param lineType
* @return
*/
@At
@RequiresPermissions("theRapyRecuperation.annualAnalysis")
public Object getLotNum(@Param(value = "year", required = false) Integer year,
@Param(value = "lineType", required = false) String lineType){
if (year == null) {
year = DateUtil.thisYear();
}
List<TheRapyRecuperationLot> lotList = dao.query(TheRapyRecuperationLot.class, Cnd.NEW().asc("lotValue"));
Sql sql = Sqls.create("""
SELECT
enroll.*,
line.lotId AS lineLotId
FROM
the_rapy_recuperation_enroll enroll
LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(signingUpTime)", "=", year);
cnd.and("enroll.isNormal", "=", true);
cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS);
if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) {
cnd.andEX("line.regionalNature", "=", lineType);
}
sql.setCondition(cnd);
List<NutMap> list = lineService.listMap(sql);
List<NutMap> resultMap = new ArrayList<>();
lotList.forEach(item -> {
NutMap map = NutMap.NEW();
int value = list.stream().filter(v -> item.getId().equals(v.getString("lineLotId"))).collect(Collectors.toList()).size();
map.put("label", item.getLotName());
map.put("value", value);
resultMap.add(map);
});
return Result.success().addData(resultMap);
}
/**
* 出行年龄分布统计
* @param year
* @param lineType
* @return
*/
@At
@RequiresPermissions("theRapyRecuperation.annualAnalysis")
public Object getAgeNum(@Param(value = "year", required = false) Integer year,
@Param(value = "lineType", required = false) String lineType){
if (year == null) {
year = DateUtil.thisYear();
}
Map<String, Integer> result = new HashMap<>();
result.put("35岁以下", 0);
result.put("35至45岁", 0);
result.put("45岁以上", 0);
Sql sql = Sqls.create("""
SELECT
enroll.idCard
FROM
the_rapy_recuperation_enroll enroll
LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(signingUpTime)", "=", year);
cnd.and("enroll.isNormal", "=", true);
cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS);
cnd.and("enroll.idCard", "is not", null);
cnd.groupBy("enroll.idCard");
if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) {
cnd.andEX("line.regionalNature", "=", lineType);
}
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.strList());
dao.execute(sql);
List<String> idCardList = sql.getList(String.class);
for (String idCard : idCardList) {
if (StrUtil.isBlank(idCard)) {
continue;
}
int birthYear = getBirthYearFromIdCard(idCard);
if (birthYear == 0) {
continue;
}
int age = year - birthYear;
if (age < 35) {
result.put("35岁以下", result.get("35岁以下") + 1);
} else if (age <= 45) {
result.put("35至45岁", result.get("35至45岁") + 1);
} else {
result.put("45岁以上", result.get("45岁以上") + 1);
}
}
List<NutMap> list = new ArrayList<>();
result.forEach((k, v) -> {
NutMap map = NutMap.NEW();
map.put("label", k);
map.put("value", v);
list.add(map);
});
return Result.success().addData(list);
}
private static int getBirthYearFromIdCard(String idCard) {
String birthYearStr;
if (idCard.length() == 18) {
// 18位身份证号,直接取第7到第10位作为出生年份
birthYearStr = idCard.substring(6, 10);
} else if (idCard.length() == 15) {
// 15位身份证号,取第7到第8位作为出生年份的后两位 15位身份证号均为19xx年
birthYearStr = "19" + idCard.substring(6, 8);
} else {
return 0;
}
return Integer.parseInt(birthYearStr);
}
/**
* 获取线路出行人数和年龄统计数据
* @return
*/
@At
@RequiresPermissions("theRapyRecuperation.annualAnalysis")
public Object getLineTravelAndAgeData(@Param(value = "year", required = false) Integer year,
@Param(value = "lineType", required = false) String lineType){
Sql sql = Sqls.create("""
SELECT
us.id,
CONCAT(line.lineName,'(',DATE_FORMAT(us.playStartTime,'%m月%d'),'至',DATE_FORMAT(us.playEndTime,'%m月%d'),')') AS lineName,
su.unionname,
lot.lotName,
COUNT(enroll.id) AS takePartInLineNum,
SUM(CASE
WHEN @year - (CASE
WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED)
WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED)
ELSE NULL
END) < 35 THEN 1 ELSE 0 END) AS underThirtyFive,
SUM(CASE
WHEN @year - (CASE
WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED)
WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED)
ELSE NULL
END) BETWEEN 35 AND 45 THEN 1 ELSE 0 END) AS thirtyFiveToFortyFive,
SUM(CASE
WHEN @year - (CASE
WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED)
WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED)
ELSE NULL
END) > 45 THEN 1 ELSE 0 END) AS aboveFortyFive
FROM
the_rapy_recuperation_line_union_select us
LEFT JOIN the_rapy_recuperation_line line ON us.lineId = line.id
LEFT JOIN the_rapy_recuperation_enroll enroll ON enroll.takePartInLineId = us.id
LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId
LEFT JOIN sys_union su ON su.id = us.unionId
$condition
""").setParam("year", year == null ? DateUtil.thisYear() : year);
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(us.selectTime)", "=", year);
cnd.and("enroll.isNormal", "=", true);
cnd.and("us.`enable`", "=", true);
cnd.groupBy("us.id");
if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) {
cnd.andEX("line.regionalNature", "=", lineType);
}
sql.setCondition(cnd);
List<NutMap> list = lineService.listMap(sql);
NutMap result = NutMap.NEW();
// 柱状图
List<NutMap> uvData = list.stream().map(v -> {
NutMap map = NutMap.NEW();
map.put("lineName", v.getString("lineName"));
map.put("value", v.getInt("takePartInLineNum"));
return map;
}).sorted(Comparator.comparing(v -> v.getString("lineName"))).collect(Collectors.toList());
// 折线图
List<NutMap> underThirtyFiveList = list.stream().map(v -> {
NutMap map = NutMap.NEW();
map.put("lineName", v.getString("lineName"));
map.put("count", v.getInt("underThirtyFive"));
map.put("name", "35岁以下");
return map;
}).collect(Collectors.toList());
List<NutMap> thirtyFiveToFortyFiveList = list.stream().map(v -> {
NutMap map = NutMap.NEW();
map.put("lineName", v.getString("lineName"));
map.put("count", v.getInt("thirtyFiveToFortyFive"));
map.put("name", "35至45岁");
return map;
}).collect(Collectors.toList());
List<NutMap> aboveFortyFiveList = list.stream().map(v -> {
NutMap map = NutMap.NEW();
map.put("lineName", v.getString("lineName"));
map.put("count", v.getInt("aboveFortyFive"));
map.put("name", "45岁以上");
return map;
}).collect(Collectors.toList());
underThirtyFiveList.addAll(thirtyFiveToFortyFiveList);
underThirtyFiveList.addAll(aboveFortyFiveList);
List<NutMap> collect = underThirtyFiveList.stream().sorted(Comparator.comparing(v -> v.getString("lineName"))).collect(Collectors.toList());
result.put("uvData", uvData);
result.put("transformData", collect);
return Result.success().addData(result);
}
/**
* 获取分工会出行人数和年龄统计数据
* @return
*/
@At
@RequiresPermissions("theRapyRecuperation.annualAnalysis")
public Object getLineTravelAgeData(@Param(value = "year", required = false) Integer year,
@Param(value = "lineType", required = false) String lineType){
return Result.success().addData(null);
}
}
@@ -3,32 +3,37 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.audit;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.RCSCloudAPI;
import io.v.nutz.base.model.AuditState;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.model.Audit;
import io.v.nutz.base.model.AuditState;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -54,32 +59,62 @@ public class TheRapyRecuperationAuditController {
@Inject
private Dao dao;
@Inject
private MsgApi msgApi;
@At
@ViReturn
public Object getXlByUnion(@Param(value = "state", required = false) Integer state,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "year", required = false) String year,
@Param(value = "signUpMode", required = false) Integer signUpMode) {
@RequiresAuthentication
public Object getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode) {
List<NutMap> xlByUnion = auditService.getXlByUnion(state, unionId, regionalNature, year, signUpMode);
List<NutMap> xlByUnion = auditService.getXlByUnion(state, unionId, regionalNature, year,endYear, signUpMode);
return xlByUnion;
}
@At
@ViReturn
@RequiresAuthentication
public Object getXlByUnionAudit(String unionId,String regionalNature, String year, Integer signUpMode) {
Sql sql = Sqls.create("""
SELECT
line.id,
line.lineName,
line.regionalNature,
ts.id as selectId,
ts.playStartTime,
ts.playEndTime
FROM
the_rapy_recuperation_line_union_select ts
LEFT JOIN the_rapy_recuperation_line line ON line.id = ts.lineId
$condition
""");
Cnd cnd = Cnd.NEW();
if (ShiroUtil.hasAnyRoles("sysadmin,A06")){
cnd.andEX("ts.unionId", "=", unionId);
} else {
cnd.and("ts.unionId", "=", vi.getUnionId());
}
cnd.andEX("YEAR(ts.selectTime)","=",year);
cnd.andEX("line.regionalNature","=",regionalNature);
cnd.andEX("line.signUpMode","=",signUpMode);
cnd.groupBy("line.id");
sql.setCondition(cnd);
return auditService.listMap(sql);
}
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyAudit")
public Object pageData(PageForm pageForm, @Param(value = "year", required = false) String year,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "state", required = false) String state,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "lotId", required = false) String lotId) {
public Object pageData(PageForm pageForm, String year, String unionId,
String unitId, String state, String takePartInLineId,
String isAudit, String regionalNature, String lotId,
String selectId) {
Sql sql = Sqls.create("""
SELECT
enroll.*,
@@ -89,6 +124,7 @@ public class TheRapyRecuperationAuditController {
'教职工' userNature,
state.stateColor,
state.stateName,
CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime,
IF
( enroll.takePartInUnionId != enroll.selfUnionId, TRUE, FALSE ) isTransferIn,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily,
@@ -110,6 +146,7 @@ public class TheRapyRecuperationAuditController {
cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId);
cnd.andEX("enroll.isNormal", "=", true);
cnd.andEX("lineu.signUpMode", "=", 1);
cnd.andEX("lineu.id", "=", selectId);
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
}
@@ -120,7 +157,7 @@ public class TheRapyRecuperationAuditController {
} else if (state.equals("2")) {
cnd.andEX("enroll.takePartInUnionId", "!=", Vi.getUnionId());
cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId());
} else {
} else if (state.equals("3")){
cnd.andEX("enroll.selfUnionId", "!=", Vi.getUnionId());
cnd.andEX("enroll.takePartInUnionId", "=", Vi.getUnionId());
}
@@ -148,12 +185,16 @@ public class TheRapyRecuperationAuditController {
""".formatted(TheRapyRecuperationState.UNIT, vi.getUnionId(), TheRapyRecuperationState.LINEUNIT, vi.getUnionId())));
}
} else {
cnd.and(Cnd.exps("enroll.selfUnionId", "=", vi.getUnionId()).or("enroll.takePartInUnionId", "=", vi.getUnionId()));
//屏蔽了本工会选择其他工会线路的人员
// cnd.and(Cnd.exps("enroll.selfUnionId", "=", vi.getUnionId()).or("enroll.takePartInUnionId", "=", vi.getUnionId()));
cnd.and("enroll.takePartInUnionId", "=", vi.getUnionId());
}
cnd.desc("enroll.signingUptime");
cnd.desc("enroll.unitName");
// cnd.having(Cnd.where("isTransferIn","=",0));
sql.setCondition(cnd);
return auditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
@@ -163,6 +204,7 @@ public class TheRapyRecuperationAuditController {
@At
@ViReturn
@RequiresAuthentication
public Object findOne(String id) {
NutMap one = auditService.findOne(id);
return one;
@@ -179,11 +221,9 @@ public class TheRapyRecuperationAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyAudit")
public Object doAudit(@Param(value = "id", required = false) String id,
@Param(value = "flag", required = false) boolean flag,
@Param(value = "isTransferIn", required = false) boolean isTransferIn,
@Param(value = "auditOpinion", required = false) String auditOpinion) {
public Object doAudit(String id, boolean flag,Boolean adjustment, boolean isTransferIn, String auditOpinion) {
Trans.exec(() -> {
TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id);
Audit audit = new Audit();
@@ -219,8 +259,13 @@ public class TheRapyRecuperationAuditController {
enroll.setStateId(TheRapyRecuperationState.LINEUNITFAIL);
}
}
auditService.updateIgnoreNull(enroll);
//auditMsg(enroll.getStateId(), enroll.getLoginName(), enroll.getTakePartInLineId());
auditMsg(enroll.getStateId(), enroll.getLoginName(),adjustment, enroll.getTakePartInLineId());
if (adjustment){
// enroll.setNormal(false);
auditService.dao().clear(TheRapyRecuperationEnroll.class,Cnd.where("id","=",enroll.getId()));
}
});
return null;
}
@@ -233,9 +278,11 @@ public class TheRapyRecuperationAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyAudit")
public Object doRecall(String id) {
TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id);
TheRapyRecuperationLineUnionSelect unionSelect = auditService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", enroll.getTakePartInLineId()));
if (enroll.getStateId().equals(TheRapyRecuperationState.UNITFAIL)) {
enroll.setStateId(TheRapyRecuperationState.UNIT);
enroll.setSelfUnionAuditId(null);
@@ -245,10 +292,12 @@ public class TheRapyRecuperationAuditController {
} else if (enroll.getStateId().equals(TheRapyRecuperationState.LINEUNITFAIL)) {
enroll.setStateId(TheRapyRecuperationState.LINEUNIT);
enroll.setSelfUnionAuditId(null);
} else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getSelfUnionId().equals(vi.getUnionId())) {
// } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getSelfUnionId().equals(vi.getUnionId())) {
} else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getSelfUnionId().equals(unionSelect.getUnionId())) {
enroll.setStateId(TheRapyRecuperationState.UNIT);
enroll.setSelfUnionAuditId(null);
} else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getTakePartInUnionId().equals(vi.getUnionId())) {
// } else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getTakePartInUnionId().equals(vi.getUnionId())) {
} else if (enroll.getStateId().equals(TheRapyRecuperationState.PASS) && enroll.getTakePartInUnionId().equals(unionSelect.getUnionId())) {
enroll.setStateId(TheRapyRecuperationState.LINEUNIT);
enroll.setJoinLineUnionAuditId(null);
}
@@ -267,9 +316,10 @@ public class TheRapyRecuperationAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("theRapyRecuperation.TheRapyAudit")
public Object doOnekeyAudit(@Param(value = "ids", required = false) String[] ids,
@Param(value = "auditOpinion", required = false) String auditOpinion, boolean flag) {
public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag,Boolean adjustment) {
Audit audit = new Audit();
audit.setAuditOpinion(auditOpinion);
audit.setAuditor(ShiroUtil.getUserId());
@@ -278,6 +328,7 @@ public class TheRapyRecuperationAuditController {
audit.setAuditTime(new Date());
audit.setAuditPass(flag);
Audit insert = auditService.insert(audit);
List<String> enrollIdList = new ArrayList<>();
for (String id : ids) {
TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id);
//如果状态等于分工会审核,并且参加的线路分工会也是自己的工会,就代表自己参加自己的工会线路
@@ -292,9 +343,14 @@ public class TheRapyRecuperationAuditController {
enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.LINEUNITFAIL);
enroll.setJoinLineUnionAuditId(insert.getId());
}
if (adjustment){
// enroll.setNormal(false);
enrollIdList.add(id);
}
auditService.updateIgnoreNull(enroll);
// auditMsg(enroll.getStateId(), enroll.getLoginName(), enroll.getTakePartInLineId());
auditMsg(enroll.getStateId(), enroll.getLoginName(),adjustment, enroll.getTakePartInLineId());
}
auditService.dao().clear(TheRapyRecuperationEnroll.class,Cnd.where("id","in",enrollIdList));
return null;
}
@@ -305,19 +361,20 @@ public class TheRapyRecuperationAuditController {
* @param loginName
* @param takePartInLineId
*/
private void auditMsg(Integer stateId,
String loginName,
String takePartInLineId) {
private void auditMsg(Integer stateId, String loginName,Boolean adjustment, String takePartInLineId) {
Sys_user user = auditService.dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName));
TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", takePartInLineId));
TheRapyRecuperationLineUnionSelect unionSelect = auditService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", takePartInLineId));
TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", unionSelect.getLineId()));
AuditState auditState = auditService.dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateId));
if (stateId.equals(TheRapyRecuperationState.UNITFAIL)) {
RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", "");
} else if (stateId.equals(TheRapyRecuperationState.LINEUNITFAIL)) {
RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", "");
} else if (stateId.equals(TheRapyRecuperationState.PASS)) {
RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", "");
String content = "【智慧工会】%s老师您好,您报名的%s线路因报名人数不足已取消,请尽快进入智慧工会重新选择线路。"
.formatted(user.getUsername(),theRapyRecuperationLine.getLineName());
if (stateId.equals(TheRapyRecuperationState.PASS)) {
content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。"
.formatted(user.getUsername(), theRapyRecuperationLine.getLineName());
}
// msgApi.sendMsg(content,user.getLoginname(), MsgApi.DING_DING_TEMPLATE_ID);
}
@@ -328,6 +385,7 @@ public class TheRapyRecuperationAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
public Object getBmUserUnion() {
Sql sql = Sqls.create("""
SELECT
@@ -340,7 +398,8 @@ public class TheRapyRecuperationAuditController {
Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) {
cnd.and("takePartInLineId", "IS NOT", null);
cnd.and(Cnd.exps("takePartInUnionId", "=", vi.getUnionId()).or("selfUnionId", "=", vi.getUnionId()));
// cnd.and(Cnd.exps("takePartInUnionId", "=", vi.getUnionId()).or("selfUnionId", "=", vi.getUnionId()));
cnd.and("selfUnionId", "=", vi.getUnionId());
}
cnd.groupBy("selfUnionId");
sql.setCondition(cnd);
@@ -357,13 +416,13 @@ public class TheRapyRecuperationAuditController {
*/
@At
@ViReturn
public Object getApplyNumAudit(@Param(value = "mode", required = false) String mode,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "year", required = false) Integer year) {
@RequiresAuthentication
public Object getApplyNumAudit(String takePartInLineId,String mode, String isAudit, Integer year,String selectId) {
String unionId = Vi.getUnionId();
Sql sql = Sqls.create("""
SELECT
COUNT( 1 )
COUNT(1) as signUpNum,
IFNULL(sum(familyNumber),0) as familyNumber
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
@@ -380,13 +439,16 @@ public class TheRapyRecuperationAuditController {
.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId", "=", takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.andEX("signUpMode", "=", 1);
if (StrUtil.isNotBlank(mode)) {
cnd1.and("stateId", "=", TheRapyRecuperationState.PASS);
}
if (StrUtil.isNotBlank(selectId)) cnd1.and("lineu.id","=",selectId);
sql.setCondition(cnd1);
int count1 = auditService.count(sql);
NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0)));
//本工会人员(其他路线)
Cnd cnd2 = Cnd.NEW();
@@ -394,13 +456,16 @@ public class TheRapyRecuperationAuditController {
.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId", "=", takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.andEX("signUpMode", "=", 1);
if (StrUtil.isNotBlank(mode)) {
cnd2.and("stateId", "=", TheRapyRecuperationState.PASS);
}
if (StrUtil.isNotBlank(selectId)) cnd2.and("lineu.id","=",selectId);
sql2.setCondition(cnd2);
int count2 = auditService.count(sql2);
NutMap map2 = (NutMap) Daos.query(dao, sql2.toString(), Sqls.callback.map());
int count2 = Integer.parseInt(String.valueOf(map2.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map2.getOrDefault("familyNumber",0)));
//其他工会人员(选我线路)
Cnd cnd3 = Cnd.NEW();
@@ -408,26 +473,32 @@ public class TheRapyRecuperationAuditController {
.and("selfUnionId", "!=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId","=",takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.andEX("signUpMode", "=", 1);
if (StrUtil.isNotBlank(mode)) {
cnd3.and("stateId", "=", TheRapyRecuperationState.PASS);
}
if (StrUtil.isNotBlank(selectId)) cnd3.and("lineu.id","=",selectId);
sql3.setCondition(cnd3);
int count3 = auditService.count(sql3);
NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map());
int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber",0)));
//选择校工会线路人员
Cnd cnd4 = Cnd.NEW();
cnd4.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId","=",takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.andEX("signUpMode", "=", 2);
if (StrUtil.isNotBlank(mode)) {
cnd4.and("stateId", "=", TheRapyRecuperationState.PASS);
}
if (StrUtil.isNotBlank(selectId)) cnd4.and("lineu.id","=",selectId);
sql4.setCondition(cnd4);
int count4 = auditService.count(sql4);
NutMap map4 = (NutMap) Daos.query(dao, sql4.toString(), Sqls.callback.map());
int count4 = Integer.parseInt(String.valueOf(map4.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map4.getOrDefault("familyNumber",0)));
return Map.of("count1", count1, "count2", count2, "count3", count3, "count4", count4);
}
@@ -436,26 +507,30 @@ public class TheRapyRecuperationAuditController {
//本公会人员(自己线路)
Cnd cnd1 = Cnd.NEW();
cnd1.and("takePartInUnionId", "=", unionId)
.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null).
andEX("YEAR(signingUptime)", "=", year)
.and("stateId", ">", TheRapyRecuperationState.UNIT)
.andEX("signUpMode", "=", 1);
sql.setCondition(cnd1);
int count1 = auditService.count(sql);
//本工会人员(其他路线)
Cnd cnd2 = Cnd.NEW();
cnd2.and("takePartInUnionId", "!=", unionId)
.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId","=",takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.and("stateId", ">", TheRapyRecuperationState.UNIT)
.andEX("signUpMode", "=", 1);
sql2.setCondition(cnd2);
int count2 = auditService.count(sql2);
if (StrUtil.isNotBlank(selectId)) cnd1.and("lineu.id","=",selectId);
sql.setCondition(cnd1);
NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0)));
//本工会人员(其他路线)
// Cnd cnd2 = Cnd.NEW();
// cnd2.and("takePartInUnionId", "!=", unionId)
// .and("selfUnionId", "=", unionId)
// .and("isNormal", "=", true)
// .and("takePartInLineId", "is not", null)
// .andEX("YEAR(signingUptime)", "=", year)
// .and("stateId", ">", TheRapyRecuperationState.UNIT)
// .andEX("signUpMode", "=", 1);
// sql2.setCondition(cnd2);
// int count2 = auditService.count(sql2);
//其他工会人员(选我线路)
Cnd cnd3 = Cnd.NEW();
@@ -463,13 +538,18 @@ public class TheRapyRecuperationAuditController {
.and("selfUnionId", "!=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId","=",takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.and("stateId", ">", TheRapyRecuperationState.LINEUNIT)
.andEX("signUpMode", "=", 1);
if (StrUtil.isNotBlank(selectId)) cnd3.and("lineu.id","=",selectId);
sql3.setCondition(cnd3);
int count3 = auditService.count(sql3);
NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map());
int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber",0)));
return Map.of("count1", count1, "count2", count2, "count3", count3);
// return Map.of("count1", count1, "count2", count2, "count3", count3);
return Map.of("count1", count1, "count3", count3);
}
if ("false".equals(isAudit)) {
@@ -479,23 +559,27 @@ public class TheRapyRecuperationAuditController {
.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId","=",takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.and("stateId", "=", TheRapyRecuperationState.UNIT)
.andEX("signUpMode", "=", 1);
if (StrUtil.isNotBlank(selectId)) cnd1.and("lineu.id","=",selectId);
sql.setCondition(cnd1);
int count1 = auditService.count(sql);
NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0)));
//本工会人员(其他路线)
Cnd cnd2 = Cnd.NEW();
cnd2.and("takePartInUnionId", "!=", unionId)
.and("selfUnionId", "=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("YEAR(signingUptime)", "=", year)
.and("stateId", "=", TheRapyRecuperationState.UNIT)
.andEX("signUpMode", "=", 1);
sql2.setCondition(cnd2);
int count2 = auditService.count(sql2);
// Cnd cnd2 = Cnd.NEW();
// cnd2.and("takePartInUnionId", "!=", unionId)
// .and("selfUnionId", "=", unionId)
// .and("isNormal", "=", true)
// .and("takePartInLineId", "is not", null)
// .andEX("YEAR(signingUptime)", "=", year)
// .and("stateId", "=", TheRapyRecuperationState.UNIT)
// .andEX("signUpMode", "=", 1);
// sql2.setCondition(cnd2);
// int count2 = auditService.count(sql2);
//其他工会人员(选我线路)
Cnd cnd3 = Cnd.NEW();
@@ -503,12 +587,17 @@ public class TheRapyRecuperationAuditController {
.and("selfUnionId", "!=", unionId)
.and("isNormal", "=", true)
.and("takePartInLineId", "is not", null)
.andEX("takePartInLineId","=",takePartInLineId)
.andEX("YEAR(signingUptime)", "=", year)
.and("stateId", "=", TheRapyRecuperationState.LINEUNIT)
.andEX("signUpMode", "=", 1);
if (StrUtil.isNotBlank(selectId)) cnd3.and("lineu.id","=",selectId);
sql3.setCondition(cnd3);
int count3 = auditService.count(sql3);
return Map.of("count1", count1, "count2", count2, "count3", count3);
NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map());
int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber",0)));
// return Map.of("count1", count1, "count2", count2, "count3", count3);
return Map.of("count1", count1, "count3", count3);
}
@@ -1,5 +1,7 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.audit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Vi;
@@ -8,23 +10,29 @@ import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@IocBean
@At("/platform/theRapyRecuperation/TheRapyXghAudit")
@@ -53,16 +61,70 @@ public class TheRapyRecuperationXghAuditController {
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyXghAudit")
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) String year,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "state", required = false) String state,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "lotId", required = false) String lotId) {
public Object pageData(PageForm pageForm, String year, String unionId,
String unitId, String state, String takePartInLineId,
String isAudit, String regionalNature, String lotId,
String selectId) {
Sql sql = Sqls.create("""
SELECT
enroll.*,
line.lineName,
line.id as lineId,
line.regionalNature,
'教职工' userNature,
state.stateColor,
state.stateName,
CONCAT(DATE_FORMAT(rs.playStartTime,'%m月%d日'),'-',DATE_FORMAT(rs.playEndTime,'%m月%d日')) AS linePlayTime,
IF
( enroll.takePartInUnionId != enroll.selfUnionId, TRUE, FALSE ) isTransferIn,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) num
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN `the_rapy_recuperation_line_union_select` rs ON rs.id = enroll.takePartInLineId
LEFT JOIN `the_rapy_recuperation_line` line on line.id=rs.lineId
LEFT JOIN audit_state state ON state.stateId = enroll.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("line.lotId", "=", lotId);
cnd.andEX("line.regionalNature", "=", regionalNature);
cnd.andEX("YEAR(enroll.signingUptime)", "=", year);
cnd.andEX("enroll.selfUnionId", "=", unionId);
cnd.and("enroll.takePartInLineId", "is not", null);
cnd.andEX("enroll.selfUnitId", "=", unitId);
cnd.andEX("line.id", "=", takePartInLineId);
cnd.andEX("enroll.isNormal", "=", true);
cnd.andEX("rs.signUpMode", "=", "2");
cnd.andEX("rs.id", "=", selectId);
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
}
if (Strings.isNotBlank(isAudit)) {
if (isAudit.equals("true")) {
cnd.and(new Static("enroll.stateId = %s".formatted(TheRapyRecuperationState.PASS)));
} else {
cnd.and(new Static("enroll.stateId = %s".formatted(TheRapyRecuperationState.SCHOOL)));
}
} else {
cnd.and(new Static("( enroll.stateId = %s OR enroll.stateId = %s OR enroll.stateId = %s)".
formatted(TheRapyRecuperationState.SCHOOL, TheRapyRecuperationState.SCHOOLFAIL, TheRapyRecuperationState.PASS)));
}
cnd.desc("enroll.signingUptime");
cnd.desc("enroll.unitName");
sql.setCondition(cnd);
return auditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyXghAudit")
public Object getLineNumber(PageForm pageForm, String year, String unionId,
String unitId, String state, String takePartInLineId,
String isAudit, String regionalNature, String lotId, String selectId) {
Sql sql = Sqls.create("""
SELECT
enroll.*,
@@ -93,6 +155,7 @@ public class TheRapyRecuperationXghAuditController {
cnd.andEX("line.id", "=", takePartInLineId);
cnd.andEX("enroll.isNormal", "=", true);
cnd.andEX("rs.signUpMode", "=", "2");
cnd.andEX("rs.id", "=", selectId);
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
}
@@ -109,7 +172,9 @@ public class TheRapyRecuperationXghAuditController {
cnd.desc("enroll.signingUptime");
cnd.desc("enroll.unitName");
sql.setCondition(cnd);
return auditService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> nutMaps = auditService.listMap(sql);
int familyNumber = nutMaps.stream().filter(o -> StrUtil.isNotBlank(o.getString("familyNumber"))).mapToInt(o -> o.getInt("familyNumber")).sum();
return familyNumber + nutMaps.size();
}
@@ -124,11 +189,9 @@ public class TheRapyRecuperationXghAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyXghAudit")
public Object doAudit(@Param(value = "id", required = false) String id,
@Param(value = "flag", required = false) boolean flag,
@Param(value = "isTransferIn", required = false) boolean isTransferIn,
@Param(value = "auditOpinion", required = false) String auditOpinion) {
public Object doAudit(String id, boolean flag, boolean isTransferIn, String auditOpinion, Boolean adjustment) {
Trans.exec(() -> {
TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id);
Audit audit = new Audit();
@@ -147,6 +210,11 @@ public class TheRapyRecuperationXghAuditController {
enroll.setStateId(TheRapyRecuperationState.SCHOOLFAIL);
}
auditService.updateIgnoreNull(enroll);
auditService.schoolAudit(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId());
if (adjustment) {
// enroll.setNormal(false);
auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", enroll.getId()));
}
});
return null;
}
@@ -159,6 +227,7 @@ public class TheRapyRecuperationXghAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyXghAudit")
public Object doRecall(String id) {
TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id);
@@ -178,10 +247,10 @@ public class TheRapyRecuperationXghAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("theRapyRecuperation.TheRapyXghAudit")
public Object doOnekeyAudit(@Param(value = "ids", required = false) String[] ids,
@Param(value = "auditOpinion", required = false) String auditOpinion,
@Param(value = "flag", required = false) boolean flag) {
public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag, Boolean adjustment) {
Audit audit = new Audit();
audit.setAuditOpinion(auditOpinion);
audit.setAuditor(ShiroUtil.getUserId());
@@ -191,12 +260,19 @@ public class TheRapyRecuperationXghAuditController {
audit.setAuditPass(flag);
Audit insert = auditService.insert(audit);
//List<TheRapyRecuperationEnroll> enrollList = auditService.dao().query(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", ids));
List<String> enrollIdList = new ArrayList<>();
for (String id : ids) {
TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id);
enroll.setStateId(TheRapyRecuperationState.PASS);
enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.SCHOOLFAIL);
enroll.setSchoolUnionAuditId(insert.getId());
auditService.updateIgnoreNull(enroll);
auditService.schoolAudit(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId());
if (adjustment) {
// enroll.setNormal(false);
enrollIdList.add(id);
}
}
auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", enrollIdList));
return null;
}
@@ -208,19 +284,61 @@ public class TheRapyRecuperationXghAuditController {
*/
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.TheRapyXghAudit")
public Object getXghLine() {
public Object getXghLine(Integer year,String regionalNature) {
// Sql sql = Sqls.create("""
// SELECT
// line.*,
// un.unionname
// FROM
// `the_rapy_recuperation_enroll` enroll
// LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
// LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId
// LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId
// where line.signUpMode='2' and line.createMode='2'
// group by line.id
// """);
Sql sql = Sqls.create("""
SELECT
line.*,
un.unionname
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
the_rapy_recuperation_line_union_select lineu
LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId
LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId
where line.signUpMode='2' and line.createMode='2'
LEFT JOIN sys_union un ON un.id = lineu.unionId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(lineu.selectTime)","=",year);
if (StrUtil.isNotBlank(regionalNature) && !"全部".equals(regionalNature)){
cnd.and("line.regionalNature","=",regionalNature);
}
cnd.groupBy("line.id");
sql.setCondition(cnd);
return baseService.listMap(sql);
}
@At
@ViReturn
@RequiresAuthentication
public Object getLinePlayTimeByLineId(String lineId, Integer signUpMode, Integer year) {
List<TheRapyRecuperationLineUnionSelect> query = dao.query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "=", lineId)
.and("signUpMode", "=", signUpMode).and("YEAR(selectTime)", "=", year));
//.and("selectUserId", "=", ShiroUtil.getUserId()).and("unionId", "=", Vi.getUnionId()));
List<NutMap> nutMaps = new ArrayList<>();
query.forEach(v -> {
String startTime = DateUtil.formatChineseDate(v.getPlayStartTime(), false, false).substring(5);
String endTime = DateUtil.formatChineseDate(v.getPlayEndTime(), false, false).substring(5);
NutMap map = new NutMap();
map.setv("times", startTime + "-" + endTime);
map.setv("selectId", v.getId());
nutMaps.add(map);
});
return nutMaps;
}
}
@@ -11,20 +11,19 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.mobile.selfApplyUser.models.SelfApplyUser;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency;
import io.v.nutz.zhgh.therapyRecuperation.service.baseManage.TheRapyRecuperationBaseManagerService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -50,7 +49,7 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.therapyRecuperation.controller.baseManage.TheBaseManagerController
* @FileName io.v.nutz.zhgh.therapyRecuperation.controller.baseManage.TheBaseManagerController
* @Description: 疗休养基地管理
* @Author zzr
* @Date 2023/6/5
@@ -93,14 +92,8 @@ public class TheRapyRecuperationBaseManagerController {
@POST
@Ok("json:full")
@ViReturn
@RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR)
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "lotId", required = false) String lotId,
@Param(value = "baseName", required = false) String baseName,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "travelAgencyId", required = false) String travelAgencyId,
@Param(value = "regionalNature", required = false) String regionalNature) {
@RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR)
public Object pageData(PageForm pageForm, Integer year, String lotId, String baseName, String unionId, String travelAgencyId, String regionalNature) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
@@ -146,9 +139,6 @@ public class TheRapyRecuperationBaseManagerController {
if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"))) {
if (ShiroUtil.hasRole("H04")) {
cnd.and("tb.createUnionId", "=", Vi.getUnionId());
} else {
SelfApplyUser selfApplyUser = baseService.dao().fetch(SelfApplyUser.class, Cnd.where("mobile", "=", ShiroUtil.getPrincipalProperty("loginname")));
cnd.and("tb.id", "in", selfApplyUser.getBaseManagementIds());
}
} else {
cnd.andEX("tb.createUnionId", "=", unionId);
@@ -167,6 +157,7 @@ public class TheRapyRecuperationBaseManagerController {
@At("/openClosedBase/?")
@POST
@ViReturn
@RequiresAuthentication
public Object openClosedBase(String id) {
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
@@ -184,6 +175,7 @@ public class TheRapyRecuperationBaseManagerController {
*/
@At("/selectBaseManageById/?")
@ViReturn
@RequiresAuthentication
public Object selectBaseManageById(String id) {
Assert.notBlank(id);
return dao.fetchLinks(dao.fetch(TheRapyRecuperationBaseManagement.class, id), "travelAgency");
@@ -199,8 +191,8 @@ public class TheRapyRecuperationBaseManagerController {
@At
@POST
@ViReturn
@SLog(type = "theRapyRecuperation", tag = "疗休养目的地管理", msg = "添加目的地")
@RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR)
@RequiresAuthentication
@RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR)
public Object doSubmit(@Param("base") TheRapyRecuperationBaseManagement baseManagement) {
baseManagement.setOpBy((String) ShiroUtil.getPrincipalProperty("id"));
baseManagement.setCreateUnionId((String) ShiroUtil.getPrincipalProperty("unionid"));
@@ -218,7 +210,7 @@ public class TheRapyRecuperationBaseManagerController {
@At("/deleteBase/?")
@POST
@ViReturn
@SLog(type = "theRapyRecuperation", tag = "疗休养目的地管理", msg = "删除目的地")
@RequiresAuthentication
public Object deleteBase(String id) {
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
@@ -235,10 +227,9 @@ public class TheRapyRecuperationBaseManagerController {
@At("/listAllBase")
@POST
@ViReturn
public Object listAllBase(@Param(value = "startYear", required = false) String startYear,
@Param(value = "endYear", required = false) String endYear,
@Param(value = "year", required = false) String year) {
Sql sql = Sqls.create("select * from `the_rapy_recuperation_base_management` tb $condition");
@RequiresAuthentication
public Object listAllBase(String startYear, String endYear, String year) {
Sql sql = Sqls.create("select * from `the_rapy_recuperation_base_management` tb left join `the_rapy_recuperation_lot` lot on lot.id=tb.lotId $condition");
CndPlus cnd = new CndPlus();
cnd.andEX("tb.`year`", ">=", startYear);
@@ -257,6 +248,7 @@ public class TheRapyRecuperationBaseManagerController {
@At("/selectBaseAllInfo")
@GET
@ViReturn
@RequiresAuthentication
public Object selectBaseAllInfo(@Param("id") String id) {
Assert.notBlank(id);
return theRapyRecuperationBaseManagerService.selectBaseAllInfo(id);
@@ -329,6 +321,7 @@ public class TheRapyRecuperationBaseManagerController {
*/
@At
@ViReturn
@RequiresAuthentication
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Aop(TransAop.READ_COMMITTED)
public Object importBaseManager(TempFile file) {
@@ -12,18 +12,18 @@ import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.mobile.selfApplyUser.models.SelfApplyUser;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationLineCreateMode;
import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyTravelLineExcelMode;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -42,14 +42,11 @@ import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.therapyRecuperation.controller.basicManage.TheRapyRecuperationLineController
* @FileName io.v.nutz.zhgh.therapyRecuperation.controller.basicManage.TheRapyRecuperationLineController
* @Description: 疗休养线路管理
* @Author zxc
* @Date 2022/5/31:09:34
@@ -76,23 +73,17 @@ public class TheRapyRecuperationLineController {
* 页面数据
*
* @param pageForm 分页参数
* @param year 年度
* @return {@link Object}
*/
@At
@POST
@Ok("json:full")
@ViReturn
@RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR)
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "keywords", required = false) String keywords,
@Param(value = "travelAgencyId", required = false) String travelAgencyId,
@Param(value = "lineName", required = false) String lineName,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "lotId", required = false) String lotId) {
@RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR)
public Object pageData(PageForm pageForm, Integer startYear , Integer endYear, String keywords, String travelAgencyId, String lineName, String unionId, String lotId) {
Cnd cnd = Cnd.NEW();
cnd.andEX("line.`year`", "=", year);
cnd.andEX("line.`year`", ">=", startYear);
cnd.andEX("line.`year`", "<=", endYear);
cnd.andEX("line.travelAgencyId", "=", travelAgencyId);
cnd.andEX("line.lotId", "=", lotId);
cnd.and(Cnd.likeEX("line.lineName", lineName));
@@ -107,17 +98,25 @@ public class TheRapyRecuperationLineController {
if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"))) {
if (ShiroUtil.hasRole("H04")) {
cnd.and("line.createUnionId", "=", Vi.getUnionId());
} else {
SelfApplyUser selfApplyUser = lineService.dao().fetch(SelfApplyUser.class, Cnd.where("mobile", "=", ShiroUtil.getPrincipalProperty("loginname")));
cnd.and("line.id", "in", selfApplyUser.getLineIds());
}
} else {
cnd.andEX("line.createUnionId", "=", unionId);
}
cnd.asc("serialNumber");
cnd.desc("regionalNature").asc("serialNumber").asc("line.opBy");
return lineService.pageData(pageForm, cnd);
}
@At
@POST
@ViReturn
@RequiresAuthentication
@RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR)
public Object getNo() {
Object serialNumber = dao.func2(TheRapyRecuperationLine.class, "max", "serialNumber");
serialNumber = Objects.requireNonNullElse(serialNumber, 0);
return Integer.parseInt(serialNumber.toString()) + 1;
}
/**
* 提交
*
@@ -127,7 +126,8 @@ public class TheRapyRecuperationLineController {
@At
@POST
@ViReturn
@RequiresRoles(value = {"sysadmin", "A06", "H04", "lxygys"}, logical = Logical.OR)
@RequiresAuthentication
@RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR)
public Object doSubmit(@Param("line") TheRapyRecuperationLine line) {
if (StrUtil.isBlank(line.getId())) {
if (lineService.count(Cnd.where("serialNumber", "=", line.getSerialNumber())) > 0) {
@@ -152,6 +152,7 @@ public class TheRapyRecuperationLineController {
@At("/openClosedLine/?")
@POST
@ViReturn
@RequiresAuthentication
public Object openClosedLine(String id) {
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
@@ -169,6 +170,7 @@ public class TheRapyRecuperationLineController {
@At("/deleteLine/?")
@POST
@ViReturn
@RequiresAuthentication
public Object deleteLine(String id) {
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
@@ -186,6 +188,7 @@ public class TheRapyRecuperationLineController {
*/
@At("/selectLineInfoById/?")
@ViReturn
@RequiresAuthentication
public Object selectLineInfoById(String id) {
Assert.notBlank(id);
return lineService.selectLineInfoById(id);
@@ -201,9 +204,8 @@ public class TheRapyRecuperationLineController {
*/
@At("/selectLineUser")
@ViReturn
public Object selectLineUser(PageForm pageForm,
@Param(value = "id", required = false) String id,
@Param(value = "unionId", required = false) String unionId) {
@RequiresAuthentication
public Object selectLineUser(PageForm pageForm, String id, String unionId) {
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
}
@@ -212,6 +214,7 @@ public class TheRapyRecuperationLineController {
@At("/getCreateMode")
@ViReturn
@RequiresAuthentication
public Object getCreateMode() {
boolean hasSchoolAdminRole = ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"));
if (hasSchoolAdminRole) {
@@ -228,6 +231,7 @@ public class TheRapyRecuperationLineController {
*/
@At("/viewUnionSelectTimeInfo/?")
@ViReturn
@RequiresAuthentication
public Object viewUnionSelectTimeInfo(String id) {
Assert.notBlank(id);
return lineService.viewUnionSelectTimeInfo(id);
@@ -240,6 +244,7 @@ public class TheRapyRecuperationLineController {
*/
@At
@ViReturn
@RequiresAuthentication
public Object hasAnyRoles(@Param("roles") String[] roles) {
boolean b = ShiroUtil.hasAnyRoles(roles);
return b;
@@ -267,6 +272,7 @@ public class TheRapyRecuperationLineController {
*/
@At
@ViReturn
@RequiresAuthentication
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Aop(TransAop.READ_COMMITTED)
public Object travelLineImport(TempFile file) {
@@ -69,8 +69,7 @@ public class TheRapyRecuperationTravelAgencyController {
@POST
@ViReturn
@RequiresAuthentication
public Object pageData(PageForm pageForm, @Param(value = "year", required = false) Integer year,
@Param(value = "keywords", required = false) String keywords) {
public Object pageData(PageForm pageForm, Integer year, String keywords) {
Cnd cnd = Cnd.NEW();
cnd.andEX("year", "=", year);
if (StrUtil.isNotBlank(keywords)) {
@@ -158,7 +157,7 @@ public class TheRapyRecuperationTravelAgencyController {
@At("/selectTravelAgency")
@ViReturn
@RequiresAuthentication
public Object selectTravelAgency(@Param(value = "year", required = false) Integer year) {
public Object selectTravelAgency(Integer year) {
Cnd cnd = Cnd.NEW();
cnd.andEX("year", "=", year);
return travelAgencyService.selectAllTravelAgencyByYear(cnd);
@@ -175,8 +174,7 @@ public class TheRapyRecuperationTravelAgencyController {
@At("/selectTravelAgencyByYears")
@ViReturn
@RequiresAuthentication
public Object selectTravelAgencyByYears(@Param(value = "startYear", required = false) Integer startYear,
@Param(value = "endYear", required = false) Integer endYear) {
public Object selectTravelAgencyByYears(Integer startYear, Integer endYear) {
Cnd cnd = Cnd.NEW();
cnd.andEX("year", ">=", startYear);
cnd.andEX("year", "<=", endYear);
@@ -246,7 +244,7 @@ public class TheRapyRecuperationTravelAgencyController {
List<TheRapyRecuperationTravelAgency> list = new ArrayList<>();
for (TheRapyTravelAgencyExcelMode travel : travelAgency) {
TheRapyRecuperationTravelAgency agency = new TheRapyRecuperationTravelAgency();
if (Strings.isNotBlank(map.get(travel.getTravelAgencyName()))) {
if (Strings.isNotBlank(map.get(travel.getTravelAgencyName()))){
agency.setId(map.get(travel.getTravelAgencyName()));
}
if (travel.getIsDisabled().equals("")) {
@@ -1,4 +1,4 @@
package io.v.nutz.zhgh.mobile.therapyRecuperation;
package io.v.nutz.zhgh.therapyRecuperation.controller.mobile;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -64,4 +64,12 @@ public class MobileTheRapyRecuperationEnrollController {
public void myRecuperation() {
}
@At("/userSignInfo")
@Ok("beetl:/mobile/therapyRecuperation/userSignInfo.html")
@RequiresAuthentication
public void userSignInfo() {
}
}
@@ -2,6 +2,7 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
@@ -9,16 +10,13 @@ import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_config;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect;
import io.v.nutz.zhgh.therapyRecuperation.model.*;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationCommonService;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.slog.annotation.SLog;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
@@ -28,13 +26,14 @@ 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.mvc.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationEnroll
* @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationEnroll
* @Description: 疗休养报名报名
* @Author zxc
* @Date 2022/5/31:16:58
@@ -88,19 +87,54 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "theRapyRecuperationType", required = false) int theRapyRecuperationType,
@Param(value = "lineUnionType", required = false) Integer lineUnionType) {
public Object pageData(PageForm pageForm, Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType) {
return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType);
}
@At
@ViReturn
@SLog(type = "lxy", tag = "我的疗休养", msg = "疗休养评价")
public Object doEvaluate(TheRapyRecuperationEvaluate rapyRecuperationEvaluate) {
rapyRecuperationEvaluate.setUserId(ShiroUtil.getUserId());
rapyRecuperationEvaluate.setUserName(io.v.nutz.web.commons.utils.ShiroUtil.getPlatformUsername());
rapyRecuperationEvaluate.setLoginName(io.v.nutz.web.commons.utils.ShiroUtil.getPlatformLoginname());
rapyRecuperationEvaluate.setApplyDate(new Date());
enrollService.dao().insertOrUpdate(rapyRecuperationEvaluate);
return null;
}
@At
@ViReturn
public Object finOneEvaluate(String lineId) {
TheRapyRecuperationEvaluate fetch = enrollService.dao().fetch(TheRapyRecuperationEvaluate.class,
Cnd.where("userId", "=", ShiroUtil.getUserId())
.and("lineId", "=", lineId));
return fetch;
}
@At
@POST
@ViReturn
@RequiresAuthentication
public Object getSelectLineById(String lineId, String unionId, int theRapyRecuperationType, Integer lineUnionType) {
return enrollService.getSelectLineById(lineId, unionId, theRapyRecuperationType, lineUnionType);
}
@At
@POST
@ViReturn
@RequiresAuthentication
public Object openSignUser(String usId, String baseId, String searchKeyWord) {
return enrollService.openSignUser(usId, baseId, searchKeyWord);
}
//获取设置了公开线路的分工会
@At
@ViReturn
@RequiresAuthentication
public Object getTheRapyUnions(@Param(value = "year", required = false) Integer year) {
public Object getTheRapyUnions(Integer year) {
return enrollService.getTheRapyUnions(year);
}
@@ -118,18 +152,37 @@ public class TheRapyRecuperationEnrollController {
public Object doSignUpForLine(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) {
//省外的线路报名需要判断
// if (lineInfo.getRegionalNature().equals(TheRapyRecuperationProvinceType.provinceOut.getValue())) {
String schoolCode = Globals.schoolCode;
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode"));
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion"));
Map<Boolean, String> validResult = new HashMap<>();
if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) {
if("zjxu".equals(config.getConfigValue())) {
validResult = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
} else {
} else if("zjiet".equals(config.getConfigValue())) {
validResult = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
} else if("zjnu".equals(config.getConfigValue())) {
validResult = enrollService.validSignUpInfoForZJNU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
} else if("hmc".equals(config.getConfigValue())) {
validResult = enrollService.validSignUpInfoForHMC((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
}
if (validResult.containsKey(false)) {
return Result.error(validResult.get(false));
}
// }
// 校验随行人的身份证信息
if (Lang.isNotEmpty(enrollInfo.getCompanionList())) {
for (TheRapyRecuperationEnrollCompanion companion : enrollInfo.getCompanionList()) {
if (StrUtil.isBlank(companion.getIdCard())) {
return Result.error("随行人身份证信息不能为空");
} else if (!IdcardUtil.isValidCard(companion.getIdCard())) {
return Result.error("随行人身份证信息有误");
}
if (companion.getAge() < 3 || companion.getAge() > 70) {
return Result.error("随行人年龄超过限制,请上传其他随行人");
}
}
}
if (StrUtil.isBlank(enrollInfo.getId())) {
enrollService.doSignUpForLine(enrollInfo);
} else {
@@ -149,10 +202,9 @@ public class TheRapyRecuperationEnrollController {
@ViReturn
@RequiresAuthentication
public Object doSignUpForTravelAgency(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) {
String schoolCode = Globals.schoolCode;
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode"));
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion"));
Map<Boolean, String> resultMap = new HashMap<>();
if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) {
if("zjxu".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
} else {
resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
@@ -179,10 +231,9 @@ public class TheRapyRecuperationEnrollController {
@ViReturn
@RequiresAuthentication
public Object doSignUpForBaseManagement(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) {
String schoolCode = Globals.schoolCode;
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode"));
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion"));
Map<Boolean, String> resultMap = new HashMap<>();
if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) {
if("zjxu".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
} else {
resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
@@ -191,6 +242,20 @@ public class TheRapyRecuperationEnrollController {
return Result.error(resultMap.get(false));
}
// 校验随行人的身份证信息
if (Lang.isNotEmpty(enrollInfo.getCompanionList())) {
for (TheRapyRecuperationEnrollCompanion companion : enrollInfo.getCompanionList()) {
if (StrUtil.isBlank(companion.getIdCard())) {
return Result.error("随行人身份证信息不能为空");
} else if (!IdcardUtil.isValidCard(companion.getIdCard())) {
return Result.error("随行人身份证信息有误");
}
if (companion.getAge() < 3 || companion.getAge() > 70) {
return Result.error("随行人年龄超过限制,请上传其他随行人");
}
}
}
if (StrUtil.isBlank(enrollInfo.getId())) {
enrollService.doSignUpForHotel(enrollInfo);
} else {
@@ -221,11 +286,7 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
public Object mySignUpPageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "theRapyRecuperationType", required = false) int theRapyRecuperationType,
@Param(value = "auditStateId", required = false) Integer auditStateId,
@Param(value = "signUpStateId", required = false) int signUpStateId) {
public Object mySignUpPageData(PageForm pageForm, Integer year, int theRapyRecuperationType, Integer auditStateId, int signUpStateId) {
Cnd cnd = Cnd.NEW();
cnd.and("e.loginName", "=", ShiroUtil.getPrincipalProperty("loginname"));
switch (signUpStateId) {
@@ -291,13 +352,20 @@ public class TheRapyRecuperationEnrollController {
return Result.error("线路信息不能为空");
}
String schoolCode = Globals.schoolCode;
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "schoolCode"));
if (StrUtil.isBlank(enrollInfo.getLoginName())){
enrollInfo.setLoginName(ShiroUtil.getPrincipalProperty("loginname").toString());
}
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion"));
Map<Boolean, String> resultMap = new HashMap<>();
if ("zjxu".equals(schoolCode) || "zjxu".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
} else {
resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo);
if("zjxu".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfoForZJXU(enrollInfo.getLoginName(), enrollInfo);
} else if("zjiet".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfo(enrollInfo.getLoginName(), enrollInfo);
} else if("zjnu".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfoForZJNU(enrollInfo.getLoginName(), enrollInfo);
} else if ("hmc".equals(config.getConfigValue())) {
resultMap = enrollService.validSignUpInfoForHMC(enrollInfo.getLoginName(), enrollInfo);
}
if (resultMap.containsKey(false)) {
return Result.error(resultMap.get(false));
@@ -367,11 +435,8 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
public Object doFeedBack(@Param(value = "id", required = false) String id,
@Param(value = "evaluationForTravelAgency", required = false) String evaluationForTravelAgency,
@Param(value = "evaluationForLine", required = false) String evaluationForLine,
@Param(value = "evaluationForJourney", required = false) String evaluationForJourney,
@Param(value = "feedbackContent", required = false) String feedbackContent) {
public Object doFeedBack(String id, String evaluationForTravelAgency, String evaluationForLine,
String evaluationForJourney, String feedbackContent) {
Chain chain = Chain.make("evaluationForTravelAgency", evaluationForTravelAgency);
chain.add("evaluationForLine", evaluationForLine);
chain.add("evaluationForJourney", evaluationForJourney);
@@ -411,7 +476,7 @@ public class TheRapyRecuperationEnrollController {
/**
* 手机端线路介绍所有信息
*
* @param usId 行id
* @param usId 行id
* @param usUnionId 我们工会id
* @return {@link Object}
*/
@@ -419,8 +484,7 @@ public class TheRapyRecuperationEnrollController {
@GET
@ViReturn
@RequiresAuthentication
public Object selectLineAllInfo(@Param(value = "usId", required = false) String usId,
@Param(value = "usUnionId", required = false) String usUnionId) {
public Object selectLineAllInfo(@Param("usId") String usId, @Param("usUnionId") String usUnionId) {
Assert.notBlank(usId);
return enrollService.selectLineAllInfo(usId, usUnionId);
}
@@ -38,7 +38,7 @@ import java.util.List;
import java.util.Map;
/**
* @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationEnrollJoinUserImport
* @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationEnrollJoinUserImport
* @Description: 导入参加人员
* @Author zxc
* @Date 2022/6/14:09:16
@@ -65,17 +65,14 @@ public class TheRapyRecuperationEnrollJoinUserImportController {
@At
@RequiresPermissions("theRapyRecuperation.joinUser.import")
@ViReturn
public Object selectLineAndTravelAgencyList(@Param(value = "year", required = false) Integer year,
@Param(value = "keyword", required = false) String keyword) {
public Object selectLineAndTravelAgencyList(Integer year, String keyword) {
return joinUserImportService.selectLineAndTravelAgencyList(year, keyword);
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("theRapyRecuperation.joinUser.import")
public Object readExcel(@Param(value = "file", required = false) TempFile tempFile,
@Param(value = "lineId", required = false) String lineId,
@Param(value = "travelAgencyId", required = false) String travelAgencyId) {
public Object readExcel(@Param("file") TempFile tempFile, @Param("lineId") String lineId, @Param("travelAgencyId") String travelAgencyId) {
try {
Assert.notNull(tempFile);
File file = tempFile.getFile();
@@ -121,7 +118,7 @@ public class TheRapyRecuperationEnrollJoinUserImportController {
@At
@ViReturn
@RequiresPermissions("theRapyRecuperation.joinUser.import")
public Object selectLineOrTravelAgency(@Param(value = "year", required = false) Integer year) {
public Object selectLineOrTravelAgency(Integer year) {
return joinUserImportService.selectLineOrTravelAgency(year);
}
@@ -5,7 +5,7 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationExamineController
* @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationExamineController
* @Description: 疗休养报名审核
* @Author zxc
* @Date 2022/6/1:18:16
@@ -3,7 +3,9 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process;
import cn.hutool.core.lang.Assert;
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.query.PageForm;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineAdjustmentService;
@@ -17,15 +19,23 @@ import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationLineAdjustment
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineAdjustment
* @Description: 线路及人员调整
* @Author zxc
* @Date 2022/6/10:10:00
@@ -40,6 +50,9 @@ public class TheRapyRecuperationLineAdjustmentController {
@Inject
private Dao dao;
@Inject
private MsgApi msgApi;
@Inject
private TheRapyRecuperationLineAdjustmentService adjustmentService;
@@ -62,11 +75,13 @@ public class TheRapyRecuperationLineAdjustmentController {
@ViReturn
@RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR)
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "lineId", required = false) String lineId,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "keywords", required = false) String keywords) {
return adjustmentService.pageData(pageForm, year, lineId, unionId, keywords);
Integer year,
String lineId,
String unionId,
String keywords,
String regionalNature,
String lotId) {
return adjustmentService.pageData(pageForm, year, lineId, unionId, keywords, regionalNature, lotId);
}
@@ -81,7 +96,7 @@ public class TheRapyRecuperationLineAdjustmentController {
@Ok("json:full")
@ViReturn
@RequiresAuthentication
public Object findUnionSignUpModeLineList(@Param(value = "year", required = false) Integer year) {
public Object findUnionSignUpModeLineList(Integer year) {
Sql sql = Sqls.create("""
select id,lineName from the_rapy_recuperation_line
$condition
@@ -104,8 +119,7 @@ public class TheRapyRecuperationLineAdjustmentController {
@POST
@Ok("json:full")
@RequiresAuthentication
public Object findUnionSignUpModeUserList(@Param(value = "lineId", required = false) String lineId,
@Param(value = "unionId", required = false) String unionId) {
public Object findUnionSignUpModeUserList(@Param("lineId") String lineId, @Param("unionId") String unionId) {
try {
Assert.notBlank(lineId);
return Result.success().addData(adjustmentService.findUnionSignUpModeUserList(lineId, unionId));
@@ -126,8 +140,7 @@ public class TheRapyRecuperationLineAdjustmentController {
@POST
@Ok("json:full")
@RequiresAuthentication
public Object adjustmentUser(@Param(value = "lineId", required = false) String lineId,
@Param(value = "loginNames", required = false) String[] loginName) {
public Object adjustmentUser(String lineId, @Param("loginNames") String[] loginName) {
try {
Assert.notBlank(lineId);
Assert.notNull(loginName);
@@ -142,4 +155,53 @@ public class TheRapyRecuperationLineAdjustmentController {
}
}
@At
@POST
@Ok("json:full")
@RequiresAuthentication
public Object smsAlerts(String lineId,@Param("loginNames") String[] loginName){
try {
Sql sql = Sqls.create("""
SELECT
rlus.id,
rlus.unionId,
rlus.lineId,
rlus.selectUserId,
DATE_FORMAT( rlus.playStartTime, '%Y-%m-%d' ) AS playStartTime,
DATE_FORMAT( rlus.playEndTime, '%Y-%m-%d' ) AS playEndTime,
rl.lineName,
rl.regionalNature,
lot.lotName
FROM
`the_rapy_recuperation_line_union_select` rlus
LEFT JOIN `the_rapy_recuperation_line` rl ON rlus.lineId = rl.id
LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id
WHERE
rlus.id = @id
""").setParam("id",lineId);
NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
String lineName = map.getString("lineName");
String lotName = map.getString("lotName");
String regionalNature = map.getString("regionalNature");
String playStartTime = map.getString("playStartTime");
String playEndTime = map.getString("playEndTime");
List<Sys_user> userList = dao.query(Sys_user.class, Cnd.where("loginname", "in", loginName));
Map<String, String> usernameMap = userList.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getUsername));
if (Lang.isNotEmpty(loginName)){
Arrays.stream(loginName).forEach(v->{
String username = usernameMap.get(v);
String content = "%s老师您好,您报名的%s【%s-%s】(%s至%s)线路未达到成团标准,现已解散,请您选择其他线路进行报名!"
.formatted(username,lineName,lotName,regionalNature,playStartTime,playEndTime);
// msgApi.sendWxMsg(content,v);
});
}
return Result.success();
} catch (Exception e){
e.printStackTrace();
return Result.error();
}
}
}
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
/**
* @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationLineClusterController
* @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationLineClusterController
* @Description: TODO
* @Author zxc
* @Date 2022/6/17:08:52
@@ -59,10 +59,7 @@ public class TheRapyRecuperationLineClusterController {
@POST
@RequiresAuthentication
@RequiresPermissions("theRapyRecuperation.lineCluster")
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "keywords", required = false) String keywords,
@Param(value = "unionId", required = false) String unionId) {
public Object pageData(PageForm pageForm, Integer year, String keywords, String unionId) {
Pagination pagination = clusterService.pageData(pageForm, year, unionId, keywords);
return pagination;
}
@@ -79,8 +76,7 @@ public class TheRapyRecuperationLineClusterController {
@ViReturn
@POST
@RequiresAuthentication
public Object findClusterInfo(@Param(value = "lineId", required = false) String lineId,
@Param(value = "usUnionId", required = false) String usUnionId) {
public Object findClusterInfo(@Param("lineId") String lineId, @Param("usUnionId") String usUnionId) {
Assert.notBlank(lineId);
Assert.notBlank(usUnionId);
return clusterService.findClusterInfo(lineId, usUnionId);
@@ -97,8 +93,7 @@ public class TheRapyRecuperationLineClusterController {
@POST
@RequiresAuthentication
@SLog(tag = "疗休养", msg = "设置组团人员", param = true, result = true)
public Object setClusterMembers(@Param(value = "clusters", required = false) String clusters,
@Param(value = "lineId", required = false) String lineId) {
public Object setClusterMembers(@Param("clusters") String clusters, @Param("lineId") String lineId) {
NutMap nutMap = Json.fromJson(NutMap.class, clusters);
List<TheRapyRecuperationCluster> clusterList = new ArrayList<>();
nutMap.forEach((k, v) -> {
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.process;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
@@ -78,24 +79,30 @@ public class TheRapyRecuperationLineUnionSelectController {
@POST
@ViReturn
@RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR)
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "keywords", required = false) String keywords,
@Param(value = "selectStatus", required = false) int selectStatus,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "lotId", required = false) String lotId,
@Param(value = "travelAgencyId", required = false) String travelAgencyId,
@Param(value = "mode", required = false) Integer mode) {
public Object pageData(PageForm pageForm, Integer year, String keywords, int selectStatus, String unionId,
String lotId, String travelAgencyId, Integer mode, String regionalNature) {
TheRapyRecuperationConfig config = unionSelectService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW());
Cnd cnd = Cnd.NEW();
cnd.andEX("line.year", "=", year);
cnd.andEX("line.lotId", "=", lotId);
cnd.andEX("line.travelAgencyId", "=", travelAgencyId);
if (!"全部".equals(regionalNature)) {
cnd.andEX("line.regionalNature", "=", regionalNature);
}
//当前登录用户已选择的线路id
Sql hasSelectLineSql = Sqls.createf("""
select lineId from the_rapy_recuperation_line_union_select where selectUserId = '%s' AND unionId = '%s'
""", ShiroUtil.getPrincipalProperty("id"), Vi.getUnionId());
Sql hasSelectLineSql;
if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) {
cnd.and(Cnd.exps("line.createUnionId", "=", Vi.getUnionId()).or("createMode", "=", 2));
hasSelectLineSql = Sqls.createf("""
select lineId from the_rapy_recuperation_line_union_select where selectUserId = '%s' AND unionId = '%s' AND year(selectTime) = %s
""", ShiroUtil.getPrincipalProperty("id"), Vi.getUnionId(), year == null ? DateUtil.thisYear() : year);
} else {
hasSelectLineSql = Sqls.createf("""
select lineId from the_rapy_recuperation_line_union_select where year(selectTime) = %s
""", year == null ? DateUtil.thisYear() : year);
}
/*hasSelectLineSql = Sqls.createf("""
select lineId from the_rapy_recuperation_line_union_select where unionId = '%s'
@@ -103,7 +110,10 @@ public class TheRapyRecuperationLineUnionSelectController {
switch (selectStatus) {
//查询未选择的线路
case -1 -> cnd.and("line.id", "not in", hasSelectLineSql);
case -1 -> {
cnd.and("line.id", "not in", hasSelectLineSql);
cnd.and("line.year", "in", year == null ? Lang.array(config.getProvinceStartYear(), config.getProvinceStartYear() + 1) : year);
}
case 0 -> {
SqlExpressionGroup seg = new SqlExpressionGroup();
@@ -123,6 +133,7 @@ public class TheRapyRecuperationLineUnionSelectController {
case 1 -> {
cnd.and("line.id", "in", hasSelectLineSql);
cnd.and("us.signUpMode", "=", mode);
cnd.and("year(us.selectTime)", "=", year == null ? DateUtil.thisYear() : year);
}
}
@@ -137,9 +148,9 @@ public class TheRapyRecuperationLineUnionSelectController {
if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().replace("ending", ""));
} else {
cnd.desc("year").asc("serialNumber");
cnd.asc("createUnionId").desc("year").asc("serialNumber");
}
return unionSelectService.pageData(pageForm, cnd);
return unionSelectService.pageData(pageForm, cnd, year);
}
/**
@@ -176,12 +187,14 @@ public class TheRapyRecuperationLineUnionSelectController {
//组织形式
int signUpMode = ShiroUtil.hasRole("H04") ? 1 : 2;
TheRapyRecuperationLineUnionSelect theRapyRecuperationLineUnionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", lineUnionSelect.getId()));
for (TheRapyRecuperationLineUnionSelect unionSelect : lineUnionSelects) {
unionSelect.setSelectTime(new Date());
unionSelect.setSelectUserId(ShiroUtil.getPlatformUid());
unionSelect.setUnionId(Vi.getUnionId());
unionSelect.setOpen(true);
unionSelect.setDelFlag(false);
unionSelect.setIsOpen(Lang.isNotEmpty(theRapyRecuperationLineUnionSelect)?theRapyRecuperationLineUnionSelect.getIsOpen():false);
unionSelect.setDelFlag(signUpMode == 2);
unionSelect.setSignUpMode(signUpMode);
}
@@ -199,9 +212,7 @@ public class TheRapyRecuperationLineUnionSelectController {
@At
@POST
@RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR)
public Object selectLineInfo(@Param(value = "lineId", required = false) String lineId,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "mode", required = false) Integer mode) {
public Object selectLineInfo(@Param("lineId") String lineId, @Param("unionId") String unionId, @Param("mode") Integer mode, @Param("year") Integer year) {
try {
Assert.notBlank(lineId);
Assert.notNull(mode);
@@ -209,10 +220,10 @@ public class TheRapyRecuperationLineUnionSelectController {
if (mode == 1 && !ShiroUtil.hasRole("H04")) {
return Result.error("您没有分工会角色权限!");
} else if (mode == 2 && !ShiroUtil.hasRole("A06")) {
} else if (mode == 2 && !ShiroUtil.hasAnyRoles("A06, sysadmin")) {
return Result.error("您没有校工会角色权限!");
}
return Result.success(unionSelectService.selectLineInfo(lineId, unionId, mode));
return Result.success(unionSelectService.selectLineInfo(lineId, unionId,mode, year));
} catch (Exception e) {
log.error(e.getMessage());
return Result.error(e.getMessage());
@@ -305,4 +316,51 @@ public class TheRapyRecuperationLineUnionSelectController {
}
/**
* 一键统赋时间,针对于已选择的线路
* @param lineIds 线路Id数组
* @param lineUnionSelects 出行时段
* @return {@link Object}
*/
@At("/setGiveLineTimes")
@POST
@ViReturn
@RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR)
@Aop(TransAop.READ_COMMITTED)
@SLog(type = "普惠疗休养",tag = "分工会/校工会选择线路",msg = "一键统赋时间,针对于已选择的线路",param = true,result = true)
public Object setGiveLineTimes(@Param("lineIds") String[] lineIds,@Param("lineUnionSelects") TheRapyRecuperationLineUnionSelect[] lineUnionSelects,
@Param(value = "year",required = false) Integer year) {
if (Lang.isNotEmpty(lineUnionSelects) && Lang.isNotEmpty(lineIds)) {
TheRapyRecuperationLineUnionSelect lineUnionSelect = lineUnionSelects[0];
Cnd cnd = Cnd.NEW();
cnd.and("unionId","=",Vi.getUnionId());
cnd.and("selectUserId","=", ShiroUtil.getUserId());
cnd.and("YEAR(selectTime)","=",year == null ? DateUtil.thisYear() : year);
List<TheRapyRecuperationLineUnionSelect> unionSelectList = dao.query(TheRapyRecuperationLineUnionSelect.class, cnd);
List<String> selectIdList = unionSelectList.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList());
Chain chain = Chain.make("enable",1);
if (lineUnionSelect.getSignUpStartTime() != null) chain.add("signUpStartTime",lineUnionSelect.getSignUpStartTime());
if (lineUnionSelect.getSignUpEndTime() != null) chain.add("signUpEndTime",lineUnionSelect.getSignUpEndTime());
if (lineUnionSelect.getChangeEndTime() != null) chain.add("changeEndTime",lineUnionSelect.getChangeEndTime());
if (lineUnionSelect.getPlayStartTime() != null) chain.add("playStartTime",lineUnionSelect.getPlayStartTime());
if (lineUnionSelect.getPlayEndTime() != null) chain.add("playEndTime",lineUnionSelect.getPlayEndTime());
dao.update(TheRapyRecuperationLineUnionSelect.class,chain,Cnd.where("id","in",selectIdList));
}
return null;
}
@At
@ViReturn
@RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR)
@SLog(type = "普惠疗休养",tag = "分工会/校工会选择线路",msg = "是否开放对外报名",param = true,result = true)
public Object doEditOpen(String id){
dao.update(TheRapyRecuperationLineUnionSelect.class,Chain.makeSpecial("isOpen", "isOpen ^ 1"), Cnd.where("id", "=", id));
return null;
}
}
@@ -13,7 +13,6 @@ import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
import java.util.Map;
@@ -42,8 +41,7 @@ public class TheRapyRecuperationStatisticsController {
@At
@ViReturn
@RequiresAuthentication
public Object getLineBar(@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "year", required = false) Integer year) {
public Object getLineBar(String regionalNature, Integer year) {
Sql sql = Sqls.create("""
SELECT
line.lineName,
@@ -16,13 +16,11 @@ import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency;
import io.v.nutz.zhgh.therapyRecuperation.model.*;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.slog.annotation.SLog;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
@@ -78,19 +76,18 @@ public class TheRapyRecuperationUnionQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object getXlData(PageForm pageForm,
@Param(value = "year", required = false) String year,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "lotId", required = false) String lotId) {
public Object getXlData(PageForm pageForm, String year, String unionId, String takePartInLineId, String regionalNature, String lotId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
lot.lotName,
lot.lotValue,
line.*,
line.id,
line.lineName,
line.regionalNature,
lineu.lineId,
lineu.id AS selectId,
lineu.signUpMode,
YEAR(lineu.selectTime) as `year`,
CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime,
lineu.playStartTime as playStartTime1,
lineu.playEndTime as playEndTime2,
lxs.travelAgencyName,
@@ -98,6 +95,9 @@ public class TheRapyRecuperationUnionQueryController {
lxs.contactMobileNumber,
enroll.takePartInUnionId AS usUnionId,
un.unionname,
lot.lotName,
lot.lotValue,
SUM(enroll.familyNumber) AS familyNumber,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=@stateId $unionCnd) lineNum,
(select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInLineId = lineu.id $unionCnd)) as signUpUserFamilyNum
FROM
@@ -115,8 +115,11 @@ public class TheRapyRecuperationUnionQueryController {
cnd.andEX("YEAR(enroll.signingUptime)", "=", year);
if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) {
sql.setVar("unionCnd", "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId()));
cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
// sql.setVar("unionCnd", "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId()));
String unionCndSql = StrUtil.isBlank(year) ? "and selfUnionId='%s'".formatted(Vi.getUnionId()) : "and selfUnionId='%s' and YEAR(signingUptime)='%s'".formatted(Vi.getUnionId(), year);
sql.setVar("unionCnd", unionCndSql);
// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
cnd.and("enroll.selfUnionId", "=", Vi.getUnionId());
/* if (Strings.isNotBlank(unionId)) {
cnd.andEX("enroll.selfUnionId", "=", unionId);
//cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
@@ -126,7 +129,8 @@ public class TheRapyRecuperationUnionQueryController {
}*/
} else {
if (Strings.isNotBlank(unionId)) {
cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
cnd.and("enroll.selfUnionId", "=", unionId);
}
}
if (Strings.isNotBlank(regionalNature)) {
@@ -146,17 +150,9 @@ public class TheRapyRecuperationUnionQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object getRyData(PageForm pageForm,
@Param(value = "year", required = false) String year,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "state", required = false) String state,
@Param(value = "state2", required = false) String state2,
@Param(value = "agencyId", required = false) String agencyId,
@Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId,
@Param(value = "lotId", required = false) String lotId) {
public Object getRyData(PageForm pageForm, String year, String unionId, String unitId,
String takePartInLineId, String regionalNature, String state,
String state2, String agencyId, String takePartInBaseManagementId, String lotId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
@@ -201,7 +197,8 @@ public class TheRapyRecuperationUnionQueryController {
if (ShiroUtil.hasAnyRoles("sysadmin,A06")) {
if (Strings.isNotBlank(unionId) && state.equals("1")) {
cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
cnd.and("enroll.selfUnionId", "=", unionId);
}
cnd.andEX("enroll.selfUnionId", "=", unionId);
} else {
@@ -221,7 +218,8 @@ public class TheRapyRecuperationUnionQueryController {
cnd.andEX("lineu.signUpMode", "=", 2);
}
} else {
cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
cnd.and("enroll.selfUnionId", "=", Vi.getUnionId());
}
}
cnd.andEX("enroll.selfUnitId", "=", unitId);
@@ -255,8 +253,7 @@ public class TheRapyRecuperationUnionQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object getLxsData(PageForm pageForm, @Param(value = "year", required = false) String year,
@Param(value = "agencyId", required = false) String agencyId) {
public Object getLxsData(PageForm pageForm, String year, String agencyId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
@@ -286,9 +283,7 @@ public class TheRapyRecuperationUnionQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object getJdData(PageForm pageForm,
@Param(value = "year", required = false) String year,
@Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId) {
public Object getJdData(PageForm pageForm, String year, String takePartInBaseManagementId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
@@ -321,12 +316,7 @@ public class TheRapyRecuperationUnionQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object getSelfUnionUser(PageForm pageForm,
@Param(value = "year", required = false) String year,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "state", required = false) String state,
@Param(value = "state2", required = false) String state2) {
public Object getSelfUnionUser(PageForm pageForm, String year, String unitId, String unionId, String state, String state2) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
@@ -364,11 +354,13 @@ public class TheRapyRecuperationUnionQueryController {
if (StrUtil.isNotBlank(unionId)) {
cnd.and("enroll.selfUnionId", "=", unionId);
} else {
cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
cnd.and("enroll.selfUnionId", "=", Vi.getUnionId());
}
} else {
if (StrUtil.isNotBlank(unionId)) {
cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId));
cnd.and("enroll.selfUnionId", "=", unionId);
}
}
cnd.desc("enroll.stateId");
@@ -396,15 +388,8 @@ public class TheRapyRecuperationUnionQueryController {
@Ok("void")
@ViReturn
@RequiresAuthentication
public void doExport(@Param(value = "state", required = false) String state,
@Param(value = "year", required = false) Integer year,
@Param(value = "searchName", required = false) String searchName,
@Param(value = "searchKeyword", required = false) String searchKeyword,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "agencyId", required = false) String agencyId,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "lotId", required = false) String lotId,
public void doExport(String state, Integer year, String searchName, String searchKeyword, String unionId,
String unitId, String agencyId, String takePartInLineId, String lotId,
HttpServletResponse response) throws IOException {
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(state)) {
@@ -418,17 +403,15 @@ public class TheRapyRecuperationUnionQueryController {
cnd.andEX("YEAR(signingUptime)", "=", year);
cnd.andEX("takePartInTravelAgencyId", "=", agencyId);
cnd.and("takePartInTravelAgencyId", "is not", null);
}
} else {
}
if (Strings.isNotBlank(searchKeyword) && Strings.isNotBlank(searchName)) {
cnd.and(Cnd.likeEX(searchName, searchKeyword));
}
if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) {
cnd.and(Cnd.exps("takePartInUnionId", "=", Vi.getUnionId()).or("selfUnionId", "=", Vi.getUnionId()));
}
cnd.and("stateId", "=", TheRapyRecuperationState.PASS);
cnd.and("isNormal", "=", true);
cnd.desc("unitName");
@@ -437,6 +420,9 @@ public class TheRapyRecuperationUnionQueryController {
baseService.dao().fetchLinks(v, "companionList");
baseService.dao().fetchLinks(v, "bedInfo");
});
TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW());
List<NutMap> arrayList = new ArrayList<>();
enrollList.forEach(v -> {
arrayList.add(new NutMap() {{
@@ -447,6 +433,7 @@ public class TheRapyRecuperationUnionQueryController {
addv("unionName", v.getUnionName());
addv("idCard", v.getIdCard());
addv("mobile", v.getMobile());
addv("familyNumber", v.getFamilyNumber());
addv("relation", "本人");
addv("bedType", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getBedType() : null);
addv("bedNum", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getBedNum() : null);
@@ -476,14 +463,19 @@ public class TheRapyRecuperationUnionQueryController {
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
exportEntities.add(new ExcelExportEntity("单位", "unitName", 40));
exportEntities.add(new ExcelExportEntity("工会", "unionName", 40));
exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 60));
exportEntities.add(new ExcelExportEntity("手机号", "mobile", 60));
exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 60));
exportEntities.add(new ExcelExportEntity("床型", "bedType", 20));
exportEntities.add(new ExcelExportEntity("位数", "bedNum", 20));
exportEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 20));
exportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
exportEntities.add(new ExcelExportEntity("工会", "unionName", 20));
exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30));
exportEntities.add(new ExcelExportEntity("手机号", "mobile", 10));
if (config.getFamilyInfo() == 2) {
exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 10));
exportEntities.add(new ExcelExportEntity("", "bedType", 10));
exportEntities.add(new ExcelExportEntity("床位数", "bedNum", 10));
exportEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 10));
} else {
exportEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 10));
}
exportEntities.add(new ExcelExportEntity("备注", "bz", 20));
response.setContentType("application/octet-stream");
@@ -512,12 +504,7 @@ public class TheRapyRecuperationUnionQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object getApplyNum(@Param(value = "state", required = false)String state,
@Param(value = "state2", required = false)String state2,
@Param(value = "unionId", required = false)String unionId,
@Param(value = "year", required = false)Integer year,
@Param(value = "regionalNature", required = false)String regionalNature,
@Param(value = "takePartInLineId", required = false)String takePartInLineId) {
public Object getApplyNum(String state, String state2, String unionId, Integer year, String regionalNature, String takePartInLineId) {
Cnd cnd1 = Cnd.NEW();
Sql sql1 = Sqls.create("""
SELECT
@@ -533,9 +520,10 @@ public class TheRapyRecuperationUnionQueryController {
if (Strings.isNotBlank(state)) {
if (state.equals("1")) {
cnd1.andEX("line.regionalNature", "=", regionalNature);
cnd1.and("enroll.takePartInTravelAgencyId", "is", null);
// cnd1.and("enroll.takePartInTravelAgencyId", "is", null);
if (StrUtil.isBlank(state2)) {
cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
// cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()));
}
} else if (state.equals("2")) {
cnd1.and("enroll.takePartInTravelAgencyId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId());
@@ -559,7 +547,8 @@ public class TheRapyRecuperationUnionQueryController {
}
}
} else {
cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
// cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()));
}
} else {
if (Strings.isNotBlank(state)) {
@@ -579,7 +568,8 @@ public class TheRapyRecuperationUnionQueryController {
}
} else {
if (Strings.isNotBlank(unionId)) {
cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId));
// cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId));
cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId));
}
}
}
@@ -588,26 +578,36 @@ public class TheRapyRecuperationUnionQueryController {
cnd1.andEX("enroll.isNormal", "= ", true);
cnd1.andEX("enroll.stateId", "= ", TheRapyRecuperationState.PASS);
TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW());
Sql sql2 = null;
if (config.getFamilyInfo() == 2) {
sql2 = Sqls.create("""
SELECT
count( 1 )
FROM
the_rapy_recuperation_enroll_companion
WHERE
trreId IN ( SELECT enroll.id FROM the_rapy_recuperation_enroll enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId $condition )
""");
} else {
sql2 = Sqls.create("""
SELECT sum(familyNumber) FROM the_rapy_recuperation_enroll enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId $condition
""");
}
Cnd cnd2 = Cnd.NEW();
Sql sql2 = Sqls.create("""
SELECT
count( 1 )
FROM
the_rapy_recuperation_enroll_companion
WHERE
trreId IN ( SELECT enroll.id FROM the_rapy_recuperation_enroll enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId $condition )
""");
if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) {
if (Strings.isNotBlank(state)) {
if (state.equals("1")) {
cnd2.andEX("line.regionalNature", "=", regionalNature);
cnd2.and("enroll.takePartInLineId", "is not", null);
if (StrUtil.isBlank(state2)) {
cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
// cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()));
}
} else if (state.equals("2")) {
cnd2.and("enroll.takePartInTravelAgencyId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId());
@@ -630,13 +630,15 @@ public class TheRapyRecuperationUnionQueryController {
}
}
} else {
cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
// cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId()));
cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()));
}
} else {
if (Strings.isNotBlank(state)) {
if (state.equals("1")) {
if (Strings.isNotBlank(unionId)) {
cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId));
// cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId));
cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId));
}
cnd2.andEX("line.regionalNature", "=", regionalNature);
cnd2.and("enroll.takePartInLineId", "is not", null);
@@ -659,7 +661,14 @@ public class TheRapyRecuperationUnionQueryController {
sql1.setCondition(cnd1);
int count1 = baseService.count(sql1);
sql2.setCondition(cnd2);
int count2 = baseService.count(sql2);
int count2 = 0;
if (config.getFamilyInfo() == 2) {
count2 = baseService.count(sql2);
} else {
Sql sql = Sqls.fetchInt(sql2.toString());
baseService.dao().execute(sql);
count2 = sql.getInt();
}
return Map.of("count1", count1, "count2", count2);
}
@@ -789,7 +798,7 @@ public class TheRapyRecuperationUnionQueryController {
left join `the_rapy_recuperation_line` rl on rs.lineId=rl.id
LEFT JOIN `the_rapy_recuperation_travel_agency` ta ON rl.travelAgencyId = ta.id
LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id
where rs.signUpMode='1' and rl.year=@year
where rs.signUpMode='1' and YEAR(rs.selectTime)=@year
""");
sql.setParam("year", DateUtil.thisYear());
List<NutMap> lineAllList = baseService.listMap(sql);
@@ -855,7 +864,7 @@ public class TheRapyRecuperationUnionQueryController {
WHERE
rl.lineName IS NOT NULL and rs.signUpMode='1' and re.isNormal='1'
and re.takePartInUnionId=@unionid
and rl.year=@year
and YEAR(re.signingUptime)=@year
and re.stateId=@stateId
""");
String unionid = ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getId();
@@ -874,6 +883,8 @@ public class TheRapyRecuperationUnionQueryController {
}
});
map.put("unionName", ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getUnionname());
map.put("year", DateUtil.thisYear());
map.put("schoolName", Globals.MyConfig.getString("GxName"));
map.put("maplist", list);
Sys_user user = baseService.dao().fetch(Sys_user.class, Cnd.where("id", "=", ShiroUtil.getPrincipalProperty("id")));
map.put("filler", user.getUsername());
@@ -1,8 +1,12 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.process;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
@@ -11,11 +15,12 @@ import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyRecuperationEnrollExcelMode;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot;
import io.v.nutz.zhgh.therapyRecuperation.model.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -28,6 +33,7 @@ import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@@ -36,10 +42,18 @@ import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@IocBean
@At("/platform/theRapyRecuperation/user/query")
@@ -62,16 +76,10 @@ public class TheRapyRecuperationUserQueryController {
@At
@ViReturn
@RequiresAuthentication
public Object pageData(@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "state", required = false) Integer state, PageForm pageForm,
@Param(value = "startYear", required = false) Integer startYear,
@Param(value = "endYear", required = false) Integer endYear,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "agencyId", required = false) String agencyId,
@Param(value = "lotId", required = false) String lotId,
@Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId) {
public Object pageData(String regionalNature, Integer state, PageForm pageForm,
Integer startYear, Integer endYear, String unionId,
String unitId, String takePartInLineId, String agencyId, String lotId,
String takePartInBaseManagementId,String signUpMode) {
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) {
@@ -84,11 +92,11 @@ public class TheRapyRecuperationUserQueryController {
SELECT
enroll.*,
lxs.travelAgencyName,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId
$condition
$condition
""");
cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId());
cnd.andEX("lxs.`year`", ">=", startYear);
@@ -105,8 +113,8 @@ public class TheRapyRecuperationUserQueryController {
enroll.*,
lineu.lineId,
lineu.playStartTime,
lineu.playEndTime,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily
lineu.playEndTime,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId
@@ -121,6 +129,7 @@ public class TheRapyRecuperationUserQueryController {
cnd.andEX("enroll.selfUnitId", "=", unitId);
cnd.andEX("line.id", "=", takePartInLineId);
cnd.andEX("line.regionalNature", "=", regionalNature);
cnd.andEX("lineu.signUpMode","=",signUpMode);
if (state == 3) {
sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = ma.lotId) as lotName");
cnd.and("enroll.takePartInBaseManagementId", "is not", null);
@@ -149,9 +158,7 @@ public class TheRapyRecuperationUserQueryController {
@At
@ViReturn
public Object getXlLxsUserCount(@Param(value = "unionId", required = false) String unionId,
@Param(value = "startYear", required = false) Integer startYear,
@Param(value = "endYear", required = false) Integer endYear) {
public Object getXlLxsUserCount(String unionId, Integer startYear, Integer endYear, Integer signUpMode) {
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(signingUptime)", ">=", startYear);
cnd.andEX("YEAR(signingUptime)", "<=", endYear);
@@ -161,17 +168,20 @@ public class TheRapyRecuperationUserQueryController {
cnd.and("isNormal", "=", true);
cnd.and("takePartInLineId", "is not", null);
cnd.and("stateId", "=", TheRapyRecuperationState.PASS);
cnd.andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode);
int count = baseService.dao().count(TheRapyRecuperationEnroll.class, cnd);
int count1 = baseService.dao().count(TheRapyRecuperationEnroll.class, Cnd.where("takePartInTravelAgencyId", "is not", null)
.andEX("selfUnionId", "=", unionId)
.andEX("YEAR(signingUptime)", ">=", startYear)
.andEX("YEAR(signingUptime)", "<=", endYear)
.andEX("isNormal", "=", true));
.andEX("isNormal", "=", true)
.andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode));
int count2 = baseService.dao().count(TheRapyRecuperationEnroll.class, Cnd.where("takePartInBaseManagementId", "is not", null)
.andEX("selfUnionId", "=", unionId)
.andEX("YEAR(signingUptime)", ">=", startYear)
.andEX("YEAR(signingUptime)", "<=", endYear)
.andEX("isNormal", "=", true));
.andEX("isNormal", "=", true)
.andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode));
return Map.of("xlCount", count, "lxsCount", count1, "jdCount", count2);
}
@@ -259,4 +269,236 @@ public class TheRapyRecuperationUserQueryController {
return null;
}
@At
@ViReturn
public Object doEdit(TheRapyRecuperationEnroll enroll) {
enroll.setNormal(true);
baseService.dao().updateIgnoreNull(enroll);
return null;
}
@At
@ViReturn
public Object getUnionSelectLine(Integer year,Integer signUpMode){
Sql sql = Sqls.create("""
SELECT
rlus.id,
rlus.unionId,
rlus.lineId,
rlus.selectUserId,
DATE_FORMAT( rlus.playStartTime, '%Y-%m-%d' ) AS playStartTime,
DATE_FORMAT( rlus.playEndTime, '%Y-%m-%d' ) AS playEndTime,
rl.lineName,
rl.regionalNature,
if(rlus.signUpMode=1,'分工会','校工会') AS signUpMode,
lot.lotName
FROM
`the_rapy_recuperation_line_union_select` rlus
LEFT JOIN `the_rapy_recuperation_line` rl ON rlus.lineId = rl.id
LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and(Cnd.exps("rlus.isOpen","=",1).or("rlus.unionId","=",Vi.getUnionId()));
cnd.and("YEAR(rlus.selectTime)","=",DateUtil.thisYear());
// cnd.and("rlus.signUpMode","=",signUpMode);
cnd.desc("lot.lotValue");
cnd.desc("rl.lineName");
sql.setCondition(cnd);
return baseService.listMap(sql);
}
@At
@Ok("void")
@ViReturn
@RequiresAuthentication
public void doExport(@Param(value = "regionalNature", required = false) String regionalNature,
@Param(value = "state", required = false) Integer state,
@Param(value = "searchName", required = false) String searchName,
@Param(value = "searchKeyword", required = false) String searchKeyword,
@Param(value = "startYear", required = false) Integer startYear,
@Param(value = "endYear", required = false) Integer endYear,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "takePartInLineId", required = false) String takePartInLineId,
@Param(value = "agencyId", required = false) String agencyId,
@Param(value = "lotId", required = false) String lotId,
@Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId,
@Param(value = "signUpMode", required = false) String signUpMode,
@Param(value = "types", required = false) String[] types,
@Param(value = "satisfyPeople", required = false) Boolean satisfyPeople,
HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment;filename="
+ URLEncoder.encode("疗休养报名人员名单.zip", StandardCharsets.UTF_8));
Cnd commonCnd = Cnd.NEW();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
commonCnd.and(Cnd.likeEX(searchName, searchKeyword));
}
if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) {
commonCnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId()));
}
commonCnd.and("enroll.isNormal", "=", true);
commonCnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS);
//线路的查询
Sql lineSql = Sqls.create("""
SELECT
line.regionalNature,
lxs.travelAgencyName,
line.lineName,
enroll.*,
date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat,
date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime,
lineu.lineId,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount,
u.schoolTime
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN `user` u on enroll.loginName = u.loginname
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId
LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId
$condition
""");
Cnd lineCnd = commonCnd.clone();
lineCnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear);
lineCnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear);
lineCnd.andEX("enroll.selfUnitId", "=", unitId);
lineCnd.andEX("line.id", "=", takePartInLineId);
lineCnd.andEX("line.regionalNature", "=", regionalNature);
lineCnd.andEX("lineu.signUpMode", "=", signUpMode);
lineCnd.andEX("enroll.selfUnionId", "=", unionId);
lineCnd.and("enroll.takePartInLineId", "is not", null);
lineCnd.and("enroll.takePartInLineId", "!=", "");
if (StrUtil.isNotBlank(lotId)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or("line.lotId", "=", lotId);
seg.or("ma.lotId", "=", lotId);
lineCnd.and(seg);
}
lineCnd.asc("playStartTime").asc("unionName");
lineSql.setCondition(lineCnd);
List<NutMap> lineEnroll = baseService.listMap(lineSql);
if (satisfyPeople) {
//按照选择线路id分组,便于判断是否成团
Map<String, List<NutMap>> enrollGroup = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInLineId")));
List<TheRapyRecuperationLineUnionSelect> unionSelects =
baseService.dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("enable", "=", true));
Map<String, TheRapyRecuperationLineUnionSelect> selectMap = unionSelects.stream().collect(Collectors.toMap(TheRapyRecuperationLineUnionSelect::getId, o -> o));
lineEnroll = enrollGroup.entrySet().stream()
.filter(entry -> selectMap.containsKey(entry.getKey()) && (entry.getValue().size() + entry.getValue().stream().mapToInt(o -> o.getInt("familyCount")).sum()) >= selectMap.get(entry.getKey()).getEstimatedFamilyNumbers())
.flatMap(entry -> entry.getValue().stream())
.toList();
}
Map<String, List<NutMap>> lineGroupMap = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("lineId")));
//查询所有的线路
List<TheRapyRecuperationLine> lineList = baseService.dao().query(TheRapyRecuperationLine.class, Cnd.NEW());
Map<String, String> lineMap = lineList.stream().collect(Collectors.toMap(TheRapyRecuperationLine::getId, TheRapyRecuperationLine::getLineName));
//定点的查询
Sql travelSql = Sqls.create("""
SELECT
enroll.*,
base.baseName,
u.schoolTime
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN `user` u ON enroll.loginName = u.loginname
LEFT JOIN the_rapy_recuperation_base_management base ON base.id = enroll.takePartInBaseManagementId
$condition
""");
Cnd baseCnd = commonCnd.clone();
baseCnd.andEX("enroll.selfUnionId", "=", unionId);
baseCnd.andEX("base.`year`", ">=", startYear);
baseCnd.andEX("base.`year`", "<=", endYear);
baseCnd.andEX("base.takePartInBaseManagementId", "=", agencyId);
baseCnd.and("enroll.takePartInBaseManagementId", "is not", null);
baseCnd.and("enroll.takePartInBaseManagementId", "!=", "");
baseCnd.desc("enroll.unionName");
travelSql.setCondition(baseCnd);
List<NutMap> travelEnroll = baseService.listMap(travelSql);
Map<String, List<NutMap>> travelGroupMap = travelEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInBaseManagementId")));
//查询所有的定点酒店
List<TheRapyRecuperationBaseManagement> baseList = baseService.dao().query(TheRapyRecuperationBaseManagement.class, Cnd.NEW());
Map<String, String> baseMap = baseList.stream().collect(Collectors.toMap(TheRapyRecuperationBaseManagement::getId, TheRapyRecuperationBaseManagement::getBaseName));
//公共的导出表头
ArrayList<ExcelExportEntity> commonEntities = new ArrayList<>();
commonEntities.add(new ExcelExportEntity("姓名", "userName", 20));
commonEntities.add(new ExcelExportEntity("工号", "loginName", 20));
commonEntities.add(new ExcelExportEntity("性别", "sex", 10));
commonEntities.add(new ExcelExportEntity("所属单位", "unitName", 20));
commonEntities.add(new ExcelExportEntity("所属工会", "unionName", 20));
commonEntities.add(new ExcelExportEntity("身份证号", "idCard", 30));
commonEntities.add(new ExcelExportEntity("手机号", "mobile", 15));
ExcelExportEntity entity = new ExcelExportEntity("报名时间", "signingUptime", 15);
entity.setFormat("yyyy-MM-dd HH:mm:ss");
commonEntities.add(entity);
//线路表头
ArrayList<ExcelExportEntity> lineEntities = new ArrayList<>(commonEntities);
lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20));
lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20));
lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20));
lineEntities.add(new ExcelExportEntity("随行人数", "familyCount", 20));
//自由组团表头
ArrayList<ExcelExportEntity> travelEntities = new ArrayList<>(commonEntities);
travelEntities.add(new ExcelExportEntity("酒店名称", "baseName", 20));
commonEntities.add(new ExcelExportEntity("备注", "remark", 30));
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
try {
if(Arrays.asList(types).contains("line")) {
for (String key : lineGroupMap.keySet()) {
List<NutMap> enrollList = lineGroupMap.get(key);
enrollList.forEach(item -> {
// String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime"));
// item.put("remark", remark);
});
String fileName = "线路报名人员/" + lineMap.get(key) + ".xlsx";
zipOutputStream.putNextEntry(new ZipEntry(fileName));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, enrollList);
workbook.write(zipOutputStream);
zipOutputStream.closeEntry();
response.flushBuffer();
}
}
if(Arrays.asList(types).contains("base")) {
for (String key : travelGroupMap.keySet()) {
List<NutMap> enrollList = travelGroupMap.get(key);
enrollList.forEach(item -> {
// String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime"));
// item.put("remark", remark);
});
String fileName = "定点疗休养报名人员/" + baseMap.get(key) + ".xlsx";
zipOutputStream.putNextEntry(new ZipEntry(fileName));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, travelEntities, enrollList);
workbook.write(zipOutputStream);
zipOutputStream.closeEntry();
response.flushBuffer();
}
}
zipOutputStream.flush();
zipOutputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,181 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.summary;
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.query.PageForm;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService;
import io.v.nutz.base.utils.ViTool;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.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 javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/therapyRecuperation/evaluate/statistics")
public class TherapyRecuperationEvaluateStatisticsController {
@Inject
private TheRapyRecuperationEnrollService enrollService;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/theRapyRecuperation/summary/evaluateStatistics.html")
@RequiresPermissions("theRapyRecuperation.evaluate.statistics")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("theRapyRecuperation.evaluate.statistics")
public Object pageData(PageForm pageForm,
String lineId,
String unionId,
String unitId,
String personType,
String userState,
String evaluateScore) {
Sql sql = Sqls.create("""
SELECT
we.evaluateText,
we.evaluateScore,
we.userName,
we.loginName,
u.unionname,
u.unitname,
u.userState,
u.personType,
line.lineName,
us.playStartTime
FROM
`the_rapy_recuperation_evaluate` we
LEFT JOIN `user` u ON u.id = we.userId
LEFT JOIN the_rapy_recuperation_enroll en ON en.takePartInLineId = we.lineId
LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = en.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
}
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equals("ascending") ? "asc" : "desc");
} else {
cnd.desc("we.evaluateScore");
}
if(StrUtil.isNotBlank(lineId)) {
cnd.andEX("we.lineId", "in", lineId.split(","));
}
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEX("we.evaluateScore", "=", evaluateScore);
cnd.groupBy("we.lineId");
sql.setCondition(cnd);
return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("theRapyRecuperation.evaluate.statistics")
public Object lineList(Integer year) {
Sql sql = Sqls.create("""
SELECT
GROUP_CONCAT(us.id) as id,
line.lineName,
if(us.signUpMode = 2, '校工会', un.unionname) as unionName
FROM
the_rapy_recuperation_line_union_select us
LEFT JOIN the_rapy_recuperation_line line ON us.lineId = line.id
LEFT JOIN sys_union un ON un.id = us.unionId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("year(us.selectTime)", "=", year);
cnd.groupBy("lineId, unionid");
sql.setCondition(cnd);
return enrollService.listMap(sql);
}
@At
@Ok("void")
@RequiresPermissions("theRapyRecuperation.evaluate.statistics")
public void exportEvaluate(String lineId,
String unionId,
String unitId,
String evaluateScore,
String searchKeyword,
String searchName,
HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
we.evaluateText,
we.evaluateScore,
we.userName,
we.loginName,
u.unionname,
u.unitname,
u.userState,
u.personType,
line.lineName,
us.playStartTime
FROM
`the_rapy_recuperation_evaluate` we
LEFT JOIN `user` u ON u.id = we.userId
LEFT JOIN the_rapy_recuperation_enroll en ON en.takePartInLineId = we.lineId
LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = en.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
cnd.and(Cnd.likeEX(searchName, searchKeyword));
}
if(StrUtil.isNotBlank(lineId)) {
cnd.andEX("we.lineId", "in", lineId.split(","));
}
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("we.evaluateScore", "=", evaluateScore);
cnd.groupBy("we.lineId");
sql.setCondition(cnd);
List<NutMap> listMap = enrollService.listMap(sql);
List<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("线路","lineName",20));
entities.add(new ExcelExportEntity("出行时间","playStartTime",20));
entities.add(new ExcelExportEntity("工号","loginName",20));
entities.add(new ExcelExportEntity("姓名","userName",20));
entities.add(new ExcelExportEntity("所属单位","unitname",20));
entities.add(new ExcelExportEntity("所属工会","unionname",20));
entities.add(new ExcelExportEntity("在职状态","userState",20));
entities.add(new ExcelExportEntity("人员类型","personType",20));
entities.add(new ExcelExportEntity("评分","evaluateScore",20));
entities.add(new ExcelExportEntity("评价","evaluateText",40));
try {
ViTool.excelResponse(response, "评价人员名单.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entities, listMap);
workbook.write(response.getOutputStream());
} catch (Exception ignored) {}
}
}
@@ -1,6 +1,8 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.theRapyConfig;
import cn.hutool.json.JSONUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.constant.RedisConstant;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
@@ -10,6 +12,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -17,7 +20,6 @@ import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import org.springframework.util.CollectionUtils;
@@ -41,6 +43,8 @@ public class TheRapyRecuperationConfigController {
@Inject
private Dao dao;
@Inject
private RedisService redisService;
@At("")
@@ -53,8 +57,7 @@ public class TheRapyRecuperationConfigController {
@ViReturn
@RequiresAuthentication
@Aop(TransAop.READ_COMMITTED)
public Object operation(TheRapyRecuperationConfig config,
@Param(value = "lotDeleteList", required = false) String[] lotDeleteList) {
public Object operation(TheRapyRecuperationConfig config, String[] lotDeleteList) {
if (Strings.isNotBlank(config.getId())) {
if (Lang.isNotEmpty(lotDeleteList)) {
dao.clear(TheRapyRecuperationLot.class, Cnd.where("id", "in", lotDeleteList));
@@ -68,6 +71,11 @@ public class TheRapyRecuperationConfigController {
} else {
dao.insertWith(config, "lots");
}
// 将配置存储到redis里边,可以避免每次都去查一次数据库
String configCache = RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE;
redisService.del(configCache);
redisService.set(configCache, JSONUtil.toJsonStr(config));
return null;
}
@@ -75,32 +83,31 @@ public class TheRapyRecuperationConfigController {
@ViReturn
@RequiresAuthentication
public Object findOne() {
return dao.fetchLinks(dao.fetch(TheRapyRecuperationConfig.class), "lots", Cnd.NEW().desc("lotValue"));
return dao.fetchLinks(dao.fetch(TheRapyRecuperationConfig.class), "lots",Cnd.NEW().desc("lotValue"));
}
/**
* 查使用该标段的线路和目的地
*
* @param lotId
* @return
*/
@At
@ViReturn
@RequiresAuthentication
public Object getLotsById(String lotId) {
public Object getLotsById(String lotId){
List<String> lineNames = new ArrayList<>();
List<String> baseNames = new ArrayList<>();
Map<String, List<String>> map = new HashMap<>();
List<TheRapyRecuperationLine> lineList = dao.query(TheRapyRecuperationLine.class, Cnd.where("lotId", "=", lotId));
if (!CollectionUtils.isEmpty(lineList)) {
lineList.forEach(v -> lineNames.add(v.getLineName()));
map.put("line", lineNames);
if (!CollectionUtils.isEmpty(lineList)){
lineList.forEach(v-> lineNames.add(v.getLineName()));
map.put("line",lineNames);
}
List<TheRapyRecuperationBaseManagement> managementList = dao.query(TheRapyRecuperationBaseManagement.class, Cnd.where("lotId", "=", lotId));
if (!CollectionUtils.isEmpty(managementList)) {
managementList.forEach(v -> baseNames.add(v.getBaseName()));
map.put("base", baseNames);
if (!CollectionUtils.isEmpty(managementList)){
managementList.forEach(v-> baseNames.add(v.getBaseName()));
map.put("base",baseNames);
}
return map;
}
@@ -108,16 +115,15 @@ public class TheRapyRecuperationConfigController {
/**
* 强制删除标段时长,会删除已绑定的线路和目的地
*
* @param lotId
* @return
*/
@At
@ViReturn
@RequiresAuthentication
public Object deleteLotById(String lotId) {
Trans.exec(() -> {
dao.clear(TheRapyRecuperationLot.class, Cnd.where("id", "=", lotId));
public Object deleteLotById(String lotId){
Trans.exec(()->{
dao.clear(TheRapyRecuperationLot.class, Cnd.where("id","=",lotId));
List<TheRapyRecuperationLine> lineList = dao.query(TheRapyRecuperationLine.class, Cnd.where("lotId", "=", lotId));
if (!CollectionUtils.isEmpty(lineList)) {
lineList.forEach(v -> v.setLotId(null));
@@ -21,7 +21,7 @@ public class TheRapyTravelLineExcelMode {
@Excel(name = "活动范围")
private String regionalNature;
@Excel(name = "最少成团人数")
@Excel(name = "最少参与教工")
private Integer minimumGroupSize;
// @Excel(name = "创建模式(分工会/校工会)")
@@ -11,7 +11,7 @@ import java.util.Date;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationBaseManagement
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement
* @Description: TODO
* @Author zzr
* @Date 2023/6/5
@@ -128,6 +128,14 @@ public class TheRapyRecuperationBaseManagement {
@Excel(name = "组织形式(分工会/校工会)")
private int createMode;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("基地联系人")
@Excel(name = "目的地联系人")
private String baseContactPerson;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("基地联系人电话")
@@ -8,7 +8,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationCluster
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster
* @Description: TODO
* @Author zxc
* @Date 2022/6/17:09:30
@@ -6,7 +6,7 @@ import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationClusterMember
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationClusterMember
* @Description: TODO
* @Author zxc
* @Date 2022/6/17:09:30
@@ -34,6 +34,11 @@ public class TheRapyRecuperationConfig {
@Comment("省外名额分配")
private Integer outsideQuota;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("省外名额分配")
private String outsideQuotaMode;
@Column
@ColDefine(type = ColType.FLOAT, width = 3, precision = 2)
@Comment("省外名额分配比例")
@@ -79,7 +84,6 @@ public class TheRapyRecuperationConfig {
@Comment("标段")
private List<NutMap> modifyBd;
@Many(field = "configId")
private List<TheRapyRecuperationLot> lots;
@@ -93,11 +97,23 @@ public class TheRapyRecuperationConfig {
@Comment("疗休养服务须知")
private String notice;
@Column
@ColDefine(type = ColType.INT)
@Comment("省内起始年份")
private Integer provinceStartYear;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("床位信息")
private Boolean bedInfo;
@Column
@ColDefine(type = ColType.INT)
@Comment("家属信息")
private Integer familyInfo;
@Column
@Comment("分工会人数限制")
@ColDefine(type = ColType.MYSQL_JSON)
private List<NutMap> unionLimit;
}
@@ -12,7 +12,7 @@ import java.util.Date;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnroll
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll
* @Description: 疗休养报名登记表
* @Author zxc
* @Date 2022/5/31:16:58
@@ -143,6 +143,24 @@ public class TheRapyRecuperationEnroll extends BaseModel {
@Many(field = "trreId")
private List<TheRapyRecuperationEnrollCompanion> companionList;
/**
* 酒店信息
*/
@One(field = "takePartInBaseManagementId")
private TheRapyRecuperationBaseManagement managementInfo;
/**
* 线路信息
*/
// @One(field = "takePartInLineId")
private TheRapyRecuperationLine lineInfo;
private String lineId;
private Date playStartTime;
private Date playEndTime;
/**
* 床位信息
*/
@@ -179,4 +197,10 @@ public class TheRapyRecuperationEnroll extends BaseModel {
@Comment("校工会审核Id")
private String schoolUnionAuditId;
@Column
@ColDefine(type = ColType.INT)
@Comment("家属数量")
private Integer familyNumber;
private String firstLetter;
}
@@ -8,7 +8,7 @@ import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollBed
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollBed
* @Description: 报名拼床信息
* @Author zxc
* @Date 2022/6/2:14:44
@@ -8,7 +8,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollChangeRecord
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollChangeRecord
* @Description: 疗休养登记变更记录表
* @Author zxc
* @Date 2022/5/31:17:10
@@ -8,7 +8,7 @@ import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollFamily
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollFamily
* @Description: TODO
* @Author zxc
* @Date 2022/5/31:17:07
@@ -0,0 +1,58 @@
package io.v.nutz.zhgh.therapyRecuperation.model;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table
public class TheRapyRecuperationEvaluate extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("参加线路id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String lineId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userName;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String loginName;
@Column
@Comment("评分")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String evaluateScore;
@Column
@Comment("评价内容")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String evaluateText;
@Column
@Comment("评价时间")
@ColDefine(type = ColType.DATETIME)
private Date applyDate;
}
@@ -12,7 +12,7 @@ import java.util.Date;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationLine
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine
* @Description: 疗休养线路管理
* @Author zxc
* @Date 2022/5/31:09:13
@@ -61,7 +61,7 @@ public class TheRapyRecuperationLine extends BaseModel {
@Column
@ColDefine(type = ColType.INT)
@Comment("最少成团人数")
@Comment("最少参与教工")
private Integer minimumGroupSize;
@Column
@@ -116,7 +116,7 @@ public class TheRapyRecuperationLine extends BaseModel {
@Column
@ColDefine(type = ColType.INT)
@Comment("预计人数(含家属")
@Comment("成团人数包括家属")
private Integer estimatedFamilyNumbers;
@Column
@@ -92,11 +92,11 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel {
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否公开")
private boolean isOpen;
private Boolean isOpen;
@Column
@ColDefine(type = ColType.INT)
@Comment("最少成团人数")
@Comment("最少参与教工")
private Integer minimumGroupSize;
@@ -112,7 +112,7 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel {
@Column
@ColDefine(type = ColType.INT)
@Comment("预计人数(含家属")
@Comment("成团人数包括家属")
private Integer estimatedFamilyNumbers;
@Column
@@ -6,7 +6,7 @@ import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationLot
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot
* @Description: TODO
* @Author zzr
* @Date 2023/6/6
@@ -11,7 +11,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationTravelAgency
* @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency
* @Description: 疗休养旅行社管理
* @Author zxc
* @Date 2022/5/31:14:39
@@ -18,7 +18,7 @@ public interface TheRapyRecuperationAuditService extends ViService<Audit> {
* @param year 可为空
* @return
*/
List<NutMap> getXlByUnion(Integer state, String unionId, String regionalNature, String year, Integer signUpMode);
List<NutMap> getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode);
/**
@@ -29,5 +29,12 @@ public interface TheRapyRecuperationAuditService extends ViService<Audit> {
NutMap findOne(String id);
/**
* 校工会审核
* @param stateId
* @param loginName
* @param adjustment
* @param takePartInLineId
*/
void schoolAudit(Integer stateId, String loginName,Boolean adjustment, String takePartInLineId);
}
@@ -29,6 +29,10 @@ public interface TheRapyRecuperationEnrollService extends ViService<TheRapyRecup
*/
Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType);
List<NutMap> getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType);
Object openSignUser(String usId, String travelId, String searchKeyWord);
/**
* 线路报名
*
@@ -78,7 +82,9 @@ public interface TheRapyRecuperationEnrollService extends ViService<TheRapyRecup
Map<Boolean, String> validSignUpInfoForZJXU(String loginName, TheRapyRecuperationEnroll enrollInfo);
Map<Boolean, String> validSignUpInfoForZJNU(String loginName, TheRapyRecuperationEnroll enrollInfo);
Map<Boolean, String> validSignUpInfoForHMC(String loginName, TheRapyRecuperationEnroll enrollInfo);
/**
* 我报名的页面数据
*
@@ -9,7 +9,7 @@ import java.util.List;
public interface TheRapyRecuperationLineAdjustmentService extends ViService {
Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords);
Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, String regionalNature, String lotId);
List findUnionSignUpModeUserList(String lineId, String unionId);
@@ -10,7 +10,7 @@ import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.service.TheRapyRecuperationLineService
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService
* @Description: 疗休养线路管理service
* @Author zxc
* @Date 2022/5/31:09:45
@@ -24,7 +24,7 @@ public interface TheRapyRecuperationLineUnionSelectService extends ViService<The
* @param cnd cnd
* @return {@link Pagination}
*/
Pagination pageData(PageForm pageForm, Cnd cnd);
Pagination pageData(PageForm pageForm, Cnd cnd, Integer year);
/**
@@ -49,7 +49,7 @@ public interface TheRapyRecuperationLineUnionSelectService extends ViService<The
* @param lineId 行id
* @return {@link Object}
*/
Object selectLineInfo(String lineId, String unionId,Integer mode);
Object selectLineInfo(String lineId, String unionId,Integer mode, Integer year);
/**
* 设置线路时间信息
@@ -1,16 +1,22 @@
package io.v.nutz.zhgh.therapyRecuperation.service.impl;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.model.Audit;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollBed;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService;
import 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
@@ -23,12 +29,16 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl<Audit> im
super(dao);
}
@Inject
private MsgApi msgApi;
@Override
public List<NutMap> getXlByUnion(Integer state, String unionId, String regionalNature, String year, Integer signUpMode) {
public List<NutMap> getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode) {
Sql sql = Sqls.create("""
SELECT
line.*,
lineu.id as selectId,
un.unionname,
DATE_FORMAT(lineu.playStartTime,'%Y-%m-%d') as playStartTime1
FROM
@@ -51,11 +61,18 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl<Audit> im
}
cnd.andEX("lineu.signUpMode", "=", signUpMode);
cnd.andEX("line.regionalNature", "=", regionalNature);
cnd.andEX("YEAR(enroll.signingUptime)", "=", year);
if (StrUtil.isNotBlank(endYear)){
cnd.andEX("YEAR(enroll.signingUptime)", ">=", year);
cnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear);
} else {
cnd.andEX("YEAR(enroll.signingUptime)", "=", year);
}
cnd.and("enroll.takePartInLineId", "is not", null);
cnd.and("enroll.takePartInLineId", "!=", "");
cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS);
cnd.groupBy("enroll.takePartInLineId");
cnd.asc("un.unionname");
cnd.groupBy("line.id");
cnd.having(Cnd.where("playStartTime1", "is not", null));
cnd.asc("un.unionname").asc("lineu.lineId").asc("lineu.playStartTime");
sql.setCondition(cnd);
return listMap(sql);
}
@@ -104,4 +121,21 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl<Audit> im
return map;
}
@Override
public void schoolAudit(Integer stateId, String loginName, Boolean adjustment, String takePartInLineId) {
Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName));
TheRapyRecuperationLineUnionSelect unionSelect = dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", takePartInLineId));
TheRapyRecuperationLine theRapyRecuperationLine = dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", unionSelect.getLineId()));
String content = "【智慧工会】%s老师您好,您报名的%s线路因报名人数不足已取消,请尽快进入智慧工会重新选择线路。"
.formatted(user.getUsername(),theRapyRecuperationLine.getLineName());
if (stateId.equals(TheRapyRecuperationState.PASS)) {
content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。"
.formatted(user.getUsername(), theRapyRecuperationLine.getLineName());
}
// msgApi.sendMsg(content,user.getLoginname(), MsgApi.DING_DING_TEMPLATE_ID);
}
}
@@ -12,7 +12,7 @@ import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationCommonServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationCommonServiceImpl
* @Description: TODO
* @Author zxc
* @Date 2022/6/6:10:46
@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Map;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationEnrollJoinUserImportServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationEnrollJoinUserImportServiceImpl
* @Description: TODO
* @Author zxc
* @Date 2022/6/14:09:57
@@ -20,7 +20,7 @@ import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineAdjustmentServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineAdjustmentServiceImpl
* @Description: TODO
* @Author zxc
* @Date 2022/6/10:10:04
@@ -34,14 +34,14 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl
}
@Override
public Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords) {
public Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, String regionalNature, String lotId) {
Sql sql = Sqls.create("""
SELECT
line.id,
line.serialNumber,
line.lineName,
line.regionalNature,
line.minimumGroupSize,
us.minimumGroupSize,
line.`year`,
line.isDisabled,
line.playNumberOfDays,
@@ -51,6 +51,7 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl
line.changeEndTime,
line.signUpMode,
line.createMode,
us.id as usId,
us.playStartTime,
us.playEndTime,
line.files,
@@ -59,8 +60,9 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl
ta.travelAgencyName,
us.unionId,
select_gh.unionname AS selectUnionName,
(select count(1) from the_rapy_recuperation_enroll where takePartInUnionId = us.unionId AND takePartInLineId = line.id and isNormal=true) as signUpUserNum,
(select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInUnionId = us.unionId AND takePartInLineId = line.id and isNormal=true)) as signUpUserFamilyNum
(select count(1) from the_rapy_recuperation_enroll where if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) AND takePartInLineId = us.id and isNormal=true) as signUpUserNum,
(select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) AND takePartInLineId = us.id and isNormal=true)) as signUpUserFamilyNum,
(select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber
FROM
the_rapy_recuperation_line_union_select us
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
@@ -70,11 +72,14 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl
$condition
""");
sql.setParam("signUpSuccessCode", TheRapyRecuperationState.PASS);
sql.setParam("year", year);
Cnd cnd = Cnd.NEW();
cnd.andEX("line.regionalNature","=",regionalNature);
cnd.andEX("line.lotId", "=", lotId);
//cnd.and("line.signUpMode", "=", TheRapyRecuperationSignUpMode.UNION.getValue());
cnd.and("us.playStartTime", "is not", null);
cnd.andEX("line.year", "=", year);
//cnd.andEX("line.year", "=", year);
cnd.andEX("line.id", "=", lineId);
if (ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.andEX("us.unionId", "=", unionId);
@@ -92,6 +97,7 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl
if (Vi.isNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
}
cnd.and("year(selectTime)", "=", year);
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@@ -108,13 +114,15 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl
e.unionName,
e.signingUptime,
e.isNormal,
count(c.id) as companionCount
count(c.id) as companionCount,
e.familyNumber
FROM
the_rapy_recuperation_enroll e
LEFT JOIN the_rapy_recuperation_enroll_companion c ON c.trreId = e.id
left join the_rapy_recuperation_line_union_select us on e.takePartInLineId = us.id
WHERE
e.takePartInLineId = @lineId
AND e.takePartInUnionId = @unionId
and if(us.signUpMode = 1, e.takePartInUnionId = @unionId, 1=1)
GROUP BY e.id
""");
// AND (e.stateId = @passStateCode or e.stateId is null)
@@ -4,11 +4,11 @@ import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationClusterMember;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineClusterService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
@@ -25,7 +25,7 @@ import java.util.Map;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineClusterServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineClusterServiceImpl
* @Description: 组团
* @Author zxc
* @Date 2022/6/17:09:04
@@ -28,7 +28,7 @@ import java.util.Date;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineServiceImpl
* @Description: TODO
* @Author zxc
* @Date 2022/5/31:09:47
@@ -212,18 +212,20 @@ public class TheRapyRecuperationLineServiceImpl extends ViServiceImpl<TheRapyRec
enroll.userName,
enroll.unionName,
enroll.unitName,
enroll.familyNumber,
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) isFamily
FROM
`the_rapy_recuperation_enroll` enroll
LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId
LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId
WHERE
lineu.lineId = @takePartInLineId
lineu.id = @takePartInLineId
and enroll.stateId=@stateId
$unionCnd
""").setParam("takePartInLineId", lineId).setParam("stateId", TheRapyRecuperationState.PASS);
if (StrUtil.isNotBlank(unionId) && !ShiroUtil.hasAnyRoles("sysadmin")) {
sql.setVar("unionCnd", "and (enroll.takePartInUnionId='%s' or enroll.selfUnionId='%s')".formatted(unionId, unionId));
// sql.setVar("unionCnd", "and (enroll.takePartInUnionId='%s' or enroll.selfUnionId='%s')".formatted(unionId, unionId));
sql.setVar("unionCnd", "and enroll.selfUnionId='%s'".formatted(unionId));
}
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> list = pagination.getList();
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.therapyRecuperation.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.Vi;
@@ -24,7 +25,7 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationLineUnionSelectServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineUnionSelectServiceImpl
* @Description: 分工会选择线路
* @Author zxc
* @Date 2022/6/1:10:18
@@ -46,7 +47,7 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
* @return {@link Pagination}
*/
@Override
public Pagination pageData(PageForm pageForm, Cnd cnd) {
public Pagination pageData(PageForm pageForm, Cnd cnd, Integer year) {
Sql sql = Sqls.create("""
select
line.id,
@@ -83,13 +84,18 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
LEFT JOIN the_rapy_recuperation_travel_agency ta on ta.id = line.travelAgencyId
LEFT JOIN sys_union gh ON gh.id = line.createUnionid
LEFT JOIN sys_user u ON u.id = line.opBy
LEFT JOIN the_rapy_recuperation_line_union_select us on us.lineId = line.id AND us.unionId = @unionId AND us.selectUserId = @userId
LEFT JOIN the_rapy_recuperation_line_union_select us on us.lineId = line.id and year(selectTime) = @year $us
LEFT JOIN sys_union usUnion on usUnion.id = us.unionId
LEFT JOIN the_rapy_recuperation_lot lot on lot.id = line.lotId
$condition
""");
sql.setParam("unionId", Vi.getUnionId());
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
if(!ShiroUtil.hasAnyRoles("sysadmin, A06")) {
sql.setVar("us", "AND us.unionId = '%s' AND us.selectUserId = '%s'".formatted(Vi.getUnionId(), ShiroUtil.getPlatformUid()));
}
//sql.setParam("unionId", Vi.getUnionId());
//sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
sql.setParam("year", year == null ? DateUtil.thisYear() : year);
/*SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or("line.createUnionId", "=", Vi.getUnionId());
@@ -151,7 +157,7 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
* @return {@link Object}
*/
@Override
public Object selectLineInfo(String lineId, String unionId, Integer mode) {
public Object selectLineInfo(String lineId, String unionId, Integer mode, Integer year) {
Sql sql;
sql = Sqls.create("""
@@ -176,11 +182,13 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
where unionId = @unionId
and lineId = @lineId
and signUpMode = @mode
and year(selectTime) = @year
ORDER BY signUpStartTime ASC
""");
sql.setParam("unionId", unionId);
sql.setParam("lineId", lineId);
sql.setParam("mode", mode);
sql.setParam("year", year == null ? DateUtil.thisYear() : year);
return listMap(sql);
@@ -15,7 +15,7 @@ import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
/**
* @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationTravelAgencyServiceImpl
* @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationTravelAgencyServiceImpl
* @Description: 疗休养旅行社
* @Author zxc
* @Date 2022/5/31:14:46
@@ -6,6 +6,7 @@ import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity;
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpUser;
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
@@ -44,7 +45,7 @@ public class TrainSignUpActivityAddController {
@At
@ViReturn
@Ok("json:full")
@RequiresPermissions("trainSingUp.manage.activity.add")
@RequiresAuthentication
public Object getUnionLimit(@Param(value = "activityScopeId", required = false) String activityScopeId) {
Sql sql = Sqls.create("""
SELECT
@@ -14,6 +14,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
@@ -28,6 +29,7 @@ import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
/**
* @ClassName WelfareChooseController
@@ -40,12 +42,15 @@ import java.util.List;
@At("/platform/welfare/userChoose")
public class WelfareUserChooseController {
@Inject
private Dao dao;
@Inject
private SimpleService simpleService;
@Inject
private WelfareProjectService welfareProjectService;
private final ReentrantLock lock = new ReentrantLock(true);
@At("")
@Ok("beetl:/platform/welfare/userChoose.html")
@RequiresPermissions("welfare.user.choose")
@@ -56,7 +61,6 @@ public class WelfareUserChooseController {
@ViReturn
@RequiresPermissions("welfare.user.choose")
public Object pageData(PageForm pageForm, Integer year) {
Sql sql = Sqls.create("""
SELECT
wp.*,
@@ -96,29 +100,44 @@ public class WelfareUserChooseController {
@SLog(type = "welfare", tag = "pc电脑选福利", msg = "福利")
@RequiresPermissions("welfare.user.choose")
public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress) {
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", ShiroUtil.getUserId()));
try {
lock.lock();
// 查询有没有这个人
int count = dao.count(WelfareList.class, Cnd.where("userId", "=", ShiroUtil.getUserId()).and("projectId", "=", projectId));
if (count <= 0) {
return Result.error("您不在此次选择名单中,如有疑问请及时联系校工会");
}
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", ShiroUtil.getUserId()));
List<WelfareUserSelection> insertList = new ArrayList<>();
List<String> ids = Json.fromJsonAsList(String.class, chooseIds);
ids.forEach(s -> {
WelfareUserSelection selection = new WelfareUserSelection();
selection.setWelfareId(projectId);
selection.setSubjectId(subjectId);
selection.setSelectUserId(ShiroUtil.getUserId());
selection.setSelectTime(new Date());
selection.setSelectOptionId(s);
selection.setReceiveAddress(receiveAddress);
insertList.add(selection);
});
simpleService.dao().insert(insertList);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId()));
return null;
List<WelfareUserSelection> insertList = new ArrayList<>();
List<String> ids = Json.fromJsonAsList(String.class, chooseIds);
ids.forEach(s -> {
WelfareUserSelection selection = new WelfareUserSelection();
selection.setWelfareId(projectId);
selection.setSubjectId(subjectId);
selection.setSelectUserId(ShiroUtil.getUserId());
selection.setSelectTime(new Date());
selection.setSelectOptionId(s);
selection.setReceiveAddress(receiveAddress);
insertList.add(selection);
});
simpleService.dao().insert(insertList);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId()));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
} finally {
lock.unlock();
}
}
@@ -129,23 +148,37 @@ public class WelfareUserChooseController {
@RequiresPermissions("welfare.user.choose")
public Result confirmSelect(@Param("welfareUserSelections") WelfareUserSelection[] welfareUserSelections,
String projectId) {
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class,
Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", ShiroUtil.getUserId()));
try {
lock.lock();
// 查询有没有这个人
int count = dao.count(WelfareList.class, Cnd.where("userId", "=", ShiroUtil.getUserId()).and("projectId", "=", projectId));
if (count <= 0) {
return Result.error("您不在此次选择名单中,如有疑问请及时联系校工会");
}
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
welfareUserSelection.setSelectUserId(ShiroUtil.getUserId());
welfareUserSelection.setSelectTime(new Date());
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class,
Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", ShiroUtil.getUserId()));
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
welfareUserSelection.setSelectUserId(ShiroUtil.getUserId());
welfareUserSelection.setSelectTime(new Date());
}
simpleService.dao().insert(welfareUserSelections);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId()));
return Result.success("选择成功");
} catch (Exception e) {
e.printStackTrace();
return Result.error();
} finally {
lock.unlock();
}
simpleService.dao().insert(welfareUserSelections);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId()));
return Result.success("选择成功");
}
@@ -799,10 +799,11 @@ public class WelfareSingleController {
wl.userState,
wl.personType,
gh.unionname,
dw.name as unitname,
dw.name as unitname,
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
wpus.selectNum,
wpso.optionName
wpso.optionName,
wpus.selectSpecs
FROM
welfare_project_user_selection wpus
left join user u on u.id = wpus.selectUserId
@@ -855,6 +856,7 @@ public class WelfareSingleController {
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 30));
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 50));
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 10));
exportEntities.add(new ExcelExportEntity("规格参数", "selectSpecs", 20));
// if (Globals.MyConfig.getBoolean("isThreeUnit")) {
// exportEntities.add(new ExcelExportEntity("所在部门", "threeUnitName", 50));
// }
@@ -22,15 +22,21 @@ public class WelfareExportEntityTc {
@Excel(name = "姓名", width = 20d)
private String userName;
@Excel(name = "所属工会", width = 20d)
@Excel(name = "所属工会", width = 30d)
private String unionName;
// @Excel(name = "所属单位", width = 60d)
// private String unitName;
@Excel(name = "工会小组", width = 30d)
private String unionGroupName;
@Excel(name = "所属单位", width = 30d)
private String unitName;
@Excel(name = "已选福利", width = 80d)
private String optionName;
@Excel(name = "规格参数", width = 50d)
private String selectSpecs;
@Excel(name = "收货人", width = 15d)
private String recipient;
@@ -8,6 +8,7 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSON;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.service.impl.ViServiceImpl;
@@ -464,13 +465,15 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
u.loginname AS loginName,
u.username AS userName,
vwl.unionname,
vwl.unionname as unionName,
vwl.unitname,
vwl.unionname AS unionName,
vwl.unitname AS unitName,
vwl.unionGroupName,
u.idcard AS idCard,
u.mobile,
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
wpus.userSign,
GROUP_CONCAT(DISTINCT wpso.optionName, IF(wpus.selectSpecs is not null, (CONCAT('规格:', wpus.selectSpecs)), ''), '',wpus.selectNum,'') optionName,
GROUP_CONCAT(DISTINCT wpso.optionName, '',wpus.selectNum,'') optionName,
wpus.selectSpecs,
wpus.courierNumber
FROM
welfare_project_user_selection wpus
@@ -645,14 +648,33 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
@Override
public void exportReceiveDetail(String projectId, String welfareUnitId, List<NutMap> allUser, List<NutMap> userChooseList, OutputStream outputStream) throws Exception {
Sql optionSql = Sqls.create("""
SELECT w2.id, w2.optionName
FROM `welfare_project_subject` w1
JOIN `welfare_project_subject_option` w2 ON w1.id = w2.subjectId
WHERE w1.projectId = @projectId;
SELECT
w2.id,
w2.optionName,
jt.fullOptionName AS fullOptionName
FROM
`welfare_project_subject` w1
JOIN
`welfare_project_subject_option` w2 ON w1.id = w2.subjectId
LEFT JOIN
JSON_TABLE(
w2.specs,
'$[*]' COLUMNS (
fullOptionName VARCHAR(255) PATH '$.value'
)
) AS jt ON 1=1
WHERE
w1.projectId = @projectId
""");
optionSql.setParam("projectId", projectId);
List<NutMap> options = (List<NutMap>) Daos.query(dao(), optionSql.toString(), Sqls.callback.maps());
// for (NutMap option : options) {
// if (StrUtil.isNotBlank(option.getString("fullOptionName"))) {
// option
// }
// }
// Sql sql = Sqls.create("""
// SELECT
// vwl.loginname,
@@ -680,7 +702,8 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
dw.`name` as unitname,
wpus.userSign,
wpus.selectOptionId,
wpus.selectNum
wpus.selectNum,
wpus.selectSpecs
FROM
welfare_list vwl
LEFT JOIN special_staff staff ON staff.userId = vwl.userId
@@ -726,7 +749,10 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
exportEntities.add(excelExportEntity1);
for (NutMap option : options) {
exportEntities.add(new ExcelExportEntity(option.getString("optionName"), option.getString("id"), 10));
exportEntities.add(new ExcelExportEntity(option.getString("optionName")
+ (StrUtil.isNotBlank(option.getString("fullOptionName")) ? ("-" + option.getString("fullOptionName")) : "")
, option.getString("id") + (StrUtil.isNotBlank(option.getString("fullOptionName")) ? ("-" + option.getString("fullOptionName")) : "")
, 40));
}
ExcelExportEntity excelExportEntity = new ExcelExportEntity();
excelExportEntity.setName("签字");
@@ -749,12 +775,29 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
data.put("qzBytes", userMap.get("qzBytes"));
for (NutMap option : options) {
if (StrUtil.isNotBlank(userMap.getString("selectOptionId"))) {
NutMap selectOption = list.stream().filter(x -> x.getString("loginname").equals(v) && x.getString("selectOptionId").equals(option.getString("id"))).findFirst().orElse(null);
if (Lang.isNotEmpty(selectOption)) {
data.put(option.getString("id"), selectOption.getInt("selectNum"));
} else {
data.put(option.getString("id"), 0);
if (StrUtil.isNotBlank(userMap.getString("selectSpecs"))) {
if (StrUtil.isNotBlank(userMap.getString("selectOptionId"))) {
String opId = (option.getString("id") + (StrUtil.isNotBlank(option.getString("fullOptionName")) ? ("-" + option.getString("fullOptionName")) : ""));
String userSpecs = userMap.getString("selectOptionId") + "-" + userMap.getString("selectSpecs");
if (opId.equals(userSpecs)) {
data.put(opId, userMap.getInt("selectNum"));
} else {
data.put(opId, 0);
}
}
} else {
if (StrUtil.isNotBlank(userMap.getString("selectOptionId"))) {
NutMap selectOption = list.stream()
.filter(x -> x.getString("loginname").equals(v)
&& x.getString("selectOptionId").equals(option.getString("id")))
.findFirst().orElse(null);
if (Lang.isNotEmpty(selectOption)) {
data.put(option.getString("id"), selectOption.getInt("selectNum"));
} else {
data.put(option.getString("id"), 0);
}
}
}
}
@@ -767,9 +810,18 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
NutMap totalMap = NutMap.NEW();
totalMap.put("no", "合计");
for (NutMap option : options) {
List<NutMap> selectOptionList = list.stream().filter(x -> StrUtil.isNotBlank(x.getString("selectOptionId")) && x.getString("selectOptionId").equals(option.getString("id"))).collect(Collectors.toList());
String opId = (option.getString("id") + (StrUtil.isNotBlank(option.getString("fullOptionName")) ? ("-" + option.getString("fullOptionName")) : ""));
List<NutMap> selectOptionList = list.stream()
.filter(x -> {
String userSpecs = "";
if (StrUtil.isNotBlank(x.getString("selectOptionId"))) {
userSpecs = x.getString("selectOptionId")
+ (StrUtil.isNotBlank(x.getString("selectSpecs")) ? ( "-" + x.getString("selectSpecs")) : "");
}
return StrUtil.isNotBlank(userSpecs) && userSpecs.equals(opId);
}).toList();
int selectNum = selectOptionList.stream().mapToInt(s -> s.getInt("selectNum")).sum();
totalMap.put(option.getString("id"), selectNum);
totalMap.put(opId, selectNum);
}
dataList.add(totalMap);
/*ExportParams exportParams = new ExportParams();