commit
This commit is contained in:
@@ -1,80 +0,0 @@
|
|||||||
package io.v.nutz.task.job;
|
|
||||||
|
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.RandomLists;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.JszAwardList;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.JszWxStep;
|
|
||||||
import io.v.nutz.sys.services.SysTaskService;
|
|
||||||
import io.v.nutz.sys.services.impl.SysTaskServiceImpl;
|
|
||||||
import io.v.nutz.task.services.TaskPlatformService;
|
|
||||||
import io.v.nutz.task.services.impl.TaskPlatformServiceImpl;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.nutz.ioc.Ioc;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.Mvcs;
|
|
||||||
import org.quartz.Job;
|
|
||||||
import org.quartz.JobDataMap;
|
|
||||||
import org.quartz.JobExecutionContext;
|
|
||||||
import org.quartz.JobExecutionException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
* 健身走抽奖
|
|
||||||
*
|
|
||||||
* @Author zhf
|
|
||||||
* @Date 2022/9/7 11:40
|
|
||||||
*/
|
|
||||||
@IocBean
|
|
||||||
public class jszLotteryJob implements Job {
|
|
||||||
@Override
|
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Ioc ioc = Mvcs.ctx().getDefaultIoc();
|
|
||||||
Dao dao = ioc.get(Dao.class);
|
|
||||||
TaskPlatformService taskPlatformService = ioc.get(TaskPlatformServiceImpl.class);
|
|
||||||
WxHttpUtil wxHttpUtil = ioc.get(WxHttpUtil.class);
|
|
||||||
SysTaskService sysTaskService = ioc.get(SysTaskServiceImpl.class);
|
|
||||||
|
|
||||||
String taskId = context.getJobDetail().getKey().getName();
|
|
||||||
JobDataMap data = context.getJobDetail().getJobDataMap();
|
|
||||||
String id = data.getString("id");
|
|
||||||
String query = "db.collection('activity').doc('%s').get()".formatted(id);
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> activityData = wxResult.getList("data", Map.class);
|
|
||||||
|
|
||||||
|
|
||||||
//查询这个活动健步的人
|
|
||||||
List<JszWxStep> userList = sysTaskService.dao().query(JszWxStep.class, Cnd.where("activityId", "=", id).and("applyDate", "=", DateUtil.getDate()));
|
|
||||||
//然后随机抽取用户
|
|
||||||
String dailyLottery = (String) activityData.get(0).get("dailyLottery");
|
|
||||||
List<JszWxStep> dailyLotteryList = RandomLists.newRandomList(userList, Integer.parseInt(dailyLottery));
|
|
||||||
List<JszAwardList> jszAwardLists = new ArrayList<>();
|
|
||||||
dailyLotteryList.forEach(v -> {
|
|
||||||
JszAwardList jszAwardList = new JszAwardList();
|
|
||||||
jszAwardList.setUserId(v.getUserId());
|
|
||||||
jszAwardList.setActivityId(id);
|
|
||||||
jszAwardList.setApplyDate(new Date());
|
|
||||||
jszAwardLists.add(jszAwardList);
|
|
||||||
|
|
||||||
});
|
|
||||||
sysTaskService.insert(jszAwardLists);
|
|
||||||
|
|
||||||
taskPlatformService.delete(taskId, taskId);
|
|
||||||
sysTaskService.delete(taskId);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,6 +31,7 @@ public class TaskPlatformServiceImpl implements TaskPlatformService {
|
|||||||
* @param jobGroup
|
* @param jobGroup
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isExist(String jobName, String jobGroup) {
|
public boolean isExist(String jobName, String jobGroup) {
|
||||||
return quartzManager.exist(new JobKey(jobName, jobGroup));
|
return quartzManager.exist(new JobKey(jobName, jobGroup));
|
||||||
}
|
}
|
||||||
@@ -45,6 +46,7 @@ public class TaskPlatformServiceImpl implements TaskPlatformService {
|
|||||||
* @param comment
|
* @param comment
|
||||||
* @param dataMap
|
* @param dataMap
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void add(String jobName, String jobGroup, String className, String cron, String comment, String dataMap) {
|
public void add(String jobName, String jobGroup, String className, String cron, String comment, String dataMap) {
|
||||||
QuartzJob qj = new QuartzJob();
|
QuartzJob qj = new QuartzJob();
|
||||||
qj.setJobName(jobName);
|
qj.setJobName(jobName);
|
||||||
@@ -63,6 +65,7 @@ public class TaskPlatformServiceImpl implements TaskPlatformService {
|
|||||||
* @param jobGroup
|
* @param jobGroup
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean delete(String jobName, String jobGroup) {
|
public boolean delete(String jobName, String jobGroup) {
|
||||||
QuartzJob qj = new QuartzJob();
|
QuartzJob qj = new QuartzJob();
|
||||||
qj.setJobName(jobName);
|
qj.setJobName(jobName);
|
||||||
@@ -73,6 +76,7 @@ public class TaskPlatformServiceImpl implements TaskPlatformService {
|
|||||||
/**
|
/**
|
||||||
* 清除任务
|
* 清除任务
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
quartzManager.clear();
|
quartzManager.clear();
|
||||||
}
|
}
|
||||||
@@ -83,6 +87,7 @@ public class TaskPlatformServiceImpl implements TaskPlatformService {
|
|||||||
* @param cronExpression
|
* @param cronExpression
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<String> getCronExeTimes(String cronExpression) throws Exception {
|
public List<String> getCronExeTimes(String cronExpression) throws Exception {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
|
CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
|
||||||
@@ -99,6 +104,7 @@ public class TaskPlatformServiceImpl implements TaskPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<String> getCronExeTimesPlus(String cronExpression) throws Exception {
|
public List<String> getCronExeTimesPlus(String cronExpression) throws Exception {
|
||||||
// 创建一个列表来存储执行时间
|
// 创建一个列表来存储执行时间
|
||||||
List<String> executionTimes = new ArrayList<>();
|
List<String> executionTimes = new ArrayList<>();
|
||||||
|
|||||||
@@ -122,9 +122,11 @@ public class Globals {
|
|||||||
List<Sys_task> taskList = sysTaskService.query();
|
List<Sys_task> taskList = sysTaskService.query();
|
||||||
for (Sys_task sysTask : taskList) {
|
for (Sys_task sysTask : taskList) {
|
||||||
try {
|
try {
|
||||||
if (!sysTask.isDisabled())//不存在则新建
|
//不存在则新建
|
||||||
|
if (!sysTask.isDisabled()) {
|
||||||
taskPlatformService.add(sysTask.getId(), sysTask.getId(), sysTask.getJobClass(), sysTask.getCron()
|
taskPlatformService.add(sysTask.getId(), sysTask.getId(), sysTask.getJobClass(), sysTask.getCron()
|
||||||
, sysTask.getNote(), sysTask.getData());
|
, sysTask.getNote(), sysTask.getData());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,9 +2,9 @@ package io.v.nutz.zhgh.healthCheckup.controller;
|
|||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupCampus;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupCampus;
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
|
|||||||
+11
-2
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.wizzer.framework.page.Pagination;
|
import cn.wizzer.framework.page.Pagination;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
||||||
@@ -70,7 +71,9 @@ public class HealthCheckupListController {
|
|||||||
u.unionGroupName,
|
u.unionGroupName,
|
||||||
hcus.selectTime,
|
hcus.selectTime,
|
||||||
hcus.subjectId,
|
hcus.subjectId,
|
||||||
hcus.userSign
|
hcus.campus,
|
||||||
|
hcus.userSign,
|
||||||
|
aus.id ausid
|
||||||
FROM
|
FROM
|
||||||
activity_user_scope aus
|
activity_user_scope aus
|
||||||
LEFT JOIN `user` u ON u.id = aus.userId
|
LEFT JOIN `user` u ON u.id = aus.userId
|
||||||
@@ -85,6 +88,10 @@ public class HealthCheckupListController {
|
|||||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||||
|
|
||||||
|
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||||
|
cnd.andEX("u.unionid", "=", Vi.getUnionId());
|
||||||
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||||
}
|
}
|
||||||
@@ -114,7 +121,7 @@ public class HealthCheckupListController {
|
|||||||
@ViReturn
|
@ViReturn
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
@RequiresPermissions("healthCheckup.list.mange")
|
@RequiresPermissions("healthCheckup.list.mange")
|
||||||
public Object doEditHealthCheckupData(String subjectId, String projectId, String userId) {
|
public Object doEditHealthCheckupData(String subjectId, String campus, String projectId, String userId) {
|
||||||
|
|
||||||
//查询用户有没有选择过套餐
|
//查询用户有没有选择过套餐
|
||||||
HealthCheckupUserSelection userSelection = healthCheckupProjectService.dao().fetch(HealthCheckupUserSelection.class,
|
HealthCheckupUserSelection userSelection = healthCheckupProjectService.dao().fetch(HealthCheckupUserSelection.class,
|
||||||
@@ -122,6 +129,7 @@ public class HealthCheckupListController {
|
|||||||
//如果选择过套餐就修改选择的套餐id
|
//如果选择过套餐就修改选择的套餐id
|
||||||
if (Lang.isNotEmpty(userSelection)) {
|
if (Lang.isNotEmpty(userSelection)) {
|
||||||
userSelection.setSubjectId(subjectId);
|
userSelection.setSubjectId(subjectId);
|
||||||
|
userSelection.setCampus(campus);
|
||||||
healthCheckupProjectService.update(userSelection);
|
healthCheckupProjectService.update(userSelection);
|
||||||
} else {
|
} else {
|
||||||
//如果没有选择过套餐添加一条记录
|
//如果没有选择过套餐添加一条记录
|
||||||
@@ -129,6 +137,7 @@ public class HealthCheckupListController {
|
|||||||
checkupUserSelection.setSelectUserId(userId);
|
checkupUserSelection.setSelectUserId(userId);
|
||||||
checkupUserSelection.setProjectId(projectId);
|
checkupUserSelection.setProjectId(projectId);
|
||||||
checkupUserSelection.setSubjectId(subjectId);
|
checkupUserSelection.setSubjectId(subjectId);
|
||||||
|
checkupUserSelection.setCampus(campus);
|
||||||
checkupUserSelection.setSelectTime(new Date());
|
checkupUserSelection.setSelectTime(new Date());
|
||||||
healthCheckupProjectService.insert(checkupUserSelection);
|
healthCheckupProjectService.insert(checkupUserSelection);
|
||||||
}
|
}
|
||||||
|
|||||||
+108
-41
@@ -4,16 +4,19 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
|
||||||
import cn.wizzer.framework.page.Pagination;
|
import cn.wizzer.framework.page.Pagination;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.utils.ViTool;
|
||||||
|
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
||||||
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||||
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
|
||||||
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
||||||
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupSingleService;
|
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupSingleService;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
@@ -30,7 +33,6 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +63,7 @@ public class HealthCheckupSingleController {
|
|||||||
public Object pageData(@Param(value = "projectId", required = false) String projectId,
|
public Object pageData(@Param(value = "projectId", required = false) String projectId,
|
||||||
@Param(value = "unionId", required = false) String unionId,
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
@Param(value = "unionGroupId", required = false) String unionGroupId) {
|
@Param(value = "unionGroupId", required = false) String unionGroupId) {
|
||||||
return healthCheckupSingleService.pageData(projectId,unionId,unionGroupId);
|
return healthCheckupSingleService.pageData(projectId, unionId, unionGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -75,31 +77,34 @@ public class HealthCheckupSingleController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@Ok("json:full")
|
@Ok("json:full")
|
||||||
@RequiresPermissions("welfare.project.statistics.single")
|
@RequiresPermissions("healthCheckup.statisticsSingle")
|
||||||
public Object receivePageData(PageForm page,@Param(value = "isSelected",required = false) String isSelected,
|
public Object receivePageData(PageForm page, @Param(value = "isSelected", required = false) String isSelected,
|
||||||
@Param(value = "projectId", required = false) String projectId,
|
@Param(value = "projectId", required = false) String projectId,
|
||||||
@Param(value = "unionId", required = false) String unionId) {
|
@Param(value = "unionId", required = false) String unionId) {
|
||||||
List<NutMap> labelList = healthCheckupSingleService.receivePageDataColumns(projectId);
|
List<NutMap> labelList = healthCheckupSingleService.receivePageDataColumns(projectId);
|
||||||
Pagination list = healthCheckupSingleService.receivePageData(page.getPageNumber(),page.getPageSize(),page.getSearchName(),page.getSearchKeyword(),projectId, unionId,isSelected);
|
Pagination list = healthCheckupSingleService.receivePageData(page.getPageNumber(), page.getPageSize(), page.getSearchName(), page.getSearchKeyword(), projectId, unionId, isSelected);
|
||||||
return NutMap.NEW().addv("list", list).addv("label", labelList);
|
return NutMap.NEW().addv("list", list).addv("label", labelList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("void")
|
@Ok("void")
|
||||||
@RequiresPermissions("welfare.project.statistics.single")
|
@RequiresPermissions("healthCheckup.statisticsSingle")
|
||||||
public void exportReceiveDetail(@Param(value = "projectId", required = false) String projectId,
|
public void exportReceiveDetail(@Param(value = "projectId", required = false) String projectId,
|
||||||
@Param(value = "unionId", required = false) String unionId,
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
@Param(value = "year",required = false) Integer year,
|
@Param(value = "year", required = false) Integer year,
|
||||||
boolean flag,HttpServletResponse response){
|
boolean flag, HttpServletResponse response) {
|
||||||
|
|
||||||
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
||||||
add(new ExcelExportEntity("职工号", "loginName", 20));
|
add(new ExcelExportEntity("职工号", "loginName", 20));
|
||||||
add(new ExcelExportEntity("姓名", "userName", 20));
|
add(new ExcelExportEntity("姓名", "userName", 20));
|
||||||
add(new ExcelExportEntity("部门", "unitName", 20));
|
|
||||||
add(new ExcelExportEntity("性别", "sex", 20));
|
add(new ExcelExportEntity("性别", "sex", 20));
|
||||||
|
add(new ExcelExportEntity("出生年月", "birthday", 20));
|
||||||
add(new ExcelExportEntity("年龄", "age", 20));
|
add(new ExcelExportEntity("年龄", "age", 20));
|
||||||
|
add(new ExcelExportEntity("婚姻状况", "marriage", 20));
|
||||||
|
add(new ExcelExportEntity("证件号", "idCard", 20));
|
||||||
|
add(new ExcelExportEntity("部门", "unitName", 20));
|
||||||
|
add(new ExcelExportEntity("部门编码", "unitCode", 20));
|
||||||
add(new ExcelExportEntity("自选项目", "subjectName", 20));
|
add(new ExcelExportEntity("自选项目", "subjectName", 20));
|
||||||
add(new ExcelExportEntity("自选院区", "campusName", 50));
|
add(new ExcelExportEntity("自选院区", "campusName", 50));
|
||||||
}};
|
}};
|
||||||
@@ -115,31 +120,24 @@ public class HealthCheckupSingleController {
|
|||||||
//获取当前年
|
//获取当前年
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
int thisYear = calendar.get(Calendar.YEAR);
|
int thisYear = calendar.get(Calendar.YEAR);
|
||||||
list.forEach(v->{
|
list.forEach(v -> {
|
||||||
int substring = 0;
|
int substring = 0;
|
||||||
if (Strings.isNotBlank(v.getString("birthday"))){
|
if (Strings.isNotBlank(v.getString("birthday"))) {
|
||||||
substring=Integer.parseInt(v.getString("birthday").substring(0,4));
|
substring = Integer.parseInt(v.getString("birthday").substring(0, 4));
|
||||||
}else if (Strings.isNotBlank(v.getString("idCard"))){
|
} else if (Strings.isNotBlank(v.getString("idCard")) && v.getString("idCard").length() >= 10) {
|
||||||
substring=Integer.parseInt(v.getString("idCard").substring(6,10));
|
substring = Integer.parseInt(v.getString("idCard").substring(6, 10));
|
||||||
}
|
}
|
||||||
v.put("age",thisYear-substring);
|
v.put("age", thisYear - substring);
|
||||||
});
|
});
|
||||||
|
|
||||||
List<NutMap> list2 = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionName"))).collect(Collectors.toList());
|
List<NutMap> list2 = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionName"))).collect(Collectors.toList());
|
||||||
Map<String, List<NutMap>> userListMap = list2.stream().collect(Collectors.groupingBy(v -> v.getString("unionName")));
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
Workbook workbook = new XSSFWorkbook();
|
exportParams.setSheetName(year + "年教职工体检项目及地点统计表");
|
||||||
userListMap.forEach((k, v) -> {
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list2);
|
||||||
ExcelExportService service = new ExcelExportService();
|
|
||||||
ExportParams exportParams = new ExportParams();
|
|
||||||
exportParams.setTitle(year+"年教职工体检项目及地点"+k.replaceAll("/", "、")+"统计表");
|
|
||||||
exportParams.setSheetName(k.replaceAll("/", "、"));
|
|
||||||
exportParams.setType(ExcelType.XSSF);
|
|
||||||
service.createSheetForMap(workbook, exportParams, entityList, v);
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ViTool.excelResponse(response, (flag ? year+"年教职工体检项目及地点统计表" : "未选名单") + ".xlsx");
|
ViTool.excelResponse(response, (flag ? year + "年教职工体检项目及地点统计表" : "未选名单") + ".xlsx");
|
||||||
ServletOutputStream outputStream = response.getOutputStream();
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
workbook.write(outputStream);
|
workbook.write(outputStream);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
@@ -151,10 +149,10 @@ public class HealthCheckupSingleController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("void")
|
@Ok("void")
|
||||||
@RequiresPermissions("welfare.project.statistics.single")
|
@RequiresPermissions("healthCheckup.statisticsSingle")
|
||||||
public void exportUserCompanion(@Param(value = "projectId", required = false) String projectId,
|
public void exportUserCompanion(@Param(value = "projectId", required = false) String projectId,
|
||||||
@Param(value = "unionId", required = false) String unionId,
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
@Param(value = "year",required = false) Integer year, HttpServletResponse response){
|
@Param(value = "year", required = false) Integer year, HttpServletResponse response) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
u.username,
|
u.username,
|
||||||
@@ -163,18 +161,30 @@ public class HealthCheckupSingleController {
|
|||||||
hcuc.userName familyName,
|
hcuc.userName familyName,
|
||||||
hcuc.sex,
|
hcuc.sex,
|
||||||
hcuc.marry isMarried,
|
hcuc.marry isMarried,
|
||||||
hcuc.idCard
|
hcuc.idCard,
|
||||||
|
hcc.campusName,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
GROUP_CONCAT( hcps.optionName )
|
||||||
|
FROM
|
||||||
|
health_checkup_user_selection hcus
|
||||||
|
LEFT JOIN `health_checkup_project_subject` hcps ON hcps.id = hcus.subjectId
|
||||||
|
WHERE
|
||||||
|
hcus.projectId = @projectId
|
||||||
|
AND hcus.selectUserId = u.id
|
||||||
|
) optionName
|
||||||
FROM
|
FROM
|
||||||
`health_checkup_user_companion` hcuc
|
`health_checkup_user_companion` hcuc
|
||||||
LEFT JOIN `health_checkup_user_selection` hcus ON hcus.id = hcuc.userSelectionId
|
LEFT JOIN `health_checkup_user_selection` hcus ON hcus.id = hcuc.userSelectionId
|
||||||
|
LEFT JOIN `health_checkup_campus` hcc ON hcc.id = hcus.campus
|
||||||
LEFT JOIN `user` u ON u.id = hcus.selectUserId
|
LEFT JOIN `user` u ON u.id = hcus.selectUserId
|
||||||
LEFT JOIN `health_checkup_project` hcp ON hcp.id = hcus.projectId
|
LEFT JOIN `health_checkup_project` hcp ON hcp.id = hcus.projectId
|
||||||
$condition
|
$condition
|
||||||
""");
|
""").setParam("projectId", projectId);
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
cnd.andEX("hcus.projectId","=",projectId);
|
cnd.andEX("hcus.projectId", "=", projectId);
|
||||||
cnd.andEX("u.unionid","=",unionId);
|
cnd.andEX("u.unionid", "=", unionId);
|
||||||
cnd.andEX("hcp.year","=",year);
|
cnd.andEX("hcp.year", "=", year);
|
||||||
cnd.asc("u.unioncode");
|
cnd.asc("u.unioncode");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
//家属信息表
|
//家属信息表
|
||||||
@@ -184,7 +194,7 @@ public class HealthCheckupSingleController {
|
|||||||
companionList.get(i).put("index", i + 1);
|
companionList.get(i).put("index", i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExcelExportEntity> entityList = new ArrayList<>(){{
|
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
||||||
add(new ExcelExportEntity("序号", "index", 20));
|
add(new ExcelExportEntity("序号", "index", 20));
|
||||||
add(new ExcelExportEntity("教职工姓名", "username", 20));
|
add(new ExcelExportEntity("教职工姓名", "username", 20));
|
||||||
add(new ExcelExportEntity("学院(部门)", "unitName", 20));
|
add(new ExcelExportEntity("学院(部门)", "unitName", 20));
|
||||||
@@ -193,20 +203,77 @@ public class HealthCheckupSingleController {
|
|||||||
add(new ExcelExportEntity("性别", "sex", 20));
|
add(new ExcelExportEntity("性别", "sex", 20));
|
||||||
add(new ExcelExportEntity("婚否", "isMarried", 20));
|
add(new ExcelExportEntity("婚否", "isMarried", 20));
|
||||||
add(new ExcelExportEntity("体检人身份证号", "idCard", 50));
|
add(new ExcelExportEntity("体检人身份证号", "idCard", 50));
|
||||||
|
add(new ExcelExportEntity("自选项目", "optionName", 50));
|
||||||
|
add(new ExcelExportEntity("自选院区", "campusName", 50));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ViTool.excelResponse(response, year + "教职工家属体检登记表.xlsx");
|
ViTool.excelResponse(response, year + "教职工家属体检登记表.xlsx");
|
||||||
ExportParams exportParams = new ExportParams();
|
ExportParams exportParams = new ExportParams();
|
||||||
exportParams.setType(ExcelType.XSSF);
|
exportParams.setType(ExcelType.XSSF);
|
||||||
exportParams.setTitle(year+"教职工家属体检登记表");
|
exportParams.setTitle(year + "教职工家属体检登记表");
|
||||||
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, companionList);
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, companionList);
|
||||||
ServletOutputStream outputStream = response.getOutputStream();
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
workbook.write(outputStream);
|
workbook.write(outputStream);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@Ok("json:full")
|
||||||
|
@RequiresPermissions("healthCheckup.statisticsSingle")
|
||||||
|
public Object doSelectByAdmin(String projectId, String optionId, String campus) {
|
||||||
|
Dao dao = healthCheckupSingleService.dao();
|
||||||
|
HealthCheckupProject project = dao.fetch(HealthCheckupProject.class, projectId);
|
||||||
|
HealthCheckupProjectSubject subject = dao.fetch(HealthCheckupProjectSubject.class, optionId);
|
||||||
|
if (Strings.isNotBlank(subject.getConditionStructureId())) {
|
||||||
|
MatchConditionStructure conditionStructure = dao.fetchLinks(dao.fetch(MatchConditionStructure.class, subject.getConditionStructureId()), "conditions");
|
||||||
|
subject.setMatchCnd(conditionStructure);
|
||||||
|
}
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
u.id,
|
||||||
|
u.loginname loginName,
|
||||||
|
u.username userName,
|
||||||
|
u.sex,
|
||||||
|
u.birthday,
|
||||||
|
u.unitname unitName,
|
||||||
|
u.unionname unionName,
|
||||||
|
u.idcard idCard,
|
||||||
|
u.mobile
|
||||||
|
FROM
|
||||||
|
`activity_user_scope` aus
|
||||||
|
LEFT JOIN `user` u ON u.id = aus.userId
|
||||||
|
$projectCnd $condition
|
||||||
|
""");
|
||||||
|
if (subject.getMatchCnd() != null) {
|
||||||
|
subject.getMatchCnd().join(cnd);
|
||||||
|
}
|
||||||
|
cnd.and("aus.groupId", "=", project.getActivityGroupId());
|
||||||
|
sql.setVar("projectCnd", "AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
||||||
|
cnd.asc("u.unioncode");
|
||||||
|
cnd.desc("u.threeUnitName");
|
||||||
|
cnd.groupBy("u.loginname");
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
List<NutMap> mapList = healthCheckupSingleService.listMap(sql);
|
||||||
|
|
||||||
|
List<String> userIds = mapList.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||||
|
//题目id
|
||||||
|
List<HealthCheckupUserSelection> selections = userIds.stream().map(v -> {
|
||||||
|
HealthCheckupUserSelection selection = new HealthCheckupUserSelection();
|
||||||
|
selection.setProjectId(projectId);
|
||||||
|
selection.setSelectUserId(v);
|
||||||
|
selection.setCampus(campus);
|
||||||
|
selection.setSubjectId(optionId);
|
||||||
|
return selection;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
healthCheckupSingleService.insert(selections);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,8 +1,8 @@
|
|||||||
package io.v.nutz.zhgh.healthCheckup.controller.HealthMange;
|
package io.v.nutz.zhgh.healthCheckup.controller.HealthMange;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.service.BaseService;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
|
import io.v.nutz.base.service.BaseService;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ public class HealthCheckupProject {
|
|||||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("体检对象类型")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||||
|
private String healthCheckupType;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("选择开始时间")
|
@Comment("选择开始时间")
|
||||||
@ColDefine(type = ColType.DATETIME)
|
@ColDefine(type = ColType.DATETIME)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package io.v.nutz.zhgh.healthCheckup.service;
|
package io.v.nutz.zhgh.healthCheckup.service;
|
||||||
|
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
|
||||||
import io.v.nutz.base.service.ViService;
|
import io.v.nutz.base.service.ViService;
|
||||||
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
|
|
||||||
public interface HealthCheckupProjectService extends ViService<HealthCheckupProject> {
|
public interface HealthCheckupProjectService extends ViService<HealthCheckupProject> {
|
||||||
|
|||||||
+23
-8
@@ -1,5 +1,7 @@
|
|||||||
package io.v.nutz.zhgh.healthCheckup.service.impl;
|
package io.v.nutz.zhgh.healthCheckup.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||||
import io.v.nutz.zhgh.data.constant.ConditionalOperational;
|
import io.v.nutz.zhgh.data.constant.ConditionalOperational;
|
||||||
import io.v.nutz.zhgh.data.constant.MatchMethod;
|
import io.v.nutz.zhgh.data.constant.MatchMethod;
|
||||||
import io.v.nutz.zhgh.data.model.MatchCondition;
|
import io.v.nutz.zhgh.data.model.MatchCondition;
|
||||||
@@ -7,7 +9,6 @@ import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
|||||||
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||||
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
||||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -15,12 +16,14 @@ import org.nutz.dao.Dao;
|
|||||||
import org.nutz.dao.entity.annotation.Comment;
|
import org.nutz.dao.entity.annotation.Comment;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.Mirror;
|
import org.nutz.lang.Mirror;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,12 +45,15 @@ public class HealthCheckupProjectServiceImpl extends ViServiceImpl<HealthCheckup
|
|||||||
@Override
|
@Override
|
||||||
public HealthCheckupProject findOne(String id) {
|
public HealthCheckupProject findOne(String id) {
|
||||||
HealthCheckupProject project = fetchLinks(fetch(id), "healthCheckupProjectSubjects", Cnd.NEW().asc("optionSort"));
|
HealthCheckupProject project = fetchLinks(fetch(id), "healthCheckupProjectSubjects", Cnd.NEW().asc("optionSort"));
|
||||||
project.getHealthCheckupProjectSubjects().forEach(v -> {
|
if (Lang.isNotEmpty(project)) {
|
||||||
if (Strings.isNotBlank(v.getConditionStructureId())) {
|
project.getHealthCheckupProjectSubjects().forEach(v -> {
|
||||||
MatchConditionStructure conditionStructure = fetchLinks(dao().fetch(MatchConditionStructure.class, v.getConditionStructureId()), "conditions");
|
if (Strings.isNotBlank(v.getConditionStructureId())) {
|
||||||
v.setMatchCnd(conditionStructure);
|
MatchConditionStructure conditionStructure = fetchLinks(dao().fetch(MatchConditionStructure.class, v.getConditionStructureId()), "conditions");
|
||||||
}
|
v.setMatchCnd(conditionStructure);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +78,18 @@ public class HealthCheckupProjectServiceImpl extends ViServiceImpl<HealthCheckup
|
|||||||
Comment annotation = field.getAnnotation(Comment.class);
|
Comment annotation = field.getAnnotation(Comment.class);
|
||||||
String fieldChineseName = annotation.value();
|
String fieldChineseName = annotation.value();
|
||||||
ConditionalOperational operational = c.getOperational();
|
ConditionalOperational operational = c.getOperational();
|
||||||
|
String value = operational.getValue();
|
||||||
String description = operational.getDescription();
|
String description = operational.getDescription();
|
||||||
sbf.append(fieldChineseName + description + c.getValue() + "\n");
|
sbf.append(fieldChineseName + description + c.getValue() + "\n");
|
||||||
cndResultList.add(ShiroUtil.getPrincipalProperty(fieldName).equals(c.getValue()));
|
if (value.equals("=")) {
|
||||||
|
cndResultList.add(ShiroUtil.getPrincipalProperty(fieldName).equals(c.getValue()));
|
||||||
|
} else if (operational.getValue().equals("<=") && fieldName.equals("birthday")) {
|
||||||
|
Date date1 = DateUtil.parse(ShiroUtil.getPrincipalProperty(fieldName).toString(), "yyyy-MM");
|
||||||
|
Date date2 = DateUtil.parse(c.getValue());
|
||||||
|
int compareResult = DateUtil.compare(date1, date2);
|
||||||
|
System.out.println();
|
||||||
|
cndResultList.add(compareResult < 0);
|
||||||
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -246,6 +246,8 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
|
|||||||
u.sex,
|
u.sex,
|
||||||
u.birthday,
|
u.birthday,
|
||||||
u.unitname AS unitName,
|
u.unitname AS unitName,
|
||||||
|
u.unitcode AS unitCode,
|
||||||
|
u.marriage,
|
||||||
u.threeUnitName AS threeUnitName,
|
u.threeUnitName AS threeUnitName,
|
||||||
u.unionname AS unionName,
|
u.unionname AS unionName,
|
||||||
u.idcard AS idCard,
|
u.idcard AS idCard,
|
||||||
@@ -257,7 +259,7 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
|
|||||||
SELECT
|
SELECT
|
||||||
GROUP_CONCAT( hcps.optionName )
|
GROUP_CONCAT( hcps.optionName )
|
||||||
FROM
|
FROM
|
||||||
welfare_project_user_selection hcus
|
health_checkup_user_selection hcus
|
||||||
LEFT JOIN `health_checkup_project_subject` hcps ON hcps.id = hcus.subjectId
|
LEFT JOIN `health_checkup_project_subject` hcps ON hcps.id = hcus.subjectId
|
||||||
WHERE
|
WHERE
|
||||||
hcus.projectId = @projectId
|
hcus.projectId = @projectId
|
||||||
@@ -282,6 +284,7 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
|
|||||||
u.sex,
|
u.sex,
|
||||||
u.birthday,
|
u.birthday,
|
||||||
u.unitname unitName,
|
u.unitname unitName,
|
||||||
|
u.unitCode unitCode,
|
||||||
u.unionname unionName,
|
u.unionname unionName,
|
||||||
u.idcard idCard,
|
u.idcard idCard,
|
||||||
u.mobile
|
u.mobile
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.cxtj;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import cn.wizzer.framework.base.service.BaseService;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@IocBean
|
|
||||||
@At("/platform/jsz/cxtj/union")
|
|
||||||
@Ok("json:full")
|
|
||||||
public class JszUniontjController {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BaseService baseService;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("re")
|
|
||||||
public String index(){
|
|
||||||
return "beetl:/platform/jsz/cxtj/hdunion.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
public Object getAllUnion(){
|
|
||||||
return Result.success().addData(baseService.dao().query("sys_union", Cnd.NEW()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
|
|
||||||
@Param(value = "pageSize",required = false) Integer pageSize,
|
|
||||||
@Param("hdid") String hdid){
|
|
||||||
//hdid="65825b355f562cf500f37a2667b36e3c";
|
|
||||||
Map<String,Object> reqBody = new HashMap<String,Object>();
|
|
||||||
reqBody.put("activity_id", hdid);
|
|
||||||
reqBody.put("schoolCode", Globals.schoolCode);
|
|
||||||
try {
|
|
||||||
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getBmInfo", reqBody);
|
|
||||||
NutMap resp_data = result.getAs("resp_data", NutMap.class);
|
|
||||||
return Result.success().addData(resp_data);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.cxtj;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
|
|
||||||
@IocBean
|
|
||||||
@At("/platform/jsz/cxtj/phbtj")
|
|
||||||
@Ok("json:full")
|
|
||||||
public class JszptphbController {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("re")
|
|
||||||
@RequiresPermissions("jsz.cxtj.phbtj")
|
|
||||||
public String index(){
|
|
||||||
return "beetl:/platform/jsz/cxtj/phb.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@RequiresPermissions("jsz.cxtj.phbtj")
|
|
||||||
public Object data(){
|
|
||||||
try {
|
|
||||||
NutMap rankAll = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "rankAll", NutMap.NEW().addv("schoolCode", Globals.schoolCode));
|
|
||||||
return Result.success().addData(rankAll);
|
|
||||||
// List<NutMap> yearlist = yearMap.getAs("resp_data", NutMap.class).getAs("data", NutMap.class).getAsList("list", NutMap.class);
|
|
||||||
// return Result.success().addData(NutMap.NEW().addv("daylist",daylist).addv("weeklist",weeklist)
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.cxtj;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author JyuHsin
|
|
||||||
* @Date 2022/9/7
|
|
||||||
* @Description 排行榜
|
|
||||||
*/
|
|
||||||
@At("/jsz/leaderboard")
|
|
||||||
@Ok("json:full")
|
|
||||||
@IocBean
|
|
||||||
public class LeaderboardController {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private JszWxStepService jszWxStepService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("re")
|
|
||||||
@RequiresPermissions("jsz.cxtj.leaderboard")
|
|
||||||
public String index() {
|
|
||||||
return "beetl:/platform/jsz/cxtj/leaderboard.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取排行榜数据
|
|
||||||
*
|
|
||||||
* @param hdid: 活动id
|
|
||||||
* @param type: 0-当日榜 1-累计排行榜 2-当日中奖榜
|
|
||||||
* @return java.lang.Object
|
|
||||||
* @author JyuHsin
|
|
||||||
* @date 2022/9/7
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.cxtj.leaderboard")
|
|
||||||
public Object getData(@Param(value = "hdid",required = false) String hdid,
|
|
||||||
@Param(value = "type",required = false) Integer type,
|
|
||||||
@Param(value = "userId",required = false) String userId) {
|
|
||||||
if (type == null) {
|
|
||||||
return Result.error("参数错误");
|
|
||||||
}
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
return jszWxStepService.getDataOfLeaderboard(hdid, type, userId, "", "", "", "");
|
|
||||||
case 2:
|
|
||||||
return jszWxStepService.getDataOfPrize(hdid, "", "", "", "");
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.cxtj.leaderboard")
|
|
||||||
public Object pageData(@Param(value = "hdid",required = false) String hdid,
|
|
||||||
@Param(value = "searchName",required = false) String searchName,
|
|
||||||
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
|
||||||
@Param(value = "unionId",required = false) String unionId,
|
|
||||||
@Param(value = "unitId",required = false) String unitId) {
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(hdid)) {
|
|
||||||
return Result.error("参数错误!");
|
|
||||||
}
|
|
||||||
|
|
||||||
String userId = ShiroUtil.getPrincipalProperty("id").toString();
|
|
||||||
Object today = jszWxStepService.getDataOfLeaderboard(hdid, 0, userId, unionId, unitId, searchName, searchKeyword);
|
|
||||||
Object summary = jszWxStepService.getDataOfLeaderboard(hdid, 1, userId, unionId, unitId, searchName, searchKeyword);
|
|
||||||
Object yesterday = jszWxStepService.getDataOfPrize(hdid, unionId, unitId, searchName, searchKeyword);
|
|
||||||
|
|
||||||
NutMap map = NutMap.NEW();
|
|
||||||
map.put("today", Map.of("list", today));
|
|
||||||
map.put("summary", Map.of("list", summary));
|
|
||||||
map.put("yesterday", Map.of("list", yesterday));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,739 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.cxtj;
|
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.service.BaseService;
|
|
||||||
import cn.wizzer.framework.page.Pagination;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.sys.models.Sys_union;
|
|
||||||
import io.v.nutz.sys.services.SysUnionService;
|
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.json.Json;
|
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static java.util.Comparator.comparing;
|
|
||||||
import static java.util.stream.Collectors.collectingAndThen;
|
|
||||||
import static java.util.stream.Collectors.toCollection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/19 14:55
|
|
||||||
* @Description: 工会报名参与信息
|
|
||||||
*/
|
|
||||||
@At("/platform/jsz/union/registerInfo")
|
|
||||||
@Ok("json:full")
|
|
||||||
@IocBean
|
|
||||||
@RequiresAuthentication
|
|
||||||
public class UnionRegisterInfoCon {
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/cxtj/unionRegisterInfo.html")
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SysUnionService sysUnionService;
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public Object getData(String activity_id, @Param("activity_tag[]") String[] activity_tag) throws IOException {
|
|
||||||
return data(activity_id, activity_tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List data(String activity_id, String[] activity_tag) throws IOException {
|
|
||||||
List<Sys_union> unions = sysUnionService.query();
|
|
||||||
Map<String, Object> reqBody = new HashMap<>();
|
|
||||||
reqBody.put("unions", unions);
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
reqBody.put("activity_tag", activity_tag);
|
|
||||||
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getRegisterInfo", reqBody);
|
|
||||||
List resp_data = result.getAs("resp_data", List.class);
|
|
||||||
return resp_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void exportAllUnionData(String activity_id, String activity_name, String activity_tag, HttpServletResponse response) throws IOException {
|
|
||||||
try {
|
|
||||||
response.setContentType("application/octet-stream");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity_name + "院级工会报名统计表.xls").getBytes("utf-8"), "ISO8859-1"));
|
|
||||||
|
|
||||||
ArrayList<E> list = new ArrayList<>();
|
|
||||||
List data = data(activity_id, activity_tag.split(","));
|
|
||||||
data.forEach(val -> {
|
|
||||||
Map v = (Map) val;
|
|
||||||
E e = new E();
|
|
||||||
e.setName((String) v.get("unionname"));
|
|
||||||
e.setReg_num((Integer) v.get("reg_num"));
|
|
||||||
e.setSign_num((Integer) v.get("sign_num"));
|
|
||||||
list.add(e);
|
|
||||||
});
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), E.class, list);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void regExport(String activity_id, String activity_tag, String unionname, String unionid, HttpServletResponse response) throws IOException {
|
|
||||||
response.setContentType("application/octet-stream");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((unionname + "报名名单.xls").getBytes("utf-8"), "ISO8859-1"));
|
|
||||||
|
|
||||||
Map<String, Object> reqBody = new HashMap<String, Object>();
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
|
|
||||||
reqBody.put("unionid", unionid);
|
|
||||||
|
|
||||||
|
|
||||||
// NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getRegisterUsers", reqBody);
|
|
||||||
// List data = result.getAs("resp_data", List.class);
|
|
||||||
|
|
||||||
Integer pageSize = 20;
|
|
||||||
Integer pageNum = 1;
|
|
||||||
List<Map> allRegister = new ArrayList<>();
|
|
||||||
List<Map> oneData = getAllRegister(unionid, activity_id, activity_tag, pageNum, pageSize);
|
|
||||||
while (oneData.size() > 0) {
|
|
||||||
allRegister.addAll(oneData);
|
|
||||||
pageNum++;
|
|
||||||
oneData = getAllRegister(unionid, activity_id, activity_tag, pageNum, pageSize);
|
|
||||||
}
|
|
||||||
System.out.println(allRegister);
|
|
||||||
|
|
||||||
ArrayList<RegE> list = new ArrayList<>();
|
|
||||||
allRegister.forEach(v -> {
|
|
||||||
RegE e = new RegE();
|
|
||||||
e.setActivity_name(StrUtil.isBlank((String) v.get("activity_tag")) ? (String) v.get("activity_name") : v.get("activity_tag") + "-" + v.get("activity_name"));
|
|
||||||
e.setLoginname((String) v.get("loginname"));
|
|
||||||
e.setUsername((String) v.get("username"));
|
|
||||||
e.setSex((String) v.get("sex"));
|
|
||||||
e.setUnitname((String) v.get("unitname"));
|
|
||||||
list.add(e);
|
|
||||||
});
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegE.class, list);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
|
|
||||||
// ArrayList<RegE> list = new ArrayList<>();
|
|
||||||
// data.forEach(val -> {
|
|
||||||
// Map v = (Map) val;
|
|
||||||
// RegE e = new RegE();
|
|
||||||
// e.setActivity_name((String) v.get("activity_name"));
|
|
||||||
// e.setLoginname((String) v.get("loginname"));
|
|
||||||
// e.setUsername((String) v.get("username"));
|
|
||||||
// e.setSex((String) v.get("sex"));
|
|
||||||
// e.setUnitname((String) v.get("unitname"));
|
|
||||||
// list.add(e);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegE.class, list);
|
|
||||||
// workbook.write(response.getOutputStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<Map> getAllRegister(String unionid, String activity_id, String activity_tag, Integer pageNumber, Integer pageSize) throws IOException {
|
|
||||||
String s = String.format(
|
|
||||||
"""
|
|
||||||
db.collection('register')
|
|
||||||
.aggregate()
|
|
||||||
.lookup({
|
|
||||||
from: 'activity',
|
|
||||||
localField: 'activity_id',
|
|
||||||
foreignField: '_id',
|
|
||||||
as: 'activity'
|
|
||||||
})
|
|
||||||
.addFields({
|
|
||||||
activity_name: $.arrayElemAt(['$activity.name',0]),
|
|
||||||
activity_tag: $.arrayElemAt(['$activity.tag',0])
|
|
||||||
})
|
|
||||||
.match({
|
|
||||||
unionid:'%s',
|
|
||||||
'activity._id':_.in(%s)
|
|
||||||
}).project({
|
|
||||||
loginname: true,
|
|
||||||
sex: true,
|
|
||||||
username: true,
|
|
||||||
unionname: true,
|
|
||||||
unionid: true,
|
|
||||||
unitname: true,
|
|
||||||
unitid: true,
|
|
||||||
mobile: true,
|
|
||||||
register_time: true,
|
|
||||||
activity_name: true,
|
|
||||||
activity_tag:true
|
|
||||||
}).sort({ 'unitid': 1, 'register_time': -1 }).skip(%d).limit(%d).end()
|
|
||||||
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag)), (pageNumber - 1) * pageSize, pageSize
|
|
||||||
);
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
|
|
||||||
List<Map> data = result.getList("data", Map.class);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void signExport(String activity_id, String activity_tag, String unionname, String unionid, HttpServletResponse response) throws IOException {
|
|
||||||
response.setContentType("application/octet-stream");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((unionname + "参与名单.xlsx").getBytes("utf-8"), "ISO8859-1"));
|
|
||||||
|
|
||||||
Map<String, Object> reqBody = new HashMap<String, Object>();
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
|
|
||||||
reqBody.put("unionid", unionid);
|
|
||||||
|
|
||||||
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUsers", reqBody);
|
|
||||||
List<NutMap> data = result.getAs("resp_data", List.class);
|
|
||||||
|
|
||||||
ArrayList<SignE> list = new ArrayList<>();
|
|
||||||
for (NutMap v : data) {
|
|
||||||
SignE e = new SignE();
|
|
||||||
// e.setActivity_name((String) v.get("activity_name"));
|
|
||||||
e.setLoginname((String) v.get("loginname"));
|
|
||||||
e.setUsername((String) v.get("username"));
|
|
||||||
e.setSex((String) v.get("sex"));
|
|
||||||
e.setMobile((String) v.get("mobile"));
|
|
||||||
e.setUnitname((String) v.get("unitname"));
|
|
||||||
e.setSignnum(v.getInt("sign_size"));
|
|
||||||
list.add(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ExportParams exportParams = new ExportParams();
|
|
||||||
exportParams.setType(ExcelType.XSSF);
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SignE.class, list);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class RegE implements Serializable {
|
|
||||||
@Excel(name = "活动", width = 40.0D)
|
|
||||||
private String activity_name;
|
|
||||||
|
|
||||||
public String getActivity_name() {
|
|
||||||
return activity_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivity_name(String activity_name) {
|
|
||||||
this.activity_name = activity_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Excel(name = "工号", width = 20.0D)
|
|
||||||
private String loginname;
|
|
||||||
|
|
||||||
@Excel(name = "姓名", width = 20.0D)
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Excel(name = "性别", width = 20.0D)
|
|
||||||
private String sex;
|
|
||||||
|
|
||||||
@Excel(name = "电话", width = 20.0D)
|
|
||||||
private String mobile;
|
|
||||||
|
|
||||||
@Excel(name = "单位", width = 60.0D)
|
|
||||||
private String unitname;
|
|
||||||
|
|
||||||
public String getLoginname() {
|
|
||||||
return loginname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoginname(String loginname) {
|
|
||||||
this.loginname = loginname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSex() {
|
|
||||||
return sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSex(String sex) {
|
|
||||||
this.sex = sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnitname() {
|
|
||||||
return unitname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnitname(String unitname) {
|
|
||||||
this.unitname = unitname;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class SignE implements Serializable {
|
|
||||||
|
|
||||||
@Excel(name = "工号", width = 20.0D)
|
|
||||||
private String loginname;
|
|
||||||
|
|
||||||
@Excel(name = "姓名", width = 20.0D)
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Excel(name = "性别", width = 20.0D)
|
|
||||||
private String sex;
|
|
||||||
|
|
||||||
@Excel(name = "电话", width = 20.0D)
|
|
||||||
private String mobile;
|
|
||||||
|
|
||||||
@Excel(name = "单位", width = 60.0D)
|
|
||||||
private String unitname;
|
|
||||||
|
|
||||||
@Excel(name = "工会", width = 60.0D)
|
|
||||||
private String unionname;
|
|
||||||
|
|
||||||
@Excel(name = "签到点位数", width = 20.0D)
|
|
||||||
private Integer signnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class E implements Serializable {
|
|
||||||
@Excel(name = "院级工会", width = 60.0D)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Excel(name = "报名人数", width = 20.0D)
|
|
||||||
private Integer reg_num;
|
|
||||||
|
|
||||||
@Excel(name = "参加人数", width = 20.0D)
|
|
||||||
private Integer sign_num;
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public Object getRegisterUser(String activity_id, @Param("activity_tag[]") String[] activity_tag, String unionid, Integer pageNumber, Integer pageSize) throws IOException {
|
|
||||||
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
|
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<>() {{
|
|
||||||
put("unionid", unionid);
|
|
||||||
}};
|
|
||||||
|
|
||||||
/*if (Strings.isNotBlank(activity_tag)) {
|
|
||||||
map.put("activity.tag", activity_tag);
|
|
||||||
}*/
|
|
||||||
if (Strings.isNotBlank(activity_id)) {
|
|
||||||
map.put("activity._id", activity_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
String match = Json.toJson(map);
|
|
||||||
|
|
||||||
String s = String.format(
|
|
||||||
"""
|
|
||||||
db.collection('register')
|
|
||||||
.aggregate()
|
|
||||||
.lookup({
|
|
||||||
from: 'activity',
|
|
||||||
localField: 'activity_id',
|
|
||||||
foreignField: '_id',
|
|
||||||
as: 'activity'
|
|
||||||
})
|
|
||||||
.addFields({
|
|
||||||
activity_name: $.arrayElemAt(['$activity.name',0]),
|
|
||||||
activity_tag: $.arrayElemAt(['$activity.tag',0])
|
|
||||||
})
|
|
||||||
.match({
|
|
||||||
unionid:'%s',
|
|
||||||
'activity._id':_.in(%s)
|
|
||||||
}).project({
|
|
||||||
loginname: true,
|
|
||||||
sex: true,
|
|
||||||
username: true,
|
|
||||||
unionname: true,
|
|
||||||
unionid: true,
|
|
||||||
unitname: true,
|
|
||||||
mobile: true,
|
|
||||||
unitid: true,
|
|
||||||
register_time: true,
|
|
||||||
activity_name: true,
|
|
||||||
activity_tag:true
|
|
||||||
}).sort({ 'unitid': 1, 'register_time': -1 }).skip(%d).limit(%d).end()
|
|
||||||
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag), skip, pageSize
|
|
||||||
);
|
|
||||||
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String count_s = String.format(
|
|
||||||
"""
|
|
||||||
db.collection('register').where(
|
|
||||||
{
|
|
||||||
unionid:'%s',
|
|
||||||
activity_id:_.in(%s)
|
|
||||||
}
|
|
||||||
).count()
|
|
||||||
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag)
|
|
||||||
);
|
|
||||||
NutMap countResult = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count_s);
|
|
||||||
|
|
||||||
return new Pagination(pageNumber, pageSize, countResult.getInt("count"), result.getList("data", Map.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public Object getSignUser(String activity_id, @Param("activity_tag[]") String[] activity_tag, String unionid, Integer pageNumber, Integer pageSize) throws IOException {
|
|
||||||
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
|
|
||||||
String s = """
|
|
||||||
db.collection('sign').aggregate().match({
|
|
||||||
activity_id: _.in(%s),
|
|
||||||
unionid:"%s"}).group({
|
|
||||||
_id: {
|
|
||||||
activity_id: '$activity_id',
|
|
||||||
loginname: '$loginname'
|
|
||||||
},
|
|
||||||
num: $.sum(1),
|
|
||||||
data: $.first('$$ROOT')
|
|
||||||
}).lookup({
|
|
||||||
from: 'activity',
|
|
||||||
localField: 'data.activity_id',
|
|
||||||
foreignField: '_id',
|
|
||||||
as: 'activity'
|
|
||||||
}).addFields({
|
|
||||||
activity: $.arrayElemAt(['$activity', 0])
|
|
||||||
}).project({
|
|
||||||
loginname: '$data.loginname',
|
|
||||||
sex: '$data.sex',
|
|
||||||
username: '$data.username',
|
|
||||||
unitname: '$data.unitname',
|
|
||||||
unionname: '$data.unionname',
|
|
||||||
pts_size: $.size('$activity.pts'),
|
|
||||||
sign_size: '$num'
|
|
||||||
}).skip(%d).limit(%d)
|
|
||||||
.end()
|
|
||||||
|
|
||||||
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag),
|
|
||||||
unionid, skip, pageSize);
|
|
||||||
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
|
|
||||||
|
|
||||||
|
|
||||||
String count_s = """
|
|
||||||
db.collection('sign').aggregate().match({
|
|
||||||
activity_id:_.in(%s),
|
|
||||||
unionid:'%s'
|
|
||||||
}).group({
|
|
||||||
_id:'$userid',
|
|
||||||
count: $.sum(1),
|
|
||||||
}).end()
|
|
||||||
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag),
|
|
||||||
unionid);
|
|
||||||
|
|
||||||
|
|
||||||
NutMap countResult = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, count_s);
|
|
||||||
|
|
||||||
return new Pagination(pageNumber, pageSize, countResult.getList("data", Map.class).size(), result.getList("data", Map.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
final Integer LIMIT = 1000;
|
|
||||||
|
|
||||||
@At
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void doGiftExport(String activity_id, String activity_tag, Boolean flag, HttpServletResponse response) throws IOException {
|
|
||||||
response.setContentType("application/octet-stream");
|
|
||||||
|
|
||||||
String fileName = flag ? "已领取礼品的用户" : "未领取礼品的用户";
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes("utf-8"), "ISO8859-1"));
|
|
||||||
|
|
||||||
Map<String, Object> reqBody = new HashMap<>();
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
|
|
||||||
String count = """
|
|
||||||
db.collection('gift_voucher').where({activity_id: _.in(%s),used:%b}).count()
|
|
||||||
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))),
|
|
||||||
flag);
|
|
||||||
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
|
|
||||||
|
|
||||||
int count1 = wxResultCount.getInt("count");
|
|
||||||
|
|
||||||
List<Map> list2 = new ArrayList<>();
|
|
||||||
|
|
||||||
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
|
|
||||||
|
|
||||||
for (int i = 0; i < ceil; i++) {
|
|
||||||
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
|
|
||||||
String query = """
|
|
||||||
db.collection('gift_voucher')
|
|
||||||
.where({
|
|
||||||
activity_id: _.in(%s),
|
|
||||||
used: %s
|
|
||||||
})
|
|
||||||
.orderBy('use_time', 'desc')
|
|
||||||
.skip(%s)
|
|
||||||
.limit(%s)
|
|
||||||
.get()
|
|
||||||
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
|
|
||||||
, flag, i * LIMIT, num);
|
|
||||||
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> data = wxResult.getList("data", Map.class);
|
|
||||||
list2.addAll(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<giftE> giftEList = list2.stream().map(v -> {
|
|
||||||
giftE e = new giftE();
|
|
||||||
e.set_openid((String) v.get("_openid"));
|
|
||||||
e.setLoginname((String) v.get("loginname"));
|
|
||||||
e.setUsername((String) v.get("username"));
|
|
||||||
e.setUnitname((String) v.get("unitname"));
|
|
||||||
e.setUnionname((String) v.get("unionname"));
|
|
||||||
return e;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
ArrayList<giftE> collect = giftEList.stream().collect(
|
|
||||||
collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
|
|
||||||
ArrayList::new));
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), giftE.class, collect);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void doExportSummary(String activity_id, String activity_tag, HttpServletResponse response) throws Exception {
|
|
||||||
|
|
||||||
NutMap cloudResult = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "findActivityInfo", Map.of("activity_id", activity_id, "activity_tag", Json.fromJsonAsArray(String.class, activity_tag)));
|
|
||||||
NutMap resp_data = cloudResult.getAs("resp_data", NutMap.class);
|
|
||||||
List<NutMap> pts = resp_data.getList("pts", NutMap.class);
|
|
||||||
int ptsLength = pts.size();
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> reqBody = new HashMap<>();
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
|
|
||||||
String count = """
|
|
||||||
db.collection('register').where({activity_id: _.in(%s)}).count()
|
|
||||||
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))));
|
|
||||||
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
|
|
||||||
int count1 = wxResultCount.getInt("count");
|
|
||||||
|
|
||||||
List<NutMap> list2 = new ArrayList<>();
|
|
||||||
|
|
||||||
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
|
|
||||||
for (int i = 0; i < ceil; i++) {
|
|
||||||
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
|
|
||||||
String query = """
|
|
||||||
db.collection('register')
|
|
||||||
.where({
|
|
||||||
activity_id: _.in(%s)
|
|
||||||
})
|
|
||||||
.orderBy('unitid', 'desc')
|
|
||||||
.skip(%s)
|
|
||||||
.limit(%s)
|
|
||||||
.get()
|
|
||||||
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
|
|
||||||
, i * LIMIT, num);
|
|
||||||
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<NutMap> data = wxResult.getList("data", NutMap.class);
|
|
||||||
list2.addAll(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> signReqBody = new HashMap<String, Object>();
|
|
||||||
signReqBody.put("activity_id", activity_id);
|
|
||||||
signReqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
|
|
||||||
//签到数据
|
|
||||||
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUserAll", signReqBody);
|
|
||||||
List<NutMap> signData = result.getAs("resp_data", List.class);
|
|
||||||
for (NutMap val : signData) {
|
|
||||||
NutMap v = val.getAs("data", NutMap.class);
|
|
||||||
val.setv("loginname", v.getString("loginname"));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ExcelExportEntity> excelExportEntities = new ArrayList<>();
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("电话", "mobile", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("工会", "unionname", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("单位", "unitname", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("是否参加", "isTakePartIn", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("签到点位数", "signNum", 20));
|
|
||||||
|
|
||||||
for (NutMap nutMap : list2) {
|
|
||||||
String loginname = nutMap.getString("loginname");
|
|
||||||
Optional<NutMap> signDataMap = signData.stream().filter(v -> StrUtil.isNotBlank(v.getString("loginname")) && v.getString("loginname").equals(loginname)).findFirst();
|
|
||||||
if (signDataMap.isPresent()) {
|
|
||||||
int signNum = signDataMap.get().getInt("num", 0);
|
|
||||||
nutMap.setv("isTakePartIn", signNum > 0 ? "是" : "否");
|
|
||||||
nutMap.setv("signNum", Math.min(signNum, ptsLength));
|
|
||||||
} else {
|
|
||||||
nutMap.setv("isTakePartIn", "否");
|
|
||||||
nutMap.setv("signNum", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// ArrayList<giftE> collect = giftEList.stream().collect(
|
|
||||||
// collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
|
|
||||||
// ArrayList::new));
|
|
||||||
ViTool.excelResponse(response, "活动汇总表.xls");
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), excelExportEntities, list2);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class giftE implements Serializable {
|
|
||||||
|
|
||||||
private String _openid;
|
|
||||||
|
|
||||||
@Excel(name = "工号", width = 20D)
|
|
||||||
private String loginname;
|
|
||||||
|
|
||||||
@Excel(name = "姓名", width = 20D)
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Excel(name = "单位", width = 20D)
|
|
||||||
private String unitname;
|
|
||||||
|
|
||||||
@Excel(name = "工会", width = 20D)
|
|
||||||
private String unionname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BaseService baseService;
|
|
||||||
|
|
||||||
//导出全部人员excel列数据
|
|
||||||
private static final List<ExcelExportEntity> excelExportEntityList = new ArrayList<>() {{
|
|
||||||
add(new ExcelExportEntity("姓名", "username", 20));
|
|
||||||
add(new ExcelExportEntity("工号", "loginname", 20));
|
|
||||||
add(new ExcelExportEntity("单位", "unitname", 20));
|
|
||||||
add(new ExcelExportEntity("工会", "unionname", 20));
|
|
||||||
}};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出活动报名人员
|
|
||||||
*
|
|
||||||
* @param activity_id
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void doExportRegsiter(String activity_id, String activity_tag, HttpServletResponse response) throws IOException {
|
|
||||||
Map<String, Object> reqBody = new HashMap<>();
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
|
|
||||||
String count = """
|
|
||||||
db.collection('register').where({activity_id: _.in(%s)}).count()
|
|
||||||
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))));
|
|
||||||
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
|
|
||||||
int count1 = wxResultCount.getInt("count");
|
|
||||||
|
|
||||||
List<Map> list2 = new ArrayList<>();
|
|
||||||
|
|
||||||
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
|
|
||||||
for (int i = 0; i < ceil; i++) {
|
|
||||||
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
|
|
||||||
String query = """
|
|
||||||
db.collection('register')
|
|
||||||
.where({
|
|
||||||
activity_id: _.in(%s)
|
|
||||||
})
|
|
||||||
.orderBy('unitid', 'desc')
|
|
||||||
.skip(%s)
|
|
||||||
.limit(%s)
|
|
||||||
.get()
|
|
||||||
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
|
|
||||||
, i * LIMIT, num);
|
|
||||||
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> data = wxResult.getList("data", Map.class);
|
|
||||||
list2.addAll(data);
|
|
||||||
List<giftE> giftEList = list2.stream().map(v -> {
|
|
||||||
giftE e = new giftE();
|
|
||||||
e.set_openid((String) v.get("_openid"));
|
|
||||||
e.setLoginname((String) v.get("loginname"));
|
|
||||||
e.setUsername((String) v.get("username"));
|
|
||||||
e.setUnitname((String) v.get("unitname"));
|
|
||||||
e.setUnionname((String) v.get("unionname"));
|
|
||||||
return e;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
ArrayList<giftE> collect = giftEList.stream().collect(
|
|
||||||
collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
|
|
||||||
ArrayList::new));
|
|
||||||
ViTool.excelResponse(response, "活动报名人员.xls");
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), giftE.class, collect);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出活动参与人员
|
|
||||||
*
|
|
||||||
* @param activity_id
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresPermissions("jsz.union.registerInfo")
|
|
||||||
public void doExportSign(String activity_id, String activity_tag, HttpServletResponse response) {
|
|
||||||
try {
|
|
||||||
Map<String, Object> reqBody = new HashMap<String, Object>();
|
|
||||||
reqBody.put("activity_id", activity_id);
|
|
||||||
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
|
|
||||||
|
|
||||||
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUserAll", reqBody);
|
|
||||||
List<NutMap> data = result.getAs("resp_data", List.class);
|
|
||||||
|
|
||||||
ArrayList<SignE> list = new ArrayList<>();
|
|
||||||
for (NutMap val : data) {
|
|
||||||
NutMap v = val.getAs("data", NutMap.class);
|
|
||||||
SignE e = new SignE();
|
|
||||||
// e.setActivity_name((String) v.get("activity_name"));
|
|
||||||
e.setLoginname((String) v.get("loginname"));
|
|
||||||
e.setUsername((String) v.get("username"));
|
|
||||||
e.setSex((String) v.get("sex"));
|
|
||||||
e.setMobile((String) v.get("mobile"));
|
|
||||||
e.setUnitname((String) v.get("unitname"));
|
|
||||||
e.setUnionname(v.getString("unionname"));
|
|
||||||
e.setSignnum(val.getInt("num"));
|
|
||||||
list.add(e);
|
|
||||||
}
|
|
||||||
ViTool.excelResponse(response, "活动参与人员.xls");
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), SignE.class, list);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.mobile;
|
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
|
||||||
import org.nutz.dao.Sqls;
|
|
||||||
import org.nutz.dao.entity.Record;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/4 10:37
|
|
||||||
* @Description: TODO
|
|
||||||
*/
|
|
||||||
@At("/jsz/api")
|
|
||||||
@Ok("json:full")
|
|
||||||
@IocBean
|
|
||||||
public class JszApiCon {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SysUserService sysUserService;
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getUserDataByLoginName(String loginname) {
|
|
||||||
Sql sql = Sqls.create("SELECT u.id userid,u.username,u.loginname,u.sex,u.mobile,u.birthday,unit.`name` unitname,u.unitid,unit.unionid,un.unionname from sys_user u left join sys_unit unit on u.unitid = unit.id left join sys_union un on unit.unionid = un.id WHERE u.loginname = @loginname").setParam("loginname", loginname);
|
|
||||||
List<Record> list = sysUserService.list(sql);
|
|
||||||
return list.size() > 0 ? list.get(0) : new Object();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.mobile;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszFillCheckService;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.POST;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/24 10:14
|
|
||||||
* @Description: 补签
|
|
||||||
*/
|
|
||||||
@At("/jsz/fillcheck")
|
|
||||||
@Ok("json:full")
|
|
||||||
@IocBean
|
|
||||||
public class JszFillCheckCon {
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/mobile/FillCheck.html")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private JszFillCheckService jszFillCheckService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SysUserService sysUserService;
|
|
||||||
|
|
||||||
@At
|
|
||||||
@POST
|
|
||||||
public Object doSubmit(Jsz_fillcheck fillcheck) {
|
|
||||||
try {
|
|
||||||
if (sysUserService.count(Cnd.where("username", "=", fillcheck.getUsername()).and("loginname", "=", fillcheck.getLoginname()).and("zzzt", "=", "在职")) == 0) {
|
|
||||||
return Result.error("姓名或工号错误");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jszFillCheckService.count(Cnd.where("username", "=", fillcheck.getUsername()).and("loginname", "=", fillcheck.getLoginname())) > 0) {
|
|
||||||
return Result.error("存在已提交的签到记录");
|
|
||||||
}
|
|
||||||
|
|
||||||
fillcheck.setCheck_time(DateUtil.getDateTime());
|
|
||||||
jszFillCheckService.insert(fillcheck);
|
|
||||||
|
|
||||||
return Result.success("提交成功");
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("系统错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.mobile;
|
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.JszWxStep;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
|
|
||||||
import org.nutz.dao.Chain;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*
|
|
||||||
* @Author zhf
|
|
||||||
* @Date 2022/9/6 15:18
|
|
||||||
*/
|
|
||||||
@At("/jsz/my/step")
|
|
||||||
@Ok("json:full")
|
|
||||||
@IocBean
|
|
||||||
public class jszWxStepController {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private JszWxStepService jszWxStepService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取今天当前用户最新步数
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getStepByUserId(String userId) {
|
|
||||||
return jszWxStepService.getStepByUserId(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取今天当前用户最新步数
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getStepRankingByUserId(String userId) {
|
|
||||||
|
|
||||||
List<JszWxStep> query = jszWxStepService.query(Cnd.where("applyDate", "=", DateUtil.getDate()).desc("step"));
|
|
||||||
int k = 0;
|
|
||||||
for (int i = 0; i < query.size(); i++) {
|
|
||||||
if (query.get(i).getUserId().equals(userId)) {
|
|
||||||
k = i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加步数
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @param step
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object addStep(String userId, Integer step) {
|
|
||||||
JszWxStep jszWxStep = new JszWxStep();
|
|
||||||
jszWxStep.setUserId(userId);
|
|
||||||
jszWxStep.setStep(step);
|
|
||||||
jszWxStep.setApplyDate(new Date());
|
|
||||||
jszWxStepService.insert(jszWxStep);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改步数
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @param step
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object editStep(String userId, Integer step) {
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("userId", "=", userId).and("applyDate", "=", DateUtil.getDate());
|
|
||||||
jszWxStepService.update(Chain.make("step", step), cnd);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.mobile;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.dao.Sqls;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: Aaron
|
|
||||||
* @create: 2020-09-11 13:50
|
|
||||||
* @description: 小程序登录
|
|
||||||
**/
|
|
||||||
@At("/platform/jsz/login")
|
|
||||||
@Ok("json:full")
|
|
||||||
@IocBean
|
|
||||||
public class loginController {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SysUserService sysUserService;
|
|
||||||
|
|
||||||
@At("/")
|
|
||||||
public Object index(String username, String loginname) {
|
|
||||||
try {
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
u.id userid,
|
|
||||||
u.username,
|
|
||||||
u.loginname,
|
|
||||||
u.sex,
|
|
||||||
u.mobile,
|
|
||||||
u.birthday,
|
|
||||||
unit.`name` unitname,
|
|
||||||
u.unitid,
|
|
||||||
u.member,
|
|
||||||
unit.unionid,
|
|
||||||
un.unionname,
|
|
||||||
group_concat(sr.`code`) roles,
|
|
||||||
'$schoolCode' as schoolCode
|
|
||||||
FROM
|
|
||||||
sys_user u
|
|
||||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
|
||||||
LEFT JOIN sys_union un ON unit.unionid = un.id
|
|
||||||
LEFT JOIN sys_user_role sur ON sur.userId = u.id
|
|
||||||
LEFT JOIN sys_role sr ON sr.id = sur.roleId
|
|
||||||
$condition
|
|
||||||
""").setParam("loginname", loginname).setParam("username", username);
|
|
||||||
sql.setVar("schoolCode", Globals.schoolCode);
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("LOWER(u.loginname)", "=", loginname.trim().toLowerCase());
|
|
||||||
cnd.and("LOWER(u.username)", "=", username.trim().toLowerCase());
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
sql.setCallback(Sqls.callback.map());
|
|
||||||
sysUserService.dao().execute(sql);
|
|
||||||
NutMap user = (NutMap) sql.getResult();
|
|
||||||
if (StrUtil.isBlank(user.getString("userid"))) {
|
|
||||||
return Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
|
|
||||||
}
|
|
||||||
// if(user.getInt("member",0)==0){
|
|
||||||
// return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
|
|
||||||
// }
|
|
||||||
/*if (user.getInt("member", 0) != 1 && !user.getString("sex", "").equals("女")) {
|
|
||||||
return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
|
|
||||||
}*/
|
|
||||||
return Result.success().addData(user);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,671 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import cn.wizzer.framework.page.Pagination;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.sys.models.Sys_task;
|
|
||||||
import io.v.nutz.sys.services.SysTaskService;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
|
||||||
import io.v.nutz.task.services.TaskPlatformService;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.json.Json;
|
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.log.Log;
|
|
||||||
import org.nutz.log.Logs;
|
|
||||||
import org.nutz.mvc.annotation.AdaptBy;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
import org.nutz.mvc.upload.TempFile;
|
|
||||||
import org.nutz.mvc.upload.UploadAdaptor;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheRemove;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/1 9:48
|
|
||||||
* @Description: 健身走活动管理
|
|
||||||
*/
|
|
||||||
@At("/platform/jsz/hdMange")
|
|
||||||
@Ok("json")
|
|
||||||
@IocBean
|
|
||||||
@RequiresAuthentication
|
|
||||||
@CacheDefaults(cacheName = "jsz_activity")
|
|
||||||
public class HdMangeCon {
|
|
||||||
|
|
||||||
private static final Log log = Logs.get();
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
private final String JOB_CLASS = "io.v.nutz.task.job.jszLotteryJob"; //调用类
|
|
||||||
@Inject
|
|
||||||
private TaskPlatformService taskPlatformService;
|
|
||||||
@Inject
|
|
||||||
private SysTaskService sysTaskService;
|
|
||||||
@Inject
|
|
||||||
private SysUserService sysUserService;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/pc/HdMange.html")
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public Object doAdd(String data, TempFile file) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
String picid = null;
|
|
||||||
|
|
||||||
if (Objects.nonNull(file)) {
|
|
||||||
NutMap picmap = wxHttpUtil.getUploadFile("activity/" + file.getSubmittedFileName());
|
|
||||||
picid = wxHttpUtil.uploadFile(picmap, file, "activity/" + file.getSubmittedFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
NutMap map = Json.fromJson(NutMap.class, data);
|
|
||||||
StringBuilder ptsBuffer = new StringBuilder("");
|
|
||||||
NutMap[] pts = map.getArray("pts", NutMap.class);
|
|
||||||
for (int i = 0; i < pts.length; i++) {
|
|
||||||
NutMap pt = pts[i];
|
|
||||||
ptsBuffer.append("{")
|
|
||||||
.append("issueIds:").append(pt.getAsList("issueIds", String.class).stream().map(v -> "'" + v + "'").collect(Collectors.toList())).append(",")
|
|
||||||
.append("code:'").append(pt.getString("code")).append("',")
|
|
||||||
.append("name:'").append(pt.getString("name")).append("',")
|
|
||||||
.append("radius:").append(pt.getInt("radius")).append(",")
|
|
||||||
.append("interval:").append(pt.getInt("interval", 0)).append(",")
|
|
||||||
.append("receivePoint:").append(pt.getBoolean("receivePoint")).append(",")
|
|
||||||
.append("location:new db.Geo.Point(")
|
|
||||||
.append(pt.getDouble("lng")).append(",")
|
|
||||||
.append(pt.getDouble("lat")).append(")")
|
|
||||||
.append("}");
|
|
||||||
if (i < pts.length - 1) {
|
|
||||||
ptsBuffer.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder lpBuffer = new StringBuilder("");
|
|
||||||
ArrayList[] linePoints = map.getArray("linePoints", ArrayList.class);
|
|
||||||
for (int i = 0; i < linePoints.length; i++) {
|
|
||||||
ArrayList linePoint = linePoints[i];
|
|
||||||
lpBuffer.append("new db.Geo.Point(" + linePoint.get(0) + "," + linePoint.get(1) + ")");
|
|
||||||
if (i < linePoints.length - 1) {
|
|
||||||
lpBuffer.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String pic = Strings.isNotBlank(picid) ? picid : map.getString("pic");
|
|
||||||
|
|
||||||
String query = """
|
|
||||||
db.collection('activity')
|
|
||||||
.add({
|
|
||||||
data:
|
|
||||||
[{
|
|
||||||
groupId:%s,
|
|
||||||
questionId:'%s',
|
|
||||||
hasAnswer:%b,
|
|
||||||
tag:'%s',
|
|
||||||
name:'%s',
|
|
||||||
activityModel:'%s',
|
|
||||||
dailyLottery:'%d',
|
|
||||||
walkingStepCount:'%d',
|
|
||||||
lotteryChance:%b,
|
|
||||||
repeatedlyLottery:%b,
|
|
||||||
leaderboardNum:'%d',
|
|
||||||
drawTime:%d,
|
|
||||||
lotteryTime:'%s',
|
|
||||||
address:'%s',
|
|
||||||
note:'%s',
|
|
||||||
apply_start_time:%d,
|
|
||||||
apply_end_time:%d,
|
|
||||||
start_time:%d,
|
|
||||||
end_time:%d,
|
|
||||||
pts:[%s],
|
|
||||||
linePoints:[%s],
|
|
||||||
toast_num:%d,
|
|
||||||
toast_msg: '%s',
|
|
||||||
check_all_msg: '%s',
|
|
||||||
checkControl:%d,
|
|
||||||
pic:'%s',
|
|
||||||
showGift:%b,
|
|
||||||
gift_name:'%s',
|
|
||||||
schoolCode:'%s',
|
|
||||||
activity_apply_user:'%s',
|
|
||||||
sendNotify:%b
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
""".formatted(
|
|
||||||
map.getString("groupId"),
|
|
||||||
map.getString("questionId", ""),
|
|
||||||
map.getBoolean("hasAnswer"),
|
|
||||||
map.getString("tag", ""),
|
|
||||||
map.getString("name"),
|
|
||||||
map.getString("activityModel"),
|
|
||||||
map.getInt("dailyLottery"),
|
|
||||||
map.getInt("walkingStepCount"),
|
|
||||||
map.getBoolean("lotteryChance"),
|
|
||||||
map.getBoolean("repeatedlyLottery"),
|
|
||||||
map.getInt("leaderboardNum"),
|
|
||||||
map.getLong("drawTime"),
|
|
||||||
map.getString("lotteryTime"),
|
|
||||||
map.getString("address"),
|
|
||||||
map.getString("note").replaceAll("\r|\n", ""),
|
|
||||||
map.getLong("apply_start_time"),
|
|
||||||
map.getLong("apply_end_time"),
|
|
||||||
map.getLong("start_time"),
|
|
||||||
map.getLong("end_time"),
|
|
||||||
ptsBuffer.toString(),
|
|
||||||
lpBuffer.toString(),
|
|
||||||
map.get("toast_num") == null ? 0 : map.getInt("toast_num"),
|
|
||||||
map.getString("toast_msg", ""),
|
|
||||||
map.getString("check_all_msg", ""),
|
|
||||||
map.getInt("checkControl"),
|
|
||||||
pic,
|
|
||||||
map.getBoolean("showGift"),
|
|
||||||
map.getString("gift_name"),
|
|
||||||
Globals.schoolCode,
|
|
||||||
ShiroUtil.getUserId(),
|
|
||||||
map.getBoolean("sendNotify", false)
|
|
||||||
);
|
|
||||||
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.insertUrl, query);
|
|
||||||
log.debug(query);
|
|
||||||
|
|
||||||
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
|
|
||||||
// addTask(map);
|
|
||||||
List<String> idList = result.getList("id_list", String.class);
|
|
||||||
map.put("_id", idList.get(0));
|
|
||||||
addNotifyTask(map);
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
|
||||||
@Param(value = "type", required = false) String type,
|
|
||||||
@Param(value = "searchName", required = false) String searchName,
|
|
||||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
|
||||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
|
||||||
@Param(value = "pageOrderName", required = true) String pageOrderName,
|
|
||||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) throws IOException {
|
|
||||||
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
|
|
||||||
|
|
||||||
String query = """
|
|
||||||
db.collection('activity')
|
|
||||||
.where(%s)
|
|
||||||
.skip(%d)
|
|
||||||
.limit(%d)
|
|
||||||
.orderBy('start_time','desc').get()
|
|
||||||
""";
|
|
||||||
|
|
||||||
List<String> and = new ArrayList<>();
|
|
||||||
String search_sql = "";
|
|
||||||
String ts_sql = "";
|
|
||||||
StringBuilder s = new StringBuilder();
|
|
||||||
|
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
|
||||||
search_sql = """
|
|
||||||
_.or([
|
|
||||||
{
|
|
||||||
name:{$regex:'%s',$options: 'i'}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tag:{$regex:'%s',$options: 'i'}
|
|
||||||
}
|
|
||||||
])
|
|
||||||
""".formatted(searchKeyword, searchKeyword);
|
|
||||||
}
|
|
||||||
if (year != null) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.clear();
|
|
||||||
calendar.set(Calendar.YEAR, year);
|
|
||||||
long start_ts = calendar.getTimeInMillis();
|
|
||||||
calendar.clear();
|
|
||||||
calendar.set(Calendar.YEAR, year);
|
|
||||||
calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
|
||||||
long end_ts = calendar.getTimeInMillis();
|
|
||||||
String activity_apply_user_cnd = "_.neq(null)";
|
|
||||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
|
||||||
activity_apply_user_cnd = "'" + ShiroUtil.getUserId() + "'";
|
|
||||||
}
|
|
||||||
ts_sql = "{apply_start_time:_.and(_.gte(%d),_.lte(%d)),activity_apply_user:%s}".formatted(start_ts, end_ts, activity_apply_user_cnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
|
||||||
s.append(search_sql);
|
|
||||||
if (year != null) {
|
|
||||||
s.append(".and(");
|
|
||||||
s.append(ts_sql);
|
|
||||||
s.append(")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (year != null && Strings.isBlank(searchKeyword)) {
|
|
||||||
s.append(ts_sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
query = query.formatted(s, skip, pageSize);
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
|
|
||||||
NutMap pager = result.getAs("pager", NutMap.class);
|
|
||||||
|
|
||||||
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), result.getList("data", Map.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public Object getData(String id) throws IOException {
|
|
||||||
String query = "db.collection('activity').doc('%s').get()".formatted(id);
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> data = wxResult.getList("data", Map.class);
|
|
||||||
return data.size() > 0 ? data.get(0) : new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("json")
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public Object getFile(String pic) {
|
|
||||||
try {
|
|
||||||
NutMap res = NutMap.NEW();
|
|
||||||
String imgurl = wxHttpUtil.getWxFileUrl(pic);
|
|
||||||
HashMap<String, Object> imgmap = new HashMap<>();
|
|
||||||
imgmap.put("status", "success");
|
|
||||||
imgmap.put("name", imgurl.substring(imgurl.lastIndexOf("/") + 1));
|
|
||||||
imgmap.put("id", imgurl);
|
|
||||||
imgmap.put("url", imgurl);
|
|
||||||
res.setv("img", imgmap);
|
|
||||||
return Result.success().addData(res);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@CacheRemoveAll
|
|
||||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public Object doEdit(String data, TempFile file) {
|
|
||||||
try {
|
|
||||||
String picid = "";
|
|
||||||
if (file != null) {
|
|
||||||
NutMap picmap = wxHttpUtil.getUploadFile("activity/" + file.getSubmittedFileName());
|
|
||||||
picid = wxHttpUtil.uploadFile(picmap, file, "activity/" + file.getSubmittedFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
NutMap map = Json.fromJson(NutMap.class, data);
|
|
||||||
|
|
||||||
StringBuilder ptsBuffer = new StringBuilder("");
|
|
||||||
NutMap[] pts = map.getArray("pts", NutMap.class);
|
|
||||||
for (int i = 0; i < pts.length; i++) {
|
|
||||||
NutMap pt = pts[i];
|
|
||||||
ptsBuffer.append("{")
|
|
||||||
.append("issueIds:").append(pt.getAsList("issueIds", String.class).stream().map(v -> "'" + v + "'").collect(Collectors.toList())).append(",")
|
|
||||||
.append("code:'").append(pt.getString("code")).append("',")
|
|
||||||
.append("name:'").append(pt.getString("name")).append("',")
|
|
||||||
.append("radius:").append(pt.getInt("radius")).append(",")
|
|
||||||
.append("interval:").append(pt.getInt("interval", 0)).append(",")
|
|
||||||
.append("receivePoint:").append(pt.getBoolean("receivePoint")).append(",")
|
|
||||||
.append("location:new db.Geo.Point(").append(pt.getDouble("lng")).append(",")
|
|
||||||
.append(pt.getDouble("lat")).append(")").append("}");
|
|
||||||
if (i < pts.length - 1) {
|
|
||||||
ptsBuffer.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder lpBuffer = new StringBuilder("");
|
|
||||||
ArrayList[] linePoints = map.getArray("linePoints", ArrayList.class);
|
|
||||||
for (int i = 0; i < linePoints.length; i++) {
|
|
||||||
ArrayList linePoint = linePoints[i];
|
|
||||||
lpBuffer.append("new db.Geo.Point(").append(linePoint.get(0)).append(",")
|
|
||||||
.append(linePoint.get(1)).append(")");
|
|
||||||
if (i < linePoints.length - 1) {
|
|
||||||
lpBuffer.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String picSql = "";
|
|
||||||
if (Strings.isNotBlank(picid)) {
|
|
||||||
picSql = String.format("pic:'%s'", picid);
|
|
||||||
}
|
|
||||||
|
|
||||||
String query = """
|
|
||||||
db.collection('activity').doc('%s')
|
|
||||||
.update({
|
|
||||||
data:
|
|
||||||
{
|
|
||||||
groupId:%s,
|
|
||||||
questionId:'%s',
|
|
||||||
hasAnswer:%b,
|
|
||||||
showGift:%b,
|
|
||||||
gift_name:'%s',
|
|
||||||
tag:'%s',
|
|
||||||
name:'%s',
|
|
||||||
activityModel:'%s',
|
|
||||||
dailyLottery:'%d',
|
|
||||||
walkingStepCount:'%d',
|
|
||||||
lotteryChance:%b,
|
|
||||||
repeatedlyLottery:%b,
|
|
||||||
leaderboardNum:'%d',
|
|
||||||
drawTime:%d,
|
|
||||||
lotteryTime:'%s',
|
|
||||||
address:'%s',
|
|
||||||
note:'%s',
|
|
||||||
apply_start_time:%d,
|
|
||||||
apply_end_time:%d,
|
|
||||||
start_time:%d,
|
|
||||||
end_time:%d,
|
|
||||||
pts:[%s],
|
|
||||||
linePoints:[%s],
|
|
||||||
toast_num:%d,
|
|
||||||
toast_msg: '%s',
|
|
||||||
check_all_msg: '%s',
|
|
||||||
checkControl:%d,
|
|
||||||
schoolCode:'%s',
|
|
||||||
activity_apply_user:'%s',
|
|
||||||
sendNotify:%b,
|
|
||||||
%s
|
|
||||||
}
|
|
||||||
})
|
|
||||||
""".formatted(
|
|
||||||
map.getString("_id"),
|
|
||||||
map.getString("groupId"),
|
|
||||||
map.getString("questionId"),
|
|
||||||
map.getBoolean("hasAnswer"),
|
|
||||||
map.getBoolean("showGift"),
|
|
||||||
map.getString("gift_name"),
|
|
||||||
map.getString("tag"),
|
|
||||||
map.getString("name"),
|
|
||||||
map.getString("activityModel"),
|
|
||||||
map.getInt("dailyLottery"),
|
|
||||||
map.getInt("walkingStepCount"),
|
|
||||||
map.getBoolean("lotteryChance"),
|
|
||||||
map.getBoolean("repeatedlyLottery"),
|
|
||||||
map.getInt("leaderboardNum"),
|
|
||||||
map.getLong("drawTime"),
|
|
||||||
map.getString("lotteryTime"),
|
|
||||||
map.getString("address"),
|
|
||||||
map.getString("note").replaceAll("\r|\n", ""),
|
|
||||||
map.getLong("apply_start_time"),
|
|
||||||
map.getLong("apply_end_time"),
|
|
||||||
map.getLong("start_time"),
|
|
||||||
map.getLong("end_time"),
|
|
||||||
ptsBuffer.toString(),
|
|
||||||
lpBuffer.toString(),
|
|
||||||
map.get("toast_num") == null ? 0 : map.getInt("toast_num"),
|
|
||||||
map.getString("toast_msg"),
|
|
||||||
map.getString("check_all_msg"),
|
|
||||||
map.getInt("checkControl"),
|
|
||||||
Globals.schoolCode,
|
|
||||||
ShiroUtil.getUserId(),
|
|
||||||
map.getBoolean("sendNotify", false),
|
|
||||||
picSql
|
|
||||||
);
|
|
||||||
log.debug(query);
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.updateUrl, query);
|
|
||||||
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
|
|
||||||
addNotifyTask(map);
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void addTask(NutMap map) {
|
|
||||||
// Trans.exec(() -> {
|
|
||||||
// try {
|
|
||||||
// if (map.getInt("dailyLottery") > 0) {
|
|
||||||
// //先删除在添加
|
|
||||||
// List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", map.getString("_id")));
|
|
||||||
// if (sys_tasks != null) {
|
|
||||||
// sys_tasks.forEach(v -> {
|
|
||||||
// taskPlatformService.delete(v.getId(), v.getId());
|
|
||||||
// sysTaskService.delete(v.getId());
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Sys_task sys_task = new Sys_task();
|
|
||||||
// sys_task.setName(map.getString("name"));
|
|
||||||
// sys_task.setNote(map.getString("_id"));
|
|
||||||
// sys_task.setJobClass(JOB_CLASS);
|
|
||||||
// sys_task.setData(Json.toJson(new HashMap<String, Object>() {{
|
|
||||||
// put("id", map.getString("_id"));
|
|
||||||
// }}));
|
|
||||||
// sys_task.setDisabled(false);
|
|
||||||
// if (!map.getBoolean("repeatedlyLottery")) {
|
|
||||||
// Date drawTime = new Date(map.getLong("drawTime"));
|
|
||||||
// String cron = io.v.nutz.base.utils.DateUtil.getCron(drawTime);
|
|
||||||
// sys_task.setCron(cron);
|
|
||||||
// List<String> cronExeTimes = taskPlatformService.getCronExeTimes(cron);
|
|
||||||
// if (cronExeTimes.size() == 0) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// sys_task = sysTaskService.insert(sys_task);
|
|
||||||
// taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
|
|
||||||
// } else {
|
|
||||||
// String lotteryTime = map.getString("lotteryTime");
|
|
||||||
// long start_time_long = map.getLong("start_time");
|
|
||||||
// long end_time_long = map.getLong("end_time");
|
|
||||||
//
|
|
||||||
// List<Date> taskDates = new ArrayList<>();
|
|
||||||
// int offsetDay = 0;
|
|
||||||
// while (DateUtil.offsetDay(new Date(start_time_long), offsetDay).compareTo(new Date(end_time_long)) < 0 ||
|
|
||||||
// DateUtil.offsetDay(new Date(start_time_long), offsetDay).compareTo(new Date(end_time_long)) == 0) {
|
|
||||||
// taskDates.add(DateUtil.offsetDay(new Date(start_time_long), offsetDay));
|
|
||||||
// offsetDay++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (Date taskDate : taskDates) {
|
|
||||||
// Calendar instance = Calendar.getInstance();
|
|
||||||
// instance.setTime(taskDate);
|
|
||||||
// int year = instance.get(Calendar.YEAR);
|
|
||||||
// int month = instance.get(Calendar.MONTH) + 1;
|
|
||||||
// int day = instance.get(Calendar.DATE);
|
|
||||||
// String[] time = lotteryTime.split(":");
|
|
||||||
// String cron = time[2] + " " + time[1] + " " + time[0] + " " + day + " " + month + " " + " ? " + year + " ";
|
|
||||||
// sys_task.setCron(cron);
|
|
||||||
// List<String> cronExeTimes = taskPlatformService.getCronExeTimes(cron);
|
|
||||||
// if (cronExeTimes.size() == 0) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// sys_task = sysTaskService.insert(sys_task);
|
|
||||||
// taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@CacheRemove
|
|
||||||
@RequiresPermissions("jsz.hdmange")
|
|
||||||
public Object delete(String id) throws IOException {
|
|
||||||
String query = "db.collection('activity').doc('" + id + "').remove()";
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, query);
|
|
||||||
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
|
|
||||||
|
|
||||||
String s1 = "db.collection('register').where({\n" +
|
|
||||||
" activity_id: '" + id + "'\n" +
|
|
||||||
"}).remove()\n";
|
|
||||||
String s2 = "db.collection('sign').where({\n" +
|
|
||||||
" activity_id: '" + id + "'\n" +
|
|
||||||
"}).remove()\n";
|
|
||||||
|
|
||||||
wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s1);
|
|
||||||
wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s2);
|
|
||||||
List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", id));
|
|
||||||
if (sys_tasks != null) {
|
|
||||||
sys_tasks.forEach(v -> {
|
|
||||||
taskPlatformService.delete(v.getId(), v.getId());
|
|
||||||
sysTaskService.delete(v.getId());
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getFitnessData() throws IOException {
|
|
||||||
String query = "db.collection('activity').where({schoolCode:'%s'}).orderBy('apply_start_time', 'desc').get()".formatted(Globals.schoolCode);
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<NutMap> data = result.getList("data", NutMap.class);
|
|
||||||
return data.size() > 0 ? data : new ArrayList<>();
|
|
||||||
//return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getActivityData() throws IOException {
|
|
||||||
|
|
||||||
Long yearStartTime = getYearStartTime();
|
|
||||||
Long yearEndTime = getYearEndTime();
|
|
||||||
|
|
||||||
String query = "db.collection('activity')\n" +
|
|
||||||
" .where({\n" +
|
|
||||||
" apply_start_time: _.and(_.gte(" + yearStartTime + "), _.lte(" + yearEndTime + "))\n" +
|
|
||||||
" }).get()";
|
|
||||||
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> data = wxResult.getList("data", Map.class);
|
|
||||||
return data;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当年的开始时间戳
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Long getYearStartTime() {
|
|
||||||
Calendar calendar = Calendar.getInstance();// 获取当前日期
|
|
||||||
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
|
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
|
||||||
calendar.add(Calendar.YEAR, 0);
|
|
||||||
calendar.add(Calendar.DATE, 0);
|
|
||||||
calendar.add(Calendar.MONTH, 0);
|
|
||||||
calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
|
||||||
calendar.set(Calendar.SECOND, 0);
|
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
|
||||||
return calendar.getTimeInMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当年的最后时间戳
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Long getYearEndTime() {
|
|
||||||
Calendar calendar = Calendar.getInstance();// 获取当前日期
|
|
||||||
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
|
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
|
||||||
int year = calendar.get(Calendar.YEAR);
|
|
||||||
calendar.clear();
|
|
||||||
calendar.set(Calendar.YEAR, year);
|
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
|
||||||
calendar.set(Calendar.MINUTE, 59);
|
|
||||||
calendar.set(Calendar.SECOND, 59);
|
|
||||||
calendar.set(Calendar.MILLISECOND, 999);
|
|
||||||
calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
|
||||||
return calendar.getTimeInMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 健身走健步模式通知提醒
|
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
*/
|
|
||||||
private void addNotifyTask(NutMap map) {
|
|
||||||
if (map.getBoolean("sendNotify")) {
|
|
||||||
String id = map.getString("_id");
|
|
||||||
String name = map.getString("name");
|
|
||||||
String groupId = map.getString("groupId");
|
|
||||||
|
|
||||||
//提醒频率
|
|
||||||
int notifyGap = 10;
|
|
||||||
|
|
||||||
List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", id));
|
|
||||||
if (Lang.isNotEmpty(sys_tasks)) {
|
|
||||||
sys_tasks.forEach(v -> {
|
|
||||||
taskPlatformService.delete(v.getId(), v.getId());
|
|
||||||
sysTaskService.delete(v.getId());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
DateTime startTime = DateUtil.date(map.getLong("start_time"));
|
|
||||||
DateTime endTime = DateUtil.date(map.getLong("end_time"));
|
|
||||||
|
|
||||||
Set<DateTime> result = new HashSet<>();
|
|
||||||
DateTime offsetDay = DateUtil.offsetDay(startTime, notifyGap);
|
|
||||||
while (offsetDay.isBefore(endTime) && offsetDay.isAfter(new Date())) {
|
|
||||||
result.add(offsetDay);
|
|
||||||
offsetDay = DateUtil.offsetDay(offsetDay, notifyGap);
|
|
||||||
}
|
|
||||||
//活动结束前一天再添加一个日期提醒
|
|
||||||
result.add(DateUtil.offsetDay(endTime, -1));
|
|
||||||
|
|
||||||
for (DateTime dateTime : result) {
|
|
||||||
Sys_task sys_task = new Sys_task();
|
|
||||||
sys_task.setName(name);
|
|
||||||
sys_task.setNote(id);
|
|
||||||
sys_task.setJobClass("io.v.nutz.task.job.walking.WalkingNotifyJob");
|
|
||||||
sys_task.setData(Json.toJson(Map.of("groupId", groupId)));
|
|
||||||
sys_task.setDisabled(false);
|
|
||||||
|
|
||||||
String dateFormat = "ss mm HH dd MM ? yyyy";
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
|
|
||||||
String corn = sdf.format(dateTime);
|
|
||||||
sys_task.setCron(corn);
|
|
||||||
|
|
||||||
sysTaskService.insert(sys_task);
|
|
||||||
|
|
||||||
taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,307 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.http.HttpUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.page.Pagination;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.base.utils.WxTokenUtil;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.Jsz_backup;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.boot.starter.ftp.FtpService;
|
|
||||||
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.json.Json;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.*;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@IocBean
|
|
||||||
@At("/platform/jsz/cloudbackup")
|
|
||||||
@Slf4j
|
|
||||||
@Ok("json:full")
|
|
||||||
public class JszCloudBackUpController {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxTokenUtil wxTokenUtil;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private FtpService ftpService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SysUserService userService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Dao dao;
|
|
||||||
|
|
||||||
private static final String UPLOAD_FILE_PATH = "/jsz";
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/pc/cloudbackup.html")
|
|
||||||
@RequiresPermissions("jsz.cloudbackup")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 集合名称
|
|
||||||
*
|
|
||||||
* @return {@link Object}
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.cloudbackup")
|
|
||||||
public Object databasecollectionget() {
|
|
||||||
String accessToken = wxTokenUtil.getAccessToken();
|
|
||||||
Map<String, Object> dataMap = new HashMap<>(4);
|
|
||||||
dataMap.put("env", WxHttpUtil.env);
|
|
||||||
String response = HttpUtil.post("https://api.weixin.qq.com/tcb/databasecollectionget?access_token=" + accessToken, Json.toJson(dataMap));
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
||||||
if (jsonObject.getString("errmsg").equals("ok")) {
|
|
||||||
return jsonObject.getJSONArray("collections");
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备份
|
|
||||||
*
|
|
||||||
* @param collections 集合名称
|
|
||||||
* @return {@link Object}
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.cloudbackup")
|
|
||||||
public Object databaseMigrateExport(@Param("collections") String[] collections) {
|
|
||||||
String accessToken = wxTokenUtil.getAccessToken();
|
|
||||||
|
|
||||||
Map<String, Long> jobIdMap = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
// 获取每个集合的导出任务id存到jobIdMap
|
|
||||||
List<CompletableFuture<Void>> jobIdFutures = Arrays.stream(collections)
|
|
||||||
.map(collection -> CompletableFuture.runAsync(() -> {
|
|
||||||
Map<String, Object> dataMap = new HashMap<>(4);
|
|
||||||
dataMap.put("env", WxHttpUtil.env);
|
|
||||||
dataMap.put("file_path", "backup_export");
|
|
||||||
dataMap.put("file_type", 1);
|
|
||||||
dataMap.put("query", "db.collection('" + collection + "').get()");
|
|
||||||
String response = HttpUtil.post("https://api.weixin.qq.com/tcb/databasemigrateexport?access_token=" + accessToken, Json.toJson(dataMap));
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
||||||
if ("ok".equals(jsonObject.getString("errmsg"))) {
|
|
||||||
jobIdMap.computeIfAbsent(collection, k -> jsonObject.getLong("job_id"));
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
CompletableFuture.allOf(jobIdFutures.toArray(new CompletableFuture[0])).join();
|
|
||||||
log.debug(jobIdMap.toString());
|
|
||||||
|
|
||||||
// 获取导出任务的执行状态,全部执行完后返回
|
|
||||||
List<JSONObject> resultList = new CopyOnWriteArrayList<>();
|
|
||||||
|
|
||||||
CompletableFuture<Void> resultAllOf = CompletableFuture.allOf(jobIdMap.entrySet().stream()
|
|
||||||
.map(entry -> executeAsyncRequest(entry, accessToken, resultList))
|
|
||||||
.toArray(CompletableFuture[]::new));
|
|
||||||
resultAllOf.join();
|
|
||||||
|
|
||||||
//上传文件并且插入到数据库
|
|
||||||
String backUpTime = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
|
||||||
List<CompletableFuture<Void>> futures = resultList.stream().map(v -> insertBackUp(v, backUpTime, ftpService, dao)).collect(Collectors.toList());
|
|
||||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
|
||||||
return Result.success();
|
|
||||||
|
|
||||||
|
|
||||||
// Map<String, Long> jobIdMap = new ConcurrentHashMap<>();
|
|
||||||
// //获取每个集合的导出任务id
|
|
||||||
// List<CompletableFuture> jobIdFutures = Arrays.stream(collections)
|
|
||||||
// .map(collection -> CompletableFuture.runAsync(() -> {
|
|
||||||
// Map<String, Object> dataMap = new HashMap<>(4);
|
|
||||||
// dataMap.put("env", WxHttpUtil.env);
|
|
||||||
// dataMap.put("file_path", "backup_export");
|
|
||||||
// dataMap.put("file_type", 1);
|
|
||||||
// dataMap.put("query", "db.collection('" + collection + "').get()");
|
|
||||||
// String response = HttpUtil.post("https://api.weixin.qq.com/tcb/databasemigrateexport?access_token=" + accessToken, Json.toJson(dataMap));
|
|
||||||
// JSONObject jsonObject = JSONObject.parseObject(response);
|
|
||||||
// if (jsonObject.getString("errmsg").equals("ok")) {
|
|
||||||
// jobIdMap.put(collection, jsonObject.getLong("job_id"));
|
|
||||||
// }
|
|
||||||
// }))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// CompletableFuture<Void> allOf = CompletableFuture.allOf(jobIdFutures.toArray(new CompletableFuture[0]));
|
|
||||||
// allOf.join();
|
|
||||||
// log.debug(jobIdMap.toString());
|
|
||||||
//
|
|
||||||
// //获取导出任务的执行状态,全部执行完后返回
|
|
||||||
// Map<String, JSONObject> resultMap = new ConcurrentHashMap<>();
|
|
||||||
//
|
|
||||||
// List<JSONObject> resultList = new CopyOnWriteArrayList<>();
|
|
||||||
//
|
|
||||||
// CompletableFuture<Void> resultAllOf = CompletableFuture.allOf(jobIdMap.entrySet().stream().map(entry -> executeAsyncRequest(entry, accessToken, resultMap, resultList)).toArray(CompletableFuture[]::new));
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// resultAllOf.get();
|
|
||||||
// } catch (InterruptedException | ExecutionException e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //插入到本地
|
|
||||||
// String backUpTime = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
|
||||||
// String filepath = UPLOAD_FILE_PATH + "/" + backUpTime;
|
|
||||||
// List<CompletableFuture<Void>> futures = resultList.stream().map(v -> CompletableFuture.runAsync(() -> {
|
|
||||||
// byte[] bytes = HttpUtil.get(v.getString("file_url")).getBytes();
|
|
||||||
// InputStream inputStream = new ByteArrayInputStream(bytes);
|
|
||||||
// String fileName = v.getString("collection") + ".json";
|
|
||||||
// //上传文件到本地
|
|
||||||
// ftpService.upload(filepath, fileName, inputStream);
|
|
||||||
// //插入数据库记录
|
|
||||||
// Jsz_backup backup = new Jsz_backup();
|
|
||||||
// backup.setCollection(v.getString("collection"));
|
|
||||||
// backup.setFilePath(filepath + "/" + fileName);
|
|
||||||
// backup.setFileName(fileName);
|
|
||||||
// backup.setBackUpDate(backUpTime);
|
|
||||||
// dao.insert(backup);
|
|
||||||
// })).collect(Collectors.toList());
|
|
||||||
// CompletableFuture<Void> allOfLocal = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
||||||
// allOfLocal.join();
|
|
||||||
// return Result.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 迁移状态查询 微信转json也需要耗时 需要不断递归去查询是否转换完成
|
|
||||||
*
|
|
||||||
* @param entry 集合->任务ID
|
|
||||||
* @param accessToken token
|
|
||||||
* @param resultList 返回list
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static CompletableFuture<Void> executeAsyncRequest(Map.Entry<String, Long> entry, String accessToken, List<JSONObject> resultList) {
|
|
||||||
String k = entry.getKey();
|
|
||||||
Long v = entry.getValue();
|
|
||||||
Supplier<CompletableFuture<Void>> futureSupplier = () -> CompletableFuture.supplyAsync(() -> {
|
|
||||||
Map<String, Object> dataMap = new HashMap<>(2);
|
|
||||||
dataMap.put("env", WxHttpUtil.env);
|
|
||||||
dataMap.put("job_id", v);
|
|
||||||
|
|
||||||
String response = HttpUtil.post("https://api.weixin.qq.com/tcb/databasemigratequeryinfo?access_token=" + accessToken, Json.toJson(dataMap));
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
||||||
|
|
||||||
System.out.println(jsonObject.getString("status"));
|
|
||||||
System.out.println(jsonObject.getString("error_msg"));
|
|
||||||
|
|
||||||
if ("success".equals(jsonObject.getString("status"))) {
|
|
||||||
jsonObject.put("collection", k);
|
|
||||||
jsonObject.put("jobId", v);
|
|
||||||
resultList.add(jsonObject);
|
|
||||||
} else if ("fail".equals(jsonObject.getString("status"))) {
|
|
||||||
throw new RuntimeException(jsonObject.getString("error_msg"));
|
|
||||||
} else {
|
|
||||||
// 如果 status 不是 success,继续发送请求
|
|
||||||
executeAsyncRequest(entry, accessToken, resultList).join();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 使用 thenCompose 实现递归调用
|
|
||||||
return CompletableFuture.supplyAsync(() -> null).thenCompose(ignore -> futureSupplier.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CompletableFuture<Void> insertBackUp(JSONObject v, String backUpTime, FtpService ftpService, Dao dao) {
|
|
||||||
String filepath = UPLOAD_FILE_PATH + "/" + backUpTime;
|
|
||||||
|
|
||||||
byte[] bytes = HttpUtil.get(v.getString("file_url")).getBytes();
|
|
||||||
InputStream inputStream = new ByteArrayInputStream(bytes);
|
|
||||||
String fileName = v.getString("collection") + ".json";
|
|
||||||
// 上传文件到本地
|
|
||||||
ftpService.upload(filepath, fileName, inputStream);
|
|
||||||
// 插入数据库记录
|
|
||||||
Jsz_backup backup = new Jsz_backup();
|
|
||||||
backup.setCollection(v.getString("collection"));
|
|
||||||
backup.setFilePath(filepath + "/" + fileName);
|
|
||||||
backup.setFileName(fileName);
|
|
||||||
backup.setBackUpDate(backUpTime);
|
|
||||||
dao.insert(backup);
|
|
||||||
return CompletableFuture.supplyAsync(() -> null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pageData
|
|
||||||
*
|
|
||||||
* @param pageForm pageForm
|
|
||||||
* @return {@link Object}
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.cloudbackup")
|
|
||||||
public Object pageData(PageForm pageForm) {
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
jb.backUpDate,
|
|
||||||
u.username
|
|
||||||
FROM
|
|
||||||
jsz_backup jb
|
|
||||||
left join sys_user u on u.id = jb.createdBy
|
|
||||||
$condition
|
|
||||||
""");
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.groupBy("jb.backUpDate");
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
|
|
||||||
Pagination pagination = userService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
|
||||||
List<NutMap> list = pagination.getList();
|
|
||||||
for (NutMap nutMap : list) {
|
|
||||||
nutMap.put("list", dao.query(Jsz_backup.class, Cnd.where("backUpDate", "=", nutMap.getString("backUpDate"))));
|
|
||||||
}
|
|
||||||
return pagination;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载
|
|
||||||
*
|
|
||||||
* @param filePath
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresPermissions("jsz.cloudbackup")
|
|
||||||
public void download(String filePath, HttpServletResponse response) {
|
|
||||||
int lastSlashIndex = filePath.lastIndexOf('/');
|
|
||||||
String fileName = filePath.substring(lastSlashIndex + 1);
|
|
||||||
ServletOutputStream outputStream;
|
|
||||||
try {
|
|
||||||
response.setContentType("image/jpg");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("utf-8"), "ISO8859-1"));
|
|
||||||
outputStream = response.getOutputStream();
|
|
||||||
ftpService.download(filePath, outputStream);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.cloudbackup")
|
|
||||||
public Object restoreData(@Param("backup") Jsz_backup backup) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszTypeService;
|
|
||||||
import io.v.nutz.zhgh.question.model.Question_issue;
|
|
||||||
import io.v.nutz.zhgh.question.model.Question_reply;
|
|
||||||
import io.v.nutz.zhgh.question.service.QuestionIssueService;
|
|
||||||
import io.v.nutz.zhgh.question.service.QuestionReplyService;
|
|
||||||
import io.v.nutz.zhgh.question.service.QuestionService;
|
|
||||||
import io.v.nutz.zhgh.question.service.QuestionWorService;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.lang.random.R;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.adaptor.JsonAdaptor;
|
|
||||||
import org.nutz.mvc.annotation.AdaptBy;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/1 10:02
|
|
||||||
* @Description: TODO
|
|
||||||
*/
|
|
||||||
@At("/jsz/common")
|
|
||||||
@Ok("json")
|
|
||||||
@IocBean
|
|
||||||
@RequiresAuthentication
|
|
||||||
public class JszCommonCon {
|
|
||||||
@Inject
|
|
||||||
private JszTypeService jszTypeService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取类型
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getTypes() {
|
|
||||||
return jszTypeService.query(Cnd.NEW().asc("location"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取所有的活动
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
public Object getAllHd(Integer year, String beforeTime, String endTime) {
|
|
||||||
try {
|
|
||||||
String str = "";
|
|
||||||
|
|
||||||
// if (Strings.isNotBlank(beforeTime) && Strings.isNotBlank(endTime)) {
|
|
||||||
// str = "start_time:_.gt(" + beforeTime + "),start_time:_.lt(" + endTime + ")";
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (year != null) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.clear();
|
|
||||||
calendar.set(Calendar.YEAR, year);
|
|
||||||
long start_ts = calendar.getTimeInMillis();
|
|
||||||
calendar.clear();
|
|
||||||
calendar.set(Calendar.YEAR, year);
|
|
||||||
calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
|
||||||
long end_ts = calendar.getTimeInMillis();
|
|
||||||
String activity_apply_user_cnd = "_.neq(null)";
|
|
||||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
|
||||||
activity_apply_user_cnd = "'" + ShiroUtil.getUserId() + "'";
|
|
||||||
}
|
|
||||||
str = "apply_start_time:_.and(_.gte(%d),_.lte(%d)),schoolCode:'%s',activity_apply_user:%s".formatted(start_ts, end_ts, Globals.schoolCode, activity_apply_user_cnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
String query = "db.collection('activity').where({\n" +
|
|
||||||
str +
|
|
||||||
"}).field({\n" +
|
|
||||||
"tag: true,\n" +
|
|
||||||
"name: true,\n" +
|
|
||||||
"startTime: true,\n" +
|
|
||||||
"endTime: true,\n" +
|
|
||||||
"activityModel: true,\n" +
|
|
||||||
"}).orderBy('startTime', 'desc').get()";
|
|
||||||
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> data = wxResult.getList("data", Map.class);
|
|
||||||
return Result.success().addData(data);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private QuestionService questionService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private QuestionIssueService questionIssueService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private QuestionWorService questionWorService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private QuestionReplyService questionReplyService;
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getQuestion() {
|
|
||||||
return questionService.query(Cnd.where("qflag", "=", 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getIssueById(String id) {
|
|
||||||
List<Question_issue> questionIssues = questionIssueService.query(Cnd.where("iqid", "=", id).asc("ipxbh"));
|
|
||||||
questionIssues.forEach(issue -> {
|
|
||||||
issue.setWors(questionWorService.query(Cnd.where("wiid", "=", issue.getIid()).asc("wpxbh")));
|
|
||||||
});
|
|
||||||
return questionIssues;
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@AdaptBy(type = JsonAdaptor.class)
|
|
||||||
public Object saveAnswer(@Param("reply") Question_reply[] replys) {
|
|
||||||
for (Question_reply reply : replys) {
|
|
||||||
reply.setSave(false);
|
|
||||||
reply.setRidentity(R.UU32());
|
|
||||||
reply.setRtime(DateUtil.getDate());
|
|
||||||
questionReplyService.insert(reply);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import cn.wizzer.framework.page.Pagination;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.json.Json;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/24 15:32
|
|
||||||
* @Description: TODO
|
|
||||||
*/
|
|
||||||
@At("/platform/jsz/login/record")
|
|
||||||
@Ok("json")
|
|
||||||
@IocBean
|
|
||||||
@RequiresAuthentication
|
|
||||||
public class JszLoginRecordCon {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/pc/LoginRecord.html")
|
|
||||||
@RequiresPermissions("jsz.login.record")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.login.record")
|
|
||||||
public Object pageData(@Param(value = "keyWord",required = false) String keyWord,
|
|
||||||
@Param(value = "searchName",required = false) String searchName,
|
|
||||||
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
|
||||||
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
|
|
||||||
@Param(value = "pageOrderName",required = false) String pageOrderName,
|
|
||||||
@Param(value = "pageOrderBy",required = false) String pageOrderBy) throws IOException {
|
|
||||||
String cnd = "";
|
|
||||||
|
|
||||||
if (Strings.isNotBlank(keyWord)) {
|
|
||||||
cnd = " _.or([{\n" +
|
|
||||||
" loginname: db.RegExp({\n" +
|
|
||||||
" regexp: '" + keyWord + "',\n" +
|
|
||||||
" options: 'i',\n" +
|
|
||||||
" })},{\n" +
|
|
||||||
" username: db.RegExp({\n" +
|
|
||||||
" regexp: '" + keyWord + "',\n" +
|
|
||||||
" options: 'i',\n" +
|
|
||||||
" })\n" +
|
|
||||||
" }]).and({schoolCode:'" + Globals.schoolCode + "'})";
|
|
||||||
} else {
|
|
||||||
cnd = "{schoolCode:'" + Globals.schoolCode + "'}";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
|
|
||||||
|
|
||||||
String query = "db.collection('login_record').where(" + cnd
|
|
||||||
+ ").field({ data: false }).skip(" + skip + ").limit(" + pageSize + ").get()";
|
|
||||||
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
|
|
||||||
NutMap pager = result.getAs("pager", NutMap.class);
|
|
||||||
|
|
||||||
List<Map> list = result.getList("data", Map.class);
|
|
||||||
list.forEach(v -> {
|
|
||||||
String openid = (String) v.get("openid");
|
|
||||||
v.put("openid", openid.substring(0, 3) + "******" + openid.substring(openid.length() - 3));
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@RequiresPermissions("jsz.login.record")
|
|
||||||
public Object delete(String[] ids) throws IOException {
|
|
||||||
try {
|
|
||||||
String s = "db.collection('login_record').where({_id:_.in(" + Json.toJson(ids) + ")}).remove()\n";
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s);
|
|
||||||
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@RequiresPermissions("jsz.login.record")
|
|
||||||
public Object deleteAll() throws IOException {
|
|
||||||
try {
|
|
||||||
String s = "db.collection('login_record').where({schoolCode: _.eq('" + Globals.schoolCode + "')}).remove()\n";
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s);
|
|
||||||
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.nutz.dao.Sqls;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.dao.util.Daos;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @FileName io.v.nutz.jsz.controller.pc.JszPrizeController
|
|
||||||
* @Description: TODO
|
|
||||||
* @Author zxc
|
|
||||||
* @Date 2022/9/8:15:06
|
|
||||||
* @Version V1.0
|
|
||||||
**/
|
|
||||||
@IocBean
|
|
||||||
@At("/platform/jsz/prize")
|
|
||||||
public class JszPrizeController {
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/pc/prize.html")
|
|
||||||
@RequiresAuthentication
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Dao dao;
|
|
||||||
|
|
||||||
private String getSql() {
|
|
||||||
return """
|
|
||||||
SELECT
|
|
||||||
u.loginname,
|
|
||||||
u.username,
|
|
||||||
u.unionname,
|
|
||||||
u.unitname,
|
|
||||||
al.applyDate,
|
|
||||||
date_format(al.applyDate,'%Y-%m-%d') as prizeData
|
|
||||||
FROM
|
|
||||||
`jsz_award_list` al
|
|
||||||
LEFT JOIN `user` u ON u.id = al.userId
|
|
||||||
$condition
|
|
||||||
""";
|
|
||||||
}
|
|
||||||
|
|
||||||
@At("/prizeDataList")
|
|
||||||
@Ok("json:full")
|
|
||||||
@ViReturn
|
|
||||||
public Object prizeDataList(@Param("activityId") String activityId) {
|
|
||||||
Date toDay = new Date();
|
|
||||||
|
|
||||||
Sql sql = Sqls.create(getSql());
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("activityId", "=", activityId);
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
List<NutMap> list = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
|
||||||
|
|
||||||
List<NutMap> yesterdayList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(DateUtil.offsetDay(toDay, -1), "yyyy-MM-dd"))).collect(Collectors.toList());
|
|
||||||
// List<NutMap> toDayList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(toDay, "yyyy-MM-dd"))).collect(Collectors.toList());
|
|
||||||
|
|
||||||
return Map.of("toDayList", Collections.emptyList(), "yesterdayList", yesterdayList, "totalList", list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@At("/exportExcel")
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresAuthentication
|
|
||||||
public void exportExcel(@Param("activityId") String activityId,
|
|
||||||
@Param("currentSelectedType") String currentSelectedType,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
Date toDay = new Date();
|
|
||||||
|
|
||||||
Sql sql = Sqls.create(getSql());
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("activityId", "=", activityId);
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
|
|
||||||
List<NutMap> exportList = new ArrayList<>();
|
|
||||||
|
|
||||||
List<NutMap> list = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
|
||||||
if ("yesterdayList".equals(currentSelectedType)) {
|
|
||||||
exportList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(DateUtil.offsetDay(toDay, -1), "yyyy-MM-dd"))).collect(Collectors.toList());
|
|
||||||
} else {
|
|
||||||
exportList = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
|
||||||
add(new ExcelExportEntity("姓名", "username", 20));
|
|
||||||
add(new ExcelExportEntity("工号", "loginname", 20));
|
|
||||||
add(new ExcelExportEntity("单位", "unitname", 20));
|
|
||||||
add(new ExcelExportEntity("分工会", "unionname", 20));
|
|
||||||
add(new ExcelExportEntity("日期", "prizeData", 20));
|
|
||||||
}};
|
|
||||||
|
|
||||||
try {
|
|
||||||
ViTool.excelResponse(response, "导出数据.xlsx");
|
|
||||||
ExportParams exportParams = new ExportParams();
|
|
||||||
exportParams.setType(ExcelType.XSSF);
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, exportList);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.page.Pagination;
|
|
||||||
import io.v.nutz.base.service.BaseService;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.dao.Sqls;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*
|
|
||||||
* @Author zhf
|
|
||||||
* @Date 2022/9/9 14:07
|
|
||||||
*/
|
|
||||||
@IocBean
|
|
||||||
@At("/platform/jsz/StepCountingRank")
|
|
||||||
public class JszStepCountingRankCon {
|
|
||||||
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/pc/stepCountingRank.html")
|
|
||||||
@RequiresPermissions("jsz.StepCountingRank")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BaseService baseService;
|
|
||||||
|
|
||||||
private String getSql() {
|
|
||||||
return """
|
|
||||||
SELECT
|
|
||||||
u.loginname,
|
|
||||||
u.username,
|
|
||||||
u.unionname,
|
|
||||||
u.unitname,
|
|
||||||
al.applyDate,
|
|
||||||
al.step,
|
|
||||||
date_format(al.applyDate,'%Y-%m-%d') as prizeData
|
|
||||||
FROM
|
|
||||||
`jsz_wx_step` al
|
|
||||||
LEFT JOIN `user` u ON u.id = al.userId
|
|
||||||
$condition
|
|
||||||
""";
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("json:full")
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.StepCountingRank")
|
|
||||||
public Object pageData(PageForm pageForm,
|
|
||||||
@Param(value = "year",required = false) Integer year,
|
|
||||||
@Param(value = "hdid",required = false) String hdid,
|
|
||||||
@Param(value = "activityDate",required = false) String[] activityDate,
|
|
||||||
@Param(value = "unionId",required = false) String unionId,
|
|
||||||
@Param(value = "unitId",required = false) String unitId) {
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
Sql sql = Sqls.create(getSql());
|
|
||||||
if (Lang.isNotEmpty(activityDate)) {
|
|
||||||
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[0]);
|
|
||||||
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[1]);
|
|
||||||
}
|
|
||||||
cnd.andEX("YEAR(al.applyDate)", "=", year);
|
|
||||||
cnd.andEX("al.activityId", "=", hdid);
|
|
||||||
cnd.andEX("u.unionid", "=", unionId);
|
|
||||||
cnd.andEX("u.unitId", "=", unitId);
|
|
||||||
cnd.desc("al.step");
|
|
||||||
cnd.desc("u.unioncode");
|
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
|
||||||
return pagination;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At("/exportExcel")
|
|
||||||
@Ok("void")
|
|
||||||
@RequiresAuthentication
|
|
||||||
@RequiresPermissions("jsz.StepCountingRank")
|
|
||||||
public void exportExcel(@Param(value = "hdid",required = false) String hdid,
|
|
||||||
@Param(value = "activityDate",required = false) String[] activityDate,
|
|
||||||
@Param(value = "unionId",required = false) String unionId,
|
|
||||||
@Param(value = "unitId",required = false) String unitId, HttpServletResponse response) {
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
Sql sql = Sqls.create(getSql());
|
|
||||||
if (activityDate.length > 0) {
|
|
||||||
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[0]);
|
|
||||||
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[1]);
|
|
||||||
}
|
|
||||||
cnd.andEX("al.activityId", "=", hdid);
|
|
||||||
cnd.andEX("u.unionid", "=", unionId);
|
|
||||||
cnd.andEX("u.unitId", "=", unitId);
|
|
||||||
cnd.desc("al.step");
|
|
||||||
cnd.desc("u.unioncode");
|
|
||||||
|
|
||||||
List<NutMap> exportList = baseService.listMap(sql);
|
|
||||||
|
|
||||||
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
|
||||||
add(new ExcelExportEntity("姓名", "username", 20));
|
|
||||||
add(new ExcelExportEntity("工号", "loginname", 20));
|
|
||||||
add(new ExcelExportEntity("单位", "unitname", 20));
|
|
||||||
add(new ExcelExportEntity("分工会", "unionname", 20));
|
|
||||||
add(new ExcelExportEntity("当前步数", "step", 20));
|
|
||||||
add(new ExcelExportEntity("日期", "prizeData", 20));
|
|
||||||
}};
|
|
||||||
|
|
||||||
try {
|
|
||||||
ViTool.excelResponse(response, "导出数据.xlsx");
|
|
||||||
ExportParams exportParams = new ExportParams();
|
|
||||||
exportParams.setType(ExcelType.XSSF);
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, exportList);
|
|
||||||
workbook.write(response.getOutputStream());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import cn.wizzer.framework.page.Pagination;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
import io.v.nutz.base.utils.WxHttpUtil;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.json.Json;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheRemove;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheResult;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: Aaron
|
|
||||||
* @create: 2020-09-03 14:12
|
|
||||||
* @description: 健身走题库管理
|
|
||||||
**/
|
|
||||||
@At("/platform/jsz/tkMange")
|
|
||||||
@Ok("json")
|
|
||||||
@IocBean
|
|
||||||
@RequiresAuthentication
|
|
||||||
@CacheDefaults(cacheName = "jsz_topic")
|
|
||||||
public class TkMangeController {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WxHttpUtil wxHttpUtil;
|
|
||||||
|
|
||||||
@At("")
|
|
||||||
@Ok("beetl:/platform/jsz/pc/TkMange.html")
|
|
||||||
@RequiresPermissions("jsz.tkmange")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("jsz.tkmange")
|
|
||||||
public Object pageData(@Param(value = "searchName",required = false) String searchName,
|
|
||||||
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
|
||||||
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize) {
|
|
||||||
try {
|
|
||||||
List and = new ArrayList<>();
|
|
||||||
|
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
|
||||||
and.add("" + searchName + ":{$regex:'" + searchKeyword + "',$options: 'i'}");
|
|
||||||
}
|
|
||||||
|
|
||||||
int skip = pageNumber == 1 ? 0 : (pageNumber - 1) * pageSize;
|
|
||||||
|
|
||||||
String query = "db.collection('topic')\n" +
|
|
||||||
" .where({" + StringUtils.join(and, ",") + "})\n" +
|
|
||||||
" .skip(0)\n" +
|
|
||||||
" .limit(10)\n" +
|
|
||||||
" .get()";
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
|
|
||||||
NutMap pager = result.getAs("pager", NutMap.class);
|
|
||||||
|
|
||||||
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), result.getList("data", Map.class));
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@RequiresPermissions("jsz.tkmange")
|
|
||||||
public Object doAdd(String issue) {
|
|
||||||
try {
|
|
||||||
NutMap map = Json.fromJson(NutMap.class, issue);
|
|
||||||
StringBuffer optionsBuffer = new StringBuffer("");
|
|
||||||
NutMap[] options = map.getArray("options", NutMap.class);
|
|
||||||
for (int i = 0; i < options.length; i++) {
|
|
||||||
NutMap op = options[i];
|
|
||||||
optionsBuffer.append("{" +
|
|
||||||
"option_name:'" + op.getString("option_name") + "'," +
|
|
||||||
"option_iswor:" + op.getBoolean("option_iswor") + "" +
|
|
||||||
"}");
|
|
||||||
if (i < options.length - 1) {
|
|
||||||
optionsBuffer.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String query = "db.collection('topic')\n" +
|
|
||||||
" .add({\n" +
|
|
||||||
" data: [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" issue_multiple: " + map.getBoolean("issue_multiple") + ",\n" +
|
|
||||||
" issue_name: '" + map.getString("issue_name") + "',\n" +
|
|
||||||
" options: [" + optionsBuffer.toString() + "]\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
" })";
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.insertUrl, query);
|
|
||||||
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@CacheResult
|
|
||||||
@RequiresPermissions("jsz.tkmange")
|
|
||||||
public Object findOne(String id) throws IOException {
|
|
||||||
String query = "db.collection('topic').doc('" + id + "').get()";
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
|
|
||||||
List<Map> data = wxResult.getList("data", Map.class);
|
|
||||||
return data.size() > 0 ? data.get(0) : new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@CacheRemoveAll
|
|
||||||
@RequiresPermissions("jsz.tkmange")
|
|
||||||
public Object doEdit(String issue) {
|
|
||||||
try {
|
|
||||||
NutMap map = Json.fromJson(NutMap.class, issue);
|
|
||||||
StringBuffer optionsBuffer = new StringBuffer("");
|
|
||||||
NutMap[] options = map.getArray("options", NutMap.class);
|
|
||||||
for (int i = 0; i < options.length; i++) {
|
|
||||||
NutMap op = options[i];
|
|
||||||
optionsBuffer.append("{" +
|
|
||||||
"option_name:'" + op.getString("option_name") + "'," +
|
|
||||||
"option_iswor:" + op.getBoolean("option_iswor") + "" +
|
|
||||||
"}");
|
|
||||||
if (i < options.length - 1) {
|
|
||||||
optionsBuffer.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String query = "db.collection('topic').doc('" + map.getString("_id") + "')\n" +
|
|
||||||
" .update({\n" +
|
|
||||||
" data: {\n" +
|
|
||||||
" issue_multiple: " + map.getBoolean("issue_multiple") + ",\n" +
|
|
||||||
" issue_name: '" + map.getString("issue_name") + "',\n" +
|
|
||||||
" options: [" + optionsBuffer.toString() + "]\n" +
|
|
||||||
" }\n" +
|
|
||||||
" })";
|
|
||||||
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.updateUrl, query);
|
|
||||||
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@CacheRemove
|
|
||||||
@RequiresPermissions("jsz.tkmange")
|
|
||||||
public Object delete(String id) throws IOException {
|
|
||||||
String query = "db.collection('topic').doc('" + id + "').remove()";
|
|
||||||
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, query);
|
|
||||||
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.controller.pc;
|
|
||||||
|
|
||||||
import cn.hutool.captcha.generator.RandomGenerator;
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
|
||||||
|
|
||||||
import io.v.nutz.zhgh.jsz.models.JszWxStep;
|
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.nutz.dao.Sqls;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.dao.util.Daos;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
|
||||||
import org.nutz.mvc.annotation.Ok;
|
|
||||||
import org.nutz.mvc.annotation.Param;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @FileName io.v.nutz.jsz.controller.pc.stepCountingController
|
|
||||||
* @Description: TODO
|
|
||||||
* @Author zxc
|
|
||||||
* @Date 2022/9/6:14:39
|
|
||||||
* @Version V1.0
|
|
||||||
**/
|
|
||||||
@IocBean
|
|
||||||
@At("/platform/jsz/stepCounting")
|
|
||||||
public class stepCountingController {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Dao dao;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SysUserService sysUserService;
|
|
||||||
|
|
||||||
@At("/sendSmsCode")
|
|
||||||
@Ok("json:full")
|
|
||||||
public Object sendSmsCode(@Param("loginName") String loginName) {
|
|
||||||
int count = dao.count(Sys_user.class, Cnd.where("loginName", "=", loginName));
|
|
||||||
if (count == 0) {
|
|
||||||
return Result.error("系统中查询不到您的工号!");
|
|
||||||
}
|
|
||||||
RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
|
|
||||||
String code = randomGenerator.generate();
|
|
||||||
try {
|
|
||||||
// sendMsg.sendTextMesg(loginName, "健步走验证码:" + code);
|
|
||||||
return Result.success().addData(code);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At("/getUserInfo")
|
|
||||||
@Ok("json:full")
|
|
||||||
public Object getUserInfo(@Param("loginName") String loginName) {
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
u.id userid,
|
|
||||||
u.username,
|
|
||||||
u.loginname,
|
|
||||||
u.sex,
|
|
||||||
u.mobile,
|
|
||||||
u.birthday,
|
|
||||||
unit.`name` unitname,
|
|
||||||
u.unitid,
|
|
||||||
u.member,
|
|
||||||
unit.unionid,
|
|
||||||
un.unionname,
|
|
||||||
group_concat(sr.`code`) roles
|
|
||||||
FROM
|
|
||||||
sys_user u
|
|
||||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
|
||||||
LEFT JOIN sys_union un ON unit.unionid = un.id
|
|
||||||
LEFT JOIN sys_user_role sur ON sur.userId = u.id
|
|
||||||
LEFT JOIN sys_role sr ON sr.id = sur.roleId
|
|
||||||
$condition
|
|
||||||
""");
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("LOWER(u.loginname)", "=", loginName.toLowerCase());
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
NutMap userMap = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
|
|
||||||
if (StrUtil.isBlank(userMap.getString("userid"))) {
|
|
||||||
return Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
|
|
||||||
}
|
|
||||||
return Result.success().addData(userMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get week step
|
|
||||||
*
|
|
||||||
* @param userId user id
|
|
||||||
* @return {@link Object}
|
|
||||||
*/
|
|
||||||
@At("/getWeekStep")
|
|
||||||
@Ok("json:full")
|
|
||||||
@ViReturn
|
|
||||||
public Object getWeekStep(@Param("userId") String userId, @Param("activityId") String activityId) {
|
|
||||||
Assert.notBlank(activityId);
|
|
||||||
Assert.notBlank(userId);
|
|
||||||
Cnd cnd = Cnd.where("userId", "=", userId);
|
|
||||||
cnd.and("activityId", "=", activityId);
|
|
||||||
cnd.and("applyDate", ">", DateUtil.offsetDay(new Date(), -7));
|
|
||||||
cnd.asc("applyDate");
|
|
||||||
List<JszWxStep> wxSteps = dao.query(JszWxStep.class, cnd);
|
|
||||||
|
|
||||||
List<HashMap> results = new ArrayList<>();
|
|
||||||
for (int i = 7; i >= 0; i--) {
|
|
||||||
int offset = (i) * -1;
|
|
||||||
DateTime offsetDay = DateUtil.offsetDay(new Date(), offset);
|
|
||||||
String dateStr = offsetDay.toString("yyyy-MM-dd");
|
|
||||||
|
|
||||||
Optional<JszWxStep> jszWxStepOptional = wxSteps.stream().filter(v -> DateUtil.format(v.getApplyDate(), "yyyy-MM-dd").equals(dateStr)).findFirst();
|
|
||||||
|
|
||||||
results.add(new HashMap<>() {{
|
|
||||||
put("day", dateStr);
|
|
||||||
put("step", jszWxStepOptional.isPresent() ? jszWxStepOptional.get().getStep() : 0);
|
|
||||||
}});
|
|
||||||
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新步数
|
|
||||||
*
|
|
||||||
* @param activityId 活动id
|
|
||||||
* @param userId 用户id
|
|
||||||
* @param step 一步
|
|
||||||
* @return {@link Object}
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@Ok("json:full")
|
|
||||||
@ViReturn
|
|
||||||
public Object updateStep(String activityId, String userId, Integer step) {
|
|
||||||
Assert.notBlank(activityId);
|
|
||||||
Assert.notBlank(userId);
|
|
||||||
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("userId", "=", userId);
|
|
||||||
cnd.and("applyDate", "=", io.v.nutz.base.utils.DateUtil.getDate());
|
|
||||||
cnd.and("activityId", "=", activityId);
|
|
||||||
|
|
||||||
JszWxStep wxStep = dao.fetch(JszWxStep.class, cnd);
|
|
||||||
if (Lang.isEmpty(wxStep)) {
|
|
||||||
wxStep = new JszWxStep();
|
|
||||||
wxStep.setActivityId(activityId);
|
|
||||||
wxStep.setUserId(userId);
|
|
||||||
wxStep.setApplyDate(new Date());
|
|
||||||
}
|
|
||||||
wxStep.setStep(step);
|
|
||||||
dao.insertOrUpdate(wxStep);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.nutz.dao.entity.annotation.*;
|
|
||||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
* 健身走获奖名单
|
|
||||||
*
|
|
||||||
* @Author zhf
|
|
||||||
* @Date 2022/9/8 9:24
|
|
||||||
*/
|
|
||||||
@Table
|
|
||||||
@Data
|
|
||||||
public class JszAwardList {
|
|
||||||
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Name
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@PrevInsert(uu32 = true)
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(type = ColType.VARCHAR)
|
|
||||||
@Comment("活动")
|
|
||||||
private String activityId;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@Comment("姓名Id")
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(type = ColType.DATETIME)
|
|
||||||
@Comment("时间")
|
|
||||||
private Date applyDate;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.nutz.dao.entity.annotation.*;
|
|
||||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*
|
|
||||||
* @Author zhf
|
|
||||||
* @Date 2022/9/6 15:06
|
|
||||||
*/
|
|
||||||
@Table
|
|
||||||
@Data
|
|
||||||
public class JszWxStep {
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Name
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@PrevInsert(uu32 = true)
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(type = ColType.VARCHAR)
|
|
||||||
@Comment("时间")
|
|
||||||
private String activityId;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@Comment("姓名Id")
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(customType = "int")
|
|
||||||
@Comment("步数")
|
|
||||||
private Integer step;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@ColDefine(type = ColType.DATE)
|
|
||||||
@Comment("时间")
|
|
||||||
private Date applyDate;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
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.util.List;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
//@Table
|
|
||||||
@Data
|
|
||||||
public class Jsz_activity extends BaseModel {
|
|
||||||
|
|
||||||
@Name
|
|
||||||
@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 _id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动模式")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
|
||||||
private String activityModel;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("校内")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("报名开始时间")
|
|
||||||
private Long apply_start_time;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("报名截至时间")
|
|
||||||
private Long apply_end_time;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("控制方式")
|
|
||||||
@ColDefine(type = ColType.INT, width = 1)
|
|
||||||
private Integer checkControl;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("打卡完成提示信息")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String check_all_msg;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动开始时间")
|
|
||||||
private Long start_time;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动截至时间")
|
|
||||||
private Long end_time;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动人员范围组别")
|
|
||||||
@ColDefine(type = ColType.INT, width = 1)
|
|
||||||
private Integer groupId;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("点位答题")
|
|
||||||
@ColDefine(type = ColType.BOOLEAN)
|
|
||||||
private Boolean hasAnswer;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("线路点位信息")
|
|
||||||
@ColDefine(type = ColType.BOOLEAN)
|
|
||||||
private List<String> linePoints;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动名称")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动介绍")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Table
|
|
||||||
@Data
|
|
||||||
public class Jsz_backup extends BaseModel {
|
|
||||||
|
|
||||||
@Name
|
|
||||||
@Comment("ID")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@PrevInsert(uu32 = true)
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("集合名称")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
|
||||||
private String collection;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("文件路径")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
|
||||||
private String filePath;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("文件名")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("备份日期")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
|
||||||
private String backUpDate;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
import org.nutz.dao.entity.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/24 10:04
|
|
||||||
* @Description: TODO
|
|
||||||
*/
|
|
||||||
@Table("Jsz_fillcheck")
|
|
||||||
public class Jsz_fillcheck {
|
|
||||||
@Column
|
|
||||||
@Name
|
|
||||||
@Comment("ID")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@Prev(els = {@EL("uuid()")})
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("用户名")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String loginname;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("姓名")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("校区")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String campus;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("签到时间")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
|
||||||
private String check_time;
|
|
||||||
|
|
||||||
public String getCheck_time() {
|
|
||||||
return check_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCheck_time(String check_time) {
|
|
||||||
this.check_time = check_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLoginname() {
|
|
||||||
return loginname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoginname(String loginname) {
|
|
||||||
this.loginname = loginname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCampus() {
|
|
||||||
return campus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCampus(String campus) {
|
|
||||||
this.campus = campus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 健身走打卡记录
|
|
||||||
*
|
|
||||||
* @author jug
|
|
||||||
* @date 2024/01/30
|
|
||||||
*/
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
//@Table
|
|
||||||
@Data
|
|
||||||
public class Jsz_sign extends BaseModel {
|
|
||||||
|
|
||||||
@Name
|
|
||||||
@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 _id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("_openid")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
private String _openid;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("活动id")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
private String activity_id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("签到坐标")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("签到点位编码")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
|
||||||
private String pts_code;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("签到时间")
|
|
||||||
private Long signDate;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("工号")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
|
||||||
private String loginname;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.models;
|
|
||||||
|
|
||||||
import org.nutz.dao.DB;
|
|
||||||
import org.nutz.dao.entity.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 1V
|
|
||||||
* @DateTime: 2020/9/1 9:42
|
|
||||||
* @Description: 活动类型
|
|
||||||
*/
|
|
||||||
@Table("Jsz_type")
|
|
||||||
public class Jsz_type {
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Name
|
|
||||||
@Comment("ID")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
|
||||||
@Prev(els = {@EL("uuid()")})
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("类型名称")
|
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("排序")
|
|
||||||
@Prev({
|
|
||||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM Jsz_type"),
|
|
||||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM Jsz_type")
|
|
||||||
})
|
|
||||||
private Integer location;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(Integer location) {
|
|
||||||
this.location = location;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.services;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.service.BaseService;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 1V
|
|
||||||
*/
|
|
||||||
public interface JszFillCheckService extends BaseService<Jsz_fillcheck> {
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.services;
|
|
||||||
|
|
||||||
|
|
||||||
import io.v.nutz.base.service.BaseService;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.Jsz_type;
|
|
||||||
|
|
||||||
public interface JszTypeService extends BaseService<Jsz_type> {
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.services;
|
|
||||||
|
|
||||||
import io.v.nutz.zhgh.jsz.models.JszWxStep;
|
|
||||||
import io.v.nutz.base.service.ViService;
|
|
||||||
|
|
||||||
public interface JszWxStepService extends ViService<JszWxStep> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取今天当前用户最新步数
|
|
||||||
*/
|
|
||||||
Object getStepByUserId(String userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当日榜或者累计排榜榜
|
|
||||||
*
|
|
||||||
* @param hdid: 活动id
|
|
||||||
* @param type: 0-当日榜, 1-累计排行榜
|
|
||||||
* @return null
|
|
||||||
* @author JyuHsin
|
|
||||||
* @date 2022/9/7
|
|
||||||
*/
|
|
||||||
Object getDataOfLeaderboard(String hdid, Integer type, String userId, String unionId, String unitId, String searchName, String searchKeyword);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当日中奖榜
|
|
||||||
*
|
|
||||||
* @param hdid: 活动id
|
|
||||||
* @return java.lang.Object
|
|
||||||
* @author JyuHsin
|
|
||||||
* @date 2022/9/7
|
|
||||||
*/
|
|
||||||
Object getDataOfPrize(String hdid, String unionId, String unitId, String searchName, String searchKeyword);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.services.impl;
|
|
||||||
|
|
||||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszFillCheckService;
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 1V
|
|
||||||
*/
|
|
||||||
@IocBean(args = {"refer:dao"})
|
|
||||||
public class JszFillCheckServiceImpl extends BaseServiceImpl<Jsz_fillcheck> implements JszFillCheckService {
|
|
||||||
|
|
||||||
public JszFillCheckServiceImpl(Dao dao) {
|
|
||||||
super(dao);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.services.impl;
|
|
||||||
|
|
||||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.Jsz_type;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszTypeService;
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
|
||||||
|
|
||||||
|
|
||||||
@IocBean(args = {"refer:dao"})
|
|
||||||
@CacheDefaults(cacheName = "jsz_type")
|
|
||||||
public class JszTypeServiceImpl extends BaseServiceImpl<Jsz_type> implements JszTypeService {
|
|
||||||
|
|
||||||
public JszTypeServiceImpl(Dao dao) {
|
|
||||||
super(dao);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
package io.v.nutz.zhgh.jsz.services.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
|
||||||
import io.v.nutz.zhgh.jsz.models.JszWxStep;
|
|
||||||
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
|
|
||||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.nutz.dao.Sqls;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*
|
|
||||||
* @Author zhf
|
|
||||||
* @Date 2022/9/6 15:12
|
|
||||||
*/
|
|
||||||
@IocBean(args = {"refer:dao"})
|
|
||||||
public class JszWxStepServiceImpl extends ViServiceImpl<JszWxStep> implements JszWxStepService {
|
|
||||||
public JszWxStepServiceImpl(Dao dao) {
|
|
||||||
super(dao);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getStepByUserId(String userId) {
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("userId", "=", userId).and("applyDate", "=", DateUtil.today());
|
|
||||||
return fetch(cnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getDataOfLeaderboard(String hdid, Integer type, String userId, String unionId, String unitId, String searchName, String searchKeyword) {
|
|
||||||
Sys_user user = dao().fetch(Sys_user.class, userId);
|
|
||||||
CndPlus cnd = CndPlus.create();
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
userId,
|
|
||||||
sum(step) as step,
|
|
||||||
u.username,
|
|
||||||
u.loginname
|
|
||||||
FROM
|
|
||||||
`jsz_wx_step` step
|
|
||||||
LEFT JOIN sys_user u ON step.userId = u.id
|
|
||||||
$condition
|
|
||||||
""");
|
|
||||||
//0查当日
|
|
||||||
if (type == 0) {
|
|
||||||
cnd.and("left(applyDate, 10)", "=", DateUtil.today());
|
|
||||||
}
|
|
||||||
cnd.and("activityId", "=", hdid);
|
|
||||||
cnd.andEx("u.unitId", "=", unitId);
|
|
||||||
cnd.andEx("u.unionId", "=", unionId);
|
|
||||||
|
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
|
||||||
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
cnd.groupBy("userId");
|
|
||||||
cnd.desc("step");
|
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
List<NutMap> lists = listMap(sql);
|
|
||||||
|
|
||||||
Sql sqlMy = sql.duplicate().setCondition(cnd.clone().and("userId", "=", userId));
|
|
||||||
List<NutMap> myStep = listMap(sqlMy);
|
|
||||||
|
|
||||||
if (Lang.isEmpty(myStep)) {
|
|
||||||
NutMap map = NutMap.NEW().setv("username", user.getUsername())
|
|
||||||
.setv("loginname", user.getLoginname())
|
|
||||||
.setv("userId", user.getId())
|
|
||||||
.setv("step", 0);
|
|
||||||
myStep.add(map);
|
|
||||||
}
|
|
||||||
lists.addAll(0, myStep);
|
|
||||||
return lists;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getDataOfPrize(String hdid, String unionId, String unitId, String searchName, String searchKeyword) {
|
|
||||||
|
|
||||||
CndPlus cnd = CndPlus.create();
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
userId,
|
|
||||||
u.username,
|
|
||||||
u.loginname,
|
|
||||||
un.`name` as unitname
|
|
||||||
FROM
|
|
||||||
`jsz_award_list` award
|
|
||||||
LEFT JOIN sys_user u ON award.userId = u.id
|
|
||||||
LEFT JOIN sys_unit un ON un.id = u.unitid
|
|
||||||
$condition
|
|
||||||
""");
|
|
||||||
cnd.and("activityId", "=", hdid);
|
|
||||||
cnd.and("left(applyDate, 10)", "=", DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd"));
|
|
||||||
|
|
||||||
cnd.andEx("u.unitId", "=", unitId);
|
|
||||||
cnd.andEx("u.unionId", "=", unionId);
|
|
||||||
|
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
|
||||||
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
cnd.groupBy("userId");
|
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
List<NutMap> nutMaps = listMap(sql);
|
|
||||||
return nutMaps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,9 +2,9 @@ package io.v.nutz.zhgh.welfare.controller;
|
|||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
|
|||||||
@@ -9,36 +9,42 @@ import cn.hutool.core.codec.Base64;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
import com.deepoove.poi.config.Configure;
|
import com.deepoove.poi.config.Configure;
|
||||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
|
import io.v.nutz.base.utils.ExpressSelectUtil;
|
||||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
import io.v.nutz.zhgh.member.service.MemberService;
|
|
||||||
import io.v.nutz.sys.models.Sys_dict;
|
import io.v.nutz.sys.models.Sys_dict;
|
||||||
import io.v.nutz.sys.services.SysDictService;
|
import io.v.nutz.sys.services.SysDictService;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
|
import io.v.nutz.zhgh.member.service.MemberService;
|
||||||
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareProvideMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareProvideMode;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
||||||
|
import io.v.nutz.zhgh.welfare.model.WelfareCourierNumber;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
||||||
|
import io.v.nutz.zhgh.welfare.model.WelfareUserSelection;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.nutz.dao.Chain;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.json.Json;
|
||||||
import org.nutz.lang.Lang;
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
@@ -71,13 +77,17 @@ public class WelfareCommonController {
|
|||||||
@Inject
|
@Inject
|
||||||
private MemberService memberService;
|
private MemberService memberService;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private WelfareProjectService projectService;
|
private WelfareProjectService projectService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OfficeTemplateUtil officeTemplateUtil;
|
private OfficeTemplateUtil officeTemplateUtil;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ExpressSelectUtil expressSelectUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询单个福利信息
|
* 查询单个福利信息
|
||||||
@@ -505,8 +515,8 @@ public class WelfareCommonController {
|
|||||||
public void exportReceive(String projectId,
|
public void exportReceive(String projectId,
|
||||||
String welfareUnit,
|
String welfareUnit,
|
||||||
@Param("welfareTwoUnit") String[] welfareTwoUnit,
|
@Param("welfareTwoUnit") String[] welfareTwoUnit,
|
||||||
@Param("personTypes")String[] personTypes,
|
@Param("personTypes") String[] personTypes,
|
||||||
@Param("userStates")String[] userStates,
|
@Param("userStates") String[] userStates,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
WelfareProject welfareProject = projectService.fetch(projectId);
|
WelfareProject welfareProject = projectService.fetch(projectId);
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
@@ -583,8 +593,86 @@ public class WelfareCommonController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看快递物流信息
|
||||||
|
*
|
||||||
|
* @param welfareId 福利id
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return {@link Object}
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
public Object courierNumberInfo(String welfareId, String userId) {
|
||||||
|
//查询的时候去触发福利最新信息
|
||||||
|
List<WelfareCourierNumber> welfareCourierNumberList = dao.query(WelfareCourierNumber.class, Cnd.where("welfareId", "=", welfareId).and("selectUserId", "=", userId));
|
||||||
|
for (WelfareCourierNumber courierNumber : welfareCourierNumberList) {
|
||||||
|
//如果有上次查询的时间
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(courierNumber.getSelectExpressDate()) && DateUtil.offsetHour(courierNumber.getSelectExpressDate(), 2).getTime() > new Date().getTime()) {
|
||||||
|
//还在有效期内
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(courierNumber.getLogisticsTrace()) && List.of("AGENT_SIGN", "SIGN").contains(courierNumber.getLogisticsTrace().getLogisticsStatus())) {
|
||||||
|
//签收了
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isEmpty(courierNumber.getCourierNumber())) {
|
||||||
|
//没快递单号
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
WelfareUserSelection userSelection = dao.fetch(WelfareUserSelection.class, Cnd.where("welfareId", "=", welfareId).and("selectUserId", "=", userId));
|
||||||
|
|
||||||
|
//需要去查询最新的物流信息
|
||||||
|
String receiveAddress = userSelection.getReceiveAddress();
|
||||||
|
String mobile = receiveAddress.substring(receiveAddress.length() - 11);
|
||||||
|
|
||||||
|
JSONObject jsonObject = expressSelectUtil.getExpressInfo(courierNumber.getCourierNumber(), mobile);
|
||||||
|
WelfareUserSelection.LogisticsTrace logisticsTrace = new WelfareUserSelection.LogisticsTrace();
|
||||||
|
logisticsTrace.setTheLastTime(jsonObject.getDate("theLastTime"));
|
||||||
|
logisticsTrace.setTheLastMessage(jsonObject.getString("theLastMessage"));
|
||||||
|
logisticsTrace.setLogisticsStatusDesc(jsonObject.getString("logisticsStatusDesc"));
|
||||||
|
logisticsTrace.setLogisticsStatus(jsonObject.getString("logisticsStatus"));
|
||||||
|
List<NutMap> logisticsTraceDetailList = Json.fromJsonAsList(NutMap.class, jsonObject.getString("logisticsTraceDetailList"));
|
||||||
|
logisticsTrace.setLogisticsTraceDetailList(logisticsTraceDetailList);
|
||||||
|
|
||||||
|
dao.update(WelfareCourierNumber.class,
|
||||||
|
Chain.make("logisticsTrace", logisticsTrace)
|
||||||
|
.add("selectExpressDate", new Date()),
|
||||||
|
Cnd.where("id", "=", courierNumber.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
wpso.optionName,
|
||||||
|
wpso.imgUrl,
|
||||||
|
wcn.courierNumber,
|
||||||
|
wcn.logisticsTrace
|
||||||
|
FROM
|
||||||
|
welfare_courier_number wcn
|
||||||
|
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wcn.selectOptionId
|
||||||
|
WHERE
|
||||||
|
wcn.welfareId = @welfareId
|
||||||
|
AND wcn.selectUserId = @userId
|
||||||
|
ORDER BY wpso.optionSort
|
||||||
|
""");
|
||||||
|
sql.setParam("welfareId", welfareId);
|
||||||
|
sql.setParam("userId", userId);
|
||||||
|
List<NutMap> list = projectService.listMap(sql);
|
||||||
|
|
||||||
|
for (NutMap nutMap : list) {
|
||||||
|
nutMap.put("logisticsTrace", nutMap.getAs("logisticsTrace", WelfareUserSelection.LogisticsTrace.class));
|
||||||
|
}
|
||||||
|
List<NutMap> mapList = sql.getList(NutMap.class);
|
||||||
|
|
||||||
|
Map<String, List<NutMap>> listMap = mapList.stream().collect(Collectors.groupingBy(v -> v.getString("optionName")));
|
||||||
|
return listMap;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+21
-2
@@ -4,8 +4,11 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.SimpleService;
|
import io.v.nutz.base.service.SimpleService;
|
||||||
|
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
||||||
|
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
@@ -13,6 +16,9 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
|||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName WelfareEvaluateStatisticsController
|
* @ClassName WelfareEvaluateStatisticsController
|
||||||
* @Description 评价统计
|
* @Description 评价统计
|
||||||
@@ -27,6 +33,9 @@ public class WelfareEvaluateStatisticsController {
|
|||||||
@Inject
|
@Inject
|
||||||
private SimpleService simpleService;
|
private SimpleService simpleService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/welfare/evaluateStatistics.html")
|
@Ok("beetl:/platform/welfare/evaluateStatistics.html")
|
||||||
@RequiresPermissions("welfare.evaluate.statistics")
|
@RequiresPermissions("welfare.evaluate.statistics")
|
||||||
@@ -35,8 +44,8 @@ public class WelfareEvaluateStatisticsController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.user.choose")
|
@RequiresPermissions("welfare.evaluate.statistics")
|
||||||
public Object pageData(PageForm pageForm, String projectId, String unionId, String unitId, String personType, String userState, Integer evaluateScore) {
|
public Object pageData(PageForm pageForm, String projectId, String unionId, String unitId, String personType, String userState, Integer evaluateScore, String optionId) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
we.evaluateText,
|
we.evaluateText,
|
||||||
@@ -67,8 +76,18 @@ public class WelfareEvaluateStatisticsController {
|
|||||||
cnd.andEX("u.personType", "=", personType);
|
cnd.andEX("u.personType", "=", personType);
|
||||||
cnd.andEX("u.userState", "=", userState);
|
cnd.andEX("u.userState", "=", userState);
|
||||||
cnd.andEX("we.evaluateScore", "=", evaluateScore);
|
cnd.andEX("we.evaluateScore", "=", evaluateScore);
|
||||||
|
cnd.andEX("optionId", "=", optionId);
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
return simpleService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
return simpleService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("welfare.evaluate.statistics")
|
||||||
|
public Object welfareOptions(String projectId) {
|
||||||
|
List<WelfareProjectSubject> subjects = dao.query(WelfareProjectSubject.class, Cnd.where("projectId", "=", projectId));
|
||||||
|
List<String> subjectIds = subjects.stream().map(v -> v.getId()).collect(Collectors.toList());
|
||||||
|
return dao.query(WelfareProjectSubjectOption.class, Cnd.where("subjectId", "in", subjectIds).asc("optionSort"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ import io.v.nutz.base.dao.CndPlus;
|
|||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
||||||
import io.v.nutz.zhgh.welfare.mode.CourierNumberExcelMode;
|
import io.v.nutz.zhgh.welfare.mode.CourierNumberExcelMode;
|
||||||
import io.v.nutz.zhgh.welfare.model.*;
|
import io.v.nutz.zhgh.welfare.model.*;
|
||||||
import io.v.nutz.zhgh.welfare.model.template.WelfareMemberSelectionTemp;
|
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareListService;
|
import io.v.nutz.zhgh.welfare.service.WelfareListService;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -41,7 +39,6 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.json.Json;
|
import org.nutz.json.Json;
|
||||||
import org.nutz.lang.Lang;
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.random.R;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.AdaptBy;
|
import org.nutz.mvc.annotation.AdaptBy;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
@@ -92,42 +89,62 @@ public class WelfareListController {
|
|||||||
public Object pageData(PageForm pageForm,
|
public Object pageData(PageForm pageForm,
|
||||||
WelfareFeature.Condition.PageParam pageParam,
|
WelfareFeature.Condition.PageParam pageParam,
|
||||||
@Param(value = "projectId", required = false) String projectId,
|
@Param(value = "projectId", required = false) String projectId,
|
||||||
@Param(value = "month", required = false) String month) {
|
@Param(value = "optionId", required = false) String optionId,
|
||||||
|
@Param(value = "month", required = false) String month,
|
||||||
|
@Param(value = "courierNumber", required = false) String courierNumber
|
||||||
|
) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
if(wus.selectUserId IS NOT NULL,1,0) AS isChoose,
|
CASE
|
||||||
wl.id,
|
|
||||||
wl.listId,
|
WHEN
|
||||||
wl.username,
|
wus.selectUserId IS NOT NULL THEN
|
||||||
wl.loginname,
|
1 ELSE 0
|
||||||
wl.personType,
|
END AS isChoose,
|
||||||
wl.userState,
|
wl.id,
|
||||||
wl.unionname,
|
wl.username,
|
||||||
wl.unitname,
|
wl.loginname,
|
||||||
wl.threeUnitName,
|
wl.personType,
|
||||||
wl.unionGroupName,
|
wl.userState,
|
||||||
wus.userSign,
|
wl.unionname,
|
||||||
wus.courierNumber,
|
wl.unitname,
|
||||||
wus.receiveAddress,
|
wl.listId,
|
||||||
GROUP_CONCAT( DISTINCT wuso.optionName, '(', wus.selectNum, '份)' ) AS gist_list
|
wus.userSign,
|
||||||
FROM
|
wus.courierNumber,
|
||||||
view_welfare_list wl
|
wus.receiveAddress,
|
||||||
LEFT JOIN welfare_project_user_selection wus ON wus.welfareId = wl.projectId
|
GROUP_CONCAT( DISTINCT wuso.optionName, '(', wus.selectNum, '份)' ) AS gist_list
|
||||||
AND wus.selectUserId = wl.id
|
FROM
|
||||||
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
view_welfare_list wl
|
||||||
LEFT JOIN welfare_project wp ON wp.id = wus.welfareId
|
LEFT JOIN welfare_project_user_selection wus ON wus.welfareId = wl.projectId
|
||||||
$condition
|
AND wus.selectUserId = wl.id
|
||||||
|
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
||||||
|
LEFT JOIN welfare_courier_number wcn on wcn.selectUserId = wl.id AND wcn.welfareId = wl.projectId
|
||||||
|
LEFT JOIN welfare_project wp ON wp.id = wus.welfareId
|
||||||
|
$condition
|
||||||
""");
|
""");
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
cnd.and(pageForm);
|
cnd.and(pageForm);
|
||||||
cnd.and("wl.projectId", "=", projectId);
|
cnd.and("wl.projectId", "=", projectId);
|
||||||
cnd.andEX("wl.unionid","=",pageParam.getWelfareUnit());
|
cnd.andEX("wus.selectOptionId", "=", optionId);
|
||||||
if (StrUtil.isNotBlank(pageParam.getUnits())) {
|
cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit());
|
||||||
String[] unitArray = Json.fromJsonAsArray(String.class, pageParam.getUnits());
|
cnd.andEX("wl.unitid", "=", pageParam.getUnit());
|
||||||
cnd.andEX("wl.unitid","in",unitArray);
|
|
||||||
|
if (Lang.isNotEmpty(pageParam.getPersonTypes())) {
|
||||||
|
String personTypes = pageParam.getPersonTypes();
|
||||||
|
String[] personTypeArray = Json.fromJsonAsArray(String.class, personTypes);
|
||||||
|
cnd.andEX("wl.personType", "in", personTypeArray);
|
||||||
}
|
}
|
||||||
cnd.andEX("wl.unionGroupId","=",pageParam.getUnionGroupId());
|
|
||||||
cnd.andEX("wl.threeUnitId","=",pageParam.getThreeUnitId());
|
if (Lang.isNotEmpty(pageParam.getUserStates())) {
|
||||||
|
String userStates = pageParam.getUserStates();
|
||||||
|
String[] userStateArray = Json.fromJsonAsArray(String.class, userStates);
|
||||||
|
cnd.andEX("wl.userState", "in", userStateArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
cnd.andEX("wl.sex", "in", pageParam.getSex());
|
||||||
|
|
||||||
|
cnd.andEX("wcn.courierNumber","=",courierNumber);
|
||||||
|
|
||||||
cnd.groupBy("wl.id");
|
cnd.groupBy("wl.id");
|
||||||
cnd.asc("wl.unitCode");
|
cnd.asc("wl.unitCode");
|
||||||
cnd.asc("wl.loginname");
|
cnd.asc("wl.loginname");
|
||||||
@@ -239,7 +256,9 @@ public class WelfareListController {
|
|||||||
selection.setSelectNum(v.getInt("selectNum"));
|
selection.setSelectNum(v.getInt("selectNum"));
|
||||||
return selection;
|
return selection;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
dao.insert(userSelections);
|
|
||||||
|
List<WelfareUserSelection> userSelections1 = userSelections.stream().filter(v -> v.getSelectNum() > 0).collect(Collectors.toList());
|
||||||
|
dao.insert(userSelections1);
|
||||||
dao.update(WelfareList.class,
|
dao.update(WelfareList.class,
|
||||||
Chain.make("isReceive", true),
|
Chain.make("isReceive", true),
|
||||||
Cnd.where("projectId", "=", editData.getString("projectId"))
|
Cnd.where("projectId", "=", editData.getString("projectId"))
|
||||||
@@ -274,7 +293,7 @@ public class WelfareListController {
|
|||||||
* @param projectId
|
* @param projectId
|
||||||
*/
|
*/
|
||||||
@At
|
@At
|
||||||
@Ok("json")
|
@Ok("void")
|
||||||
@RequiresPermissions("welfare.list.mange")
|
@RequiresPermissions("welfare.list.mange")
|
||||||
public void exportSelectData(String projectId, HttpServletResponse response) {
|
public void exportSelectData(String projectId, HttpServletResponse response) {
|
||||||
WelfareProject welfareProject = dao.fetch(WelfareProject.class, Cnd.where("id", "=", projectId));
|
WelfareProject welfareProject = dao.fetch(WelfareProject.class, Cnd.where("id", "=", projectId));
|
||||||
@@ -283,11 +302,10 @@ public class WelfareListController {
|
|||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
u.loginname,
|
u.loginname,
|
||||||
u.threeUnitName,
|
|
||||||
u.username,
|
u.username,
|
||||||
u.mobile,
|
u.mobile,
|
||||||
unionname,
|
vwl.unionname,
|
||||||
unitname,
|
vwl.unitname,
|
||||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||||
wpus.selectNum,
|
wpus.selectNum,
|
||||||
wpso.optionName
|
wpso.optionName
|
||||||
@@ -295,6 +313,7 @@ public class WelfareListController {
|
|||||||
welfare_project_user_selection wpus
|
welfare_project_user_selection wpus
|
||||||
left join `user` u on u.id = wpus.selectUserId
|
left join `user` u on u.id = wpus.selectUserId
|
||||||
left join welfare_project_subject_option wpso on wpso.id = wpus.selectOptionId
|
left join welfare_project_subject_option wpso on wpso.id = wpus.selectOptionId
|
||||||
|
left join view_welfare_list vwl on vwl.id = wpus.selectUserId
|
||||||
$condition
|
$condition
|
||||||
""");
|
""");
|
||||||
cnd.and("wpus.welfareId", "=", projectId);
|
cnd.and("wpus.welfareId", "=", projectId);
|
||||||
@@ -306,6 +325,7 @@ public class WelfareListController {
|
|||||||
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
||||||
cnd.and("u.unionGroupId", "is not", null);
|
cnd.and("u.unionGroupId", "is not", null);
|
||||||
}
|
}
|
||||||
|
cnd.groupBy("wpus.selectUserId", "wpus.selectOptionId");
|
||||||
cnd.asc("u.unitcode");
|
cnd.asc("u.unitcode");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
List<NutMap> list = projectService.listMap(sql);
|
List<NutMap> list = projectService.listMap(sql);
|
||||||
@@ -350,7 +370,10 @@ public class WelfareListController {
|
|||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
@RequiresPermissions("welfare.list.mange")
|
@RequiresPermissions("welfare.list.mange")
|
||||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
public Object importCourierNumber(@Param("file") TempFile file, @Param("projectId") String projectId) {
|
public Object importCourierNumber(@Param("file") TempFile file,
|
||||||
|
@Param("projectId") String projectId,
|
||||||
|
@Param("optionId") String optionId
|
||||||
|
) {
|
||||||
if (Lang.isEmpty(file)) {
|
if (Lang.isEmpty(file)) {
|
||||||
return Result.error("上传的文件不能为空");
|
return Result.error("上传的文件不能为空");
|
||||||
}
|
}
|
||||||
@@ -374,31 +397,68 @@ public class WelfareListController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (excelList.stream().anyMatch(v -> StrUtil.isBlank(v.getLoginName())) || excelList.stream().anyMatch(v -> StrUtil.isBlank(v.getCourierNumber()))) {
|
if (excelList.stream().anyMatch(v -> StrUtil.isBlank(v.getLoginName()))) {
|
||||||
return Result.error("工号和快递单号不能为空");
|
return Result.error("工号和快递单号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> loginNameCourierMap = excelList.stream().collect(Collectors.toMap(v -> v.getLoginName().replaceAll("\n", "").replaceAll("\t", "").trim(), v -> v.getCourierNumber()));
|
List<CourierNumberExcelMode> filterExcelList = excelList.stream().collect(Collectors.collectingAndThen(
|
||||||
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CourierNumberExcelMode::getLoginName))),
|
||||||
|
ArrayList::new
|
||||||
|
));
|
||||||
|
|
||||||
List<String> loginNameList = excelList.stream().map(v -> v.getLoginName().replaceAll("\n", "").replaceAll("\t", "").trim()).collect(Collectors.toList());
|
|
||||||
|
List<String> loginNameList = filterExcelList.stream().map(v -> v.getLoginName().replaceAll("\n", "").replaceAll("\t", "").trim()).collect(Collectors.toList());
|
||||||
Sql loginNameSql = Sqls.create("select id,loginname from sys_user where loginname in (@loginNameList)");
|
Sql loginNameSql = Sqls.create("select id,loginname from sys_user where loginname in (@loginNameList)");
|
||||||
loginNameSql.setParam("loginNameList", loginNameList);
|
loginNameSql.setParam("loginNameList", loginNameList);
|
||||||
List<NutMap> loginNameMaps = welfareListService.listMap(loginNameSql);
|
List<NutMap> loginNameMaps = welfareListService.listMap(loginNameSql);
|
||||||
|
|
||||||
Map<String, String> kvMap = loginNameMaps.stream().collect(Collectors.toMap(v -> v.getString("id"), v -> v.getString("loginname")));
|
|
||||||
|
|
||||||
List<String> userIds = loginNameMaps.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
List<String> userIds = loginNameMaps.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||||
List<WelfareUserSelection> userSelectionList = welfareListService.dao().query(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId).and("selectUserId", "in", userIds));
|
|
||||||
|
|
||||||
for (WelfareUserSelection us : userSelectionList) {
|
|
||||||
String loginName = kvMap.get(us.getSelectUserId());
|
//根据福利和选项删除本次导入的快递单号
|
||||||
String courierNumber = loginNameCourierMap.get(loginName);
|
welfareListService.dao().clear(WelfareCourierNumber.class,
|
||||||
us.setCourierNumber(courierNumber);
|
Cnd.where("welfareId", "=", projectId)
|
||||||
|
.and("selectUserId", "in", userIds)
|
||||||
|
.and("selectOptionId", "=", optionId));
|
||||||
|
|
||||||
|
List<WelfareCourierNumber> welfareCourierNumbers = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
for (NutMap map : loginNameMaps) {
|
||||||
|
String id = map.getString("id");
|
||||||
|
String loginname = map.getString("loginname");
|
||||||
|
CourierNumberExcelMode courierNumberExcelMode = filterExcelList.stream().filter(u -> u.getLoginName().replaceAll("\n", "").equals(loginname)).findFirst().orElse(null);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> courierNumberList = new ArrayList<>();
|
||||||
|
if (StrUtil.isNotBlank(courierNumberExcelMode.getOneCourierNumber())) {
|
||||||
|
courierNumberList.add(courierNumberExcelMode.getOneCourierNumber());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(courierNumberExcelMode.getTwoCourierNumber())) {
|
||||||
|
courierNumberList.add(courierNumberExcelMode.getTwoCourierNumber());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(courierNumberExcelMode.getThreeCourierNumber())) {
|
||||||
|
courierNumberList.add(courierNumberExcelMode.getThreeCourierNumber());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(courierNumberExcelMode.getFourCourierNumber())) {
|
||||||
|
courierNumberList.add(courierNumberExcelMode.getFourCourierNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String number : courierNumberList) {
|
||||||
|
WelfareCourierNumber courierNumber = new WelfareCourierNumber();
|
||||||
|
courierNumber.setCourierNumber(number);
|
||||||
|
courierNumber.setSelectUserId(id);
|
||||||
|
courierNumber.setWelfareId(projectId);
|
||||||
|
courierNumber.setSelectOptionId(optionId);
|
||||||
|
welfareCourierNumbers.add(courierNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
welfareListService.update(userSelectionList);
|
welfareListService.insert(welfareCourierNumbers);
|
||||||
|
|
||||||
return Result.success("导入成功");
|
return Result.success("导入成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
return Result.error("导入快递单号失败");
|
return Result.error("导入快递单号失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,91 +468,97 @@ public class WelfareListController {
|
|||||||
@At
|
@At
|
||||||
@Ok("void")
|
@Ok("void")
|
||||||
@RequiresPermissions("welfare.list.mange")
|
@RequiresPermissions("welfare.list.mange")
|
||||||
public void downloadImport(HttpServletResponse response) {
|
public void doExcelByOptionId(@Param(value = "projectId", required = false) String projectId,
|
||||||
try {
|
@Param(value = "optionId", required = false) String optionId,
|
||||||
ViTool.excelResponse(response, "福利导入模版.xlsx");
|
HttpServletResponse response) {
|
||||||
|
WelfareProject project = welfareListService.dao().fetch(WelfareProject.class, projectId);
|
||||||
|
WelfareProjectSubjectOption subjectOption = welfareListService.dao().fetch(WelfareProjectSubjectOption.class, optionId);
|
||||||
|
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
u.id,
|
||||||
|
u.loginname,
|
||||||
|
u.username,
|
||||||
|
wl.personType,
|
||||||
|
un.unionname,
|
||||||
|
it.`name` unitname,
|
||||||
|
wpus.selectNum
|
||||||
|
FROM
|
||||||
|
welfare_project_user_selection_copy1 wpus
|
||||||
|
LEFT JOIN `welfare_list` wl ON wpus.selectUserId = wl.userId
|
||||||
|
LEFT JOIN `sys_user` u ON u.id = wl.userId
|
||||||
|
LEFT JOIN sys_union un ON un.id = wl.welfareUnitId
|
||||||
|
LEFT JOIN sys_unit it ON it.id = wl.welfareSecondLevelUnitId
|
||||||
|
WHERE
|
||||||
|
wpus.welfareId = @welfareId
|
||||||
|
AND wpus.selectOptionId = @selectOptionId and wpus.selectNum!=0
|
||||||
|
|
||||||
|
""").setParam("welfareId", projectId).setParam("selectOptionId", optionId);
|
||||||
|
|
||||||
|
// GROUP BY wpus.selectUserId,wpus.selectOptionId ORDER BY un.unioncode
|
||||||
|
|
||||||
|
List<NutMap> mapList = welfareListService.listMap(sql);
|
||||||
|
|
||||||
|
List<String> userId = mapList.stream().map(m -> m.getString("id")).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<WelfareCourierNumber> courierNumberList = welfareListService.dao().query(WelfareCourierNumber.class,
|
||||||
|
Cnd.where("selectUserId", "in", userId)
|
||||||
|
.and("welfareId", "=", projectId)
|
||||||
|
.and("selectOptionId", "=", optionId));
|
||||||
|
|
||||||
|
List<String> nameList = List.of("one", "two", "three", "four");
|
||||||
|
for (NutMap map : mapList) {
|
||||||
|
List<WelfareCourierNumber> userCourierNumbers = courierNumberList.stream()
|
||||||
|
.filter(c -> c.getSelectUserId().equals(map.getString("id"))).collect(Collectors.toList());
|
||||||
|
for (int i = 0; i < userCourierNumbers.size(); i++) {
|
||||||
|
map.setv(nameList.get(i) + "CourierNumber", userCourierNumbers.get(i).getCourierNumber());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||||
|
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("人员类别", "personType", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("所在部门", "unitname", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("份数", "selectNum", 20));
|
||||||
|
for (int i = 0; i < nameList.size(); i++) {
|
||||||
|
exportEntities.add(new ExcelExportEntity("快递单号" + (i + 1), nameList.get(i) + "CourierNumber", 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> unitList = List.of("在职教职工", "劳务派遣", "空状态");
|
||||||
|
|
||||||
|
Workbook workbook = new XSSFWorkbook();
|
||||||
|
for (String un : unitList) {
|
||||||
|
List<NutMap> v = new ArrayList<>();
|
||||||
|
if (un.equals("在职教职工")) {
|
||||||
|
v = mapList.stream().filter(m -> StrUtil.isNotBlank(m.getString("personType")) &&
|
||||||
|
(!m.getString("personType").equals("劳务人才派遣") && !m.getString("personType").equals("其他类"))
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (un.equals("劳务派遣")) {
|
||||||
|
v = mapList.stream().filter(m -> StrUtil.isNotBlank(m.getString("personType")) &&
|
||||||
|
(m.getString("personType").equals("劳务人才派遣") || m.getString("personType").equals("其他类"))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (un.equals("空状态")) {
|
||||||
|
v = mapList.stream().filter(m -> StrUtil.isBlank(m.getString("personType"))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
ExcelExportService service = new ExcelExportService();
|
||||||
ExportParams exportParams = new ExportParams();
|
ExportParams exportParams = new ExportParams();
|
||||||
exportParams.setType(ExcelType.XSSF);
|
exportParams.setType(ExcelType.XSSF);
|
||||||
Workbook sheets = ExcelExportUtil.exportExcel(exportParams, WelfareMemberSelectionTemp.class, new ArrayList<>());
|
exportParams.setTitle(project.getName() + subjectOption.getOptionName() + "发放名单(" + un + ")");
|
||||||
ServletOutputStream outputStream = response.getOutputStream();
|
exportParams.setSheetName(un);
|
||||||
sheets.write(outputStream);
|
service.createSheetForMap(workbook, exportParams, exportEntities, v);
|
||||||
outputStream.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||||
|
ViTool.excelResponse(response, project.getName() + subjectOption.getOptionName() + ".xlsx");
|
||||||
|
workbook.write(outputStream);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入选择详情
|
|
||||||
*
|
|
||||||
* @param file
|
|
||||||
* @param projectId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@Ok("json")
|
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
|
||||||
@RequiresPermissions("welfare.list.mange")
|
|
||||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
|
||||||
public Object doImport(@Param("file") TempFile file, @Param("projectId") String projectId) {
|
|
||||||
if (Lang.isEmpty(file)) {
|
|
||||||
return Result.error("上传的文件不能为空");
|
|
||||||
}
|
|
||||||
String extName = FileUtil.extName(file.getFile());
|
|
||||||
if (!List.of("xls", "xlsx").contains(extName.toLowerCase())) {
|
|
||||||
return Result.error("请上传xls,xlsx文件");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<WelfareMemberSelectionTemp> welfareMemberSelectionImportList = ExcelImportUtil.importExcel(file.getFile(), WelfareMemberSelectionTemp.class, new ImportParams());
|
|
||||||
|
|
||||||
WelfareProject welfareProject = projectService.projectInfo(projectId);
|
|
||||||
List<WelfareProjectSubjectOption> options = welfareProject.getWelfareProjectSubjects().get(0).getOptions();
|
|
||||||
|
|
||||||
List<String> importLoginNameList = welfareMemberSelectionImportList.stream().map(v -> v.getLoginName()).collect(Collectors.toList());
|
|
||||||
List<Sys_user> userList = dao.query(Sys_user.class, Cnd.where("loginname", "in", importLoginNameList));
|
|
||||||
Map<String, Sys_user> userMap = userList.stream().collect(Collectors.toMap(Sys_user::getLoginname, v -> v));
|
|
||||||
|
|
||||||
try {
|
|
||||||
dao.clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId).and("selectUserId", "in", userList.stream().map(Sys_user::getId).collect(Collectors.toList())));
|
|
||||||
List<WelfareUserSelection> welfareUserSelectionList = new ArrayList<>();
|
|
||||||
welfareMemberSelectionImportList.forEach(v -> {
|
|
||||||
Sys_user user = userMap.get(v.getLoginName());
|
|
||||||
if (v.getFuPin() != null) {
|
|
||||||
List<WelfareProjectSubjectOption> optionListFp = options.stream().filter(item -> item.getOptionName().equals("全校统一消费帮扶(300元)")).collect(Collectors.toList());
|
|
||||||
List<WelfareUserSelection> userSelectionsFp = welfareListService.buildUserSelection(welfareProject, user.getId(), optionListFp, v.getFuPin());
|
|
||||||
if (Lang.isNotEmpty(userSelectionsFp)) welfareUserSelectionList.addAll(userSelectionsFp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.getSixFuPin() != null) {
|
|
||||||
List<WelfareProjectSubjectOption> optionListSixFp = options.stream().filter(item -> item.getOptionName().equals("六院部消费帮扶(500元)")).collect(Collectors.toList());
|
|
||||||
List<WelfareUserSelection> userSelectionsSixFp = welfareListService.buildUserSelection(welfareProject, user.getId(), optionListSixFp, v.getFuPin());
|
|
||||||
if (Lang.isNotEmpty(userSelectionsSixFp)) welfareUserSelectionList.addAll(userSelectionsSixFp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.getDuanWu() != null) {
|
|
||||||
List<WelfareProjectSubjectOption> optionListDw = options.stream().filter(item -> item.getOptionName().equals("端午节")).collect(Collectors.toList());
|
|
||||||
List<WelfareUserSelection> userSelectionsDw = welfareListService.buildUserSelection(welfareProject, user.getId(), optionListDw, v.getDuanWu());
|
|
||||||
if (Lang.isNotEmpty(userSelectionsDw)) welfareUserSelectionList.addAll(userSelectionsDw);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.getZhongQiu() != null) {
|
|
||||||
List<WelfareProjectSubjectOption> optionListZq = options.stream().filter(item -> item.getOptionName().equals("中秋节")).collect(Collectors.toList());
|
|
||||||
List<WelfareUserSelection> userSelectionsZq = welfareListService.buildUserSelection(welfareProject, user.getId(), optionListZq, v.getZhongQiu());
|
|
||||||
if (Lang.isNotEmpty(userSelectionsZq)) welfareUserSelectionList.addAll(userSelectionsZq);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.getYuanDan() != null) {
|
|
||||||
List<WelfareProjectSubjectOption> optionListCj = options.stream().filter(item -> item.getOptionName().equals("春节")).collect(Collectors.toList());
|
|
||||||
List<WelfareUserSelection> userSelectionsCj = welfareListService.buildUserSelection(welfareProject, user.getId(), optionListCj, v.getYuanDan());
|
|
||||||
if (Lang.isNotEmpty(userSelectionsCj)) welfareUserSelectionList.addAll(userSelectionsCj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (Lang.isNotEmpty(welfareUserSelectionList)) dao.fastInsert(welfareUserSelectionList);
|
|
||||||
return Result.success();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-104
@@ -1,16 +1,15 @@
|
|||||||
package io.v.nutz.zhgh.welfare.controller;
|
package io.v.nutz.zhgh.welfare.controller;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.page.Pagination;
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.lang.Lang;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.base.lang.Lang;
|
||||||
|
import io.v.nutz.base.model.Audit;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
|
import io.v.nutz.sys.models.User;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
|
||||||
import io.v.nutz.zhgh.data.service.HistoryUserService;
|
import io.v.nutz.zhgh.data.service.HistoryUserService;
|
||||||
import io.v.nutz.zhgh.member.MemberMode;
|
import io.v.nutz.zhgh.member.MemberMode;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||||
@@ -18,27 +17,21 @@ import io.v.nutz.zhgh.member.constant.MemberChangeOrigin;
|
|||||||
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||||
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
|
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
|
||||||
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
||||||
import io.v.nutz.base.model.Audit;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
||||||
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
||||||
|
import io.v.nutz.zhgh.welfare.handle.WelfareMemberApplyAuditHandle;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
||||||
|
import io.v.nutz.zhgh.welfare.model.WelfareMemberApplyRecord;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
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.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||||
import org.nutz.dao.util.cri.Static;
|
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.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
@@ -74,10 +67,11 @@ public class WelfareMemberAdjustmentController {
|
|||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.member.adjustment")
|
@RequiresPermissions("welfare.member.adjustment")
|
||||||
public Object pageData(@Param(value = "changeDateBefore", required = false) String changeDateBefore,
|
public Object pageData(@Param(value = "changeDateBefore", required = false) String changeDateBefore,
|
||||||
@Param(value = "changeDateEnd", required = false) String changeDateEnd, PageForm pageForm,
|
@Param(value = "changeDateEnd", required = false) String changeDateEnd,
|
||||||
|
PageForm pageForm,
|
||||||
WelfareFeature.Condition.PageParam pageParam,
|
WelfareFeature.Condition.PageParam pageParam,
|
||||||
@Param(value = "changeDate", required = false) String changeDate,
|
@Param(value = "changeDate", required = false) String changeDate,
|
||||||
@Param(value = "changeType", required = false) Integer changeType,
|
@Param(value = "changeType", required = false) String changeType,
|
||||||
@Param(value = "welfareMember", required = false) Integer welfareMember,
|
@Param(value = "welfareMember", required = false) Integer welfareMember,
|
||||||
@Param(value = "member", required = false) Integer member,
|
@Param(value = "member", required = false) Integer member,
|
||||||
@Param(value = "changed", required = false) Integer changed) {
|
@Param(value = "changed", required = false) Integer changed) {
|
||||||
@@ -102,13 +96,18 @@ public class WelfareMemberAdjustmentController {
|
|||||||
mcr_state.stateColor mcrStateColor
|
mcr_state.stateColor mcrStateColor
|
||||||
FROM
|
FROM
|
||||||
`user` u
|
`user` u
|
||||||
|
|
||||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
||||||
|
|
||||||
LEFT JOIN welfare_member_apply_record_latest wmar ON wmar.userId = u.id
|
LEFT JOIN welfare_member_apply_record_latest wmar ON wmar.userId = u.id
|
||||||
|
|
||||||
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
||||||
|
|
||||||
LEFT JOIN audit_state state ON wmar.stateId = state.stateId
|
LEFT JOIN audit_state state ON wmar.stateId = state.stateId
|
||||||
|
|
||||||
LEFT JOIN audit_state mcr_state ON mcr_state.stateId = mcr.stateId
|
LEFT JOIN audit_state mcr_state ON mcr_state.stateId = mcr.stateId
|
||||||
$condition
|
$condition
|
||||||
""")
|
""")
|
||||||
.setParam("recordMode", MemberChangeRecordMode.WELFARE_MEMBER.getCode())
|
.setParam("recordMode", MemberChangeRecordMode.WELFARE_MEMBER.getCode())
|
||||||
.setParam("changeUnitAuditing", MemberChangeApplyState.SCHOOL_UNION)
|
.setParam("changeUnitAuditing", MemberChangeApplyState.SCHOOL_UNION)
|
||||||
.setParam("changeUnitError", MemberChangeApplyState.SCHOOL_UNION_FAIL);
|
.setParam("changeUnitError", MemberChangeApplyState.SCHOOL_UNION_FAIL);
|
||||||
@@ -121,12 +120,12 @@ public class WelfareMemberAdjustmentController {
|
|||||||
cnd.andEX("u.unionGroupId", "=", pageParam.getUnionGroupId());
|
cnd.andEX("u.unionGroupId", "=", pageParam.getUnionGroupId());
|
||||||
|
|
||||||
|
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||||
if (ShiroUtil.hasRole("H04")) {
|
if (ShiroUtil.hasAnyRoles("H04,gh12")) {
|
||||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
seg.or("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||||
seg.or("u.unionGroupId", "is", null);
|
seg.or("u.unionGroupId", "is", null);
|
||||||
cnd.and(seg);
|
cnd.and(seg);
|
||||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||||
@@ -163,27 +162,16 @@ public class WelfareMemberAdjustmentController {
|
|||||||
|
|
||||||
WelfareFeature.Condition.judgmentAuthority(cnd, "u");
|
WelfareFeature.Condition.judgmentAuthority(cnd, "u");
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(pageParam.getUnit())){
|
cnd.and(pageForm);
|
||||||
cnd.and("u.unitid","=",pageParam.getUnit());
|
cnd.desc("u.threeUnitId");
|
||||||
}
|
cnd.asc("u.loginname");
|
||||||
|
|
||||||
|
pageParam.participate(cnd, "u");
|
||||||
|
|
||||||
if (Lang.notNull(changeDateBefore, changeDateEnd)) {
|
if (Lang.notNull(changeDateBefore, changeDateEnd)) {
|
||||||
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
|
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
|
||||||
}
|
}
|
||||||
// cnd.andEX("his.changeType", "=", changeType);
|
cnd.andEx("his.changeType", "=", changeType);
|
||||||
|
|
||||||
if (changeType != null) {
|
|
||||||
cnd.and(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(changeType)));
|
|
||||||
}
|
|
||||||
|
|
||||||
pageParam.participate(cnd, "u");
|
|
||||||
|
|
||||||
cnd.and(pageForm);
|
|
||||||
cnd.desc("his.changeTypes");
|
|
||||||
cnd.desc("u.threeUnitId");
|
|
||||||
cnd.asc("u.loginname");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
return welfareMemberService.list(pageForm, sql);
|
return welfareMemberService.list(pageForm, sql);
|
||||||
@@ -192,11 +180,18 @@ public class WelfareMemberAdjustmentController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions(value = {"welfare.member.adjustment", "welfare.member.check.union"}, logical = Logical.OR)
|
@RequiresPermissions(value = {"welfare.member.adjustment", "welfare.member.check.union"}, logical = Logical.OR)
|
||||||
public Object getChangeNumber(@Param(value = "changeDateBefore", required = false) String changeDateBefore,
|
public Object getChangeNumber(PageForm pageForm,
|
||||||
@Param(value = "changeDateEnd", required = false) String changeDateEnd, PageForm pageForm, WelfareFeature.Condition.PageParam pageParam,
|
WelfareFeature.Condition.PageParam pageParam,
|
||||||
|
@Param(value = "changeDateBefore", required = false) String changeDateBefore,
|
||||||
|
@Param(value = "changeDateEnd", required = false) String changeDateEnd,
|
||||||
@Param(value = "changeType", required = false) String changeType,
|
@Param(value = "changeType", required = false) String changeType,
|
||||||
@Param(value = "welfareMember", required = false) Integer welfareMember,
|
@Param(value = "welfareMember", required = false) Integer welfareMember,
|
||||||
@Param(value = "member", required = false) Integer member, Integer changed) {
|
@Param(value = "member", required = false) Integer member, Integer changed,
|
||||||
|
@Param(value = "userStates", required = false) String[] userStates,
|
||||||
|
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||||
|
@Param(value = "changeTypes", required = false) Integer[] changeTypes,
|
||||||
|
@Param(value = "changeOrigin", required = false) Integer[] changeOrigins
|
||||||
|
) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(1) AS `all`,
|
COUNT(1) AS `all`,
|
||||||
@@ -226,12 +221,12 @@ public class WelfareMemberAdjustmentController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cnd.andEX("u.unionGroupId", "=", pageParam.getUnionGroupId());
|
cnd.andEX("u.unionGroupId", "=", pageParam.getUnionGroupId());
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||||
if (ShiroUtil.hasRole("H04")) {
|
if (ShiroUtil.hasAnyRoles("H04,gh12")) {
|
||||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
seg.or("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||||
seg.or("u.unionGroupId", "is", null);
|
seg.or("u.unionGroupId", "is", null);
|
||||||
cnd.and(seg);
|
cnd.and(seg);
|
||||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||||
@@ -247,16 +242,45 @@ public class WelfareMemberAdjustmentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WelfareFeature.Condition.judgmentAuthority(cnd, "u");
|
WelfareFeature.Condition.judgmentAuthority(cnd, "u");
|
||||||
|
|
||||||
cnd.and(pageForm);
|
cnd.and(pageForm);
|
||||||
|
|
||||||
pageParam.participate(cnd, "u");
|
pageParam.participate(cnd, "u");
|
||||||
|
|
||||||
if (Lang.notNull(changeDateBefore, changeDateEnd)) {
|
if (Lang.notNull(changeDateBefore, changeDateEnd)) {
|
||||||
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
|
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
|
||||||
}
|
}
|
||||||
|
|
||||||
cnd.andEX("his.changeType", "=", changeType);
|
// cnd.andEx("his.changeType", "=", changeType);
|
||||||
|
|
||||||
|
if (org.nutz.lang.Lang.isNotEmpty(changeTypes)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (Integer type : changeTypes) {
|
||||||
|
seg.or(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(type)));
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (org.nutz.lang.Lang.isNotEmpty(userStates)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (String state : userStates) {
|
||||||
|
seg.orEquals("u.userState", state);
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (org.nutz.lang.Lang.isNotEmpty(personTypes)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (String personType : personTypes) {
|
||||||
|
seg.orEquals("u.personType", personType);
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (org.nutz.lang.Lang.isNotEmpty(changeOrigins)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (Integer c : changeOrigins) {
|
||||||
|
seg.orEquals("u.changeOrigin", c);
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
|
|
||||||
@@ -282,9 +306,8 @@ public class WelfareMemberAdjustmentController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.member.adjustment")
|
@RequiresPermissions("welfare.member.adjustment")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
|
||||||
public Object joinWelfareMember(String[] userIds) {
|
public Object joinWelfareMember(String[] userIds) {
|
||||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06,flwyh01")) {
|
if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||||
WelfareMemberMode.joinWelfareMember(Arrays.stream(userIds).collect(Collectors.toList()));
|
WelfareMemberMode.joinWelfareMember(Arrays.stream(userIds).collect(Collectors.toList()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -297,12 +320,11 @@ public class WelfareMemberAdjustmentController {
|
|||||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
historyUserService.insert(audit);
|
historyUserService.insert(audit);
|
||||||
|
|
||||||
for (String userId : userIds) {
|
for (String userId : userIds) {
|
||||||
User user = historyUserService.dao().fetch(User.class, Cnd.where("id", "=", userId));
|
User user = historyUserService.dao().fetch(User.class, Cnd.where("id", "=", userId));
|
||||||
MemberChangeRecord changeRecord = new MemberChangeRecord();
|
MemberChangeRecord changeRecord = new MemberChangeRecord();
|
||||||
changeRecord.setType(UserChangeType.NEW.getCode());
|
changeRecord.setType(UserChangeType.NEW.getCode());
|
||||||
changeRecord.setApplyOrigin(io.v.nutz.web.commons.utils.ShiroUtil.hasRole("H04") ? MemberChangeOrigin.UNION.getCode() : MemberChangeOrigin.UNION_GROUP.getCode());
|
changeRecord.setApplyOrigin(ShiroUtil.hasAnyRoles("H04,gh12") ? MemberChangeOrigin.UNION.getCode() : MemberChangeOrigin.UNION_GROUP.getCode());
|
||||||
changeRecord.setStateId(MemberChangeApplyState.SCHOOL_UNION);
|
changeRecord.setStateId(MemberChangeApplyState.SCHOOL_UNION);
|
||||||
changeRecord.setUpdateWelfareMember(true);
|
changeRecord.setUpdateWelfareMember(true);
|
||||||
changeRecord.setUserId(userId);
|
changeRecord.setUserId(userId);
|
||||||
@@ -316,10 +338,8 @@ public class WelfareMemberAdjustmentController {
|
|||||||
maps.add(changeRecord);
|
maps.add(changeRecord);
|
||||||
}
|
}
|
||||||
historyUserService.insert(maps);
|
historyUserService.insert(maps);
|
||||||
historyUserService.dao().update(Sys_user.class, Chain.make("schoolTime", DateUtil.today()),Cnd.where("id","in",userIds));
|
WelfareMemberApplyAuditHandle.CREATE.next(Arrays.stream(userIds).map(v -> new WelfareMemberApplyRecord().setUserId(v)).collect(Collectors.toList()), null);
|
||||||
return null;
|
return null;
|
||||||
/* WelfareMemberApplyAuditHandle.CREATE.next(Arrays.stream(userIds).map(v -> new WelfareMemberApplyRecord().setUserId(v)).collect(Collectors.toList()), null);
|
|
||||||
return null;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -345,53 +365,4 @@ public class WelfareMemberAdjustmentController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("welfare.member.adjustment")
|
|
||||||
public Object getPostdoctoralExit(PageForm pageForm){
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
u.id,
|
|
||||||
u.loginname,
|
|
||||||
u.username,
|
|
||||||
u.unitname,
|
|
||||||
u.unionname,
|
|
||||||
threeUnitName,
|
|
||||||
unionGroupName,
|
|
||||||
his.id hisId,
|
|
||||||
his.changeType,
|
|
||||||
his.changeTypes,
|
|
||||||
his.changeTime
|
|
||||||
FROM
|
|
||||||
`user` u
|
|
||||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
|
||||||
$condition
|
|
||||||
""");
|
|
||||||
Cnd cnd = Cnd.NEW();
|
|
||||||
cnd.and("u.userState","=","博士后出站");
|
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
|
||||||
Pagination pagination = welfareMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
|
||||||
|
|
||||||
List<NutMap> list = pagination.getList();
|
|
||||||
|
|
||||||
//查询表中新入职的
|
|
||||||
List<UserHistory> newUserList = welfareMemberService.dao().query(UserHistory.class,
|
|
||||||
Cnd.where(new Static("JSON_CONTAINS(changeTypes, CAST(%d AS JSON), '$')"
|
|
||||||
.formatted(UserChangeType.NEW.getCode()))));
|
|
||||||
|
|
||||||
list.forEach(v->{
|
|
||||||
//博士后出站后,判断新入职的姓名是否相同,相同就返回
|
|
||||||
List<UserHistory> identicalUserNameList = newUserList.stream().filter(item -> item.getUsername().equals(v.getString("username"))).collect(Collectors.toList());
|
|
||||||
if (org.nutz.lang.Lang.isNotEmpty(identicalUserNameList)) {
|
|
||||||
v.setv("isExitAfterEntry",true);
|
|
||||||
v.setv("entryData", identicalUserNameList);
|
|
||||||
} else {
|
|
||||||
v.setv("isExitAfterEntry",false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return pagination;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -2,16 +2,16 @@ package io.v.nutz.zhgh.welfare.controller;
|
|||||||
|
|
||||||
import io.v.nutz.base.annontation.ViRequired;
|
import io.v.nutz.base.annontation.ViRequired;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.lang.Enum;
|
import io.v.nutz.base.lang.Enum;
|
||||||
|
import io.v.nutz.base.model.Audit;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.service.ViService;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||||
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
|
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
|
||||||
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
||||||
import io.v.nutz.base.model.Audit;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.base.service.ViService;
|
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
@@ -75,7 +75,7 @@ public class WelfareMemberChangeApplyAuditController {
|
|||||||
wun.welfareUnitId realWelfareUnitId,
|
wun.welfareUnitId realWelfareUnitId,
|
||||||
wun.welfareUnitCode realWelfareUnitCode,
|
wun.welfareUnitCode realWelfareUnitCode,
|
||||||
wun.welfareUnitName realWelfareUnitName,
|
wun.welfareUnitName realWelfareUnitName,
|
||||||
u.mobile AS userMobile,
|
u.mobile,
|
||||||
state.stateName,
|
state.stateName,
|
||||||
state.stateColor,
|
state.stateColor,
|
||||||
originUnit.unitcode originUnitCode,
|
originUnit.unitcode originUnitCode,
|
||||||
|
|||||||
@@ -8,22 +8,21 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.result.Result;
|
|
||||||
import io.v.nutz.base.utils.Roles;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.result.Result;
|
||||||
import io.v.nutz.base.service.AsyncService;
|
import io.v.nutz.base.service.AsyncService;
|
||||||
|
import io.v.nutz.base.utils.Roles;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.zhgh.member.MemberMode;
|
|
||||||
import io.v.nutz.zhgh.member.WelfareMemberMode;
|
|
||||||
import io.v.nutz.sys.models.Sys_unit;
|
import io.v.nutz.sys.models.Sys_unit;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.sys.models.Sys_user_role;
|
import io.v.nutz.sys.models.Sys_user_role;
|
||||||
import io.v.nutz.sys.models.User;
|
import io.v.nutz.sys.models.User;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
|
import io.v.nutz.zhgh.member.MemberMode;
|
||||||
|
import io.v.nutz.zhgh.member.WelfareMemberMode;
|
||||||
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
||||||
import io.v.nutz.zhgh.welfare.model.template.WelfareMemberTemp;
|
import io.v.nutz.zhgh.welfare.model.template.WelfareMemberTemp;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
||||||
@@ -53,7 +52,6 @@ import org.springframework.util.CollectionUtils;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|||||||
@@ -73,14 +73,14 @@ public class WelfareMineController {
|
|||||||
END AS isChoose,
|
END AS isChoose,
|
||||||
GROUP_CONCAT(DISTINCT wuso.optionName,wus.selectNum) AS gist_list,
|
GROUP_CONCAT(DISTINCT wuso.optionName,wus.selectNum) AS gist_list,
|
||||||
wus.receiveAddress,
|
wus.receiveAddress,
|
||||||
wus.courierNumber,
|
wcn.courierNumber,
|
||||||
we.evaluateScore
|
wl.userId
|
||||||
FROM
|
FROM
|
||||||
welfare_project wp
|
welfare_project wp
|
||||||
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
|
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
|
||||||
|
LEFT JOIN welfare_courier_number wcn ON wp.id = wcn.welfareId AND wcn.selectUserId = @selectUserId
|
||||||
LEFT JOIN welfare_list wl ON wp.id = wl.projectId AND wl.userId = @selectUserId
|
LEFT JOIN welfare_list wl ON wp.id = wl.projectId AND wl.userId = @selectUserId
|
||||||
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
||||||
LEFT JOIN welfare_evaluate we ON we.projectId=wp.id AND we.userId=@selectUserId
|
|
||||||
$condition
|
$condition
|
||||||
""");
|
""");
|
||||||
sql.setParam("selectUserId", ShiroUtil.getUserId());
|
sql.setParam("selectUserId", ShiroUtil.getUserId());
|
||||||
@@ -132,7 +132,11 @@ public class WelfareMineController {
|
|||||||
wpus.userSign,
|
wpus.userSign,
|
||||||
wpus.courierNumber,
|
wpus.courierNumber,
|
||||||
wpus.selectTime,
|
wpus.selectTime,
|
||||||
wpso.imgUrl
|
wpso.imgUrl,
|
||||||
|
wpso.simpleDesc,
|
||||||
|
wpso.simpleDesc,
|
||||||
|
wpso.supplier,
|
||||||
|
(select COUNT(1) FROM welfare_evaluate we WHERE we.projectId=@projectId AND we.optionId=wpso.id) isPj
|
||||||
FROM
|
FROM
|
||||||
`welfare_project_user_selection` wpus
|
`welfare_project_user_selection` wpus
|
||||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||||
@@ -164,10 +168,10 @@ public class WelfareMineController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.mine")
|
@RequiresPermissions("welfare.mine")
|
||||||
public Object finOneWelfareEvaluate(String projectId) {
|
public Object finOneWelfareEvaluate(String projectId, String optionId) {
|
||||||
WelfareEvaluate welfareEvaluate = welfareProjectService.dao().fetch(WelfareEvaluate.class,
|
WelfareEvaluate welfareEvaluate = welfareProjectService.dao().fetch(WelfareEvaluate.class,
|
||||||
Cnd.where("userId", "=", ShiroUtil.getUserId())
|
Cnd.where("userId", "=", ShiroUtil.getUserId())
|
||||||
.and("projectId", "=", projectId));
|
.and("projectId", "=", projectId).and("optionId", "=", optionId));
|
||||||
return welfareEvaluate;
|
return welfareEvaluate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-37
@@ -1,17 +1,16 @@
|
|||||||
package io.v.nutz.zhgh.welfare.controller;
|
package io.v.nutz.zhgh.welfare.controller;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.utils.MsgApi;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
|
import io.v.nutz.sys.services.SysTaskService;
|
||||||
import io.v.nutz.task.services.TaskPlatformService;
|
import io.v.nutz.task.services.TaskPlatformService;
|
||||||
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
||||||
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
||||||
import io.v.nutz.zhgh.mobileHome.service.MobileHomeService;
|
import io.v.nutz.zhgh.mobileHome.service.MobileHomeService;
|
||||||
import io.v.nutz.sys.services.SysTaskService;
|
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
|
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
|
||||||
@@ -38,6 +37,7 @@ import org.nutz.mvc.annotation.Ok;
|
|||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
import org.nutz.trans.Trans;
|
import org.nutz.trans.Trans;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -235,9 +235,9 @@ public class WelfareProjectMangeController {
|
|||||||
dao.update(project);
|
dao.update(project);
|
||||||
|
|
||||||
}
|
}
|
||||||
// if (project.getIsPushHome() != 0) {
|
if (project.getIsPushHome() != 0) {
|
||||||
// mobileHomeService.handle(project, "welfare", "/mobile/welfare/list/receive?projectId=" + project.getId(), project.getIsPushHome());
|
mobileHomeService.handle(project, "welfare", "/mobile/welfare/list/receive?projectId=" + project.getId(), project.getIsPushHome());
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -309,11 +309,11 @@ public class WelfareProjectMangeController {
|
|||||||
sql.setParam("projectId", projectId);
|
sql.setParam("projectId", projectId);
|
||||||
List<NutMap> userList = listService.listMap(sql);
|
List<NutMap> userList = listService.listMap(sql);
|
||||||
|
|
||||||
/*for (NutMap map : userList) {
|
// for (NutMap map : userList) {
|
||||||
msgApi.sendMsg(sendMsgValue, "", "", "", "4", new ArrayList<>() {{
|
// msgApi.sendMsg(sendMsgValue, "", "", "", "4", new ArrayList<>() {{
|
||||||
add(NutMap.NEW().addv("userId", map.getString("loginname")));
|
// add(NutMap.NEW().addv("userId", map.getString("loginname")));
|
||||||
}});
|
// }});
|
||||||
}*/
|
// }
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -332,29 +332,4 @@ public class WelfareProjectMangeController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询是否全年节日选择
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("welfare.list.mange")
|
|
||||||
public Object isCheckAnnualFestival(){
|
|
||||||
return projectService.count(Cnd.where("`year`", "=", DateUtil.thisYear()).and("isAnnualFestival","=",1));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭本年节日选择项目
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("welfare.list.mange")
|
|
||||||
public Object closeAnnualFestivalByThisYear(){
|
|
||||||
projectService.update(Chain.make("isAnnualFestival",0),Cnd.where("`year`", "=", DateUtil.thisYear()));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package io.v.nutz.zhgh.welfare.controller;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||||
import io.v.nutz.zhgh.member.model.MemberCheckSelfTask;
|
import io.v.nutz.zhgh.member.model.MemberCheckSelfTask;
|
||||||
import io.v.nutz.zhgh.member.model.MemberCheckTask;
|
import io.v.nutz.zhgh.member.model.MemberCheckTask;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.nutz.ioc.aop.Aop;
|
|||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.json.Json;
|
import org.nutz.json.Json;
|
||||||
import org.nutz.lang.util.NutMap;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
@@ -66,8 +65,7 @@ public class WelfareUserChooseController {
|
|||||||
END AS isChoose,
|
END AS isChoose,
|
||||||
wus.selectTime,
|
wus.selectTime,
|
||||||
GROUP_CONCAT(DISTINCT wuso.optionName ,'(',wus.selectNum,'份)') AS gist_list,
|
GROUP_CONCAT(DISTINCT wuso.optionName ,'(',wus.selectNum,'份)') AS gist_list,
|
||||||
wus.receiveAddress,
|
wus.receiveAddress
|
||||||
wl.welfareUnitId
|
|
||||||
FROM
|
FROM
|
||||||
welfare_project wp
|
welfare_project wp
|
||||||
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
|
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
|
||||||
|
|||||||
+3
-3
@@ -4,11 +4,11 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.zhgh.member.service.MemberCheckPersonalService;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
|
import io.v.nutz.zhgh.member.service.MemberCheckPersonalService;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
|||||||
+2
-2
@@ -6,14 +6,14 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.SimpleService;
|
import io.v.nutz.base.service.SimpleService;
|
||||||
import io.v.nutz.base.utils.Roles;
|
import io.v.nutz.base.utils.Roles;
|
||||||
|
import io.v.nutz.base.utils.ViTool;
|
||||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||||
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
|||||||
+3
-4
@@ -2,16 +2,15 @@ package io.v.nutz.zhgh.welfare.controller.check;
|
|||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.SimpleService;
|
import io.v.nutz.base.service.SimpleService;
|
||||||
|
import io.v.nutz.sys.models.Sys_union;
|
||||||
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
||||||
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
||||||
import io.v.nutz.zhgh.member.model.MemberCheckSelfTask;
|
import io.v.nutz.zhgh.member.model.MemberCheckSelfTask;
|
||||||
import io.v.nutz.zhgh.member.model.MemberCheckTask;
|
import io.v.nutz.zhgh.member.model.MemberCheckTask;
|
||||||
import io.v.nutz.zhgh.member.model.MemberCheckUnionTask;
|
import io.v.nutz.zhgh.member.model.MemberCheckUnionTask;
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.sys.models.SysUnionGroup;
|
|
||||||
import io.v.nutz.sys.models.Sys_union;
|
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
|
|||||||
+101
-29
@@ -4,11 +4,19 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.wizzer.framework.base.Result;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
|
import io.v.nutz.base.model.Audit;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.SimpleService;
|
import io.v.nutz.base.service.SimpleService;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
|
import io.v.nutz.sys.models.Sys_config;
|
||||||
|
import io.v.nutz.sys.models.User;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
import io.v.nutz.zhgh.data.constant.UserChangeType;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
import io.v.nutz.zhgh.member.constant.MemberChangeApplyState;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberChangeOrigin;
|
import io.v.nutz.zhgh.member.constant.MemberChangeOrigin;
|
||||||
@@ -16,11 +24,6 @@ import io.v.nutz.zhgh.member.constant.MemberChangeRecordMode;
|
|||||||
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
|
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
|
||||||
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
import io.v.nutz.zhgh.member.model.MemberChangeRecord;
|
||||||
import io.v.nutz.zhgh.member.model.MemberCheckUnionTask;
|
import io.v.nutz.zhgh.member.model.MemberCheckUnionTask;
|
||||||
import io.v.nutz.base.model.Audit;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.base.utils.ViTool;
|
|
||||||
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
||||||
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
||||||
@@ -35,16 +38,14 @@ import org.nutz.dao.util.cri.SqlExpressionGroup;
|
|||||||
import org.nutz.dao.util.cri.Static;
|
import org.nutz.dao.util.cri.Static;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,18 +76,25 @@ public class WelfareMemberCheckUnionController {
|
|||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.member.check.union")
|
@RequiresPermissions("welfare.member.check.union")
|
||||||
public Object pageData(PageForm pageForm,
|
public Object pageData(PageForm pageForm,
|
||||||
|
WelfareFeature.Condition.PageParam pageParam,
|
||||||
@Param(value = "taskId", required = false) String taskId,
|
@Param(value = "taskId", required = false) String taskId,
|
||||||
@Param(value = "unionId", required = false) String unionId,
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
@Param(value = "unitId", required = false) String unitId,
|
@Param(value = "unitId", required = false) String unitId,
|
||||||
@Param(value = "changed", required = false) Integer changed,
|
@Param(value = "changed", required = false) Integer changed,
|
||||||
@Param(value = "changeType", required = false) String changeType,
|
@Param(value = "changeType", required = false) String changeType,
|
||||||
@Param(value = "isMember", required = false) Integer isMember,
|
@Param(value = "isMember", required = false) Integer isMember,
|
||||||
WelfareFeature.Condition.PageParam pageParam,
|
@Param(value = "welfareMember", required = false) Integer welfareMember,
|
||||||
@Param(value = "welfareMember", required = false) Integer welfareMember) {
|
@Param(value = "userStates", required = false) String[] userStates,
|
||||||
|
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||||
|
@Param(value = "changeTypes", required = false) Integer[] changeTypes,
|
||||||
|
@Param(value = "changeOrigin", required = false) Integer[] changeOrigins
|
||||||
|
) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
u.*,
|
u.*,
|
||||||
|
his.id hisId,
|
||||||
his.changeType,
|
his.changeType,
|
||||||
|
his.changeTypes,
|
||||||
his.changeTime,
|
his.changeTime,
|
||||||
IF
|
IF
|
||||||
( his.id IS NULL, FALSE, TRUE ) hasHis,
|
( his.id IS NULL, FALSE, TRUE ) hasHis,
|
||||||
@@ -102,15 +110,10 @@ public class WelfareMemberCheckUnionController {
|
|||||||
mcr_state.stateColor mcrStateColor
|
mcr_state.stateColor mcrStateColor
|
||||||
FROM
|
FROM
|
||||||
`user` u
|
`user` u
|
||||||
|
|
||||||
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
LEFT JOIN user_history_latest his ON his.loginname = u.loginname
|
||||||
|
|
||||||
LEFT JOIN welfare_member_apply_record_latest wmar ON wmar.userId = u.id
|
LEFT JOIN welfare_member_apply_record_latest wmar ON wmar.userId = u.id
|
||||||
|
|
||||||
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
LEFT JOIN member_change_record_latest mcr on mcr.userId = u.id
|
||||||
|
|
||||||
LEFT JOIN audit_state state ON wmar.stateId = state.stateId
|
LEFT JOIN audit_state state ON wmar.stateId = state.stateId
|
||||||
|
|
||||||
LEFT JOIN audit_state mcr_state ON mcr_state.stateId = mcr.stateId
|
LEFT JOIN audit_state mcr_state ON mcr_state.stateId = mcr.stateId
|
||||||
$condition
|
$condition
|
||||||
""")
|
""")
|
||||||
@@ -128,12 +131,12 @@ public class WelfareMemberCheckUnionController {
|
|||||||
/* if (!ShiroUtil.hasAnyRoles("sysadmin,A06,flwyh01")) {
|
/* if (!ShiroUtil.hasAnyRoles("sysadmin,A06,flwyh01")) {
|
||||||
cnd.and("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
cnd.and("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||||
}*/
|
}*/
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionMemberAdmin,A06")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||||
if (ShiroUtil.hasRole("H04")) {
|
if (ShiroUtil.hasAnyRoles("H04,gh12")) {
|
||||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
seg.or("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
seg.or("u.unionGroupId", "in", ShiroUtil.getUnionGroupIds());
|
||||||
seg.or("u.unionGroupId", "is", null);
|
seg.or("u.unionGroupId", "is", null);
|
||||||
cnd.and(seg);
|
cnd.and(seg);
|
||||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||||
@@ -150,7 +153,6 @@ public class WelfareMemberCheckUnionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (welfareMember == 1) {
|
if (welfareMember == 1) {
|
||||||
cnd.and("u.welfareMember", "=", WelfareMemberMode.NORMAL.getCode());
|
cnd.and("u.welfareMember", "=", WelfareMemberMode.NORMAL.getCode());
|
||||||
} else if (welfareMember == 2) {
|
} else if (welfareMember == 2) {
|
||||||
@@ -168,6 +170,37 @@ public class WelfareMemberCheckUnionController {
|
|||||||
cnd.asc("u.unitid");
|
cnd.asc("u.unitid");
|
||||||
cnd.asc("u.loginname");
|
cnd.asc("u.loginname");
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(changeTypes)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (Integer type : changeTypes) {
|
||||||
|
seg.or(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(type)));
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(userStates)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (String state : userStates) {
|
||||||
|
seg.orEquals("u.userState", state);
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(personTypes)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (String personType : personTypes) {
|
||||||
|
seg.orEquals("u.personType", personType);
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(changeOrigins)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
for (Integer c : changeOrigins) {
|
||||||
|
seg.orEquals("u.changeOrigin", c);
|
||||||
|
}
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
return simpleService.list(pageForm, sql);
|
return simpleService.list(pageForm, sql);
|
||||||
@@ -193,16 +226,55 @@ public class WelfareMemberCheckUnionController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.member.check.union")
|
@RequiresPermissions("welfare.member.check.union")
|
||||||
public Object doSubmitChangeUser(MemberChangeRecord record) {
|
public Object doSubmitChangeUser(MemberChangeRecord memberChangeRecord) {
|
||||||
record.setRecordMode(MemberChangeRecordMode.WELFARE_MEMBER.getCode());
|
if (Objects.equals(memberChangeRecord.getType(), UserChangeType.NEW.getCode())) {
|
||||||
record.setApplyOrigin(MemberChangeOrigin.UNION.getCode());
|
return Result.error("您已经入职,可以选择恢复功能入会!");
|
||||||
record = MemberChangeAuditHandle.CREATE.next(record, null);
|
}
|
||||||
|
if (Objects.equals(memberChangeRecord.getType(), UserChangeType.UNIT_CHANGE.getCode())) {
|
||||||
|
boolean unionGroupEnable = Optional.ofNullable(dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "isThreeUnit"))).map(v -> v.getConfigValue()).orElse("false").equals("true");
|
||||||
|
|
||||||
|
if (unionGroupEnable && memberChangeRecord.getCurrentThreeUnitId().equals(memberChangeRecord.getOriginThreeUnitId())) {
|
||||||
|
return Result.error("请选择不同的单位!");
|
||||||
|
} else if (!unionGroupEnable && memberChangeRecord.getCurrentUnitId().equals(memberChangeRecord.getOriginUnitId())) {
|
||||||
|
return Result.error("请选择不同的单位!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Objects.equals(memberChangeRecord.getType(), UserChangeType.UNIT_CHANGE.getCode())) {
|
||||||
|
memberChangeRecord.setCurrentUnitId(null);
|
||||||
|
memberChangeRecord.setCurrentUnionId(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sql userSql = Sqls.fetchString("select userState from sys_user where id = @userId");
|
||||||
|
userSql.setParam("userId", memberChangeRecord.getUserId());
|
||||||
|
dao.execute(userSql);
|
||||||
|
String userState = StrUtil.blankToDefault(userSql.getString(), "");
|
||||||
|
|
||||||
|
if (memberChangeRecord.getType() == UserChangeType.ON_DUTY.getCode()) {
|
||||||
|
if (userState.equals(UserChangeType.ON_DUTY.getDescription())) {
|
||||||
|
return Result.error("该用户当前的状态已经是" + UserChangeType.ON_DUTY.getDescription() + ",您无需变更!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (memberChangeRecord.getType() == UserChangeType.RESIGN.getCode()) {
|
||||||
|
if (userState.equals(UserChangeType.RESIGN.getDescription())) {
|
||||||
|
return Result.error("该用户当前的状态已经是" + UserChangeType.RESIGN.getDescription() + ",您无需变更!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (memberChangeRecord.getType() == UserChangeType.RETIREMENT.getCode()) {
|
||||||
|
if (userState.equals(UserChangeType.RETIREMENT.getDescription())) {
|
||||||
|
return Result.error("该用户当前的状态已经是" + UserChangeType.RETIREMENT.getDescription() + ",您无需变更!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
memberChangeRecord.setRecordMode(MemberChangeRecordMode.WELFARE_MEMBER.getCode());
|
||||||
|
memberChangeRecord.setApplyOrigin(MemberChangeOrigin.UNION.getCode());
|
||||||
|
memberChangeRecord = MemberChangeAuditHandle.CREATE.next(memberChangeRecord, null);
|
||||||
|
|
||||||
Audit audit = new Audit();
|
Audit audit = new Audit();
|
||||||
audit.setAuditPass(true);
|
audit.setAuditPass(true);
|
||||||
audit.setAuditOpinion(record.getRemark());
|
audit.setAuditOpinion(memberChangeRecord.getRemark());
|
||||||
|
|
||||||
MemberChangeAuditHandle.UNION.next(record, audit);
|
MemberChangeAuditHandle.UNION.next(memberChangeRecord, audit);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -238,7 +310,7 @@ public class WelfareMemberCheckUnionController {
|
|||||||
public Object doWelfareMember(String[] userIds, String taskId,
|
public Object doWelfareMember(String[] userIds, String taskId,
|
||||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||||
@Param(value = "unitId", required = false) String unitId) {
|
@Param(value = "unitId", required = false) String unitId) {
|
||||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06,flwyh01")) {
|
if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionMemberAdmin,SchoolUnionWelfareAdmin")) {
|
||||||
WelfareMemberMode.joinWelfareMember(Arrays.stream(userIds).collect(Collectors.toList()));
|
WelfareMemberMode.joinWelfareMember(Arrays.stream(userIds).collect(Collectors.toList()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -300,7 +372,7 @@ public class WelfareMemberCheckUnionController {
|
|||||||
excelExportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
excelExportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||||
excelExportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
excelExportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||||
excelExportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
excelExportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||||
excelExportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
excelExportEntities.add(new ExcelExportEntity("所属单位", "unitname", 50));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ViTool.excelResponse(response, "福利名单.xlsx");
|
ViTool.excelResponse(response, "福利名单.xlsx");
|
||||||
|
|||||||
+22
-22
@@ -23,8 +23,6 @@ import io.v.nutz.zhgh.welfare.model.WelfareUserSelection;
|
|||||||
import io.v.nutz.zhgh.welfare.service.WelfareSingleService;
|
import io.v.nutz.zhgh.welfare.service.WelfareSingleService;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@@ -48,7 +46,6 @@ import org.nutz.mvc.annotation.Param;
|
|||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -296,9 +293,9 @@ public class WelfareSingleController {
|
|||||||
$notGroupIdCnd
|
$notGroupIdCnd
|
||||||
""").setParam("welfareId", projectId);
|
""").setParam("welfareId", projectId);
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
// if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
||||||
// sql.setVar("notGroupIdCnd", "and u.unionGroupId is not null");
|
sql.setVar("notGroupIdCnd", "and u.unionGroupId is not null");
|
||||||
// }
|
}
|
||||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||||
if (Strings.isNotBlank(month)) {
|
if (Strings.isNotBlank(month)) {
|
||||||
cnd.andEX("SUBSTR(u.birthday,6,2)", "=", month.substring(5, 7));
|
cnd.andEX("SUBSTR(u.birthday,6,2)", "=", month.substring(5, 7));
|
||||||
@@ -630,8 +627,8 @@ public class WelfareSingleController {
|
|||||||
response.setHeader("content-disposition", "attachment;filename="
|
response.setHeader("content-disposition", "attachment;filename="
|
||||||
+ URLEncoder.encode(welfareProject.getName() + "签收表.xlsx", "UTF-8"));
|
+ URLEncoder.encode(welfareProject.getName() + "签收表.xlsx", "UTF-8"));
|
||||||
//获取这个福利项目下的所有数据
|
//获取这个福利项目下的所有数据
|
||||||
// List<NutMap> allUser = welfareSingleService.getUserByProjectId(projectId, month, unionGroupId);
|
List<NutMap> allUser = welfareSingleService.getUserByProjectId(projectId, month, unionGroupId);
|
||||||
// List<NutMap> userChoose = welfareSingleService.getUserChooseByProjectId(projectId, month, unionGroupId);
|
List<NutMap> userChoose = welfareSingleService.getUserChooseByProjectId(projectId, month, unionGroupId);
|
||||||
welfareSingleService.exportReceiveDetail(projectId, welfareUnitId, new ArrayList<>(), new ArrayList<>(), response.getOutputStream());
|
welfareSingleService.exportReceiveDetail(projectId, welfareUnitId, new ArrayList<>(), new ArrayList<>(), response.getOutputStream());
|
||||||
ViTool.excelResponse(response, sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xlsx");
|
ViTool.excelResponse(response, sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xlsx");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -691,18 +688,22 @@ public class WelfareSingleController {
|
|||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
u.loginname,
|
u.loginname,
|
||||||
u.threeUnitName,
|
|
||||||
u.username,
|
u.username,
|
||||||
u.mobile,
|
u.mobile,
|
||||||
unionname,
|
wl.userState,
|
||||||
unitname,
|
wl.personType,
|
||||||
|
gh.unionname,
|
||||||
|
dw.name as unitname,
|
||||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||||
wpus.selectNum,
|
wpus.selectNum,
|
||||||
wpso.optionName
|
wpso.optionName
|
||||||
FROM
|
FROM
|
||||||
welfare_project_user_selection wpus
|
welfare_project_user_selection_copy1 wpus
|
||||||
left join `user` u on u.id = wpus.selectUserId
|
left join sys_user u on u.id = wpus.selectUserId
|
||||||
left join welfare_project_subject_option wpso on wpso.id = wpus.selectOptionId
|
left join welfare_project_subject_option wpso on wpso.id = wpus.selectOptionId
|
||||||
|
left join welfare_list wl on wl.userId = wpus.selectUserId
|
||||||
|
left join sys_union gh on gh.id = wl.welfareUnitId
|
||||||
|
left join sys_unit dw on dw.id = wl.welfareSecondLevelUnitId
|
||||||
$condition
|
$condition
|
||||||
""");
|
""");
|
||||||
cnd.and("wpus.welfareId", "=", projectId);
|
cnd.and("wpus.welfareId", "=", projectId);
|
||||||
@@ -710,13 +711,10 @@ public class WelfareSingleController {
|
|||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionWelfareAdmin")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionWelfareAdmin")) {
|
||||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||||
}
|
}
|
||||||
|
cnd.and("wpus.selectNum", "!=", 0);
|
||||||
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
|
||||||
cnd.and("u.unionGroupId", "is not", null);
|
|
||||||
}
|
|
||||||
cnd.andEX("u.unioncode", "=", welfareUnitCode);
|
cnd.andEX("u.unioncode", "=", welfareUnitCode);
|
||||||
cnd.asc("u.threeUnitCode");
|
//下次活动必须打开
|
||||||
cnd.asc("u.unitcode");
|
//cnd.groupBy("wpus.selectUserId", "wpus.selectOptionId");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
List<NutMap> list = welfareSingleService.listMap(sql);
|
List<NutMap> list = welfareSingleService.listMap(sql);
|
||||||
Map<String, List<NutMap>> optionGroupData = list.stream().collect(Collectors.groupingBy(v -> v.getString("optionName")));
|
Map<String, List<NutMap>> optionGroupData = list.stream().collect(Collectors.groupingBy(v -> v.getString("optionName")));
|
||||||
@@ -725,12 +723,14 @@ public class WelfareSingleController {
|
|||||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||||
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
|
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||||
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 30));
|
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 30));
|
||||||
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 50));
|
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 50));
|
||||||
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 20));
|
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 20));
|
||||||
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
// if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
||||||
exportEntities.add(new ExcelExportEntity("所在部门", "threeUnitName", 50));
|
// exportEntities.add(new ExcelExportEntity("所在部门", "threeUnitName", 50));
|
||||||
}
|
// }
|
||||||
exportEntities.add(new ExcelExportEntity("收货地址", "receiveAddress", 100));
|
exportEntities.add(new ExcelExportEntity("收货地址", "receiveAddress", 100));
|
||||||
|
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package io.v.nutz.zhgh.welfare.feature;
|
package io.v.nutz.zhgh.welfare.feature;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -90,8 +90,8 @@ public interface WelfareFeature {
|
|||||||
// cnd.andEX(Condition.getPrefix(prefix) + "unitid", "=", getUnit());
|
// cnd.andEX(Condition.getPrefix(prefix) + "unitid", "=", getUnit());
|
||||||
cnd.andEX(Condition.getPrefix(prefix) + WelfareUnitMode.getMode().getField(), "=", getWelfareUnit());
|
cnd.andEX(Condition.getPrefix(prefix) + WelfareUnitMode.getMode().getField(), "=", getWelfareUnit());
|
||||||
cnd.andEX(Condition.getPrefix(prefix) + "campusId", "=", getCampus());
|
cnd.andEX(Condition.getPrefix(prefix) + "campusId", "=", getCampus());
|
||||||
cnd.andEX(Condition.getPrefix(prefix) + "personType", "=", getPersonType());
|
// cnd.andEX(Condition.getPrefix(prefix) + "personType", "=", getPersonType());
|
||||||
cnd.andEX(Condition.getPrefix(prefix) + "userState", "=", getUserState());
|
// cnd.andEX(Condition.getPrefix(prefix) + "userState", "=", getUserState());
|
||||||
cnd.andEX(Condition.getPrefix(prefix) + "sex", "=", getSex());
|
cnd.andEX(Condition.getPrefix(prefix) + "sex", "=", getSex());
|
||||||
cnd.andEX(Condition.getPrefix(prefix) + "threeUnitId", "=", getThreeUnitId());
|
cnd.andEX(Condition.getPrefix(prefix) + "threeUnitId", "=", getThreeUnitId());
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package io.v.nutz.zhgh.welfare.handle;
|
package io.v.nutz.zhgh.welfare.handle;
|
||||||
|
|
||||||
|
import io.v.nutz.base.model.Audit;
|
||||||
import io.v.nutz.base.service.AuditService;
|
import io.v.nutz.base.service.AuditService;
|
||||||
|
import io.v.nutz.base.utils.Roles;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.utils.ViResource;
|
import io.v.nutz.base.utils.ViResource;
|
||||||
import io.v.nutz.zhgh.member.constant.MemberApplyState;
|
import io.v.nutz.sys.models.Sys_user_role;
|
||||||
import io.v.nutz.base.model.Audit;
|
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
|
import io.v.nutz.zhgh.member.constant.MemberApplyState;
|
||||||
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
import io.v.nutz.zhgh.welfare.constant.WelfareMemberApplyState;
|
||||||
|
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
|
||||||
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareMemberMode;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareMemberApplyRecord;
|
import io.v.nutz.zhgh.welfare.model.WelfareMemberApplyRecord;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
import io.v.nutz.zhgh.welfare.service.WelfareMemberService;
|
||||||
@@ -14,6 +17,7 @@ import lombok.Getter;
|
|||||||
import org.nutz.dao.Chain;
|
import org.nutz.dao.Chain;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -39,8 +43,8 @@ public enum WelfareMemberApplyAuditHandle {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void next(List<WelfareMemberApplyRecord> records, Audit audit) {
|
public void next(List<WelfareMemberApplyRecord> records, Audit audit) {
|
||||||
WelfareMemberMode.joinWelfareMember(records.stream().map(v -> v.getUserId()).collect(Collectors.toList()));
|
// WelfareMemberMode.joinWelfareMember(records.stream().map(v -> v.getUserId()).collect(Collectors.toList()));
|
||||||
/* if (WelfareFeature.judgmentAuthority()) {
|
if (WelfareFeature.judgmentAuthority()) {
|
||||||
WelfareMemberMode.joinWelfareMember(records.stream().map(v -> v.getUserId()).collect(Collectors.toList()));
|
WelfareMemberMode.joinWelfareMember(records.stream().map(v -> v.getUserId()).collect(Collectors.toList()));
|
||||||
} else {
|
} else {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
@@ -49,7 +53,7 @@ public enum WelfareMemberApplyAuditHandle {
|
|||||||
record.setStateId(WelfareMemberApplyState.SCHOOL_UNION);
|
record.setStateId(WelfareMemberApplyState.SCHOOL_UNION);
|
||||||
}
|
}
|
||||||
service.dao().insert(records);
|
service.dao().insert(records);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +81,18 @@ public enum WelfareMemberApplyAuditHandle {
|
|||||||
service.update(records);
|
service.update(records);
|
||||||
|
|
||||||
if (audit.getAuditPass()) {
|
if (audit.getAuditPass()) {
|
||||||
service.update(Chain.make("welfareMember", WelfareMemberMode.NORMAL.getCode()).add("welfareMemberJoinTime", new Date()), Cnd.where("id", "in", records.stream().map(v -> v.getUserId()).collect(Collectors.toList())));
|
List<String> userIds = records.stream().map(WelfareMemberApplyRecord::getUserId).collect(Collectors.toList());
|
||||||
|
service.update(Chain.make("welfareMember", WelfareMemberMode.NORMAL.getCode()).add("welfareMemberJoinTime", new Date()), Cnd.where("id", "in", userIds));
|
||||||
|
service.dao().clear(Sys_user_role.class, Cnd.where("id", "in", userIds).and("roleId", "=", Roles.WELFARE_MEMBER));
|
||||||
|
|
||||||
|
List<Sys_user_role> roles = new ArrayList<>();
|
||||||
|
userIds.forEach(u -> {
|
||||||
|
Sys_user_role userRole = new Sys_user_role();
|
||||||
|
userRole.setUserId(u);
|
||||||
|
userRole.setRoleId(Roles.WELFARE_MEMBER);
|
||||||
|
roles.add(userRole);
|
||||||
|
});
|
||||||
|
getService().insert(roles);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,16 @@ public class CourierNumberExcelMode {
|
|||||||
@Excel(name = "姓名", width = 20)
|
@Excel(name = "姓名", width = 20)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@Excel(name = "快递单号", width = 30)
|
@Excel(name = "快递单号1", width = 30)
|
||||||
private String courierNumber;
|
private String oneCourierNumber;
|
||||||
|
|
||||||
|
@Excel(name = "快递单号2", width = 30)
|
||||||
|
private String twoCourierNumber;
|
||||||
|
|
||||||
|
@Excel(name = "快递单号3", width = 30)
|
||||||
|
private String threeCourierNumber;
|
||||||
|
|
||||||
|
@Excel(name = "快递单号4", width = 30)
|
||||||
|
private String fourCourierNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package io.v.nutz.zhgh.welfare.mode;
|
package io.v.nutz.zhgh.welfare.mode;
|
||||||
|
|
||||||
import io.v.nutz.base.lang.Enum;
|
import io.v.nutz.base.lang.Enum;
|
||||||
import io.v.nutz.sys.services.SysUnitService;
|
|
||||||
import io.v.nutz.base.utils.ViResource;
|
import io.v.nutz.base.utils.ViResource;
|
||||||
|
import io.v.nutz.sys.services.SysUnitService;
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
import io.v.nutz.zhgh.welfare.model.view.WelfareUnit;
|
import io.v.nutz.zhgh.welfare.model.view.WelfareUnit;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package io.v.nutz.zhgh.welfare.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WelfareCourierNumber
|
||||||
|
* @Description TODO
|
||||||
|
* @Author zhf
|
||||||
|
* @Date 2024/6/27 9:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Table
|
||||||
|
@Comment("福利用户快递单号")
|
||||||
|
public class WelfareCourierNumber {
|
||||||
|
|
||||||
|
|
||||||
|
@Name
|
||||||
|
@Comment("ID")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
@PrevInsert(uu32 = true)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("所属福利")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String welfareId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("选择项")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String selectOptionId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("选择用户")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String selectUserId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("快递单号")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
|
private String courierNumber;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("物流信息")
|
||||||
|
@ColDefine(type = ColType.MYSQL_JSON)
|
||||||
|
private WelfareUserSelection.LogisticsTrace logisticsTrace;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("上次查询物流信息的时间")
|
||||||
|
@ColDefine(type = ColType.DATETIME)
|
||||||
|
private Date selectExpressDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class LogisticsTrace {
|
||||||
|
//运单号物流流转当前最新变更时间
|
||||||
|
private Date theLastTime;
|
||||||
|
//运单号物流流转当前最新描述
|
||||||
|
private String theLastMessage;
|
||||||
|
//运单号当前物流状态文字描述
|
||||||
|
private String logisticsStatusDesc;
|
||||||
|
//物流流转状态(WAIT_ACCEPT:)
|
||||||
|
private String logisticsStatus;
|
||||||
|
//物流流转明细
|
||||||
|
private List<NutMap> logisticsTraceDetailList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,6 +32,11 @@ public class WelfareEvaluate extends BaseModel implements Serializable {
|
|||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("套餐ID")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String optionId;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("用户ID")
|
@Comment("用户ID")
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
|||||||
@@ -42,13 +42,29 @@ public class WelfareList {
|
|||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
private String welfareUnitId;
|
private String welfareUnitId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("福利二级单位ID")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String welfareSecondLevelUnitId;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("是否签收")
|
@Comment("是否签收")
|
||||||
@ColDefine(type = ColType.BOOLEAN)
|
@ColDefine(type = ColType.BOOLEAN)
|
||||||
private boolean isReceive;
|
private Boolean isReceive;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("是否下次福利自动选择当前提货券")
|
@Comment("是否下次福利自动选择当前提货券")
|
||||||
@ColDefine(type = ColType.BOOLEAN)
|
@ColDefine(type = ColType.BOOLEAN)
|
||||||
private boolean isAutoSelect;
|
private Boolean isAutoSelect;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("人员类型")
|
||||||
|
@ColDefine(type = ColType.VARCHAR)
|
||||||
|
private String personType;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("在职状态")
|
||||||
|
@ColDefine(type = ColType.VARCHAR)
|
||||||
|
private String userState;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,34 +215,4 @@ public class WelfareProject extends ViBaseModel {
|
|||||||
@ColDefine(type = ColType.BOOLEAN)
|
@ColDefine(type = ColType.BOOLEAN)
|
||||||
private Boolean isDisabled;
|
private Boolean isDisabled;
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("是否全年选择节日")
|
|
||||||
@ColDefine(type = ColType.BOOLEAN)
|
|
||||||
private Boolean isAnnualFestival;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("允许选择的工会Id")
|
|
||||||
@ColDefine(type = ColType.MYSQL_JSON)
|
|
||||||
private List<String> unionIdList;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("是否使用配置")
|
|
||||||
@ColDefine(type = ColType.BOOLEAN)
|
|
||||||
private Boolean isConfig;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("新入职老师选择")
|
|
||||||
@ColDefine(type = ColType.MYSQL_JSON)
|
|
||||||
private List<NewlyHiredTeacherSelect> teacherSelectList;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class NewlyHiredTeacherSelect{
|
|
||||||
//开始时间
|
|
||||||
private Date startTime;
|
|
||||||
//结束时间
|
|
||||||
private Date endTime;
|
|
||||||
//可选选项id
|
|
||||||
private List<String> optionIdList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,6 @@ public class WelfareProjectSubjectOption extends BaseModel {
|
|||||||
@ColDefine(type = ColType.BOOLEAN)
|
@ColDefine(type = ColType.BOOLEAN)
|
||||||
private Boolean isSystemDefault;
|
private Boolean isSystemDefault;
|
||||||
|
|
||||||
|
|
||||||
@Column
|
|
||||||
@Comment("默认选择几个")
|
|
||||||
@ColDefine(type = ColType.INT)
|
|
||||||
private Integer defaultSelectNum;
|
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("图片地址")
|
@Comment("图片地址")
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||||
|
|||||||
@@ -80,15 +80,14 @@ public class WelfareUserSelection {
|
|||||||
@Comment("物流信息")
|
@Comment("物流信息")
|
||||||
@ColDefine(type = ColType.MYSQL_JSON)
|
@ColDefine(type = ColType.MYSQL_JSON)
|
||||||
private LogisticsTrace logisticsTrace;
|
private LogisticsTrace logisticsTrace;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("上次查询物流信息的时间")
|
@Comment("上次查询物流信息的时间")
|
||||||
@ColDefine(type = ColType.DATETIME)
|
@ColDefine(type = ColType.DATETIME)
|
||||||
private Date selectExpressDate;
|
private Date selectExpressDate;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class LogisticsTrace {
|
public static class LogisticsTrace {
|
||||||
|
|
||||||
//运单号物流流转当前最新变更时间
|
//运单号物流流转当前最新变更时间
|
||||||
private Date theLastTime;
|
private Date theLastTime;
|
||||||
//运单号物流流转当前最新描述
|
//运单号物流流转当前最新描述
|
||||||
@@ -99,8 +98,6 @@ public class WelfareUserSelection {
|
|||||||
private String logisticsStatus;
|
private String logisticsStatus;
|
||||||
//物流流转明细
|
//物流流转明细
|
||||||
private List<NutMap> logisticsTraceDetailList;
|
private List<NutMap> logisticsTraceDetailList;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class WelfareExportEntityTc {
|
|||||||
@Excel(name = "所属工会", width = 20d)
|
@Excel(name = "所属工会", width = 20d)
|
||||||
private String unionName;
|
private String unionName;
|
||||||
|
|
||||||
@Excel(name = "所属单位", width = 60d)
|
// @Excel(name = "所属单位", width = 60d)
|
||||||
private String unitName;
|
// private String unitName;
|
||||||
|
|
||||||
@Excel(name = "已选福利", width = 80d)
|
@Excel(name = "已选福利", width = 80d)
|
||||||
private String optionName;
|
private String optionName;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package io.v.nutz.zhgh.welfare.service;
|
|||||||
|
|
||||||
import io.v.nutz.base.service.ViService;
|
import io.v.nutz.base.service.ViService;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
|
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareUserSelection;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,7 +30,4 @@ public interface WelfareListService extends ViService<WelfareList> {
|
|||||||
void joinWelfareList(String projectId, List<String> userIds);
|
void joinWelfareList(String projectId, List<String> userIds);
|
||||||
|
|
||||||
List<NutMap> getToNotWelfareUsers(String projectId);
|
List<NutMap> getToNotWelfareUsers(String projectId);
|
||||||
|
|
||||||
|
|
||||||
List<WelfareUserSelection> buildUserSelection(WelfareProject project, String userId, List<WelfareProjectSubjectOption> options, Integer selectNum);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.v.nutz.zhgh.welfare.service.impl;
|
package io.v.nutz.zhgh.welfare.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
@@ -8,7 +7,6 @@ import io.v.nutz.sys.models.Sys_user;
|
|||||||
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
import io.v.nutz.zhgh.welfare.mode.WelfareUnitMode;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
|
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareUserSelection;
|
import io.v.nutz.zhgh.welfare.model.WelfareUserSelection;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareListService;
|
import io.v.nutz.zhgh.welfare.service.WelfareListService;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
||||||
@@ -20,12 +18,12 @@ import org.nutz.dao.sql.Sql;
|
|||||||
import org.nutz.ioc.aop.Aop;
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.random.R;
|
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +40,6 @@ public class WelfareListServiceImpl extends ViServiceImpl<WelfareList> implement
|
|||||||
@Inject
|
@Inject
|
||||||
private WelfareProjectService projectService;
|
private WelfareProjectService projectService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public void createList(String projectId, boolean created) {
|
public void createList(String projectId, boolean created) {
|
||||||
@@ -56,7 +53,7 @@ public class WelfareListServiceImpl extends ViServiceImpl<WelfareList> implement
|
|||||||
|
|
||||||
List<String> userIds;
|
List<String> userIds;
|
||||||
|
|
||||||
if (project.getIsYearBirthday() != null && project.getIsYearBirthday()) {
|
if (project.getIsYearBirthday()!=null && project.getIsYearBirthday()) {
|
||||||
//如果是生日福利
|
//如果是生日福利
|
||||||
//从user找出生日在今天之后的,并且不符合发放范围的人
|
//从user找出生日在今天之后的,并且不符合发放范围的人
|
||||||
|
|
||||||
@@ -110,9 +107,6 @@ public class WelfareListServiceImpl extends ViServiceImpl<WelfareList> implement
|
|||||||
Sql sql = Sqls.create("SELECT * from `welfare_member` $condition");
|
Sql sql = Sqls.create("SELECT * from `welfare_member` $condition");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
joinWelfareList(listMap(sql), projectId);
|
joinWelfareList(listMap(sql), projectId);
|
||||||
if (project.getIsAnnualFestival()) {
|
|
||||||
renewWelfareSelection(project);
|
|
||||||
}
|
|
||||||
// addflUser(projectId, created);
|
// addflUser(projectId, created);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +148,7 @@ public class WelfareListServiceImpl extends ViServiceImpl<WelfareList> implement
|
|||||||
list.setProjectId(projectId);
|
list.setProjectId(projectId);
|
||||||
list.setUserId(user.getString("id"));
|
list.setUserId(user.getString("id"));
|
||||||
list.setWelfareUnitId(user.getString(field));
|
list.setWelfareUnitId(user.getString(field));
|
||||||
|
list.setWelfareSecondLevelUnitId(user.getString("unitid"));
|
||||||
lists.add(list);
|
lists.add(list);
|
||||||
}
|
}
|
||||||
dao().insert(lists);
|
dao().insert(lists);
|
||||||
@@ -169,189 +164,4 @@ public class WelfareListServiceImpl extends ViServiceImpl<WelfareList> implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新教工所选择的福利
|
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
*/
|
|
||||||
private void renewWelfareSelection(WelfareProject project) {
|
|
||||||
String projectId = project.getId();
|
|
||||||
Sql sql = Sqls.create("""
|
|
||||||
SELECT
|
|
||||||
member.*,
|
|
||||||
list.welfareUnitId as oldunionid,
|
|
||||||
IF(member.unionid = list.welfareUnitId,0,1) as changeUnion
|
|
||||||
FROM
|
|
||||||
`welfare_member` member
|
|
||||||
LEFT JOIN `welfare_list` list ON list.userId = member.id
|
|
||||||
where list.projectId = @projectId
|
|
||||||
""").setParam("projectId", projectId);
|
|
||||||
List<NutMap> users = listMap(sql);
|
|
||||||
|
|
||||||
//所有的福利
|
|
||||||
List<WelfareProjectSubjectOption> options = project.getWelfareProjectSubjects().get(0).getOptions();
|
|
||||||
|
|
||||||
//六院部以外的福利
|
|
||||||
List<WelfareProjectSubjectOption> optionList = options.stream().filter(v -> !v.getOptionName().contains("六院部")).collect(Collectors.toList());
|
|
||||||
|
|
||||||
//此福利用户选择
|
|
||||||
List<WelfareUserSelection> userSelectionList = dao().query(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId));
|
|
||||||
|
|
||||||
Map<String, List<WelfareUserSelection>> userSelectionMap = userSelectionList.stream().collect(Collectors.groupingBy(WelfareUserSelection::getSelectUserId));
|
|
||||||
|
|
||||||
//能选择的分工会Id
|
|
||||||
List<String> canChooseUnionIdList = project.getUnionIdList();
|
|
||||||
|
|
||||||
//不能选择的分工会用户
|
|
||||||
List<NutMap> notChooseUsers = users.stream().filter(v -> StrUtil.isNotBlank(v.getString("unionid")) && !canChooseUnionIdList.contains(v.getString("unionid"))).collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (Lang.isEmpty(userSelectionList)) {
|
|
||||||
//如果选择表中没有记录
|
|
||||||
List<WelfareUserSelection> needInsertWelfareSelectionList = new ArrayList<>();
|
|
||||||
notChooseUsers.forEach(v -> {
|
|
||||||
List<WelfareProjectSubjectOption> welfareProjectSubjectOptions = buildUserOptions(project, v, optionList, null, canChooseUnionIdList);
|
|
||||||
List<WelfareUserSelection> oneUserSelections = buildUserSelection(project, v.getString("id"), welfareProjectSubjectOptions, 1);
|
|
||||||
if (Lang.isNotEmpty(oneUserSelections)) needInsertWelfareSelectionList.addAll(oneUserSelections);
|
|
||||||
});
|
|
||||||
dao().fastInsert(needInsertWelfareSelectionList);
|
|
||||||
} else {
|
|
||||||
//有记录,福利选项可能会减少或增加
|
|
||||||
List<WelfareUserSelection> needInsertWelfareSelectionList = new ArrayList<>();
|
|
||||||
|
|
||||||
users.forEach(v -> {
|
|
||||||
List<WelfareUserSelection> userSelections = userSelectionMap.get(v.getString("id"));
|
|
||||||
List<WelfareProjectSubjectOption> welfareProjectSubjectOptions = new ArrayList<>();
|
|
||||||
//六院部的教工以外,六院部自己选择
|
|
||||||
if (!canChooseUnionIdList.contains(v.getString("unionid"))) {
|
|
||||||
welfareProjectSubjectOptions = buildUserOptions(project, v, optionList, userSelections, canChooseUnionIdList);
|
|
||||||
} else {
|
|
||||||
welfareProjectSubjectOptions = buildUserOptions(project, v, options, userSelections, canChooseUnionIdList);
|
|
||||||
}
|
|
||||||
List<WelfareUserSelection> oneUserSelections = buildUserSelection(project, v.getString("id"), welfareProjectSubjectOptions, 1);
|
|
||||||
if (Lang.isNotEmpty(oneUserSelections)) needInsertWelfareSelectionList.addAll(oneUserSelections);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Lang.isNotEmpty(needInsertWelfareSelectionList)) dao().fastInsert(needInsertWelfareSelectionList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建六院部以外的用户选择节日
|
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
* @param userId
|
|
||||||
* @param options
|
|
||||||
* @param selectNum
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<WelfareUserSelection> buildUserSelection(WelfareProject project, String userId, List<WelfareProjectSubjectOption> options, Integer selectNum) {
|
|
||||||
if (Lang.isEmpty(options)) return null;
|
|
||||||
String projectId = project.getId();
|
|
||||||
return options.stream().map(v -> {
|
|
||||||
WelfareUserSelection welfareUserSelection = new WelfareUserSelection();
|
|
||||||
welfareUserSelection.setId(R.UU32());
|
|
||||||
welfareUserSelection.setSelectUserId(userId);
|
|
||||||
welfareUserSelection.setWelfareId(projectId);
|
|
||||||
welfareUserSelection.setSelectOptionId(v.getId());
|
|
||||||
welfareUserSelection.setSubjectId(v.getSubjectId());
|
|
||||||
welfareUserSelection.setSelectTime(cn.hutool.core.date.DateUtil.date());
|
|
||||||
welfareUserSelection.setSelectNum(selectNum);
|
|
||||||
return welfareUserSelection;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 看根据入职时间,看新进的教工能选择那些节日
|
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
* @param user
|
|
||||||
* @param options 福利选项
|
|
||||||
* @param userSelections 用户已选择的
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<WelfareProjectSubjectOption> buildUserOptions(
|
|
||||||
WelfareProject project, NutMap user,
|
|
||||||
List<WelfareProjectSubjectOption> options,
|
|
||||||
List<WelfareUserSelection> userSelections,
|
|
||||||
List<String> canChooseUnionIdList) {
|
|
||||||
|
|
||||||
String unionId = user.getString("unionid");
|
|
||||||
boolean canChoose = canChooseUnionIdList.contains(unionId);
|
|
||||||
boolean hasSelections = userSelections != null && !userSelections.isEmpty();
|
|
||||||
|
|
||||||
// 如果用户不能选择,并且没有选择任何项目,返回全部选项
|
|
||||||
if (!canChoose && !hasSelections) {
|
|
||||||
return new ArrayList<>(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否为新入职教师
|
|
||||||
boolean isNewlyHired = false;
|
|
||||||
String schoolTimeStr = user.getString("schoolTime");
|
|
||||||
if (StrUtil.isNotBlank(schoolTimeStr)) {
|
|
||||||
isNewlyHired = project.getTeacherSelectList().stream()
|
|
||||||
.anyMatch(v -> cn.hutool.core.date.DateUtil.parseDate(schoolTimeStr).isAfterOrEquals(v.getStartTime()) &&
|
|
||||||
cn.hutool.core.date.DateUtil.parseDate(schoolTimeStr).isBeforeOrEquals(v.getEndTime()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNewlyHired) {
|
|
||||||
// 新入职用户只能选择特定选项
|
|
||||||
Set<String> allowedOptionIds = project.getTeacherSelectList().stream().flatMap(v -> v.getOptionIdList().stream()).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
Set<String> optionIds = options.stream().filter(v -> allowedOptionIds.contains(v.getOptionName())).map(v -> v.getId()).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
// 检查userSelections是否为空,并获取用户已选择的选项ID集合
|
|
||||||
Set<String> userSelectedOptionIds = (userSelections != null) ? userSelections.stream().map(WelfareUserSelection::getSelectOptionId).collect(Collectors.toSet()) : Collections.emptySet();
|
|
||||||
|
|
||||||
// 检查用户选择的选项ID集合是否包含所有允许的选项ID
|
|
||||||
boolean containsAllAllowedOptions = !userSelectedOptionIds.isEmpty() && userSelectedOptionIds.containsAll(optionIds);
|
|
||||||
|
|
||||||
// 如果用户已经选择了所有允许的特定选项,则返回空集合
|
|
||||||
if (containsAllAllowedOptions) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return options.stream().filter(option -> allowedOptionIds.contains(option.getOptionName())).collect(Collectors.toList());
|
|
||||||
} else {
|
|
||||||
// 非新入职用户,根据是否有选择权和已选择的项目进行筛选
|
|
||||||
if (!canChoose) {
|
|
||||||
//选择了节日
|
|
||||||
if (hasSelections) {
|
|
||||||
Set<String> selectedOptionIds = userSelections.stream().map(WelfareUserSelection::getSelectOptionId).collect(Collectors.toSet());
|
|
||||||
return options.stream().filter(option -> !selectedOptionIds.contains(option.getId())).collect(Collectors.toList());
|
|
||||||
} else {
|
|
||||||
// 如果用户没有选择权且没有选择任何项目,返回空列表
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 用户有选择权,返回所有选项
|
|
||||||
if (hasSelections) {
|
|
||||||
// 找出特定名称的选项ID集合
|
|
||||||
Set<String> sixOptionIds = options.stream().filter(v -> v.getOptionName().contains("六院部消费帮扶")).map(WelfareProjectSubjectOption::getId).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
// 找出用户已选择的选项ID集合
|
|
||||||
Set<String> userSelectedIds = userSelections.stream().map(WelfareUserSelection::getSelectOptionId).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
// 检查用户是否选择了特定名称的选项
|
|
||||||
boolean selectedSpecificOption = !Collections.disjoint(sixOptionIds, userSelectedIds);
|
|
||||||
|
|
||||||
if (selectedSpecificOption) {
|
|
||||||
// 如果用户已经选择了特定选项,返回空列表
|
|
||||||
return Collections.emptyList();
|
|
||||||
} else {
|
|
||||||
// 如果用户没有选择特定选项,返回这些选项
|
|
||||||
return options.stream().filter(option -> sixOptionIds.contains(option.getId())).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 如果用户没有选择权,返回空列表
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package io.v.nutz.zhgh.welfare.service.impl;
|
package io.v.nutz.zhgh.welfare.service.impl;
|
||||||
|
|
||||||
import io.v.nutz.base.utils.Roles;
|
|
||||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||||
|
import io.v.nutz.base.utils.Roles;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.sys.models.Sys_user_role;
|
import io.v.nutz.sys.models.Sys_user_role;
|
||||||
import io.v.nutz.sys.services.SysRoleService;
|
import io.v.nutz.sys.services.SysRoleService;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package io.v.nutz.zhgh.welfare.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
|
||||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
|
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProject;
|
||||||
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
import io.v.nutz.zhgh.welfare.model.WelfareProjectSubject;
|
||||||
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.v.nutz.zhgh.welfare.service.impl;
|
package io.v.nutz.zhgh.welfare.service.impl;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.entity.ImageEntity;
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
@@ -43,8 +42,10 @@ import javax.imageio.ImageIO;
|
|||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.lang.reflect.Method;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -163,14 +164,14 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
@Override
|
@Override
|
||||||
public List<NutMap> getUserSelectionByProjectId(String projectId, String month) {
|
public List<NutMap> getUserSelectionByProjectId(String projectId, String month) {
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
cnd.and("u.unionid", "is not", null);
|
cnd.and("wl.welfareUnitId", "is not", null);
|
||||||
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
||||||
cnd.and("u.unionGroupId", "is not", null);
|
// cnd.and("u.unionGroupId", "is not", null);
|
||||||
}
|
}
|
||||||
cnd.andEX("wpus.welfareId", "=", projectId);
|
cnd.andEX("wpus.welfareId", "=", projectId);
|
||||||
if (Strings.isNotBlank(month)) {
|
// if (Strings.isNotBlank(month)) {
|
||||||
cnd.andEX("SUBSTR(u.birthday,6,2)", "=", month.substring(5, 7));
|
// cnd.andEX("SUBSTR(u.birthday,6,2)", "=", month.substring(5, 7));
|
||||||
}
|
// }
|
||||||
cnd.asc("wpus.selectUserId");
|
cnd.asc("wpus.selectUserId");
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
@@ -181,13 +182,10 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
wpus.receiveAddress,
|
wpus.receiveAddress,
|
||||||
wpus.welfareId,
|
wpus.welfareId,
|
||||||
wpus.selectUserId,
|
wpus.selectUserId,
|
||||||
u.unionid AS unionId,
|
wl.welfareUnitId as unionId
|
||||||
u.unioncode AS unionCode,
|
|
||||||
u.unitcode AS unitCode,
|
|
||||||
u.unionGroupId
|
|
||||||
FROM
|
FROM
|
||||||
`welfare_project_user_selection` wpus
|
`welfare_project_user_selection_copy1` wpus
|
||||||
LEFT JOIN `user` u ON u.id = wpus.selectUserId
|
LEFT JOIN welfare_list wl on wl.userId = wpus.selectUserId
|
||||||
$condition
|
$condition
|
||||||
""");
|
""");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
@@ -244,7 +242,7 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
//循环每个分工会
|
//循环每个分工会
|
||||||
welfareUnitList.forEach(v -> {
|
welfareUnitList.forEach(v -> {
|
||||||
//找出这个分工会的人数
|
//找出这个分工会的人数
|
||||||
List<NutMap> collect = viewMap.stream().filter(view -> view.getString("unioncode").equals(v.getString("welfareUnitCode"))).collect(Collectors.toList());
|
List<NutMap> collect = viewMap.stream().filter(view -> view.getString("unionid").equals(v.getString("welfareUnitId"))).collect(Collectors.toList());
|
||||||
v.addv("teacherSum", collect.size());
|
v.addv("teacherSum", collect.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -256,30 +254,35 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
for (NutMap wUnit : welfareUnitList) {
|
for (NutMap wUnit : welfareUnitList) {
|
||||||
//该分工会选择数据
|
//该分工会选择数据
|
||||||
List<NutMap> thisUnionSelectionList;
|
List<NutMap> thisUnionSelectionList;
|
||||||
if (StrUtil.isNotBlank(unionGroupId)) {
|
thisUnionSelectionList = userSelectionList.stream().filter(x ->
|
||||||
thisUnionSelectionList = userSelectionList.stream().filter(x ->
|
x.getString("unionId").equals(wUnit.getString("welfareUnitId")) &&
|
||||||
x.getString("unionCode").equals(wUnit.getString("welfareUnitCode")) &&
|
x.getString("welfareId").equals(projectId)).collect(Collectors.toList());
|
||||||
x.getString("welfareId").equals(projectId) &&
|
// if (StrUtil.isNotBlank(unionGroupId)) {
|
||||||
x.getString("unionGroupId").equals(unionGroupId)).collect(Collectors.toList());
|
// thisUnionSelectionList = userSelectionList.stream().filter(x ->
|
||||||
} else {
|
// x.getString("unionCode").equals(wUnit.getString("welfareUnitId")) &&
|
||||||
thisUnionSelectionList = userSelectionList.stream().filter(x ->
|
// x.getString("welfareId").equals(projectId) &&
|
||||||
x.getString("unionCode").equals(wUnit.getString("welfareUnitCode")) &&
|
// x.getString("unionGroupId").equals(unionGroupId)).collect(Collectors.toList());
|
||||||
x.getString("welfareId").equals(projectId)).collect(Collectors.toList());
|
// } else {
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
optionList.forEach(o -> {
|
optionList.forEach(o -> {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (StrUtil.isNotBlank(unionGroupId)) {
|
count = userSelectionList.stream().filter(x ->
|
||||||
count = userSelectionList.stream().filter(x ->
|
x.getString("unionId").equals(wUnit.getString("welfareUnitId")) &&
|
||||||
x.getString("unionCode").equals(wUnit.getString("welfareUnitCode")) &&
|
x.getString("welfareId").equals(projectId) &&
|
||||||
x.getString("welfareId").equals(projectId) &&
|
x.getString("selectOptionId").equals(o.getString("id"))).mapToInt(x -> x.getInt("selectNum")).sum();
|
||||||
x.getString("unionGroupId").equals(unionGroupId) &&
|
// if (StrUtil.isNotBlank(unionGroupId)) {
|
||||||
x.getString("selectOptionId").equals(o.getString("id"))).mapToInt(x -> x.getInt("selectNum")).sum();
|
// count = userSelectionList.stream().filter(x ->
|
||||||
} else {
|
// x.getString("unionCode").equals(wUnit.getString("welfareUnitId")) &&
|
||||||
count = userSelectionList.stream().filter(x ->
|
// x.getString("welfareId").equals(projectId) &&
|
||||||
x.getString("unionCode").equals(wUnit.getString("welfareUnitCode")) &&
|
// x.getString("unionGroupId").equals(unionGroupId) &&
|
||||||
x.getString("welfareId").equals(projectId) &&
|
// x.getString("selectOptionId").equals(o.getString("id"))).mapToInt(x -> x.getInt("selectNum")).sum();
|
||||||
x.getString("selectOptionId").equals(o.getString("id"))).mapToInt(x -> x.getInt("selectNum")).sum();
|
// } else {
|
||||||
}
|
// count = userSelectionList.stream().filter(x ->
|
||||||
|
// x.getString("unionCode").equals(wUnit.getString("welfareUnitId")) &&
|
||||||
|
// x.getString("welfareId").equals(projectId) &&
|
||||||
|
// x.getString("selectOptionId").equals(o.getString("id"))).mapToInt(x -> x.getInt("selectNum")).sum();
|
||||||
|
// }
|
||||||
//每一项选择的人数
|
//每一项选择的人数
|
||||||
/* Cnd optionCountCnd = Cnd.NEW();
|
/* Cnd optionCountCnd = Cnd.NEW();
|
||||||
Sql optionCountSql = Sqls.create("""
|
Sql optionCountSql = Sqls.create("""
|
||||||
@@ -461,9 +464,8 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
SELECT
|
SELECT
|
||||||
u.loginname AS loginName,
|
u.loginname AS loginName,
|
||||||
u.username AS userName,
|
u.username AS userName,
|
||||||
u.unitname AS unitName,
|
vwl.unionname,
|
||||||
u.threeUnitName AS threeUnitName,
|
vwl.unitname,
|
||||||
u.unionname AS unionName,
|
|
||||||
u.idcard AS idCard,
|
u.idcard AS idCard,
|
||||||
u.mobile,
|
u.mobile,
|
||||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||||
@@ -474,29 +476,23 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
welfare_project_user_selection wpus
|
welfare_project_user_selection wpus
|
||||||
LEFT JOIN `user` u ON u.id = wpus.selectUserId
|
LEFT JOIN `user` u ON u.id = wpus.selectUserId
|
||||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||||
|
LEFT JOIN view_welfare_list vwl on vwl.id = wpus.selectUserId
|
||||||
$condition
|
$condition
|
||||||
$monthCnd
|
$monthCnd
|
||||||
""").setParam("welfareId", projectId);
|
""").setParam("welfareId", projectId);
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
if (Strings.isNotBlank(month)) {
|
|
||||||
cnd.andEX("SUBSTR(u.birthday,6,2)", "=", month.substring(5, 7));
|
|
||||||
}
|
|
||||||
cnd.groupBy("u.loginname ");
|
cnd.groupBy("u.loginname ");
|
||||||
switch (WelfareUnitMode.getMode().name()) {
|
switch (WelfareUnitMode.getMode().name()) {
|
||||||
case "UNION" -> {
|
case "UNION" -> {
|
||||||
cnd.andEX("u.unioncode", "=", welfareUnitCode);
|
cnd.andEX("wu.welfareUnitCode", "=", welfareUnitCode);
|
||||||
cnd.asc("u.unioncode");
|
cnd.asc("wu.welfareUnitCode");
|
||||||
}
|
}
|
||||||
case "UNIT" -> {
|
case "UNIT" -> {
|
||||||
cnd.andEX("u.unitcode", "=", welfareUnitCode);
|
cnd.andEX("u.unitcode", "=", welfareUnitCode);
|
||||||
cnd.asc("u.unitcode");
|
cnd.asc("u.unitcode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Globals.MyConfig.getBoolean("isThreeUnit")) {
|
|
||||||
cnd.and("u.unionGroupId", "is not", null);
|
|
||||||
}
|
|
||||||
cnd.and("wpus.welfareId", "=", projectId);
|
cnd.and("wpus.welfareId", "=", projectId);
|
||||||
cnd.desc("u.threeUnitName");
|
|
||||||
cnd.desc("wpus.selectOptionId");
|
cnd.desc("wpus.selectOptionId");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
return listMap(sql);
|
return listMap(sql);
|
||||||
@@ -534,6 +530,14 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
* 未领取人员信息
|
* 未领取人员信息
|
||||||
*
|
*
|
||||||
* @param projectId
|
* @param projectId
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
* @param welfareUnitCode
|
* @param welfareUnitCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -649,8 +653,7 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
SELECT w2.id, w2.optionName
|
SELECT w2.id, w2.optionName
|
||||||
FROM `welfare_project_subject` w1
|
FROM `welfare_project_subject` w1
|
||||||
JOIN `welfare_project_subject_option` w2 ON w1.id = w2.subjectId
|
JOIN `welfare_project_subject_option` w2 ON w1.id = w2.subjectId
|
||||||
WHERE w1.projectId = @projectId
|
WHERE w1.projectId = @projectId;
|
||||||
order by w2.optionSort asc
|
|
||||||
""");
|
""");
|
||||||
optionSql.setParam("projectId", projectId);
|
optionSql.setParam("projectId", projectId);
|
||||||
List<NutMap> options = (List<NutMap>) Daos.query(dao(), optionSql.toString(), Sqls.callback.maps());
|
List<NutMap> options = (List<NutMap>) Daos.query(dao(), optionSql.toString(), Sqls.callback.maps());
|
||||||
@@ -661,7 +664,6 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
vwl.username,
|
vwl.username,
|
||||||
vwl.unionid,
|
vwl.unionid,
|
||||||
vwl.unionname,
|
vwl.unionname,
|
||||||
vwl.unionGroupName,
|
|
||||||
wpus.userSign,
|
wpus.userSign,
|
||||||
wpus.selectOptionId,
|
wpus.selectOptionId,
|
||||||
wpus.selectNum
|
wpus.selectNum
|
||||||
@@ -695,10 +697,7 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
|
|
||||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||||
exportEntities.add(new ExcelExportEntity("序号", "no", 20));
|
exportEntities.add(new ExcelExportEntity("序号", "no", 20));
|
||||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
|
||||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||||
exportEntities.add(new ExcelExportEntity("工会", "unionname", 20));
|
|
||||||
exportEntities.add(new ExcelExportEntity("工会小组", "unionGroupName", 20));
|
|
||||||
for (NutMap option : options) {
|
for (NutMap option : options) {
|
||||||
exportEntities.add(new ExcelExportEntity(option.getString("optionName"), option.getString("id"), 20));
|
exportEntities.add(new ExcelExportEntity(option.getString("optionName"), option.getString("id"), 20));
|
||||||
}
|
}
|
||||||
@@ -710,17 +709,12 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
|
|||||||
excelExportEntity.setExportImageType(2);
|
excelExportEntity.setExportImageType(2);
|
||||||
exportEntities.add(excelExportEntity);
|
exportEntities.add(excelExportEntity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<String> loginnames = list.stream().map(v -> v.getString("loginname")).distinct().collect(Collectors.toList());
|
List<String> loginnames = list.stream().map(v -> v.getString("loginname")).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
List<NutMap> dataList = loginnames.stream().map(v -> {
|
List<NutMap> dataList = loginnames.stream().map(v -> {
|
||||||
NutMap data = NutMap.NEW();
|
NutMap data = NutMap.NEW();
|
||||||
NutMap userMap = list.stream().filter(x -> x.getString("loginname").equals(v)).findFirst().get();
|
NutMap userMap = list.stream().filter(x -> x.getString("loginname").equals(v)).findFirst().get();
|
||||||
data.put("loginname", userMap.getString("loginname"));
|
|
||||||
data.put("username", userMap.getString("username"));
|
data.put("username", userMap.getString("username"));
|
||||||
data.put("unionname", userMap.getString("unionname"));
|
|
||||||
data.put("unionGroupName", userMap.getString("unionGroupName"));
|
|
||||||
data.put("qzBytes", userMap.get("qzBytes"));
|
data.put("qzBytes", userMap.get("qzBytes"));
|
||||||
for (NutMap option : options) {
|
for (NutMap option : options) {
|
||||||
if (StrUtil.isNotBlank(userMap.getString("selectOptionId"))) {
|
if (StrUtil.isNotBlank(userMap.getString("selectOptionId"))) {
|
||||||
|
|||||||
+24
-26
@@ -8,6 +8,8 @@ package io.v.nutz.zhgh.zgfw.controller.condolence;
|
|||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
|
import io.v.nutz.sys.models.Sys_menu;
|
||||||
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -15,12 +17,15 @@ import org.nutz.dao.Sqls;
|
|||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@IocBean
|
@IocBean
|
||||||
@Ok("json:full")
|
@Ok("json:full")
|
||||||
@@ -37,34 +42,24 @@ public class CondolenceAgentController {
|
|||||||
|
|
||||||
private static final String UCR = "/platform/fw/condolence/ucr";
|
private static final String UCR = "/platform/fw/condolence/ucr";
|
||||||
private static final String FR = "/platform/fw/condolence/fr";
|
private static final String FR = "/platform/fw/condolence/fr";
|
||||||
private static final String VCR = "/platform/fw/condolence/vcr";
|
private static final String VCR = "/platform/fw/condolence/vcr/school";
|
||||||
private static final String ECR = "/platform/fw/condolence/ecr";
|
private static final String ECR = "/platform/fw/condolence/ecr";
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object getAgenda() {
|
public Object getAgenda() {
|
||||||
|
final String title = "【职工慰问】";
|
||||||
|
|
||||||
List<NutMap> result = new ArrayList<>();
|
List<NutMap> result = new ArrayList<>();
|
||||||
if (ShiroUtil.hasAnyRoles("sysadmin")) {
|
|
||||||
result.add(new NutMap().setv("url", UCR).setv("iconClass", vi.getIconByPath(UCR)).setv("label", "六必访基层工会审核").setv("number", getUcrCount()));
|
result.add(new NutMap().setv("title", title).setv("url", UCR).setv("iconClass", vi.getIconByPath(UCR)).setv("label", "待院级工会审核").setv("number", getUcrCount()));
|
||||||
result.add(new NutMap().setv("url", FR).setv("iconClass", vi.getIconByPath(FR)).setv("label", "六必访待工会会计审核").setv("number", getFrCount()));
|
result.add(new NutMap().setv("title", title).setv("url", FR).setv("iconClass", vi.getIconByPath(FR)).setv("label", "待二级党组织审核").setv("number", getFrCount()));
|
||||||
result.add(new NutMap().setv("url", VCR).setv("iconClass", vi.getIconByPath(VCR)).setv("label", "六必访校工会主席审核").setv("number", getVcrCount()));
|
result.add(new NutMap().setv("title", title).setv("url", VCR).setv("iconClass", vi.getIconByPath(VCR)).setv("label", "待校工会审核").setv("number", getVcrCount()));
|
||||||
result.add(new NutMap().setv("url", ECR).setv("iconClass", vi.getIconByPath(ECR)).setv("label", "六必访待工会常务副主席审核").setv("number", getEcrCount()));
|
result.add(new NutMap().setv("title", title).setv("url", ECR).setv("iconClass", vi.getIconByPath(ECR)).setv("label", "待工会常务副主席审核").setv("number", getEcrCount()));
|
||||||
} else {
|
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||||
if (ShiroUtil.hasAnyRoles("H01,gh01")) {
|
List<Sys_menu> menus = Optional.ofNullable(user).orElse(new Sys_user()).getMenus();
|
||||||
result.add(new NutMap().setv("url", UCR).setv("iconClass", vi.getIconByPath(UCR)).setv("label", "六必访基层工会审核").setv("number", getUcrCount()));
|
return result.stream().filter(v -> Strings.isNotBlank(v.getString("url")) && menus.stream().anyMatch(x -> Strings.isNotBlank(x.getHref()) && v.getString("url").equals(x.getHref()))).distinct().collect(Collectors.toList());
|
||||||
}
|
|
||||||
if (ShiroUtil.hasRole("xghkj")) {
|
|
||||||
result.add(new NutMap().setv("url", FR).setv("iconClass", vi.getIconByPath(FR)).setv("label", "六必访待工会会计审核").setv("number", getFrCount()));
|
|
||||||
}
|
|
||||||
if (ShiroUtil.hasRole("wyh02")) {
|
|
||||||
result.add(new NutMap().setv("url", VCR).setv("iconClass", vi.getIconByPath(VCR)).setv("label", "六必访校工会主席审核").setv("number", getVcrCount()));
|
|
||||||
}//暂时没用
|
|
||||||
if (ShiroUtil.hasRole("wyh02")) {
|
|
||||||
result.add(new NutMap().setv("url", ECR).setv("iconClass", vi.getIconByPath(ECR)).setv("label", "六必访待工会常务副主席审核").setv("number", getEcrCount()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +71,7 @@ public class CondolenceAgentController {
|
|||||||
private Integer getUcrCount() {
|
private Integer getUcrCount() {
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT COUNT(1) FROM condolence con LEFT JOIN `user` us ON con.manager=us.id $condition
|
SELECT COUNT(1) FROM condolence con LEFT JOIN `user` us ON con.be_user=us.id $condition
|
||||||
""");
|
""");
|
||||||
cnd.and("con.state_id", "=", 2000);
|
cnd.and("con.state_id", "=", 2000);
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||||
@@ -88,11 +83,12 @@ public class CondolenceAgentController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 待工会会计审核
|
* 待工会会计审核
|
||||||
*暂时没用
|
* 暂时没用
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getFrCount() {
|
private Integer getFrCount() {
|
||||||
return condolenceService.count(Cnd.where("state_id", "=", 2020));
|
return condolenceService.count(Cnd.where("state_id", "=", 2012));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,12 +97,14 @@ public class CondolenceAgentController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getVcrCount() {
|
private Integer getVcrCount() {
|
||||||
return condolenceService.count(Cnd.where("state_id", "=", 2040));
|
int state_id = condolenceService.count(Cnd.where("state_id", "=", 2020));
|
||||||
|
return state_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待工会常务副主席审核
|
* 待工会常务副主席审核
|
||||||
*暂时没用
|
* 暂时没用
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getEcrCount() {
|
private Integer getEcrCount() {
|
||||||
|
|||||||
@@ -1,48 +1,41 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
import io.v.nutz.base.utils.MsgApi;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.sys.models.Sys_local_process_instance;
|
|
||||||
import io.v.nutz.sys.models.Sys_signature;
|
import io.v.nutz.sys.models.Sys_signature;
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.sys.services.SysSignatureService;
|
import io.v.nutz.sys.services.SysSignatureService;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.entity.Record;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||||
import org.nutz.ioc.aop.Aop;
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
* @DateTime: 2020/11/20 11:49
|
* @DateTime: 2020/11/20 11:49
|
||||||
* @Description: 慰问申请
|
* @Description: 慰问申请
|
||||||
*/
|
*/
|
||||||
@At("/platform/fw/condolence/apply")
|
@At({"/platform/fw/condolence/apply", "/platform/fw/condolence/applyWrite"})
|
||||||
@IocBean
|
@IocBean
|
||||||
@RequiresAuthentication
|
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
public class CondolenceApplyCon {
|
public class CondolenceApplyCon {
|
||||||
|
|
||||||
@@ -64,10 +57,21 @@ public class CondolenceApplyCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.apply")
|
||||||
public Object queryUser(String query) {
|
public Object queryUser(String query) {
|
||||||
Sql sql = Sqls.create("SELECT u.id,u.username,u.loginname from sys_user u left join sys_unit unit on u.unitid = unit.id left join sys_union un on unit.unionid = un.id $condition");
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT u.id,
|
||||||
|
u.username,
|
||||||
|
u.loginname,
|
||||||
|
IFNULL(u.unitname,'暂无') as unitname,
|
||||||
|
u.sex
|
||||||
|
from user u
|
||||||
|
left join sys_unit unit on u.unitid = unit.id
|
||||||
|
left join sys_union un on unit.unionid = un.id
|
||||||
|
$condition
|
||||||
|
""");
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("u.id", "!=", ShiroUtil.getPlatformUid());
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||||
cnd.and("un.id", "=", vi.getUnionId());
|
cnd.and("un.id", "=", vi.getUnionId());
|
||||||
}
|
}
|
||||||
@@ -75,8 +79,9 @@ public class CondolenceApplyCon {
|
|||||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||||
group.orLike("u.username", query);
|
group.orLike("u.username", query);
|
||||||
group.orLike("u.loginname", query);
|
group.orLike("u.loginname", query);
|
||||||
|
group.orEquals("u.id", query);
|
||||||
cnd.and(group);
|
cnd.and(group);
|
||||||
|
cnd.asc("u.unionname").asc("unitname");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
|
|
||||||
return condolenceService.listPage(1, 50, sql).getList();
|
return condolenceService.listPage(1, 50, sql).getList();
|
||||||
@@ -90,8 +95,9 @@ public class CondolenceApplyCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.apply")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doAdd(@Param("data") Condolence condolence, String sign,
|
public Object doAdd(@Param(value = "data", required = false) Condolence condolence, @Param(value = "sign", required = false) String sign,
|
||||||
@Param(value = "hospital_stay_1", required = false) String hospital_stay_1,
|
@Param(value = "hospital_stay_1", required = false) String hospital_stay_1,
|
||||||
@Param(value = "hospital_stay_2", required = false) String hospital_stay_2) {
|
@Param(value = "hospital_stay_2", required = false) String hospital_stay_2) {
|
||||||
|
|
||||||
@@ -100,55 +106,71 @@ public class CondolenceApplyCon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
condolence.setManager(ShiroUtil.getPrincipalProperty("id").toString());
|
condolence.setManager(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
condolence.setApply_time(DateUtil.getDate());
|
condolence.setApply_time(DateUtil.getDateTime());
|
||||||
condolence.setStarting_time(hospital_stay_1);
|
condolence.setStarting_time(hospital_stay_1);
|
||||||
condolence.setEnd_time(hospital_stay_2);
|
condolence.setEnd_time(hospital_stay_2);
|
||||||
/*if (ShiroUtil.hasAnyRoles("H04,gh01")) {
|
/* if (ShiroUtil.hasAnyRoles("H04,gh01")) {
|
||||||
condolence.setState_id("2040");
|
condolence.setState_id("2040");
|
||||||
}*/
|
}*/
|
||||||
condolence.setState_id("2000");
|
condolence.setState_id("2000");
|
||||||
// condolenceService.add(condolence);
|
condolenceService.add(condolence);
|
||||||
|
|
||||||
if (StrUtil.isBlank(condolence.getId())) {
|
Sql unionAdminSql = Sqls.create("""
|
||||||
Condolence add = condolenceService.add(condolence);
|
SELECT
|
||||||
|
u.username,
|
||||||
//开启流程
|
u.loginname
|
||||||
CondolenceToDoHandler.START_PROCESS.exec(add, null);
|
FROM
|
||||||
|
sys_user_role sur
|
||||||
//提交后分工会审核
|
LEFT JOIN sys_user u ON u.id = sur.userId\s
|
||||||
CondolenceToDoHandler.CREATE_UNION_TASK.exec(add, null);
|
AND sur.unionid = @unionId
|
||||||
// //提交申请,发企业微信通知给基层工会主席
|
WHERE
|
||||||
// List<User> unionManageByCurrentUser = vi.getUnionManageByCurrentUser();
|
sur.roleId = '5d342e614e9a48288d50154bcdcc75d3'\s
|
||||||
// for (User item : unionManageByCurrentUser) {
|
AND sur.unionid = @unionId
|
||||||
// String msg = "%s您好,%s老师提交了日常慰问申请,请您登录OA办公系统(待办中心)或登陆智慧工会平台进行审核。".formatted(item.getUsername(), ShiroUtil.getPlatformUsername());
|
""");
|
||||||
// msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(item.getLoginname()), "");
|
unionAdminSql.setParam("unionId", Vi.getUnionId());
|
||||||
// }
|
List<NutMap> unionAdmins = condolenceService.listMap(unionAdminSql);
|
||||||
} else {
|
for (NutMap unionAdmin : unionAdmins) {
|
||||||
Condolence edit = condolenceService.edit(condolence);
|
String msg = "%s主席您好!您分工会下的%s老师申请了一条慰问,请您登录智慧工会系统职工服务>职工慰问下审核.".formatted(
|
||||||
|
unionAdmin.getString("username"), ShiroUtil.getPrincipalProperty("username"));
|
||||||
if (StrUtil.isNotBlank(edit.getVice_chairman_review()) || StrUtil.isNotBlank(edit.getUnion_chairman_review())) {
|
// msgApi.sendMsg(unionAdmin.getString("loginname"), msg);
|
||||||
int count = condolenceService.dao().count(Sys_local_process_instance.class, Cnd.where("processUniqueId", "=", "condolence_apply@" + edit.getId()));
|
System.out.println(msg);
|
||||||
if (count > 0) {
|
|
||||||
CondolenceToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(edit, "退回重新提交");
|
|
||||||
CondolenceToDoHandler.CREATE_UNION_TASK.exec(edit, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CondolenceToDoHandler.START_PROCESS.exec(condolence, null);
|
||||||
|
CondolenceToDoHandler.CREATE_UNION_TASK.exec(condolence, null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.info")
|
||||||
|
public Object doEdit(@Param("data") Condolence condolence,
|
||||||
|
@Param(value = "sign", required = false) String sign,
|
||||||
|
@Param(value = "hospital_stay_1", required = false) String hospital_stay_1,
|
||||||
|
@Param(value = "hospital_stay_2", required = false) String hospital_stay_2) {
|
||||||
|
if (Strings.isNotBlank(sign)) {
|
||||||
|
condolence.setManager_sign(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||||
|
}
|
||||||
|
condolence.setState_id("2000");
|
||||||
|
condolence.setStarting_time(hospital_stay_1);
|
||||||
|
condolence.setEnd_time(hospital_stay_2);
|
||||||
|
condolenceService.updateIgnoreNull(condolence);
|
||||||
|
|
||||||
|
// CondolenceToDoHandler.START_PROCESS.exec(condolence, null);
|
||||||
|
// CondolenceToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(condolence, null);
|
||||||
|
// CondolenceToDoHandler.CREATE_UNION_TASK.exec(condolence, null);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
|
@RequiresPermissions("fw.condolence.apply")
|
||||||
public Object getUserData(String userId) {
|
public Object getUserData(String userId) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT us.*,unit.id,unit.`name` FROM sys_user us LEFT JOIN sys_unit unit ON us.unitid=unit.id WHERE us.id=@userId
|
SELECT us.*,unit.id unitid,unit.`name` FROM sys_user us LEFT JOIN sys_unit unit ON us.unitid=unit.id WHERE us.id=@userId
|
||||||
""");
|
""");
|
||||||
sql.setParam("userId", userId);
|
sql.setParam("userId", userId);
|
||||||
List<Record> list = sysUserService.list(sql);
|
return Result.success().addData(sysUserService.list(sql).get(0));
|
||||||
if (Lang.isNotEmpty(list)) {
|
|
||||||
return Result.success().addData(list.get(0));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +1,33 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.service.BaseService;
|
import cn.wizzer.framework.base.service.BaseService;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
|
||||||
import com.deepoove.poi.config.Configure;
|
|
||||||
import com.deepoove.poi.data.PictureRenderData;
|
|
||||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
|
||||||
import com.google.zxing.BarcodeFormat;
|
|
||||||
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
||||||
import com.google.zxing.common.BitMatrix;
|
|
||||||
import com.google.zxing.qrcode.QRCodeWriter;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.model.Review;
|
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||||
import io.v.nutz.base.utils.Roles;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.sys.models.Sys_file;
|
|
||||||
import io.v.nutz.sys.models.Sys_signature;
|
import io.v.nutz.sys.models.Sys_signature;
|
||||||
import io.v.nutz.sys.services.SysSignatureService;
|
import io.v.nutz.sys.services.SysSignatureService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
|
||||||
import org.nutz.boot.starter.ftp.FtpService;
|
import org.nutz.boot.starter.ftp.FtpService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.entity.Record;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.aop.Aop;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.json.Json;
|
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.apache.commons.beanutils.ConvertUtils.convert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
* @DateTime: 2020/11/20 11:49
|
* @DateTime: 2020/11/20 11:49
|
||||||
* @Description: 慰问信息
|
* @Description: 慰问信息
|
||||||
*/
|
*/
|
||||||
@At("/platform/fw/condolence")
|
@At({"/platform/fw/condolence", "/platform/fw/condolence/myList"})
|
||||||
@IocBean
|
@IocBean
|
||||||
@RequiresAuthentication
|
@RequiresAuthentication
|
||||||
@Ok("json:full")
|
@Ok("json:full")
|
||||||
@@ -78,8 +48,12 @@ public class CondolenceCon {
|
|||||||
@Inject
|
@Inject
|
||||||
private BaseService baseService;
|
private BaseService baseService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OfficeTemplateUtil officeTemplateUtil;
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.info")
|
||||||
public Object findOne(String id) {
|
public Object findOne(String id) {
|
||||||
return condolenceService.findOne(id);
|
return condolenceService.findOne(id);
|
||||||
}
|
}
|
||||||
@@ -87,7 +61,17 @@ public class CondolenceCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String year, String unitId, String unionId, String type, String way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.info")
|
||||||
|
public Object pageData(@Param(value = "year", required = false) String year,
|
||||||
|
@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
|
@Param(value = "type", required = false) String type,
|
||||||
|
@Param(value = "way", required = false) String way,
|
||||||
|
@Param(value = "searchName", required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||||
|
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
@@ -100,68 +84,14 @@ public class CondolenceCon {
|
|||||||
be.unitname be_unitname,
|
be.unitname be_unitname,
|
||||||
be.unionname be_unionname,
|
be.unionname be_unionname,
|
||||||
state.state_name,
|
state.state_name,
|
||||||
state.state_color,(
|
state.state_color
|
||||||
CASE
|
|
||||||
state.state_id
|
|
||||||
WHEN @state1 THEN
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
GROUP_CONCAT( u.username )
|
|
||||||
FROM
|
|
||||||
sys_user_role sur
|
|
||||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
|
||||||
WHERE
|
|
||||||
sur.unionid = be.unionid
|
|
||||||
AND sur.roleId = @role1
|
|
||||||
)
|
|
||||||
WHEN @state2 THEN
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
GROUP_CONCAT( u.username )
|
|
||||||
FROM
|
|
||||||
sys_user_role sur
|
|
||||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
|
||||||
WHERE
|
|
||||||
sur.roleId = @role2
|
|
||||||
)
|
|
||||||
WHEN @state3 THEN
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
GROUP_CONCAT( u.username )
|
|
||||||
FROM
|
|
||||||
sys_user_role sur
|
|
||||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
|
||||||
WHERE
|
|
||||||
sur.roleId = @role3
|
|
||||||
)
|
|
||||||
WHEN @state4 THEN
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
GROUP_CONCAT( u.username )
|
|
||||||
FROM
|
|
||||||
sys_user_role sur
|
|
||||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
|
||||||
WHERE
|
|
||||||
sur.roleId = @role4
|
|
||||||
) ELSE NULL
|
|
||||||
END
|
|
||||||
) shrname
|
|
||||||
FROM
|
FROM
|
||||||
condolence con
|
condolence con
|
||||||
LEFT JOIN `user` be ON con.be_user = be.id
|
LEFT JOIN `user` be ON con.be_user = be.id
|
||||||
LEFT JOIN `user` sqr ON con.manager= sqr.id
|
LEFT JOIN `user` sqr ON con.manager= sqr.id
|
||||||
LEFT JOIN state state ON state.state_id = con.state_id
|
LEFT JOIN state state ON state.state_id = con.state_id
|
||||||
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
||||||
""");
|
""");
|
||||||
sql.setParam("role1", Roles.UNION_MANGER);
|
|
||||||
sql.setParam("role2", Roles.XGHKJ);
|
|
||||||
sql.setParam("role3", Roles.GH_WYH_CWFZX);
|
|
||||||
// 暂时没用
|
|
||||||
sql.setParam("role4", Roles.GH_WYH_CWFZX);
|
|
||||||
sql.setParam("state1", 2000);
|
|
||||||
sql.setParam("state2", 2020);
|
|
||||||
sql.setParam("state3", 2040);
|
|
||||||
sql.setParam("state4", 2060);
|
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||||
cnd.and("con.manager", "=", ShiroUtil.getPrincipalProperty("id"));
|
cnd.and("con.manager", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||||
@@ -180,7 +110,7 @@ public class CondolenceCon {
|
|||||||
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
||||||
cnd.orderBy(pageOrderName, pageOrderBy);
|
cnd.orderBy(pageOrderName, pageOrderBy);
|
||||||
} else {
|
} else {
|
||||||
cnd.desc("con.apply_time").asc("type.`code`");
|
cnd.desc("con.apply_time");
|
||||||
}
|
}
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
@@ -193,7 +123,12 @@ public class CondolenceCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object doEdit(@Param("data") Condolence condolence, String[] delNotesList, String sign) {
|
@RequiresPermissions("fw.condolence.info")
|
||||||
|
public Object doEdit(@Param("data") Condolence condolence,
|
||||||
|
@Param(value = "delNotesList", required = false) String[] delNotesList,
|
||||||
|
@Param(value = "sign", required = false) String sign,
|
||||||
|
@Param(value = "hospital_stay_1", required = false) String hospital_stay_1,
|
||||||
|
@Param(value = "hospital_stay_2", required = false) String hospital_stay_2) {
|
||||||
if (delNotesList != null && delNotesList.length > 0) {
|
if (delNotesList != null && delNotesList.length > 0) {
|
||||||
for (String s : delNotesList) {
|
for (String s : delNotesList) {
|
||||||
if (Strings.isNotBlank(s)) {
|
if (Strings.isNotBlank(s)) {
|
||||||
@@ -212,7 +147,13 @@ public class CondolenceCon {
|
|||||||
if (Strings.isNotBlank(sign)) {
|
if (Strings.isNotBlank(sign)) {
|
||||||
condolence.setManager_sign(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
condolence.setManager_sign(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||||
}
|
}
|
||||||
condolenceService.edit(condolence);
|
if (condolence.getState_id().equals("1990") || condolence.getState_id().equals("1995")) {
|
||||||
|
condolence.setState_id("2000");
|
||||||
|
}
|
||||||
|
|
||||||
|
condolence.setStarting_time(hospital_stay_1);
|
||||||
|
condolence.setEnd_time(hospital_stay_2);
|
||||||
|
condolenceService.updateIgnoreNull(condolence);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,250 +162,13 @@ public class CondolenceCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@RequiresPermissions("fw.condolence.info")
|
||||||
public Object doDelete(String id) {
|
public Object doDelete(String id) {
|
||||||
Condolence condolence = condolenceService.fetch(id);
|
Condolence condolence = condolenceService.fetch(id);
|
||||||
vi.deleteSysFiles(condolence.getFiles());
|
vi.deleteSysFiles(condolence.getFiles());
|
||||||
baseService.clear("goods", Cnd.where("reid", "=", id));
|
baseService.clear("goods", Cnd.where("reid", "=", id));
|
||||||
condolenceService.del(id);
|
condolenceService.del(id);
|
||||||
CondolenceToDoHandler.DELETE_PROCESS_AND_TASK.exec(condolence,null);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PictureRenderData getImg(String base64) throws IOException {
|
|
||||||
try{
|
|
||||||
if(StrUtil.isBlank(base64)){
|
|
||||||
return new PictureRenderData(70, 30, ".png", new byte[]{});
|
|
||||||
}
|
|
||||||
System.out.println(base64);
|
|
||||||
String s = base64.split(",")[1];
|
|
||||||
byte[] bytes = Base64.getDecoder().decode(s);
|
|
||||||
return new PictureRenderData(70, 30, ".png", bytes);
|
|
||||||
}catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出报销表
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param response
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
public void doExport(String id, HttpServletResponse response) throws Exception {
|
|
||||||
Record record = condolenceService.findOne(id);
|
|
||||||
|
|
||||||
List<Record> query1 = baseService.dao().query("goods", Cnd.where("reid", "=", id));
|
|
||||||
|
|
||||||
|
|
||||||
double price = record.getDouble("money");
|
|
||||||
int money_int = (int) price;
|
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(price));
|
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(money_int));
|
|
||||||
double moneyAngle = b1.subtract(b2).doubleValue();
|
|
||||||
BigDecimal b3 = new BigDecimal(moneyAngle);
|
|
||||||
|
|
||||||
|
|
||||||
record.set("one", money_int >= 1000000 ? (money_int / 1000000) % 10 : null);
|
|
||||||
record.set("two", money_int >= 100000 ? (money_int / 100000) % 10 : null);
|
|
||||||
record.set("three", money_int >= 10000 ? (money_int / 10000) % 10 : null);
|
|
||||||
record.set("four", money_int >= 1000 ? (money_int / 1000) % 10 : null);
|
|
||||||
record.set("five", money_int >= 100 ? (money_int / 100) % 10 : null);
|
|
||||||
record.set("six", money_int >= 10 ? (money_int / 10) % 10 : null);
|
|
||||||
record.set("seven", money_int >= 10 ? money_int % 10 : null);
|
|
||||||
record.set("eight", (int) (moneyAngle * 10));
|
|
||||||
record.set("nine", (int) (moneyAngle * 100 % 10));
|
|
||||||
|
|
||||||
String files = record.getString("files");
|
|
||||||
if (Strings.isNotBlank(files)) {
|
|
||||||
record.set("invoice_num", Json.fromJsonAsList(Sys_file.class, files).size());
|
|
||||||
}
|
|
||||||
|
|
||||||
Object vcr = record.get("vcr");
|
|
||||||
if (vcr != null) {
|
|
||||||
Review review = (Review) vcr;
|
|
||||||
record.set("vcr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object ucr = record.get("ucr");
|
|
||||||
if (ucr != null) {
|
|
||||||
Review review = (Review) ucr;
|
|
||||||
record.set("ucr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object ecr = record.get("ecr");
|
|
||||||
if (ecr != null) {
|
|
||||||
Review review = (Review) ecr;
|
|
||||||
record.set("ecr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object fr = record.get("fr");
|
|
||||||
if (fr != null) {
|
|
||||||
Review review = (Review) fr;
|
|
||||||
record.set("fr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
String ms = record.getString("manager_sign");
|
|
||||||
if (Strings.isNotBlank(ms)) {
|
|
||||||
record.set("ms", getImg(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
record.set("money_big", Convert.digitToChinese(record.getDouble("money")));
|
|
||||||
|
|
||||||
String suffix = "中国药科大学报销凭证";
|
|
||||||
|
|
||||||
record.set("suffix", suffix);
|
|
||||||
|
|
||||||
response.addHeader("Content-Type", "application/octet-stream");
|
|
||||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(suffix.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
|
||||||
|
|
||||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
|
||||||
Configure config = Configure.newBuilder().bind("goods", policy).build();
|
|
||||||
record.set("goods", query1);
|
|
||||||
|
|
||||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/condolence/condolence.docx");
|
|
||||||
XWPFTemplate.compile(inputStream, config).render(record, response.getOutputStream());
|
|
||||||
inputStream.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* @At
|
|
||||||
@ViReturn
|
|
||||||
public void export(String id, HttpServletResponse response) throws Exception {
|
|
||||||
|
|
||||||
response.addHeader("Content-Type", "application/octet-stream");
|
|
||||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String("职工慰问报销审批单".getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
|
||||||
Record record = condolenceService.findOne(id);
|
|
||||||
|
|
||||||
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
|
||||||
BitMatrix bitMatrix = qrCodeWriter.encode(record.getString("document_no"), BarcodeFormat.QR_CODE, 80, 80);
|
|
||||||
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
|
||||||
PictureRenderData pictureRenderData = new PictureRenderData(80, 80, ".png", bufferedImage);
|
|
||||||
record.set("qrcode", pictureRenderData);
|
|
||||||
|
|
||||||
//自己签字
|
|
||||||
String ms = record.getString("manager_sign");
|
|
||||||
if (Strings.isNotBlank(ms)) {
|
|
||||||
record.set("ms", getImg(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//分工会主席
|
|
||||||
Object ucr = record.get("ucr");
|
|
||||||
if (ucr != null) {
|
|
||||||
Review review = (Review) ucr;
|
|
||||||
record.set("ucr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("ucrTime", review.getTime());
|
|
||||||
record.set("ucrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
//财务
|
|
||||||
Object fr = record.get("fr");
|
|
||||||
if (fr != null) {
|
|
||||||
Review review = (Review) fr;
|
|
||||||
record.set("fr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("frTime", review.getTime());
|
|
||||||
record.set("frOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//工会副主席
|
|
||||||
Object vcr = record.get("vcr");
|
|
||||||
if (vcr != null) {
|
|
||||||
Review review = (Review) vcr;
|
|
||||||
record.set("vcr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("vcrTime", review.getTime());
|
|
||||||
record.set("vcrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
//校工会常务副主席
|
|
||||||
Object ecr = record.get("ecr");
|
|
||||||
if (ecr != null) {
|
|
||||||
Review review = (Review) ecr;
|
|
||||||
record.set("ecr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("ecrTime", review.getTime());
|
|
||||||
record.set("ecrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
record.set("money_big", MoneyUtil.toRMBUpper(record.getString("money")));
|
|
||||||
|
|
||||||
Configure config = Configure.newBuilder().build();
|
|
||||||
|
|
||||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/condolence/record.docx");
|
|
||||||
XWPFTemplate.compile(inputStream, config).render(record, response.getOutputStream());
|
|
||||||
inputStream.close();
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("void")
|
|
||||||
public void export(String id, HttpServletResponse response) throws Exception {
|
|
||||||
Record record = condolenceService.findOne(id);
|
|
||||||
List<Record> query1 = baseService.dao().query("goods", Cnd.where("reid", "=", id));
|
|
||||||
|
|
||||||
//自己签字
|
|
||||||
String ms = record.getString("manager_sign");
|
|
||||||
if (Strings.isNotBlank(ms)) {
|
|
||||||
record.set("ms", getImg(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//分工会主席
|
|
||||||
Object ucr = record.get("ucr");
|
|
||||||
if (ucr != null) {
|
|
||||||
Review review = (Review) ucr;
|
|
||||||
record.set("ucr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("ucrTime", review.getTime());
|
|
||||||
record.set("ucrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
//财务
|
|
||||||
Object fr = record.get("fr");
|
|
||||||
if (fr != null) {
|
|
||||||
Review review = (Review) fr;
|
|
||||||
record.set("fr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("frTime", review.getTime());
|
|
||||||
record.set("frOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//工会副主席
|
|
||||||
Object vcr = record.get("vcr");
|
|
||||||
if (vcr != null) {
|
|
||||||
Review review = (Review) vcr;
|
|
||||||
record.set("vcr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("vcrTime", review.getTime());
|
|
||||||
record.set("vcrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
//校工会常务副主席
|
|
||||||
Object ecr = record.get("ecr");
|
|
||||||
if (ecr != null) {
|
|
||||||
Review review = (Review) ecr;
|
|
||||||
record.set("ecr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("ecrTime", review.getTime());
|
|
||||||
record.set("ecrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
|
||||||
Configure config = Configure.newBuilder().bind("goods", policy).build();
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
map.put("c", record);
|
|
||||||
map.put("goods", query1);
|
|
||||||
|
|
||||||
String fileName = "中国药科大学在职工会会员慰问审批表";
|
|
||||||
response.addHeader("Content-Type", "application/octet-stream");
|
|
||||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
|
||||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/condolence/must_visit.docx");
|
|
||||||
XWPFTemplate.compile(inputStream, config).render(record, response.getOutputStream());
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.model.Review;
|
||||||
import io.v.nutz.base.service.ReviewService;
|
import io.v.nutz.base.service.ReviewService;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.model.Review;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
@@ -17,6 +17,7 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
@@ -32,13 +33,6 @@ public class CondolenceEcrCon {
|
|||||||
@Inject
|
@Inject
|
||||||
private Vi vi;
|
private Vi vi;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CondolenceService condolenceService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ReviewService reviewService;
|
|
||||||
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/condolence/ecr.html")
|
@Ok("beetl:/platform/zgfw/condolence/ecr.html")
|
||||||
@RequiresPermissions("fw.condolence.ecr")
|
@RequiresPermissions("fw.condolence.ecr")
|
||||||
@@ -48,7 +42,17 @@ public class CondolenceEcrCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String unionid, Boolean isAudit, Integer year, Integer type, Integer way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.ecr")
|
||||||
|
public Object pageData(@Param(value = "unionid",required = false) String unionid,
|
||||||
|
@Param(value = "isAudit",required = false) Boolean isAudit,
|
||||||
|
@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "type",required = false) Integer type,
|
||||||
|
@Param(value = "way",required = false) Integer way,
|
||||||
|
@Param(value = "searchName",required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName",required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy",required = false) String pageOrderBy) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
con.*,
|
con.*,
|
||||||
@@ -94,8 +98,15 @@ public class CondolenceEcrCon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CondolenceService condolenceService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ReviewService reviewService;
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.ecr")
|
||||||
public Object doReview(String id, boolean pass, Review review) {
|
public Object doReview(String id, boolean pass, Review review) {
|
||||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||||
|
|||||||
@@ -1,22 +1,28 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.model.Review;
|
import io.v.nutz.base.model.Review;
|
||||||
import io.v.nutz.base.service.ReviewService;
|
import io.v.nutz.base.service.ReviewService;
|
||||||
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
|
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
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.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
@@ -41,35 +47,49 @@ public class CondolenceFrCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String unitId, Boolean isAudit, String year, String type, String way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.fr")
|
||||||
|
public Object pageData(@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
|
@Param(value = "isAudit", required = false) Boolean isAudit,
|
||||||
|
@Param(value = "year", required = false) Integer year,
|
||||||
|
@Param(value = "type", required = false) Integer type,
|
||||||
|
@Param(value = "way", required = false) Integer way,
|
||||||
|
@Param(value = "searchName", required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
con.*,
|
con.*,
|
||||||
type.`name` type_name,
|
type.`name` type_name,
|
||||||
be.username be_username,
|
be.username be_username,
|
||||||
be_unit.`name` be_unitname,
|
be.loginname be_loginname,
|
||||||
man.username man_username,
|
sqr.username sqr_username,
|
||||||
be_union.unionname,
|
be.unitname be_unitname,
|
||||||
state.state_name,
|
be.unionname be_unionname,
|
||||||
state.state_color
|
state.state_name,
|
||||||
FROM
|
state.state_color
|
||||||
condolence con
|
FROM
|
||||||
LEFT JOIN sys_user be ON con.be_user = be.id
|
condolence con
|
||||||
LEFT JOIN sys_user man ON con.manager = man.id
|
LEFT JOIN `user` be ON con.be_user = be.id
|
||||||
LEFT JOIN sys_unit be_unit ON be.unitid = be_unit.id
|
LEFT JOIN `user` sqr ON con.manager= sqr.id
|
||||||
LEFT JOIN sys_union be_union ON be_unit.unionid = be_union.id
|
LEFT JOIN state state ON state.state_id = con.state_id
|
||||||
LEFT JOIN state state ON state.state_id = con.state_id
|
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
||||||
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
""");
|
||||||
""");
|
|
||||||
|
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
|
|
||||||
cnd.and("con.state_id", isAudit ? ">" : "=", 2020);
|
cnd.and("con.state_id", isAudit ? ">" : "in", isAudit ? 2012 : Lang.array(2012, 2031));
|
||||||
|
|
||||||
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionCondolenceAdmin")) {
|
||||||
|
Vi.cndPlus(cnd, "be.unitid", "=", ShiroUtil.getPrincipalProperty("unitid"));
|
||||||
|
}
|
||||||
Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year);
|
Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year);
|
||||||
Vi.cndPlus(cnd, "con.type", "=", type);
|
Vi.cndPlus(cnd, "con.type", "=", type);
|
||||||
Vi.cndPlus(cnd, "con.way", "=", way);
|
Vi.cndPlus(cnd, "con.way", "=", way);
|
||||||
Vi.cndPlus(cnd, "be_unit.id", "=", unitId);
|
Vi.cndPlus(cnd, "be.unitid", "=", unitId);
|
||||||
|
Vi.cndPlus(cnd, "be.unionid", "=", unionId);
|
||||||
|
|
||||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||||
cnd.where().andLike(searchName, searchKeyword);
|
cnd.where().andLike(searchName, searchKeyword);
|
||||||
@@ -95,7 +115,9 @@ public class CondolenceFrCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object doReview(String id, boolean pass, Review review, double money) {
|
@RequiresPermissions("fw.condolence.fr")
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public Object doReview(String id, Integer pass, Review review, double money) {
|
||||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||||
review.setTime(DateUtil.getDate());
|
review.setTime(DateUtil.getDate());
|
||||||
@@ -103,8 +125,33 @@ public class CondolenceFrCon {
|
|||||||
Condolence condolence = condolenceService.fetch(id);
|
Condolence condolence = condolenceService.fetch(id);
|
||||||
condolence.setMoney(money);
|
condolence.setMoney(money);
|
||||||
condolence.setFinance_review(review.getId());
|
condolence.setFinance_review(review.getId());
|
||||||
condolence.setState_id(pass ? "2040" : "2030");
|
if (pass == 1) {
|
||||||
|
condolence.setState_id("2014");
|
||||||
|
} else if (pass == 2) {
|
||||||
|
condolence.setState_id("2015");
|
||||||
|
} else {
|
||||||
|
condolence.setState_id("2020");
|
||||||
|
}
|
||||||
condolenceService.edit(condolence);
|
condolenceService.edit(condolence);
|
||||||
|
|
||||||
|
CondolenceToDoHandler.COMPLETE_FINANCE_TASK.exec(condolence, review.getOpinion());
|
||||||
|
CondolenceToDoHandler.COMPLETE_BACK_SCHOOL_TASK.exec(condolence, review.getOpinion());
|
||||||
|
//1拒绝 3通过
|
||||||
|
if (pass == 1){
|
||||||
|
CondolenceToDoHandler.COMPLETE_PROCESS.exec(condolence, review.getOpinion());
|
||||||
|
} else if(pass == 2) {
|
||||||
|
CondolenceToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(condolence, review.getOpinion());
|
||||||
|
} else if (pass == 3){
|
||||||
|
CondolenceToDoHandler.CREATE_SCHOOL_TASK.exec(condolence,null);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.fr")
|
||||||
|
public Object doEdit(String id) {
|
||||||
|
condolenceService.update(Chain.make("state_id", 2012), Cnd.where("id", "=", id));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
|
|
||||||
|
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.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.artofsolving.jodconverter.DocumentConverter;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
|
|
||||||
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
|
|
||||||
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
|
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
import com.deepoove.poi.config.Configure;
|
import com.deepoove.poi.config.Configure;
|
||||||
import com.deepoove.poi.data.PictureRenderData;
|
|
||||||
import com.deepoove.poi.data.TableRenderData;
|
|
||||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
|
||||||
import com.deepoove.poi.policy.TableRenderPolicy;
|
|
||||||
import com.google.zxing.BarcodeFormat;
|
|
||||||
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
||||||
import com.google.zxing.common.BitMatrix;
|
|
||||||
import com.google.zxing.qrcode.QRCodeWriter;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.model.Review;
|
import io.v.nutz.base.model.Review;
|
||||||
|
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
|
import io.v.nutz.base.utils.ViTool;
|
||||||
|
import io.v.nutz.sys.models.Sys_signature;
|
||||||
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
|
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
||||||
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -30,22 +29,30 @@ import org.nutz.dao.sql.Sql;
|
|||||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.lang.random.R;
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.awt.image.BufferedImage;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.*;
|
import java.net.URLEncoder;
|
||||||
import java.util.Base64;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
* @DateTime: 2020/11/20 11:49
|
* @DateTime: 2020/11/20 11:49
|
||||||
* @Description: 阅览
|
* @Description: 阅览
|
||||||
*/
|
*/
|
||||||
@At("/platform/fw/condolence/read")
|
@At({"/platform/fw/condolence/doRead", "/platform/fw/condolence/read"})
|
||||||
@IocBean
|
@IocBean
|
||||||
@RequiresAuthentication
|
@RequiresAuthentication
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
@@ -56,6 +63,9 @@ public class CondolenceReadCon {
|
|||||||
@Inject
|
@Inject
|
||||||
private Vi vi;
|
private Vi vi;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OfficeTemplateUtil officeTemplateUtil;
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/condolence/read.html")
|
@Ok("beetl:/platform/zgfw/condolence/read.html")
|
||||||
@RequiresPermissions("fw.condolence.read")
|
@RequiresPermissions("fw.condolence.read")
|
||||||
@@ -65,7 +75,17 @@ public class CondolenceReadCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String unitId, String unionId, Integer year, String type, String way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.read")
|
||||||
|
public Object pageData(@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
|
@Param(value = "year", required = false) Integer year,
|
||||||
|
@Param(value = "type", required = false) String type,
|
||||||
|
@Param(value = "way", required = false) Integer way,
|
||||||
|
@Param(value = "searchName", required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
con.*,
|
con.*,
|
||||||
@@ -88,13 +108,13 @@ public class CondolenceReadCon {
|
|||||||
|
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
|
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,wyh02")) {
|
||||||
SqlExpressionGroup group2 = new SqlExpressionGroup();
|
SqlExpressionGroup group2 = new SqlExpressionGroup();
|
||||||
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
||||||
group2.or("be.unionid", "=", vi.getUnionId());
|
group2.or("be.unionid", "=", vi.getUnionId());
|
||||||
/*group2.or("con.state_id", ">=", 2000);*/
|
/*group2.or("con.state_id", ">=", 2000);*/
|
||||||
}/*
|
}
|
||||||
if (ShiroUtil.hasAnyRoles("xghkj")) {
|
/* if (ShiroUtil.hasAnyRoles("SchoolUnionAccountant")) {
|
||||||
group2.or("con.state_id", ">=", 2020);
|
group2.or("con.state_id", ">=", 2020);
|
||||||
}
|
}
|
||||||
if (ShiroUtil.hasAnyRoles("A06")) {
|
if (ShiroUtil.hasAnyRoles("A06")) {
|
||||||
@@ -102,7 +122,8 @@ public class CondolenceReadCon {
|
|||||||
}*/
|
}*/
|
||||||
/* if (ShiroUtil.hasAnyRoles("")) {
|
/* if (ShiroUtil.hasAnyRoles("")) {
|
||||||
group2.or("con.state_id", ">=", 2060);
|
group2.or("con.state_id", ">=", 2060);
|
||||||
} */else {
|
} */
|
||||||
|
else {
|
||||||
group2.or("con.be_user", "=", ShiroUtil.getPrincipalProperty("id").toString());
|
group2.or("con.be_user", "=", ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
group2.or("con.manager", "=", ShiroUtil.getPrincipalProperty("id").toString());
|
group2.or("con.manager", "=", ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
}
|
}
|
||||||
@@ -114,7 +135,7 @@ public class CondolenceReadCon {
|
|||||||
Vi.cndPlus(cnd, "con.way", "=", way);
|
Vi.cndPlus(cnd, "con.way", "=", way);
|
||||||
Vi.cndPlus(cnd, "be.unitid", "=", unitId);
|
Vi.cndPlus(cnd, "be.unitid", "=", unitId);
|
||||||
Vi.cndPlus(cnd, "be.unionid", "=", unionId);
|
Vi.cndPlus(cnd, "be.unionid", "=", unionId);
|
||||||
|
cnd.and("con.state_id", ">=", "2040");
|
||||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||||
cnd.where().andLike(searchName, searchKeyword);
|
cnd.where().andLike(searchName, searchKeyword);
|
||||||
}
|
}
|
||||||
@@ -130,102 +151,289 @@ public class CondolenceReadCon {
|
|||||||
return condolenceService.listPage(pageNumber, pageSize, sql);
|
return condolenceService.listPage(pageNumber, pageSize, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("void")
|
@Ok("void")
|
||||||
public void doPrint(String id, HttpServletResponse response) throws Exception {
|
@RequiresPermissions("fw.condolence.read")
|
||||||
response.setContentType("application/pdf");
|
public void exportReceipt(String id, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
Record record = condolenceService.findOne(id);
|
Record record = condolenceService.findOne(id);
|
||||||
|
List<CondolenceType> typeList = condolenceService.dao().query(CondolenceType.class, Cnd.NEW());
|
||||||
|
typeList.forEach(item -> {
|
||||||
|
if (item.getId().equals(record.getString("type"))) {
|
||||||
|
record.put(item.getCode(), "☑");
|
||||||
|
} else {
|
||||||
|
record.put(item.getCode(), "□");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
record.set("apply_time", DateUtil.format(DateUtil.parseDate(record.getString("apply_time")), "yyyy年MM月dd日"));
|
||||||
BitMatrix bitMatrix = qrCodeWriter.encode(record.getString("document_no"), BarcodeFormat.QR_CODE, 80, 80);
|
|
||||||
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
|
||||||
PictureRenderData pictureRenderData = new PictureRenderData(80, 80, ".png", bufferedImage);
|
|
||||||
record.set("qrcode", pictureRenderData);
|
|
||||||
|
|
||||||
//自己签字
|
|
||||||
String ms = record.getString("manager_sign");
|
|
||||||
if (Strings.isNotBlank(ms)) {
|
|
||||||
record.set("ms", getImg(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//分工会主席
|
|
||||||
Object ucr = record.get("ucr");
|
|
||||||
if (ucr != null) {
|
|
||||||
Review review = (Review) ucr;
|
|
||||||
record.set("ucr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("ucrTime", review.getTime());
|
|
||||||
record.set("ucrOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
//财务
|
|
||||||
Object fr = record.get("fr");
|
|
||||||
if (fr != null) {
|
|
||||||
Review review = (Review) fr;
|
|
||||||
record.set("fr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("frTime", review.getTime());
|
|
||||||
record.set("frOpinion", review.getOpinion());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//工会副主席
|
|
||||||
Object vcr = record.get("vcr");
|
Object vcr = record.get("vcr");
|
||||||
if (vcr != null) {
|
if (vcr != null) {
|
||||||
Review review = (Review) vcr;
|
Review review = (Review) vcr;
|
||||||
record.set("vcr", review.getSign() != null ? getImg(review.getSign()) : null);
|
record.set("vcr", review.getSign() != null ? ViTool.poiBase64Image(review.getSign(), 130, 100) : null);
|
||||||
record.set("vcrTime", review.getTime());
|
|
||||||
record.set("vcrOpinion", review.getOpinion());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//校工会常务副主席
|
Object ucr = record.get("ucr");
|
||||||
Object ecr = record.get("ecr");
|
if (ucr != null) {
|
||||||
if (ecr != null) {
|
Review review = (Review) ucr;
|
||||||
Review review = (Review) ecr;
|
record.set("ucr", review.getSign() != null ? ViTool.poiBase64Image(review.getSign(), 130, 100) : null);
|
||||||
record.set("ecr", review.getSign() != null ? getImg(review.getSign()) : null);
|
|
||||||
record.set("ecrTime", review.getTime());
|
|
||||||
record.set("ecrOpinion", review.getOpinion());
|
|
||||||
}
|
}
|
||||||
record.set("money_big", Convert.digitToChinese(record.getDouble("money")));
|
|
||||||
|
|
||||||
String uuid = R.UU32();
|
String ms = record.getString("manager_sign_data");
|
||||||
|
if (Strings.isNotBlank(ms)) {
|
||||||
|
record.set("applySign", ViTool.poiBase64Image(ms, 100, 50));
|
||||||
|
}
|
||||||
|
|
||||||
File docx = new File(uuid + ".docx");
|
record.set("bigMoney", Convert.digitToChinese(record.getDouble("money")));
|
||||||
File pdf = new File(uuid + ".pdf");
|
|
||||||
|
|
||||||
OutputStream outputStream = new FileOutputStream(docx);
|
String fileName = Globals.schoolName + "领取通知单";
|
||||||
|
|
||||||
HackLoopTableRenderPolicy tableRenderPolicy = new HackLoopTableRenderPolicy();
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
Configure config = Configure.newBuilder().bind("goods",tableRenderPolicy).build();
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/condolence/must_visit.docx");
|
|
||||||
XWPFTemplate.compile(inputStream, config).render(record, outputStream);
|
|
||||||
inputStream.close();
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
//打开连接
|
Configure config = Configure.builder().build();
|
||||||
OpenOfficeConnection connection = new SocketOpenOfficeConnection("127.0.0.1", 8100);
|
XWPFTemplate.compile(officeTemplateUtil.getPath("condolence_pay"), config).render(record).writeAndClose(response.getOutputStream());
|
||||||
connection.connect();
|
|
||||||
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
|
|
||||||
//执行转换
|
|
||||||
converter.convert(docx, pdf);
|
|
||||||
connection.disconnect();
|
|
||||||
|
|
||||||
|
|
||||||
InputStream pdfStream = new FileInputStream(pdf);
|
|
||||||
|
|
||||||
IOUtils.copy(pdfStream, response.getOutputStream());
|
|
||||||
|
|
||||||
pdfStream.close();
|
|
||||||
docx.delete();
|
|
||||||
pdf.delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("fw.condolence.read")
|
||||||
|
public void exportAllPay(String year, HttpServletResponse response) throws Exception {
|
||||||
|
List<CondolenceType> typeList = condolenceService.dao().query(CondolenceType.class, Cnd.NEW());
|
||||||
|
//查询用户
|
||||||
|
List<Record> userList = condolenceService.dao().query("user", Cnd.NEW());
|
||||||
|
Map<String, Record> userMap = userList.stream().collect(Collectors.toMap(o -> o.getString("id"), o -> o));
|
||||||
|
|
||||||
private PictureRenderData getImg(String base64) throws IOException {
|
//根据年度查询所有的慰问
|
||||||
String s = base64.split(",")[1];
|
List<Condolence> condolenceList = condolenceService.query(Cnd.NEW().andEX("year(apply_time)", "=", year));
|
||||||
byte[] bytes = Base64.getDecoder().decode(s);
|
|
||||||
return new PictureRenderData(70, 30, ".png", bytes);
|
//导出为一个压缩包
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("content-disposition", "attachment;filename="
|
||||||
|
+ URLEncoder.encode("职工慰问领取通知单汇总.zip", "UTF-8"));
|
||||||
|
ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
for (int i = 0; i < condolenceList.size(); i++) {
|
||||||
|
Condolence con = condolenceList.get(i);
|
||||||
|
|
||||||
|
Record applyUser = userMap.get(con.getManager());
|
||||||
|
Record bzUser = userMap.get(con.getBe_user());
|
||||||
|
Record payUser = userMap.get(con.getPayee());
|
||||||
|
|
||||||
|
NutMap conMap = Lang.obj2map(con, NutMap.class);
|
||||||
|
typeList.forEach(item -> {
|
||||||
|
if (item.getId().equals(con.getType())) {
|
||||||
|
conMap.put(item.getCode(), "☑");
|
||||||
|
} else {
|
||||||
|
conMap.put(item.getCode(), "□");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
conMap.put("apply_time", DateUtil.format(DateUtil.parseDate(con.getApply_time()), "yyyy年MM月dd日"));
|
||||||
|
if (Strings.isNotBlank(con.getManager_sign())) {
|
||||||
|
Sys_signature signature = condolenceService.dao().fetch(Sys_signature.class, con.getManager_sign());
|
||||||
|
conMap.put("applySign", ViTool.poiBase64Image(signature.getData(), 100, 50));
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(con.getUnion_chairman_review())) {
|
||||||
|
Review review = condolenceService.dao().fetch(Review.class, con.getUnion_chairman_review());
|
||||||
|
conMap.put("ucr", review.getSign() != null ? ViTool.poiBase64Image(review.getSign(), 130, 100) : null);
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(con.getVice_chairman_review())) {
|
||||||
|
Review review = condolenceService.dao().fetch(Review.class, con.getVice_chairman_review());
|
||||||
|
conMap.put("vcr", review.getSign() != null ? ViTool.poiBase64Image(review.getSign(), 130, 100) : null);
|
||||||
|
}
|
||||||
|
conMap.put("bigMoney", Convert.digitToChinese(con.getMoney()));
|
||||||
|
conMap.put("be_username", bzUser.getString("username"));
|
||||||
|
conMap.put("be_loginname", bzUser.getString("loginname"));
|
||||||
|
conMap.put("be_unitname", bzUser.getString("unitname"));
|
||||||
|
conMap.put("m_loginname", payUser.getString("loginname"));
|
||||||
|
conMap.put("m_name", payUser.getString("username"));
|
||||||
|
String fileName = (i + 1) + bzUser.getString("username") + "职工慰问领取通知单.docx";
|
||||||
|
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||||
|
|
||||||
|
String officeTemplateUtilPath = officeTemplateUtil.getPath("condolence_pay");
|
||||||
|
assert officeTemplateUtilPath != null;
|
||||||
|
Configure config = Configure.builder().build();
|
||||||
|
XWPFTemplate.compile(officeTemplateUtilPath, config).render(conMap).write(zipOutputStream);
|
||||||
|
zipOutputStream.closeEntry();
|
||||||
|
}
|
||||||
|
zipOutputStream.flush();
|
||||||
|
zipOutputStream.close();
|
||||||
|
response.getOutputStream().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("fw.condolence.read")
|
||||||
|
public void exportApply(String id, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
NutMap conMap = getData(id, null).get(0);
|
||||||
|
|
||||||
|
String fileName = Globals.schoolName + "在职教职工慰问金申请表";
|
||||||
|
|
||||||
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||||
|
|
||||||
|
Configure config = Configure.builder().build();
|
||||||
|
XWPFTemplate.compile(officeTemplateUtil.getPath("condolence_apply"), config).render(conMap).writeAndClose(response.getOutputStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("fw.condolence.read")
|
||||||
|
public void exportAllApply(String year, HttpServletResponse response) throws Exception {
|
||||||
|
List<NutMap> mapList = getData(null, year);
|
||||||
|
|
||||||
|
//导出为一个压缩包
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("content-disposition", "attachment;filename="
|
||||||
|
+ URLEncoder.encode("职工慰问金申请表.zip", "UTF-8"));
|
||||||
|
ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream());
|
||||||
|
for (int i = 0; i < mapList.size(); i++) {
|
||||||
|
NutMap conMap = mapList.get(i);
|
||||||
|
String fileName = (i + 1) + conMap.getString("be_username") + "慰问金申请表.docx";
|
||||||
|
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||||
|
|
||||||
|
String officeTemplateUtilPath = officeTemplateUtil.getPath("condolence_apply");
|
||||||
|
assert officeTemplateUtilPath != null;
|
||||||
|
Configure config = Configure.builder().build();
|
||||||
|
XWPFTemplate.compile(officeTemplateUtilPath, config).render(conMap).write(zipOutputStream);
|
||||||
|
zipOutputStream.closeEntry();
|
||||||
|
}
|
||||||
|
zipOutputStream.flush();
|
||||||
|
zipOutputStream.close();
|
||||||
|
response.getOutputStream().close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("fw.condolence.read")
|
||||||
|
public void exportSummary(String exportType, String conType, HttpServletResponse response) throws Exception {
|
||||||
|
CondolenceType condolenceType = condolenceService.dao().fetch(CondolenceType.class, conType);
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("content-disposition", "attachment;filename="
|
||||||
|
+ URLEncoder.encode(condolenceType.getName() + "汇总表.zip", "UTF-8"));
|
||||||
|
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
con.*,
|
||||||
|
type.`name` type_name,
|
||||||
|
be.username be_username,
|
||||||
|
be.loginname be_loginname,
|
||||||
|
sqr.username sqr_username,
|
||||||
|
be.unitname be_unitname,
|
||||||
|
be.unionname be_unionname,
|
||||||
|
state.state_name,
|
||||||
|
state.state_color,
|
||||||
|
type.`code`,
|
||||||
|
year(apply_time) applyYear,
|
||||||
|
month(apply_time) applyMonth
|
||||||
|
FROM
|
||||||
|
condolence con
|
||||||
|
LEFT JOIN `user` be ON con.be_user = be.id
|
||||||
|
LEFT JOIN `user` sqr ON con.manager= sqr.id
|
||||||
|
LEFT JOIN state state ON state.state_id = con.state_id
|
||||||
|
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
||||||
|
""");
|
||||||
|
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("con.state_id", ">=", "2040");
|
||||||
|
cnd.andEX("con.type", "=", conType);
|
||||||
|
cnd.desc("con.apply_time");
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
|
||||||
|
List<NutMap> listMap = condolenceService.listMap(sql);
|
||||||
|
Map<String, List<NutMap>> resultList = listMap.stream().collect(Collectors.groupingBy(o -> o.getString("year".equals(exportType) ? "applyYear" : "applyMonth")));
|
||||||
|
|
||||||
|
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||||
|
|
||||||
|
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||||
|
exportEntities.add(new ExcelExportEntity("慰问对象", "be_username", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("慰问对象工号", "be_loginname", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("申请人", "sqr_username", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("所在工会", "be_unionname", 30));
|
||||||
|
exportEntities.add(new ExcelExportEntity("所在单位", "be_unitname", 30));
|
||||||
|
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("慰问类型", "type_name", 30));
|
||||||
|
exportEntities.add(new ExcelExportEntity("慰问金额", "money", 20));
|
||||||
|
exportEntities.add(new ExcelExportEntity("申请时间", "apply_time", 20));
|
||||||
|
for (String key : resultList.keySet()) {
|
||||||
|
try {
|
||||||
|
zipOutputStream.putNextEntry(new ZipEntry(key + ("year".equals(exportType) ? "年" : "月") + "慰问申请汇总表.xls"));
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, resultList.get(key));
|
||||||
|
workbook.write(zipOutputStream);
|
||||||
|
zipOutputStream.closeEntry();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zipOutputStream.flush();
|
||||||
|
zipOutputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NutMap> getData(String id, String year) throws Exception {
|
||||||
|
List<CondolenceType> typeList = condolenceService.dao().query(CondolenceType.class, Cnd.NEW());
|
||||||
|
//查询用户
|
||||||
|
List<Record> userList = condolenceService.dao().query("user", Cnd.NEW());
|
||||||
|
Map<String, Record> userMap = userList.stream().collect(Collectors.toMap(o -> o.getString("id"), o -> o));
|
||||||
|
|
||||||
|
List<Condolence> condolenceList = condolenceService.query(Cnd.NEW().andEX("id", "=", id).andEX("year(apply_time)", "=", year));
|
||||||
|
|
||||||
|
List<NutMap> result = new ArrayList<>();
|
||||||
|
for (Condolence condolence : condolenceList) {
|
||||||
|
Record applyUser = userMap.get(condolence.getManager());
|
||||||
|
Record bzUser = userMap.get(condolence.getBe_user());
|
||||||
|
|
||||||
|
NutMap conMap = Lang.obj2map(condolence, NutMap.class);
|
||||||
|
|
||||||
|
conMap.put("apply_time", DateUtil.format(DateUtil.parseDate(condolence.getApply_time()), "yyyy年MM月dd日"));
|
||||||
|
if (Strings.isNotBlank(condolence.getUnion_chairman_review())) {
|
||||||
|
Review review = condolenceService.dao().fetch(Review.class, condolence.getUnion_chairman_review());
|
||||||
|
conMap.put("ucr", review.getSign() != null ? ViTool.poiBase64Image(review.getSign(), 110, 70) : null);
|
||||||
|
conMap.put("ucrOpinion", review.getOpinion());
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(condolence.getVice_chairman_review())) {
|
||||||
|
Review review = condolenceService.dao().fetch(Review.class, condolence.getVice_chairman_review());
|
||||||
|
conMap.put("vcr", review.getSign() != null ? ViTool.poiBase64Image(review.getSign(), 110, 70) : null);
|
||||||
|
conMap.put("vcrOpinion", review.getOpinion());
|
||||||
|
}
|
||||||
|
conMap.put("sName", Globals.schoolName);
|
||||||
|
conMap.put("be_username", bzUser.getString("username"));
|
||||||
|
conMap.put("be_loginname", bzUser.getString("loginname"));
|
||||||
|
conMap.put("be_sex", bzUser.getString("sex"));
|
||||||
|
conMap.put("be_unitname", bzUser.getString("unitname"));
|
||||||
|
conMap.put("a_username", applyUser.getString("username"));
|
||||||
|
conMap.put("a_loginname", applyUser.getString("loginname"));
|
||||||
|
conMap.put("a_unitname", applyUser.getString("unitname"));
|
||||||
|
conMap.put("a_sex", applyUser.getString("sex"));
|
||||||
|
conMap.put("the_hospital", condolence.getThe_hospital());
|
||||||
|
conMap.put("h_num", condolence.getThe_hospital_house_num());
|
||||||
|
conMap.put("b_num", condolence.getThe_hospital_house_bed_num());
|
||||||
|
conMap.put("hospital_by", condolence.getHospital_by());
|
||||||
|
conMap.put("bigMoney", Convert.digitToChinese(condolence.getMoney()));
|
||||||
|
CondolenceType type = typeList.stream().filter(o -> o.getId().equals(conMap.getString("type"))).findAny().orElse(null);
|
||||||
|
conMap.put("typeName", type.getName());
|
||||||
|
String content = "慰问事由:" + condolence.getRemark();
|
||||||
|
if ("F".equals(type.getCode())) {
|
||||||
|
conMap.put("remark", content + "\n" + "去世者与本人关系:" + condolence.getDeadImmediateFamily());//直系亲属去世
|
||||||
|
} else if ("B".equals(type.getCode())) {
|
||||||
|
conMap.put("remark", content + "\n" + "孩次:" + condolence.getBirth_child_num());//生育
|
||||||
|
} else if ("C".equals(type.getCode())) {
|
||||||
|
conMap.put("remark", content
|
||||||
|
+ "\n" + "治疗医院:" + condolence.getThe_hospital()
|
||||||
|
+ "\n" + "病房号:" + condolence.getThe_hospital_house_num()
|
||||||
|
+ "\n" + "床号:" + condolence.getThe_hospital_house_bed_num());
|
||||||
|
} else if ("D".equals(type.getCode())) {
|
||||||
|
conMap.put("remark", content
|
||||||
|
+ "\n" + "治疗医院:" + condolence.getThe_hospital()
|
||||||
|
+ "\n" + "病房号:" + condolence.getThe_hospital_house_num()
|
||||||
|
+ "\n" + "床号:" + condolence.getThe_hospital_house_bed_num()
|
||||||
|
+ "\n" + "患病病种:" + condolence.getHospital_by());
|
||||||
|
} else {
|
||||||
|
conMap.put("remark", condolence.getRemark());//结婚、教职工去世
|
||||||
|
}
|
||||||
|
result.add(conMap);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-2
@@ -11,6 +11,7 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
|||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhf
|
* @author zhf
|
||||||
@@ -34,7 +35,12 @@ public class CondolenceTypeMangeController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.type")
|
||||||
|
public Object pageData(@Param(value = "searchName", required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||||
cnd.where().andLike(searchName, searchKeyword);
|
cnd.where().andLike(searchName, searchKeyword);
|
||||||
@@ -51,6 +57,7 @@ public class CondolenceTypeMangeController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.type")
|
||||||
public Object doAdd(CondolenceType type) {
|
public Object doAdd(CondolenceType type) {
|
||||||
|
|
||||||
if (condolenceTypeViService.count(Cnd.where("code", "=", type.getCode())) > 0) {
|
if (condolenceTypeViService.count(Cnd.where("code", "=", type.getCode())) > 0) {
|
||||||
@@ -64,6 +71,7 @@ public class CondolenceTypeMangeController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.type")
|
||||||
public Object doEdit(CondolenceType type) {
|
public Object doEdit(CondolenceType type) {
|
||||||
|
|
||||||
if (condolenceTypeViService.count(Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId())) > 0) {
|
if (condolenceTypeViService.count(Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId())) > 0) {
|
||||||
@@ -83,6 +91,7 @@ public class CondolenceTypeMangeController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.type")
|
||||||
public Object doDelete(String id) {
|
public Object doDelete(String id) {
|
||||||
condolenceTypeViService.delete(id);
|
condolenceTypeViService.delete(id);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
@@ -92,7 +101,8 @@ public class CondolenceTypeMangeController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object getAll() {
|
public Object getAll() {
|
||||||
return Result.success().addData(condolenceTypeViService.query(Cnd.NEW().asc("code")));
|
// return Result.success().addData(condolenceTypeViService.query(Cnd.where("isDisabled", "=", 0).asc("sortNum")));
|
||||||
|
return condolenceTypeViService.query(Cnd.NEW().asc("sortNum"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.model.Review;
|
||||||
|
import io.v.nutz.base.service.ReviewService;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
import io.v.nutz.base.utils.MsgApi;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.base.model.Review;
|
|
||||||
import io.v.nutz.base.service.ReviewService;
|
|
||||||
import io.v.nutz.sys.models.Sys_local_process_instance;
|
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
@@ -16,6 +13,7 @@ import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
|||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
|
import org.nutz.dao.Chain;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
@@ -24,16 +22,14 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.trans.Trans;
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
* @DateTime: 2020/11/20 11:49
|
* @DateTime: 2020/11/20 11:49
|
||||||
* @Description: 基层工会主席审核
|
* @Description: 院级工会主席审核
|
||||||
*/
|
*/
|
||||||
@At("/platform/fw/condolence/ucr")
|
@At({"/platform/fw/condolence/ucr", "/platform/fw/condolence/ucr/union"})
|
||||||
@IocBean
|
@IocBean
|
||||||
@RequiresAuthentication
|
@RequiresAuthentication
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
@@ -45,16 +41,32 @@ public class CondolenceUcrCon {
|
|||||||
@Inject
|
@Inject
|
||||||
private MsgApi msgApi;
|
private MsgApi msgApi;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CondolenceService condolenceService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ReviewService reviewService;
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/condolence/ucr.html")
|
@Ok("beetl:/platform/zgfw/condolence/ucr.html")
|
||||||
@RequiresPermissions("fw.condolence.ucr")
|
@RequiresPermissions("fw.condolence.ucr")
|
||||||
public void index() {
|
public void index() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String year,String unitId, String unionId, Boolean isAudit,String type, String way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.ucr")
|
||||||
|
public Object pageData(@Param(value = "year", required = false) String year,
|
||||||
|
@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
|
@Param(value = "isAudit", required = false) Boolean isAudit,
|
||||||
|
@Param(value = "type", required = false) String type,
|
||||||
|
@Param(value = "way", required = false) String way,
|
||||||
|
@Param(value = "searchName", required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
con.*,
|
con.*,
|
||||||
@@ -103,62 +115,44 @@ public class CondolenceUcrCon {
|
|||||||
return condolenceService.listPage(pageNumber, pageSize, sql);
|
return condolenceService.listPage(pageNumber, pageSize, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
@Inject
|
@ViReturn
|
||||||
private CondolenceService condolenceService;
|
@RequiresPermissions("fw.condolence.ucr")
|
||||||
|
public Object doEdit(String id) {
|
||||||
@Inject
|
condolenceService.update(Chain.make("state_id", 2000), Cnd.where("id", "=", id));
|
||||||
private ReviewService reviewService;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.ucr")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doReview(String id, boolean pass, Review review) {
|
public Object doReview(String id, Integer pass, Review review) {
|
||||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||||
review.setTime(DateUtil.getDate());
|
review.setTime(DateUtil.getDate());
|
||||||
review = reviewService.insert(review);
|
review = reviewService.insert(review);
|
||||||
Condolence condolence = condolenceService.fetch(id);
|
Condolence condolence = condolenceService.fetch(id);
|
||||||
condolence.setUnion_chairman_review(review.getId());
|
condolence.setUnion_chairman_review(review.getId());
|
||||||
condolence.setState_id(pass ? "2040" : "2010");
|
if (pass == 1) {
|
||||||
condolenceService.edit(condolence);
|
condolence.setState_id("2010");
|
||||||
|
} else if (pass == 2) {
|
||||||
Sys_user sysUser = condolenceService.dao().fetch(Sys_user.class, condolence.getManager());
|
condolence.setState_id("2011");
|
||||||
//审核发通知
|
|
||||||
if(pass) {
|
|
||||||
List<User> schoolPresident = vi.getSchoolPresident();
|
|
||||||
schoolPresident.forEach(item -> {
|
|
||||||
String msg = "%s您好,%s老师的日常慰问申请基层工会已通过,转为待校工会审核,请您登录智慧工会平台进行审核。".formatted(item.getUsername(), sysUser.getUsername());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(item.getLoginname()), "");
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
String msg = "%s您好,您申请的日常慰问被分工会审核拒绝,拒绝原因:%s。".formatted(sysUser.getUsername(), review.getOpinion());
|
condolence.setState_id("2012");
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = condolenceService.dao().count(Sys_local_process_instance.class, Cnd.where("processUniqueId", "=", "condolence_apply@" + condolence.getId()));
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
//完成分工会任务
|
|
||||||
CondolenceToDoHandler.COMPLETE_UNION_TASK.exec(condolence,pass ? "基层工会通过" : "基层工会拒绝");
|
|
||||||
|
|
||||||
if (pass) {
|
|
||||||
//如果通过到下一流程节点
|
|
||||||
CondolenceToDoHandler.CREATE_SCHOOL_TASK.exec(condolence,null);
|
|
||||||
} else {
|
|
||||||
CondolenceToDoHandler.REFUSE_UNION_TASK.exec(condolence,"基层工会退回修改");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
|
||||||
public Object doWithdraw(String id) {
|
|
||||||
Condolence condolence = condolenceService.fetch(id);
|
|
||||||
condolence.setState_id("2000");
|
|
||||||
condolenceService.edit(condolence);
|
condolenceService.edit(condolence);
|
||||||
|
|
||||||
|
CondolenceToDoHandler.COMPLETE_UNION_TASK.exec(condolence, review.getOpinion());
|
||||||
|
// 1 拒绝;3 通过
|
||||||
|
if (pass == 1){
|
||||||
|
CondolenceToDoHandler.COMPLETE_PROCESS.exec(condolence, review.getOpinion());
|
||||||
|
} else if(pass == 2) {
|
||||||
|
CondolenceToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(condolence, review.getOpinion());
|
||||||
|
} else {
|
||||||
|
CondolenceToDoHandler.CREATE_FINANCE_TASK.exec(condolence,null);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.model.Review;
|
import io.v.nutz.base.model.Review;
|
||||||
import io.v.nutz.base.service.ReviewService;
|
import io.v.nutz.base.service.ReviewService;
|
||||||
import io.v.nutz.sys.models.Sys_local_process_instance;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
@@ -25,16 +20,14 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 1V
|
* @Author: 1V
|
||||||
* @DateTime: 2020/11/20 11:49
|
* @DateTime: 2020/11/20 11:49
|
||||||
* @Description: 校工会审核
|
* @Description: 校工会审核
|
||||||
*/
|
*/
|
||||||
@At("/platform/fw/condolence/vcr")
|
@At({"/platform/fw/condolence/vcr","/platform/fw/condolence/vcr/school"})
|
||||||
@IocBean
|
@IocBean
|
||||||
@RequiresAuthentication
|
@RequiresAuthentication
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
@@ -43,9 +36,6 @@ public class CondolenceVcrCon {
|
|||||||
@Inject
|
@Inject
|
||||||
private Vi vi;
|
private Vi vi;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MsgApi msgApi;
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/condolence/vcr.html")
|
@Ok("beetl:/platform/zgfw/condolence/vcr.html")
|
||||||
@RequiresPermissions("fw.condolence.vcr")
|
@RequiresPermissions("fw.condolence.vcr")
|
||||||
@@ -55,12 +45,23 @@ public class CondolenceVcrCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String unitId, String unionId, Boolean isAudit, Integer year, String type, String way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.vcr")
|
||||||
|
public Object pageData(@Param(value = "year",required = false) String year,
|
||||||
|
@Param(value = "unitId",required = false) String unitId,
|
||||||
|
@Param(value = "unionId",required = false) String unionId,
|
||||||
|
@Param(value = "isAudit",required = false) Boolean isAudit,
|
||||||
|
@Param(value = "type",required = false) String type,
|
||||||
|
@Param(value = "way",required = false) String way,
|
||||||
|
@Param(value = "searchName",required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName",required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy",required = false) String pageOrderBy) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
con.*,
|
con.*,
|
||||||
type.`name` type_name,
|
type.`name` type_name,
|
||||||
be.username be_username,
|
be.username be_username,
|
||||||
be.loginname be_loginname,
|
be.loginname be_loginname,
|
||||||
sqr.username sqr_username,
|
sqr.username sqr_username,
|
||||||
be.unitname be_unitname,
|
be.unitname be_unitname,
|
||||||
@@ -77,7 +78,7 @@ public class CondolenceVcrCon {
|
|||||||
|
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
|
|
||||||
cnd.and("con.state_id", isAudit ? ">" : "=", 2040);
|
cnd.and("con.state_id", isAudit ? ">" : "=", 2020);
|
||||||
|
|
||||||
Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year);
|
Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year);
|
||||||
Vi.cndPlus(cnd, "con.type", "=", type);
|
Vi.cndPlus(cnd, "con.type", "=", type);
|
||||||
@@ -107,59 +108,34 @@ public class CondolenceVcrCon {
|
|||||||
@Inject
|
@Inject
|
||||||
private ReviewService reviewService;
|
private ReviewService reviewService;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ZgfwKnbfService zgfwKnbfService;
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.vcr")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doReview(String id, boolean pass, Review review) {
|
public Object doReview(String id, Integer pass, Review review) {
|
||||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||||
review.setTime(DateUtil.getDate());
|
review.setTime(DateUtil.getDate());
|
||||||
review = reviewService.insert(review);
|
review = reviewService.insert(review);
|
||||||
Condolence condolence = condolenceService.fetch(id);
|
Condolence condolence = condolenceService.fetch(id);
|
||||||
condolence.setVice_chairman_review(review.getId());
|
condolence.setVice_chairman_review(review.getId());
|
||||||
condolence.setState_id(pass ? "2080" : "2050");
|
if (pass == 1) {
|
||||||
condolenceService.edit(condolence);
|
condolence.setState_id("2030");
|
||||||
|
} else if (pass == 2) {
|
||||||
Sys_user sysUser = condolenceService.dao().fetch(Sys_user.class, condolence.getManager());
|
condolence.setState_id("2031");
|
||||||
//审核发通知
|
} else if (pass == 4) {
|
||||||
if (pass) {
|
condolence.setState_id("2050");
|
||||||
String msg = "%s您好,您申请的日常慰问已经审核通过。".formatted(sysUser.getUsername());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
} else {
|
} else {
|
||||||
String msg = "%s您好,您申请的日常慰问被校工会审核拒绝,拒绝原因:%s。".formatted(sysUser.getUsername(), review.getOpinion());
|
condolence.setState_id("2040");
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = condolenceService.dao().count(Sys_local_process_instance.class, Cnd.where("processUniqueId", "=", "condolence_apply@" + condolence.getId()));
|
|
||||||
|
|
||||||
if (count > 0){
|
|
||||||
CondolenceToDoHandler.COMPLETE_SCHOOL_TASK.exec(condolence, pass ? "校工会通过" : "校工会拒绝");
|
|
||||||
if (pass) {
|
|
||||||
CondolenceToDoHandler.COMPLETE_PROCESS.exec(condolence, null);
|
|
||||||
} else {
|
|
||||||
CondolenceToDoHandler.REFUSE_UNION_TASK.exec(condolence,"校工会退回修改");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object getApplyNum(String userId, String type) {
|
|
||||||
int conNum = condolenceService.count(Cnd.where("be_user", "=", userId).and("YEAR(apply_time)", "=", DateUtil.getYear()).and("type", "=", type).and("state_id", "=", 2080));
|
|
||||||
int knbfNum = zgfwKnbfService.count(Cnd.where("bbzrusername", "=", userId).and("YEAR(sqsj)", "=", DateUtil.getYear()).and("sq_bzlx", "=", type).and("zt", "=", 500));
|
|
||||||
return Map.of("conNum", conNum, "knbfNum", knbfNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object doWithdraw(String id) {
|
|
||||||
Condolence condolence = condolenceService.fetch(id);
|
|
||||||
condolence.setState_id("2040");
|
|
||||||
condolenceService.updateIgnoreNull(condolence);
|
condolenceService.updateIgnoreNull(condolence);
|
||||||
|
CondolenceToDoHandler.COMPLETE_SCHOOL_TASK.exec(condolence, review.getOpinion());
|
||||||
|
if (pass == 1){
|
||||||
|
CondolenceToDoHandler.COMPLETE_PROCESS.exec(condolence, review.getOpinion());
|
||||||
|
} else if (pass == 2){
|
||||||
|
CondolenceToDoHandler.CREATE_BACK_SCHOOL_TASK.exec(condolence, review.getOpinion());
|
||||||
|
}
|
||||||
|
CondolenceToDoHandler.COMPLETE_PROCESS.exec(condolence,null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
|
||||||
import io.v.nutz.base.service.ViService;
|
import io.v.nutz.base.service.ViService;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
||||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
@@ -13,9 +13,11 @@ import org.nutz.dao.Sqls;
|
|||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhf
|
* @author zhf
|
||||||
@@ -37,13 +39,66 @@ public class StatisticsController {
|
|||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/condolence/statistics.html")
|
@Ok("beetl:/platform/zgfw/condolence/statistics.html")
|
||||||
@RequiresPermissions("fw.condolence.statistics2")
|
@RequiresPermissions("fw.condolence.statistics")
|
||||||
public void index() {
|
public void index() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object condolencesType(String year, String unionid, String type, String way) {
|
@RequiresPermissions("fw.condolence.statistics")
|
||||||
|
public Object condolencesType(@Param(value = "year", required = false) Integer year,
|
||||||
|
@Param(value = "yearMonth", required = false) String[] yearMonth,
|
||||||
|
@Param(value = "unionid", required = false) String unionid,
|
||||||
|
@Param(value = "type", required = false) String type,
|
||||||
|
@Param(value = "way", required = false) String way,
|
||||||
|
@Param(value = "reiItemId", required = false) String reiItemId) {
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
rei.*,
|
||||||
|
be.username be_username,
|
||||||
|
state.stateName,
|
||||||
|
state.stateColor
|
||||||
|
FROM
|
||||||
|
`reimbursement_new` rei
|
||||||
|
LEFT JOIN `user` be ON be.id = rei.userId
|
||||||
|
LEFT JOIN audit_state state ON state.stateId = rei.state
|
||||||
|
WHERE rei.State=3100
|
||||||
|
$timeCnd
|
||||||
|
$unionidCnd
|
||||||
|
$typeCnd
|
||||||
|
$wayCnd
|
||||||
|
$reiItemIdCnd
|
||||||
|
""");
|
||||||
|
if (yearMonth != null && yearMonth.length == 2) {
|
||||||
|
String timeSql = StrUtil.format("AND DATE_FORMAT ( rei.applyTime,'%Y-%m' ) >= '{}' AND DATE_FORMAT ( rei.applyTime,'%Y-%m' ) <= '{}'", yearMonth[0], yearMonth[1]);
|
||||||
|
sql.setVar("timeCnd", timeSql);
|
||||||
|
}
|
||||||
|
if (Lang.isNotEmpty(year)) {
|
||||||
|
sql.setVar("yearCnd", "AND YEAR(rei.applyTime) = %s".formatted(year));
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(unionid)) {
|
||||||
|
sql.setVar("unionidCnd", String.format("AND rei.unionId = '%s' ", unionid));
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(type)) {
|
||||||
|
sql.setVar("typeCnd", String.format("AND con.type = '%s' ", type));
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(way)) {
|
||||||
|
sql.setVar("wayCnd", String.format("AND con.way = '%s' ", way));
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(reiItemId)) {
|
||||||
|
sql.setVar("reiItemIdCnd", String.format("AND rei.reimbursementItemId = '%s' ", reiItemId));
|
||||||
|
}
|
||||||
|
return condolenceTypeViService.list(sql);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.condolence.statistics")
|
||||||
|
public Object condolencesType2(@Param(value = "year", required = false) String year,
|
||||||
|
@Param(value = "unionid", required = false) String unionid,
|
||||||
|
@Param(value = "type", required = false) String type,
|
||||||
|
@Param(value = "way", required = false) String way) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
type.`name`,
|
type.`name`,
|
||||||
@@ -55,7 +110,7 @@ public class StatisticsController {
|
|||||||
condolence con
|
condolence con
|
||||||
LEFT JOIN `user` us ON us.id = con.be_user
|
LEFT JOIN `user` us ON us.id = con.be_user
|
||||||
WHERE
|
WHERE
|
||||||
type.id = con.type and con.state_id=2080
|
type.id = con.type
|
||||||
$yearCnd
|
$yearCnd
|
||||||
$unionidCnd
|
$unionidCnd
|
||||||
$typeCnd
|
$typeCnd
|
||||||
@@ -76,7 +131,7 @@ public class StatisticsController {
|
|||||||
if (Strings.isNotBlank(way)) {
|
if (Strings.isNotBlank(way)) {
|
||||||
sql.setVar("wayCnd", String.format("AND con.way = '%s' ", way));
|
sql.setVar("wayCnd", String.format("AND con.way = '%s' ", way));
|
||||||
}
|
}
|
||||||
CndPlus cnd = CndPlus.create();
|
Cnd cnd = Cnd.NEW();
|
||||||
cnd.asc("type.location");
|
cnd.asc("type.location");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
return condolenceTypeViService.list(sql);
|
return condolenceTypeViService.list(sql);
|
||||||
@@ -86,34 +141,39 @@ public class StatisticsController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String conType, String unionid, String year, String type, String way, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
@RequiresPermissions("fw.condolence.statistics")
|
||||||
|
public Object pageData(@Param(value = "reiItemId", required = false) String reiItemId,
|
||||||
|
@Param(value = "unionid", required = false) String unionid, @Param("yearMonth") String[] yearMonth,
|
||||||
|
@Param(value = "type", required = false) String type,
|
||||||
|
@Param(value = "way", required = false) String way,
|
||||||
|
@Param(value = "searchName", required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||||
|
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||||
|
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||||
|
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
con.*,
|
rei.*,
|
||||||
type.`name` type_name,
|
|
||||||
be.username be_username,
|
be.username be_username,
|
||||||
be_unit.`name` be_unitname,
|
state.stateName,
|
||||||
be_union.unionname,
|
state.stateColor
|
||||||
state.state_name,
|
|
||||||
state.state_color
|
|
||||||
FROM
|
FROM
|
||||||
condolence con
|
`reimbursement_new` rei
|
||||||
LEFT JOIN sys_user be ON con.be_user = be.id
|
LEFT JOIN `user` be ON be.id = rei.userId
|
||||||
LEFT JOIN sys_unit be_unit ON be.unitid = be_unit.id
|
LEFT JOIN audit_state state ON state.stateId = rei.state $condition
|
||||||
LEFT JOIN sys_union be_union ON be_unit.unionid = be_union.id
|
|
||||||
LEFT JOIN state state ON state.state_id = con.state_id
|
|
||||||
LEFT JOIN condolence_type type ON type.id=con.type $condition
|
|
||||||
""");
|
""");
|
||||||
|
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
|
|
||||||
cnd.and("con.state_id", "=", 2080);
|
cnd.and("rei.State", "=", 3100);
|
||||||
|
|
||||||
Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year);
|
if (null != yearMonth && yearMonth.length == 2) {
|
||||||
Vi.cndPlus(cnd, "con.type", "=", type);
|
Vi.cndPlus(cnd, "DATE_FORMAT ( rei.applyTime,'%Y-%m' )", ">=", yearMonth[0]);
|
||||||
Vi.cndPlus(cnd, "con.type", "=", conType);
|
Vi.cndPlus(cnd, "DATE_FORMAT ( rei.applyTime,'%Y-%m' )", "<=", yearMonth[1]);
|
||||||
Vi.cndPlus(cnd, "con.way", "=", way);
|
}
|
||||||
Vi.cndPlus(cnd, "be_union.id", "=", unionid);
|
|
||||||
|
Vi.cndPlus(cnd, "rei.unionId", "=", unionid);
|
||||||
|
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||||
|
|
||||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||||
cnd.where().andLike(searchName, searchKeyword);
|
cnd.where().andLike(searchName, searchKeyword);
|
||||||
@@ -122,14 +182,14 @@ public class StatisticsController {
|
|||||||
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
||||||
cnd.orderBy(pageOrderName, pageOrderBy);
|
cnd.orderBy(pageOrderName, pageOrderBy);
|
||||||
} else {
|
} else {
|
||||||
cnd.asc("con.state_id");
|
cnd.asc("rei.State");
|
||||||
cnd.desc("con.apply_time");
|
cnd.desc("rei.applyTime");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
|
|
||||||
return condolenceService.listPage(pageNumber, pageSize, sql);
|
return condolenceService.listPageMap(pageNumber, pageSize, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+13
-11
@@ -43,29 +43,31 @@ public class DifficultAgentController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object getAgenda() {
|
public Object getAgenda() {
|
||||||
|
final String title = "【困难帮扶】";
|
||||||
|
|
||||||
List<NutMap> result = new ArrayList<>();
|
List<NutMap> result = new ArrayList<>();
|
||||||
|
|
||||||
if (ShiroUtil.hasAnyRoles("sysadmin")) {
|
if (ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||||
result.add(new NutMap().setv("url", UNIONCHAIRMAN).setv("iconClass", vi.getIconByPath(UNIONCHAIRMAN)).setv("label", "困难帮扶基层工会主席审核").setv("number", getUnionChairmanCount()));
|
result.add(new NutMap().setv("title", title).setv("url", UNIONCHAIRMAN).setv("iconClass", vi.getIconByPath(UNIONCHAIRMAN)).setv("label", "待院级工会审核").setv("number", getUnionChairmanCount()));
|
||||||
result.add(new NutMap().setv("url", SCHOOLMANAGER).setv("iconClass", vi.getIconByPath(SCHOOLMANAGER)).setv("label", "困难帮扶待校工会主席审核").setv("number", getSchoolManagerCount()));
|
result.add(new NutMap().setv("title", title).setv("url", SCHOOLMANAGER).setv("iconClass", vi.getIconByPath(SCHOOLMANAGER)).setv("label", "待校工会审核").setv("number", getSchoolManagerCount()));
|
||||||
//暂时没用到
|
//暂时没用到
|
||||||
result.add(new NutMap().setv("url", SCHOOLVICECHAIRMAN).setv("iconClass", vi.getIconByPath(SCHOOLVICECHAIRMAN)).setv("label", "困难帮扶待校工会副主席审核").setv("number", getSchoolviceChairmanCount()));
|
result.add(new NutMap().setv("title", title).setv("url", SCHOOLVICECHAIRMAN).setv("iconClass", vi.getIconByPath(SCHOOLVICECHAIRMAN)).setv("label", "待校工会副主席审核").setv("number", getSchoolviceChairmanCount()));
|
||||||
//暂时没用到
|
//暂时没用到
|
||||||
result.add(new NutMap().setv("url", SCHOOLSTANDING).setv("iconClass", vi.getIconByPath(SCHOOLSTANDING)).setv("label", "困难帮扶待校工会常务副主席审核").setv("number", getSchoolStandingCount()));
|
result.add(new NutMap().setv("title", title).setv("url", SCHOOLSTANDING).setv("iconClass", vi.getIconByPath(SCHOOLSTANDING)).setv("label", "待校工会常务副主席审核").setv("number", getSchoolStandingCount()));
|
||||||
} else {
|
} else {
|
||||||
if (ShiroUtil.hasAnyRoles("H01,gh01")) {
|
if (ShiroUtil.hasAnyRoles("H04,gh01")) {
|
||||||
result.add(new NutMap().setv("url", UNIONCHAIRMAN).setv("iconClass", vi.getIconByPath(UNIONCHAIRMAN)).setv("label", "困难帮扶基层工会主席审核").setv("number", getUnionChairmanCount()));
|
result.add(new NutMap().setv("title", title).setv("url", UNIONCHAIRMAN).setv("iconClass", vi.getIconByPath(UNIONCHAIRMAN)).setv("label", "待院级工会审核").setv("number", getUnionChairmanCount()));
|
||||||
}
|
}
|
||||||
if (ShiroUtil.hasRole("wyh02")) {
|
if (ShiroUtil.hasAnyRoles("A06,wyh02")) {
|
||||||
result.add(new NutMap().setv("url", SCHOOLMANAGER).setv("iconClass", vi.getIconByPath(SCHOOLMANAGER)).setv("label", "困难帮扶待校工会主席审核").setv("number", getSchoolManagerCount()));
|
result.add(new NutMap().setv("title", title).setv("url", SCHOOLMANAGER).setv("iconClass", vi.getIconByPath(SCHOOLMANAGER)).setv("label", "待校工会审核").setv("number", getSchoolManagerCount()));
|
||||||
|
|
||||||
}//暂时没用到
|
}//暂时没用到
|
||||||
if (ShiroUtil.hasRole("wyh01")) {
|
if (ShiroUtil.hasRole("wyh01")) {
|
||||||
result.add(new NutMap().setv("url", SCHOOLVICECHAIRMAN).setv("iconClass", vi.getIconByPath(SCHOOLVICECHAIRMAN)).setv("label", "困难帮扶待校工会副主席审核").setv("number", getSchoolviceChairmanCount()));
|
result.add(new NutMap().setv("title", title).setv("url", SCHOOLVICECHAIRMAN).setv("iconClass", vi.getIconByPath(SCHOOLVICECHAIRMAN)).setv("label", "待校工会副主席审核").setv("number", getSchoolviceChairmanCount()));
|
||||||
|
|
||||||
}//暂时没用到
|
}//暂时没用到
|
||||||
if (ShiroUtil.hasRole("wyh02")) {
|
if (ShiroUtil.hasRole("wyh02")) {
|
||||||
result.add(new NutMap().setv("url", SCHOOLSTANDING).setv("iconClass", vi.getIconByPath(SCHOOLSTANDING)).setv("label", "困难帮扶待校工会常务副主席审核").setv("number", getSchoolStandingCount()));
|
result.add(new NutMap().setv("title", title).setv("url", SCHOOLSTANDING).setv("iconClass", vi.getIconByPath(SCHOOLSTANDING)).setv("label", "待校工会常务副主席审核").setv("number", getSchoolStandingCount()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +96,7 @@ public class DifficultAgentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待校工会经办人审核
|
* 待校工会审核
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.service.AuditService;
|
import io.v.nutz.base.service.AuditService;
|
||||||
import io.v.nutz.sys.models.Sys_local_process_instance;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.sys.models.Sys_signature;
|
import io.v.nutz.sys.models.Sys_signature;
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.sys.services.SysSignatureService;
|
import io.v.nutz.sys.services.SysSignatureService;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
@@ -60,8 +56,6 @@ public class DifficultyApply {
|
|||||||
@Inject
|
@Inject
|
||||||
private Vi vi;
|
private Vi vi;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MsgApi msgApi;
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/difficulty/apply.html")
|
@Ok("beetl:/platform/zgfw/difficulty/apply.html")
|
||||||
@@ -69,8 +63,10 @@ public class DifficultyApply {
|
|||||||
public void index() {
|
public void index() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.apply")
|
||||||
public Object querySqr(String key) {
|
public Object querySqr(String key) {
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
@@ -85,9 +81,7 @@ public class DifficultyApply {
|
|||||||
LEFT JOIN sys_unit un ON un.id = su.unitid
|
LEFT JOIN sys_unit un ON un.id = su.unitid
|
||||||
LEFT JOIN sys_union uni ON uni.id = un.unionid $condition
|
LEFT JOIN sys_union uni ON uni.id = un.unionid $condition
|
||||||
""");
|
""");
|
||||||
if (!ShiroUtil.hasRole("sysadmin")){
|
cnd.and("uni.id", "=", vi.getUnionId());
|
||||||
cnd.and("uni.id", "=", vi.getUnionId());
|
|
||||||
}
|
|
||||||
if (Strings.isNotBlank(key)) {
|
if (Strings.isNotBlank(key)) {
|
||||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||||
group.orLike("su.username", key);
|
group.orLike("su.username", key);
|
||||||
@@ -101,27 +95,23 @@ public class DifficultyApply {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.apply")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doAdd(Zgfw_knbf knbf) {
|
public Object doAdd(Zgfw_knbf knbf, Boolean flag) {
|
||||||
if (Strings.isNotBlank(knbf.getApplicantsign())) {
|
if (Strings.isNotBlank(knbf.getApplicantsign())) {
|
||||||
knbf.setApplicantsign(sysSignatureService.insert(new Sys_signature(knbf.getApplicantsign())).getId());
|
knbf.setApplicantsign(sysSignatureService.insert(new Sys_signature(knbf.getApplicantsign())).getId());
|
||||||
}
|
}
|
||||||
knbf.setZt(100);
|
if (knbf.getApply_mode().equals("1")) {
|
||||||
|
knbf.setBbzrusername(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
|
}
|
||||||
|
knbf.setZt(flag ? 100 : 98);
|
||||||
knbf.setSqr(ShiroUtil.getPrincipalProperty("id").toString());
|
knbf.setSqr(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
knbf.setSqsj(DateUtil.getDate());
|
knbf.setSqsj(DateUtil.getDate());
|
||||||
|
// zgfwKnbfService.insert(knbf);
|
||||||
zgfwKnbfService.insertWith(knbf, "jtcys");
|
zgfwKnbfService.insertWith(knbf, "jtcys");
|
||||||
|
|
||||||
//提交申请,发企业微信通知给基层工会主席
|
DifficultToDoHandler.START_PROCESS.exec(knbf);
|
||||||
List<User> unionManageByCurrentUser = vi.getUnionManageByCurrentUser();
|
DifficultToDoHandler.CREATE_UNION_TASK.exec(knbf);
|
||||||
unionManageByCurrentUser.forEach(item -> {
|
|
||||||
String msg = "%s您好,%s老师提交了元旦春节困难补助(慰问)申请,请您登录智慧工会平台进行审核。".formatted(item.getUsername(), ShiroUtil.getPlatformUsername());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(item.getLoginname()), "");
|
|
||||||
});
|
|
||||||
|
|
||||||
//提交申请
|
|
||||||
DifficultToDoHandler.START_PROCESS.exec(knbf,null);
|
|
||||||
//创建分工会审核任务
|
|
||||||
DifficultToDoHandler.CREATE_UNION_TASK.exec(knbf,null);
|
|
||||||
return Result.success();
|
return Result.success();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -129,22 +119,25 @@ public class DifficultyApply {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.apply")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doEdit(Zgfw_knbf knbf) {
|
public Object doEdit(Zgfw_knbf knbf, Boolean flag) {
|
||||||
if (Strings.isNotBlank(knbf.getApplicantsign())) {
|
if (Strings.isNotBlank(knbf.getApplicantsign())) {
|
||||||
knbf.setApplicantsign(sysSignatureService.insert(new Sys_signature(knbf.getApplicantsign())).getId());
|
knbf.setApplicantsign(sysSignatureService.insert(new Sys_signature(knbf.getApplicantsign())).getId());
|
||||||
}
|
}
|
||||||
zgfwKnbfService.update(knbf);
|
if (knbf.getApply_mode().equals("1")) {
|
||||||
|
knbf.setBbzrusername(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
|
}
|
||||||
|
knbf.setZt(flag ? 100 : 98);
|
||||||
|
zgfwKnbfService.updateIgnoreNull(knbf);
|
||||||
zgfwKnbfJtcyService.clear(Cnd.where("sqid", "=", knbf.getId()));
|
zgfwKnbfJtcyService.clear(Cnd.where("sqid", "=", knbf.getId()));
|
||||||
zgfwKnbfService.insertLinks(knbf, "jtcys");
|
zgfwKnbfService.insertLinks(knbf, "jtcys");
|
||||||
zgfwKnbfService.updateWith(knbf, "jtcys");
|
DifficultToDoHandler.START_PROCESS.exec(knbf);
|
||||||
|
DifficultToDoHandler.CREATE_UNION_TASK.exec(knbf);
|
||||||
int count = zgfwKnbfService.dao().count(Sys_local_process_instance.class, Cnd.where("processUniqueId", "=", "zgfw_knbf@" + knbf.getId()));
|
if (List.of(150,156,250,350,450).contains(knbf.getZt())){
|
||||||
if (count > 0) {
|
DifficultToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(knbf);
|
||||||
if (StrUtil.isNotBlank(knbf.getUnion_president_audit()) || StrUtil.isNotBlank(knbf.getSchool_manager_audit())) {
|
|
||||||
DifficultToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(knbf, "基层工会审核");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// zgfwKnbfService.updateWith(knbf, "jtcys");
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +148,7 @@ public class DifficultyApply {
|
|||||||
*/
|
*/
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.apply")
|
||||||
public Object getUserData() {
|
public Object getUserData() {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -8,19 +8,16 @@ import io.v.nutz.base.service.AuditService;
|
|||||||
import io.v.nutz.sys.services.SysUnionService;
|
import io.v.nutz.sys.services.SysUnionService;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
|
||||||
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfJtcyService;
|
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfJtcyService;
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
|
||||||
import org.nutz.boot.starter.ftp.FtpService;
|
import org.nutz.boot.starter.ftp.FtpService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.ioc.aop.Aop;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhf
|
* @author zhf
|
||||||
@@ -32,8 +29,6 @@ import org.nutz.mvc.annotation.Ok;
|
|||||||
@At("/platform/fw/difficulty/applylist")
|
@At("/platform/fw/difficulty/applylist")
|
||||||
public class DifficultyApplyList {
|
public class DifficultyApplyList {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FtpService ftpService;
|
private FtpService ftpService;
|
||||||
|
|
||||||
@@ -62,11 +57,13 @@ public class DifficultyApplyList {
|
|||||||
|
|
||||||
@At()
|
@At()
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(Integer year, String unitId, String unionId,PageForm page) {
|
@RequiresPermissions("difficulty.applylist")
|
||||||
|
public Object pageData(@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "unitId",required = false) String unitId,
|
||||||
|
@Param(value = "unionId",required = false) String unionId, PageForm page) {
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||||
cnd.and("sq.sqr", "=", ShiroUtil.getPrincipalProperty("id").toString())
|
cnd.and(Cnd.exps("sq.sqr", "=", ShiroUtil.getPlatformUid()).or("sq.bbzrusername", "=", ShiroUtil.getPlatformUid()));
|
||||||
/* .or("sq.bbzrusername", "=", ShiroUtil.getPrincipalProperty("id").toString())*/;
|
|
||||||
}
|
}
|
||||||
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
||||||
}
|
}
|
||||||
@@ -74,6 +71,7 @@ public class DifficultyApplyList {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.applylist")
|
||||||
public Object findOne(String id) {
|
public Object findOne(String id) {
|
||||||
return zgfwKnbfService.findOne(id);
|
return zgfwKnbfService.findOne(id);
|
||||||
}
|
}
|
||||||
@@ -81,13 +79,15 @@ public class DifficultyApplyList {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@RequiresPermissions("difficulty.applylist")
|
||||||
public Object doDelete(String id) {
|
public Object doDelete(String id) {
|
||||||
Zgfw_knbf knbf = zgfwKnbfService.fetch(id);
|
|
||||||
zgfwKnbfJtcyService.clear(Cnd.where("sqid", "=", id));
|
zgfwKnbfJtcyService.clear(Cnd.where("sqid", "=", id));
|
||||||
zgfwKnbfService.delete(id);
|
zgfwKnbfService.delete(id);
|
||||||
DifficultToDoHandler.DELETE_PROCESS_AND_TASK.exec(knbf,null);
|
|
||||||
return Result.success();
|
return Result.success();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
@@ -11,31 +7,25 @@ import com.deepoove.poi.config.Configure;
|
|||||||
import com.deepoove.poi.data.PictureRenderData;
|
import com.deepoove.poi.data.PictureRenderData;
|
||||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.model.Audit;
|
import io.v.nutz.base.model.Audit;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.service.BaseService;
|
||||||
|
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.sys.models.Sys_file;
|
import io.v.nutz.sys.models.Sys_file;
|
||||||
import io.v.nutz.sys.models.Sys_signature;
|
import io.v.nutz.sys.models.Sys_signature;
|
||||||
import io.v.nutz.sys.models.Sys_union;
|
import io.v.nutz.sys.models.Sys_union;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.sys.services.SysUnionService;
|
import io.v.nutz.sys.services.SysUnionService;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
import io.v.nutz.web.commons.utils.FileUtil;
|
import io.v.nutz.web.commons.utils.FileUtil;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfJtcyService;
|
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfJtcyService;
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
|
||||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.boot.starter.ftp.FtpService;
|
import org.nutz.boot.starter.ftp.FtpService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -47,16 +37,20 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.lang.random.R;
|
import org.nutz.lang.random.R;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhf
|
* @author zhf
|
||||||
@@ -81,9 +75,14 @@ public class ReadingController {
|
|||||||
@Inject
|
@Inject
|
||||||
private SysUnionService sysUnionService;
|
private SysUnionService sysUnionService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private BaseService baseService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Vi vi;
|
private Vi vi;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OfficeTemplateUtil officeTemplateUtil;
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/difficulty/reading.html")
|
@Ok("beetl:/platform/zgfw/difficulty/reading.html")
|
||||||
@@ -94,9 +93,13 @@ public class ReadingController {
|
|||||||
|
|
||||||
@At()
|
@At()
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(String[] dateRange, Integer year, String unitId, String unionId, PageForm page, String sq_bzlx) {
|
@RequiresPermissions("difficulty.reading")
|
||||||
|
public Object pageData(@Param(value = "dateRange", required = false) String[] dateRange,
|
||||||
|
@Param(value = "year", required = false) Integer year,
|
||||||
|
@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "unionId", required = false) String unionId, PageForm page) {
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,A06")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,wyh03,wyh02")) {
|
||||||
SqlExpressionGroup group2 = new SqlExpressionGroup();
|
SqlExpressionGroup group2 = new SqlExpressionGroup();
|
||||||
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
||||||
group2.or("sqr.unionid", "=", vi.getUnionId());
|
group2.or("sqr.unionid", "=", vi.getUnionId());
|
||||||
@@ -111,12 +114,12 @@ public class ReadingController {
|
|||||||
cnd.and("sq.sqsj", ">=", dateRange[0]);
|
cnd.and("sq.sqsj", ">=", dateRange[0]);
|
||||||
cnd.and("sq.sqsj", "<=", dateRange[1]);
|
cnd.and("sq.sqsj", "<=", dateRange[1]);
|
||||||
}
|
}
|
||||||
cnd.andEX("sq.sq_bzlx", "=", sq_bzlx);
|
|
||||||
return zgfwKnbfService.pageData(cnd, page, year, unitId, unionId);
|
return zgfwKnbfService.pageData(cnd, page, year, unitId, unionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.reading")
|
||||||
public Object findOne(String id) {
|
public Object findOne(String id) {
|
||||||
return zgfwKnbfService.findOne(id);
|
return zgfwKnbfService.findOne(id);
|
||||||
}
|
}
|
||||||
@@ -129,41 +132,37 @@ public class ReadingController {
|
|||||||
* @param response
|
* @param response
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
|
||||||
@Ok("void")
|
@Ok("void")
|
||||||
public void doExport(String id, HttpServletResponse response) throws Exception {
|
@ViReturn
|
||||||
|
@RequiresPermissions("difficulty.reading")
|
||||||
|
public void doExport(@Param("id") String id, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
Record record = zgfwKnbfService.findOne(id);
|
Record record = zgfwKnbfService.findOne(id);
|
||||||
|
record.put("knbf", "☑");
|
||||||
|
Object app = record.get("app");
|
||||||
|
if (app != null) {
|
||||||
|
Sys_signature signature = (Sys_signature) app;
|
||||||
|
if (Strings.isNotBlank(signature.getData())) {
|
||||||
|
record.set("appimg", ((Sys_signature) app).getData() != null ? getImg(((Sys_signature) app).getData()) : null);
|
||||||
|
}
|
||||||
|
}
|
||||||
Object upa = record.get("upa");
|
Object upa = record.get("upa");
|
||||||
if (upa != null) {
|
if (upa != null) {
|
||||||
Audit audit = (Audit) upa;
|
Audit audit = (Audit) upa;
|
||||||
if (Strings.isNotBlank(audit.getAuditSign())) {
|
record.set("upaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
||||||
record.set("upaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object sua = record.get("sua");
|
Object sua = record.get("sua");
|
||||||
if (sua != null) {
|
if (sua != null) {
|
||||||
Audit audit = (Audit) sua;
|
Audit audit = (Audit) sua;
|
||||||
if (Strings.isNotBlank(audit.getAuditSign())) {
|
record.set("suaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
||||||
record.set("suaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
record.set("subsidy_amount_big", Convert.digitToChinese(record.getDouble("xghbzje")));
|
||||||
|
|
||||||
if (Strings.isNotBlank(record.getString("xghbzje"))) {
|
/*int price = record.getInt("xghbzje");
|
||||||
record.set("subsidy_amount_big", Convert.digitToChinese(record.getDouble("xghbzje")));
|
int money_int = price;
|
||||||
}
|
int money_decimal = money_int - price;
|
||||||
|
|
||||||
|
|
||||||
double price = record.getDouble("xghbzje");
|
|
||||||
int money_int = (int) price;
|
|
||||||
BigDecimal b1 = new BigDecimal(price);
|
|
||||||
BigDecimal b2 = new BigDecimal(money_int);
|
|
||||||
double moneyAngle = b1.subtract(b2).doubleValue();
|
|
||||||
|
|
||||||
|
|
||||||
record.set("one", money_int >= 1000000 ? (money_int / 1000000) % 10 : null);
|
record.set("one", money_int >= 1000000 ? (money_int / 1000000) % 10 : null);
|
||||||
record.set("two", money_int >= 100000 ? (money_int / 100000) % 10 : null);
|
record.set("two", money_int >= 100000 ? (money_int / 100000) % 10 : null);
|
||||||
record.set("three", money_int >= 10000 ? (money_int / 10000) % 10 : null);
|
record.set("three", money_int >= 10000 ? (money_int / 10000) % 10 : null);
|
||||||
@@ -171,23 +170,22 @@ public class ReadingController {
|
|||||||
record.set("five", money_int >= 100 ? (money_int / 100) % 10 : null);
|
record.set("five", money_int >= 100 ? (money_int / 100) % 10 : null);
|
||||||
record.set("six", money_int >= 10 ? (money_int / 10) % 10 : null);
|
record.set("six", money_int >= 10 ? (money_int / 10) % 10 : null);
|
||||||
record.set("seven", money_int >= 10 ? money_int % 10 : null);
|
record.set("seven", money_int >= 10 ? money_int % 10 : null);
|
||||||
record.set("eight", (int) (moneyAngle * 10));
|
record.set("eight", (int) (money_decimal * 10));
|
||||||
record.set("nine", (int) (moneyAngle * 100 % 10));
|
record.set("nine", (int) (money_decimal % 0.1 * 100));*/
|
||||||
|
|
||||||
|
|
||||||
if (record.getInt("sq_bzlx") == 1) {
|
/* if (record.getInt("sq_bzlx") == 1) {
|
||||||
record.set("bzlx_name", "日常补助慰问");
|
record.set("bzlx_name", "日常补助慰问");
|
||||||
} else if (record.getInt("sq_bzlx") == 2) {
|
} else if (record.getInt("sq_bzlx") == 2) {
|
||||||
record.set("bzlx_name", "“元旦、春节”困难补助慰问");
|
record.set("bzlx_name", "“元旦、春节”困难补助慰问");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
Configure config = Configure.newBuilder().build();
|
Configure config = Configure.newBuilder().build();
|
||||||
String suffix = "困难帮扶报销表";
|
String suffix = "领取通知单";
|
||||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/difficulty/reimbursement.docx");
|
//InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/difficulty/knbf_reimbursement.docx");
|
||||||
response.addHeader("Content-Type", "application/octet-stream");
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(suffix.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(suffix.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||||
XWPFTemplate.compile(inputStream, config).render(record, response.getOutputStream());
|
XWPFTemplate.compile(officeTemplateUtil.getPath("knbf_pay"), config).render(record).writeAndClose(response.getOutputStream());
|
||||||
inputStream.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -198,20 +196,24 @@ public class ReadingController {
|
|||||||
* @param response
|
* @param response
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("void")
|
@RequiresPermissions("difficulty.reading")
|
||||||
public void export(String id, HttpServletResponse response) throws Exception {
|
public void export(@Param("id") String id, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
Record record = zgfwKnbfService.findOne(id);
|
// Record record = zgfwKnbfService.findOne(id);
|
||||||
String suffix;
|
String suffix = "江南大学工会会员困难补助申请表";
|
||||||
|
|
||||||
if (record.getString("sq_knlx").equals("1")) {
|
/* if (record.getString("sq_knlx").equals("1")) {
|
||||||
suffix = "中国药科大学在职工会会员生病住院补助备案表";
|
suffix = Globals.schoolName + "工会审批表";
|
||||||
} else if (record.getString("sq_knlx").equals("3")) {
|
} else if (record.getString("sq_knlx").equals("3")) {
|
||||||
suffix = "中国药科大学在职工会会员去世慰问金备案表";
|
suffix = Globals.schoolName + "工会审批表";
|
||||||
} else {
|
} else {
|
||||||
suffix = "中国药科大学困难补助(慰问)金申报表";
|
suffix = Globals.schoolName + "工会审批表";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
response.addHeader("Content-Type", "application/octet-stream");
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(suffix.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(suffix.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||||
Export(id, response.getOutputStream());
|
Export(id, response.getOutputStream());
|
||||||
@@ -233,12 +235,11 @@ public class ReadingController {
|
|||||||
record.set("familyList", recordList);
|
record.set("familyList", recordList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record.getInt("sq_bzlx") == 1) {
|
/* if (record.getInt("sq_bzlx") == 1) {
|
||||||
record.set("bzlx_name", "日常补助慰问");
|
record.set("bzlx_name", "日常补助慰问");
|
||||||
} else if (record.getInt("sq_bzlx") == 2) {
|
} else if (record.getInt("sq_bzlx") == 2) {
|
||||||
record.set("bzlx_name", "“元旦、春节”困难补助慰问");
|
record.set("bzlx_name", "“元旦、春节”困难补助慰问");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
//分工会
|
//分工会
|
||||||
Object app = record.get("app");
|
Object app = record.get("app");
|
||||||
@@ -253,40 +254,46 @@ public class ReadingController {
|
|||||||
Object upa = record.get("upa");
|
Object upa = record.get("upa");
|
||||||
if (upa != null) {
|
if (upa != null) {
|
||||||
Audit audit = (Audit) upa;
|
Audit audit = (Audit) upa;
|
||||||
if (Strings.isNotBlank(audit.getAuditSign())) {
|
record.set("upaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
||||||
record.set("upaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
record.set("upaTime", audit.getAuditTime() != null ? DateUtil.formatDate(audit.getAuditTime()) : null);
|
||||||
record.set("upaTime", audit.getAuditTime() != null ? DateUtil.formatDate(audit.getAuditTime()) : null);
|
record.set("upaOpinion", audit.getAuditOpinion());
|
||||||
record.set("upaOpinion", audit.getAuditOpinion());
|
}
|
||||||
}
|
|
||||||
|
//二级党委组织
|
||||||
|
Object tda = record.get("tda");
|
||||||
|
if (tda != null) {
|
||||||
|
Audit audit = (Audit) tda;
|
||||||
|
record.set("tdaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
||||||
|
record.set("tdaTime", audit.getAuditTime() != null ? DateUtil.formatDate(audit.getAuditTime()) : null);
|
||||||
|
record.set("tdaOpinion", audit.getAuditOpinion());
|
||||||
}
|
}
|
||||||
|
|
||||||
//校工会主席
|
//校工会主席
|
||||||
Object sua = record.get("sua");
|
Object sma = record.get("sma");
|
||||||
if (sua != null) {
|
if (sma != null) {
|
||||||
Audit audit = (Audit) sua;
|
Audit audit = (Audit) sma;
|
||||||
if (Strings.isNotBlank(audit.getAuditSign())) {
|
record.set("smaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
||||||
record.set("suaimg", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
record.set("smaTime", audit.getAuditTime() != null ? DateUtil.formatDate(audit.getAuditTime()) : null);
|
||||||
record.set("suaTime", audit.getAuditTime() != null ? DateUtil.formatDate(audit.getAuditTime()) : null);
|
record.set("smaOpinion", audit.getAuditOpinion());
|
||||||
record.set("suaOpinion", audit.getAuditOpinion());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings.isNotBlank(record.getString("xghbzje"))) {
|
if (Strings.isNotBlank(record.getString("xghbzje"))) {
|
||||||
record.set("subsidy_amount_big", Convert.digitToChinese(record.getDouble("xghbzje")));
|
record.set("subsidy_amount_big", Convert.digitToChinese(record.getDouble("xghbzje")));
|
||||||
} else {
|
|
||||||
record.set("subsidy_amount_big", null);
|
|
||||||
}
|
}
|
||||||
InputStream inputStream;
|
record.set("schoolName", Globals.schoolName);
|
||||||
|
|
||||||
if (record.getString("sq_knlx").equals("1")) {
|
InputStream inputStream;
|
||||||
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/difficulty/sick.docx");
|
String officeTemplateUtilPath = officeTemplateUtil.getPath("knbf_apply");
|
||||||
|
/* if (record.getString("sq_knlx").equals("1")) {
|
||||||
|
officeTemplateUtilPath = officeTemplateUtil.getPath("knbf_sick");
|
||||||
} else if (record.getString("sq_knlx").equals("3")) {
|
} else if (record.getString("sq_knlx").equals("3")) {
|
||||||
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/difficulty/die.docx");
|
officeTemplateUtilPath = officeTemplateUtil.getPath("knbf_die");
|
||||||
} else {
|
} else {
|
||||||
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/difficulty/subsidy.docx");
|
officeTemplateUtilPath = officeTemplateUtil.getPath("knbf_summary");
|
||||||
}
|
}*/
|
||||||
XWPFTemplate.compile(inputStream, config).render(record, outputStream);
|
assert officeTemplateUtilPath != null;
|
||||||
inputStream.close();
|
XWPFTemplate.compile(officeTemplateUtilPath, config).render(record, outputStream);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -300,7 +307,8 @@ public class ReadingController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public void downloadAnnex(String id, HttpServletResponse response) throws Exception {
|
@RequiresPermissions("difficulty.reading")
|
||||||
|
public void downloadAnnex(@Param("id") String id, HttpServletResponse response) throws Exception {
|
||||||
response.reset();
|
response.reset();
|
||||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||||
|
|
||||||
@@ -331,12 +339,10 @@ public class ReadingController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FileOutputStream outputStream = new FileOutputStream(tmpDir.getPath() + "/" + "职工慰问报销审批单.docx");
|
FileOutputStream outputStream = new FileOutputStream(tmpDir.getPath() + "/" + "职工慰问报销审批单.docx");
|
||||||
Export(id, outputStream);
|
Export(id, outputStream);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
|
|
||||||
String aimsDir = "zipTmp/" + R.UU32();
|
String aimsDir = "zipTmp/" + R.UU32();
|
||||||
String aimsName = fileName + ".zip";
|
String aimsName = fileName + ".zip";
|
||||||
String aimsPath = aimsDir + "/" + aimsName;
|
String aimsPath = aimsDir + "/" + aimsName;
|
||||||
@@ -357,66 +363,72 @@ public class ReadingController {
|
|||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
|
@ViReturn
|
||||||
@Ok("void")
|
@Ok("void")
|
||||||
public void doExcel(Integer year, String[] dateRange, String sq_bzlx, HttpServletResponse response) throws IOException {
|
@RequiresPermissions("difficulty.reading")
|
||||||
|
public void doExcel(@Param(value = "year", required = false) Integer year,
|
||||||
|
@Param(value = "dateRange", required = false) String[] dateRange,
|
||||||
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
|
@Param(value = "unitId", required = false) String unitId, HttpServletResponse response) throws IOException {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
su.username,
|
su.username,
|
||||||
su.loginname,
|
su.loginname,
|
||||||
su.unitname,
|
su.unitname,
|
||||||
bf.apply_reason,
|
su.unionname,
|
||||||
bf.zyzkyybz,
|
su.sex,
|
||||||
bf.xghbzje,
|
su.jobTitle,
|
||||||
bf.yhkh,
|
bf.zc,
|
||||||
bf.lxfs,
|
bf.zw,
|
||||||
knlx.lxName as sq_knlx,
|
bf.zyzkyybz,
|
||||||
IF(bf.sq_bzlx = 1,'日常补助慰问','元旦、春节困难补助慰问') as sq_bzlx,
|
bf.xghbzje,
|
||||||
bf.sqsj,
|
bf.yhkh,
|
||||||
bf.zt
|
bf.lxfs,
|
||||||
|
bf.apply_reason
|
||||||
FROM
|
FROM
|
||||||
zgfw_knbf bf
|
zgfw_knbf bf
|
||||||
LEFT JOIN `user` su ON su.id = bf.bbzrusername
|
LEFT JOIN `user` su ON su.id = bf.bbzrusername $condition
|
||||||
left join `zgfw_knlx` knlx on bf.sq_knlx = knlx.`code` $condition
|
|
||||||
""");
|
""");
|
||||||
|
|
||||||
// Cnd cnd = Cnd.where("bf.zt", "=", 500);
|
Map<String, Object> map = new HashMap<>();
|
||||||
CndPlus cnd = CndPlus.create();
|
|
||||||
|
Cnd cnd = Cnd.where("bf.zt", "=", 500);
|
||||||
if (dateRange != null && dateRange.length == 2) {
|
if (dateRange != null && dateRange.length == 2) {
|
||||||
cnd.and("bf.sqsj", ">=", dateRange[0]);
|
cnd.and("bf.sqsj", ">=", dateRange[0]);
|
||||||
cnd.and("bf.sqsj", "<=", dateRange[1]);
|
cnd.and("bf.sqsj", "<=", dateRange[1]);
|
||||||
}
|
}
|
||||||
cnd.andEX("bf.sq_bzlx", "=", sq_bzlx);
|
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,wyh03,wyh02")) {
|
||||||
|
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
||||||
|
cnd.andEX("su.unionid", "=", vi.getUnionId());
|
||||||
|
map.put("union", "院级工会主席");
|
||||||
|
|
||||||
|
}
|
||||||
|
map.put("union", "校工会");
|
||||||
|
}
|
||||||
|
cnd.andEX("su.unionid", "=", unionId);
|
||||||
|
cnd.andEX("su.unitid", "=", unitId);
|
||||||
|
cnd.asc("su.unionname");
|
||||||
|
cnd.asc("su.unitname");
|
||||||
|
cnd.asc("bf.sqsj");
|
||||||
|
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
|
|
||||||
List<Record> list = zgfwKnbfService.list(sql);
|
List<NutMap> nutMap = sysUserService.listMap(sql);
|
||||||
|
AtomicInteger listIndex = new AtomicInteger(1);
|
||||||
|
nutMap.forEach(v -> {
|
||||||
|
v.put("index", listIndex.get());
|
||||||
|
listIndex.getAndIncrement();
|
||||||
|
});
|
||||||
|
map.put("exportDate", io.v.nutz.base.utils.DateUtil.getDate());
|
||||||
|
map.put("knbf", nutMap);
|
||||||
|
|
||||||
ExportParams exportParams = new ExportParams();
|
|
||||||
exportParams.setType(ExcelType.XSSF);
|
|
||||||
if (dateRange != null) {
|
|
||||||
exportParams.setTitle(dateRange[0] + "-" + dateRange[1] + "困难帮扶汇总表");
|
|
||||||
} else {
|
|
||||||
exportParams.setTitle("困难帮扶汇总表");
|
|
||||||
}
|
|
||||||
List<ExcelExportEntity> excelExportEntities = new ArrayList<>();
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("单位", "unitname", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("联系电话", "lxfs", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("银行卡号", "yhkh", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("困难情况简要", "apply_reason", 50));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("主要致困原因备注", "zyzkyybz", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("困难类型", "sq_knlx", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("补助类型", "sq_bzlx", 20));
|
|
||||||
excelExportEntities.add(new ExcelExportEntity("申请时间", "sqsj", 20));
|
|
||||||
// excelExportEntities.add(new ExcelExportEntity("申请状态", "zt", 20));
|
|
||||||
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelExportEntities, list);
|
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||||
try {
|
Configure config = Configure.newBuilder().bind("knbf", policy).build();
|
||||||
ViTool.excelResponse(response,"困难帮扶汇总表.xlsx");
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
workbook.write(response.getOutputStream());
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(("院级工会教职工困难补助申报汇总表").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||||
} catch (Exception e) {
|
XWPFTemplate.compile(officeTemplateUtil.getPath("knbf_summary"), config).render(map).writeAndClose(response.getOutputStream());
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -426,12 +438,5 @@ public class ReadingController {
|
|||||||
return new PictureRenderData(70, 30, ".png", bytes);
|
return new PictureRenderData(70, 30, ".png", bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String none2str(String s) {
|
|
||||||
if (Strings.isBlank(s)) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-56
@@ -1,29 +1,24 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.model.Audit;
|
import io.v.nutz.base.model.Audit;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.AuditService;
|
import io.v.nutz.base.service.AuditService;
|
||||||
import io.v.nutz.sys.models.Sys_local_process_instance;
|
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
|
||||||
import org.nutz.ioc.aop.Aop;
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhf
|
* @author zhf
|
||||||
@@ -42,12 +37,6 @@ public class SchoolManagerController {
|
|||||||
@Inject
|
@Inject
|
||||||
private AuditService auditService;
|
private AuditService auditService;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Vi vi;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MsgApi msgApi;
|
|
||||||
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/difficulty/schoolmanager.html")
|
@Ok("beetl:/platform/zgfw/difficulty/schoolmanager.html")
|
||||||
@@ -57,17 +46,21 @@ public class SchoolManagerController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(Boolean isAudit, Integer year, String unitId,String unionId, PageForm page ,String bzlx) {
|
@RequiresPermissions("fw.difficulty.schoolmanager")
|
||||||
|
public Object pageData(@Param(value = "isAudit", required = false) Boolean isAudit,
|
||||||
|
@Param(value = "year", required = false) Integer year,
|
||||||
|
@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "unionId", required = false) String unionId, PageForm page) {
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
cnd.and("sq.zt", isAudit ? ">" : "=", 200);
|
cnd.and("sq.zt", isAudit ? ">" : "=", 200);
|
||||||
cnd.andEX("sq.sq_bzlx", "=", bzlx);
|
return zgfwKnbfService.pageData(cnd, page, year, unitId, unionId);
|
||||||
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.difficulty.schoolmanager")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doReview(String id, Integer pass, Audit audit, String xghbzje) {
|
public Object doReview(String id, Integer pass, Audit audit, @Param(value = "xghbzje", required = false) String xghbzje) {
|
||||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||||
@@ -75,56 +68,28 @@ public class SchoolManagerController {
|
|||||||
audit = auditService.insert(audit);
|
audit = auditService.insert(audit);
|
||||||
Zgfw_knbf zgfw_knbf = zgfwKnbfService.fetch(id);
|
Zgfw_knbf zgfw_knbf = zgfwKnbfService.fetch(id);
|
||||||
zgfw_knbf.setSchool_manager_audit(audit.getId());
|
zgfw_knbf.setSchool_manager_audit(audit.getId());
|
||||||
zgfw_knbf.setXghbzje(xghbzje);
|
// zgfw_knbf.setXghbzje(xghbzje);
|
||||||
|
if (pass == 1) {
|
||||||
String nodeName = "";
|
//不通过
|
||||||
Sys_user sysUser = zgfwKnbfService.dao().fetch(Sys_user.class, zgfw_knbf.getSqr());
|
|
||||||
if (pass==1){
|
|
||||||
nodeName = "校工会拒绝";
|
|
||||||
zgfw_knbf.setZt(250);
|
zgfw_knbf.setZt(250);
|
||||||
String msg = "%s您好,您申请的元旦春节困难补助(慰问)被校工会审核拒绝,拒绝原因:%s。".formatted(sysUser.getUsername(), audit.getAuditOpinion());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
}
|
}
|
||||||
if (pass==2){
|
if (pass == 2) {
|
||||||
nodeName = "校工会通过";
|
//通过
|
||||||
zgfw_knbf.setZt(500);
|
zgfw_knbf.setZt(500);
|
||||||
String msg = "%s您好,您申请的元旦春节困难补助(慰问)已经审核通过。".formatted(sysUser.getUsername());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
}
|
}
|
||||||
if (pass==3){
|
if (pass == 3) {
|
||||||
nodeName = "校工会退回修改";
|
zgfw_knbf.setZt(252);
|
||||||
zgfw_knbf.setZt(100);
|
|
||||||
String msg = "%s您好,您申请的元旦春节困难补助(慰问)被校工会退回修改,退回原因:%s。".formatted(sysUser.getUsername(), audit.getAuditOpinion());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
}
|
}
|
||||||
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
||||||
|
|
||||||
int count = zgfwKnbfService.dao().count(Sys_local_process_instance.class, Cnd.where("processUniqueId", "=", "zgfw_knbf@" + zgfw_knbf.getId()));
|
if (pass == 1){
|
||||||
|
DifficultToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(zgfw_knbf);
|
||||||
if (count > 0){
|
} else if (pass == 2){
|
||||||
DifficultToDoHandler.COMPLETE_SCHOOL_TASK.exec(zgfw_knbf,nodeName);
|
DifficultToDoHandler.COMPLETE_PROCESS.exec(zgfw_knbf);
|
||||||
if (pass == 1) {
|
|
||||||
DifficultToDoHandler.REFUSE_UNION_TASK.exec(zgfw_knbf,"校工会拒绝");
|
|
||||||
} else if (pass==2){
|
|
||||||
DifficultToDoHandler.COMPLETE_PROCESS.exec(zgfw_knbf,null);
|
|
||||||
} else if (pass==3){
|
|
||||||
DifficultToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(zgfw_knbf,"校工会退回修改");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
DifficultToDoHandler.COMPLETE_SCHOOL_TASK.exec(zgfw_knbf);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object doWithdraw(String id) {
|
|
||||||
Zgfw_knbf zgfw_knbf = zgfwKnbfService.fetch(id);
|
|
||||||
zgfw_knbf.setZt(200);
|
|
||||||
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -13,6 +13,7 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ import java.util.Date;
|
|||||||
@IocBean
|
@IocBean
|
||||||
public class SchoolStandingController {
|
public class SchoolStandingController {
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZgfwKnbfService zgfwKnbfService;
|
private ZgfwKnbfService zgfwKnbfService;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ public class SchoolStandingController {
|
|||||||
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/difficulty/schoolstanding.html")
|
@Ok("beetl:/platform/fw/difficulty/schoolstanding.html")
|
||||||
@RequiresPermissions("fw.difficulty.schoolstanding")
|
@RequiresPermissions("fw.difficulty.schoolstanding")
|
||||||
public void index() {
|
public void index() {
|
||||||
}
|
}
|
||||||
@@ -42,7 +44,11 @@ public class SchoolStandingController {
|
|||||||
|
|
||||||
@At()
|
@At()
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(Boolean isAudit,Integer year, String unitId,String unionId, PageForm page) {
|
@RequiresPermissions("fw.difficulty.schoolstanding")
|
||||||
|
public Object pageData(@Param(value = "isAudit",required = false) Boolean isAudit,
|
||||||
|
@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "unitId",required = false) String unitId,
|
||||||
|
@Param(value = "unionId",required = false) String unionId, PageForm page) {
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
cnd.and("sq.zt", isAudit ? ">" : "=", 400);
|
cnd.and("sq.zt", isAudit ? ">" : "=", 400);
|
||||||
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
||||||
@@ -51,6 +57,7 @@ public class SchoolStandingController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.difficulty.schoolstanding")
|
||||||
public Object doReview(String id, boolean pass, Audit audit, String jb, String xghbzje) {
|
public Object doReview(String id, boolean pass, Audit audit, String jb, String xghbzje) {
|
||||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.nutz.ioc.loader.annotation.Inject;
|
|||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class SchoolViceChairmanCon {
|
|||||||
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/difficulty/schoolvicechairman.html")
|
@Ok("beetl:/platform/fw/difficulty/schoolvicechairman.html")
|
||||||
@RequiresPermissions("fw.difficulty.schoolvicechairman")
|
@RequiresPermissions("fw.difficulty.schoolvicechairman")
|
||||||
public void index() {
|
public void index() {
|
||||||
}
|
}
|
||||||
@@ -44,7 +45,11 @@ public class SchoolViceChairmanCon {
|
|||||||
|
|
||||||
@At()
|
@At()
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(Boolean isAudit,Integer year, String unitId,String unionId, PageForm page) {
|
@RequiresPermissions("fw.difficulty.schoolvicechairman")
|
||||||
|
public Object pageData(@Param(value = "isAudit",required = false) Boolean isAudit,
|
||||||
|
@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "unitId",required = false) String unitId,
|
||||||
|
@Param(value = "unionId",required = false) String unionId, PageForm page) {
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
cnd.and("sq.zt", isAudit ? ">" : "=", 300);
|
cnd.and("sq.zt", isAudit ? ">" : "=", 300);
|
||||||
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
||||||
@@ -53,6 +58,7 @@ public class SchoolViceChairmanCon {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.difficulty.schoolvicechairman")
|
||||||
public Object doReview(String id, boolean pass, Audit audit) {
|
public Object doReview(String id, boolean pass, Audit audit) {
|
||||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||||
|
|||||||
+5
-5
@@ -1,11 +1,11 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.model.Audit;
|
import io.v.nutz.base.model.Audit;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.AuditService;
|
import io.v.nutz.base.service.AuditService;
|
||||||
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
||||||
@@ -79,15 +79,15 @@ public class TwoOrganizationController {
|
|||||||
zgfw_knbf.setZt(157);
|
zgfw_knbf.setZt(157);
|
||||||
}
|
}
|
||||||
zgfw_knbf.setXghbzje(xghbzje);
|
zgfw_knbf.setXghbzje(xghbzje);
|
||||||
// zgfw_knbf.setTwo_dzz_audit(audit.getId());
|
zgfw_knbf.setTwo_dzz_audit(audit.getId());
|
||||||
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
||||||
|
|
||||||
if (pass == 1){
|
if (pass == 1){
|
||||||
DifficultToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(zgfw_knbf,null);
|
DifficultToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(zgfw_knbf);
|
||||||
}else if (pass == 2){
|
}else if (pass == 2){
|
||||||
DifficultToDoHandler.CREATE_SCHOOL_TASK.exec(zgfw_knbf,null);
|
DifficultToDoHandler.CREATE_SCHOOL_TASK.exec(zgfw_knbf);
|
||||||
}
|
}
|
||||||
DifficultToDoHandler.COMPLETE_FINANCE_TASK.exec(zgfw_knbf,null);
|
DifficultToDoHandler.COMPLETE_FINANCE_TASK.exec(zgfw_knbf);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-51
@@ -1,30 +1,27 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
package io.v.nutz.zhgh.zgfw.controller.difficult;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.model.Audit;
|
import io.v.nutz.base.model.Audit;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.AuditService;
|
import io.v.nutz.base.service.AuditService;
|
||||||
import io.v.nutz.sys.models.Sys_local_process_instance;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
|
||||||
import io.v.nutz.sys.models.User;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.difficult.DifficultToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
import io.v.nutz.zhgh.zgfw.model.difficult.Zgfw_knbf;
|
||||||
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
import io.v.nutz.zhgh.zgfw.service.ZgfwKnbfService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
|
import org.nutz.dao.Chain;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.ioc.aop.Aop;
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhf
|
* @author zhf
|
||||||
@@ -46,9 +43,6 @@ public class UnionChairmanController {
|
|||||||
@Inject
|
@Inject
|
||||||
private Vi vi;
|
private Vi vi;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MsgApi msgApi;
|
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/difficulty/unionchairman.html")
|
@Ok("beetl:/platform/zgfw/difficulty/unionchairman.html")
|
||||||
@RequiresPermissions("fw.difficulty.unionchairman")
|
@RequiresPermissions("fw.difficulty.unionchairman")
|
||||||
@@ -57,18 +51,42 @@ public class UnionChairmanController {
|
|||||||
|
|
||||||
@At()
|
@At()
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object pageData(Boolean isAudit, Integer year, String unitId, String unionId, PageForm page) {
|
@RequiresPermissions("fw.difficulty.unionchairman")
|
||||||
|
public Object pageData(@Param(value = "isAudit",required = false) Boolean isAudit,
|
||||||
|
@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "unitId",required = false) String unitId,
|
||||||
|
@Param(value = "unionId",required = false) String unionId, PageForm page) {
|
||||||
CndPlus cnd = CndPlus.create();
|
CndPlus cnd = CndPlus.create();
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin")){
|
||||||
cnd.and("un.id", "=", vi.getUnionId());
|
cnd.and("un.id", "=", vi.getUnionId());
|
||||||
}
|
}
|
||||||
cnd.and("sq.zt", isAudit ? ">" : "=", 100);
|
cnd.and("sq.zt", isAudit ? ">" : "=", 100);
|
||||||
return zgfwKnbfService.pageData(cnd, page, year, unitId, unionId);
|
return zgfwKnbfService.pageData(cnd, page, year, unitId,unionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.difficulty.unionchairman")
|
||||||
|
public Object doEdit(String id) {
|
||||||
|
Zgfw_knbf knbf = zgfwKnbfService.fetch(id);
|
||||||
|
int zt = 0;
|
||||||
|
//审核通过,撤回为待校工会审核
|
||||||
|
if(knbf.getZt().equals(500)){
|
||||||
|
zt=200;
|
||||||
|
} else if (knbf.getZt().equals(200)){//待校工会审核,撤回为待二级党组织审核
|
||||||
|
zt=155;
|
||||||
|
}else if (knbf.getZt().equals(155)){//待二级党组织审核,撤回为待分工会审核
|
||||||
|
zt=100;
|
||||||
|
}
|
||||||
|
zgfwKnbfService.update(Chain.make("zt", zt), Cnd.where("id", "=", id));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("fw.difficulty.unionchairman")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doReview(String id, Integer pass, Audit audit) {
|
public Object doReview(String id, Integer pass, Audit audit) {
|
||||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
@@ -77,53 +95,24 @@ public class UnionChairmanController {
|
|||||||
audit.setAuditTime(new Date());
|
audit.setAuditTime(new Date());
|
||||||
audit = auditService.insert(audit);
|
audit = auditService.insert(audit);
|
||||||
Zgfw_knbf zgfw_knbf = zgfwKnbfService.fetch(id);
|
Zgfw_knbf zgfw_knbf = zgfwKnbfService.fetch(id);
|
||||||
|
|
||||||
Sys_user sysUser = zgfwKnbfService.dao().fetch(Sys_user.class, zgfw_knbf.getSqr());
|
|
||||||
// 1拒绝;2通过,3退回
|
|
||||||
String nodeName = "";
|
|
||||||
if (pass == 1) {
|
if (pass == 1) {
|
||||||
nodeName = "基层工会拒绝";
|
//不通过
|
||||||
zgfw_knbf.setZt(150);
|
zgfw_knbf.setZt(150);
|
||||||
String msg = "%s您好,您申请的元旦春节困难补助(慰问)被分工会审核拒绝,拒绝原因:%s。".formatted(sysUser.getUsername(), audit.getAuditOpinion());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
} else if (pass == 2) {
|
} else if (pass == 2) {
|
||||||
nodeName = "基层工会通过";
|
zgfw_knbf.setZt(152);
|
||||||
zgfw_knbf.setZt(200);
|
} else {
|
||||||
List<User> schoolPresident = vi.getSchoolPresident();
|
//通过
|
||||||
schoolPresident.forEach(item -> {
|
zgfw_knbf.setZt(155);
|
||||||
String msg = "%s您好,%s老师提交了元旦春节困难补助(慰问)申请,请您登录智慧工会平台进行审核。".formatted(item.getUsername(), sysUser.getUsername());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(item.getLoginname()), "");
|
|
||||||
});
|
|
||||||
} else if (pass == 3){
|
|
||||||
nodeName = "基层工会退回修改";
|
|
||||||
zgfw_knbf.setZt(100);
|
|
||||||
String msg = "%s您好,您申请的元旦春节困难补助(慰问)被分工会退回修改,退回原因:%s。".formatted(sysUser.getUsername(), audit.getAuditOpinion());
|
|
||||||
msgApi.sendWxMsg("智慧工会", "", "text", msg, List.of(sysUser.getLoginname()), "");
|
|
||||||
}
|
}
|
||||||
zgfw_knbf.setUnion_president_audit(audit.getId());
|
zgfw_knbf.setUnion_president_audit(audit.getId());
|
||||||
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
||||||
|
|
||||||
int count = zgfwKnbfService.dao().count(Sys_local_process_instance.class, Cnd.where("processUniqueId", "=", "zgfw_knbf@" + zgfw_knbf.getId()));
|
if (pass == 1){
|
||||||
|
DifficultToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(zgfw_knbf);
|
||||||
if (count > 0) {
|
}else if (pass == 3){
|
||||||
DifficultToDoHandler.COMPLETE_UNION_TASK.exec(zgfw_knbf, null);
|
DifficultToDoHandler.CREATE_FINANCE_TASK.exec(zgfw_knbf);
|
||||||
if (pass == 1) {
|
|
||||||
DifficultToDoHandler.REFUSE_UNION_TASK.exec(zgfw_knbf, "基层工会拒绝");
|
|
||||||
} else if (pass == 2) {
|
|
||||||
DifficultToDoHandler.CREATE_SCHOOL_TASK.exec(zgfw_knbf, null);
|
|
||||||
} else if (pass == 3) {
|
|
||||||
DifficultToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(zgfw_knbf, "基层工会退回修改");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
DifficultToDoHandler.COMPLETE_UNION_TASK.exec(zgfw_knbf);
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
public Object doWithdraw(String id) {
|
|
||||||
Zgfw_knbf zgfw_knbf = zgfwKnbfService.fetch(id);
|
|
||||||
zgfw_knbf.setZt(100);
|
|
||||||
zgfwKnbfService.updateIgnoreNull(zgfw_knbf);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,11 +64,12 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
@Ok("re")
|
@Ok("re")
|
||||||
@RequiresPermissions("zgfw.knbf.sjdr")
|
@RequiresPermissions("zgfw.knbf.sjdr")
|
||||||
public String index() {
|
public String index() {
|
||||||
return "beetl:/platform/zgfw/difficulty/sjdr.html";
|
return "beetl:/platform/fw/difficulty/sjdr.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
|
@RequiresPermissions("zgfw.knbf.sjdr")
|
||||||
public Object queryUser(String query) {
|
public Object queryUser(String query) {
|
||||||
try {
|
try {
|
||||||
Sql sql = Sqls.create("SELECT u.*,un.`name` unitname from sys_user u left join sys_unit un on u.unitid = un.id $condition");
|
Sql sql = Sqls.create("SELECT u.*,un.`name` unitname from sys_user u left join sys_unit un on u.unitid = un.id $condition");
|
||||||
@@ -77,7 +78,7 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
if (!ShiroUtil.hasAnyRoles("sysadmin", "A06")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin", "A06")) {
|
||||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||||
if (ShiroUtil.hasRole("H04")) {
|
if (ShiroUtil.hasRole("H04")) {
|
||||||
//基层工会
|
//院级工会
|
||||||
group.or("unit.unionid", "in", getFghIdStr());
|
group.or("unit.unionid", "in", getFghIdStr());
|
||||||
}
|
}
|
||||||
cnd.and(group);
|
cnd.and(group);
|
||||||
@@ -98,6 +99,7 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
|
@RequiresPermissions("zgfw.knbf.sjdr")
|
||||||
public Object doAdd(Zgfw_knbf zgfw_knbf) {
|
public Object doAdd(Zgfw_knbf zgfw_knbf) {
|
||||||
try {
|
try {
|
||||||
zgfw_knbf.setZyzkyy("[]");
|
zgfw_knbf.setZyzkyy("[]");
|
||||||
@@ -118,6 +120,7 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@At
|
@At
|
||||||
|
@RequiresPermissions("zgfw.knbf.sjdr")
|
||||||
public void downLoadTemp(HttpServletResponse response) throws IOException {
|
public void downLoadTemp(HttpServletResponse response) throws IOException {
|
||||||
File file = null;
|
File file = null;
|
||||||
InputStream fin = null;
|
InputStream fin = null;
|
||||||
@@ -147,7 +150,8 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
@At
|
@At
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
public Object getRow(@Param("file") TempFile tempFile, String year) {
|
@RequiresPermissions("zgfw.knbf.sjdr")
|
||||||
|
public Object getRow(@Param("file") TempFile tempFile,@Param(value = "year",required = false) String year) {
|
||||||
try {
|
try {
|
||||||
if (tempFile == null) {
|
if (tempFile == null) {
|
||||||
return Result.error("文件为空!");
|
return Result.error("文件为空!");
|
||||||
@@ -239,7 +243,6 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
jb = cell11.getStringCellValue();
|
jb = cell11.getStringCellValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Sql sql = Sqls.create("SELECT u.*,un.`name` unitname from sys_user u left join sys_unit un on u.unitid = un.id WHERE u.loginname = @loginname LIMIT 1").setParam("loginname", loginname);
|
Sql sql = Sqls.create("SELECT u.*,un.`name` unitname from sys_user u left join sys_unit un on u.unitid = un.id WHERE u.loginname = @loginname LIMIT 1").setParam("loginname", loginname);
|
||||||
List<Record> list = sysUserService.list(sql);
|
List<Record> list = sysUserService.list(sql);
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
@@ -380,6 +383,7 @@ public class ZgfwKnbfSjdrCon extends ZgfwUtil {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
|
@RequiresPermissions("zgfw.knbf.sjdr")
|
||||||
public Object write(Zgfw_knbf[] zgfw_knbfs, String sqsj) {
|
public Object write(Zgfw_knbf[] zgfw_knbfs, String sqsj) {
|
||||||
try {
|
try {
|
||||||
if (Strings.isBlank(sqsj)) {
|
if (Strings.isBlank(sqsj)) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class ZgfwUtil {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final String FGH_ROLE_ID = "5d342e614e9a48288d50154bcdcc75d3"; //基层工会
|
protected static final String FGH_ROLE_ID = "5d342e614e9a48288d50154bcdcc75d3"; //院级工会
|
||||||
protected static final String XGH_ROLE_ID = "9b01918f873645048f8a85a4fc06d135"; // 校工会
|
protected static final String XGH_ROLE_ID = "9b01918f873645048f8a85a4fc06d135"; // 校工会
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,7 +86,7 @@ public class ZgfwUtil {
|
|||||||
if (isSuperAdmin()) {
|
if (isSuperAdmin()) {
|
||||||
result = 1; //超级管理员
|
result = 1; //超级管理员
|
||||||
} else {
|
} else {
|
||||||
if (hasRole(FGH_ROLE_ID)) //基层工会
|
if (hasRole(FGH_ROLE_ID)) //院级工会
|
||||||
result = 2;
|
result = 2;
|
||||||
else if (hasRole(XGH_ROLE_ID)) //校工会
|
else if (hasRole(XGH_ROLE_ID)) //校工会
|
||||||
result = 3;
|
result = 3;
|
||||||
@@ -107,7 +107,7 @@ public class ZgfwUtil {
|
|||||||
return hasRole(HY_ROLE_ID);
|
return hasRole(HY_ROLE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据当前用户查询管理的基层工会
|
//根据当前用户查询管理的院级工会
|
||||||
protected List<String> getFghId() {
|
protected List<String> getFghId() {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
Sql sql = Sqls.create("SELECT sur.`unionid` as fghid FROM sys_user_role AS sur WHERE sur.`userId`= @userid AND sur.`roleId`= @fghrole");
|
Sql sql = Sqls.create("SELECT sur.`unionid` as fghid FROM sys_user_role AS sur WHERE sur.`userId`= @userid AND sur.`roleId`= @fghrole");
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
||||||
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import cn.wizzer.framework.base.Result;
|
|||||||
import cn.wizzer.framework.base.service.BaseService;
|
import cn.wizzer.framework.base.service.BaseService;
|
||||||
import cn.wizzer.framework.page.Pagination;
|
import cn.wizzer.framework.page.Pagination;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.zhgh.member.MemberMode;
|
|
||||||
import io.v.nutz.sys.models.Sys_msg;
|
import io.v.nutz.sys.models.Sys_msg;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.sys.services.SysMsgService;
|
import io.v.nutz.sys.services.SysMsgService;
|
||||||
import io.v.nutz.sys.services.SysMsgUserService;
|
import io.v.nutz.sys.services.SysMsgUserService;
|
||||||
import io.v.nutz.sys.services.SysUserRoleService;
|
import io.v.nutz.sys.services.SysUserRoleService;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
|
import io.v.nutz.zhgh.member.MemberMode;
|
||||||
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj_year;
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj_year;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.dao.Chain;
|
import org.nutz.dao.Chain;
|
||||||
|
|||||||
@@ -1,29 +1,63 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
||||||
|
|
||||||
|
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.TemplateExportParams;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import cn.wizzer.framework.base.service.BaseService;
|
import cn.wizzer.framework.base.service.BaseService;
|
||||||
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
|
import com.deepoove.poi.config.Configure;
|
||||||
|
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.utils.*;
|
||||||
|
import io.v.nutz.sys.models.Sys_dict;
|
||||||
import io.v.nutz.sys.models.Sys_file;
|
import io.v.nutz.sys.models.Sys_file;
|
||||||
|
import io.v.nutz.sys.models.Sys_unit;
|
||||||
|
import io.v.nutz.sys.services.SysDictService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.rxdj.RxdjToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.rxdj.RxdjToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
||||||
|
import io.v.nutz.zhgh.zgfw.template.rxdj.RxdjTemp;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
|
import org.nutz.dao.entity.Record;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
|
import org.nutz.lang.random.R;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.annotation.AdaptBy;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
import org.nutz.mvc.upload.TempFile;
|
||||||
|
import org.nutz.mvc.upload.UploadAdaptor;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@IocBean
|
@IocBean
|
||||||
@At("/platform/zgfw/rxdj/sh")
|
@At("/platform/zgfw/rxdj/sh")
|
||||||
@@ -33,6 +67,18 @@ public class RxdjShController {
|
|||||||
@Inject
|
@Inject
|
||||||
private BaseService baseService;
|
private BaseService baseService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SysDictService dictService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OfficeTemplateUtil officeTemplateUtil;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private MsgApi msgApi;
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("beetl:/platform/zgfw/rxdj/fghsh.html")
|
@Ok("beetl:/platform/zgfw/rxdj/fghsh.html")
|
||||||
@RequiresPermissions("zgfw.rxdj.fghsh")
|
@RequiresPermissions("zgfw.rxdj.fghsh")
|
||||||
@@ -84,13 +130,14 @@ public class RxdjShController {
|
|||||||
cnd.and("dj.dj_sqzt", "=", 5100);
|
cnd.and("dj.dj_sqzt", "=", 5100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isAudit == 1) {
|
// if (isAudit == 1) {
|
||||||
cnd.and("dj.dj_sqzt", "in", List.of(5200, 5215, 5218, 5300));
|
// cnd.and("dj.dj_sqzt", "in", List.of(5200, 5215, 5218, 5300));
|
||||||
} else if (isAudit == 2) {
|
// } else if (isAudit == 2) {
|
||||||
cnd.and("dj.dj_sqzt", "in", List.of(5215, 5218, 5300));
|
// cnd.and("dj.dj_sqzt", "in", List.of(5215, 5218, 5300));
|
||||||
} else {
|
// } else {
|
||||||
cnd.and("dj.dj_sqzt", "=", 5200);
|
// cnd.and("dj.dj_sqzt", "=", 5200);
|
||||||
}
|
// }
|
||||||
|
cnd.and("dj.dj_sqzt", "=", 5300);
|
||||||
}
|
}
|
||||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||||
cnd.andEX("ur.unionid", "=", Vi.getUnionId());
|
cnd.andEX("ur.unionid", "=", Vi.getUnionId());
|
||||||
@@ -117,26 +164,31 @@ public class RxdjShController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions(value = {"zgfw.rxdj.fghsh", "zgfw.rxdj.xghsh"}, logical = Logical.OR)
|
@RequiresPermissions(value = {"zgfw.rxdj.fghsh", "zgfw.rxdj.xghsh"}, logical = Logical.OR)
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doch(Fw_rxdj rxdj) {
|
public Object doch(Fw_rxdj rxdj) {
|
||||||
Fw_rxdj fw_rxdj = baseService.dao().fetch(Fw_rxdj.class, rxdj.getDj_id());
|
Fw_rxdj fw_rxdj = baseService.dao().fetch(Fw_rxdj.class, rxdj.getDj_id());
|
||||||
|
fw_rxdj.setDj_fghshr(null);
|
||||||
if (List.of(5115, 5118, 5200).contains(fw_rxdj.getDj_sqzt())) {
|
fw_rxdj.setDj_fghshsj(null);
|
||||||
fw_rxdj.setDj_fghshr(null);
|
fw_rxdj.setDj_fghshyj(null);
|
||||||
fw_rxdj.setDj_fghshsj(null);
|
fw_rxdj.setDj_sqzt(5100);
|
||||||
fw_rxdj.setDj_fghshyj(null);
|
// if (List.of(5115, 5118, 5200).contains(fw_rxdj.getDj_sqzt())) {
|
||||||
fw_rxdj.setDj_sqzt(5100);
|
// fw_rxdj.setDj_fghshr(null);
|
||||||
} else {
|
// fw_rxdj.setDj_fghshsj(null);
|
||||||
fw_rxdj.setDj_xghshr(null);
|
// fw_rxdj.setDj_fghshyj(null);
|
||||||
fw_rxdj.setDj_xghshsj(null);
|
// fw_rxdj.setDj_sqzt(5100);
|
||||||
fw_rxdj.setDj_xghshyj(null);
|
// } else {
|
||||||
fw_rxdj.setDj_sqzt(5200);
|
// fw_rxdj.setDj_xghshr(null);
|
||||||
}
|
// fw_rxdj.setDj_xghshsj(null);
|
||||||
|
// fw_rxdj.setDj_xghshyj(null);
|
||||||
|
// fw_rxdj.setDj_sqzt(5200);
|
||||||
|
// }
|
||||||
baseService.update(fw_rxdj);
|
baseService.update(fw_rxdj);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@RequiresPermissions(value = {"zgfw.rxdj.fghsh"})
|
@RequiresPermissions(value = {"zgfw.rxdj.fghsh"})
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object dofghSh(Fw_rxdj rxdj) {
|
public Object dofghSh(Fw_rxdj rxdj) {
|
||||||
try {
|
try {
|
||||||
rxdj.setDj_fghshr((String) ShiroUtil.getPrincipalProperty("username"));
|
rxdj.setDj_fghshr((String) ShiroUtil.getPrincipalProperty("username"));
|
||||||
@@ -144,10 +196,13 @@ public class RxdjShController {
|
|||||||
baseService.updateIgnoreNull(rxdj);
|
baseService.updateIgnoreNull(rxdj);
|
||||||
|
|
||||||
RxdjToDoHandler.COMPLETE_UNION_TASK.exec(rxdj);
|
RxdjToDoHandler.COMPLETE_UNION_TASK.exec(rxdj);
|
||||||
if (List.of(5115,5118).contains(rxdj.getDj_sqzt())){
|
if (Objects.equals(5118, rxdj.getDj_sqzt())) {
|
||||||
RxdjToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(rxdj);
|
RxdjToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(rxdj);
|
||||||
|
} else if (rxdj.getDj_sqzt() == 5115) {
|
||||||
|
RxdjToDoHandler.COMPLETE_UNION_TASK_REJECTED.exec(rxdj);
|
||||||
} else if (rxdj.getDj_sqzt() == 5200) {
|
} else if (rxdj.getDj_sqzt() == 5200) {
|
||||||
RxdjToDoHandler.CREATE_SCHOOL_TASK.exec(rxdj);
|
// RxdjToDoHandler.CREATE_SCHOOL_TASK.exec(rxdj);
|
||||||
|
RxdjToDoHandler.COMPLETE_PROCESS.exec(rxdj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.success();
|
return Result.success();
|
||||||
@@ -167,7 +222,7 @@ public class RxdjShController {
|
|||||||
|
|
||||||
|
|
||||||
RxdjToDoHandler.COMPLETE_SCHOOL_TASK.exec(rxdj);
|
RxdjToDoHandler.COMPLETE_SCHOOL_TASK.exec(rxdj);
|
||||||
if (List.of(5215,5218).contains(rxdj.getDj_sqzt())){
|
if (List.of(5215, 5218).contains(rxdj.getDj_sqzt())) {
|
||||||
RxdjToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(rxdj);
|
RxdjToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(rxdj);
|
||||||
} else if (rxdj.getDj_sqzt() == 5300) {
|
} else if (rxdj.getDj_sqzt() == 5300) {
|
||||||
RxdjToDoHandler.COMPLETE_PROCESS.exec(rxdj);
|
RxdjToDoHandler.COMPLETE_PROCESS.exec(rxdj);
|
||||||
@@ -194,8 +249,348 @@ public class RxdjShController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出汇总表
|
||||||
|
*
|
||||||
|
* @param year 年份
|
||||||
|
* @param djlx 登记类型
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions(value = {"zgfw.rxdj.fghsh", "zgfw.rxdj.xghsh"}, logical = Logical.OR)
|
||||||
|
public void exportSummary(Integer year, String djlx, HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
NutMap docxMap = NutMap.NEW();
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("dj_year", "=", year);
|
||||||
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionZnrxAdmin")) {
|
||||||
|
cnd.and("dj_szfghid", "=", Vi.getUnionId());
|
||||||
|
}
|
||||||
|
cnd.and("dj_djlx", "=", djlx);
|
||||||
|
cnd.and("applyType", "=", "rxdj");
|
||||||
|
List<Fw_rxdj> list = dao.query(Fw_rxdj.class, cnd);
|
||||||
|
|
||||||
|
List<NutMap> listMap = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
NutMap map = Lang.obj2nutmap(list.get(i)).addv("xh", i + 1);
|
||||||
|
map.put("jth", map.getBoolean("isCollectiveHouseholds", false) ? "是" : "否");
|
||||||
|
listMap.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
docxMap.put("list", listMap);
|
||||||
|
|
||||||
|
List<Sys_dict> schoolRegisterTypes = dictService.getSubListByCode("childrenSchoolRegisterType");
|
||||||
|
String lxname = schoolRegisterTypes.stream().filter(x -> x.getCode().equals(djlx)).findFirst().map(v -> v.getName()).orElse(null);
|
||||||
|
docxMap.put("lxname", lxname);
|
||||||
|
docxMap.put("year", year);
|
||||||
|
docxMap.put("dw", Vi.getUnion().getUnionname());
|
||||||
|
|
||||||
|
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||||
|
Configure config = Configure.builder().bind("list", policy).build();
|
||||||
|
|
||||||
|
String fileName = year + "年江南大学集体户青年教职工子女报名就读" + lxname + "情况统计表";
|
||||||
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||||
|
// File file = new File("C:\\Users\\jug\\Desktop\\childrenSchool.docx");
|
||||||
|
XWPFTemplate.compile(officeTemplateUtil.getPath("childrenSchool"), config).render(docxMap).writeAndClose(response.getOutputStream());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions(value = {"zgfw.rxdj.fghsh", "zgfw.rxdj.xghsh"}, logical = Logical.OR)
|
||||||
|
public void exportSummaryExcel(Integer year, String djlx, HttpServletResponse response) {
|
||||||
|
Map docxMap = new HashMap<String, Object>();
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("dj_year", "=", year);
|
||||||
|
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionZnrxAdmin")) {
|
||||||
|
cnd.and("dj_szfghid", "=", Vi.getUnionId());
|
||||||
|
}
|
||||||
|
cnd.and("dj_djlx", "=", djlx);
|
||||||
|
cnd.and("applyType", "=", "rxdj");
|
||||||
|
List<Fw_rxdj> list = dao.query(Fw_rxdj.class, cnd);
|
||||||
|
|
||||||
|
List<NutMap> listMap = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
NutMap map = Lang.obj2nutmap(list.get(i)).addv("xh", i + 1);
|
||||||
|
map.put("jth", map.getBoolean("isCollectiveHouseholds", false) ? "是" : "否");
|
||||||
|
map.put("zc_xl", map.getString("dj_zc") + "/" + map.getString("dj_xl"));
|
||||||
|
listMap.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Sys_dict> schoolRegisterTypes = dictService.getSubListByCode("childrenSchoolRegisterType");
|
||||||
|
String lxname = schoolRegisterTypes.stream().filter(x -> x.getCode().equals(djlx)).findFirst().map(v -> v.getName()).orElse(null);
|
||||||
|
|
||||||
|
docxMap.put("maplist", listMap);
|
||||||
|
docxMap.put("lxname", lxname);
|
||||||
|
docxMap.put("year", year);
|
||||||
|
docxMap.put("dw", Vi.getUnion().getUnionname());
|
||||||
|
|
||||||
|
String fileName = year + "年江南大学集体户青年教职工子女报名就读" + lxname + "情况统计表";
|
||||||
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||||
|
|
||||||
|
// List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||||
|
// entityList.add(new ExcelExportEntity("序号", "xh", 10));
|
||||||
|
// entityList.add(new ExcelExportEntity("青年教职工姓名", "dj_xm", 20));
|
||||||
|
// entityList.add(new ExcelExportEntity("职称/学历", "zc_xl", 20));
|
||||||
|
// entityList.add(new ExcelExportEntity("子女姓名", "dj_znname", 20));
|
||||||
|
// entityList.add(new ExcelExportEntity("子女姓别", "dj_znsex", 20));
|
||||||
|
// entityList.add(new ExcelExportEntity("子女出生年月", "dj_znzsny", 30));
|
||||||
|
// entityList.add(new ExcelExportEntity("青年教职工家庭住址", "dj_jtzz", 50));
|
||||||
|
// entityList.add(new ExcelExportEntity("青年教职工户口所在地派出所", "dj_hjssxq", 50));
|
||||||
|
// entityList.add(new ExcelExportEntity("青年教职工联系电话", "dj_iphone", 20));
|
||||||
|
// entityList.add(new ExcelExportEntity("是否集体户", "jth", 20));
|
||||||
|
// entityList.add(new ExcelExportEntity("备注", "dj_babz", 30));
|
||||||
|
try {
|
||||||
|
ViTool.excelResponse(response, year + "年江南大学集体户青年教职工子女报名就读" + lxname + "情况统计表.xlsx");
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
// Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, listMap);
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(officeTemplateUtil.getPath("rxdjdc")), docxMap);
|
||||||
|
workbook.write(response.getOutputStream());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校工会导出
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @param djlx
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("zgfw.rxdj.xghsh")
|
||||||
|
public void exportSchoolUnionSummaryExcel(Integer year, String djlx, HttpServletResponse response) {
|
||||||
|
Map docxMap = new HashMap<String, Object>();
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("dj_year", "=", year);
|
||||||
|
cnd.and("dj_djlx", "=", djlx);
|
||||||
|
cnd.and("applyType", "=", "rxdj");
|
||||||
|
List<Fw_rxdj> list = dao.query(Fw_rxdj.class, cnd);
|
||||||
|
|
||||||
|
List<NutMap> listMap = new ArrayList<>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
NutMap map = Lang.obj2nutmap(list.get(i)).addv("xh", i + 1);
|
||||||
|
map.put("jth", map.getBoolean("isCollectiveHouseholds", false) ? "是" : "否");
|
||||||
|
map.put("zc_xl", map.getString("dj_zc") + "/" + map.getString("dj_xl"));
|
||||||
|
listMap.add(map);
|
||||||
|
}
|
||||||
|
List<Sys_dict> schoolRegisterTypes = dictService.getSubListByCode("childrenSchoolRegisterType");
|
||||||
|
String lxname = schoolRegisterTypes.stream().filter(x -> x.getCode().equals(djlx)).findFirst().map(v -> v.getName()).orElse(null);
|
||||||
|
|
||||||
|
String fileName = year + "年江南大学集体户青年教职工子女报名就读" + lxname + "情况统计表";
|
||||||
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||||
|
|
||||||
|
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||||
|
entityList.add(new ExcelExportEntity("序号", "xh", 10));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工姓名", "dj_xm", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("工号", "dj_gzh", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("单位", "dj_szdw", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("分工会", "dj_szfgh", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("职称/学历", "zc_xl", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("子女姓名", "dj_znname", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("子女姓别", "dj_znsex", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("子女出生年月", "dj_znzsny", 30));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工家庭住址", "dj_jtzz", 50));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工户口所在地派出所", "dj_hjssxq", 50));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工联系电话", "dj_iphone", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("是否集体户", "jth", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("备注", "dj_babz", 30));
|
||||||
|
try {
|
||||||
|
ViTool.excelResponse(response, year + "年江南大学集体户青年教职工子女报名就读" + lxname + "情况统计表.xlsx");
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, listMap);
|
||||||
|
workbook.write(response.getOutputStream());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员保存备注
|
||||||
|
*
|
||||||
|
* @param fw_rxdj
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("zgfw.rxdj.xghsh")
|
||||||
|
public Object adminSave(@Param("info") Fw_rxdj fw_rxdj) {
|
||||||
|
dao.update(fw_rxdj, "dj_babz");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知未审核的分工会
|
||||||
|
*
|
||||||
|
* @param sendTypes 发送方式
|
||||||
|
* @param content 发送内容
|
||||||
|
* @param year 年份
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "SchoolUnionZnrxAdmin"}, logical = Logical.OR)
|
||||||
|
public Object confirmMsgBranchUnionAudit(@Param("sendTypes") String[] sendTypes,
|
||||||
|
@Param("content") String content,
|
||||||
|
@Param("year") Integer year) {
|
||||||
|
/*Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
u.username,
|
||||||
|
u.loginname
|
||||||
|
FROM
|
||||||
|
sys_user u
|
||||||
|
JOIN sys_user_role sur ON u.id = sur.userId
|
||||||
|
JOIN ( SELECT DISTINCT dj_szfghid FROM fw_rxdj WHERE YEAR ( dj_tbrq ) = @year AND dj_sqzt = 5100 ) AS subquery ON sur.unionid = subquery.dj_szfghid
|
||||||
|
WHERE
|
||||||
|
sur.roleid = '9c1f19e385914fef82bc35da7c9ded36';
|
||||||
|
""");
|
||||||
|
sql.setParam("year", year);
|
||||||
|
List<Record> list = baseService.list(sql);
|
||||||
|
for (Record r : list) {
|
||||||
|
msgApi.sendMsg(content, "", "", "", "4", new ArrayList<>() {{
|
||||||
|
add(NutMap.NEW().addv("userId", r.getString("loginname")));
|
||||||
|
}});
|
||||||
|
}*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入学登记,模版下载
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "SchoolUnionZnrxAdmin"}, logical = Logical.OR)
|
||||||
|
public void downloadImport(HttpServletResponse response){
|
||||||
|
try {
|
||||||
|
ViTool.excelResponse(response, "导入模版.xlsx");
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
|
||||||
|
Workbook sheets = ExcelExportUtil.exportExcel(exportParams, RxdjTemp.class, new ArrayList<>());
|
||||||
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
|
sheets.write(outputStream);
|
||||||
|
outputStream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
|
@RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "SchoolUnionZnrxAdmin"}, logical = Logical.OR)
|
||||||
|
public Object doImport(TempFile file, String djType, Integer year) {
|
||||||
|
try {
|
||||||
|
List<RxdjTemp> rxdjTempList = ExcelImportUtil.importExcel(file.getFile(), RxdjTemp.class, new ImportParams());
|
||||||
|
|
||||||
|
List<Fw_rxdj> nowYearDjList = dao.query(Fw_rxdj.class,
|
||||||
|
Cnd.where("dj_year", "=", cn.hutool.core.date.DateUtil.thisYear()).and("dj_djlx","=",djType));
|
||||||
|
|
||||||
|
List<Sys_unit> unitList = dao.query(Sys_unit.class, Cnd.where("unitlevel", "=", 2));
|
||||||
|
//单位map
|
||||||
|
Map<String, String> unitMap = unitList.stream().collect(Collectors.toMap(Sys_unit::getName, Sys_unit::getId));
|
||||||
|
|
||||||
|
Sql sql = Sqls.create("select id,loginname,username,sex,unitid,unitname,unionid,unionname,education,jobTitle from `user` where member = 1");
|
||||||
|
List<NutMap> userList = dictService.listMap(sql);
|
||||||
|
|
||||||
|
Map<String, NutMap> userMap = userList.stream().collect(Collectors.toMap(v -> v.getString("loginname"), v -> v));
|
||||||
|
|
||||||
|
DateTime nowDate = cn.hutool.core.date.DateUtil.date();
|
||||||
|
|
||||||
|
//需要新增的
|
||||||
|
List<Fw_rxdj> needInsertList = new ArrayList<>();
|
||||||
|
|
||||||
|
//只需要更改审核状态
|
||||||
|
List<Fw_rxdj> needUpdateList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<RxdjTemp> errorInfos = new ArrayList<>();
|
||||||
|
|
||||||
|
rxdjTempList.forEach(v->{
|
||||||
|
String unitId = unitMap.get(v.getDj_szdw());
|
||||||
|
if (StrUtil.isBlank(unitId)) {
|
||||||
|
v.setRemark("获取不到填写的单位,请检查单位名称是否正确");
|
||||||
|
errorInfos.add(v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NutMap user = userMap.get(v.getDj_gzh());
|
||||||
|
if (Lang.isEmpty(user)){
|
||||||
|
v.setRemark("获取不到该用户,请检查工号是否正确");
|
||||||
|
errorInfos.add(v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fw_rxdj fwRxdj = nowYearDjList.stream().filter(item -> item.getDj_gzh().equals(v.getDj_gzh()))
|
||||||
|
.collect(Collectors.toList()).stream().findFirst().orElse(new Fw_rxdj());
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(fwRxdj.getDj_id())) {
|
||||||
|
BeanUtils.copyProperties(v,fwRxdj);
|
||||||
|
fwRxdj.setDj_id(R.UU32());
|
||||||
|
fwRxdj.setDj_year(year);
|
||||||
|
fwRxdj.setDj_szdwid(unitId);
|
||||||
|
fwRxdj.setDj_jzgid(user.getString("id"));
|
||||||
|
fwRxdj.setDj_szfgh(user.getString("unionname"));
|
||||||
|
fwRxdj.setDj_szfghid(user.getString("unionid"));
|
||||||
|
fwRxdj.setDj_zc(StrUtil.isNotBlank(fwRxdj.getDj_zc()) ? fwRxdj.getDj_zc() : user.getString("jobTitle"));
|
||||||
|
fwRxdj.setDj_xl(StrUtil.isNotBlank(fwRxdj.getDj_xl()) ? fwRxdj.getDj_xl() : user.getString("education"));
|
||||||
|
fwRxdj.setDj_iphone(StrUtil.isNotBlank(fwRxdj.getDj_iphone()) ? fwRxdj.getDj_iphone() : user.getString("mobile"));
|
||||||
|
fwRxdj.setApplyType("rxdj");
|
||||||
|
fwRxdj.setIsCollectiveHouseholds("是".equals(v.getIsCollectiveHouseholds()));
|
||||||
|
fwRxdj.setDj_djlx(Convert.toInt(djType));
|
||||||
|
fwRxdj.setDj_fghshyj("校工会批量导入,默认通过");
|
||||||
|
fwRxdj.setDj_tbrq(nowDate);
|
||||||
|
fwRxdj.setDj_sqzt(5300);
|
||||||
|
needInsertList.add(fwRxdj);
|
||||||
|
} else {
|
||||||
|
if (fwRxdj.getDj_sqzt() != 5300){
|
||||||
|
fwRxdj.setDj_sqzt(5300);
|
||||||
|
fwRxdj.setDj_fghshyj("校工会批量导入,默认通过");
|
||||||
|
needUpdateList.add(fwRxdj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(needInsertList)) {
|
||||||
|
dao.fastInsert(needInsertList);
|
||||||
|
}
|
||||||
|
if (Lang.isNotEmpty(needUpdateList)) {
|
||||||
|
dao.updateIgnoreNull(needUpdateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(errorInfos)) {
|
||||||
|
NutMap nutMap = new NutMap();
|
||||||
|
nutMap.setv("totalCount", rxdjTempList.size());
|
||||||
|
nutMap.setv("successCount", needInsertList.size() + needUpdateList.size());
|
||||||
|
nutMap.setv("errorCount", errorInfos.size());
|
||||||
|
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||||
|
return NutMap.NEW().addv("工号", v.getDj_gzh()).addv("姓名", v.getDj_xm()).addv("错误原因", v.getRemark());
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
return Result.success(nutMap);
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,29 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import cn.wizzer.framework.base.Result;
|
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.service.ViService;
|
import io.v.nutz.base.service.ViService;
|
||||||
|
import io.v.nutz.base.utils.MsgApi;
|
||||||
import io.v.nutz.sys.models.Sys_file;
|
import io.v.nutz.sys.models.Sys_file;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.rxdj.RxdjToDoHandler;
|
import io.v.nutz.zhgh.zgfw.handler.rxdj.RxdjToDoHandler;
|
||||||
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
||||||
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj_year;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.boot.starter.ftp.FtpService;
|
import org.nutz.boot.starter.ftp.FtpService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.entity.Record;
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.dao.sql.Sql;
|
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.Lang;
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
import org.nutz.trans.Trans;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,6 +46,12 @@ public class RxdjSqController {
|
|||||||
@Inject
|
@Inject
|
||||||
private MsgApi msgApi;
|
private MsgApi msgApi;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
|
||||||
|
@Inject("Sys_file")
|
||||||
|
private ViService<Sys_file> fileViService;
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/rxdj/sq.html")
|
@Ok("beetl:/platform/zgfw/rxdj/sq.html")
|
||||||
@RequiresPermissions("sys.zgfw.rxdjsq")
|
@RequiresPermissions("sys.zgfw.rxdjsq")
|
||||||
@@ -60,83 +59,92 @@ public class RxdjSqController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At("/include")
|
||||||
public Object planStatus() {
|
@Ok("beetl:/platform/zgfw/rxdj/apply_include.html")
|
||||||
try {
|
|
||||||
Sql sql = Sqls.create("select \n" +
|
|
||||||
"(SELECT nlxz FROM `fw_rxdj_year` where bmlx=1 and bmkqzt = 1 and DATE_SUB(curdate(),INTERVAL 0 DAY) BETWEEN bmkssj and bmjssj) as nlxz,\n" +
|
|
||||||
"(SELECT count(1) FROM `fw_rxdj_year` where bmlx=1 and bmkqzt = 1 and DATE_SUB(curdate(),INTERVAL 0 DAY) BETWEEN bmkssj and bmjssj) as yey,\n" +
|
|
||||||
"(SELECT count(1) FROM `fw_rxdj_year` where bmlx=2 and bmkqzt = 1 and DATE_SUB(curdate(),INTERVAL 0 DAY) BETWEEN bmkssj and bmjssj) as xx,\n" +
|
|
||||||
"(SELECT count(1) FROM `fw_rxdj_year` where bmlx=3 and bmkqzt = 1 and DATE_SUB(curdate(),INTERVAL 0 DAY) BETWEEN bmkssj and bmjssj) as cz");
|
|
||||||
Record o = (Record) baseService.list(sql).get(0);
|
|
||||||
return o;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("json")
|
|
||||||
public Object hasDJ(Fw_rxdj rxdj, String dwname, String zw, String mobile, String loginname) {
|
|
||||||
Cnd cnd = Cnd.where("dj_jzgid", "=", rxdj.getDj_jzgid())
|
|
||||||
.and("dj_znname", "=", rxdj.getDj_znname())
|
|
||||||
.and("dj_year", "=", new SimpleDateFormat("yyyy").format(new Date()))
|
|
||||||
.and("dj_sqzt", "in", List.of(5000, 5100, 5118, 5218))
|
|
||||||
.and("applyType", "=", "rxdj");
|
|
||||||
int count = baseService.count("fw_rxdj", cnd);
|
|
||||||
Fw_rxdj fw_rxdj = baseService.dao().fetch(Fw_rxdj.class, cnd);
|
|
||||||
if (Lang.isEmpty(fw_rxdj)) {
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.success().addData(Map.of("count", count, "dj_id", fw_rxdj.getDj_id()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("sys.zgfw.rxdjsq")
|
@RequiresPermissions("sys.zgfw.rxdjsq")
|
||||||
public Object doAdd(boolean flag, @Param("data") Fw_rxdj fw_rxdj,
|
public void index2(HttpServletRequest request) {
|
||||||
@Param(value = "hkfile", required = false) Sys_file[] hkfile,
|
String id = request.getParameter("id");
|
||||||
@Param(value = "csfile", required = false) Sys_file[] csfile,
|
request.setAttribute("id", request.getParameter("id"));
|
||||||
@Param(value = "fcfile", required = false) Sys_file[] fcfile,
|
}
|
||||||
@Param(value = "qmkffile", required = false) Sys_file[] qmkffile,
|
|
||||||
@Param(value = "jszgfile", required = false) Sys_file[] jszgfile,
|
|
||||||
@Param(value = "pyhtfile", required = false) Sys_file[] pyhtfile) {
|
|
||||||
Trans.exec(() -> {
|
|
||||||
fw_rxdj.setDj_tbrfgh(Vi.getUnionId());
|
|
||||||
fw_rxdj.setDj_tbrq(DateUtil.getDateTime());
|
|
||||||
fw_rxdj.setDj_year(DateUtil.getYear().toString());
|
|
||||||
fw_rxdj.setApplyType("rxdj");
|
|
||||||
fw_rxdj.setDj_sfba(null);
|
|
||||||
fw_rxdj.setDj_sfrx(null);
|
|
||||||
if (!flag) {
|
|
||||||
baseService.insert(fw_rxdj);
|
|
||||||
} else {
|
|
||||||
if (Strings.isNotBlank(fw_rxdj.getDj_id())) {
|
|
||||||
fileViService.clear(Cnd.where("reid", "=", fw_rxdj.getDj_id()));
|
|
||||||
}
|
|
||||||
baseService.update(fw_rxdj);
|
|
||||||
}
|
|
||||||
Sys_file[] sys_files = ArrayUtil.addAll(hkfile, csfile, jszgfile, pyhtfile);
|
|
||||||
for (Sys_file file : sys_files) {
|
|
||||||
file.setReid(fw_rxdj.getDj_id());
|
|
||||||
baseService.insert(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本年入学计划
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjsq")
|
||||||
|
@ViReturn
|
||||||
|
public Object schoolPlans() {
|
||||||
|
List<Fw_rxdj_year> plans = dao.query(Fw_rxdj_year.class, Cnd.where("bmyear", "=", cn.hutool.core.date.DateUtil.thisYear()));
|
||||||
|
return plans;
|
||||||
|
}
|
||||||
|
|
||||||
RxdjToDoHandler.START_PROCESS.exec(fw_rxdj);
|
/**
|
||||||
RxdjToDoHandler.CREATE_UNION_TASK.exec(fw_rxdj);
|
* 详情
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjsq")
|
||||||
|
@ViReturn
|
||||||
|
public Object findOne(String id) {
|
||||||
|
Fw_rxdj info = dao.fetch(Fw_rxdj.class, id);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
@At
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjsq")
|
||||||
|
@ViReturn
|
||||||
|
@SLog(type = "入学登记", tag = "登记", msg = "保存", param = true, result = true)
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public Object save(@Param("info") Fw_rxdj fw_rxdj) {
|
||||||
|
fw_rxdj.setDj_sqzt(5000);
|
||||||
|
fw_rxdj.setApplyType("rxdj");
|
||||||
|
fw_rxdj.setDj_tbrq(new Date());
|
||||||
|
fw_rxdj.setDj_year(cn.hutool.core.date.DateUtil.thisYear());
|
||||||
|
dao.insertOrUpdate(fw_rxdj);
|
||||||
|
RxdjToDoHandler.START_PROCESS.exec(fw_rxdj);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject("Sys_file")
|
|
||||||
private ViService<Sys_file> fileViService;
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjsq")
|
||||||
@ViReturn
|
@ViReturn
|
||||||
public Object getZnxxByJzgId() {
|
@SLog(type = "入学登记", tag = "登记", msg = "提交", param = true, result = true)
|
||||||
return baseService.dao().query(Fw_rxdj.class, Cnd.where("dj_jzgid", "=", ShiroUtil.getUserId()).and("applyType", "=", "znxx"));
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public Object submit(@Param("info") Fw_rxdj fw_rxdj) {
|
||||||
|
fw_rxdj.setDj_sqzt(5100);
|
||||||
|
fw_rxdj.setApplyType("rxdj");
|
||||||
|
fw_rxdj.setDj_tbrq(new Date());
|
||||||
|
fw_rxdj.setDj_year(cn.hutool.core.date.DateUtil.thisYear());
|
||||||
|
dao.insertOrUpdate(fw_rxdj);
|
||||||
|
|
||||||
|
RxdjToDoHandler.START_PROCESS.exec(fw_rxdj);
|
||||||
|
RxdjToDoHandler.CREATE_UNION_TASK.exec(fw_rxdj);
|
||||||
|
|
||||||
|
// String unionId = fw_rxdj.getDj_szfghid();
|
||||||
|
// Sql sql = Sqls.create("""
|
||||||
|
// SELECT
|
||||||
|
// u.username,
|
||||||
|
// u.loginname\s
|
||||||
|
// FROM
|
||||||
|
// sys_user_role sur
|
||||||
|
// LEFT JOIN sys_user u ON u.id = sur.userId\s
|
||||||
|
// WHERE
|
||||||
|
// sur.roleid = '5d342e614e9a48288d50154bcdcc75d3'\s
|
||||||
|
// AND sur.unionid = @unionId
|
||||||
|
// """);
|
||||||
|
// sql.setParam("unionId", unionId);
|
||||||
|
// NutMap userMap = fileViService.fetch(sql);
|
||||||
|
// if (Lang.isNotEmpty(userMap)) {
|
||||||
|
// String msg = "您好!" + fw_rxdj.getDj_xm() + "老师申请一条子女入学登记,请您登录智慧工会系统进行审核。";
|
||||||
|
// msgApi.sendMsg(msg, "", "", "", "4", new ArrayList<>() {{
|
||||||
|
// add(NutMap.NEW().addv("userId", userMap.getString("loginname")));
|
||||||
|
// }});
|
||||||
|
// }
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
package io.v.nutz.zhgh.zgfw.controller.rxdj;
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import cn.wizzer.framework.base.service.BaseService;
|
import cn.wizzer.framework.base.service.BaseService;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.Vi;
|
|
||||||
import io.v.nutz.base.dao.CndPlus;
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.utils.ViTool;
|
||||||
|
import io.v.nutz.sys.models.Sys_dict;
|
||||||
import io.v.nutz.sys.models.Sys_file;
|
import io.v.nutz.sys.models.Sys_file;
|
||||||
|
import io.v.nutz.sys.services.SysDictService;
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
|
import io.v.nutz.web.commons.utils.FileUtil;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.handler.rxdj.RxdjToDoHandler;
|
|
||||||
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.boot.starter.ftp.FtpService;
|
import org.nutz.boot.starter.ftp.FtpService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -21,14 +28,23 @@ import org.nutz.dao.entity.Record;
|
|||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
|
import org.nutz.lang.random.R;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
import org.nutz.trans.Trans;
|
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
@@ -50,6 +66,9 @@ public class RxdjSqxxController {
|
|||||||
@Inject
|
@Inject
|
||||||
private FtpService ftpService;
|
private FtpService ftpService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SysDictService sysDictService;
|
||||||
|
|
||||||
@At("")
|
@At("")
|
||||||
@Ok("beetl:/platform/zgfw/rxdj/sqxx.html")
|
@Ok("beetl:/platform/zgfw/rxdj/sqxx.html")
|
||||||
@RequiresPermissions("sys.zgfw.rxdjxx")
|
@RequiresPermissions("sys.zgfw.rxdjxx")
|
||||||
@@ -63,7 +82,9 @@ public class RxdjSqxxController {
|
|||||||
@RequiresPermissions("sys.zgfw.rxdjxx")
|
@RequiresPermissions("sys.zgfw.rxdjxx")
|
||||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||||
@Param(value = "unionId", required = false) String unionId,
|
@Param(value = "unionId", required = false) String unionId,
|
||||||
@Param(value = "unitId", required = false) String unitId, PageForm pageForm) {
|
@Param(value = "unitId", required = false) String unitId,
|
||||||
|
@Param(value = "djlx", required = false) String djlx,
|
||||||
|
PageForm pageForm) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
dj.*,
|
dj.*,
|
||||||
@@ -81,6 +102,7 @@ public class RxdjSqxxController {
|
|||||||
CndPlus cndPlus = CndPlus.create();
|
CndPlus cndPlus = CndPlus.create();
|
||||||
cndPlus.andEX("dj.dj_year", "=", year);
|
cndPlus.andEX("dj.dj_year", "=", year);
|
||||||
cndPlus.andEX("dj.applyType", "=", "rxdj");
|
cndPlus.andEX("dj.applyType", "=", "rxdj");
|
||||||
|
cndPlus.andEX("dj.dj_djlx", "=", djlx);
|
||||||
cndPlus.andEX("u.unionid", "=", unionId);
|
cndPlus.andEX("u.unionid", "=", unionId);
|
||||||
cndPlus.andEX("u.unitid", "=", unitId);
|
cndPlus.andEX("u.unitid", "=", unitId);
|
||||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||||
@@ -144,45 +166,6 @@ public class RxdjSqxxController {
|
|||||||
return Result.success().addData(nutMap);
|
return Result.success().addData(nutMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
|
||||||
@ViReturn
|
|
||||||
@RequiresPermissions("sys.zgfw.rxdjxx")
|
|
||||||
public Object doEdit(boolean flag, @Param("data") Fw_rxdj fw_rxdj,
|
|
||||||
@Param(value = "hkfile", required = false) Sys_file[] hkfile,
|
|
||||||
@Param(value = "csfile", required = false) Sys_file[] csfile,
|
|
||||||
@Param(value = "fcfile", required = false) Sys_file[] fcfile,
|
|
||||||
@Param(value = "qmkffile", required = false) Sys_file[] qmkffile,
|
|
||||||
@Param(value = "jszgfile", required = false) Sys_file[] jszgfile,
|
|
||||||
@Param(value = "pyhtfile", required = false) Sys_file[] pyhtfile) {
|
|
||||||
Trans.exec(() -> {
|
|
||||||
fw_rxdj.setDj_year(DateUtil.getYear().toString());
|
|
||||||
fw_rxdj.setDj_tbrq(DateUtil.getDateTime());
|
|
||||||
fw_rxdj.setDj_tbrfgh(Vi.getUnionId());
|
|
||||||
fw_rxdj.setApplyType("rxdj");
|
|
||||||
fw_rxdj.setDj_sfba(null);
|
|
||||||
fw_rxdj.setDj_sfrx(null);
|
|
||||||
fw_rxdj.setDj_sqzt(flag ? 5100 : 5000);
|
|
||||||
baseService.update(fw_rxdj);
|
|
||||||
|
|
||||||
baseService.dao().clear(Sys_file.class, Cnd.where("reid", "=", fw_rxdj.getDj_id()).and("bz", "is not", null));
|
|
||||||
Sys_file[] sys_files = ArrayUtil.addAll(hkfile, csfile, pyhtfile, jszgfile);
|
|
||||||
for (Sys_file file : sys_files) {
|
|
||||||
file.setReid(fw_rxdj.getDj_id());
|
|
||||||
baseService.insert(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
RxdjToDoHandler.START_PROCESS.exec(fw_rxdj);
|
|
||||||
RxdjToDoHandler.CREATE_UNION_TASK.exec(fw_rxdj);
|
|
||||||
if (List.of(5115,5215).contains(fw_rxdj.getDj_sqzt())){
|
|
||||||
RxdjToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(fw_rxdj);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
public Object findfjList(String id) {
|
public Object findfjList(String id) {
|
||||||
List fjList = baseService.list(Sqls.create("select CONCAT('" + Globals.AppFileDomain + "',filepath) as url,filepath,filename,filepath id,bz from sys_file where reid = @id").setParam("id", id));
|
List fjList = baseService.list(Sqls.create("select CONCAT('" + Globals.AppFileDomain + "',filepath) as url,filepath,filename,filepath id,bz from sys_file where reid = @id").setParam("id", id));
|
||||||
@@ -208,4 +191,168 @@ public class RxdjSqxxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出汇总表
|
||||||
|
* @param year
|
||||||
|
* @param djlx
|
||||||
|
* @param searchName
|
||||||
|
* @param searchKeyword
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjxx")
|
||||||
|
public void doExportExcel(@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "djlx",required = false) String djlx,
|
||||||
|
@Param(value = "searchName",required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||||
|
HttpServletResponse response){
|
||||||
|
Sql sql = Sqls.create("SELECT * FROM fw_rxdj $condition");
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("dj_year", "=", year);
|
||||||
|
cnd.andEX("dj_djlx", "=", djlx);
|
||||||
|
cnd.and("applyType", "=", "rxdj");
|
||||||
|
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
|
||||||
|
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||||
|
}
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
List<NutMap> list = sysDictService.listMap(sql);
|
||||||
|
List<Sys_dict> childrenSchoolRegisterType = sysDictService.getSubListByCode("childrenSchoolRegisterType");
|
||||||
|
Map<String, String> rxdjTypeMap = childrenSchoolRegisterType.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||||
|
|
||||||
|
list.forEach(v->{
|
||||||
|
String djName = rxdjTypeMap.get(v.getString("dj_djlx"));
|
||||||
|
v.put("jth", v.getBoolean("isCollectiveHouseholds", false) ? "是" : "否");
|
||||||
|
v.put("zc_xl", v.getString("dj_zc") + "/" + v.getString("dj_xl"));
|
||||||
|
v.put("djName",djName);
|
||||||
|
});
|
||||||
|
|
||||||
|
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||||
|
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||||
|
no.setFormat("isAddIndex");
|
||||||
|
entityList.add(no);
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工姓名", "dj_xm", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("登记类型", "djName", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("工号", "dj_gzh", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("单位", "dj_szdw", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("分工会", "dj_szfgh", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("职称/学历", "zc_xl", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("子女姓名", "dj_znname", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("子女姓别", "dj_znsex", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("子女出生年月", "dj_znzsny", 30));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工家庭住址", "dj_jtzz", 50));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工户口所在地派出所", "dj_hjssxq", 50));
|
||||||
|
entityList.add(new ExcelExportEntity("青年教职工联系电话", "dj_iphone", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("是否集体户", "jth", 20));
|
||||||
|
entityList.add(new ExcelExportEntity("备注", "dj_babz", 30));
|
||||||
|
|
||||||
|
try {
|
||||||
|
ViTool.excelResponse(response, year + "年江南大学集体户青年教职工子女报名就读情况统计表.xlsx");
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
|
||||||
|
workbook.write(response.getOutputStream());
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出附件信息
|
||||||
|
* @param year
|
||||||
|
* @param djlx
|
||||||
|
* @param searchName
|
||||||
|
* @param searchKeyword
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjxx")
|
||||||
|
public void doExportEnclosure(@Param(value = "year",required = false) Integer year,
|
||||||
|
@Param(value = "djlx",required = false) String djlx,
|
||||||
|
@Param(value = "searchName",required = false) String searchName,
|
||||||
|
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||||
|
HttpServletResponse response){
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.and("dj_year", "=", year);
|
||||||
|
cnd.andEX("dj_djlx", "=", djlx);
|
||||||
|
cnd.and("applyType", "=", "rxdj");
|
||||||
|
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
|
||||||
|
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||||
|
}
|
||||||
|
cnd.and("files","is not",null);
|
||||||
|
cnd.and("files","!=","[]");
|
||||||
|
|
||||||
|
List<Fw_rxdj> list = baseService.dao().query(Fw_rxdj.class, cnd);
|
||||||
|
|
||||||
|
if (Lang.isEmpty(list))return;
|
||||||
|
|
||||||
|
Map<String, List<Fw_rxdj>> loginNameDjMap = list.stream().collect(Collectors.groupingBy(v -> v.getDj_gzh()));
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建临时文件夹
|
||||||
|
*/
|
||||||
|
String tmpPath = "tmp/" + R.UU32();
|
||||||
|
File tmpDir = new File(tmpPath + "/江南大学集体户青年教职工子女报名就读情况附件汇总");
|
||||||
|
tmpDir.mkdirs();
|
||||||
|
|
||||||
|
loginNameDjMap.forEach((k,v)->{
|
||||||
|
Fw_rxdj fwRxdj = v.stream().findFirst().orElse(null);
|
||||||
|
/**
|
||||||
|
* 创建临时文件夹
|
||||||
|
*/
|
||||||
|
String fileName = fwRxdj.getDj_xm() + "(" + k + ")附件信息";
|
||||||
|
File tDir = new File(tmpDir + "/" + fileName);
|
||||||
|
tDir.mkdirs();
|
||||||
|
|
||||||
|
List<Sys_file> fileList = v.stream().flatMap(item -> item.getFiles().stream()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
for (Sys_file file : fileList) {
|
||||||
|
try {
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(tDir.getPath() + "/" + file.getFilename());
|
||||||
|
ftpService.download(file.getFilepath(), outputStream);
|
||||||
|
outputStream.close();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
String aimsDir = "zipTmp/" + R.UU32();
|
||||||
|
String aimsName = year + "年江南大学集体户青年教职工子女报名就读情况附件汇总.zip";
|
||||||
|
String aimsPath = aimsDir + "/" + aimsName;
|
||||||
|
FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName);
|
||||||
|
|
||||||
|
response.setHeader("content-disposition", "attachment;filename="
|
||||||
|
+ URLEncoder.encode(aimsName, "UTF-8"));
|
||||||
|
|
||||||
|
File aimsFile = new File(aimsPath);
|
||||||
|
FileInputStream inputStream = new FileInputStream(aimsFile);
|
||||||
|
IOUtils.copy(inputStream, response.getOutputStream());
|
||||||
|
inputStream.close();
|
||||||
|
aimsFile.delete();
|
||||||
|
|
||||||
|
FileUtil.deleteDir(new File(tmpPath));
|
||||||
|
FileUtil.deleteDir(new File(aimsDir));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验是否有附件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sys.zgfw.rxdjxx")
|
||||||
|
public Object hasFiles() {
|
||||||
|
int count = baseService.dao().count(Fw_rxdj.class, Cnd.where("files", "is not", null).and("files", "!=", "[]"));
|
||||||
|
return count > 0 ? Result.success() : Result.error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
|||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.ZipUtil;
|
import cn.hutool.core.util.ZipUtil;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.dao.CndPlus;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||||
import io.v.nutz.base.utils.Vi;
|
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.sys.models.Sys_file;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import io.v.nutz.base.utils.ViTool;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
|
import io.v.nutz.sys.models.Sys_file;
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
import io.v.nutz.zhgh.zgfw.model.rxdj.Fw_rxdj;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
@@ -264,7 +264,7 @@ public class RxdjZhcxController {
|
|||||||
imageType = "学历学位证或教师资格证" + (i + 1);
|
imageType = "学历学位证或教师资格证" + (i + 1);
|
||||||
}
|
}
|
||||||
String fullFileName = v.getString("username") + "(" + v.getString("loginname") + ")" + imageType;
|
String fullFileName = v.getString("username") + "(" + v.getString("loginname") + ")" + imageType;
|
||||||
String extName = cn.hutool.core.io.FileUtil.extName(sysFile.getFilename());
|
String extName = FileUtil.extName(sysFile.getFilename());
|
||||||
FileOutputStream outputStream = new FileOutputStream(userNamePath.toAbsolutePath() + "\\" + fullFileName + "." + extName);
|
FileOutputStream outputStream = new FileOutputStream(userNamePath.toAbsolutePath() + "\\" + fullFileName + "." + extName);
|
||||||
ftpService.download(sysFile.getFilepath(), outputStream);
|
ftpService.download(sysFile.getFilepath(), outputStream);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|||||||
+1
-34
@@ -7,9 +7,8 @@ package io.v.nutz.zhgh.zgfw.controller.rxdj.mobile;
|
|||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
|
||||||
import io.v.nutz.base.utils.MsgApi;
|
|
||||||
import io.v.nutz.base.service.ViService;
|
import io.v.nutz.base.service.ViService;
|
||||||
|
import io.v.nutz.base.utils.MsgApi;
|
||||||
import io.v.nutz.sys.models.Sys_file;
|
import io.v.nutz.sys.models.Sys_file;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
@@ -138,38 +137,6 @@ public class ZgfwJzgznrxdjMobileController {
|
|||||||
@Inject
|
@Inject
|
||||||
private MsgApi msgApi;
|
private MsgApi msgApi;
|
||||||
|
|
||||||
@At
|
|
||||||
@Ok("json")
|
|
||||||
@ViReturn
|
|
||||||
public Object doSubmit(boolean flag, @Param("data") Fw_rxdj jzgznbmdj,
|
|
||||||
@Param(value = "hkfile", required = false) Sys_file[] hkfile,
|
|
||||||
@Param(value = "csfile", required = false) Sys_file[] csfile,
|
|
||||||
@Param(value = "fcfile", required = false) Sys_file[] fcfile,
|
|
||||||
@Param(value = "jszgfile", required = false) Sys_file[] jszgfile,
|
|
||||||
@Param(value = "pyhtfile", required = false) Sys_file[] pyhtfile,
|
|
||||||
@Param(value = "qmkffile", required = false) Sys_file[] qmkffile) {
|
|
||||||
Trans.exec(() -> {
|
|
||||||
try {
|
|
||||||
jzgznbmdj.setDj_sqzt(flag ? 5100 : 5000);
|
|
||||||
jzgznbmdj.setDj_sfbc(1);
|
|
||||||
jzgznbmdj.setApplyType("rxdj");
|
|
||||||
jzgznbmdj.setDj_year(DateUtil.getYear().toString());
|
|
||||||
jzgznbmdj.setDj_tbrq(DateUtil.getDateTime());
|
|
||||||
Fw_rxdj insert = jzgznbmdjService.insert(jzgznbmdj);
|
|
||||||
Sys_file[] sys_files = ArrayUtil.addAll(hkfile, csfile, pyhtfile, jszgfile);
|
|
||||||
saveFiles(sys_files, insert.getDj_id());
|
|
||||||
/* Sys_user_role userRole = sysUserService.dao().fetch(Sys_user_role.class, Cnd.where("roleid", "=", Roles.UNION_MANGER).and("unionid", "=", Vi.getUnionId()));
|
|
||||||
Sys_user user = sysUserService.dao().fetch(Sys_user.class, Cnd.where("id", "=", userRole.getUserId()));
|
|
||||||
String content = "您有一条“%s”老师提交的“%s”的摸底信息,请审核!".formatted(io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("username"), jzgznbmdj.getDj_djlx().equals(2) ? "幼升小" : "小学");
|
|
||||||
// msgApi.pushWeChatMsg("子女入学登记通知", content, user.getLoginname());*/
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user