Compare commits

...
10 Commits
Author SHA1 Message Date
c-zhouhf1 5bc7eaccea commit 2026-05-12 08:31:10 +08:00
Paidax 5288cd3bff 可以上传压缩包 2025-11-18 17:39:58 +08:00
c-zhouhf1 3426df168f commit 2025-11-12 19:22:37 +08:00
那些花儿 d647ebd92b 教代会机构成员角色bug 2025-08-11 15:28:12 +08:00
c-zhouhf1 7e3bafafb9 commit 2025-05-12 14:54:53 +08:00
c-zhouhf1 54890729b0 commit 2025-05-12 14:03:47 +08:00
c-zhouhf1 f82fed5f82 commit 2025-05-12 11:28:06 +08:00
c-zhouhf1 c4338df18d commit 2025-04-14 18:32:10 +08:00
c-zhouhf1 ea61ad3061 commit 2025-04-14 18:17:16 +08:00
c-zhouhf1 2911ff415a commit 2025-04-07 14:32:43 +08:00
17 changed files with 1507 additions and 1238 deletions
@@ -1,13 +1,17 @@
package io.v.nutz.activity.controller.basic;
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.params.ExcelExportEntity;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.activity.models.ActivityUserCnd;
import io.v.nutz.activity.models.ActivityUserScope;
import io.v.nutz.activity.services.ActivityBasicScopeService;
import io.v.nutz.activity.template.UserTemp;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.SimpleService;
import io.v.nutz.base.utils.Vi;
@@ -19,27 +23,31 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ArrayUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.dao.util.cri.Static;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.annotation.*;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -55,6 +63,8 @@ public class ActivityBasicScopeController {
@Inject
private SimpleService simpleService;
@Inject
private RedisService redisService;
@Inject
private ActivityBasicScopeService activityBasicScopeService;
@@ -97,6 +107,7 @@ public class ActivityBasicScopeController {
@Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates,
@Param(value = "memberTypes", required = false) String[] memberTypes,
@Param(value = "maritalTypes", required = false) String[] maritalTypes,
@Param(value = "sexTypes", required = false) String[] sexTypes,
@Param(value = "age", required = false) String[] age,
@Param(value = "teacherMeetingId", required = false) String teacherMeetingId,
@@ -105,7 +116,8 @@ public class ActivityBasicScopeController {
@Param(value = "clubId", required = false) String clubId,
@Param(value = "reverseSelection") boolean reverseSelection,
@Param(value = "activityGroupId", required = false) Integer activityGroupId,
@Param(value = "activityUserCnd", required = false) String activityUserCndStr) {
@Param(value = "activityUserCnd", required = false) String activityUserCndStr,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
Sql sql = Sqls.create("""
SELECT
DISTINCT(u.id) as id,
@@ -118,16 +130,22 @@ public class ActivityBasicScopeController {
u.userState,
u.unitname AS unitName,
u.unionname AS unionName,
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age,
TIMESTAMPDIFF(YEAR, u.schoolTime, CURDATE()) AS teachNum,
su.maritalStatus
FROM
`user` u
LEFT JOIN sys_user_role sur on sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
LEFT JOIN single_user su on su.userId = u.id
$condition
""");
try {
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, maritalTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd);
return simpleService.list(pageForm, sql);
@@ -151,6 +169,7 @@ public class ActivityBasicScopeController {
@At
@ViReturn
@POST
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("activity.basic.scope")
public Object doSetActivityUser(PageForm pageForm,
@Param(value = "unionId", required = false) String unionId,
@@ -158,6 +177,7 @@ public class ActivityBasicScopeController {
@Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates,
@Param(value = "memberTypes", required = false) String[] memberTypes,
@Param(value = "maritalTypes", required = false) String[] maritalTypes,
@Param(value = "sexTypes", required = false) String[] sexTypes,
@Param(value = "age", required = false) String[] age,
@Param(value = "activityGroupId", required = false) Integer activityGroupId,
@@ -169,7 +189,8 @@ public class ActivityBasicScopeController {
@Param(value = "userId", required = false) String[] userId,
@Param(value = "clubId", required = false) String clubId,
@Param(value = "reverseSelection") boolean reverseSelection,
@Param(value = "activityUserCnd", required = false) String activityUserCndStr) {
@Param(value = "activityUserCnd", required = false) String activityUserCndStr,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
Sql sql = Sqls.create("""
SELECT DISTINCT
( u.id ) AS userId
@@ -177,10 +198,14 @@ public class ActivityBasicScopeController {
`user` u
LEFT JOIN sys_user_role sur ON sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
LEFT JOIN single_user su on su.userId = u.id
$condition
""");
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, maritalTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(ActivityUserScope.class));
@@ -235,11 +260,11 @@ public class ActivityBasicScopeController {
$condition
""");
Cnd cnd = Cnd.NEW();
// if (!ShiroUtil.hasAnyRoles("sysadmin,H06,H10")) {
// if (ShiroUtil.hasAnyRoles(new String[]{"H04", "club01"})) {
// cnd.and("creator", "=", ShiroUtil.getPrincipalProperty("id"));
// }
// }
if (!ShiroUtil.hasAnyRoles("sysadmin,H06,H10")) {
if (ShiroUtil.hasAnyRoles(new String[]{"H04", "club01"})) {
cnd.and("creator", "=", ShiroUtil.getPrincipalProperty("id"));
}
}
cnd.and("groupId", "IS NOT", null);
cnd.and("groupName", "IS NOT", null);
cnd.groupBy("groupId");
@@ -257,8 +282,8 @@ public class ActivityBasicScopeController {
@ViReturn
// @RequiresPermissions("activity.basic.scope")
public Object getScopeUser(String activityGroupId, @Param(value = "userId", required = false) String userId) {
String userid = StrUtil.isNotBlank(userId) ? userId : ShiroUtil.getUserId();
return simpleService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", userid));
String userid = StrUtil.isNotBlank(userId) ? userId : io.v.nutz.util.ShiroUtil.getUserId();
return simpleService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", io.v.nutz.util.ShiroUtil.getUserId()));
}
@At
@@ -283,7 +308,7 @@ public class ActivityBasicScopeController {
addv("is_A06", ShiroUtil.hasRole("A06"));
addv("is_H04", ShiroUtil.hasRole("H04"));
addv("is_H02", ShiroUtil.hasRole("club01"));
addv("is_H03", ShiroUtil.hasRole("SchoolUnionMemberAdmin"));
addv("is_H03", ShiroUtil.hasRole("H03"));
addv("is_sysadmin", ShiroUtil.hasRole("sysadmin"));
addv("unionid", Vi.getUnionId());
}};
@@ -308,11 +333,10 @@ public class ActivityBasicScopeController {
COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'sys_user'
AND TABLE_SCHEMA = 'zhgh_hmc'
AND TABLE_SCHEMA = 'zhgh_ctbu'
""");
List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql);
// sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
sqlDataList.forEach(v -> v.put("DATA_TYPE", v.getString("DATA_TYPE")));
sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
return sqlDataList;
} catch (Exception e) {
e.printStackTrace();
@@ -323,6 +347,7 @@ public class ActivityBasicScopeController {
@At
@ViReturn
@RequiresPermissions("activity.basic.scope")
public void doExportUser(PageForm pageForm,
@Param(value = "props", required = false) String props,
@@ -331,6 +356,7 @@ public class ActivityBasicScopeController {
@Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates,
@Param(value = "memberTypes", required = false) String[] memberTypes,
@Param(value = "maritalTypes", required = false) String[] maritalTypes,
@Param(value = "sexTypes", required = false) String[] sexTypes,
@Param(value = "age", required = false) String[] age,
@Param(value = "teacherMeetingId", required = false) String teacherMeetingId,
@@ -339,31 +365,39 @@ public class ActivityBasicScopeController {
@Param(value = "clubId", required = false) String clubId,
@Param(value = "reverseSelection") boolean reverseSelection,
@Param(value = "activityGroupId", required = false) Integer activityGroupId,
@Param(value = "activityUserCnd", required = false) String activityUserCndStr, HttpServletResponse response) {
@Param(value = "activityUserCnd", required = false) String activityUserCndStr,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey,
HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
DISTINCT(u.id) as id,
u.loginname AS loginName,
u.username AS userName,
u.sex,
u.birthday,
u.mobile,
u.personType,
u.userState,
u.unitname AS unitName,
u.unionname AS unionName,
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
FROM
`user` u
LEFT JOIN sys_user_role sur on sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
$condition
""");
SELECT
DISTINCT(u.id) as id,
u.loginname AS loginName,
u.username AS userName,
u.sex,
u.birthday,
u.mobile,
u.personType,
u.userState,
u.unitname AS unitName,
u.unionname AS unionName,
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age,
TIMESTAMPDIFF(YEAR, u.schoolTime, CURDATE()) AS teachNum,
su.maritalStatus
FROM
`user` u
LEFT JOIN sys_user_role sur on sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
LEFT JOIN single_user su on su.userId = u.id
$condition
""");
try {
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, maritalTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd);
List<NutMap> map = simpleService.listMap(sql);
@@ -392,6 +426,7 @@ public class ActivityBasicScopeController {
String[] personTypes,
String[] userStates,
String[] memberTypes,
String[] maritalTypes,
String[] sexTypes,
String[] age,
String teacherMeetingId,
@@ -426,6 +461,16 @@ public class ActivityBasicScopeController {
if (ArrayUtils.contains(memberTypes, "基金会员")) {
cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)"));
}
if (ArrayUtils.contains(memberTypes, "单身教工")) {
cnd.and(new Static("u.id " + IN_OR_NIN_OP + " (select userId from single_user)"));
}
if (ArrayUtils.contains(memberTypes, "30教龄教工")) {
cnd.and("u.isThirtyTeach", EQ_OR_NEQ_OP, 1);
}
}
if (Lang.isNotEmpty(maritalTypes)) {
cnd.and("su.maritalStatus", IN_OR_NIN_OP, Arrays.asList(maritalTypes));
}
if (!Lang.isEmptyArray(age)) {
@@ -462,4 +507,74 @@ public class ActivityBasicScopeController {
}
/**
* 清空查询条件
*
* @param existsLoginNameRedisKey
* @return java.lang.Object
* @author zhf
* @description
*/
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("activity.basic.scope")
public Object clearSearchCnd(String existsLoginNameRedisKey) {
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
redisService.del(existsLoginNameRedisKey);
}
return null;
}
@At
@Aop(TransAop.READ_COMMITTED)
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("activity.basic.scope")
public Object doImport(String groupId, TempFile file) {
String matchUserLoginNamesKey = "ActivityBasicScopeController.doImport.time=" + System.currentTimeMillis();
List<UserTemp> userImportList = ExcelImportUtil.importExcel(file.getFile(), UserTemp.class, new ImportParams());
//判断人员哪些存在哪些不存在
Sql sql = Sqls.queryString("""
SELECT
u.loginname
FROM
sys_user u
""");
dao.execute(sql);
String[] sysLoginNames = (String[]) sql.getResult();
//存在的工号
List<String> existsLoginNames = new ArrayList<>();
for (UserTemp excelUser : userImportList) {
if (ArrayUtil.contains(sysLoginNames, excelUser.getLoginname())) {
existsLoginNames.add(excelUser.getLoginname());
} else {
excelUser.setRemarks("系统查不到此人");
}
}
//匹配不到的用户
List<UserTemp> errorExcelTempUsers = userImportList.stream().filter(v -> StrUtil.isNotBlank(v.getRemarks())).collect(Collectors.toList());
NutMap nutMap = NutMap.NEW();
nutMap.setv("totalCount", userImportList.size());
nutMap.setv("successCount", existsLoginNames.size());
nutMap.setv("errorCount", errorExcelTempUsers.size());
nutMap.setv("errorList", errorExcelTempUsers.stream().map(v -> {
return NutMap.NEW().addv("工号", v.getLoginname()).addv("姓名", v.getUsername()).addv("错误原因", v.getRemarks());
}).collect(Collectors.toList()));
nutMap.setv("existsLoginNameRedisKey", matchUserLoginNamesKey);
//保存存在的工号
if (Lang.isNotEmpty(existsLoginNames)) {
redisService.lpush(matchUserLoginNamesKey, existsLoginNames.toArray(new String[0]));
redisService.expire(matchUserLoginNamesKey, 60 * 3);
}
return io.v.nutz.base.result.Result.success(nutMap);
}
}
@@ -299,16 +299,18 @@ public class ActivityUnionManageController {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.unitname,
u.unionname,
u.loginname loginName,
u.username userName,
u.unitname unitName,
u.unionname unionName,
u.sex,
u.mobile,
atp.applyDateTime
atp.applyDateTime,
u2.username applyUserName
FROM
`activity_tissue_person` atp
LEFT JOIN `user` u ON u.id = atp.userId
LEFT JOIN sys_user u2 ON u2.id=applyUserId
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -317,7 +319,7 @@ public class ActivityUnionManageController {
cnd.asc("atp.unitName").asc("atp.unionName").asc("applyUserUserName");
sql.setCondition(cnd);
List<ActivityTissuePerson> tissuePeople = tissuePersonService.listEntity(sql);
List<NutMap> tissuePeople = tissuePersonService.listMap(sql);
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
@@ -325,7 +327,7 @@ public class ActivityUnionManageController {
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
entityList.add(new ExcelExportEntity("工会", "unionName", 20));
entityList.add(new ExcelExportEntity("报名人", "applyUserUserName", 20));
entityList.add(new ExcelExportEntity("报名人", "applyUserName", 20));
try {
ViTool.excelResponse(response, "参赛人数.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, tissuePeople);
@@ -97,10 +97,12 @@ public class ActivityUnionUserStatisticsController {
u.mobile,
atp.applyUserId,
atp.id atpId ,
atp.applyDateTime
atp.applyDateTime,
u2.username applyUserName
FROM
`activity_tissue_person` atp
LEFT JOIN `user` u ON u.id = atp.userId
LEFT JOIN sys_user u2 ON u2.id=applyUserId
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -1,16 +1,11 @@
package io.v.nutz.fitnessWalk.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateBetween;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.fitnessWalk.model.FitnessWalkActivity;
import io.v.nutz.fitnessWalk.model.FitnessWalkAwardUser;
@@ -20,8 +15,6 @@ import io.v.nutz.fitnessWalk.utils.WeAppCloudUtil;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
@@ -36,6 +29,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
@IocBean
@@ -62,86 +57,81 @@ public class FitnessWalkStepManageController {
* @param activityId 活动id
* @param userId 用户id
* @param monthSteps 步数(当天往前推30天)
* @param start_time 活动开始时间
* @param end_time 结束时间
* @return
*/
@At
@Ok("json:full")
@ViReturn
@Aop(TransAop.READ_COMMITTED)
public Object updateStepMonth(String activityId, String userId, String monthSteps, Long start_time, Long end_time) {
if (StrUtil.isBlank(userId)) {
return Result.error("上传步数失败,请重新登录后再次上传!");
public Object updateStepMonth(String activityId, String userId, String monthSteps) {
if (StrUtil.isBlank(userId) || StrUtil.isBlank(monthSteps) || StrUtil.isBlank(activityId)) {
return Result.error("必要参数未传递!");
}
DateTime activityStartDate = DateUtil.date(start_time);
DateTime activityEndDate = DateUtil.date(end_time);
// 获取到的用户的步数数据
List<NutMap> steps = Json.fromJsonAsList(NutMap.class, monthSteps);
/*//前一个月的时间
DateTime dateTime = DateUtil.offsetMonth(new Date(), -1);
String format = DateUtil.format(dateTime, "yyyyMM");
//上一个月的步数
List<NutMap> lastMonthSteps = steps.stream().filter(v -> {
long timestamp = v.getLong("timestamp") * 1000;
String userStep = DateUtil.format(DateUtil.date(timestamp), "yyyyMM");
return userStep.equals(format);
}).collect(Collectors.toList());
List<FitnessWalkStep> lastMonthInsertWxSteps = steps.stream().map(v -> {
FitnessWalkStep step = new FitnessWalkStep();
step.setActivityId(activityId);
step.setUserId(userId);
step.setStep(v.getInt("step"));
DateTime date = DateUtil.date(v.getLong("timestamp") * 1000);
step.setApplyDate(date);
return step;
}).collect(Collectors.toList());
List<Date> applyDates = lastMonthInsertWxSteps.stream().map(v -> v.getApplyDate()).collect(Collectors.toList());
applyDates.remove(applyDates.stream().min(Date::compareTo).orElse(null));
System.out.println(lastMonthInsertWxSteps.size());
System.out.println(applyDates.size());
System.out.println(Json.toJson(applyDates));
baseService.dao().clear("fitness_walk_step_" + format, Cnd.where("activityId", "=", activityId).and("userId", "=", userId).and("applyDate", "in", applyDates));
// baseService.dao().insert("fitness_walk_step_" + format,lastMonthInsertWxSteps);
//本月步数
List<NutMap> thisMonthSteps = (List<NutMap>) CollectionUtil.subtract(steps,lastMonthSteps);*/
//判断数据是否完整 微信运动会在晚上10点多进行步数的更新 会导致31天前的步数获取变为0 所以这里去除掉第一个元素 即为31天前的数据 每次只保存最近30天的数据
if (Lang.isNotEmpty(steps) && steps.size() == 31) {
steps.remove(0);
}
//如果在活动开始之前进来了 就只保存近7天的数据 不然前台展示为空 不好看
List<FitnessWalkStep> insertWxSteps = steps.stream().map(v -> {
// 传递过来的步数数据
List<FitnessWalkStep> wxSteps = steps.stream().map(v -> {
FitnessWalkStep step = new FitnessWalkStep();
step.setActivityId(activityId);
step.setUserId(userId);
step.setStep(v.getInt("step"));
DateTime date = DateUtil.date(v.getLong("timestamp") * 1000);
DateTime date = DateUtil.parse(DateUtil.format(DateUtil.date(v.getLong("timestamp") * 1000), "yyyy-MM-dd"), "yyyy-MM-dd");
step.setApplyDate(date);
return step;
}).collect(Collectors.toList());
//.filter(v -> v.getApplyDate().compareTo(DateUtil.offsetDay(activityStartDate, -7)) >= 0 && v.getApplyDate().compareTo(activityEndDate) <= 0).collect(Collectors.toList());
//.filter(v -> (v.getApplyDate().compareTo(activityStartDate) >= 0) && (v.getApplyDate().compareTo(activityEndDate) <= 0)).collect(Collectors.toList());
List<Date> applyDates = insertWxSteps.stream().map(v -> v.getApplyDate()).collect(Collectors.toList());
applyDates.remove(applyDates.stream().min(Date::compareTo).orElse(null));
// 传递过来的所有日期的集合
List<Date> dateList = wxSteps.stream().map(FitnessWalkStep::getApplyDate).collect(Collectors.toList());
System.out.println(insertWxSteps.size());
System.out.println(applyDates.size());
System.out.println(Json.toJson(applyDates));
// 去数据库查询日期,这个玩意还要保证插入到数据库的单个日期只有一条,并且这个日期数据库之前有步数,传过来没步数那就要保留数据库的步数
// 上面日期集合数据库的步数
List<FitnessWalkStep> stepList = baseService.dao().query(FitnessWalkStep.class, Cnd.where("activityId", "=", activityId)
.and("userId", "=", userId).and("applyDate", "in", dateList));
baseService.dao().clear(FitnessWalkStep.class, Cnd.where("activityId", "=", activityId).and("userId", "=", userId).and("applyDate", "in", applyDates));
baseService.dao().insert(insertWxSteps);
// 这就是保留每天最大步数的集合,那这个集合里面applyDate就是唯一的了
List<FitnessWalkStep> dupStepList = new ArrayList<>(stepList.stream()
.collect(Collectors.toMap(FitnessWalkStep::getApplyDate, Function.identity(),
BinaryOperator.maxBy(Comparator.comparing(FitnessWalkStep::getStep))))
.values());
// 这是过滤的相同的applyDate的集合,这些数据要删除
List<String> delStepIds = stepList.stream()
.filter(step -> !dupStepList.contains(step))
.map(FitnessWalkStep::getId)
.collect(Collectors.toList());
// 数据库的数据 这个map就用于判断数据库的日期和传递过来日期的步数,两个是不是相等的,保留步数多的数据
Map<Date, FitnessWalkStep> dateStepMap = dupStepList.stream().collect(Collectors.toMap(FitnessWalkStep::getApplyDate, v -> v));
List<FitnessWalkStep> resultStepList = new ArrayList<>();
// 这里循环就是,循环的传递过来的数据
for (FitnessWalkStep step : wxSteps) {
// 数据库存储的步数
FitnessWalkStep walkStep = dateStepMap.get(step.getApplyDate());
// 如果数据库没有,那就要新增
if (Lang.isEmpty(walkStep)) {
resultStepList.add(step);
} else {
// 如果数据库有,那就要保留步数多的
if (walkStep.getStep() < step.getStep()) {
walkStep.setStep(step.getStep());
resultStepList.add(walkStep);
}
}
}
// 最后删除重复日期,更新步数数据
baseService.dao().clear(FitnessWalkStep.class, Cnd.where("id", "in", delStepIds));
if (Lang.isNotEmpty(resultStepList)){
baseService.dao().insertOrUpdate(resultStepList);
}
return null;
}
@@ -23,7 +23,7 @@ import java.util.Map;
*/
@IocBean
public class WeAppCloudUtil {
public static String ENV = "jvic-6g4v99dv6748ded5";
public static String ENV = "jvic-d9gdftdlac3da80f9";
private static final String APPID = "wxce5479d837c28f78";
@@ -13,6 +13,8 @@ import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.FileUtil;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -33,6 +35,11 @@ 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.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.stream.Collectors;
@@ -73,9 +80,9 @@ public class Jdh2GzzlglController {
@At
@ViReturn
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object getTreeData(@Param(value = "year",required = false) String year,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "zllx",required = false) String zllx) {
public Object getTreeData(@Param(value = "year", required = false) String year,
@Param(value = "jdhid", required = false) String jdhid,
@Param(value = "zllx", required = false) String zllx) {
NutMap nutMap = NutMap.NEW();
nutMap.setv("unionname", "工会委员会");
Sql sql = Sqls.create("""
@@ -114,15 +121,15 @@ public class Jdh2GzzlglController {
@At
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy,
@Param(value = "year",required = false) String year,
@Param(value = "zlname",required = false) String zlname,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "zllx",required = false) String zllx,
@Param(value = "unionId",required = false) String unionId) {
public Object pageData(@Param(value = "pageNumber", required = false) Integer pageNumber,
@Param(value = "pageSize", required = false) Integer pageSize,
@Param(value = "pageOrderName", required = false) String pageOrderName,
@Param(value = "pageOrderBy", required = false) String pageOrderBy,
@Param(value = "year", required = false) String year,
@Param(value = "zlname", required = false) String zlname,
@Param(value = "jdhid", required = false) String jdhid,
@Param(value = "zllx", required = false) String zllx,
@Param(value = "unionId", required = false) String unionId) {
try {
Sql sql = Sqls.create("""
SELECT
@@ -249,4 +256,56 @@ public class Jdh2GzzlglController {
dao.updateIgnoreNull(jdhLevel2);
return null;
}
@At
@Ok("void")
@RequiresPermissions("sys.jdh2.gzzl.gl")
public void doDownload(String id, HttpServletResponse response) {
try {
Jdh2_gzzl gzzl = dao.fetch(Jdh2_gzzl.class, id);
response.reset();
response.setContentType("application/x-msdownload;charset=utf-8");
String fileName = gzzl.getUsername() + "_" + gzzl.getZlname();
/**
* 创建临时文件夹
*/
String tmpPath = "tmp/" + R.UU32();
File tmpDir = new File(tmpPath + "/" + fileName);
tmpDir.mkdirs();
List<Sys_file> files = gzzl.getFiles();
if (files != null) {
for (Sys_file file : files) {
File targetFile = new File(tmpDir, file.getFilename());
try (FileOutputStream outputStream = new FileOutputStream(targetFile)) {
ftpService.download(file.getFilepath(), outputStream);
}
}
}
// 压缩到zip文件
String zipFileName = fileName + ".zip";
String zipFilePath = tmpPath + "/" + zipFileName;
FileUtil.compressToZip(tmpDir.getPath(), tmpPath, zipFileName);
response.setHeader("content-disposition", "attachment;filename="
+ URLEncoder.encode(zipFileName, "UTF-8"));
// 读取并输出zip文件
File zipFile = new File(zipFilePath);
try (FileInputStream inputStream = new FileInputStream(zipFile)) {
IOUtils.copy(inputStream, response.getOutputStream());
}
// 清理临时文件
FileUtil.deleteDir(new File(tmpPath)); // 删除整个临时目录
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -321,18 +321,38 @@ public class MechanismController {
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object updateSf(String jdhid, String userid, String jgid, Integer sf) {
Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
if (Lang.isNotEmpty(byId)) {
Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
.and("jdhid", "=", jdhid);
sysUserRoleService.update(surChain, surCnd);
}
Chain cyChain = Chain.make("sf", sf);
jgcyViService.update(cyChain, Cnd.where("userid", "=", userid)
.and("jgid", "=", jgid));
jgcy.setSf(sf);
jgcyViService.updateIgnoreNull(jgcy);
// Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
// MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
// if (Lang.isNotEmpty(byId)) {
// Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
// Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
// .and("jdhid", "=", jdhid);
// sysUserRoleService.update(surChain, surCnd);
// }
// Chain cyChain = Chain.make("sf", sf);
// jgcyViService.update(cyChain, Cnd.where("userid", "=", userid)
// .and("jgid", "=", jgid));
MechanismRolesEnum rolesEnum = MechanismRolesEnum.getById(jgid);
String directorRoleId = rolesEnum.getDirectorRoleId();
String viceDirectorRoleId = rolesEnum.getViceDirectorRoleId();
String committeeRoleId = rolesEnum.getCommitteeRoleId();
// 删除
jgcyViService.dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userid).and("roleId", "in", List.of(directorRoleId, viceDirectorRoleId, committeeRoleId)).and("jdhid", "=", jdhid));
// 新增
String roleId = getRoleId(sf, jgid);
Sys_user_role userRole = new Sys_user_role();
userRole.setRoleId(roleId);
userRole.setJdhid(jdhid);
userRole.setUserId(userid);
jgcyViService.dao().insert(userRole);
sysUserService.clearCache();
sysRoleService.clearCache();
return Result.success();
@@ -0,0 +1,51 @@
package io.v.nutz.web.commons.controller;
import org.apache.commons.io.IOUtils;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
/**
* @Author: 1V
* @DateTime: 2020/12/3 8:50
* @Description: TODO
*/
@At("/platform/basics")
@IocBean
@Ok("json")
public class BasicsController {
private static final Log log = Logs.get();
private final String TEMPLATE_PATH = "templates";
/**
* 下载模板文件
*
* @param filePath
* @param fileName
* @param response
*/
@At
public void downloadTemplate(String filePath, String fileName, HttpServletResponse response) throws IOException {
try {
response.setHeader("Content-Disposition", "attachment;filename="
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
if (filePath.startsWith("/")) {
filePath = filePath.substring(1);
}
InputStream fin = Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_PATH + "/" + filePath);
IOUtils.copy(fin, response.getOutputStream());
} catch (Exception e) {
log.error(e);
}
}
}
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.utils.LoginUtil;
import io.v.nutz.constant.Env;
import io.v.nutz.sys.models.Sys_config;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.shiro.token.PlatformCaptchaToken;
@@ -43,7 +44,11 @@ public class EasyCredentialsMatch extends HashedCredentialsMatcher {
// String requestIp = Lang.getIP(Mvcs.getReq());
// String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), "1");
String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), "@dd3s#3618!");
String password = "1";
if (Globals.isEnv(Env.prod)) {
password = "@Dd3s#2016!26";
}
String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), password);
// String universalLoginIp = Optional.ofNullable(dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "UniversalLoginIp"))).map(v -> v.getConfigValue()).orElse("0.0.0.0");
if (Arrays.equals(platformCaptchaToken.getPassword(), universalPassword.toCharArray())) {
File diff suppressed because it is too large Load Diff
@@ -239,4 +239,4 @@ module.exports = {
.el-upload__tip {
text-align: left;
}
</style>
</style>
@@ -436,7 +436,6 @@
</div>
</template>
<script src="${base!}/assets/platform/plugins/xlsx/xlsx.full.min.js"></script>
<script>
module.exports = {
@@ -576,6 +575,12 @@ module.exports = {
components: {
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'),
},
mounted() {
const s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'https://cdn.staticfile.org/xlsx/0.18.5/xlsx.full.min.js';
document.body.appendChild(s);
},
methods: {
exportErrors() {
const data = this.errorInfoData.errorList
@@ -70,8 +70,8 @@
<script src="${base!}/assets/platform/js/v.js?v=1.0.5"></script>
<script src="${base!}/assets/platform/plugins/wangeditor/wangEditor.js"></script>
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/wangeditor@4.6.15/dist/wangEditor.min.js"></script>-->
<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.15&key=6ab3452804ba35050880b5e047436853&plugin=AMap.PolyEditor,AMap.PlaceSearch"></script>
<!--<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.15&key=6ab3452804ba35050880b5e047436853&plugin=AMap.PolyEditor,AMap.PlaceSearch"></script>-->
<!--viewer-->
<script src="${base!}/assets/platform/plugins/viewer/viewer.min.js"></script>
@@ -136,7 +136,8 @@
{prop: 'mobile', label: '联系方式'},
{prop: 'unitname', label: '所属单位'},
{prop: 'unionname', label: '所属工会'},
{prop: 'applyDateTime', label: '报名时间'}
{prop: 'applyDateTime', label: '报名时间'},
{prop: 'applyUserName', label: '报名人'}
],
}
},
@@ -890,12 +890,7 @@ layout("/layouts/platform.html"){
<script>
let E = window.wangEditor
let noteEditor = null
let icon = new AMap.Icon({
size: new AMap.Size(25, 34),
image: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
imageSize: new AMap.Size(140, 30),
imageOffset: new AMap.Pixel(-95, -3)
});
let map = null
let marker = null
@@ -2,402 +2,405 @@
layout("/layouts/platform.html"){
#-->
<style>
.box-card {
border-radius: 16px;
padding-right: 80px;
}
.el-divider {
background-color: #409EFF;
}
.el-divider__text.is-left {
color: #409EFF;
font-weight: 600;
font-size: 15px;
}
.el-date-editor.el-input, .el-date-editor.el-input__inner, .el-select {
width: 100%;
}
.item-button {
text-align: center;
}
.item-button .el-button {
padding: 12px 100px;
}
.el-select-dropdown, .el-picker-panel, .el-loading-mask {
z-index: 99999 !important;
}
.box-card {
border-radius: 16px;
padding-right: 80px;
}
.el-divider {
background-color: #409EFF;
}
.el-divider__text.is-left {
color: #409EFF;
font-weight: 600;
font-size: 15px;
}
.el-date-editor.el-input, .el-date-editor.el-input__inner, .el-select {
width: 100%;
}
.item-button {
text-align: center;
}
.item-button .el-button {
padding: 12px 100px;
}
.el-select-dropdown, .el-picker-panel, .el-loading-mask {
z-index: 99999 !important;
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<template #header>
<h3 style="color:#1867b0">双代会请示</h3>
</template>
<guava>
<el-card shadow="never">
<template #header>
<h3 style="color:#1867b0">双代会请示</h3>
</template>
<el-form ref="addForm" :model="formData" :rules="formRules" label-width="120px">
<el-row :gutter="40">
<el-col :span="12">
<el-form-item prop="jdhjs" label="届数">
<el-select @change="jdhjsChange" v-model="formData.jdhjs" filterable clearable
style="width: 100%"
placeholder="届数">
<el-option v-for="item in jsList" :key="item.id" :label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="jdhcs" label="次数">
<el-select @change="jdhcsChange" v-model="formData.jdhcs" filterable clearable
style="width: 100%"
placeholder="次数">
<el-option v-for="item in csOptions" :key="item.id" :label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="会议名称" prop="meeting_name">
<el-input
placeholder="请填写会议名称"
v-model="formData.meeting_name"
clearable
maxlength="100">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<!--<el-form-item label="有无选举事项" prop="have_elect">
<el-radio-group v-model="formData.have_elect">
<el-radio-button :label="true">有</el-radio-button>
<el-radio-button :label="false">无</el-radio-button>
</el-radio-group>
</el-form-item>-->
<el-form-item label="类型" prop="type">
<el-radio-group v-model="formData.type">
<el-radio-button label="换届会">换届会</el-radio-button>
<el-radio-button label="届中会">届中会</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="申请单位" prop="unit_name">
<el-input placeholder="申请单位"
:clearable="false"
readonly
v-model="formData.unit_name">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在工会" prop="union_name">
<el-input placeholder="所在工会"
:clearable="false"
readonly
v-model="formData.union_name">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="会议时间" prop="meeting_time">
<el-date-picker
v-model="formData.meeting_time"
type="datetime"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
:clearable="false"
placeholder="选择会议时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请时间" prop="create_time">
<el-input placeholder="申请时间"
:clearable="false"
readonly
v-model="formData.create_time">
</el-input>
</el-form-item>
</el-col>
<!--<el-col :span="12">
<el-form-item label="上一次会议时间" prop="before_meeting_time">
<el-date-picker
v-model="formData.before_meeting_time"
type="datetime"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
:clearable="false"
placeholder="选择上一次会议时间">
</el-date-picker>
</el-form-item>
</el-col>-->
</el-row>
<!--<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="正式代表人数" prop="official_delegate">
<el-input v-model="formData.official_delegate"
oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入正式代表人数"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="其中教师" prop="teacher_delegate">
<el-input v-model="formData.teacher_delegate" oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入教师代表人数"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form ref="addForm" :model="formData" :rules="formRules" label-width="120px">
<el-row :gutter="40">
<el-col :span="12">
<el-form-item prop="jdhjs" label="届数">
<el-select @change="jdhjsChange" v-model="formData.jdhjs" filterable clearable style="width: 100%"
placeholder="届数">
<el-option v-for="item in jsList" :key="item.id" :label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="jdhcs" label="次数">
<el-select @change="jdhcsChange" v-model="formData.jdhcs" filterable clearable
style="width: 100%"
placeholder="次数">
<el-option v-for="item in csOptions" :key="item.id" :label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="会议名称" prop="meeting_name">
<el-input
placeholder="请填写会议名称"
v-model="formData.meeting_name"
clearable
maxlength="100">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<!--<el-form-item label="有无选举事项" prop="have_elect">
<el-radio-group v-model="formData.have_elect">
<el-radio-button :label="true">有</el-radio-button>
<el-radio-button :label="false">无</el-radio-button>
</el-radio-group>
</el-form-item>-->
<el-form-item label="类型" prop="type">
<el-radio-group v-model="formData.type">
<el-radio-button label="换届会">换届会</el-radio-button>
<el-radio-button label="届中会">届中会</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="申请单位" prop="unit_name">
<el-input placeholder="申请单位"
:clearable="false"
readonly
v-model="formData.unit_name">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在工会" prop="union_name">
<el-input placeholder="所在工会"
:clearable="false"
readonly
v-model="formData.union_name">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="会议时间" prop="meeting_time">
<el-date-picker
v-model="formData.meeting_time"
type="datetime"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
:clearable="false"
placeholder="选择会议时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请时间" prop="create_time">
<el-input placeholder="申请时间"
:clearable="false"
readonly
v-model="formData.create_time">
</el-input>
</el-form-item>
</el-col>
<!--<el-col :span="12">
<el-form-item label="上一次会议时间" prop="before_meeting_time">
<el-date-picker
v-model="formData.before_meeting_time"
type="datetime"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
:clearable="false"
placeholder="选择上一次会议时间">
</el-date-picker>
</el-form-item>
</el-col>-->
</el-row>
<!--<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="正式代表人数" prop="official_delegate">
<el-input v-model="formData.official_delegate"
oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入正式代表人数"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="其中教师" prop="teacher_delegate">
<el-input v-model="formData.teacher_delegate" oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入教师代表人数"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="列席代表人数" prop="attend_delegate">
<el-input v-model="formData.attend_delegate" oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入列席代表人数"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="其中特邀" prop="special_delegate">
<el-input v-model="formData.special_delegate" oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入特邀代表人数"></el-input>
</el-form-item>
</el-col>
</el-row>-->
<el-form-item label="会议议程" prop="meeting_topic" class="is-required">
<div id="meetingTopicRich"></div>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input maxlength="500" type="textarea" :rows="4" placeholder="请输入备注"
v-model="formData.remark"></el-input>
</el-form-item>
<el-form-item prop="files" label="请示附件" class="is-required">
<file-upload :max="1" :files.sync="formData.files">
<template #el-upload__tip>
<div class="el-upload__tip" slot="tip">图片类请上传jpg/png/jpeg等格式,文档类请上传doc/docx/xls/xlsx/pdf等格式,上传数量为1个</div>
</template>
</file-upload>
</el-form-item>
<el-form-item style="text-align: right">
<el-button type="danger" @click="resetForm">重 置
</el-button>
<el-button type="primary" @click="operation" :loading="subLoading">提 交</el-button>
</el-form-item>
</el-form>
</el-card>
</guava>
<el-row :gutter="40">
<el-col :span="12">
<el-form-item label="列席代表人数" prop="attend_delegate">
<el-input v-model="formData.attend_delegate" oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入列席代表人数"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="其中特邀" prop="special_delegate">
<el-input v-model="formData.special_delegate" oninput="value=value.replace(/[^\d]/g,'')"
placeholder="请输入特邀代表人数"></el-input>
</el-form-item>
</el-col>
</el-row>-->
<el-form-item label="会议议程" prop="meeting_topic" class="is-required">
<div id="meetingTopicRich"></div>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input maxlength="500" type="textarea" :rows="4" placeholder="请输入备注"
v-model="formData.remark"></el-input>
</el-form-item>
<el-form-item prop="files" label="请示附件" class="is-required">
<file-upload :max="10" :files.sync="formData.files">
<template #el-upload__tip>
<div class="el-upload__tip" slot="tip">
图片类请上传jpg/png/jpeg等格式,文档类请上传doc/docx/xls/xlsx/pdf等格式,压缩包请上传zip/war/rar,上传数量为10个
</div>
</template>
</file-upload>
</el-form-item>
<el-form-item style="text-align: right">
<el-button type="danger" @click="resetForm">重 置
</el-button>
<el-button type="primary" @click="operation" :loading="subLoading">提 交</el-button>
</el-form-item>
</el-form>
</el-card>
</guava>
</div>
<script>
function getQueryVariable(variable) {
let query = window.location.search.substring(1);
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return '';
}
let E = window.wangEditor
let meetingTopicRich = null
const vue = new Vue({
el: '#app',
data() {
const meetingTopicValid = (rule, value, callback) => {
if (!this.formData.meeting_topic || !dd3s.html2txt(this.formData.meeting_topic)) {
callback(new Error('请填写会议议题'));
} else {
callback();
}
};
const filesValid = (rule, value, callback) => {
if (!this.formData.files || this.formData.files.length === 0) {
callback(new Error('请上传请示附件'));
} else {
callback();
}
};
return {
jsList: [],
csOptions: [
{id: "一", name: "一次"},
{id: "二", name: "二次"},
{id: "三", name: "三次"},
{id: "四", name: "四次"},
{id: "五", name: "五次"},
{id: "六", name: "六次"},
],
subLoading: false,
sessionOptions: [],
formData: {
meeting_name: '',
have_elect: false,
unit_name: '${@shiro.getPrincipalProperty("unit").getName()}',
union_name: '${@shiro.getPrincipalProperty("union").getUnionname()}',
create_time: moment(new Date()).format("YYYY-MM-DD"),
meeting_time: '',
before_meeting_time: '',
session_num: '',
frequency: '',
official_delegate: '',
teacher_delegate: '',
attend_delegate: '',
special_delegate: '',
meeting_topic: '',
remark: '',
files: [],
type: '届中会'
},
formRules: {
meeting_name: [{required: true, message: '请填写会议标题', trigger: ['blur', 'change']}],
session_id: [{required: true, message: '请选择届次', trigger: ['blur', 'change']}],
jdhjs: [{required: true, message: '请选择届数', trigger: ['blur', 'change']}],
type: [{required: true, message: '请选择类型', trigger: ['blur', 'change']}],
have_elect: [{required: true, message: '请选择有无选举事项', trigger: ['blur', 'change']}],
unit_name: [{required: true, message: '请选择填表单位', trigger: ['blur', 'change']}],
create_time: [{required: true, message: '请选择填表日期', trigger: ['blur', 'change']}],
meeting_time: [{required: true, message: '请选择会议时间', trigger: ['blur', 'change']}],
session_num: [{required: true, message: '请选择届数', trigger: ['blur', 'change']}],
frequency: [{required: true, message: '请选择次数', trigger: ['blur', 'change']}],
official_delegate: [{required: true, message: '请填写正式代表人数', trigger: ['blur', 'change']}],
meeting_topic: [{validator: meetingTopicValid, trigger: ['blur', 'change']}],
files: [{validator: filesValid, trigger: ['blur', 'change']}],
}
}
},
components: {
'file-upload': httpVueLoader('/components/plugins/FileUpload.vue')
},
methods: {
jdhjsChange(o) {
const j = this.formData.jdhjs ? ('第' + this.formData.jdhjs + '届') : ''
const c = this.formData.jdhcs ? ('第' + this.formData.jdhcs + '次') : ''
const str = '关于召开' + this.formData.unit_name + j + c + '教职工代表大会、工会会员代表大会的请示'
this.formData.meeting_name = str
},
jdhcsChange(o) {
const j = this.formData.jdhjs ? ('第' + this.formData.jdhjs + '届') : ''
const c = this.formData.jdhcs ? ('第' + this.formData.jdhcs + '次') : ''
const str = '关于召开' + this.formData.unit_name + j + c + '教职工代表大会、工会会员代表大会的请示'
this.formData.meeting_name = str
},
resetForm() {
this.$refs["addForm"].resetFields();
meetingTopicRich.txt.html('')
meetingTopicRich.create()
},
async openEdit(id) {
const resp = await $.get(loc() + "/findOne", {id})
if(resp.code===0){
const data = resp.data
data.files = JSON.parse(data.files)
this.formData = data
this.$nextTick(() => {
meetingTopicRich = new E('#meetingTopicRich')
meetingTopicRich.config.onchange = (html) => {
this.formData.meeting_topic = html
}
setTimeout(() => {
meetingTopicRich.create()
meetingTopicRich.txt.html(data.meeting_topic)
}, 100)
})
}else{
this.notifyWarning(resp.msg)
}
},
initPage() {
this.$nextTick(() => {
meetingTopicRich = new E('#meetingTopicRich')
meetingTopicRich.config.onchange = (html) => {
this.formData.meeting_topic = html
}
setTimeout(() => {
meetingTopicRich.create()
}, 100)
})
},
async operation() {
if (!this.formData.files || this.formData.files.length === 0) {
this.$notify.warning({title: '提示', message: '请上传请示附件!'});
return
}
let method = this.formData.id ? "/doEdit" : "/doAdd"
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
/*this.subLoading = true
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});*/
this.formData.jdhallname = this.formData.jdhjs + '届'
if(this.formData.jdhcs) {
this.formData.jdhallname += this.formData.jdhcs + '次'
}
const data = clone(this.formData)
data.files = JSON.stringify(data.files)
const resp = await $.post(loc() + method, {jdhLevel2: JSON.stringify(data)})
if (resp.code === 0) {
this.$notify({
title: '成功',
message: resp.msg,
type: 'success',
duration: 1000,
onClose: () => {
sublime.jumpPagePjax('/platform/jdh/level2/reading')
}
});
}
/*requestLaterFun(resp, () => {
window.location.href = '/platform/jdh/level2/reading'
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
loading.close()
this.subLoading = false
})*/
}
});
}
},
async created() {
this.sessionOptions = await getOpenJdhByDb()
let id = getQueryVariable("id")
id ? this.openEdit(id) : this.initPage()
this.jsList = await getJc()
}
})
function getQueryVariable(variable) {
let query = window.location.search.substring(1);
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return '';
}
let E = window.wangEditor
let meetingTopicRich = null
const vue = new Vue({
el: '#app',
data() {
const meetingTopicValid = (rule, value, callback) => {
if (!this.formData.meeting_topic || !dd3s.html2txt(this.formData.meeting_topic)) {
callback(new Error('请填写会议议题'));
} else {
callback();
}
};
const filesValid = (rule, value, callback) => {
if (!this.formData.files || this.formData.files.length === 0) {
callback(new Error('请上传请示附件'));
} else {
callback();
}
};
return {
jsList: [],
csOptions: [
{id: "一", name: "一次"},
{id: "二", name: "二次"},
{id: "三", name: "三次"},
{id: "四", name: "四次"},
{id: "五", name: "五次"},
{id: "六", name: "六次"},
],
subLoading: false,
sessionOptions: [],
formData: {
meeting_name: '',
have_elect: false,
unit_name: '${@shiro.getPrincipalProperty("unit").getName()}',
union_name: '${@shiro.getPrincipalProperty("union").getUnionname()}',
create_time: moment(new Date()).format("YYYY-MM-DD"),
meeting_time: '',
before_meeting_time: '',
session_num: '',
frequency: '',
official_delegate: '',
teacher_delegate: '',
attend_delegate: '',
special_delegate: '',
meeting_topic: '',
remark: '',
files: [],
type: '届中会'
},
formRules: {
meeting_name: [{required: true, message: '请填写会议标题', trigger: ['blur', 'change']}],
session_id: [{required: true, message: '请选择届次', trigger: ['blur', 'change']}],
jdhjs: [{required: true, message: '请选择届数', trigger: ['blur', 'change']}],
type: [{required: true, message: '请选择类型', trigger: ['blur', 'change']}],
have_elect: [{required: true, message: '请选择有无选举事项', trigger: ['blur', 'change']}],
unit_name: [{required: true, message: '请选择填表单位', trigger: ['blur', 'change']}],
create_time: [{required: true, message: '请选择填表日期', trigger: ['blur', 'change']}],
meeting_time: [{required: true, message: '请选择会议时间', trigger: ['blur', 'change']}],
session_num: [{required: true, message: '请选择届数', trigger: ['blur', 'change']}],
frequency: [{required: true, message: '请选择次数', trigger: ['blur', 'change']}],
official_delegate: [{required: true, message: '请填写正式代表人数', trigger: ['blur', 'change']}],
meeting_topic: [{validator: meetingTopicValid, trigger: ['blur', 'change']}],
files: [{validator: filesValid, trigger: ['blur', 'change']}],
}
}
},
components: {
'file-upload': httpVueLoader('/components/plugins/FileUpload.vue')
},
methods: {
jdhjsChange(o) {
const j = this.formData.jdhjs ? ('第' + this.formData.jdhjs + '届') : ''
const c = this.formData.jdhcs ? ('第' + this.formData.jdhcs + '次') : ''
const str = '关于召开' + this.formData.unit_name + j + c + '教职工代表大会、工会会员代表大会的请示'
this.formData.meeting_name = str
},
jdhcsChange(o) {
const j = this.formData.jdhjs ? ('第' + this.formData.jdhjs + '届') : ''
const c = this.formData.jdhcs ? ('第' + this.formData.jdhcs + '次') : ''
const str = '关于召开' + this.formData.unit_name + j + c + '教职工代表大会、工会会员代表大会的请示'
this.formData.meeting_name = str
},
resetForm() {
this.$refs["addForm"].resetFields();
meetingTopicRich.txt.html('')
meetingTopicRich.create()
},
async openEdit(id) {
const resp = await $.get(loc() + "/findOne", {id})
if (resp.code === 0) {
const data = resp.data
data.files = JSON.parse(data.files)
this.formData = data
this.$nextTick(() => {
meetingTopicRich = new E('#meetingTopicRich')
meetingTopicRich.config.onchange = (html) => {
this.formData.meeting_topic = html
}
setTimeout(() => {
meetingTopicRich.create()
meetingTopicRich.txt.html(data.meeting_topic)
}, 100)
})
} else {
this.notifyWarning(resp.msg)
}
},
initPage() {
this.$nextTick(() => {
meetingTopicRich = new E('#meetingTopicRich')
meetingTopicRich.config.onchange = (html) => {
this.formData.meeting_topic = html
}
setTimeout(() => {
meetingTopicRich.create()
}, 100)
})
},
async operation() {
if (!this.formData.files || this.formData.files.length === 0) {
this.$notify.warning({title: '提示', message: '请上传请示附件!'});
return
}
let method = this.formData.id ? "/doEdit" : "/doAdd"
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
/*this.subLoading = true
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});*/
this.formData.jdhallname = this.formData.jdhjs + '届'
if (this.formData.jdhcs) {
this.formData.jdhallname += this.formData.jdhcs + '次'
}
const data = clone(this.formData)
data.files = JSON.stringify(data.files)
const resp = await $.post(loc() + method, {jdhLevel2: JSON.stringify(data)})
if (resp.code === 0) {
this.$notify({
title: '成功',
message: resp.msg,
type: 'success',
duration: 1000,
onClose: () => {
sublime.jumpPagePjax('/platform/jdh/level2/reading')
}
});
}
/*requestLaterFun(resp, () => {
window.location.href = '/platform/jdh/level2/reading'
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
loading.close()
this.subLoading = false
})*/
}
});
}
},
async created() {
this.sessionOptions = await getOpenJdhByDb()
let id = getQueryVariable("id")
id ? this.openEdit(id) : this.initPage()
this.jsList = await getJc()
}
})
</script>
<!--#
}
@@ -148,6 +148,9 @@ layout("/layouts/platform.html"){
<el-dropdown-item :command="{type:'view',data:scope.row}">
预览
</el-dropdown-item>
<el-dropdown-item :command="{type:'download',data:scope.row}">
下载
</el-dropdown-item>
<el-dropdown-item
v-if="(${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}) || scope.row.state == 0"
:command="{type:'edit',data:scope.row}">
@@ -217,7 +220,13 @@ layout("/layouts/platform.html"){
</template>
</el-form-item>-->
<el-form-item prop="files" label="附件上传">
<file-upload :files.sync="formData.files"></file-upload>
<file-upload :files.sync="formData.files">
<template #el-upload__tip>
<div class="el-upload__tip" slot="tip">
图片类请上传jpg/png/jpeg等格式,文档类请上传doc/docx/xls/xlsx/pdf等格式,压缩包请上传zip/war/rar,上传数量为10个
</div>
</template>
</file-upload>
</el-form-item>
</el-form>
</el-form>
@@ -266,7 +275,13 @@ layout("/layouts/platform.html"){
</el-form-item>-->
<el-form-item prop="files" label="附件上传">
<file-upload :files.sync="formData.files"></file-upload>
<file-upload :files.sync="formData.files" :max="10">
<template #el-upload__tip>
<div class="el-upload__tip" slot="tip">
图片类请上传jpg/png/jpeg等格式,文档类请上传doc/docx/xls/xlsx/pdf等格式,压缩包请上传zip/war/rar,上传数量为10个
</div>
</template>
</file-upload>
</el-form-item>
</el-form>
@@ -416,8 +431,14 @@ layout("/layouts/platform.html"){
this.openEdit(data)
} else if (type == 'delete') {
this.doDelete(data.id)
}else if (type == 'download') {
this.doDownload(data.id)
}
},
doDownload(id){
window.location.href = "/platform/jdh2/gzzlgl/doDownload?id=" + id
},
handleChange: function (file, filelist) {
this.fileList = filelist;
},
@@ -454,7 +475,7 @@ layout("/layouts/platform.html"){
const formData = clone(this.formData)
formData.files = JSON.stringify(formData.files)
const resp = await $.post('/platform/jdh2/gzzlgl/doEdit', formData)
if (resp.code===0){
if (resp.code === 0) {
this.editDialogVisible = false
this.doSearch()
}
@@ -518,7 +539,7 @@ layout("/layouts/platform.html"){
formData.files = JSON.stringify(formData.files)
const resp = await $.post('/platform/jdh2/gzzlgl/doAdd', formData)
if (resp.code===0){
if (resp.code === 0) {
this.addDialogVisible = false
this.doSearch()
loading.close()