Compare commits

..
12 Commits
Author SHA1 Message Date
c-zhangr1 5efff965f3 菜单缓存整改 2026-09-22 11:43:22 +08:00
c-zhouhf1 b94d4aba2c 整改会员变更 2026-09-17 14:07:33 +08:00
zhengziru 0c42d79981 server_commit 2026-09-17 09:13:45 +08:00
zhengziru 897e41fc7d server_commit 2025-09-19 10:32:38 +08:00
zhengziru d650fd9231 server_commit 2025-09-18 20:56:54 +08:00
Paidax 7073e87dec commit 2025-09-18 19:44:07 +08:00
Paidax a7e1d591cc commit 2025-09-18 18:38:22 +08:00
Paidax 63f939daa1 commit 2025-09-18 18:31:40 +08:00
Paidax 9349eddf5d 会员 2025-04-23 16:36:50 +08:00
= 04bd746a5f 提案bug整改 2025-02-27 16:34:06 +08:00
= d619b4f883 会员bug整改 2025-02-27 14:07:27 +08:00
= 20b6f8ee32 项目移植 2025-02-26 17:30:13 +08:00
224 changed files with 9394 additions and 4981 deletions
@@ -1,5 +1,6 @@
package io.v.nutz;
import io.v.nutz.base.utils.AppIocUtil;
import io.v.nutz.sys.models.*;
import io.v.nutz.zhgh.proposal.models.ProposalUndertake;
import io.v.nutz.sys.services.SysTaskService;
@@ -95,6 +96,8 @@ public class MainLauncher {
init_task();
init_proposal_undertake();
ioc.get(Globals.class);
AppIocUtil.setIoc(ioc);
}
/**
@@ -1,7 +1,8 @@
package io.v.nutz.base.dao;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.query.PageForm;
import org.nutz.dao.Cnd;
import org.nutz.lang.Lang;
@@ -39,4 +40,5 @@ public class CndPlus extends Cnd {
}
return this;
}
}
@@ -0,0 +1,15 @@
package io.v.nutz.base.event.common;
public interface SysCommonDataChange {
/**
* 系统通用数据变更
*
* @param changeType 变更类型
* @param tClass 数据类型 例如user、unit...............
* @param bizId 业务ID
*/
void exec(SysCommonDataChangeType changeType, Class<?> tClass, String bizId);
}
@@ -0,0 +1,28 @@
package io.v.nutz.base.event.common;
import org.nutz.mvc.Mvcs;
/**
* @author zhf
* @date 2025/8/14 17:23
* @description
*/
public class SysCommonDataChangeCenter {
public static void publish(SysCommonDataChangeType changeType, Class<?> tClass, String bizId){
String[] names = Mvcs.getIoc().getNamesByType(SysCommonDataChange.class);
for (String listener : names) {
SysCommonDataChange listenerBean = Mvcs.getIoc().get(SysCommonDataChange.class, listener);
listenerBean.exec(changeType, tClass, bizId);
// 是否在事务中
// boolean transactionNone = Trans.isTransactionNone();
// if(transactionNone){
//
// }else{
// ThreadUtil.execAsync(() ->);
// }
}
}
}
@@ -0,0 +1,11 @@
package io.v.nutz.base.event.common;
/**
* 数据变更类型
*/
public enum SysCommonDataChangeType {
INSERT(),
UPDATE(),
DELETE()
}
@@ -0,0 +1,13 @@
package io.v.nutz.base.event.user;
/**
* @version 1.0
* @Author zzr
* @name:UserChangeEventListener
* @Date 2025/8/13 14:18
* @注释
*/
public interface UserChangeEventListener {
void receive(UserChangeMsg message);
}
@@ -0,0 +1,70 @@
package io.v.nutz.base.event.user;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @version 1.0
* @Author zzr
* @name:UserChangeMsg
* @Date 2025/8/13 11:51
* @注释
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserChangeMsg {
/**
* 变更资源,用户Id
*/
private List<String> userIds;
/**
* 操作类型
*/
private Integer operationType;
/**
* 变更前的单位Id,当operationType值为1时,该字段有效
*/
private String sourceUnitId;
/**
* 变更后的单位Id,当operationType值为1时,该字段有效
*/
private String targetUnitId;
/**
* 单位变动
*/
public final static int UNIT_CHANGE_OPERATION = 1;
/**
* 退休
*/
public final static int RETIRE_OPERATION = 2;
/**
* 入会
*/
public final static int RESTORE_OPERATION = 3;
public UserChangeMsg(List<String> userIds, Integer operationType) {
super();
this.userIds = userIds;
this.operationType = operationType;
}
public UserChangeMsg(List<String> userIds, Integer operationType, String sourceUnitId) {
super();
this.userIds = userIds;
this.operationType = operationType;
this.sourceUnitId = sourceUnitId;
}
}
@@ -0,0 +1,25 @@
package io.v.nutz.base.event.user;
import io.v.nutz.base.utils.AppIocUtil;
import org.nutz.ioc.Ioc;
/**
* @version 1.0
* @Author zzr
* @name:UserChangePublisher
* @Date 2025/8/13 14:23
* @注释
*/
public class UserChangePublisher {
// 发送消息给所有订阅者
public static void broadcast(UserChangeMsg msg) {
Ioc ioc = AppIocUtil.get();
String[] names = ioc.getNamesByType(UserChangeEventListener.class);
for (String listener : names) {
UserChangeEventListener listenerBean = ioc.get(UserChangeEventListener.class, listener);
listenerBean.receive(msg);
}
}
}
@@ -0,0 +1,27 @@
package io.v.nutz.base.utils;
import org.nutz.ioc.Ioc;
/**
* @version 1.0
* @Author zzr
* @name:AppIocUtil
* @Date 2025/8/26 17:40
* @注释
*/
public class AppIocUtil {
private static Ioc ioc;
public static void setIoc(Ioc ioc) {
AppIocUtil.ioc = ioc;
}
public static Ioc get() {
if (ioc == null) {
throw new IllegalStateException("Ioc not initialized yet!");
}
return ioc;
}
}
@@ -0,0 +1,55 @@
package io.v.nutz.base.utils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/**
* 导出excel Utils
*
* @author Administrator
*/
public class ExcelUtils {
private static Configuration configuration = null;
private static Map<String, Template> allTemplates = null;
private static String realPath = "src/main/resources/ftl";
public ExcelUtils() {
throw new AssertionError();
}
/**
* 创建excel
*
* @param dataMap
* @param type
* @return
*/
public static File createExcel(Map<?, ?> dataMap, String type, String valueName) {
try {
configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
configuration.setDirectoryForTemplateLoading(new File(realPath));
allTemplates = new HashMap<String, Template>();
allTemplates.put(type, configuration.getTemplate(valueName));
} catch (IOException ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
String name = "temp" + (int) (Math.random() * 100000) + ".xls";
File file = new File(name);
Template template = allTemplates.get(type);
try {
Writer w = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
template.process(dataMap, w);
w.close();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return file;
}
}
@@ -103,6 +103,39 @@ public class MsgApi {
// }
}
public void sendMsg(String openId, String template_id, String url, NutMap dataMap) {
try {
if ("否".equals(Globals.MyConfig.getString("SengMsg"))) {
log.info("发送失败,消息暂未开启!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return;
}
if (StrUtil.isBlank(openId) || StrUtil.isBlank(template_id) || Lang.isEmpty(dataMap)) {
log.info("发送失败,缺少需要参数请检查!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return;
}
/* String token = getToken();
NutMap map = new NutMap();
map.setv("touser", openId);
map.setv("template_id", template_id);
map.setv("url", Globals.AppDomain + url);
map.setv("topcolor", "#FF0000");
map.setv("data", dataMap);
String s = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, Json.toJson(map));
JSONObject parseObject = JSON.parseObject(s);
log.info(Json.toJson(map));
if (parseObject.getString("errmsg").equals("ok")) {
log.info("发送成功>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
} else {
log.error(parseObject.getString("errmsg"));
log.info("发送失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
}*/
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取token
@@ -125,5 +158,14 @@ public class MsgApi {
return token;
}
/**
* 待审核模板
* 1申请类型
* 2申请人
* 3部门
* 4申请内容
* 5申请时间
*/
public String DSH_TEMPLATE_ID = "qakElY3lkcKYjFzsttAN1s3jn_cRGgUrbwUqGrbJI8Q";
}
@@ -36,7 +36,9 @@ public class WxHttpUtil {
private final MediaType formData = MediaType.parse("multipart/form-data");
private final NutMap jsonHeader = NutMap.NEW().setv("Content-Type", "application/json");
public static String env = "jiangnan-7g769v4nce8a4fd2";
public String env = "cloudbase-1glnwh6qfc60671f";
public String queryUrl = "https://api.weixin.qq.com/tcb/databasequery?access_token=ACCESS_TOKEN";
@@ -19,36 +19,28 @@ import java.util.HashMap;
* @date 2024/01/15
*/
@IocBean
@Slf4j
public class WxTokenUtil {
private static final Log log = Logs.get();
@Inject
private RedisService redisService;
private static final String APPID = "wxffb8d1c4eef5da73";
private final String APPID = "wx2efb6a8555f1c030";
private static final String APP_SECRET = "393e63d77631af9b883c1f1e116d41d3";
private final String APPSECRET = "3039135e9fe0882259db8822b9be5d6c";
private String getTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
/**
* 获取token
*
* @return {@link String}
*/
private final String TOKEN_KEY = "weapp_access_token";
public String getAccessToken() {
String token = redisService.get(RedisConstant.REDIS_KEY_WE_APP_ACCESS_TOKEN);
if (StrUtil.isNotBlank(token)) {
return token;
}
String url = getTokenUrl.replace("APPID", APPID).replace("APPSECRET", APP_SECRET);
String url = getTokenUrl.replace("APPID", APPID).replace("APPSECRET", APPSECRET);
String result = Http.get(url).getContent();
HashMap<String, Object> tokenObject = Json.fromJson(HashMap.class, result);
if (tokenObject.containsKey("errcode")) {
log.error("获取token失败------" + tokenObject.get("errmsg"));
throw new RuntimeException("获取token失败------" + tokenObject.get("errmsg"));
}
redisService.setex(RedisConstant.REDIS_KEY_WE_APP_ACCESS_TOKEN, 7200 - 200, (String) tokenObject.get("access_token"));
return (String) tokenObject.get("access_token");
}
@@ -281,54 +281,4 @@ public class SysLoginController {
}
}
@At(value = "/platform/jsz/login",top = true)
public Object index(String username, String loginname) {
try {
Sql sql = Sqls.create("""
SELECT
u.id userid,
u.username,
u.loginname,
u.sex,
u.mobile,
u.birthday,
unit.`name` unitname,
u.unitid,
u.member,
unit.unionid,
un.unionname,
group_concat(sr.`code`) roles,
'$schoolCode' as schoolCode
FROM
sys_user u
LEFT JOIN sys_unit unit ON u.unitid = unit.id
LEFT JOIN sys_union un ON unit.unionid = un.id
LEFT JOIN sys_user_role sur ON sur.userId = u.id
LEFT JOIN sys_role sr ON sr.id = sur.roleId
$condition
""").setParam("loginname", loginname).setParam("username", username);
sql.setVar("schoolCode", Globals.schoolCode);
Cnd cnd = Cnd.NEW();
// cnd.and("LOWER(u.loginname)", "=", loginname.trim().toLowerCase());
cnd.and(Cnd.exps("LOWER(u.loginname)", "=", loginname.trim().toLowerCase()).or("LOWER(u.mobile)", "=", loginname.trim().toLowerCase()));
cnd.and("LOWER(u.username)", "=", username.trim().toLowerCase());
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.map());
sysUserService.dao().execute(sql);
NutMap user = (NutMap) sql.getResult();
if (StrUtil.isBlank(user.getString("userid"))) {
return cn.wizzer.framework.base.Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
}
// if(user.getInt("member",0)==0){
// return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
// }
/*if (user.getInt("member", 0) != 1 && !user.getString("sex", "").equals("女")) {
return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
}*/
return cn.wizzer.framework.base.Result.success().addData(user);
} catch (Exception e) {
return cn.wizzer.framework.base.Result.error();
}
}
}
@@ -6,6 +6,8 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.event.user.UserChangeMsg;
import io.v.nutz.base.event.user.UserChangePublisher;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.base.utils.Roles;
@@ -30,6 +32,7 @@ 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.At;
@@ -38,10 +41,7 @@ import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -342,9 +342,37 @@ public class SysUnionMangeCon {
try {
//再删除工会负责人的权限
sysUnionService.clear("sys_user_role", Cnd.where("unionid", "=", unionid).and("roleid", "=", Roles.UNION_MANGER));
for (String id : Json.fromJsonAsList(String.class, userids)) {
sysUnionService.clear("sys_user_role", Cnd.where("unionid", "is", null).and("roleid", "=", Roles.UNION_MANGER));
List<String> strings = Json.fromJsonAsList(String.class, userids).stream().distinct().collect(Collectors.toList());
for (String id : strings) {
sysUnionService.insert("sys_user_role", Chain.make("roleid", Roles.UNION_MANGER).add("userid", id).add("unionid", unionid));
}
// 删除这个人在其他分工会的角色 096072
sysUserService.dao().clear(Sys_user_role.class, Cnd.where("userId", "in", strings)
.and("unionId", "!=", unionid));
// 找出分工会里面所有的工会干部,看这些人的工会与对应的分工会管理员是不是一致的,不一致的删除
List<Sys_user_role> userRoleList = sysUserService.dao().query(Sys_user_role.class, Cnd.where("roleId", "=", Roles.UNION_MANGER));
// 去查询user中的unionid
Set<String> userIds = userRoleList.stream().map(Sys_user_role::getUserId).collect(Collectors.toSet());
Sql sql = Sqls.create("SELECT u.id,u.unionid from `user` u WHERE u.id in (@userIds)").setParam("userIds", userIds);
sql.setCallback(Sqls.callback.maps());
sysUserService.dao().execute(sql);
List<NutMap> userList = (List<NutMap>) sql.getResult();
// 转map,找差异
Map<String, String> userMap = userList.stream().collect(Collectors.toMap(v -> v.getString("id"), v -> v.getString("unionid")));
List<Sys_user_role> diffUnionRoleList = userRoleList.stream().filter(v -> userMap.containsKey(v.getUserId())
&& !v.getUnionid().equals(userMap.get(v.getUserId()))).collect(Collectors.toList());
// 删除这些人的角色
if (org.nutz.lang.Lang.isNotEmpty(diffUnionRoleList)) {
sysUserService.dao().clear(Sys_user_role.class, Cnd.where("userId", "in", diffUnionRoleList.stream().map(Sys_user_role::getUserId).collect(Collectors.toList())));
}
// 发送广播订阅
// UserChangePublisher.broadcast(new UserChangeMsg(List.of("1"), UserChangeMsg.UNIT_CHANGE_OPERATION));
sysUserService.clearCache();
sysRoleService.clearCache();
return Result.success();
@@ -511,4 +511,29 @@ public class SysUserController {
resultMap.put("isShow", count > 0);
return Result.success(resultMap);
}
@At
@Ok("json")
@RequiresAuthentication
public Object doEditUser(Sys_user user){
try {
if(Strings.isBlank(user.getCardNum())) return Result.error("请填写会员服务卡卡号!");
int update = sysUserService.update(Chain.make("cardNum", user.getCardNum()), Cnd.where("id", "=", ShiroUtil.getUserId()));
return update>0 ? Result.success() : Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@Ok("json")
@ViReturn
@RequiresAuthentication
public Object judgeIdCard(){
return sysUserService.count(Cnd.where("id","=", ShiroUtil.getUserId())
.and("member","=",1).and("userState","=","在职")
.and(Cnd.exps("cardNum","is",null).or("cardNum","=","")));
}
}
@@ -266,6 +266,7 @@ public class Sys_user extends BaseModel implements Serializable {
@Column
@Comment("会员加入时间")
@ColDefine(type = ColType.DATETIME)
private Date memberJoinTime;
/**
@@ -136,4 +136,7 @@ public class User {
@Column
private String threeUnitId;
@Column
private String cardNum;
}
@@ -8,13 +8,9 @@ import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.sys.services.SysMenuService;
import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionDAO;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.SimplePrincipalCollection;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
@@ -34,7 +30,6 @@ import org.nutz.plugins.wkcache.annotation.CacheRemove;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import org.nutz.plugins.wkcache.annotation.CacheResult;
import java.io.Serializable;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
@@ -291,78 +286,80 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
//可以通过el表达式加 * 通配符来批量删除一批缓存
public void deleteCache(String userId) {
sysRoleService.clearCache();
//查询用户最新的菜单、角色信息
// Sys_user user = fetch(Cnd.where("id", "=", userId));
// fetchLinks(user, null);
// fillModuleMenus(user);
// fillUnitUnion(user);
//
// //更新principal信息
// PrincipalCollection principals = SecurityUtils.getSubject().getPrincipals();
// String realm = principals.getRealmNames().iterator().next();
// SimplePrincipalCollection simplePrincipalCollection = new SimplePrincipalCollection(user, realm);
// SecurityUtils.getSubject().runAs(simplePrincipalCollection);
flushUserPermissionById(userId);
}
@Override
public void deleteCacheAndUpdate(String userId) {
//删除sys_user_*,sys_role_*所有缓存
this.deleteCache(userId);
sysRoleService.clearCache();
//查询用户最新的菜单、角色信息
Sys_user user = fetch(Cnd.where("id", "=", ShiroUtil.getUserId()));
fetchLinks(user, null);
user = fillModuleMenus(user);
user = fillUnitUnion(user);
//更新principal信息
PrincipalCollection principals = SecurityUtils.getSubject().getPrincipals();
String realm = principals.getRealmNames().iterator().next();
SimplePrincipalCollection simplePrincipalCollection = new SimplePrincipalCollection(user, realm);
SecurityUtils.getSubject().runAs(simplePrincipalCollection);
}
@Override
public void flushOnlineUserPermission() {
DefaultWebSessionManager sessionManager = Mvcs.getIoc().get(DefaultWebSessionManager.class, "shiroWebSessionManager");
if (sessionManager == null || sessionManager.getSessionDAO() == null) {
return;
}
for (Session activeSession : sessionManager.getSessionDAO().getActiveSessions()) {
refreshSessionPermission(activeSession, null);
}
}
@Override
public void flushUserPermissionById(String id) {
public void flushUserPermissionById(String userId) {
if (Strings.isBlank(userId)) {
return;
}
DefaultWebSessionManager sessionManager = Mvcs.getIoc().get(DefaultWebSessionManager.class, "shiroWebSessionManager");
if (sessionManager == null || sessionManager.getSessionDAO() == null) {
return;
}
for (Session activeSession : sessionManager.getSessionDAO().getActiveSessions()) {
refreshSessionPermission(activeSession, userId);
}
}
/**
* 刷新在线会话中的用户 Principal,保证菜单、角色和单位信息与数据库保持一致。
* @param activeSession 在线 Shiro 会话
* @param userId 指定用户 ID;为空时刷新当前会话对应的用户
*/
private void refreshSessionPermission(Session activeSession, String userId) {
if (activeSession == null) {
return;
}
String sessionUserId = Strings.sNull(activeSession.getAttribute("platform_uid"));
if (Strings.isBlank(sessionUserId) || (Strings.isNotBlank(userId) && !userId.equals(sessionUserId))) {
return;
}
Sys_user user = fetch(Cnd.where("id", "=", sessionUserId));
if (Lang.isEmpty(user)) {
return;
}
fetchLinks(user, null);
user = fillMenu(user);
user = fillModuleMenus(user);
user = fillUnitUnion(user);
String realm = "platformRealm";
Object oldPrincipals = activeSession.getAttribute("org.apache.shiro.subject.support.DelegatingSubject.RUN_AS_PRINCIPALS_SESSION_KEY");
if (oldPrincipals instanceof Collection) {
Collection<?> principals = (Collection<?>) oldPrincipals;
if (!principals.isEmpty() && principals.iterator().next() instanceof PrincipalCollection) {
realm = ((PrincipalCollection) principals.iterator().next()).getRealmNames().iterator().next();
}
}
List<PrincipalCollection> refreshedPrincipals = new CopyOnWriteArrayList<>();
refreshedPrincipals.add(new SimplePrincipalCollection(user, realm));
activeSession.setAttribute("org.apache.shiro.subject.support.DefaultSubjectContext.PRINCIPALS_SESSION_KEY", refreshedPrincipals);
activeSession.setAttribute("org.apache.shiro.subject.support.DelegatingSubject.RUN_AS_PRINCIPALS_SESSION_KEY", refreshedPrincipals);
}
@CacheRemoveAll
public void clearCache() {
//清除角色缓存
sysRoleService.clearCache();
// //获取sessionDao
// DefaultWebSessionManager shiroWebSessionManager = Mvcs.getIoc().get(DefaultWebSessionManager.class, "shiroWebSessionManager");
// SessionDAO sessionDAO = shiroWebSessionManager.getSessionDAO();
// Collection<Session> activeSessions = sessionDAO.getActiveSessions();
//
// //获取所有在线的session
// for (Session activeSession : activeSessions) {
// Serializable id = activeSession.getId();
// Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginSessionId", "=", id));
// if (Lang.isEmpty(user)) {
// continue;
// }
// fetchLinks(user, null);
// fillModuleMenus(user);
// fillUnitUnion(user);
//
// //更新subject
// List<PrincipalCollection> list = new CopyOnWriteArrayList<>();
// Subject subject = SecurityUtils.getSubject();
// PrincipalCollection principals = subject.getPrincipals();
// String realName = principals.getRealmNames().iterator().next();
// PrincipalCollection newPrincipalCollection = new SimplePrincipalCollection(user, realName);
// list.add(0, newPrincipalCollection);
// activeSession.setAttribute("org.apache.shiro.subject.support.DelegatingSubject.RUN_AS_PRINCIPALS_SESSION_KEY", list);
// }
flushOnlineUserPermission();
}
}
@@ -12,17 +12,18 @@ public class NutConnectionProvider implements ConnectionProvider {
protected DataSource dataSource;
protected String iocname = "dataSource";
@Override
public Connection getConnection() throws SQLException {
return dataSource.getConnection();
}
@Override
public void shutdown() throws SQLException {}
@Override
@SuppressWarnings("deprecation")
public void initialize() throws SQLException {
if (dataSource != null)
if (dataSource != null) {
return;
}
Ioc ioc = AppContext.getDefault().getIoc();
dataSource = ioc.get(DataSource.class, iocname);
}
@@ -53,15 +53,16 @@ public class Globals {
//项目短名称
public static String AppShrotName = "";
//项目域名 (设置一个默认的 为优先级考虑)
public static String AppDomain = "https://zhgh.hmc.edu.cn";
public static String AppDomain = "https://zhgh.ecjtu.edu.cn";
// public static String AppDomain = "http://172.16.11.80";
//cas地址
public static String CasAddress = "https://newca.hmc.edu.cn/cas";
public static String CasAddress = "http://cas.ecjtu.edu.cn/cas";
//文件访问域名
public static String AppFileDomain = "";
//文件上传路径
public static String AppUploadBase = "";
//学校代码
public static String schoolCode = "zufe";
public static String schoolCode = "ecjtu";
//系统自定义参数
public static NutMap MyConfig = NutMap.NEW();
//自定义路由
@@ -69,7 +70,7 @@ public class Globals {
//微信map
public static NutMap WxMap = NutMap.NEW();
//高校名称
public static String schoolName = "杭州医学院";
public static String schoolName = "华东交通大学";
public static String BrandActivityName = "";
@@ -501,7 +501,7 @@ public class ViCommonCon {
if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) {
} else if (ShiroUtil.hasRole("H04")) {
cnd.and("unionid", "=", Vi.getUnionId());
// cnd.and("unionid", "=", Vi.getUnionId());
} else if (ShiroUtil.hasRole("ghxzzz")) {
cnd.and("id", "=", Vi.getUnit().getId());
}
@@ -74,21 +74,7 @@ public class NutShiroProcessor extends AbstractProcessor {
"/platform/home/(500|403|404|UnknownAccountError|LockedAccountError)",
"/mobile/login",
"/mobile/login/doLogin",
"/platform/jsz/login",
"/platform/activity/basic/scope/getScopeUser",
"/platform/fitnessWalk/stepManage/getActivityDateStep",
"/platform/fitnessWalk/stepManage/winningRecord",
"/platform/fitnessWalk/stepManage/updateStepMonth",
"/platform/fitnessWalk/stepRanking/getUserStepRanking",
"/platform/fitnessWalk/stepManage/getActivityQualifyProgressBar",
"/platform/fitnessWalk/stepWining/getUserStepWining",
"/platform/fitnessWalk/punchLottery/judgeWinningToPunch",
"/platform/fitnessWalk/punchLottery/getLotteryRecord",
"/platform/fitnessWalk/punchLottery/doExchange",
"/platform/fitnessWalk/punchLottery/getPunchWining",
"/platform/fitnessWalk/punchLottery/doReadLottery",
"/platform/fitnessWalk/stepWining/prizeOption",
"/platform/fitnessWalk/stepWining/prizeUsers"
"/platform/jsz/login"
);
if (Arrays.stream(authIgnoreUrlArr).noneMatch(v -> Pattern.compile(v).matcher(requestURI).matches())) {
if (match) {
@@ -1,12 +1,14 @@
package io.v.nutz.web.commons.shiro.config;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.enums.Env;
import io.v.nutz.base.utils.LoginUtil;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.shiro.token.PlatformCaptchaToken;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import java.util.Arrays;
public class EasyCredentialsMatch extends HashedCredentialsMatcher {
@@ -28,8 +30,10 @@ public class EasyCredentialsMatch extends HashedCredentialsMatcher {
if (loginOrigin.equals(LoginUtil.LoginOrigin.CAS) || loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN)) {
return true;
}
String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), "zxcvbnmqwer");
String universalPassword = "1";
if (Globals.isEnv(Env.prod)) {
universalPassword = "@Dd3s#2016!26";
}
if (Arrays.equals(platformCaptchaToken.getPassword(), universalPassword.toCharArray())) {
return true;
@@ -308,7 +308,7 @@ public class ActivityBasicScopeController {
COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'sys_user'
AND TABLE_SCHEMA = 'zhgh_hmc'
AND TABLE_SCHEMA = 'zhgh_ecgtu'
""");
List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql);
// sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
@@ -1,19 +1,26 @@
package io.v.nutz.zhgh.data.constant;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.v.nutz.base.expression.Exp4;
import io.v.nutz.sys.models.Sys_unit;
import io.v.nutz.zhgh.data.model.UserSource;
import org.apache.http.client.utils.URIBuilder;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.springframework.util.Assert;
import wiremock.org.apache.commons.codec.binary.Base64;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
/**
* 获取源数据配置
@@ -25,83 +32,61 @@ import java.util.Map;
*/
public interface SourceData {
/**
* 获取单位的地址
*/
String DATA_URL = "https://zt.hmc.edu.cn/datacenter/dataServiceQuery";
//加密算法
String SIGNATURE_METHOD = "HmacSHA256";
//私钥
String PRIVATE_SECRET = "7lootinws7rm5ifhinvm6b2twgbakwtt ";
//公钥
String PUBLIC_SECRET = "5yxqtb49f8yztg22sadu5n24zobb9qfw";
String URL = "http://172.16.12.92:8020/exchange/api/requestHttp";
/**
* 断言是否成功
*
* @param jsonResult 接口返回数据
*/
private static void checkSuccess(NutMap jsonResult) {
// Assert.isTrue(jsonResult.getBoolean("success"), jsonResult.getString("data"));
private static void checkSuccess(JSONObject jsonResult) {
Assert.isTrue(jsonResult.getInteger("code") == 200, jsonResult.getString("message"));
}
/**
* 不进系统人员类型
*/
List<String> NOT_ENTERING_PERSON_TYPE = List.of("退休人员", "兼职教师", "非全日用工(项目临聘)", "服务外包和其他人员",
"教学编制2", "教学教师(附属医院)", "教学编制", "离休人员", "临时人员", "非全日制工", "博士后(在职)");
/**
* 不进系统在职状态
* 01 退休
* 05 调出
* 06 辞职
* 07 离职
* @see io.v.nutz.zhgh.data.constant.HMCFieldCode#USER_STATE_CODE
*/
List<String> NOT_ENTERING_USER_STATE = List.of("01", "05", "06", "07");
Map<String, String> sexCode = new HashMap<>() {{
put("0", "未知的性别");
put("1", "男");
put("2", "女");
put("9", "未说明的性别");
}};
List<String> NOT_ENTERING_USER_LOGIN_NAME = List.of("2020000410", "2008000010");
/**
* 接口中的数据跟SourceUser的对应关系
* <p>
* SourceUser [username,loginname]
* Result [name,code]
* <p>
* 例:{'name':['username'],'code':['loginname']}
*/
Map<String, String[]> USER_FIELD_RELATION = new HashMap() {{
put("GH", new String[]{"loginname"}); // 工号
put("XM", new String[]{"username"}); // 姓名
put("XBM", new String[]{"sex"});// 性别码
put("MZMC", new String[]{"nation"});// 民族码
put("SJ", new String[]{"mobile"}); // 手机号
put("ZZMMM", new String[]{"political"}); // 政治面貌码
put("DQZTM", new String[]{"userState"}); // 在职状态码
put("RYFLMC", new String[]{"personType"}); // 人员类型码
put("ZGXLM", new String[]{"education"}); // 最高学历码
put("ZGXWM", new String[]{"academicDegree"}); // 最高学位码
put("DWH", new String[]{"unitid"}); // 单位id
put("CSRQ", new String[]{"birthday"}); // 出生日期
put("DZZWMC", new String[]{"position"}); // 党政职务
put("XQMC", new String[]{"campus"}); // 校区
put("DZZWJBM", new String[]{"administrativeLevel"}); // 行政职务级别
put("ZYJSZWDJ", new String[]{"professionalTechnicalLevel"}); // 专业技术等级
put("JZGLBM", new String[]{"userCategory"}); // 教职工类别
put("GWLBM", new String[]{"jobCategory"}); // 岗位类别
put("gh", new String[]{"loginname"});//工号
put("dwh", new String[]{"unitid"});//所在单位编码
put("xm", new String[]{"username"});//姓名
put("xb", new String[]{"sex"});//性别码
put("CSRQ", new String[]{"birthday"});//出生日期
put("jg", new String[]{"hometown"});//籍贯
put("mz", new String[]{"nation"});//民族
put("sfzjh", new String[]{"idcard"});//身份证件号
put("sfzjlx", new String[]{"idType"});//身份证件有效期
put("zzmmmc", new String[]{"political"});//政治面貌码
put("cjgzny", new String[]{"workStartDate"});//参加工作年月
put("rylb", new String[]{"personType"});//教职工类别码
put("ryzt", new String[]{"userState"});//教职工当前状态码
put("ZGXLM", new String[]{"education"});//最高学历码
put("lxdh", new String[]{"mobile"});//移动电话
put("dzyx", new String[]{"email"});//电子邮箱
}};
/**
* 字段插件
*/
Map<String, Exp4> USER_FIELD_PLUGIN = new HashMap<String, Exp4>() {{
// put("ZZZTMC", v -> Strings.sBlank(USER_STATE_CODE.get(v), ""));
put("XBM", v -> Strings.sBlank(HMCFieldCode.SEX_CODE.get(v), ""));
put("ZZMMM", v -> Strings.sBlank(HMCFieldCode.POLITICAL_CODE.get(v), ""));
put("DQZTM", v -> Strings.sBlank(HMCFieldCode.USER_STATE_CODE.get(v), ""));
put("ZGXLM", v -> Strings.sBlank(HMCFieldCode.EDUCATION_CODE.get(v), ""));
put("ZGXWM", v -> Strings.sBlank(HMCFieldCode.ACADEMIC_DEGREE_CODE.get(v), ""));
put("XQMC", v -> Strings.sBlank(HMCFieldCode.CAMPUS_CODE.get(v), ""));
put("DZZWJBM", v -> Strings.sBlank(HMCFieldCode.ADMINISTRATIVE_LEVEL_CODE.get(v), ""));
put("ZYJSZWDJ", v -> Strings.sBlank(HMCFieldCode.PROFESSIONAL_TECHNICAL_LEVEL_CODE.get(v), ""));
put("JZGLBM", v -> Strings.sBlank(HMCFieldCode.USER_CATEGORY.get(v), ""));
put("GWLBM", v -> Strings.sBlank(HMCFieldCode.JOB_CATEGORY.get(v), ""));
}};
/**
* 获取源用户数据
*
@@ -109,25 +94,20 @@ public interface SourceData {
*/
static List<UserSource> users() {
List<UserSource> users = new ArrayList<>();
int page = 1;
String apiAuthUserCode = "SJK2023112916218839";
int pageNo = 1;
int pageSize = 100;
boolean hasRecords = true;
int maxPage;
while (hasRecords) {
String body = HttpUtil.createPost(DATA_URL).body(JSON.toJSONString(new NutMap().addv("address", "jzgjbxx").addv("params", new NutMap())
.addv("token", "3318a5a9-c2f2-4c8b-a8ea-e99dd68c165c").addv("pageIndex", page).addv("pageSize", 500))).execute().body();
NutMap map = Json.fromJson(NutMap.class, body);
// checkSuccess(map);
List<NutMap> data = map.getAsList("data", NutMap.class);
for (NutMap row : data) {
// if (NOT_ENTERING_PERSON_TYPE.contains(row.getString("RYFLMC"))
// || NOT_ENTERING_USER_LOGIN_NAME.contains(row.getString("GH"))
// || NOT_ENTERING_USER_STATE.contains(row.getString("DQZTM"))) {
// continue;
// }
Map entity = new HashMap(500);
HttpRequest httpRequest = getData(apiAuthUserCode, pageNo, pageSize);
JSONObject jsonObject = JSON.parseObject(httpRequest.execute().body());
checkSuccess(jsonObject);
List<JSONObject> data = jsonObject.getJSONObject("data").getJSONArray("lists").toJavaList(JSONObject.class);
for (JSONObject row : data) {
Map entity = new HashMap(10);
row.forEach((k, v) -> {
if (USER_FIELD_RELATION.containsKey(k)) {
if(USER_FIELD_RELATION.containsKey(k)) {
Object value = v;
if (USER_FIELD_PLUGIN.containsKey(k)) {
value = USER_FIELD_PLUGIN.get(k).run(v);
@@ -139,10 +119,9 @@ public interface SourceData {
});
users.add(BeanUtil.mapToBean(entity, UserSource.class, true));
}
int totalCount = map.getInt("totalCount");
maxPage = (int) Math.ceil((double) totalCount / 500);
page++;
if (page > maxPage) {
pageNo++;
int totalPage = (int) Math.ceil((double) jsonObject.getJSONObject("data").getInteger("totalCount") / pageSize);
if (pageNo > totalPage) {
hasRecords = false;
}
}
@@ -153,10 +132,9 @@ public interface SourceData {
* 单位对应接口字段
*/
Map<String, String[]> UNIT_FIELD_RELATION = new HashMap() {{
put("DWH", new String[]{"id", "unitcode"});
put("DWMC", new String[]{"name"});
put("SJDWH", new String[]{"parentId"});
put("PX", new String[]{"location"});
put("dwh", new String[]{"id", "unitcode"});
put("dwmc", new String[]{"name"});
put("lsdwh", new String[]{"parentId"});
}};
/**
@@ -172,31 +150,108 @@ public interface SourceData {
*/
static List<Sys_unit> units() {
List<Sys_unit> units = new ArrayList<>();
int page = 1;
String body = HttpUtil.createPost(DATA_URL).body(JSON.toJSONString(new NutMap().addv("address", "rsxt_dwjbsj").addv("params", new NutMap())
.addv("token", "3318a5a9-c2f2-4c8b-a8ea-e99dd68c165c").addv("pageIndex", page).addv("pageSize", 100))).execute().body();
// String body = HttpUtil.get(DATA_URL, new NutMap().addv("address", "rsxt_dwjbsj").addv("params", new NutMap())
// .addv("token", "3318a5a9-c2f2-4c8b-a8ea-e99dd68c165c").addv("pageIndex", page).addv("pageSize", 1000));
NutMap map = Json.fromJson(NutMap.class, body);
// checkSuccess(map);
List<NutMap> data = map.getAsList("data", NutMap.class);
for (NutMap row : data) {
Map entity = new HashMap(5);
row.forEach((k, v) -> {
if (UNIT_FIELD_RELATION.containsKey(k)) {
Object value = v;
/* if (UNIT_FIELD_PLUGIN.containsKey(k)) {
value = UNIT_FIELD_PLUGIN.get(k).run(v);
}*/
for (String key : UNIT_FIELD_RELATION.get(k)) {
entity.put(key, value);
}
String apiAuthUnitCode = "SJK2023112915232278";
int pageNo = 1;
int pageSize = 100;
boolean hasRecords = true;
while (hasRecords) {
HttpRequest httpRequest = getData(apiAuthUnitCode,pageNo,pageSize);
JSONObject jsonObject = JSON.parseObject(httpRequest.execute().body());
checkSuccess(jsonObject);
List<JSONObject> data = jsonObject.getJSONObject("data").getJSONArray("lists").toJavaList(JSONObject.class);
for (JSONObject row : data) {
if ("1".equals(row.getString("sfcxm"))){
continue;
}
});
units.add(BeanUtil.mapToBean(entity, Sys_unit.class, true));
Map entity = new HashMap(5);
row.forEach((k, v) -> {
if(UNIT_FIELD_RELATION.containsKey(k)) {
Object value = v;
if (UNIT_FIELD_PLUGIN.containsKey(k)) {
value = UNIT_FIELD_PLUGIN.get(k).run(v);
}
for (String key : UNIT_FIELD_RELATION.get(k)) {
entity.put(key, value);
}
}
});
units.add(BeanUtil.mapToBean(entity, Sys_unit.class, true));
}
pageNo++;
int totalPage = (int) Math.ceil((double) jsonObject.getJSONObject("data").getInteger("totalCount") / pageSize);
if (pageNo > totalPage) {
hasRecords = false;
}
}
return units;
}
/**
* 获取InputStreamReader
*
* @param codePath
* @return
*/
static InputStreamReader getIsReaderByCodePath(String codePath) {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(codePath);
return new InputStreamReader(is);
}
/**
* 华交通过签名获取单位、人员数据
*
* @param apiAuthCode
* @return
*/
private static HttpRequest getData(String apiAuthCode,Integer pageNo,Integer pageSize){
NutMap header = new NutMap();
header.put("Accept", "application/json");
header.put("Content-Type", "application/json;charset=utf-8");
header.put("Date", String.valueOf(new Date()));
header.put("x-ca-key", PUBLIC_SECRET);
header.put("x-ca-signature-method", SIGNATURE_METHOD);
header.put("x-ca-timestamp", String.valueOf(System.currentTimeMillis()));
HttpRequest httpRequest = HttpUtil.createPost(URL);
header.forEach((k, v) -> {
httpRequest.header(k, (String) v);
});
try {
StringBuffer signatureStrBuffer = new StringBuffer();
signatureStrBuffer.append(httpRequest.getMethod().name().toUpperCase()).append("\n")
.append(header.get("Accept")).append("\n")
.append(header.get("Content-Type")).append("\n")
.append(header.get("Date")).append("\n")
.append("x-ca-key").append(":").append(PUBLIC_SECRET).append("\n")
.append("x-ca-signature-method").append(":").append(SIGNATURE_METHOD).append("\n")
.append("x-ca-timestamp").append(":").append(header.get("x-ca-timestamp")).append("\n")
.append(new URIBuilder(URL).getPath());
// 签名字符串
String signatureStr = signatureStrBuffer.toString();
Mac hmac = Mac.getInstance(SIGNATURE_METHOD);
byte[] keyBytes = PUBLIC_SECRET.getBytes("UTF-8");
hmac.init(new SecretKeySpec(PRIVATE_SECRET.getBytes("UTF-8"), 0, keyBytes.length, SIGNATURE_METHOD));
byte[] md5Result = hmac.doFinal(signatureStr.getBytes("UTF-8"));
String sign = Base64.encodeBase64String(md5Result);
//将签名添加到请求头x-ca-signature
httpRequest.header("x-ca-signature", sign);
NutMap parameter = new NutMap();
parameter.put("apiAuthCode", apiAuthCode);
parameter.put("pageNo", pageNo);
parameter.put("pageSize", pageSize);
httpRequest.body(JSONUtil.toJsonStr(parameter));
return httpRequest;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
@@ -72,9 +72,9 @@ public class SourceUserController {
CndPlus cnd = CndPlus.create();
cnd.and(pageForm);
cnd.andEx("unitid", "=", unitId);
cnd.andEx("personType", "=", personType);
cnd.andEx("userState", "=", userState);
cnd.andEX("unitid", "=", unitId);
cnd.andEX("personType", "=", personType);
cnd.andEX("userState", "=", userState);
if(!StringUtils.isEmpty(importDate)){
cnd.and("DATE(u.pullTime)", "=", importDate);
@@ -3,6 +3,7 @@ package io.v.nutz.zhgh.data.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.ViResource;
@@ -77,12 +78,14 @@ public class UpdateUserController {
CndPlus cnd = CndPlus.create();
cnd.and(pageForm);
cnd.andEx("u.unitid", "=", unitId);
cnd.andEx("u.personType", "=", personType);
cnd.andEx("u.userState", "=", userState);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEx("Date(his.changeTime)", "=", changeDate);
cnd.andEx("his.changeType", "=", changeType);
if (StrUtil.isNotBlank(changeDate)) {
cnd.and("DATE(his.changeTime)", "=", changeDate);
}
cnd.andEX("his.changeType", "=", changeType);
sql.setCondition(cnd);
@@ -108,22 +108,27 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
@Aop(TransAop.READ_COMMITTED)
public void updateSysUser(String pullTime, String sourceType, String[] columnNames, String isUpSet, String partGroupId, boolean isInvert) {
try {
List<UserSource> sources = new ArrayList<>();
// List<UserSource> sources = new ArrayList<>();
Map<String, String> userPartMap = new HashMap<>();
if (Strings.isNotBlank(partGroupId)) {
//如果为true,更新组别之外人员
Sql sql = Sqls.create("select u.loginname from user_part up left join `user` u on u.id=up.userId where up.groupId = @groupId").setParam("groupId", partGroupId);
List<String> loginNameList = userPatUpService.listMap(sql).stream().map(o -> o.getString("loginname")).collect(Collectors.toList());
if (isInvert) {
sources = query(Cnd.where("pullTime", "=", pullTime).and("loginname", "not in", loginNameList).groupBy("loginname"));
userPartMap = sources.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getLoginname));
} else {
userPartMap = userPatUpService.query(Cnd.where("groupId", "=", partGroupId)).stream().collect(Collectors.toMap(UserPartUp::getLoginname, UserPartUp::getLoginname));
sources = query(Cnd.where("pullTime", "=", pullTime).and("loginname", "in", loginNameList).groupBy("loginname"));
}
} else {
sources = query(Cnd.where("pullTime", "=", pullTime).groupBy("loginname"));
}
// if (Strings.isNotBlank(partGroupId)) {
// //如果为true,更新组别之外人员
// Sql sql = Sqls.create("select u.loginname from user_part up left join `user` u on u.id=up.userId where up.groupId = @groupId").setParam("groupId", partGroupId);
// List<String> loginNameList = userPatUpService.listMap(sql).stream().map(o -> o.getString("loginname")).collect(Collectors.toList());
// if (isInvert) {
// sources = query(Cnd.where("pullTime", "=", pullTime).and("loginname", "not in", loginNameList).groupBy("loginname"));
// userPartMap = sources.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getLoginname));
// } else {
// userPartMap = userPatUpService.query(Cnd.where("groupId", "=", partGroupId)).stream().collect(Collectors.toMap(UserPartUp::getLoginname, UserPartUp::getLoginname));
// sources = query(Cnd.where("pullTime", "=", pullTime).and("loginname", "in", loginNameList).groupBy("loginname"));
// }
// } else {
// sources = query(Cnd.where("pullTime", "=", pullTime).groupBy("loginname"));
// }
Sql sql = Sqls.create("select * from user_source where loginname not in (select loginname from sys_user) and pullTime = @pullTime group by loginname").setParam("pullTime", pullTime);
List<NutMap> list = listMap(sql);
List<UserSource> sources = BeanUtil.copyToList(list, UserSource.class);
// 查询所有用户,判断是否需要更新
List<Sys_user> users = sysUserService.query(Cnd.where("loginname", "is not", null));
@@ -165,7 +170,8 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
List<String> addWelfareMemberUserIds = new CopyOnWriteArrayList<>();
// 移除福利会员角色的用户id
List<String> deleteWelfareMemberUserIds = new CopyOnWriteArrayList<>();
// 数据库没单位的,但是数据源有单位
List<Sys_user> renewUnitUser = new CopyOnWriteArrayList<>();
// 创建一个固定大小的线程池 可以根据服务器性能调整线程池大小
int numberOfThreads = Runtime.getRuntime().availableProcessors() * 2;
@@ -183,7 +189,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
//不更新会员和福利会员字段
source.setMember(null);
source.setWelfareMember(null);
Sys_user user = userMap.get(source.getLoginname().toLowerCase());
Sys_user user = userMap.get(source.getLoginname());
if (isAuto) {
checkMemberOrWelfareMember(changeConfig, source, user, addMemberUserIds, deleteMemberUserIds,
@@ -195,6 +201,11 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
}
}
if (user != null && StrUtil.isBlank(user.getUnitid()) && StrUtil.isNotBlank(source.getUnitid())) {
user.setUnitid(source.getUnitid());
renewUnitUser.add(user);
}
Sys_user u = new Sys_user();
BeanUtils.copyProperties(source, u);
switch (sourceType) {
@@ -250,9 +261,17 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
//如果有新用户,增加到用户表同时增加角色
if (Lang.isNotEmpty(needInitUserList)) {
sysUserService.fastInsert(needInitUserList);
List<String> userIdList = userRoles.stream().map(Sys_user_role::getUserId).collect(Collectors.toList());
sysUserRoleService.dao().clear(Sys_user_role.class, Cnd.where("userId", "in", userIdList));
sysUserRoleService.insert(userRoles);
String roleId = Roles.PUBLIC;
List<Sys_user_role> roleList = needInitUserList.stream().map(v -> {
Sys_user_role role = new Sys_user_role();
role.setUserId(v.getId());
role.setRoleId(roleId);
return role;
}).collect(Collectors.toList());
sysUserRoleService.insert(roleList);
}
// 添加会员
@@ -277,6 +296,12 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
// 在职状态关乎变更类型,建议自己手动更新,不要使用自动更新功能,硬要使用,请点进 renewUserState 打开注释
userPatUpService.renewUserState();
doClearRepeat(pullTime);
if (Lang.isNotEmpty(renewUnitUser)) {
dao().update(renewUnitUser, "unitid");
}
// 修改不在人事库的人员,删除角色
// userPatUpService.deleteNotInSourceUser(true);
//清除缓存
@@ -555,7 +580,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
return null;
}
String changeInfos = changeList.stream().map(v -> {
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue"));
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue", "")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue", ""));
}).collect(Collectors.joining(";"));
// 比较变更数据
commonCompareChange(source, user, changeTypes);
@@ -584,13 +609,13 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
}
}
if (!ObjectUtil.equals(user.getMember(), source.getMember())){
if (source.getMember() == 1) {
changeTypes.add(MemberChangeType.RESTORE.getType());
} else {
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
}
}
// if (!ObjectUtil.equals(user.getMember(), source.getMember())){
// if (source.getMember() != null && source.getMember() == 1) {
// changeTypes.add(MemberChangeType.RESTORE.getType());
// } else {
// changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
// }
// }
if (!ObjectUtil.equals(user.getUnitid(), source.getUnitid())) {
changeTypes.add(MemberChangeType.UNIT_CHANGE.getType());
@@ -656,6 +681,57 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
}
private void doClearRepeat(String pullTime) {
//查出变更类型是新增的工号
List<UserHistory> histories = dao().query(UserHistory.class, Cnd.where("changeTime", "=", pullTime));
List<String> loginnameList = histories.stream().map(Sys_user::getLoginname).collect(Collectors.toList());
//查出这些工号在sys_user表中是否与user_source表中的姓名不一致
List<Sys_user> userList = dao().query(Sys_user.class, Cnd.where("loginname", "in", loginnameList));
List<UserSource> sourceList = dao().query(UserSource.class, Cnd.where("pulltime", "=", pullTime)
.and("loginname", "in", loginnameList));
//工号为键
Map<String, UserSource> sourceMap = sourceList.stream().collect(Collectors.toMap(Sys_user::getLoginname, v -> v));
List<Sys_user> needInsertUserList = new ArrayList<>();
List<String> needDeleteUserIdList = new ArrayList<>();
List<Sys_user_role> needInsertUserRoleList = new ArrayList<>();
userList.forEach(v -> {
UserSource source = sourceMap.get(v.getLoginname());
if (Lang.isEmpty(source)) return;
//如果工号相同,姓名不同,就删除sys_user的数据,并且删除角色
if (!v.getUsername().equals(source.getUsername())) {
needDeleteUserIdList.add(v.getId());
Sys_user user = new Sys_user();
BeanUtils.copyProperties(source, user);
needInsertUserList.add(user);
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(user.getId());
userRole.setRoleId(Roles.PUBLIC);
needInsertUserRoleList.add(userRole);
}
});
if (Lang.isNotEmpty(needDeleteUserIdList)) {
dao().clear(Sys_user.class, Cnd.where("id", "in", needDeleteUserIdList));
dao().clear(Sys_user_role.class, Cnd.where("userId", "in", needDeleteUserIdList));
dao().fastInsert(needInsertUserList);
dao().insert(needInsertUserRoleList);
}
}
/**
* 数据大批量更新
* @param needDoUpdateList 需要更新的数据
@@ -1,7 +1,8 @@
package io.v.nutz.zhgh.jdh.constants;
import io.v.nutz.annontation.SelectEnum;
import io.v.nutz.base.annontation.SelectEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -2,7 +2,8 @@ package io.v.nutz.zhgh.jdh.controller;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
@@ -2,7 +2,8 @@ package io.v.nutz.zhgh.jdh.controller;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.service.ViService;
import io.v.nutz.base.service.ViService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
@@ -73,7 +73,7 @@ public class JdhMefpController {
CndPlus cndPlus = CndPlus.create();
cndPlus.andEX("dbt.jdhid", "=", jdhid);
// cndPlus.andExcludeEmpty("uni.id", "=", union_id);
// cndPlus.andEx("uni.id", "=", union_id);
// cndPlus.asc("unioncode");
sql.setCondition(cndPlus);
@@ -91,8 +91,8 @@ public class MechanismController {
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.desc("jgsz.mechanismcode");
cnd.andExcludeEmpty("parentId", "=", StrUtil.isBlank(parentId) ? "5972c34ff68e4b0cbc6d0834fe88982b" : parentId);
/* cnd.andExcludeEmpty("jgsz.jdhid", "=", jdhid);*/
cnd.andEx("parentId", "=", StrUtil.isBlank(parentId) ? "5972c34ff68e4b0cbc6d0834fe88982b" : parentId);
/* cnd.andEx("jgsz.jdhid", "=", jdhid);*/
sql.setCondition(cnd);
return jgszViService.list(pageForm, sql);
}
@@ -1,6 +1,7 @@
package io.v.nutz.zhgh.jdh.model.cb;
import io.v.nutz.modules.models.DbFile;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
@@ -52,6 +53,6 @@ public class Jdh_cbwj implements Serializable {
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<DbFile> files;
private List<Sys_file> files;
}
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.jdh.model.cb;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
/**
@@ -8,7 +9,7 @@ import org.nutz.dao.entity.annotation.*;
* @author 赵欣雨
* @date 2020/8/17 15:40
*/
@Data
@Table("jdh_jdhxx")
public class Jdh_jdhxx {
@@ -53,68 +54,4 @@ public class Jdh_jdhxx {
@ColDefine(type = ColType.INT, width = 1)
private boolean jdhkqzt;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getJdhnf() {
return jdhnf;
}
public void setJdhnf(String jdhnf) {
this.jdhnf = jdhnf;
}
public String getJdhjs() {
return jdhjs;
}
public void setJdhjs(String jdhjs) {
this.jdhjs = jdhjs;
}
public String getJdhcs() {
return jdhcs;
}
public void setJdhcs(String jdhcs) {
this.jdhcs = jdhcs;
}
public String getJdhkqsj() {
return jdhkqsj;
}
public void setJdhkqsj(String jdhkqsj) {
this.jdhkqsj = jdhkqsj;
}
public String getJdhms() {
return jdhms;
}
public void setJdhms(String jdhms) {
this.jdhms = jdhms;
}
public boolean isJdhkqzt() {
return jdhkqzt;
}
public void setJdhkqzt(boolean jdhkqzt) {
this.jdhkqzt = jdhkqzt;
}
public String getJdhallname() {
return jdhallname;
}
public void setJdhallname(String jdhallname) {
this.jdhallname = jdhallname;
}
}
@@ -1,10 +1,11 @@
package io.v.nutz.zhgh.jdh.model.cb;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
@Data
@Table("jdh_mefp")
public class Jdh_mefp implements Serializable {
@@ -40,51 +41,5 @@ public class Jdh_mefp implements Serializable {
@ColDefine(type = ColType.INT, width = 4)
private int bzzbs;
public String getJdhid() {
return jdhid;
}
public void setJdhid(String jdhid) {
this.jdhid = jdhid;
}
public String getFghid() {
return fghid;
}
public void setFghid(String fghid) {
this.fghid = fghid;
}
public int getFps() {
return fps;
}
public void setFps(int fps) {
this.fps = fps;
}
public int getBzzbs() {
return bzzbs;
}
public void setBzzbs(int bzzbs) {
this.bzzbs = bzzbs;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDbtid() {
return dbtid;
}
public void setDbtid(String dbtid) {
this.dbtid = dbtid;
}
}
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.jdh.model.gzzl;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@@ -11,6 +12,7 @@ import java.io.Serializable;
* @author 赵欣雨
* @date 2020/8/18 9:16
*/
@Data
@Table("jdh_gzzllx")
public class Jdh_gzzllx implements Serializable {
private static final long serialVersionUID = 1L;
@@ -36,35 +38,4 @@ public class Jdh_gzzllx implements Serializable {
@ColDefine(type = ColType.INT, width = 1)
private Integer xh;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLxname() {
return lxname;
}
public void setLxname(String lxname) {
this.lxname = lxname;
}
public Integer getXh() {
return xh;
}
public void setXh(Integer xh) {
this.xh = xh;
}
}
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.jdh.model.two;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@@ -11,6 +12,7 @@ import java.io.Serializable;
* @author 赵欣雨
* @date 2020/8/18 9:16
*/
@Data
@Table("jdh2_gzzllx")
public class Jdh2_gzzllx implements Serializable {
private static final long serialVersionUID = 1L;
@@ -36,35 +38,4 @@ public class Jdh2_gzzllx implements Serializable {
@ColDefine(type = ColType.INT, width = 1)
private Integer xh;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLxname() {
return lxname;
}
public void setLxname(String lxname) {
this.lxname = lxname;
}
public Integer getXh() {
return xh;
}
public void setXh(Integer xh) {
this.xh = xh;
}
}
@@ -1,10 +1,11 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
@Data
@Table("jdh_dbt_zcfgh")
public class Jdh_dbt_zcfgh implements Serializable {
private static final long serialVersionUID = 1L;
@@ -31,35 +32,4 @@ public class Jdh_dbt_zcfgh implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDbtid() {
return dbtid;
}
public void setDbtid(String dbtid) {
this.dbtid = dbtid;
}
public String getFghid() {
return fghid;
}
public void setFghid(String fghid) {
this.fghid = fghid;
}
public String getJdhid() {
return jdhid;
}
public void setJdhid(String jdhid) {
this.jdhid = jdhid;
}
}
@@ -2,9 +2,10 @@ package io.v.nutz.zhgh.jdh.services;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.jdh.model.two.JdhLevel2;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
/**
* @author: Aaron
@@ -4,12 +4,13 @@ import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.FileService;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.jdh.model.two.JdhLevel2;
import io.v.nutz.jdh.services.MeetingLevelTwoService;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
import io.v.nutz.zhgh.jdh.services.MeetingLevelTwoService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
@@ -61,8 +62,8 @@ public class MeetingLevelTwoServiceImpl extends BaseServiceImpl<JdhLevel2> imple
if (StrUtil.isNotBlank(page.getSearchName()) && StrUtil.isNotBlank(page.getSearchKeyword())) {
cnd.and(Cnd.likeEX(page.getSearchName(), page.getSearchKeyword()));
}
cnd.andExcludeEmpty("un.id", "=", unitId);
cnd.andExcludeEmpty("uni.id", "=", unionId);
cnd.andEx("un.id", "=", unitId);
cnd.andEx("uni.id", "=", unionId);
cnd.asc("jdh2.audit_state").desc("jdh2.create_time");
sql.setCondition(cnd);
return listPage(page.getPageNumber(), page.getPageSize(), sql);
@@ -0,0 +1,60 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.base.Globals;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@IocBean
@At("/platform/jsz/cxtj/union")
@Ok("json:full")
public class JszUniontjController {
@Inject
private WxHttpUtil wxHttpUtil;
@Inject
private BaseService baseService;
@At("")
@Ok("re")
public String index(){
return "beetl:/platform/jsz/cxtj/hdunion.html";
}
@At
public Object getAllUnion(){
return Result.success().addData(baseService.dao().query("sys_union", Cnd.NEW()));
}
@At
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param("hdid") String hdid){
//hdid="65825b355f562cf500f37a2667b36e3c";
Map<String,Object> reqBody = new HashMap<String,Object>();
reqBody.put("activity_id", hdid);
reqBody.put("schoolCode", Globals.schoolCode);
try {
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getBmInfo", reqBody);
NutMap resp_data = result.getAs("resp_data", NutMap.class);
return Result.success().addData(resp_data);
} catch (IOException e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,42 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@IocBean
@At("/platform/jsz/cxtj/phbtj")
@Ok("json:full")
public class JszptphbController {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("re")
@RequiresPermissions("jsz.cxtj.phbtj")
public String index(){
return "beetl:/platform/jsz/cxtj/phb.html";
}
@At
@RequiresPermissions("jsz.cxtj.phbtj")
public Object data(){
try {
NutMap rankAll = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "rankAll", NutMap.NEW().addv("schoolCode", Globals.schoolCode));
return Result.success().addData(rankAll);
// List<NutMap> yearlist = yearMap.getAs("resp_data", NutMap.class).getAs("data", NutMap.class).getAsList("list", NutMap.class);
// return Result.success().addData(NutMap.NEW().addv("daylist",daylist).addv("weeklist",weeklist)
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,97 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.Map;
/**
* @Author JyuHsin
* @Date 2022/9/7
* @Description 排行榜
*/
@At("/jsz/leaderboard")
@Ok("json:full")
@IocBean
public class LeaderboardController {
@Inject
private JszWxStepService jszWxStepService;
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("re")
@RequiresPermissions("jsz.cxtj.leaderboard")
public String index() {
return "beetl:/platform/jsz/cxtj/leaderboard.html";
}
/**
* 获取排行榜数据
*
* @param hdid: 活动id
* @param type: 0-当日榜 1-累计排行榜 2-当日中奖榜
* @return java.lang.Object
* @author JyuHsin
* @date 2022/9/7
*/
@At
@ViReturn
@RequiresPermissions("jsz.cxtj.leaderboard")
public Object getData(@Param(value = "hdid",required = false) String hdid,
@Param(value = "type",required = false) Integer type,
@Param(value = "userId",required = false) String userId) {
if (type == null) {
return Result.error("参数错误");
}
switch (type) {
case 0:
case 1:
return jszWxStepService.getDataOfLeaderboard(hdid, type, userId, "", "", "", "");
case 2:
return jszWxStepService.getDataOfPrize(hdid, "", "", "", "");
default:
break;
}
return null;
}
@At
@ViReturn
@RequiresPermissions("jsz.cxtj.leaderboard")
public Object pageData(@Param(value = "hdid",required = false) String hdid,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId) {
if (StrUtil.isBlank(hdid)) {
return Result.error("参数错误!");
}
String userId = ShiroUtil.getPrincipalProperty("id").toString();
Object today = jszWxStepService.getDataOfLeaderboard(hdid, 0, userId, unionId, unitId, searchName, searchKeyword);
Object summary = jszWxStepService.getDataOfLeaderboard(hdid, 1, userId, unionId, unitId, searchName, searchKeyword);
Object yesterday = jszWxStepService.getDataOfPrize(hdid, unionId, unitId, searchName, searchKeyword);
NutMap map = NutMap.NEW();
map.put("today", Map.of("list", today));
map.put("summary", Map.of("list", summary));
map.put("yesterday", Map.of("list", yesterday));
return map;
}
}
@@ -0,0 +1,739 @@
package io.v.nutz.zhgh.jsz.controller.cxtj;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.services.SysUnionService;
import lombok.Data;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;
/**
* @Author: 1V
* @DateTime: 2020/9/19 14:55
* @Description: 工会报名参与信息
*/
@At("/platform/jsz/union/registerInfo")
@Ok("json:full")
@IocBean
@RequiresAuthentication
public class UnionRegisterInfoCon {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("beetl:/platform/jsz/cxtj/unionRegisterInfo.html")
@RequiresPermissions("jsz.union.registerInfo")
public void index() {
}
@Inject
private SysUnionService sysUnionService;
@At
@ViReturn
@RequiresPermissions("jsz.union.registerInfo")
public Object getData(String activity_id, @Param("activity_tag[]") String[] activity_tag) throws IOException {
return data(activity_id, activity_tag);
}
private List data(String activity_id, String[] activity_tag) throws IOException {
List<Sys_union> unions = sysUnionService.query();
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("unions", unions);
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", activity_tag);
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getRegisterInfo", reqBody);
List resp_data = result.getAs("resp_data", List.class);
return resp_data;
}
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void exportAllUnionData(String activity_id, String activity_name, String activity_tag, HttpServletResponse response) throws IOException {
try {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity_name + "院级工会报名统计表.xls").getBytes("utf-8"), "ISO8859-1"));
ArrayList<E> list = new ArrayList<>();
List data = data(activity_id, activity_tag.split(","));
data.forEach(val -> {
Map v = (Map) val;
E e = new E();
e.setName((String) v.get("unionname"));
e.setReg_num((Integer) v.get("reg_num"));
e.setSign_num((Integer) v.get("sign_num"));
list.add(e);
});
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), E.class, list);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
@At
@RequiresPermissions("jsz.union.registerInfo")
public void regExport(String activity_id, String activity_tag, String unionname, String unionid, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((unionname + "报名名单.xls").getBytes("utf-8"), "ISO8859-1"));
Map<String, Object> reqBody = new HashMap<String, Object>();
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
reqBody.put("unionid", unionid);
// NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getRegisterUsers", reqBody);
// List data = result.getAs("resp_data", List.class);
Integer pageSize = 20;
Integer pageNum = 1;
List<Map> allRegister = new ArrayList<>();
List<Map> oneData = getAllRegister(unionid, activity_id, activity_tag, pageNum, pageSize);
while (oneData.size() > 0) {
allRegister.addAll(oneData);
pageNum++;
oneData = getAllRegister(unionid, activity_id, activity_tag, pageNum, pageSize);
}
System.out.println(allRegister);
ArrayList<RegE> list = new ArrayList<>();
allRegister.forEach(v -> {
RegE e = new RegE();
e.setActivity_name(StrUtil.isBlank((String) v.get("activity_tag")) ? (String) v.get("activity_name") : v.get("activity_tag") + "-" + v.get("activity_name"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setSex((String) v.get("sex"));
e.setUnitname((String) v.get("unitname"));
list.add(e);
});
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegE.class, list);
workbook.write(response.getOutputStream());
// ArrayList<RegE> list = new ArrayList<>();
// data.forEach(val -> {
// Map v = (Map) val;
// RegE e = new RegE();
// e.setActivity_name((String) v.get("activity_name"));
// e.setLoginname((String) v.get("loginname"));
// e.setUsername((String) v.get("username"));
// e.setSex((String) v.get("sex"));
// e.setUnitname((String) v.get("unitname"));
// list.add(e);
// });
//
// Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegE.class, list);
// workbook.write(response.getOutputStream());
}
private List<Map> getAllRegister(String unionid, String activity_id, String activity_tag, Integer pageNumber, Integer pageSize) throws IOException {
String s = String.format(
"""
db.collection('register')
.aggregate()
.lookup({
from: 'activity',
localField: 'activity_id',
foreignField: '_id',
as: 'activity'
})
.addFields({
activity_name: $.arrayElemAt(['$activity.name',0]),
activity_tag: $.arrayElemAt(['$activity.tag',0])
})
.match({
unionid:'%s',
'activity._id':_.in(%s)
}).project({
loginname: true,
sex: true,
username: true,
unionname: true,
unionid: true,
unitname: true,
unitid: true,
mobile: true,
register_time: true,
activity_name: true,
activity_tag:true
}).sort({ 'unitid': 1, 'register_time': -1 }).skip(%d).limit(%d).end()
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag)), (pageNumber - 1) * pageSize, pageSize
);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
List<Map> data = result.getList("data", Map.class);
return data;
}
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void signExport(String activity_id, String activity_tag, String unionname, String unionid, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((unionname + "参与名单.xlsx").getBytes("utf-8"), "ISO8859-1"));
Map<String, Object> reqBody = new HashMap<String, Object>();
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
reqBody.put("unionid", unionid);
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUsers", reqBody);
List<NutMap> data = result.getAs("resp_data", List.class);
ArrayList<SignE> list = new ArrayList<>();
for (NutMap v : data) {
SignE e = new SignE();
// e.setActivity_name((String) v.get("activity_name"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setSex((String) v.get("sex"));
e.setMobile((String) v.get("mobile"));
e.setUnitname((String) v.get("unitname"));
e.setSignnum(v.getInt("sign_size"));
list.add(e);
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SignE.class, list);
workbook.write(response.getOutputStream());
}
public class RegE implements Serializable {
@Excel(name = "活动", width = 40.0D)
private String activity_name;
public String getActivity_name() {
return activity_name;
}
public void setActivity_name(String activity_name) {
this.activity_name = activity_name;
}
@Excel(name = "工号", width = 20.0D)
private String loginname;
@Excel(name = "姓名", width = 20.0D)
private String username;
@Excel(name = "性别", width = 20.0D)
private String sex;
@Excel(name = "电话", width = 20.0D)
private String mobile;
@Excel(name = "单位", width = 60.0D)
private String unitname;
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getUnitname() {
return unitname;
}
public void setUnitname(String unitname) {
this.unitname = unitname;
}
}
@Data
public static class SignE implements Serializable {
@Excel(name = "工号", width = 20.0D)
private String loginname;
@Excel(name = "姓名", width = 20.0D)
private String username;
@Excel(name = "性别", width = 20.0D)
private String sex;
@Excel(name = "电话", width = 20.0D)
private String mobile;
@Excel(name = "单位", width = 60.0D)
private String unitname;
@Excel(name = "工会", width = 60.0D)
private String unionname;
@Excel(name = "签到点位数", width = 20.0D)
private Integer signnum;
}
@Data
public static class E implements Serializable {
@Excel(name = "院级工会", width = 60.0D)
private String name;
@Excel(name = "报名人数", width = 20.0D)
private Integer reg_num;
@Excel(name = "参加人数", width = 20.0D)
private Integer sign_num;
}
@At
@ViReturn
@RequiresPermissions("jsz.union.registerInfo")
public Object getRegisterUser(String activity_id, @Param("activity_tag[]") String[] activity_tag, String unionid, Integer pageNumber, Integer pageSize) throws IOException {
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
Map<String, String> map = new HashMap<>() {{
put("unionid", unionid);
}};
/*if (Strings.isNotBlank(activity_tag)) {
map.put("activity.tag", activity_tag);
}*/
if (Strings.isNotBlank(activity_id)) {
map.put("activity._id", activity_id);
}
String match = Json.toJson(map);
String s = String.format(
"""
db.collection('register')
.aggregate()
.lookup({
from: 'activity',
localField: 'activity_id',
foreignField: '_id',
as: 'activity'
})
.addFields({
activity_name: $.arrayElemAt(['$activity.name',0]),
activity_tag: $.arrayElemAt(['$activity.tag',0])
})
.match({
unionid:'%s',
'activity._id':_.in(%s)
}).project({
loginname: true,
sex: true,
username: true,
unionname: true,
unionid: true,
unitname: true,
mobile: true,
unitid: true,
register_time: true,
activity_name: true,
activity_tag:true
}).sort({ 'unitid': 1, 'register_time': -1 }).skip(%d).limit(%d).end()
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag), skip, pageSize
);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
String count_s = String.format(
"""
db.collection('register').where(
{
unionid:'%s',
activity_id:_.in(%s)
}
).count()
""", unionid, StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag)
);
NutMap countResult = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count_s);
return new Pagination(pageNumber, pageSize, countResult.getInt("count"), result.getList("data", Map.class));
}
@At
@ViReturn
@RequiresPermissions("jsz.union.registerInfo")
public Object getSignUser(String activity_id, @Param("activity_tag[]") String[] activity_tag, String unionid, Integer pageNumber, Integer pageSize) throws IOException {
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
String s = """
db.collection('sign').aggregate().match({
activity_id: _.in(%s),
unionid:"%s"}).group({
_id: {
activity_id: '$activity_id',
loginname: '$loginname'
},
num: $.sum(1),
data: $.first('$$ROOT')
}).lookup({
from: 'activity',
localField: 'data.activity_id',
foreignField: '_id',
as: 'activity'
}).addFields({
activity: $.arrayElemAt(['$activity', 0])
}).project({
loginname: '$data.loginname',
sex: '$data.sex',
username: '$data.username',
unitname: '$data.unitname',
unionname: '$data.unionname',
pts_size: $.size('$activity.pts'),
sign_size: '$num'
}).skip(%d).limit(%d)
.end()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag),
unionid, skip, pageSize);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, s);
String count_s = """
db.collection('sign').aggregate().match({
activity_id:_.in(%s),
unionid:'%s'
}).group({
_id:'$userid',
count: $.sum(1),
}).end()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(activity_tag),
unionid);
NutMap countResult = wxHttpUtil.getWxResult(wxHttpUtil.aggregateUrl, count_s);
return new Pagination(pageNumber, pageSize, countResult.getList("data", Map.class).size(), result.getList("data", Map.class));
}
final Integer LIMIT = 1000;
@At
@RequiresPermissions("jsz.union.registerInfo")
public void doGiftExport(String activity_id, String activity_tag, Boolean flag, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
String fileName = flag ? "已领取礼品的用户" : "未领取礼品的用户";
response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes("utf-8"), "ISO8859-1"));
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("activity_id", activity_id);
String count = """
db.collection('gift_voucher').where({activity_id: _.in(%s),used:%b}).count()
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))),
flag);
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
int count1 = wxResultCount.getInt("count");
List<Map> list2 = new ArrayList<>();
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
for (int i = 0; i < ceil; i++) {
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
String query = """
db.collection('gift_voucher')
.where({
activity_id: _.in(%s),
used: %s
})
.orderBy('use_time', 'desc')
.skip(%s)
.limit(%s)
.get()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
, flag, i * LIMIT, num);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
list2.addAll(data);
}
List<giftE> giftEList = list2.stream().map(v -> {
giftE e = new giftE();
e.set_openid((String) v.get("_openid"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setUnitname((String) v.get("unitname"));
e.setUnionname((String) v.get("unionname"));
return e;
}).collect(Collectors.toList());
ArrayList<giftE> collect = giftEList.stream().collect(
collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
ArrayList::new));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), giftE.class, collect);
workbook.write(response.getOutputStream());
}
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void doExportSummary(String activity_id, String activity_tag, HttpServletResponse response) throws Exception {
NutMap cloudResult = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "findActivityInfo", Map.of("activity_id", activity_id, "activity_tag", Json.fromJsonAsArray(String.class, activity_tag)));
NutMap resp_data = cloudResult.getAs("resp_data", NutMap.class);
List<NutMap> pts = resp_data.getList("pts", NutMap.class);
int ptsLength = pts.size();
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("activity_id", activity_id);
String count = """
db.collection('register').where({activity_id: _.in(%s)}).count()
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))));
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
int count1 = wxResultCount.getInt("count");
List<NutMap> list2 = new ArrayList<>();
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
for (int i = 0; i < ceil; i++) {
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
String query = """
db.collection('register')
.where({
activity_id: _.in(%s)
})
.orderBy('unitid', 'desc')
.skip(%s)
.limit(%s)
.get()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
, i * LIMIT, num);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<NutMap> data = wxResult.getList("data", NutMap.class);
list2.addAll(data);
}
Map<String, Object> signReqBody = new HashMap<String, Object>();
signReqBody.put("activity_id", activity_id);
signReqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
//签到数据
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUserAll", signReqBody);
List<NutMap> signData = result.getAs("resp_data", List.class);
for (NutMap val : signData) {
NutMap v = val.getAs("data", NutMap.class);
val.setv("loginname", v.getString("loginname"));
}
List<ExcelExportEntity> excelExportEntities = new ArrayList<>();
excelExportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
excelExportEntities.add(new ExcelExportEntity("姓名", "username", 20));
excelExportEntities.add(new ExcelExportEntity("性别", "sex", 20));
excelExportEntities.add(new ExcelExportEntity("电话", "mobile", 20));
excelExportEntities.add(new ExcelExportEntity("工会", "unionname", 20));
excelExportEntities.add(new ExcelExportEntity("单位", "unitname", 20));
excelExportEntities.add(new ExcelExportEntity("是否参加", "isTakePartIn", 20));
excelExportEntities.add(new ExcelExportEntity("签到点位数", "signNum", 20));
for (NutMap nutMap : list2) {
String loginname = nutMap.getString("loginname");
Optional<NutMap> signDataMap = signData.stream().filter(v -> StrUtil.isNotBlank(v.getString("loginname")) && v.getString("loginname").equals(loginname)).findFirst();
if (signDataMap.isPresent()) {
int signNum = signDataMap.get().getInt("num", 0);
nutMap.setv("isTakePartIn", signNum > 0 ? "是" : "否");
nutMap.setv("signNum", Math.min(signNum, ptsLength));
} else {
nutMap.setv("isTakePartIn", "否");
nutMap.setv("signNum", 0);
}
}
//
// ArrayList<giftE> collect = giftEList.stream().collect(
// collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
// ArrayList::new));
ViTool.excelResponse(response, "活动汇总表.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), excelExportEntities, list2);
workbook.write(response.getOutputStream());
}
@Data
public static class giftE implements Serializable {
private String _openid;
@Excel(name = "工号", width = 20D)
private String loginname;
@Excel(name = "姓名", width = 20D)
private String username;
@Excel(name = "单位", width = 20D)
private String unitname;
@Excel(name = "工会", width = 20D)
private String unionname;
}
@Inject
private BaseService baseService;
//导出全部人员excel列数据
private static final List<ExcelExportEntity> excelExportEntityList = new ArrayList<>() {{
add(new ExcelExportEntity("姓名", "username", 20));
add(new ExcelExportEntity("工号", "loginname", 20));
add(new ExcelExportEntity("单位", "unitname", 20));
add(new ExcelExportEntity("工会", "unionname", 20));
}};
/**
* 导出活动报名人员
*
* @param activity_id
*/
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void doExportRegsiter(String activity_id, String activity_tag, HttpServletResponse response) throws IOException {
Map<String, Object> reqBody = new HashMap<>();
reqBody.put("activity_id", activity_id);
String count = """
db.collection('register').where({activity_id: _.in(%s)}).count()
""".formatted((StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))));
NutMap wxResultCount = wxHttpUtil.getWxResult(wxHttpUtil.countUrl, count);
int count1 = wxResultCount.getInt("count");
List<Map> list2 = new ArrayList<>();
int ceil = (int) Math.ceil(count1 / LIMIT) + 1;
for (int i = 0; i < ceil; i++) {
Integer num = i == 0 ? LIMIT : count1 - LIMIT;
String query = """
db.collection('register')
.where({
activity_id: _.in(%s)
})
.orderBy('unitid', 'desc')
.skip(%s)
.limit(%s)
.get()
""".formatted(StrUtil.isNotBlank(activity_id) ? Json.toJson(Lang.array(activity_id)) : Json.toJson(Json.fromJsonAsArray(String.class, activity_tag))
, i * LIMIT, num);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
list2.addAll(data);
List<giftE> giftEList = list2.stream().map(v -> {
giftE e = new giftE();
e.set_openid((String) v.get("_openid"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setUnitname((String) v.get("unitname"));
e.setUnionname((String) v.get("unionname"));
return e;
}).collect(Collectors.toList());
ArrayList<giftE> collect = giftEList.stream().collect(
collectingAndThen(toCollection(() -> new TreeSet<>(comparing(o -> o.get_openid()))),
ArrayList::new));
ViTool.excelResponse(response, "活动报名人员.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), giftE.class, collect);
workbook.write(response.getOutputStream());
}
}
/**
* 导出活动参与人员
*
* @param activity_id
*/
@At
@Ok("void")
@RequiresPermissions("jsz.union.registerInfo")
public void doExportSign(String activity_id, String activity_tag, HttpServletResponse response) {
try {
Map<String, Object> reqBody = new HashMap<String, Object>();
reqBody.put("activity_id", activity_id);
reqBody.put("activity_tag", Json.fromJsonAsArray(String.class, activity_tag));
NutMap result = wxHttpUtil.getCloudResult(wxHttpUtil.cloudUrl, "getSignUserAll", reqBody);
List<NutMap> data = result.getAs("resp_data", List.class);
ArrayList<SignE> list = new ArrayList<>();
for (NutMap val : data) {
NutMap v = val.getAs("data", NutMap.class);
SignE e = new SignE();
// e.setActivity_name((String) v.get("activity_name"));
e.setLoginname((String) v.get("loginname"));
e.setUsername((String) v.get("username"));
e.setSex((String) v.get("sex"));
e.setMobile((String) v.get("mobile"));
e.setUnitname((String) v.get("unitname"));
e.setUnionname(v.getString("unionname"));
e.setSignnum(val.getInt("num"));
list.add(e);
}
ViTool.excelResponse(response, "活动参与人员.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), SignE.class, list);
workbook.write(response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,35 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* @Author: 1V
* @DateTime: 2020/9/4 10:37
* @Description: TODO
*/
@At("/jsz/api")
@Ok("json:full")
@IocBean
public class JszApiCon {
@Inject
private SysUserService sysUserService;
@At
@ViReturn
public Object getUserDataByLoginName(String loginname) {
Sql sql = Sqls.create("SELECT u.id userid,u.username,u.loginname,u.sex,u.mobile,u.birthday,unit.`name` unitname,u.unitid,unit.unionid,un.unionname from sys_user u left join sys_unit unit on u.unitid = unit.id left join sys_union un on unit.unionid = un.id WHERE u.loginname = @loginname").setParam("loginname", loginname);
List<Record> list = sysUserService.list(sql);
return list.size() > 0 ? list.get(0) : new Object();
}
}
@@ -0,0 +1,57 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
import io.v.nutz.zhgh.jsz.services.JszFillCheckService;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
/**
* @Author: 1V
* @DateTime: 2020/9/24 10:14
* @Description: 补签
*/
@At("/jsz/fillcheck")
@Ok("json:full")
@IocBean
public class JszFillCheckCon {
@At("")
@Ok("beetl:/platform/jsz/mobile/FillCheck.html")
public void index() {
}
@Inject
private JszFillCheckService jszFillCheckService;
@Inject
private SysUserService sysUserService;
@At
@POST
public Object doSubmit(Jsz_fillcheck fillcheck) {
try {
if (sysUserService.count(Cnd.where("username", "=", fillcheck.getUsername()).and("loginname", "=", fillcheck.getLoginname()).and("zzzt", "=", "在职")) == 0) {
return Result.error("姓名或工号错误");
}
if (jszFillCheckService.count(Cnd.where("username", "=", fillcheck.getUsername()).and("loginname", "=", fillcheck.getLoginname())) > 0) {
return Result.error("存在已提交的签到记录");
}
fillcheck.setCheck_time(DateUtil.getDateTime());
jszFillCheckService.insert(fillcheck);
return Result.success("提交成功");
} catch (Exception e) {
return Result.error("系统错误");
}
}
}
@@ -0,0 +1,100 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.Date;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/6 15:18
*/
@At("/jsz/my/step")
@Ok("json:full")
@IocBean
public class jszWxStepController {
@Inject
private JszWxStepService jszWxStepService;
/**
* 获取今天当前用户最新步数
*
* @param userId
* @return
*/
@At
@ViReturn
public Object getStepByUserId(String userId) {
return jszWxStepService.getStepByUserId(userId);
}
/**
* 获取今天当前用户最新步数
*
* @param userId
* @return
*/
@At
@ViReturn
public Object getStepRankingByUserId(String userId) {
List<JszWxStep> query = jszWxStepService.query(Cnd.where("applyDate", "=", DateUtil.getDate()).desc("step"));
int k = 0;
for (int i = 0; i < query.size(); i++) {
if (query.get(i).getUserId().equals(userId)) {
k = i + 1;
}
}
return k;
}
/**
* 添加步数
*
* @param userId
* @param step
* @return
*/
@At
@ViReturn
public Object addStep(String userId, Integer step) {
JszWxStep jszWxStep = new JszWxStep();
jszWxStep.setUserId(userId);
jszWxStep.setStep(step);
jszWxStep.setApplyDate(new Date());
jszWxStepService.insert(jszWxStep);
return null;
}
/**
* 修改步数
*
* @param userId
* @param step
* @return
*/
@At
@ViReturn
public Object editStep(String userId, Integer step) {
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", userId).and("applyDate", "=", DateUtil.getDate());
jszWxStepService.update(Chain.make("step", step), cnd);
return null;
}
}
@@ -0,0 +1,77 @@
package io.v.nutz.zhgh.jsz.controller.mobile;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.base.Globals;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author: Aaron
* @create: 2020-09-11 13:50
* @description: 小程序登录
**/
@At("/platform/jsz/login")
@Ok("json:full")
@IocBean
public class loginController {
@Inject
private SysUserService sysUserService;
@At("/")
public Object index(String username, String loginname) {
try {
Sql sql = Sqls.create("""
SELECT
u.id userid,
u.username,
u.loginname,
u.sex,
u.mobile,
u.birthday,
unit.`name` unitname,
u.unitid,
u.member,
unit.unionid,
un.unionname,
group_concat(sr.`code`) roles,
'$schoolCode' as schoolCode
FROM
sys_user u
LEFT JOIN sys_unit unit ON u.unitid = unit.id
LEFT JOIN sys_union un ON unit.unionid = un.id
LEFT JOIN sys_user_role sur ON sur.userId = u.id
LEFT JOIN sys_role sr ON sr.id = sur.roleId
$condition
""").setParam("loginname", loginname).setParam("username", username);
sql.setVar("schoolCode", Globals.schoolCode);
Cnd cnd = Cnd.NEW();
cnd.and("LOWER(u.loginname)", "=", loginname.trim().toLowerCase());
cnd.and("LOWER(u.username)", "like", "%" + username.trim().toLowerCase() + "%");
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.map());
sysUserService.dao().execute(sql);
NutMap user = (NutMap) sql.getResult();
if (StrUtil.isBlank(user.getString("userid"))) {
return Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
}
// if(user.getInt("member",0)==0){
// return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
// }
/*if (user.getInt("member", 0) != 1 && !user.getString("sex", "").equals("女")) {
return Result.error().addMsg("您没有权限参加本次健步行,请与工会管理员联系!");
}*/
return Result.success().addData(user);
} catch (Exception e) {
return Result.error();
}
}
}
@@ -0,0 +1,610 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.sys.models.Sys_task;
import io.v.nutz.sys.services.SysTaskService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.task.services.TaskPlatformService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemove;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: 1V
* @DateTime: 2020/9/1 9:48
* @Description: 健身走活动管理
*/
@At("/platform/jsz/hdMange")
@Ok("json")
@IocBean
@RequiresAuthentication
@CacheDefaults(cacheName = "jsz_activity")
public class HdMangeCon {
private static final Log log = Logs.get();
@Inject
private WxHttpUtil wxHttpUtil;
private final String JOB_CLASS = "io.v.nutz.task.job.jszLotteryJob"; //调用类
@Inject
private TaskPlatformService taskPlatformService;
@Inject
private SysTaskService sysTaskService;
@At("")
@Ok("beetl:/platform/jsz/pc/HdMange.html")
@RequiresPermissions("jsz.hdmange")
public void index() {
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("jsz.hdmange")
public Object doAdd(String data, TempFile file) {
try {
String picid = null;
// if (Objects.nonNull(file)) {
// NutMap picmap = wxHttpUtil.getUploadFile("activity/" + file.getSubmittedFileName());
// picid = wxHttpUtil.uploadFile(picmap, file, "activity/" + file.getSubmittedFileName());
// }
NutMap map = Json.fromJson(NutMap.class, data);
StringBuilder ptsBuffer = new StringBuilder("");
NutMap[] pts = map.getArray("pts", NutMap.class);
for (int i = 0; i < pts.length; i++) {
NutMap pt = pts[i];
ptsBuffer.append("{")
.append("issueIds:").append(pt.getAsList("issueIds", String.class).stream().map(v -> "'" + v + "'").collect(Collectors.toList())).append(",")
.append("code:'").append(pt.getString("code")).append("',")
.append("name:'").append(pt.getString("name")).append("',")
.append("radius:").append(pt.getInt("radius")).append(",")
.append("interval:").append(pt.getInt("interval", 0)).append(",")
.append("location:new db.Geo.Point(")
.append(pt.getDouble("lng")).append(",")
.append(pt.getDouble("lat")).append(")")
.append("}");
if (i < pts.length - 1) {
ptsBuffer.append(",");
}
}
StringBuilder lpBuffer = new StringBuilder("");
ArrayList[] linePoints = map.getArray("linePoints", ArrayList.class);
for (int i = 0; i < linePoints.length; i++) {
ArrayList linePoint = linePoints[i];
lpBuffer.append("new db.Geo.Point(" + linePoint.get(0) + "," + linePoint.get(1) + ")");
if (i < linePoints.length - 1) {
lpBuffer.append(",");
}
}
// String pic = Strings.isNotBlank(picid) ? picid : map.getString("pic");
String pic = "cloud://cloudbase-1glnwh6qfc60671f.636c-cloudbase-1glnwh6qfc60671f-1317134219/activity/健身走.jpg";
String query = """
db.collection('activity')
.add({
data:
[{
groupId:%s,
questionId:'%s',
hasAnswer:%b,
tag:'%s',
name:'%s',
activityModel:'%s',
dailyLottery:'%d',
walkingStepCount:'%d',
lotteryChance:%b,
repeatedlyLottery:%b,
leaderboardNum:'%d',
drawTime:%d,
lotteryTime:'%s',
address:'%s',
note:'%s',
apply_start_time:%d,
apply_end_time:%d,
start_time:%d,
end_time:%d,
pts:[%s],
linePoints:[%s],
toast_num:%d,
toast_msg: '%s',
check_all_msg: '%s',
checkControl:%d,
pic:'%s',
showGift:%b,
gift_name:'%s',
schoolCode:'%s',
activity_apply_user:'%s'
}]
})
""".formatted(
map.getString("groupId"),
map.getString("questionId", ""),
map.getBoolean("hasAnswer"),
map.getString("tag", ""),
map.getString("name"),
map.getString("activityModel"),
map.getInt("dailyLottery"),
map.getInt("walkingStepCount"),
map.getBoolean("lotteryChance"),
map.getBoolean("repeatedlyLottery"),
map.getInt("leaderboardNum"),
map.getLong("drawTime"),
map.getString("lotteryTime"),
map.getString("address"),
map.getString("note").replaceAll("\r|\n", ""),
map.getLong("apply_start_time"),
map.getLong("apply_end_time"),
map.getLong("start_time"),
map.getLong("end_time"),
ptsBuffer.toString(),
lpBuffer.toString(),
map.get("toast_num") == null ? 0 : map.getInt("toast_num"),
map.getString("toast_msg", ""),
map.getString("check_all_msg", ""),
map.getInt("checkControl"),
pic,
map.getBoolean("showGift"),
map.getString("gift_name"),
Globals.schoolCode,
ShiroUtil.getUserId()
);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.insertUrl, query);
log.debug(query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
// addTask(map);
return Result.success();
}
return Result.error();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@Inject
private SysUserService sysUserService;
@At
@ViReturn
@RequiresPermissions("jsz.hdmange")
public Object pageData(@Param(value = "year",required = false) Integer year,
@Param(value = "type",required = false) String type,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
@Param(value = "pageOrderName",required = true) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy) throws IOException {
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
String query = """
db.collection('activity')
.where(%s)
.skip(%d)
.limit(%d)
.orderBy('start_time','desc').get()
""";
List<String> and = new ArrayList<>();
String search_sql = "";
String ts_sql = "";
StringBuilder s = new StringBuilder();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
search_sql = """
_.or([
{
name:{$regex:'%s',$options: 'i'}
},
{
tag:{$regex:'%s',$options: 'i'}
}
])
""".formatted(searchKeyword, searchKeyword);
}
if (year != null) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
long start_ts = calendar.getTimeInMillis();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
long end_ts = calendar.getTimeInMillis();
String activity_apply_user_cnd = "_.neq(null)";
if (!ShiroUtil.hasRole("sysadmin")) {
activity_apply_user_cnd = "'" + ShiroUtil.getUserId() + "'";
}
ts_sql = "{apply_start_time:_.and(_.gte(%d),_.lte(%d)),schoolCode:'%s',activity_apply_user:%s}".formatted(start_ts, end_ts, Globals.schoolCode, activity_apply_user_cnd);
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
s.append(search_sql);
if (year != null) {
s.append(".and(");
s.append(ts_sql);
s.append(")");
}
}
if (year != null && Strings.isBlank(searchKeyword)) {
s.append(ts_sql);
}
query = query.formatted(s, skip, pageSize);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
NutMap pager = result.getAs("pager", NutMap.class);
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), result.getList("data", Map.class));
}
@At
@ViReturn
@RequiresPermissions("jsz.hdmange")
public Object getData(String id) throws IOException {
String query = "db.collection('activity').doc('%s').get()".formatted(id);
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return data.size() > 0 ? data.get(0) : new Object();
}
@At
@Ok("json")
@RequiresPermissions("jsz.hdmange")
public Object getFile(String pic) {
try {
NutMap res = NutMap.NEW();
String imgurl = wxHttpUtil.getWxFileUrl(pic);
HashMap<String, Object> imgmap = new HashMap<>();
imgmap.put("status", "success");
imgmap.put("name", imgurl.substring(imgurl.lastIndexOf("/") + 1));
imgmap.put("id", imgurl);
imgmap.put("url", imgurl);
res.setv("img", imgmap);
return Result.success().addData(res);
} catch (Exception e) {
return Result.error();
}
}
@At
@CacheRemoveAll
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("jsz.hdmange")
public Object doEdit(String data, TempFile file) {
try {
String picid = "";
if (file != null) {
NutMap picmap = wxHttpUtil.getUploadFile("activity/" + file.getSubmittedFileName());
picid = wxHttpUtil.uploadFile(picmap, file, "activity/" + file.getSubmittedFileName());
}
NutMap map = Json.fromJson(NutMap.class, data);
StringBuilder ptsBuffer = new StringBuilder("");
NutMap[] pts = map.getArray("pts", NutMap.class);
for (int i = 0; i < pts.length; i++) {
NutMap pt = pts[i];
ptsBuffer.append("{")
.append("issueIds:").append(pt.getAsList("issueIds", String.class).stream().map(v -> "'" + v + "'").collect(Collectors.toList())).append(",")
.append("code:'").append(pt.getString("code")).append("',")
.append("name:'").append(pt.getString("name")).append("',")
.append("radius:").append(pt.getInt("radius")).append(",")
.append("interval:").append(pt.getInt("interval", 0)).append(",")
.append("location:new db.Geo.Point(").append(pt.getDouble("lng")).append(",")
.append(pt.getDouble("lat")).append(")").append("}");
if (i < pts.length - 1) {
ptsBuffer.append(",");
}
}
StringBuilder lpBuffer = new StringBuilder("");
ArrayList[] linePoints = map.getArray("linePoints", ArrayList.class);
for (int i = 0; i < linePoints.length; i++) {
ArrayList linePoint = linePoints[i];
lpBuffer.append("new db.Geo.Point(").append(linePoint.get(0)).append(",")
.append(linePoint.get(1)).append(")");
if (i < linePoints.length - 1) {
lpBuffer.append(",");
}
}
String picSql = "";
if (Strings.isNotBlank(picid)) {
picSql = String.format("pic:'%s'", picid);
}
String query = """
db.collection('activity').doc('%s')
.update({
data:
{
groupId:%s,
questionId:'%s',
hasAnswer:%b,
showGift:%b,
gift_name:'%s',
tag:'%s',
name:'%s',
activityModel:'%s',
dailyLottery:'%d',
walkingStepCount:'%d',
lotteryChance:%b,
repeatedlyLottery:%b,
leaderboardNum:'%d',
drawTime:%d,
lotteryTime:'%s',
address:'%s',
note:'%s',
apply_start_time:%d,
apply_end_time:%d,
start_time:%d,
end_time:%d,
pts:[%s],
linePoints:[%s],
toast_num:%d,
toast_msg: '%s',
check_all_msg: '%s',
checkControl:%d,
schoolCode:'%s',
activity_apply_user:'%s',
%s
}
})
""".formatted(
map.getString("_id"),
map.getString("groupId"),
map.getString("questionId"),
map.getBoolean("hasAnswer"),
map.getBoolean("showGift"),
map.getString("gift_name"),
map.getString("tag"),
map.getString("name"),
map.getString("activityModel"),
map.getInt("dailyLottery"),
map.getInt("walkingStepCount"),
map.getBoolean("lotteryChance"),
map.getBoolean("repeatedlyLottery"),
map.getInt("leaderboardNum"),
map.getLong("drawTime"),
map.getString("lotteryTime"),
map.getString("address"),
map.getString("note").replaceAll("\r|\n", ""),
map.getLong("apply_start_time"),
map.getLong("apply_end_time"),
map.getLong("start_time"),
map.getLong("end_time"),
ptsBuffer.toString(),
lpBuffer.toString(),
map.get("toast_num") == null ? 0 : map.getInt("toast_num"),
map.getString("toast_msg"),
map.getString("check_all_msg"),
map.getInt("checkControl"),
Globals.schoolCode,
ShiroUtil.getUserId(),
picSql
);
log.debug(query);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.updateUrl, query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
// addTask(map);
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
public void addTask(NutMap map) {
// Trans.exec(() -> {
// try {
// if (map.getInt("dailyLottery") > 0) {
// //先删除在添加
// List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", map.getString("_id")));
// if (sys_tasks != null) {
// sys_tasks.forEach(v -> {
// taskPlatformService.delete(v.getId(), v.getId());
// sysTaskService.delete(v.getId());
// });
//
// }
//
//
// Sys_task sys_task = new Sys_task();
// sys_task.setName(map.getString("name"));
// sys_task.setNote(map.getString("_id"));
// sys_task.setJobClass(JOB_CLASS);
// sys_task.setData(Json.toJson(new HashMap<String, Object>() {{
// put("id", map.getString("_id"));
// }}));
// sys_task.setDisabled(false);
// if (!map.getBoolean("repeatedlyLottery")) {
// Date drawTime = new Date(map.getLong("drawTime"));
// String cron = io.v.nutz.base.utils.DateUtil.getCron(drawTime);
// sys_task.setCron(cron);
// List<String> cronExeTimes = taskPlatformService.getCronExeTimes(cron);
// if (cronExeTimes.size() == 0) {
// return;
// }
// sys_task = sysTaskService.insert(sys_task);
// taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
// } else {
// String lotteryTime = map.getString("lotteryTime");
// long start_time_long = map.getLong("start_time");
// long end_time_long = map.getLong("end_time");
//
// List<Date> taskDates = new ArrayList<>();
// int offsetDay = 0;
// while (DateUtil.offsetDay(new Date(start_time_long), offsetDay).compareTo(new Date(end_time_long)) < 0 ||
// DateUtil.offsetDay(new Date(start_time_long), offsetDay).compareTo(new Date(end_time_long)) == 0) {
// taskDates.add(DateUtil.offsetDay(new Date(start_time_long), offsetDay));
// offsetDay++;
// }
//
// for (Date taskDate : taskDates) {
// Calendar instance = Calendar.getInstance();
// instance.setTime(taskDate);
// int year = instance.get(Calendar.YEAR);
// int month = instance.get(Calendar.MONTH) + 1;
// int day = instance.get(Calendar.DATE);
// String[] time = lotteryTime.split(":");
// String cron = time[2] + " " + time[1] + " " + time[0] + " " + day + " " + month + " " + " ? " + year + " ";
// sys_task.setCron(cron);
// List<String> cronExeTimes = taskPlatformService.getCronExeTimes(cron);
// if (cronExeTimes.size() == 0) {
// return;
// }
// sys_task = sysTaskService.insert(sys_task);
// taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
// }
//
//
// }
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// });
}
@At
@ViReturn
@CacheRemove
@RequiresPermissions("jsz.hdmange")
public Object delete(String id) throws IOException {
String query = "db.collection('activity').doc('" + id + "').remove()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, query);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
String s1 = "db.collection('register').where({\n" +
" activity_id: '" + id + "'\n" +
"}).remove()\n";
String s2 = "db.collection('sign').where({\n" +
" activity_id: '" + id + "'\n" +
"}).remove()\n";
wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s1);
wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s2);
List<Sys_task> sys_tasks = sysTaskService.query(Cnd.where("note", "=", id));
if (sys_tasks != null) {
sys_tasks.forEach(v -> {
taskPlatformService.delete(v.getId(), v.getId());
sysTaskService.delete(v.getId());
});
}
return Result.success();
}
return Result.error();
}
@At
@ViReturn
public Object getFitnessData() throws IOException {
String query = "db.collection('activity').where({schoolCode:'%s'}).orderBy('apply_start_time', 'desc').get()".formatted(Globals.schoolCode);
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<NutMap> data = result.getList("data", NutMap.class);
return data.size() > 0 ? data : new ArrayList<>();
//return Collections.emptyList();
}
@At
@ViReturn
public Object getActivityData() throws IOException {
Long yearStartTime = getYearStartTime();
Long yearEndTime = getYearEndTime();
String query = "db.collection('activity')\n" +
" .where({\n" +
" apply_start_time: _.and(_.gte(" + yearStartTime + "), _.lte(" + yearEndTime + "))\n" +
" }).get()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return data;
}
/**
* 获取当年的开始时间戳
*
* @return
*/
public static Long getYearStartTime() {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.DATE, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取当年的最后时间戳
*
* @return
*/
public static Long getYearEndTime() {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
calendar.setTimeInMillis(System.currentTimeMillis());
int year = calendar.get(Calendar.YEAR);
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return calendar.getTimeInMillis();
}
}
@@ -0,0 +1,101 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.jsz.services.JszTypeService;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
/**
* @Author: 1V
* @DateTime: 2020/9/1 10:02
* @Description: TODO
*/
@At("/platform/jsz/common")
@Ok("json")
@IocBean
@RequiresAuthentication
public class JszCommonCon {
@Inject
private JszTypeService jszTypeService;
@Inject
private WxHttpUtil wxHttpUtil;
/**
* 获取类型
*
* @return
*/
@At
@ViReturn
public Object getTypes() {
return jszTypeService.query(Cnd.NEW().asc("location"));
}
/**
* 获取所有的活动
*
* @return
*/
@At
public Object getAllHd(Integer year, String beforeTime, String endTime) {
try {
String str = "";
if (Strings.isNotBlank(beforeTime) && Strings.isNotBlank(endTime)) {
str = "start_time:_.gt(" + beforeTime + "),start_time:_.lt(" + endTime + "),schoolCode:'" + Globals.schoolCode + "'";
} else {
str = "schoolCode:'" + Globals.schoolCode + "'";
}
if (year != null) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
long start_ts = calendar.getTimeInMillis();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
long end_ts = calendar.getTimeInMillis();
String activity_apply_user_cnd = "_.neq(null)";
if (!ShiroUtil.hasRole("sysadmin")) {
activity_apply_user_cnd = "'" + ShiroUtil.getUserId() + "'";
}
str = "apply_start_time:_.and(_.gte(%d),_.lte(%d)),schoolCode:'%s',activity_apply_user:%s".formatted(start_ts, end_ts, Globals.schoolCode, activity_apply_user_cnd);
}
String query = "db.collection('activity').where({\n" +
str +
"}).field({\n" +
"tag: true,\n" +
"name: true,\n" +
"start_time: true,\n" +
"end_time: true,\n" +
"activityModel: true,\n" +
"schoolCode: '" + Globals.schoolCode + "'\n" +
"}).orderBy('start_time', 'desc').get()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return Result.success().addData(data);
} catch (IOException e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,121 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @Author: 1V
* @DateTime: 2020/9/24 15:32
* @Description: TODO
*/
@At("/platform/jsz/login/record")
@Ok("json")
@IocBean
@RequiresAuthentication
public class JszLoginRecordCon {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("beetl:/platform/jsz/pc/LoginRecord.html")
@RequiresPermissions("jsz.login.record")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("jsz.login.record")
public Object pageData(@Param(value = "keyWord",required = false) String keyWord,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy) throws IOException {
String cnd = "";
if (Strings.isNotBlank(keyWord)) {
cnd = " _.or([{\n" +
" loginname: db.RegExp({\n" +
" regexp: '" + keyWord + "',\n" +
" options: 'i',\n" +
" })},{\n" +
" username: db.RegExp({\n" +
" regexp: '" + keyWord + "',\n" +
" options: 'i',\n" +
" })\n" +
" }])";
} else {
// cnd = "{schoolCode:'" + Globals.schoolCode + "'}";
}
int skip = (pageNumber == 1 ? 0 : (pageNumber - 1)) * pageSize;
String query = "db.collection('login_record')" + ( StrUtil.isNotBlank(cnd) ? (".where(" + cnd + ")") : "" )
+ ".field({ data: false }).skip(" + skip + ").limit(" + pageSize + ").get()";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
NutMap pager = result.getAs("pager", NutMap.class);
List<Map> list = result.getList("data", Map.class);
list.forEach(v -> {
String openid = (String) v.get("openid");
v.put("openid", openid.substring(0, 3) + "******" + openid.substring(openid.length() - 3));
});
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), list);
}
@At
@RequiresPermissions("jsz.login.record")
public Object delete(String[] ids) throws IOException {
try {
String s = "db.collection('login_record').where({_id:_.in(" + Json.toJson(ids) + ")}).remove()\n";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("jsz.login.record")
public Object deleteAll() throws IOException {
try {
String s = "db.collection('login_record').where({schoolCode: _.eq('" + Globals.schoolCode + "')}).remove()\n";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, s);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
}
@@ -0,0 +1,124 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.date.DateUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.ViTool;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
* @FileName io.v.nutz.zhgh.jsz.controller.pc.JszPrizeController
* @Description: TODO
* @Author zxc
* @Date 2022/9/8:15:06
* @Version V1.0
**/
@IocBean
@At("/platform/jsz/prize")
public class JszPrizeController {
@At("")
@Ok("beetl:/platform/jsz/pc/prize.html")
@RequiresAuthentication
public void index() {
}
@Inject
private Dao dao;
private String getSql() {
return """
SELECT
u.loginname,
u.username,
u.unionname,
u.unitname,
al.applyDate,
date_format(al.applyDate,'%Y-%m-%d') as prizeData
FROM
`jsz_award_list` al
LEFT JOIN `user` u ON u.id = al.userId
$condition
""";
}
@At("/prizeDataList")
@Ok("json:full")
@ViReturn
public Object prizeDataList(@Param("activityId") String activityId) {
Date toDay = new Date();
Sql sql = Sqls.create(getSql());
Cnd cnd = Cnd.NEW();
cnd.and("activityId", "=", activityId);
sql.setCondition(cnd);
List<NutMap> list = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
List<NutMap> yesterdayList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(DateUtil.offsetDay(toDay, -1), "yyyy-MM-dd"))).collect(Collectors.toList());
// List<NutMap> toDayList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(toDay, "yyyy-MM-dd"))).collect(Collectors.toList());
return Map.of("toDayList", Collections.emptyList(), "yesterdayList", yesterdayList, "totalList", list);
}
@At("/exportExcel")
@Ok("void")
@RequiresAuthentication
public void exportExcel(@Param("activityId") String activityId,
@Param("currentSelectedType") String currentSelectedType,
HttpServletResponse response) {
Date toDay = new Date();
Sql sql = Sqls.create(getSql());
Cnd cnd = Cnd.NEW();
cnd.and("activityId", "=", activityId);
sql.setCondition(cnd);
List<NutMap> exportList = new ArrayList<>();
List<NutMap> list = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
if ("yesterdayList".equals(currentSelectedType)) {
exportList = list.stream().filter(v -> v.getString("applyDate").substring(0, 10).equals(DateUtil.format(DateUtil.offsetDay(toDay, -1), "yyyy-MM-dd"))).collect(Collectors.toList());
} else {
exportList = list;
}
List<ExcelExportEntity> entityList = new ArrayList<>() {{
add(new ExcelExportEntity("姓名", "username", 20));
add(new ExcelExportEntity("工号", "loginname", 20));
add(new ExcelExportEntity("单位", "unitname", 20));
add(new ExcelExportEntity("分工会", "unionname", 20));
add(new ExcelExportEntity("日期", "prizeData", 20));
}};
try {
ViTool.excelResponse(response, "导出数据.xlsx");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, exportList);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,140 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.ViTool;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/9 14:07
*/
@IocBean
@At("/platform/jsz/StepCountingRank")
public class JszStepCountingRankCon {
@At("")
@Ok("beetl:/platform/jsz/pc/stepCountingRank.html")
@RequiresPermissions("jsz.StepCountingRank")
public void index() {
}
@Inject
private BaseService baseService;
private String getSql() {
return """
SELECT
u.loginname,
u.username,
u.unionname,
u.unitname,
al.applyDate,
al.step,
date_format(al.applyDate,'%Y-%m-%d') as prizeData
FROM
`jsz_wx_step` al
LEFT JOIN `user` u ON u.id = al.userId
$condition
""";
}
@At
@Ok("json:full")
@ViReturn
@RequiresPermissions("jsz.StepCountingRank")
public Object pageData(PageForm pageForm,
@Param(value = "year",required = false) Integer year,
@Param(value = "hdid",required = false) String hdid,
@Param(value = "activityDate",required = false) String[] activityDate,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create(getSql());
if (Lang.isNotEmpty(activityDate)) {
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[0]);
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[1]);
}
cnd.andEX("YEAR(al.applyDate)", "=", year);
cnd.andEX("al.activityId", "=", hdid);
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitId", "=", unitId);
cnd.desc("al.step");
cnd.desc("u.unioncode");
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return pagination;
}
@At("/exportExcel")
@Ok("void")
@RequiresAuthentication
@RequiresPermissions("jsz.StepCountingRank")
public void exportExcel(@Param(value = "hdid",required = false) String hdid,
@Param(value = "activityDate",required = false) String[] activityDate,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId, HttpServletResponse response) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create(getSql());
if (activityDate.length > 0) {
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[0]);
cnd.and("date_format(al.applyDate,'%Y-%m-%d')", ">=", activityDate[1]);
}
cnd.andEX("al.activityId", "=", hdid);
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitId", "=", unitId);
cnd.desc("al.step");
cnd.desc("u.unioncode");
List<NutMap> exportList = baseService.listMap(sql);
List<ExcelExportEntity> entityList = new ArrayList<>() {{
add(new ExcelExportEntity("姓名", "username", 20));
add(new ExcelExportEntity("工号", "loginname", 20));
add(new ExcelExportEntity("单位", "unitname", 20));
add(new ExcelExportEntity("分工会", "unionname", 20));
add(new ExcelExportEntity("当前步数", "step", 20));
add(new ExcelExportEntity("日期", "prizeData", 20));
}};
try {
ViTool.excelResponse(response, "导出数据.xlsx");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, exportList);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,178 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.WxHttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemove;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import org.nutz.plugins.wkcache.annotation.CacheResult;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author: Aaron
* @create: 2020-09-03 14:12
* @description: 健身走题库管理
**/
@At("/platform/jsz/tkMange")
@Ok("json")
@IocBean
@RequiresAuthentication
@CacheDefaults(cacheName = "jsz_topic")
public class TkMangeController {
@Inject
private WxHttpUtil wxHttpUtil;
@At("")
@Ok("beetl:/platform/jsz/pc/TkMange.html")
@RequiresPermissions("jsz.tkmange")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("jsz.tkmange")
public Object pageData(@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize) {
try {
List and = new ArrayList<>();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
and.add("" + searchName + ":{$regex:'" + searchKeyword + "',$options: 'i'}");
}
int skip = pageNumber == 1 ? 0 : (pageNumber - 1) * pageSize;
String query = "db.collection('topic')\n" +
" .where({" + StringUtils.join(and, ",") + "})\n" +
" .skip(0)\n" +
" .limit(10)\n" +
" .get()";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
NutMap pager = result.getAs("pager", NutMap.class);
return new Pagination(pageNumber, pageSize, pager.getInt("Total"), result.getList("data", Map.class));
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("jsz.tkmange")
public Object doAdd(String issue) {
try {
NutMap map = Json.fromJson(NutMap.class, issue);
StringBuffer optionsBuffer = new StringBuffer("");
NutMap[] options = map.getArray("options", NutMap.class);
for (int i = 0; i < options.length; i++) {
NutMap op = options[i];
optionsBuffer.append("{" +
"option_name:'" + op.getString("option_name") + "'," +
"option_iswor:" + op.getBoolean("option_iswor") + "" +
"}");
if (i < options.length - 1) {
optionsBuffer.append(",");
}
}
String query = "db.collection('topic')\n" +
" .add({\n" +
" data: [\n" +
" {\n" +
" issue_multiple: " + map.getBoolean("issue_multiple") + ",\n" +
" issue_name: '" + map.getString("issue_name") + "',\n" +
" options: [" + optionsBuffer.toString() + "]\n" +
" }\n" +
" ]\n" +
" })";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.insertUrl, query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
@CacheResult
@RequiresPermissions("jsz.tkmange")
public Object findOne(String id) throws IOException {
String query = "db.collection('topic').doc('" + id + "').get()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.queryUrl, query);
List<Map> data = wxResult.getList("data", Map.class);
return data.size() > 0 ? data.get(0) : new Object();
}
@At
@CacheRemoveAll
@RequiresPermissions("jsz.tkmange")
public Object doEdit(String issue) {
try {
NutMap map = Json.fromJson(NutMap.class, issue);
StringBuffer optionsBuffer = new StringBuffer("");
NutMap[] options = map.getArray("options", NutMap.class);
for (int i = 0; i < options.length; i++) {
NutMap op = options[i];
optionsBuffer.append("{" +
"option_name:'" + op.getString("option_name") + "'," +
"option_iswor:" + op.getBoolean("option_iswor") + "" +
"}");
if (i < options.length - 1) {
optionsBuffer.append(",");
}
}
String query = "db.collection('topic').doc('" + map.getString("_id") + "')\n" +
" .update({\n" +
" data: {\n" +
" issue_multiple: " + map.getBoolean("issue_multiple") + ",\n" +
" issue_name: '" + map.getString("issue_name") + "',\n" +
" options: [" + optionsBuffer.toString() + "]\n" +
" }\n" +
" })";
NutMap result = wxHttpUtil.getWxResult(wxHttpUtil.updateUrl, query);
if (result.getInt("errcode") == 0 && result.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
@CacheRemove
@RequiresPermissions("jsz.tkmange")
public Object delete(String id) throws IOException {
String query = "db.collection('topic').doc('" + id + "').remove()";
NutMap wxResult = wxHttpUtil.getWxResult(wxHttpUtil.deleteUrl, query);
if (wxResult.getInt("errcode") == 0 && wxResult.getString("errmsg").equals("ok")) {
return Result.success();
}
return Result.error();
}
}
@@ -0,0 +1,170 @@
package io.v.nutz.zhgh.jsz.controller.pc;
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.io.IOException;
import java.util.*;
/**
* @FileName io.v.nutz.zhgh.jsz.controller.pc.stepCountingController
* @Description: TODO
* @Author zxc
* @Date 2022/9/6:14:39
* @Version V1.0
**/
@IocBean
@At("/platform/jsz/stepCounting")
public class stepCountingController {
// @Inject
// private SendMsg sendMsg;
@Inject
private Dao dao;
@Inject
private SysUserService sysUserService;
@At("/sendSmsCode")
@Ok("json:full")
public Object sendSmsCode(@Param("loginName") String loginName) {
int count = dao.count(Sys_user.class, Cnd.where("loginName", "=", loginName));
if (count == 0) {
return Result.error("系统中查询不到您的工号!");
}
RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
String code = randomGenerator.generate();
// try {
// sendMsg.sendTextMesg(loginName, "健步走验证码:" + code);
// return Result.success().addData(code);
// } catch (IOException e) {
// e.printStackTrace();
// return Result.error();
// }
return null;
}
@At("/getUserInfo")
@Ok("json:full")
public Object getUserInfo(@Param("loginName") String loginName) {
Sql sql = Sqls.create("""
SELECT
u.id userid,
u.username,
u.loginname,
u.sex,
u.mobile,
u.birthday,
unit.`name` unitname,
u.unitid,
u.member,
unit.unionid,
un.unionname,
group_concat(sr.`code`) roles
FROM
sys_user u
LEFT JOIN sys_unit unit ON u.unitid = unit.id
LEFT JOIN sys_union un ON unit.unionid = un.id
LEFT JOIN sys_user_role sur ON sur.userId = u.id
LEFT JOIN sys_role sr ON sr.id = sur.roleId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("LOWER(u.loginname)", "=", loginName.toLowerCase());
sql.setCondition(cnd);
NutMap userMap = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
if (StrUtil.isBlank(userMap.getString("userid"))) {
return Result.error().addMsg("系统查询不到您的信息,请与工会管理员联系!");
}
return Result.success().addData(userMap);
}
/**
* get week step
*
* @param userId user id
* @return {@link Object}
*/
@At("/getWeekStep")
@Ok("json:full")
@ViReturn
public Object getWeekStep(@Param("userId") String userId, @Param("activityId") String activityId) {
Assert.notBlank(activityId);
Assert.notBlank(userId);
Cnd cnd = Cnd.where("userId", "=", userId);
cnd.and("activityId", "=", activityId);
cnd.and("applyDate", ">", DateUtil.offsetDay(new Date(), -7));
cnd.asc("applyDate");
List<JszWxStep> wxSteps = dao.query(JszWxStep.class, cnd);
List<HashMap> results = new ArrayList<>();
for (int i = 7; i >= 0; i--) {
int offset = (i) * -1;
DateTime offsetDay = DateUtil.offsetDay(new Date(), offset);
String dateStr = offsetDay.toString("yyyy-MM-dd");
Optional<JszWxStep> jszWxStepOptional = wxSteps.stream().filter(v -> DateUtil.format(v.getApplyDate(), "yyyy-MM-dd").equals(dateStr)).findFirst();
results.add(new HashMap<>() {{
put("day", dateStr);
put("step", jszWxStepOptional.isPresent() ? jszWxStepOptional.get().getStep() : 0);
}});
}
return results;
}
/**
* 更新步数
*
* @param activityId 活动id
* @param userId 用户id
* @param step 一步
* @return {@link Object}
*/
@At
@Ok("json:full")
@ViReturn
public Object updateStep(String activityId, String userId, Integer step) {
Assert.notBlank(activityId);
Assert.notBlank(userId);
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", userId);
cnd.and("applyDate", "=", io.v.nutz.base.utils.DateUtil.getDate());
cnd.and("activityId", "=", activityId);
JszWxStep wxStep = dao.fetch(JszWxStep.class, cnd);
if (Lang.isEmpty(wxStep)) {
wxStep = new JszWxStep();
wxStep.setActivityId(activityId);
wxStep.setUserId(userId);
wxStep.setApplyDate(new Date());
}
wxStep.setStep(step);
dao.insertOrUpdate(wxStep);
return null;
}
}
@@ -0,0 +1,44 @@
package io.v.nutz.zhgh.jsz.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* TODO
* 健身走获奖名单
*
* @Author zhf
* @Date 2022/9/8 9:24
*/
@Table
@Data
public class JszAwardList {
@Column
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR)
@Comment("活动")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("姓名Id")
private String userId;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("时间")
private Date applyDate;
}
@@ -0,0 +1,45 @@
package io.v.nutz.zhgh.jsz.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/6 15:06
*/
@Table
@Data
public class JszWxStep {
@Column
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR)
@Comment("时间")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("姓名Id")
private String userId;
@Column
@ColDefine(customType = "int")
@Comment("步数")
private Integer step;
@Column
@ColDefine(type = ColType.DATE)
@Comment("时间")
private Date applyDate;
}
@@ -0,0 +1,78 @@
package io.v.nutz.zhgh.jsz.models;
import org.nutz.dao.entity.annotation.*;
/**
* @Author: 1V
* @DateTime: 2020/9/24 10:04
* @Description: TODO
*/
@Table("Jsz_fillcheck")
public class Jsz_fillcheck {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("用户名")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String loginname;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String username;
@Column
@Comment("校区")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String campus;
@Column
@Comment("签到时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String check_time;
public String getCheck_time() {
return check_time;
}
public void setCheck_time(String check_time) {
this.check_time = check_time;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getCampus() {
return campus;
}
public void setCampus(String campus) {
this.campus = campus;
}
}
@@ -0,0 +1,57 @@
package io.v.nutz.zhgh.jsz.models;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
/**
* @Author: 1V
* @DateTime: 2020/9/1 9:42
* @Description: 活动类型
*/
@Table("Jsz_type")
public class Jsz_type {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("类型名称")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String name;
@Column
@Comment("排序")
@Prev({
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM Jsz_type"),
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM Jsz_type")
})
private Integer location;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getLocation() {
return location;
}
public void setLocation(Integer location) {
this.location = location;
}
}
@@ -0,0 +1,11 @@
package io.v.nutz.zhgh.jsz.services;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
/**
* @author 1V
*/
public interface JszFillCheckService extends BaseService<Jsz_fillcheck> {
}
@@ -0,0 +1,8 @@
package io.v.nutz.zhgh.jsz.services;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.zhgh.jsz.models.Jsz_type;
public interface JszTypeService extends BaseService<Jsz_type> {
}
@@ -0,0 +1,36 @@
package io.v.nutz.zhgh.jsz.services;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
public interface JszWxStepService extends ViService<JszWxStep> {
/**
* 获取今天当前用户最新步数
*/
Object getStepByUserId(String userId);
/**
* 获取当日榜或者累计排榜榜
*
* @param hdid: 活动id
* @param type: 0-当日榜, 1-累计排行榜
* @return null
* @author JyuHsin
* @date 2022/9/7
*/
Object getDataOfLeaderboard(String hdid, Integer type, String userId, String unionId, String unitId, String searchName, String searchKeyword);
/**
* 获取当日中奖榜
*
* @param hdid: 活动id
* @return java.lang.Object
* @author JyuHsin
* @date 2022/9/7
*/
Object getDataOfPrize(String hdid, String unionId, String unitId, String searchName, String searchKeyword);
}
@@ -0,0 +1,20 @@
package io.v.nutz.zhgh.jsz.services.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.zhgh.jsz.models.Jsz_fillcheck;
import io.v.nutz.zhgh.jsz.services.JszFillCheckService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author 1V
*/
@IocBean(args = {"refer:dao"})
public class JszFillCheckServiceImpl extends BaseServiceImpl<Jsz_fillcheck> implements JszFillCheckService {
public JszFillCheckServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.zhgh.jsz.services.impl;
import io.v.nutz.base.service.impl.BaseServiceImpl;
import io.v.nutz.zhgh.jsz.models.Jsz_type;
import io.v.nutz.zhgh.jsz.services.JszTypeService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
@IocBean(args = {"refer:dao"})
@CacheDefaults(cacheName = "jsz_type")
public class JszTypeServiceImpl extends BaseServiceImpl<Jsz_type> implements JszTypeService {
public JszTypeServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,119 @@
package io.v.nutz.zhgh.jsz.services.impl;
import cn.hutool.core.date.DateUtil;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.zhgh.jsz.models.JszWxStep;
import io.v.nutz.zhgh.jsz.services.JszWxStepService;
import io.v.nutz.sys.models.Sys_user;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import java.util.Date;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/9/6 15:12
*/
@IocBean(args = {"refer:dao"})
public class JszWxStepServiceImpl extends ViServiceImpl<JszWxStep> implements JszWxStepService {
public JszWxStepServiceImpl(Dao dao) {
super(dao);
}
@Override
public Object getStepByUserId(String userId) {
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", userId).and("applyDate", "=", DateUtil.today());
return fetch(cnd);
}
@Override
public Object getDataOfLeaderboard(String hdid, Integer type, String userId, String unionId, String unitId, String searchName, String searchKeyword) {
Sys_user user = dao().fetch(Sys_user.class, userId);
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
userId,
sum(step) as step,
u.username,
u.loginname
FROM
`jsz_wx_step` step
LEFT JOIN sys_user u ON step.userId = u.id
$condition
""");
//0查当日
if (type == 0) {
cnd.and("left(applyDate, 10)", "=", DateUtil.today());
}
cnd.and("activityId", "=", hdid);
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.unionId", "=", unionId);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
cnd.groupBy("userId");
cnd.desc("step");
sql.setCondition(cnd);
List<NutMap> lists = listMap(sql);
Sql sqlMy = sql.duplicate().setCondition(cnd.clone().and("userId", "=", userId));
List<NutMap> myStep = listMap(sqlMy);
if (Lang.isEmpty(myStep)) {
NutMap map = NutMap.NEW().setv("username", user.getUsername())
.setv("loginname", user.getLoginname())
.setv("userId", user.getId())
.setv("step", 0);
myStep.add(map);
}
lists.addAll(0, myStep);
return lists;
}
@Override
public Object getDataOfPrize(String hdid, String unionId, String unitId, String searchName, String searchKeyword) {
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
userId,
u.username,
u.loginname,
un.`name` as unitname
FROM
`jsz_award_list` award
LEFT JOIN sys_user u ON award.userId = u.id
LEFT JOIN sys_unit un ON un.id = u.unitid
$condition
""");
cnd.and("activityId", "=", hdid);
cnd.and("left(applyDate, 10)", "=", DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd"));
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.unionId", "=", unionId);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
cnd.groupBy("userId");
sql.setCondition(cnd);
List<NutMap> nutMaps = listMap(sql);
return nutMaps;
}
}
@@ -1,16 +1,16 @@
package io.v.nutz.zhgh.proposal.constants;
import io.v.nutz.base.service.ViService;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.proposal.models.*;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.proposal.services.ProposalReplyService;
import io.v.nutz.service.ViService;
import io.v.nutz.service.impl.ViServiceImpl;
import io.v.nutz.base.utils.ViResource;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.models.*;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import io.v.nutz.zhgh.proposal.services.ProposalReplyService;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.util.ViResource;
import lombok.Getter;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
@@ -1,15 +1,16 @@
package io.v.nutz.zhgh.proposal.constants;
import cn.wizzer.framework.base.Result;
import io.v.nutz.proposal.models.ProposalConfig;
import io.v.nutz.proposal.models.ProposalInfo;
import io.v.nutz.proposal.models.ProposalSeconded;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.proposal.services.ProposalSecondedService;
import io.v.nutz.service.ViService;
import io.v.nutz.service.impl.ViServiceImpl;
import io.v.nutz.util.ViResource;
import io.v.nutz.base.service.ViService;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.base.utils.ViResource;
import io.v.nutz.zhgh.proposal.models.ProposalConfig;
import io.v.nutz.zhgh.proposal.models.ProposalInfo;
import io.v.nutz.zhgh.proposal.models.ProposalSeconded;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import io.v.nutz.zhgh.proposal.services.ProposalSecondedService;
import lombok.Getter;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
@@ -1,10 +1,11 @@
package io.v.nutz.zhgh.proposal.controller.basics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.proposal.models.ProposalConfig;
import io.v.nutz.proposal.services.ProposalConfigService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.zhgh.proposal.models.ProposalConfig;
import io.v.nutz.zhgh.proposal.services.ProposalConfigService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -3,11 +3,11 @@ package io.v.nutz.zhgh.proposal.controller.basics;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalState;
import io.v.nutz.service.ViService;
import io.v.nutz.web.controllers.platform.sys.SysMenuController;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.controllers.platform.sys.SysMenuController;
import io.v.nutz.zhgh.proposal.models.ProposalState;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -1,9 +1,9 @@
package io.v.nutz.zhgh.proposal.controller.basics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalType;
import io.v.nutz.service.ViService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.proposal.models.ProposalType;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
@@ -2,19 +2,19 @@ package io.v.nutz.zhgh.proposal.controller.basics;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.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.ViService;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalConfig;
import io.v.nutz.proposal.models.ProposalUndertake;
import io.v.nutz.service.ViService;
import io.v.nutz.sys.models.Sys_unit;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUnitService;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.zhgh.proposal.models.ProposalConfig;
import io.v.nutz.zhgh.proposal.models.ProposalUndertake;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
@@ -313,8 +313,8 @@ public class ProposalUndertakeController {
LEFT JOIN proposal_undertake pun ON pun.id = sur.cbdwid
$condition
""");
cnd.andExcludeEmpty("sur.cbdwid", "=", id);
cnd.andExcludeEmpty("sur.roleId", "=", flag ? Roles.IN_CHARGE_LEADER : Roles.CONTRACTOR_PERSON);
cnd.andEx("sur.cbdwid", "=", id);
cnd.andEx("sur.roleId", "=", flag ? Roles.IN_CHARGE_LEADER : Roles.CONTRACTOR_PERSON);
sql.setCondition(cnd);
return sysUserService.list(sql);
}
@@ -1,19 +1,19 @@
package io.v.nutz.zhgh.proposal.controller.common;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalReplyConfig;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.proposal.services.ProposalReplyService;
import io.v.nutz.sys.models.Sys_menu;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalReplyConfig;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import io.v.nutz.zhgh.proposal.services.ProposalReplyService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
@@ -3,22 +3,24 @@ package io.v.nutz.zhgh.proposal.controller.common;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.jdh.model.db.Jdh_db;
import io.v.nutz.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.jdh.model.zzjg.Jdh_jgsz;
import io.v.nutz.proposal.constants.ProposalStateDirectionEnum;
import io.v.nutz.proposal.models.*;
import io.v.nutz.proposal.services.ProposalCommonService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.proposal.services.ProposalReplyService;
import io.v.nutz.service.ViService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_jgsz;
import io.v.nutz.zhgh.proposal.constants.ProposalStateDirectionEnum;
import io.v.nutz.zhgh.proposal.models.*;
import io.v.nutz.zhgh.proposal.services.ProposalCommonService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import io.v.nutz.zhgh.proposal.services.ProposalReplyService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
@@ -108,7 +110,7 @@ public class ProposalCommonController {
@ViReturn
public Object getProposalState(Integer stateCode) {
CndPlus cnd = CndPlus.create();
cnd.andExcludeEmpty("stateCode", "=", stateCode);
cnd.andEx("stateCode", "=", stateCode);
cnd.asc("stateCode");
return baseService.dao().query(ProposalState.class, cnd);
}
@@ -524,7 +526,7 @@ public class ProposalCommonController {
* 查询所有状态
*
* @return
* @see io.v.nutz.proposal.constants.ProposalState
* @see ProposalState
*/
@At
@ViReturn
@@ -1,9 +1,10 @@
package io.v.nutz.zhgh.proposal.controller.common;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.proposal.models.ProposalSeconded;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.service.ViService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.proposal.models.ProposalSeconded;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -6,17 +6,17 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalAudit;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.util.ViTool;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalAudit;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -5,15 +5,15 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalAudit;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.util.ViTool;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalAudit;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -2,14 +2,14 @@ package io.v.nutz.zhgh.proposal.controller.export;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
@@ -7,14 +7,14 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.util.ViTool;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -4,15 +4,15 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import io.v.nutz.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.utils.Vi;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.commons.io.IOUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -1,13 +1,13 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalFeedback;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalFeedback;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
@@ -1,11 +1,11 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalInfo;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
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.zhgh.proposal.models.ProposalInfo;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
@@ -1,12 +1,13 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.models.ProposalSeconded;
import io.v.nutz.proposal.services.ProposalInfoService;
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.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.models.ProposalSeconded;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
@@ -1,17 +1,17 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.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.utils.DateUtil;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalAudit;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalCaseService;
import io.v.nutz.proposal.services.ProposalCommonService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProcessService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalAudit;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalCaseService;
import io.v.nutz.zhgh.proposal.services.ProposalCommonService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProcessService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Dao;
@@ -1,14 +1,15 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalInfo;
import io.v.nutz.proposal.models.ProposalReply;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalCommonService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalInfo;
import io.v.nutz.zhgh.proposal.models.ProposalReply;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalCommonService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
@@ -1,8 +1,8 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.proposal.services.ProposalCommonService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.zhgh.proposal.services.ProposalCommonService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -1,10 +1,11 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
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.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
@@ -1,11 +1,11 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
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.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -1,12 +1,12 @@
package io.v.nutz.zhgh.proposal.controller.senior;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalUrgeService;
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.sys.services.SysUserService;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalUrgeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
@@ -1,9 +1,9 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.service.ViService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -1,14 +1,15 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalDataBoardService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalDataBoardService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
@@ -1,14 +1,14 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import io.v.nutz.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.utils.Roles;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
@@ -73,7 +73,7 @@ public class ProposalDelegationSumController {
}
}
cnd.andExcludeEmpty("dbt.jdhid", "=", meetingId);
cnd.andEx("dbt.jdhid", "=", meetingId);
cnd.asc("dbt.`code`");
sql.setCondition(cnd);
@@ -1,10 +1,10 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
@@ -1,9 +1,9 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalHandlingProgressService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalHandlingProgressService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -2,14 +2,14 @@ package io.v.nutz.zhgh.proposal.controller.statistics;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -1,8 +1,9 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
@@ -1,13 +1,13 @@
package io.v.nutz.zhgh.proposal.controller.statistics;
import cn.hutool.core.util.ArrayUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalConstant;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.constants.ProposalConstant;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
@@ -2,18 +2,19 @@ package io.v.nutz.zhgh.proposal.controller.statistics;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.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.utils.Vi;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.jdh.model.db.Jdh_db;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.constants.ProposalState;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalConfigService;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.proposal.services.ProposalProgressService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.proposal.constants.ProposalState;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalConfigService;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import io.v.nutz.zhgh.proposal.services.ProposalProgressService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
@@ -70,7 +71,7 @@ public class ProposalProgressController {
@Param(value = "levyStates", required = false) Integer[] levyStates) {
CndPlus cnd = CndPlus.create();
cnd.andExcludeEmpty("info.stateCode", "=", stateCode);
cnd.andEx("info.stateCode", "=", stateCode);
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06", "tamange"})) {
if (ShiroUtil.hasAnyRoles("jdhdbt01,jdhdbt02")) {
@@ -163,9 +164,9 @@ public class ProposalProgressController {
group.orLike("su.loginname", search.getCreateUser());
cnd.and(group);
}
cnd.andExcludeEmpty("info.delegationId", "=", search.getDelegationId());
cnd.andExcludeEmpty("su.unionId", "=", search.getUnionId());
cnd.andExcludeEmpty("su.unitId", "=", search.getUnitId());
cnd.andEx("info.delegationId", "=", search.getDelegationId());
cnd.andEx("su.unionId", "=", search.getUnionId());
cnd.andEx("su.unitId", "=", search.getUnitId());
cnd.groupBy("info.id");
cnd.desc("info.proposalCode");
sql.setCondition(cnd);
@@ -4,17 +4,18 @@ 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.params.ExcelExportEntity;
import io.v.nutz.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.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.proposal.models.ProposalSearch;
import io.v.nutz.proposal.services.ProposalExportService;
import io.v.nutz.proposal.services.ProposalInfoService;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.util.ViTool;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.zhgh.proposal.models.ProposalSearch;
import io.v.nutz.zhgh.proposal.services.ProposalExportService;
import io.v.nutz.zhgh.proposal.services.ProposalInfoService;
import lombok.Data;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -148,10 +149,10 @@ public class ProposalSummaryController {
$condition
""");
cnd.andExcludeEmpty("info.teacherMeetingId", "=", meetingId);
cnd.andExcludeEmpty("info.stateCode", "=", stateCode);
cnd.andExcludeEmpty("info.delegationId", "=", delegationId);
cnd.andExcludeEmpty("info.typeId", "=", typeId);
cnd.andEx("info.teacherMeetingId", "=", meetingId);
cnd.andEx("info.stateCode", "=", stateCode);
cnd.andEx("info.delegationId", "=", delegationId);
cnd.andEx("info.typeId", "=", typeId);
cnd.groupBy("pr.proposalId");
sql.setCondition(cnd);
@@ -215,8 +216,8 @@ public class ProposalSummaryController {
$condition
""");
cnd.andExcludeEmpty("info.teacherMeetingId", "=", meetingId);
cnd.andExcludeEmpty("pru.undertakeId", "=", undertakeId);
cnd.andEx("info.teacherMeetingId", "=", meetingId);
cnd.andEx("pru.undertakeId", "=", undertakeId);
cnd.groupBy("pru.proposalId");
sql.setCondition(cnd);
List<ExportEntity> exportList = proposalInfoService.listEntity(sql, ExportEntity.class);

Some files were not shown because too many files have changed in this diff Show More