This commit is contained in:
server
2025-06-23 11:42:24 +08:00
parent f2ec1bd5d4
commit cc008b2722
14 changed files with 177 additions and 39 deletions
@@ -76,6 +76,14 @@ public class SysHomeController {
}
}
@At("/platform/h5")
@Ok("re")
@SaCheckLogin
public String h5Home(HttpSession session, HttpServletRequest req) {
return "beetl:/platform/zhghh5/sys/home/index.html";
}
@At("/403")
@Ok("re")
public Object error403(HttpServletRequest req) {
@@ -8,7 +8,9 @@ import com.budwk.app.sys.models.Sys_task;
import com.budwk.app.sys.services.SysTaskService;
import com.budwk.app.task.services.TaskPlatformService;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
@@ -75,6 +77,7 @@ public class SysTaskController {
@Ok("json")
@SLog(tag = "新建任务", msg = "任务名称:${args[0].name}")
@SaCheckPermission("sys.manager.task.add")
@Aop(TransAop.READ_COMMITTED)
public Object addDo(@Param("..") Sys_task task, HttpServletRequest req) {
try {
task.setCreatedBy(SecurityUtil.getUserId());
@@ -13,7 +13,7 @@ public interface SysDataUserPullService extends BaseService<Sys_user_source> {
/**
* 从信息中心拉取数据
*/
void pull();
Date pull();
/**
* 拉取人员博士后的信息
@@ -40,15 +40,15 @@ public class SysDataUserIncrUpdateServiceImpl implements SysDataUserUpdateServic
@Override
public String update(SysDataUserUpdateParam updateParam) {
// 基本SQL查询
Cnd cnd = Cnd.where("s.pullTime", "=", updateParam.getPullTime())
.and("s.loginname", "NOT IN", Sqls.create("SELECT loginname FROM sys_user"));
Cnd cnd = Cnd.where("pullTime", "=", updateParam.getPullTime())
.and("loginname", "NOT IN", Sqls.create("SELECT loginname FROM sys_user"));
// 处理复杂条件
if (updateParam.getConditionGroup() != null) {
cnd = ConditionGroupUtil.applyConditionGroup(cnd, updateParam.getConditionGroup());
}
cnd.groupBy("s.loginname");
cnd.groupBy("loginname");
// 执行查询
List<Sys_user_source> userSources = dao.query(Sys_user_source.class, cnd);
@@ -88,7 +88,7 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
}
@Override
public void pull() {
public Date pull() {
try {
// 博士后进站日期数据
Map<String, Date> doctoralData = pullPostDoctoral();
@@ -180,6 +180,8 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
log.info("--------------------");
// 插入到数据库
dao().insert(latestSourceList);
return nowDate;
} catch (Exception e) {
throw new BaseException("数据拉取失败,{}", e.getMessage());
}
@@ -0,0 +1,62 @@
package com.budwk.app.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.param.ConditionGroup;
import com.budwk.app.sys.enums.SysDataUpdateMode;
import com.budwk.app.sys.models.Sys_user_source;
import com.budwk.app.sys.param.SysDataUserUpdateParam;
import com.budwk.app.sys.services.SysDataUserPullService;
import com.budwk.app.sys.services.SysDataUserUpdateService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.util.NutMap;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.Date;
/**
* 人员全量更新任务
*/
@IocBean
@Slf4j
public class SysUserAllRenewJob implements Job {
@Inject
private Dao dao;
@Inject
private SysDataUserPullService sysDataUserPullService;
@Inject
private SysDataUserUpdateService sysDataUserUpdateService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Date pullTime = sysDataUserPullService.pull();
JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
NutMap conditionGroupMap = (NutMap)jobDataMap.get("conditionGroup");
if(conditionGroupMap == null || conditionGroupMap.isEmpty()){
log.error("SysUserAllRenewJob定时任务执行中止,原因:conditionGroup为null");
}
String conditionGroupStr = Json.toJson(conditionGroupMap).replace("@currentDate", DateUtil.today());
ConditionGroup conditionGroup = null;
try {
conditionGroup = Json.fromJson(ConditionGroup.class, conditionGroupStr);
} catch (Exception e) {
log.error("SysUserAllRenewJob定时任务执行失败,原因:{}", e.getMessage());
}
SysDataUserUpdateParam param = new SysDataUserUpdateParam();
param.setPullTime(DateUtil.formatDateTime(pullTime));
param.setUpdateMode(SysDataUpdateMode.ALL.name());
param.setConditionGroup(conditionGroup);
sysDataUserUpdateService.update(param);
}
}
@@ -55,7 +55,7 @@ public class WelfareProjectMangeController {
Integer year,
String name) {
Sql sql = Sqls.create("SELECT project.*,IF((SELECT count(1) FROM welfare_list WHERE projectId = project.id)>0,TRUE,FALSE) created FROM `welfare_project` project $condition");
Sql sql = Sqls.create("SELECT project.* FROM `welfare_project` project $condition");
Cnd cnd = Cnd.NEW();
pageForm.defaultSortDesc("createdAt");
@@ -63,6 +63,9 @@ public class WelfareProjectMangeController {
if (Strings.isNotBlank(name)) {
cnd.and(Cnd.likeEX("name", name));
}
cnd.desc("project.choiceTimeStart");
sql.setCondition(cnd);
return Result.success(projectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
@@ -82,7 +82,7 @@ public class WelfareUserSelection extends BaseModel implements Serializable {
@Column
@Comment("手机号")
@ColDefine(type = ColType.VARCHAR, width = 11)
@ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile;
@Column
@@ -29,7 +29,7 @@ const MEMBER_STATISTICS_COMPREHENSIVE_QUERY_FORM = {
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="所属工会">
<search-item label="所属单位">
<el-select placeholder="所属单位"
v-model="pageForm.unitId"
clearable
@@ -20,7 +20,6 @@ const selectedUser = {
</div>
<el-table
:data="tableData"
height="100%"
row-key="id"
style="width: 100%"
>
@@ -14,11 +14,6 @@ const MOBILE_MEMBER_INFO = {
<van-cell title="学历">{{ viewData.education }}</van-cell>
<van-cell title="政治面貌">{{ viewData.political }}</van-cell>
<van-cell title="是否会员">{{ viewData.member ? '是' : '否' }}</van-cell>
<van-cell title="是否福利会员">{{ viewData.welfareMember ? '是' : '否' }}</van-cell>
<van-cell title="是否劳模">{{ viewData.isModelWorker ? '是' : '否' }}</van-cell>
<van-cell title="个人简历">
<div slot="label" class="van-cell-rich-text" v-html="viewData.personalData"></div>
</van-cell>
</van-cell-group>
</div>
`,
@@ -6,21 +6,23 @@ layout("/layouts/platform_h5.html"){
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="会员查询" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
v-model="pageForm.searchKeyword"
placeholder="请输入工号或者姓名进行查询"
:show-action="false"
:reverse-color="false"
input-align="left"
@search="doSearch"
v-model="pageForm.searchKeyword"
placeholder="请输入工号或者姓名进行查询"
:show-action="false"
:reverse-color="false"
input-align="left"
@search="doSearch"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="unionList" @change="unionChange" v-model="pageForm.unionId"></van-dropdown-item>
<van-dropdown-item :options="unionList" @change="unionChange"
v-model="pageForm.unionId"></van-dropdown-item>
<van-dropdown-item :options="unitList" @change="doSearch" v-model="pageForm.unitId"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<div>
<van-list v-if="tableData.length>0" v-model="tableLoading" :finished="tableFinished" finished-text="没有更多了" @load="pageData">
<van-list v-if="tableData.length>0" v-model="tableLoading" :finished="tableFinished" finished-text="没有更多了"
@load="pageData">
<div class="table-list">
<div class="table-card" v-for="row in tableData" :key="row.id">
<van-cell title="姓名" :value="row.username"></van-cell>
@@ -35,11 +37,13 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
</van-list>
<van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png" description="暂无数据"></van-empty>
<van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png"
description="暂无数据"></van-empty>
</div>
<div :style="{color:'#1890ff'}" style="text-align: right; position: fixed; bottom: 20px; right: 20px">
<van-button :color="'#1890ff'" hairline size="small" type="primary">总人数:{{pageForm.totalCount}}人</van-button>
<van-button :color="'#1890ff'" hairline size="small" type="primary">总人数:{{pageForm.totalCount}}人
</van-button>
</div>
<van-action-sheet v-model="infoShow" title="会员详细信息">
@@ -92,7 +96,7 @@ layout("/layouts/platform_h5.html"){
},
pageData() {
this.tableLoading = true
this.$axios.post("/platform/member/info/group/pageData", this.pageForm).then((resp) => {
this.$axios.post("/platform/member/info/group/pageData", {pageForm: JSON.stringify(this.pageForm)}).then((resp) => {
this.tableData = this.tableData.concat(resp.data.list)
this.pageForm.totalCount = resp.data.totalCount
if (this.tableData.length >= this.pageForm.totalCount) {
@@ -113,7 +117,7 @@ layout("/layouts/platform_h5.html"){
v.value = v.id
})
if (hasAdmin) {
this.unionList.unshift({ text: "全部工会", value: null })
this.unionList.unshift({text: "全部工会", value: null})
}
if (this.unionList && this.unionList.length > 0) {
this.$set(this.pageForm, "unionId", this.unionList[0].value)
@@ -130,7 +134,7 @@ layout("/layouts/platform_h5.html"){
v.value = v.id
})
if (hasAdmin && !this.pageForm.unionId) {
this.unitList.unshift({ text: "全部单位", value: null })
this.unitList.unshift({text: "全部单位", value: null})
}
if (this.unitList && this.unitList.length > 0) {
this.$set(this.pageForm, "unitId", this.unitList[0].value)
@@ -72,12 +72,12 @@ const mine = {
</span>
</van-cell>
<van-cell :value="$store.state.user.totalIntegral" is-link @click="$pjaxReplace('/platform/integral/records/h5')" class="action-cell">
<span class="cell-title" slot="title">
<van-icon name="points" class="cell-icon"></van-icon>
我的积分
</span>
</van-cell>
<!-- <van-cell :value="$store.state.user.totalIntegral" is-link @click="$pjaxReplace('/platform/integral/records/h5')" class="action-cell">-->
<!-- <span class="cell-title" slot="title">-->
<!-- <van-icon name="points" class="cell-icon"></van-icon>-->
<!-- 我的积分-->
<!-- </span>-->
<!-- </van-cell>-->
</van-cell-group>
</div>
+68 -6
View File
@@ -7,6 +7,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.models.Sys_user_source;
import com.budwk.app.zhgh.welfare.model.WelfareList;
import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
@@ -49,9 +50,9 @@ public class WelfareTest {
@Test
public void importSelectUser() {
List<SelectUser> list = ExcelImportUtil.importExcel(new File("C:\\Users\\jug\\Desktop\\新建文件夹 (2)\\蛋糕汇总表.xlsx"), SelectUser.class, new ImportParams());
List<SelectUser> list = ExcelImportUtil.importExcel(new File("C:\\Users\\administrator\\Desktop\\匹配上生日.xlsx"), SelectUser.class, new ImportParams());
// 福利id
String welfareId = "6b6b438811044d7180b76facaebbe2f3";
String welfareId = "638c6bc84b384fd4a2f64c56faa6a130";
// 福利名单
Sql sql = Sqls.create("""
@@ -170,19 +171,22 @@ public class WelfareTest {
@Test
public void importUser() {
List<SelectUser> allList = ExcelImportUtil.importExcel(new File("C:\\Users\\jug\\Desktop\\南京师范蛋糕卡\\匹配上生日.xlsx"), SelectUser.class, new ImportParams());
List<SelectUser> allList = ExcelImportUtil.importExcel(new File("C:\\Users\\administrator\\Desktop\\匹配上生日.xlsx"), SelectUser.class, new ImportParams());
List<SelectUser> list = allList.stream().filter(v -> StrUtil.isNotBlank(v.getLoginName())).toList();
List<Sys_user> users = dao.query(Sys_user.class, Cnd.NEW());
Map<String, Sys_user> userMap = users.stream().collect(Collectors.toMap(v -> v.getLoginname(), v -> v));
// 福利id
String welfareId = "6b6b438811044d7180b76facaebbe2f3";
String welfareId = "824f43e4286c4d96b8376368c2907be2";
int startMonth = 10;
int endMonth = 12;
List<WelfareProjectSubjectOption> options = dao.query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", welfareId));
Map<String, String> optionMap = options.stream().collect(Collectors.toMap(v -> v.getOptionName(), v -> v.getId()));
// 福利名单
List<WelfareList> welfareLists = list.stream().filter(v -> v.getBirthday().getMonth() + 1 > 6 && v.getBirthday().getMonth() + 1 <= 9).map(v -> {
List<WelfareList> welfareLists = list.stream().filter(v -> v.getBirthday().getMonth() + 1 >= startMonth && v.getBirthday().getMonth() + 1 <= endMonth).map(v -> {
WelfareList welfareList = new WelfareList();
welfareList.setProjectId(welfareId);
if (userMap.get(v.getLoginName()) != null) {
@@ -198,7 +202,7 @@ public class WelfareTest {
}).toList();
// 选择数据
List<WelfareUserSelection> selections = list.stream().filter(v -> v.getBirthday().getMonth() + 1 > 6 && v.getBirthday().getMonth() + 1 <= 9).map(v -> {
List<WelfareUserSelection> selections = list.stream().filter(v -> v.getBirthday().getMonth() + 1 >= startMonth && v.getBirthday().getMonth() + 1 <= endMonth).map(v -> {
WelfareUserSelection selection = new WelfareUserSelection();
selection.setWelfareId(welfareId);
selection.setSelectUserId(userMap.get(v.getLoginName()).getId());
@@ -244,6 +248,64 @@ public class WelfareTest {
}
@Test
public void check() {
List<SelectUser> allList = ExcelImportUtil.importExcel(new File("C:\\Users\\administrator\\Desktop\\匹配上生日.xlsx"), SelectUser.class, new ImportParams());
List<SelectUser> list = allList.stream().filter(v -> StrUtil.isNotBlank(v.getLoginName())).toList();
List<String> loginNames = list.stream().map(v -> v.getLoginName()).toList();
Sql userSql = Sqls.create("select loginname from sys_user");
userSql.setCallback(Sqls.callback.strList());
dao.execute(userSql);
List<String> ss = userSql.getList(String.class);
for (String loginName : loginNames) {
if (!ss.contains(loginName)) {
System.out.println(loginName);
}
}
for (SelectUser selectUser : allList) {
int month = selectUser.getBirthday().getMonth();
System.out.println(month);
}
long count = allList.stream().filter(v -> v.getBirthday().getMonth() + 1 >= 1 && v.getBirthday().getMonth() <= 3).count();
long count2 = allList.stream().filter(v -> v.getBirthday().getMonth() + 1 >= 4 && v.getBirthday().getMonth() <= 6).count();
long count3 = allList.stream().filter(v -> v.getBirthday().getMonth() + 1 >= 7 && v.getBirthday().getMonth() <= 9).count();
System.out.println(count);
System.out.println(count2);
System.out.println(count3);
System.out.println(count + count2 + count3);
}
@Test
public void setMember() {
// List<Sys_user> list = dao.query(Sys_user.class, Cnd.where("loginname", "!=", "superadmin").and("userState","=","在岗"));
// for (Sys_user user : list) {
// user.setMember(true);
// }
// dao.update(list, "member");
List<Sys_user> list = dao.query(Sys_user.class, Cnd.where(Sys_user::getMember, "=", 1));
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "=", "6d603b652abee584ba6274dc1fcee3bb"));
List<Sys_user_role> list1 = list.stream().map(v -> {
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setRoleId("6d603b652abee584ba6274dc1fcee3bb");
sysUserRole.setUserId(v.getId());
return sysUserRole;
}).toList();
dao.insert(list1);
}
}