commit
This commit is contained in:
+1
-1
@@ -209,7 +209,7 @@ public class TourLineController {
|
||||
return Result.error("创建年度不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(line.getTravelAgencyId())) {
|
||||
return Result.error("旅行社名称不能为空");
|
||||
return Result.error("服务单位名称不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(line.getLineName())) {
|
||||
return Result.error("线路名称不能为空");
|
||||
|
||||
+7
-1
@@ -466,7 +466,13 @@ public class TourMySignupController {
|
||||
ledger.setSignupTime(defaultIfBlank(oldLedger.getSignupTime(), ledger.getSignupTime()));
|
||||
fillStaffInfo(ledger);
|
||||
|
||||
tourLedgerService.updateIgnoreNull(ledger);
|
||||
// 修改报名也重新锁定并校验当前分工会名额,兼容人员所属分工会发生变化的场景。
|
||||
String quotaMessage = tourLedgerService.saveWithUnionSignupQuota(
|
||||
ledger, matter.getSettingId(), matter.getId(), SecurityUtil.getUserId(), true);
|
||||
if (StrUtil.isNotBlank(quotaMessage)) {
|
||||
return Result.error(quotaMessage);
|
||||
}
|
||||
|
||||
tourLedgerFamilyService.clear(Cnd.where(TourLedgerFamily::getLedgerId, "=", ledger.getId()));
|
||||
tourLedgerDirectRelativeService.clear(Cnd.where(TourLedgerDirectRelative::getLedgerId, "=", ledger.getId()));
|
||||
if (Lang.isNotEmpty(familyList)) {
|
||||
|
||||
+32
@@ -69,6 +69,8 @@ public class TourSettingController {
|
||||
Cnd lotCnd = Cnd.NEW();
|
||||
lotCnd.desc(TourSettingLot::getLotValue);
|
||||
tourSettingService.dao().fetchLinks(tourSetting, "lots", lotCnd);
|
||||
// 编辑时同时返回分工会人员数量,确保页面按当前组织和人员总数完整回显。
|
||||
tourSetting.setUnionQuotas(tourSettingService.listUnionQuotaRows(id));
|
||||
return Result.success(tourSetting);
|
||||
}
|
||||
|
||||
@@ -89,15 +91,30 @@ public class TourSettingController {
|
||||
Cnd lotCnd = Cnd.NEW();
|
||||
lotCnd.desc(TourSettingLot::getLotValue);
|
||||
tourSettingService.dao().fetchLinks(tourSetting, "lots", lotCnd);
|
||||
// 延用上一年配置时带出原分配数量,前端会清除子表ID后作为新配置提交。
|
||||
tourSetting.setUnionQuotas(tourSettingService.listUnionQuotaRows(tourSetting.getId()));
|
||||
return Result.success(tourSetting);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询人员分配页签所需的全部分工会、当前人员总数和已保存人员数量。
|
||||
*
|
||||
* @param settingId 疗休养配置ID,新增时为空
|
||||
* @return 分工会人员分配行
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("tour.setting")
|
||||
public Result unionQuotaRows(String settingId) {
|
||||
return Result.success(tourSettingService.listUnionQuotaRows(settingId));
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("tour.setting")
|
||||
@SLog(type = "tour", tag = "疗休养设置", msg = "保存疗休养配置")
|
||||
public Result doSubmit(TourSetting tourSetting,
|
||||
@Param(value = "lots") String lots,
|
||||
@Param(value = "unionQuotas") String unionQuotas,
|
||||
@Param(value = "lotDeleteList") String[] lotDeleteList) {
|
||||
Result checkResult = check(tourSetting);
|
||||
if (checkResult != null) {
|
||||
@@ -113,6 +130,14 @@ public class TourSettingController {
|
||||
return Result.error("同年度下配置名称已存在");
|
||||
}
|
||||
|
||||
// 后端再次校验分配总量,避免绕过页面直接提交超出出行人数指标的数据。
|
||||
int travelPeopleQuota = tourSetting.getTravelPeopleQuota() == null
|
||||
? 0 : tourSetting.getTravelPeopleQuota();
|
||||
String quotaLimitMessage = tourSettingService.checkUnionQuotaLimit(unionQuotas, travelPeopleQuota);
|
||||
if (StrUtil.isNotBlank(quotaLimitMessage)) {
|
||||
return Result.error(quotaLimitMessage);
|
||||
}
|
||||
|
||||
// 布尔值给默认值,避免前端未传时出现空状态。
|
||||
if (tourSetting.getEnabled() == null) {
|
||||
tourSetting.setEnabled(true);
|
||||
@@ -148,6 +173,7 @@ public class TourSettingController {
|
||||
} else {
|
||||
tourSettingService.insertWith(tourSetting, "lots");
|
||||
}
|
||||
tourSettingService.saveUnionQuotas(tourSetting.getId(), unionQuotas);
|
||||
} else {
|
||||
// 编辑时先处理页面删除的标段,再保存配置和当前标段行。
|
||||
if (Lang.isNotEmpty(lotDeleteList)) {
|
||||
@@ -155,6 +181,7 @@ public class TourSettingController {
|
||||
}
|
||||
tourSettingService.updateIgnoreNull(tourSetting);
|
||||
saveLots(tourSetting);
|
||||
tourSettingService.saveUnionQuotas(tourSetting.getId(), unionQuotas);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
@@ -168,6 +195,8 @@ public class TourSettingController {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
tourSettingService.dao().clear(TourSettingLot.class, Cnd.where(TourSettingLot::getSettingId, "=", id));
|
||||
// 配置删除时同步清理人员分配,避免遗留不可达的子表数据。
|
||||
tourSettingService.clearUnionQuotas(id);
|
||||
tourSettingService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
@@ -205,6 +234,9 @@ public class TourSettingController {
|
||||
if (StrUtil.isBlank(tourSetting.getConfigName())) {
|
||||
return Result.error("配置名称不能为空");
|
||||
}
|
||||
if (tourSetting.getTravelPeopleQuota() == null || tourSetting.getTravelPeopleQuota() < 0) {
|
||||
return Result.error("出行人数指标必须为非负整数");
|
||||
}
|
||||
if (tourSetting.getMinGroupPeople() != null && tourSetting.getMaxGroupPeople() != null
|
||||
&& tourSetting.getMinGroupPeople() > tourSetting.getMaxGroupPeople()) {
|
||||
return Result.error("最少成团人数不能大于最多成团人数");
|
||||
|
||||
+7
-3
@@ -699,12 +699,16 @@ public class TourSignupController {
|
||||
ledger.setOverCostReimbursed(Boolean.TRUE.equals(ledger.getOverCostReimbursed()));
|
||||
fillStaffInfo(ledger);
|
||||
|
||||
// PC和移动端共用本接口;在写入台账前锁定分工会名额,防止并发报名超过人员分配数量。
|
||||
String quotaMessage = tourLedgerService.saveWithUnionSignupQuota(
|
||||
ledger, matter.getSettingId(), matter.getId(), SecurityUtil.getUserId(), update);
|
||||
if (StrUtil.isNotBlank(quotaMessage)) {
|
||||
return Result.error(quotaMessage);
|
||||
}
|
||||
|
||||
if (update) {
|
||||
tourLedgerService.updateIgnoreNull(ledger);
|
||||
tourLedgerFamilyService.clear(Cnd.where(TourLedgerFamily::getLedgerId, "=", ledger.getId()));
|
||||
tourLedgerDirectRelativeService.clear(Cnd.where(TourLedgerDirectRelative::getLedgerId, "=", ledger.getId()));
|
||||
} else {
|
||||
tourLedgerService.insert(ledger);
|
||||
}
|
||||
if (Lang.isNotEmpty(familyList)) {
|
||||
familyList.forEach(item -> {
|
||||
|
||||
+6
-6
@@ -58,13 +58,13 @@ public class TourTravelAgencyController {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
TourTravelAgency agency = travelAgencyService.fetch(id);
|
||||
return agency == null ? Result.error("旅行社不存在") : Result.success(agency);
|
||||
return agency == null ? Result.error("服务单位不存在") : Result.success(agency);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("tour.travelAgency")
|
||||
@SLog(type = "tour", tag = "旅行社管理", msg = "保存旅行社信息")
|
||||
@SLog(type = "tour", tag = "服务单位管理", msg = "保存服务单位信息")
|
||||
public Result doSubmit(TourTravelAgency agency) {
|
||||
Result checkResult = check(agency);
|
||||
if (checkResult != null) {
|
||||
@@ -77,7 +77,7 @@ public class TourTravelAgencyController {
|
||||
sameCodeCnd.and(TourTravelAgency::getId, "<>", agency.getId());
|
||||
}
|
||||
if (travelAgencyService.count(sameCodeCnd) > 0) {
|
||||
return Result.error("同年度下旅行社编号已存在");
|
||||
return Result.error("同年度下服务单位编号已存在");
|
||||
}
|
||||
if (agency.getEnabled() == null) {
|
||||
agency.setEnabled(true);
|
||||
@@ -93,7 +93,7 @@ public class TourTravelAgencyController {
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("tour.travelAgency")
|
||||
@SLog(type = "tour", tag = "旅行社管理", msg = "删除旅行社信息")
|
||||
@SLog(type = "tour", tag = "服务单位管理", msg = "删除服务单位信息")
|
||||
public Result doDelete(String id) {
|
||||
if (StrUtil.isBlank(id)) {
|
||||
return Result.error("参数错误");
|
||||
@@ -110,10 +110,10 @@ public class TourTravelAgencyController {
|
||||
return Result.error("年度不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(agency.getAgencyName())) {
|
||||
return Result.error("旅行社名称不能为空");
|
||||
return Result.error("服务单位名称不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(agency.getAgencyCode())) {
|
||||
return Result.error("旅行社编号不能为空");
|
||||
return Result.error("服务单位编号不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(agency.getContactName())) {
|
||||
return Result.error("联系人不能为空");
|
||||
|
||||
@@ -102,12 +102,12 @@ public class TourLedger extends BaseModel implements Serializable {
|
||||
private String hotelName;
|
||||
|
||||
@Column
|
||||
@Comment("旅行社ID")
|
||||
@Comment("服务单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String travelAgencyId;
|
||||
|
||||
@Column
|
||||
@Comment("旅行社")
|
||||
@Comment("服务单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String travelAgencyName;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TourLine extends BaseModel implements Serializable {
|
||||
private String lineName;
|
||||
|
||||
@Column
|
||||
@Comment("旅行社ID")
|
||||
@Comment("服务单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String travelAgencyId;
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@ public class TourSetting extends BaseModel implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String tourType;
|
||||
|
||||
@Column
|
||||
@Comment("出行人数指标")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default("0")
|
||||
private Integer travelPeopleQuota;
|
||||
|
||||
@Column
|
||||
@Comment("可参加人员范围ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@@ -122,11 +128,16 @@ public class TourSetting extends BaseModel implements Serializable {
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 标段管理沿用老疗休养配置的子表设计,后续线路、旅行社等模块可通过标段ID继续关联。
|
||||
* 标段管理沿用老疗休养配置的子表设计,后续线路、服务单位等模块可通过标段ID继续关联。
|
||||
*/
|
||||
@Many(field = "settingId")
|
||||
private List<TourSettingLot> lots;
|
||||
|
||||
/**
|
||||
* 分工会人员分配,仅用于配置弹窗回显与提交,不作为 tour_setting 表字段保存。
|
||||
*/
|
||||
private List<TourSettingUnionQuota> unionQuotas;
|
||||
|
||||
@Column
|
||||
@Comment("服务须知")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.budwk.app.zhgh.dayofficework.tour.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.ColDefine;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.entity.annotation.Column;
|
||||
import org.nutz.dao.entity.annotation.Comment;
|
||||
import org.nutz.dao.entity.annotation.Default;
|
||||
import org.nutz.dao.entity.annotation.Name;
|
||||
import org.nutz.dao.entity.annotation.Table;
|
||||
import org.nutz.dao.entity.annotation.TableMeta;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 疗休养配置下的分工会人员数量分配。
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("tour_setting_union_quota")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("疗休养配置分工会人员分配")
|
||||
public class TourSettingUnionQuota extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属疗休养配置ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String settingId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("人员数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default("0")
|
||||
private Integer peopleQuota;
|
||||
|
||||
/**
|
||||
* 当前分工会人员总数,仅用于页面分配参考,不写入数据库。
|
||||
*/
|
||||
private Integer personCount;
|
||||
}
|
||||
@@ -9,14 +9,14 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 旅行社管理。
|
||||
* 先维护疗休养线路创建会复用的旅行社基础信息,后续线路模块可通过旅行社ID关联。
|
||||
* 服务单位管理。
|
||||
* 先维护疗休养线路创建会复用的服务单位基础信息,后续线路模块可通过服务单位ID关联。
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("tour_travel_agency")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("普惠疗休养旅行社")
|
||||
@Comment("普惠疗休养服务单位")
|
||||
public class TourTravelAgency extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@@ -32,12 +32,12 @@ public class TourTravelAgency extends BaseModel implements Serializable {
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@Comment("旅行社编号")
|
||||
@Comment("服务单位编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String agencyCode;
|
||||
|
||||
@Column
|
||||
@Comment("旅行社名称")
|
||||
@Comment("服务单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String agencyName;
|
||||
|
||||
|
||||
@@ -3,5 +3,24 @@ package com.budwk.app.zhgh.dayofficework.tour.service;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.models.TourLedger;
|
||||
|
||||
/**
|
||||
* 疗休养报名台账服务,统一处理报名记录及并发名额校验。
|
||||
*/
|
||||
public interface TourLedgerService extends BaseService<TourLedger> {
|
||||
|
||||
/**
|
||||
* 在同一事务中锁定分工会名额、校验并发容量并写入报名台账。
|
||||
*
|
||||
* @param ledger 待新增或修改的报名台账
|
||||
* @param settingId 疗休养配置ID
|
||||
* @param matterId 当前报名事项ID
|
||||
* @param userId 当前登录用户ID
|
||||
* @param update true 表示修改已有报名,false 表示新增报名
|
||||
* @return 保存成功返回空字符串,否则返回业务提示
|
||||
*/
|
||||
String saveWithUnionSignupQuota(TourLedger ledger,
|
||||
String settingId,
|
||||
String matterId,
|
||||
String userId,
|
||||
boolean update);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,44 @@ package com.budwk.app.zhgh.dayofficework.tour.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.models.TourSetting;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.models.TourSettingUnionQuota;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 疗休养配置服务,统一处理配置及分工会人员数量分配业务。
|
||||
*/
|
||||
public interface TourSettingService extends BaseService<TourSetting> {
|
||||
|
||||
/**
|
||||
* 查询全部分工会在指定配置下的人员数量,并实时补充分工会人员总数。
|
||||
*
|
||||
* @param settingId 疗休养配置ID,新增配置时允许为空
|
||||
* @return 按分工会编码排序的人员分配行
|
||||
*/
|
||||
List<TourSettingUnionQuota> listUnionQuotaRows(String settingId);
|
||||
|
||||
/**
|
||||
* 保存指定配置的分工会人员数量,提交内容为 JSON 数组字符串。
|
||||
*
|
||||
* @param settingId 疗休养配置ID
|
||||
* @param unionQuotas 分工会人员分配 JSON
|
||||
*/
|
||||
void saveUnionQuotas(String settingId, String unionQuotas);
|
||||
|
||||
/**
|
||||
* 校验各分工会人员数量是否均为非负整数且合计不超过出行人数指标。
|
||||
*
|
||||
* @param unionQuotas 分工会人员分配 JSON
|
||||
* @param travelPeopleQuota 出行人数指标
|
||||
* @return 校验通过返回空字符串,否则返回业务提示
|
||||
*/
|
||||
String checkUnionQuotaLimit(String unionQuotas, int travelPeopleQuota);
|
||||
|
||||
/**
|
||||
* 清除指定配置下的全部分工会人员分配。
|
||||
*
|
||||
* @param settingId 疗休养配置ID
|
||||
*/
|
||||
void clearUnionQuotas(String settingId);
|
||||
}
|
||||
|
||||
+121
@@ -1,15 +1,136 @@
|
||||
package com.budwk.app.zhgh.dayofficework.tour.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.models.TourLedger;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.service.TourLedgerService;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* 疗休养报名台账服务实现。
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class TourLedgerServiceImpl extends BaseServiceImpl<TourLedger> implements TourLedgerService {
|
||||
|
||||
public TourLedgerServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public String saveWithUnionSignupQuota(TourLedger ledger,
|
||||
String settingId,
|
||||
String matterId,
|
||||
String userId,
|
||||
boolean update) {
|
||||
if (ledger == null) {
|
||||
return "报名数据不能为空";
|
||||
}
|
||||
String quotaMessage = lockAndCheckUnionSignupQuota(
|
||||
settingId, matterId, userId, update ? ledger.getId() : null);
|
||||
if (StrUtil.isNotBlank(quotaMessage)) {
|
||||
return quotaMessage;
|
||||
}
|
||||
// 名额校验通过后立即在同一事务内写入台账,事务提交前始终持有分工会名额行锁。
|
||||
if (update) {
|
||||
updateIgnoreNull(ledger);
|
||||
} else {
|
||||
insert(ledger);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定当前配置和登录人所属分工会的名额行,并校验报名后是否超过人员数量。
|
||||
*/
|
||||
private String lockAndCheckUnionSignupQuota(String settingId,
|
||||
String matterId,
|
||||
String userId,
|
||||
String excludeLedgerId) {
|
||||
if (StrUtil.isBlank(settingId) || StrUtil.isBlank(matterId)) {
|
||||
return "疗休养配置或报名事项不存在";
|
||||
}
|
||||
// 分工会信息从用户视图读取,不接受报名表单传入的工会ID,防止跨工会占用名额。
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where(View_user::getId, "=", userId));
|
||||
if (user == null || StrUtil.isBlank(user.getUnionId()) || StrUtil.isBlank(user.getLoginname())) {
|
||||
return "未查询到您所属的分工会,不能报名";
|
||||
}
|
||||
|
||||
// FOR UPDATE 串行化同一配置、同一分工会的抢名额请求,不同分工会之间互不阻塞。
|
||||
Sql quotaSql = Sqls.create("""
|
||||
SELECT peopleQuota
|
||||
FROM tour_setting_union_quota
|
||||
WHERE settingId = @settingId
|
||||
AND unionId = @unionId
|
||||
AND delFlag = 0
|
||||
LIMIT 1
|
||||
FOR UPDATE
|
||||
""");
|
||||
quotaSql.setParam("settingId", settingId);
|
||||
quotaSql.setParam("unionId", user.getUnionId());
|
||||
quotaSql.setCallback(Sqls.callback.map());
|
||||
dao().execute(quotaSql);
|
||||
NutMap quotaRow = quotaSql.getObject(NutMap.class);
|
||||
if (quotaRow == null || quotaRow.isEmpty()) {
|
||||
return "您所在分工会未分配报名名额";
|
||||
}
|
||||
int peopleQuota = quotaRow.getInt("peopleQuota", 0);
|
||||
if (peopleQuota <= 0) {
|
||||
return "您所在分工会的报名名额已满";
|
||||
}
|
||||
|
||||
// 取得名额锁后再次检查同事项重复报名,关闭双击或并发请求绕过前置查询的时间窗口。
|
||||
String excludeSql = StrUtil.isBlank(excludeLedgerId) ? "" : " AND id <> @excludeLedgerId";
|
||||
Sql duplicateSql = Sqls.create("""
|
||||
SELECT COUNT(1)
|
||||
FROM tour_ledger
|
||||
WHERE delFlag = 0
|
||||
AND matterId = @matterId
|
||||
AND jobNo = @jobNo
|
||||
""" + excludeSql);
|
||||
duplicateSql.setParam("matterId", matterId);
|
||||
duplicateSql.setParam("jobNo", user.getLoginname());
|
||||
if (StrUtil.isNotBlank(excludeLedgerId)) {
|
||||
duplicateSql.setParam("excludeLedgerId", excludeLedgerId);
|
||||
}
|
||||
duplicateSql.setCallback(Sqls.callback.integer());
|
||||
dao().execute(duplicateSql);
|
||||
if (duplicateSql.getInt() > 0) {
|
||||
return "您已报名当前出行时段,请勿重复提交";
|
||||
}
|
||||
|
||||
// 名额按配置统计,覆盖该配置下的全部事项;待审核报名也占用名额,取消后因台账删除自动释放。
|
||||
String countExcludeSql = StrUtil.isBlank(excludeLedgerId) ? "" : " AND ledger.id <> @excludeLedgerId";
|
||||
Sql countSql = Sqls.create("""
|
||||
SELECT COUNT(1)
|
||||
FROM tour_ledger ledger
|
||||
INNER JOIN tour_matter matter
|
||||
ON matter.id = ledger.matterId
|
||||
AND matter.delFlag = 0
|
||||
WHERE ledger.delFlag = 0
|
||||
AND matter.settingId = @settingId
|
||||
AND ledger.unionId = @unionId
|
||||
""" + countExcludeSql);
|
||||
countSql.setParam("settingId", settingId);
|
||||
countSql.setParam("unionId", user.getUnionId());
|
||||
if (StrUtil.isNotBlank(excludeLedgerId)) {
|
||||
countSql.setParam("excludeLedgerId", excludeLedgerId);
|
||||
}
|
||||
countSql.setCallback(Sqls.callback.integer());
|
||||
dao().execute(countSql);
|
||||
int signupCount = countSql.getInt();
|
||||
if (signupCount + 1 > peopleQuota) {
|
||||
return "您所在分工会的报名名额已满(已报名 " + signupCount
|
||||
+ " 人,分配 " + peopleQuota + " 人)";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
+157
@@ -1,15 +1,172 @@
|
||||
package com.budwk.app.zhgh.dayofficework.tour.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.models.TourSetting;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.models.TourSettingUnionQuota;
|
||||
import com.budwk.app.zhgh.dayofficework.tour.service.TourSettingService;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 疗休养配置服务实现,负责分工会人员分配的查询、校验和持久化。
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class TourSettingServiceImpl extends BaseServiceImpl<TourSetting> implements TourSettingService {
|
||||
|
||||
public TourSettingServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TourSettingUnionQuota> listUnionQuotaRows(String settingId) {
|
||||
// 一次查询分工会、已保存数量和实时人员总数,避免逐个工会统计产生 N+1 查询。
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
quota.id AS id,
|
||||
@settingId AS settingId,
|
||||
un.id AS unionId,
|
||||
un.name AS unionName,
|
||||
COALESCE(quota.peopleQuota, 0) AS peopleQuota,
|
||||
COALESCE(user_count.personCount, 0) AS personCount
|
||||
FROM sys_union un
|
||||
LEFT JOIN tour_setting_union_quota quota
|
||||
ON quota.unionId = un.id
|
||||
AND quota.settingId = @settingId
|
||||
AND COALESCE(quota.delFlag, 0) = 0
|
||||
LEFT JOIN (
|
||||
SELECT unionId, COUNT(1) AS personCount
|
||||
FROM vw_user
|
||||
GROUP BY unionId
|
||||
) user_count ON user_count.unionId = un.id
|
||||
WHERE COALESCE(un.delFlag, 0) = 0
|
||||
ORDER BY un.unionCode ASC
|
||||
""");
|
||||
sql.setParam("settingId", StrUtil.blankToDefault(settingId, ""));
|
||||
List<NutMap> rows = listMap(sql);
|
||||
return rows.stream().map(row -> {
|
||||
TourSettingUnionQuota quota = new TourSettingUnionQuota();
|
||||
quota.setId(row.getString("id"));
|
||||
quota.setSettingId(row.getString("settingId"));
|
||||
quota.setUnionId(row.getString("unionId"));
|
||||
quota.setUnionName(row.getString("unionName"));
|
||||
quota.setPeopleQuota(toNonNegativeInteger(row.getInt("peopleQuota")));
|
||||
quota.setPersonCount(toNonNegativeInteger(row.getInt("personCount")));
|
||||
return quota;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveUnionQuotas(String settingId, String unionQuotas) {
|
||||
if (StrUtil.isBlank(settingId)) {
|
||||
return;
|
||||
}
|
||||
clearUnionQuotas(settingId);
|
||||
if (StrUtil.isBlank(unionQuotas)) {
|
||||
return;
|
||||
}
|
||||
List<TourSettingUnionQuota> quotaList = Json.fromJsonAsList(TourSettingUnionQuota.class, unionQuotas);
|
||||
if (Lang.isEmpty(quotaList)) {
|
||||
return;
|
||||
}
|
||||
// 工会名称以当前组织表为准,防止前端篡改或历史名称继续写入。
|
||||
Map<String, Sys_union> unionMap = dao().query(Sys_union.class,
|
||||
Cnd.where(Sys_union::getDelFlag, "=", false)).stream()
|
||||
.collect(Collectors.toMap(Sys_union::getId, item -> item, (first, second) -> first));
|
||||
List<TourSettingUnionQuota> saveList = quotaList.stream()
|
||||
.filter(item -> item != null
|
||||
&& StrUtil.isNotBlank(item.getUnionId())
|
||||
&& unionMap.containsKey(item.getUnionId()))
|
||||
.map(item -> normalizeUnionQuota(settingId, item, unionMap))
|
||||
.filter(item -> item.getPeopleQuota() > 0)
|
||||
.collect(Collectors.toList());
|
||||
if (Lang.isNotEmpty(saveList)) {
|
||||
dao().insert(saveList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkUnionQuotaLimit(String unionQuotas, int travelPeopleQuota) {
|
||||
if (StrUtil.isBlank(unionQuotas)) {
|
||||
return "";
|
||||
}
|
||||
final List<TourSettingUnionQuota> quotaList;
|
||||
try {
|
||||
quotaList = Json.fromJsonAsList(TourSettingUnionQuota.class, unionQuotas);
|
||||
} catch (Exception e) {
|
||||
return "人员分配数据格式不正确";
|
||||
}
|
||||
if (Lang.isEmpty(quotaList)) {
|
||||
return "";
|
||||
}
|
||||
long total = 0L;
|
||||
Set<String> unionIds = new HashSet<>();
|
||||
Set<String> validUnionIds = dao().query(Sys_union.class,
|
||||
Cnd.where(Sys_union::getDelFlag, "=", false)).stream()
|
||||
.map(Sys_union::getId)
|
||||
.collect(Collectors.toSet());
|
||||
for (int index = 0; index < quotaList.size(); index++) {
|
||||
TourSettingUnionQuota quota = quotaList.get(index);
|
||||
if (quota == null || quota.getPeopleQuota() == null) {
|
||||
continue;
|
||||
}
|
||||
// 工会ID必须来自当前组织表且不能重复,防止伪造行绕过总量和组织范围校验。
|
||||
if (StrUtil.isBlank(quota.getUnionId())
|
||||
|| !validUnionIds.contains(quota.getUnionId())
|
||||
|| !unionIds.add(quota.getUnionId())) {
|
||||
return "第" + (index + 1) + "行分工会信息无效或重复";
|
||||
}
|
||||
if (quota.getPeopleQuota() < 0) {
|
||||
return "第" + (index + 1) + "行人员数量必须为非负整数";
|
||||
}
|
||||
total += quota.getPeopleQuota();
|
||||
}
|
||||
if (total > travelPeopleQuota) {
|
||||
return "当前人员数量合计 " + total + ",不能超过出行人数指标 " + travelPeopleQuota;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearUnionQuotas(String settingId) {
|
||||
if (StrUtil.isNotBlank(settingId)) {
|
||||
dao().clear(TourSettingUnionQuota.class,
|
||||
Cnd.where(TourSettingUnionQuota::getSettingId, "=", settingId));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将前端分配行转换为可信的持久化对象,只接受当前组织表中的工会名称。
|
||||
*/
|
||||
private TourSettingUnionQuota normalizeUnionQuota(String settingId,
|
||||
TourSettingUnionQuota item,
|
||||
Map<String, Sys_union> unionMap) {
|
||||
Sys_union union = unionMap.get(item.getUnionId());
|
||||
TourSettingUnionQuota quota = new TourSettingUnionQuota();
|
||||
quota.setSettingId(settingId);
|
||||
quota.setUnionId(item.getUnionId());
|
||||
quota.setUnionName(union.getName());
|
||||
quota.setPeopleQuota(toNonNegativeInteger(item.getPeopleQuota()));
|
||||
return quota;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将空值或负数统一转换为零,保证页面统计和数据库保存使用相同口径。
|
||||
*/
|
||||
private Integer toNonNegativeInteger(Integer value) {
|
||||
return value == null || value < 0 ? 0 : value;
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -8,6 +8,7 @@ import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalType;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -33,6 +34,8 @@ public class ProposalConfigTypeController {
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/config/type/index.html")
|
||||
@@ -47,6 +50,8 @@ public class ProposalConfigTypeController {
|
||||
Sql sql = Sqls.create("select * from proposal_type $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(Cnd.likeEX("name", name));
|
||||
// 提案类型列表只允许名称和编码参与排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "configType");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageVO(pageForm, sql, ProposalType.class);
|
||||
return Result.success(pagination);
|
||||
|
||||
+7
-1
@@ -19,6 +19,7 @@ import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -54,6 +55,8 @@ public class ProposalConfigUnitController {
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/config/unit/index.html")
|
||||
@@ -99,7 +102,10 @@ public class ProposalConfigUnitController {
|
||||
cnd.where().orLike("u2.loginname", pageForm.getSearchKeyword());
|
||||
cnd.where().orLike("t1.name", pageForm.getSearchKeyword());
|
||||
}
|
||||
cnd.asc("t1.code");
|
||||
// 承办单位列表未指定有效排序时继续按单位编码升序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "configUnit")) {
|
||||
cnd.asc("t1.code");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+20
@@ -28,6 +28,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/dashboard")
|
||||
@@ -35,6 +36,23 @@ import java.util.List;
|
||||
@Ok("json:full")
|
||||
public class ProposalDashboardController {
|
||||
|
||||
/**
|
||||
* 工作台表格允许排序的字段映射,值为查询中的真实字段或安全别名。
|
||||
*/
|
||||
private static final Map<String, String> DASHBOARD_ORDER_COLUMNS = Map.ofEntries(
|
||||
Map.entry("code", "info.code"),
|
||||
Map.entry("name", "info.name"),
|
||||
Map.entry("createUserName", "info.createUserName"),
|
||||
Map.entry("typeName", "typeName"),
|
||||
Map.entry("delegationName", "delegationName"),
|
||||
Map.entry("caseFilingResult", "info.caseFilingResult"),
|
||||
Map.entry("isConsolidation", "info.isConsolidation"),
|
||||
Map.entry("masterUnitName", "masterUnitName"),
|
||||
Map.entry("slaveUnitNames", "slaveUnitNames"),
|
||||
Map.entry("curTaskName", "curTaskName"),
|
||||
Map.entry("instanceState", "instanceState")
|
||||
);
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
@@ -178,6 +196,8 @@ public class ProposalDashboardController {
|
||||
}
|
||||
}
|
||||
|
||||
// 根据工作台字段白名单追加排序,未选择排序时保持原有查询顺序。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, DASHBOARD_ORDER_COLUMNS);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+5
@@ -7,6 +7,7 @@ import com.budwk.app.base.param.ExportTableColumns;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalQueryComprehensiveParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalExportService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -29,6 +30,8 @@ public class ProposalExportComprehensiveController {
|
||||
|
||||
@Inject
|
||||
private ProposalExportService proposalExportService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/export/comprehensive/index.html")
|
||||
@@ -73,6 +76,8 @@ public class ProposalExportComprehensiveController {
|
||||
}
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 综合导出主列表的聚合字段仅通过固定查询别名排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "exportComprehensive");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalExportService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+7
-1
@@ -17,6 +17,7 @@ import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.vo.ProcessTaskVO;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
@@ -63,6 +64,8 @@ public class ProposalExportSingleCustomController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@@ -100,7 +103,10 @@ public class ProposalExportSingleCustomController {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
cnd.desc("info.createdAt");
|
||||
// 自定义导出列表未指定有效排序时保留提案创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "exportSingleCustom")) {
|
||||
cnd.desc("info.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+59
-22
@@ -6,11 +6,13 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -31,6 +33,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@@ -40,10 +43,26 @@ import java.util.stream.Collectors;
|
||||
@Api(tags = "提案统计分析")
|
||||
public class ProposalQueryAnalysisController {
|
||||
|
||||
/**
|
||||
* 统计数据表允许排序的字段白名单。
|
||||
*/
|
||||
private static final Set<String> STATISTICS_ORDER_COLUMNS = Set.of(
|
||||
"dimension", "itemName", "count", "rate"
|
||||
);
|
||||
|
||||
/**
|
||||
* 分析数据表允许排序的字段白名单。
|
||||
*/
|
||||
private static final Set<String> ANALYSIS_ORDER_COLUMNS = Set.of(
|
||||
"dimension", "total", "categoryCount", "topItem", "topCount", "topRate", "analysis"
|
||||
);
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/query/analysis/index.html")
|
||||
@@ -51,36 +70,54 @@ public class ProposalQueryAnalysisController {
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询提案统计数据。
|
||||
*
|
||||
* @param sessionId 教代会届次ID
|
||||
* @param dimension 统计维度,为空时返回全部维度
|
||||
* @param statisticsOrderName 统计表排序字段
|
||||
* @param statisticsOrderBy 统计表排序方向
|
||||
* @return 统计行列表,包含维度、分类项、数量和占比
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("统计数据")
|
||||
@SaCheckPermission("proposal.query.analysis")
|
||||
public Result statisticsData(String sessionId, String dimension) {
|
||||
/*
|
||||
* 查询参数说明:
|
||||
* sessionId:教代会届次ID,用于限定统计提案范围;
|
||||
* dimension:统计维度,可传“提案人单位、提案类型、代表团、立案结果、满意度”,为空时返回全部维度。
|
||||
* 返回值:Result.data 为统计行列表,包含 dimension、itemName、count、rate。
|
||||
*/
|
||||
public Result statisticsData(String sessionId, String dimension, String statisticsOrderName, String statisticsOrderBy) {
|
||||
if (StrUtil.isBlank(sessionId)) {
|
||||
return Result.error("请先选择教代会届次");
|
||||
}
|
||||
return Result.success(buildStatisticsRows(sessionId, dimension));
|
||||
List<NutMap> rows = buildStatisticsRows(sessionId, dimension);
|
||||
PageForm orderForm = new PageForm();
|
||||
orderForm.setPageOrderName(statisticsOrderName);
|
||||
orderForm.setPageOrderBy(statisticsOrderBy);
|
||||
// 统计数据生成后按独立白名单执行后端排序。
|
||||
proposalCommonService.sortStatisticsRows(rows, orderForm, STATISTICS_ORDER_COLUMNS);
|
||||
return Result.success(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询提案分析数据。
|
||||
*
|
||||
* @param sessionId 教代会届次ID
|
||||
* @param dimension 统计维度,为空时返回全部维度
|
||||
* @param analysisOrderName 分析表排序字段
|
||||
* @param analysisOrderBy 分析表排序方向
|
||||
* @return 分析行列表,包含总量、最高项、最高占比和分析结论
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("分析数据")
|
||||
@SaCheckPermission("proposal.query.analysis")
|
||||
public Result analysisData(String sessionId, String dimension) {
|
||||
/*
|
||||
* 查询参数说明:
|
||||
* sessionId:教代会届次ID,用于限定分析提案范围;
|
||||
* dimension:统计维度,可传“提案人单位、提案类型、代表团、立案结果、满意度”,为空时返回全部维度。
|
||||
* 返回值:Result.data 为分析行列表,包含 dimension、total、categoryCount、topItem、topCount、topRate、analysis。
|
||||
*/
|
||||
public Result analysisData(String sessionId, String dimension, String analysisOrderName, String analysisOrderBy) {
|
||||
if (StrUtil.isBlank(sessionId)) {
|
||||
return Result.error("请先选择教代会届次");
|
||||
}
|
||||
return Result.success(buildAnalysisRows(sessionId, dimension));
|
||||
List<NutMap> rows = buildAnalysisRows(sessionId, dimension);
|
||||
PageForm orderForm = new PageForm();
|
||||
orderForm.setPageOrderName(analysisOrderName);
|
||||
orderForm.setPageOrderBy(analysisOrderBy);
|
||||
// 分析数据生成后按独立白名单执行后端排序。
|
||||
proposalCommonService.sortStatisticsRows(rows, orderForm, ANALYSIS_ORDER_COLUMNS);
|
||||
return Result.success(rows);
|
||||
}
|
||||
|
||||
@At
|
||||
@@ -94,9 +131,9 @@ public class ProposalQueryAnalysisController {
|
||||
entities.add(new ExcelExportEntity("分类项", "itemName", 30));
|
||||
entities.add(new ExcelExportEntity("数量", "count", 12));
|
||||
entities.add(new ExcelExportEntity("占比", "rate", 12));
|
||||
ExportParams params = new ExportParams();
|
||||
params.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, entities, list);
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list);
|
||||
CommonDownloadUtil.download("提案统计数据.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
@@ -114,9 +151,9 @@ public class ProposalQueryAnalysisController {
|
||||
entities.add(new ExcelExportEntity("最高数量", "topCount", 12));
|
||||
entities.add(new ExcelExportEntity("最高占比", "topRate", 12));
|
||||
entities.add(new ExcelExportEntity("分析结论", "analysis", 60));
|
||||
ExportParams params = new ExportParams();
|
||||
params.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, entities, list);
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list);
|
||||
CommonDownloadUtil.download("提案分析数据.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
|
||||
+19
-1
@@ -27,6 +27,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@IocBean
|
||||
@@ -36,6 +37,20 @@ import java.util.List;
|
||||
@Api(tags = "征集进度查询")
|
||||
public class ProposalQueryCollectProgressController {
|
||||
|
||||
/**
|
||||
* 征集进度表格允许排序的字段映射,值为查询中的真实字段或安全别名。
|
||||
*/
|
||||
private static final Map<String, String> COLLECT_PROGRESS_ORDER_COLUMNS = Map.ofEntries(
|
||||
Map.entry("code", "info.code"),
|
||||
Map.entry("name", "info.name"),
|
||||
Map.entry("createUserName", "info.createUserName"),
|
||||
Map.entry("delegationName", "delegationName"),
|
||||
Map.entry("inviteCount", "inviteCount"),
|
||||
Map.entry("finishCount", "finishCount"),
|
||||
Map.entry("curTaskName", "curTaskName"),
|
||||
Map.entry("instanceState", "instanceState")
|
||||
);
|
||||
|
||||
static List<NutMap> states = new ArrayList<>() {{
|
||||
add(NutMap.NEW().addv("code", 10).addv("id", 10).addv("name", "撰写提案"));
|
||||
add(NutMap.NEW().addv("code", 20).addv("id", 20).addv("name", "附议提案"));
|
||||
@@ -83,8 +98,9 @@ public class ProposalQueryCollectProgressController {
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("sessionId", pageForm.getSessionId());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 征集进度必须按页面选中的教代会过滤,避免共享参数未处理sessionId导致跨届次查询。
|
||||
cnd.andEX("info.sessionId", "=", pageForm.getSessionId());
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
@@ -106,6 +122,8 @@ public class ProposalQueryCollectProgressController {
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.groupBy("info.id");
|
||||
// 征集进度包含关联字段和人数统计别名,只允许白名单字段进入排序条件。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, COLLECT_PROGRESS_ORDER_COLUMNS);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = (List<NutMap>) pagination.getList();
|
||||
|
||||
+22
-1
@@ -25,6 +25,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/query/comprehensive")
|
||||
@@ -33,6 +34,23 @@ import java.util.Arrays;
|
||||
@Api(tags = "提案综合查询")
|
||||
public class ProposalQueryComprehensiveController {
|
||||
|
||||
/**
|
||||
* 综合查询表格允许排序的字段映射,值为查询中的真实字段或安全别名。
|
||||
*/
|
||||
private static final Map<String, String> COMPREHENSIVE_ORDER_COLUMNS = Map.ofEntries(
|
||||
Map.entry("code", "info.code"),
|
||||
Map.entry("name", "info.name"),
|
||||
Map.entry("createUserName", "info.createUserName"),
|
||||
Map.entry("typeName", "typeName"),
|
||||
Map.entry("delegationName", "delegationName"),
|
||||
Map.entry("caseFilingResult", "info.caseFilingResult"),
|
||||
Map.entry("caseFilingType", "info.caseFilingType"),
|
||||
Map.entry("merge", "merge"),
|
||||
Map.entry("undertakeUnits", "undertakeUnitsOrder"),
|
||||
Map.entry("curTaskName", "curTaskName"),
|
||||
Map.entry("instanceState", "instanceState")
|
||||
);
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
@@ -62,7 +80,8 @@ public class ProposalQueryComprehensiveController {
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 1 THEN pru.unitName END) AS masterUnitName,
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 0 THEN pru.unitName END) AS slaveUnitNames
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 0 THEN pru.unitName END) AS slaveUnitNames,
|
||||
GROUP_CONCAT(DISTINCT pru.unitName ORDER BY pru.isMaster DESC, pru.unitName) AS undertakeUnitsOrder
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
@@ -120,6 +139,8 @@ public class ProposalQueryComprehensiveController {
|
||||
}
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 综合查询包含多表字段及聚合别名,只允许白名单字段进入排序条件。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, COMPREHENSIVE_ORDER_COLUMNS);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+68
-10
@@ -1,13 +1,16 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.query;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -19,8 +22,10 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/query/delegation")
|
||||
@@ -29,9 +34,34 @@ import java.util.stream.Collectors;
|
||||
@Api(tags = "代表团提案统计")
|
||||
public class ProposalQueryDelegationController {
|
||||
|
||||
/**
|
||||
* 代表团汇总表固定列的安全排序映射,动态立案结果列在查询时追加。
|
||||
*/
|
||||
private static final Map<String, String> DELEGATION_SUMMARY_ORDER_COLUMNS = Map.of(
|
||||
"dbtName", "dbt.name",
|
||||
"TOTAL", "TOTAL",
|
||||
"caseRate", "caseRateOrder"
|
||||
);
|
||||
|
||||
/**
|
||||
* 代表团提案明细表允许排序的字段映射。
|
||||
*/
|
||||
private static final Map<String, String> DELEGATION_PROPOSAL_ORDER_COLUMNS = Map.ofEntries(
|
||||
Map.entry("code", "info.code"),
|
||||
Map.entry("name", "info.name"),
|
||||
Map.entry("createUserName", "info.createUserName"),
|
||||
Map.entry("typeName", "typeName"),
|
||||
Map.entry("sessionName", "sessionName"),
|
||||
Map.entry("delegationName", "delegationName"),
|
||||
Map.entry("curTaskName", "curTaskName")
|
||||
);
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@@ -46,28 +76,45 @@ public class ProposalQueryDelegationController {
|
||||
@At
|
||||
@ApiOperation("代表团提案统计")
|
||||
@SaCheckPermission("proposal.query.delegation")
|
||||
public Result pageData(String sessionId) {
|
||||
public Result pageData(PageForm pageForm, String sessionId) {
|
||||
List<Sys_dict> dictList = sysDictService.getSubListByCode("PROPOSAL_CASE_FILING_RESULT");
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.id,
|
||||
dbt.`name` AS dbtName,
|
||||
(select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId ) as TOTAL,
|
||||
(select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId and info.isSubmit = 1 ) as SUBMIT_COUNT,
|
||||
$resultSql
|
||||
(select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId and info.isSubmit = 1 ) as SUBMIT_COUNT
|
||||
$resultSql,
|
||||
(select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId and info.caseFilingResult = @confirmFiling)
|
||||
/ NULLIF((select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId), 0) AS caseRateOrder
|
||||
FROM
|
||||
teacher_congress_delegation dbt
|
||||
$condition
|
||||
""");
|
||||
String resultStr = dictList.stream().map(v -> {
|
||||
return "( select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId and info.caseFilingResult= '%s' ) as `%s`".formatted(v.getCode(), v.getCode());
|
||||
}).collect(Collectors.joining(","));
|
||||
sql.setVar("resultSql", resultStr);
|
||||
Map<String, String> summaryOrderColumns = new HashMap<>(DELEGATION_SUMMARY_ORDER_COLUMNS);
|
||||
List<String> resultSqlParts = new ArrayList<>();
|
||||
int resultIndex = 0;
|
||||
for (Sys_dict dict : dictList) {
|
||||
String resultCode = dict.getCode();
|
||||
// 动态别名仅允许字母、数字和下划线,查询值使用参数绑定,避免字典内容进入SQL结构。
|
||||
if (StrUtil.isBlank(resultCode) || !resultCode.matches("[A-Za-z0-9_]+")) {
|
||||
continue;
|
||||
}
|
||||
String paramName = "caseFilingResult" + resultIndex++;
|
||||
resultSqlParts.add(", (select count(1) from proposal_info info where info.delegationId = dbt.id and info.sessionId = dbt.sessionId and info.caseFilingResult = @" + paramName + ") AS `" + resultCode + "`");
|
||||
sql.setParam(paramName, resultCode);
|
||||
summaryOrderColumns.put(resultCode, "`" + resultCode + "`");
|
||||
}
|
||||
sql.setVar("resultSql", String.join("", resultSqlParts));
|
||||
sql.setParam("confirmFiling", "CONFIRM_FILING");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt.sessionId", "=", sessionId);
|
||||
if (!AuthUtil.hasRoleOr("SYSADMIN", "SCHOOL_UNION_ADMIN")) {
|
||||
}
|
||||
cnd.asc("dbt.`code`");
|
||||
// 未选择排序时保留原有代表团编码升序,选择后仅应用白名单字段。
|
||||
if (!proposalCommonService.applySafePageOrder(cnd, pageForm, summaryOrderColumns)) {
|
||||
cnd.asc("dbt.`code`");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listMap(sql));
|
||||
}
|
||||
@@ -101,7 +148,18 @@ public class ProposalQueryDelegationController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
// 先应用明细字段白名单,再隔离公共搜索中的原始排序处理,阻止任意字段进入SQL。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, DELEGATION_PROPOSAL_ORDER_COLUMNS);
|
||||
String requestedOrderName = pageForm.getPageOrderName();
|
||||
String requestedOrderBy = pageForm.getPageOrderBy();
|
||||
pageForm.setPageOrderName(null);
|
||||
pageForm.setPageOrderBy(null);
|
||||
try {
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
} finally {
|
||||
pageForm.setPageOrderName(requestedOrderName);
|
||||
pageForm.setPageOrderBy(requestedOrderBy);
|
||||
}
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
+25
-1
@@ -5,6 +5,7 @@ import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalQueryComprehensiveParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -18,6 +19,7 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/query/history")
|
||||
@@ -26,8 +28,27 @@ import javax.validation.Valid;
|
||||
@Api(tags = "提案管理系统-查询统计-历史提案查询")
|
||||
public class ProposalQueryHistoryController {
|
||||
|
||||
/**
|
||||
* 历史提案表格允许排序的字段映射,值为查询中的真实字段或安全别名。
|
||||
*/
|
||||
private static final Map<String, String> HISTORY_ORDER_COLUMNS = Map.ofEntries(
|
||||
Map.entry("code", "info.code"),
|
||||
Map.entry("name", "info.name"),
|
||||
Map.entry("createUserName", "info.createUserName"),
|
||||
Map.entry("sessionName", "sessionName"),
|
||||
Map.entry("delegationName", "delegationName"),
|
||||
Map.entry("caseFilingResult", "info.caseFilingResult"),
|
||||
Map.entry("caseFilingType", "info.caseFilingType"),
|
||||
Map.entry("merge", "merge"),
|
||||
Map.entry("undertakeUnits", "undertakeUnitsOrder"),
|
||||
Map.entry("curTaskName", "curTaskName"),
|
||||
Map.entry("instanceState", "instanceState")
|
||||
);
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/query/history/index.html")
|
||||
@@ -53,7 +74,8 @@ public class ProposalQueryHistoryController {
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 1 THEN pru.unitName END) AS masterUnitName,
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 0 THEN pru.unitName END) AS slaveUnitNames
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 0 THEN pru.unitName END) AS slaveUnitNames,
|
||||
GROUP_CONCAT(DISTINCT pru.unitName ORDER BY pru.isMaster DESC, pru.unitName) AS undertakeUnitsOrder
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
@@ -69,6 +91,8 @@ public class ProposalQueryHistoryController {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 历史查询包含多表字段及聚合别名,只允许白名单字段进入排序条件。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, HISTORY_ORDER_COLUMNS);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+14
-1
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.query;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.engine.util.FlowUtil;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
@@ -31,6 +32,15 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class ProposalQueryUnitReplyController {
|
||||
|
||||
/**
|
||||
* 承办单位办理统计允许排序的字段白名单。
|
||||
*/
|
||||
private static final Set<String> UNIT_REPLY_ORDER_COLUMNS = Set.of(
|
||||
"unitName", "sum", "masterSum", "masterReplySum", "masterNoReplySum",
|
||||
"slaveSum", "slaveReplySum", "slaveNoReplySum"
|
||||
);
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
@@ -45,9 +55,10 @@ public class ProposalQueryUnitReplyController {
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.query.unitReply")
|
||||
public Result data(String sessionId, String undertakeUnitId, String caseFilingResult) {
|
||||
public Result data(PageForm pageForm, String sessionId, String undertakeUnitId, String caseFilingResult) {
|
||||
/*
|
||||
* 查询参数说明:
|
||||
* pageForm:表格排序字段和排序方向;
|
||||
* sessionId:教代会届次ID,用于限定统计的提案范围;
|
||||
* undertakeUnitId:承办单位ID,用于只统计某个承办单位,为空时统计全部承办单位;
|
||||
* caseFilingResult:立案结果字典值,对应 proposal_info.caseFilingResult,为空时不限制立案结果。
|
||||
@@ -139,6 +150,8 @@ public class ProposalQueryUnitReplyController {
|
||||
tableData.add(tableRow);
|
||||
});
|
||||
|
||||
// 统计结果生成后在服务层按白名单字段排序,避免前端字段参与任意业务处理。
|
||||
proposalCommonService.sortStatisticsRows(tableData, pageForm, UNIT_REPLY_ORDER_COLUMNS);
|
||||
return Result.success().addData(Map.of("tableData", tableData, "slaveNeedReply", slaveNeedReply));
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -21,6 +21,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/query/yearReport")
|
||||
@@ -29,6 +30,22 @@ import javax.validation.Valid;
|
||||
@Api(tags = "提案年度报告")
|
||||
public class ProposalQueryYearReportController {
|
||||
|
||||
/**
|
||||
* 年度报告表格允许排序的字段映射,值为查询中的真实字段或安全别名。
|
||||
*/
|
||||
private static final Map<String, String> YEAR_REPORT_ORDER_COLUMNS = Map.ofEntries(
|
||||
Map.entry("code", "info.code"),
|
||||
Map.entry("name", "info.name"),
|
||||
Map.entry("createUserName", "info.createUserName"),
|
||||
Map.entry("typeName", "typeName"),
|
||||
Map.entry("delegationName", "delegationName"),
|
||||
Map.entry("caseFilingResult", "info.caseFilingResult"),
|
||||
Map.entry("isConsolidation", "info.isConsolidation"),
|
||||
Map.entry("undertakeUnits", "undertakeUnitsOrder"),
|
||||
Map.entry("curTaskName", "curTaskName"),
|
||||
Map.entry("instanceState", "instanceState")
|
||||
);
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@@ -56,7 +73,8 @@ public class ProposalQueryYearReportController {
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 1 THEN pru.unitName END) AS masterUnitName,
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 0 THEN pru.unitName END) AS slaveUnitNames
|
||||
GROUP_CONCAT(DISTINCT CASE WHEN pru.isMaster = 0 THEN pru.unitName END) AS slaveUnitNames,
|
||||
GROUP_CONCAT(DISTINCT pru.unitName ORDER BY pru.isMaster DESC, pru.unitName) AS undertakeUnitsOrder
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
@@ -70,8 +88,12 @@ public class ProposalQueryYearReportController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 年度报告必须按页面选中的教代会过滤,避免共享参数未处理sessionId导致跨届次查询。
|
||||
cnd.andEX("info.sessionId", "=", pageForm.getSessionId());
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 年度报告包含多表字段及聚合别名,只允许白名单字段进入排序条件。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, YEAR_REPORT_ORDER_COLUMNS);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+29
-1
@@ -1,6 +1,8 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.query;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.engine.util.FlowUtil;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
@@ -10,6 +12,7 @@ import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalReplyUnit;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -30,10 +33,19 @@ import java.util.stream.Collectors;
|
||||
@Api(tags = "提案承办单位满意度")
|
||||
public class ProposalUnderTakeSatisfactionController {
|
||||
|
||||
/**
|
||||
* 满意度统计固定列的排序白名单,动态满意度列在查询时追加。
|
||||
*/
|
||||
private static final Set<String> SATISFACTION_ORDER_COLUMNS = Set.of(
|
||||
"unitName", "sum", "masterSum", "slaveSum"
|
||||
);
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/query/underTakeSatisfaction/index.html")
|
||||
@@ -42,10 +54,24 @@ public class ProposalUnderTakeSatisfactionController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询指定教代会和承办单位的满意度统计结果。
|
||||
*
|
||||
* @param pageForm 表格排序参数
|
||||
* @param sessionId 教代会届次ID
|
||||
* @param undertakeUnitId 承办单位ID
|
||||
* @return 满意度统计结果
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("proposal.query.underTake.satisfaction")
|
||||
public Result data(String sessionId, String undertakeUnitId) {
|
||||
public Result data(PageForm pageForm, String sessionId, String undertakeUnitId) {
|
||||
List<Sys_dict> feedbackCodes = sysDictService.getSubListByCode("PROPOSAL_FEEDBACK");
|
||||
Set<String> orderColumns = new HashSet<>(SATISFACTION_ORDER_COLUMNS);
|
||||
// 动态满意度列仅从后端字典加入白名单,不接受前端自行扩展字段。
|
||||
feedbackCodes.stream()
|
||||
.map(Sys_dict::getCode)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.forEach(orderColumns::add);
|
||||
|
||||
// 当前届次所有的提案ID
|
||||
Sql sql = Sqls.create("select id from proposal_info where sessionId = @sessionId").setParam("sessionId", sessionId);
|
||||
@@ -109,6 +135,8 @@ public class ProposalUnderTakeSatisfactionController {
|
||||
tableData.add(tableRow);
|
||||
});
|
||||
|
||||
// 汇总完成后在服务层执行白名单排序,数字列按数值顺序处理。
|
||||
proposalCommonService.sortStatisticsRows(tableData, pageForm, orderColumns);
|
||||
return Result.success(tableData);
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -111,7 +111,10 @@ public class ProposalExpeditingController {
|
||||
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 提案催办列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "expediting")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -78,6 +78,8 @@ public class ProposalSeniorBasicController {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 内容修改列表仅允许页面展示字段参与排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "seniorBasic");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -78,6 +78,8 @@ public class ProposalSeniorDeleteController {
|
||||
}
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 高级删除列表仅允许页面展示字段参与排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "seniorDelete");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -93,6 +93,8 @@ public class ProposalSeniorFeedBackController {
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
// cnd.and("latestFeedBack.id","is not",null);
|
||||
cnd.groupBy("info.id");
|
||||
// 反馈评分修改列表包含反馈计算列,使用页面独立白名单排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "seniorFeedback");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -82,6 +82,8 @@ public class ProposalSeniorTypeController {
|
||||
}
|
||||
ProposalQueryComprehensiveParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
// 类型修改列表仅允许页面展示字段参与排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "seniorType");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+11
-4
@@ -5,23 +5,23 @@ import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
@@ -39,6 +39,8 @@ public class ProposalAllFinishedController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/allFinished/index.html")
|
||||
@@ -62,7 +64,9 @@ public class ProposalAllFinishedController {
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId
|
||||
FROM wf_process_instance ins
|
||||
LEFT JOIN proposal_info info ON info.id = ins.businessNo
|
||||
/* Limit all-finished data to proposal workflow instances and discard other module instances. */
|
||||
INNER JOIN wf_process_define def ON def.id = ins.processDefineId AND def.name = 'JDHTA_NC'
|
||||
INNER JOIN proposal_info info ON info.id = ins.businessNo
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
@@ -72,9 +76,12 @@ public class ProposalAllFinishedController {
|
||||
cnd.and("ins.state", "=", "20");
|
||||
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
// Non-admin users can only see proposal flows where they participated in at least one task.
|
||||
cnd.and(new Static("EXISTS (SELECT 1 FROM wf_process_task wt INNER JOIN wf_process_task_actor wta ON wta.processTaskId = wt.id WHERE wt.processInstanceId = ins.id AND wta.actorId = '" + SecurityUtil.getUserId() + "')"));
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
// 已办结列表仅允许页面展示字段参与排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "allFinished");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+7
-1
@@ -10,6 +10,7 @@ import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalCaseCheckService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -42,6 +43,8 @@ public class ProposalCaseCheckController {
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCaseCheckService proposalCaseCheckService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/caseCheck/index.html")
|
||||
@@ -104,7 +107,10 @@ public class ProposalCaseCheckController {
|
||||
cnd.andEX("vu.unionId", "=", pageForm.getUnionId());
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 委员会审查列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "caseCheck")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+4
-1
@@ -85,7 +85,10 @@ public class ProposalCommissionerController {
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.and("pco.id", approval ? "is not" : "is", null);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 委员查询包含统计列,未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "commissioner")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+7
-1
@@ -10,6 +10,7 @@ import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalCommitteeFilingService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -40,6 +41,8 @@ public class ProposalCommitteeFilingController {
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ProposalCommitteeFilingService proposalCommitteeFilingService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/committeeFiling/index.html")
|
||||
@@ -102,7 +105,10 @@ public class ProposalCommitteeFilingController {
|
||||
cnd.andEX("vu.unionId", "=", pageForm.getUnionId());
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 立案审核列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "committeeFiling")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommitteeFilingService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+4
-1
@@ -118,7 +118,10 @@ public class ProposalCommitteeFilingUnitController {
|
||||
cnd.andEX("vu.unionId", "=", pageForm.getUnionId());
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 确认承办单位列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "committeeFilingUnit")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommitteeFilingUnitService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+7
-1
@@ -10,6 +10,7 @@ import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -33,6 +34,8 @@ public class ProposalControlController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/control/index.html")
|
||||
@@ -84,7 +87,10 @@ public class ProposalControlController {
|
||||
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 状态调整列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "control")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+4
-1
@@ -118,7 +118,10 @@ public class ProposalDelegationController {
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 团长审核列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "delegation")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+4
-1
@@ -107,7 +107,10 @@ public class ProposalFeedbackEvaluationController {
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 反馈评分列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "feedbackEvaluation")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
-4
@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
@@ -99,10 +98,9 @@ public class ProposalInviteController {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
// 页面排序仅使用邀请列表白名单,未指定有效字段时保留创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "invite")) {
|
||||
cnd.desc("info.createdAt");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
+26
@@ -62,6 +62,28 @@ import java.util.Objects;
|
||||
@Ok("json:full")
|
||||
@Api(tags = "提案管理-我的提案")
|
||||
public class ProposalMineController {
|
||||
/** 我的提案列表允许排序的页面字段与 SQL 字段映射。 */
|
||||
private static final Map<String, String> MINE_ORDER_COLUMNS = Map.of(
|
||||
"code", "info.code",
|
||||
"name", "info.name",
|
||||
"createTime", "info.createTime",
|
||||
"typeName", "type.name",
|
||||
"sourceName", "sd.name",
|
||||
"sessionName", "tcs.fullName",
|
||||
"taskName", "t.displayName",
|
||||
"instanceState", "ins.state"
|
||||
);
|
||||
|
||||
/** 邀请附议人列表允许排序的页面字段与 SQL 字段映射。 */
|
||||
private static final Map<String, String> SECONDER_ORDER_COLUMNS = Map.of(
|
||||
"loginName", "t1.loginName",
|
||||
"userName", "t1.userName",
|
||||
"sex", "t1.sex",
|
||||
"unitName", "t1.unitName",
|
||||
"unionName", "t1.unionName",
|
||||
"delegationName", "t2.name"
|
||||
);
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
@@ -128,6 +150,8 @@ public class ProposalMineController {
|
||||
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.andEX("info.sessionId", "=", sessionId);
|
||||
// 排序字段必须经过白名单映射,避免前端参数直接参与 SQL 排序。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, MINE_ORDER_COLUMNS);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
@@ -255,6 +279,8 @@ public class ProposalMineController {
|
||||
seg.orLike("t1.userName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
// 邀请列表与主列表使用独立白名单,确保关联表字段排序准确且安全。
|
||||
proposalCommonService.applySafePageOrder(cnd, pageForm, SECONDER_ORDER_COLUMNS);
|
||||
sql.setCondition(cnd);
|
||||
Pagination<ProposalInviteSeconderVO> pagination = proposalCommonService.listPageVO(pageForm, sql, ProposalInviteSeconderVO.class);
|
||||
return Result.success(pagination);
|
||||
|
||||
+7
-1
@@ -9,6 +9,7 @@ import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -39,6 +40,8 @@ public class ProposalPreAuditController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/preAudit/index.html")
|
||||
@@ -102,7 +105,10 @@ public class ProposalPreAuditController {
|
||||
cnd.andEX("vu.unionId", "=", pageForm.getUnionId());
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 预审核列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "preAudit")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+4
-1
@@ -135,7 +135,10 @@ public class ProposalSchoolLeaderApprovalController {
|
||||
cnd.andEX("vu.unionId", "=", pageForm.getUnionId());
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 分管领导审批列表未指定有效排序时保留任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "schoolLeaderApproval")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+19
-1
@@ -21,6 +21,7 @@ import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalSecond;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalSecondedService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -41,6 +42,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 附议提案
|
||||
@@ -51,6 +53,17 @@ import java.util.List;
|
||||
@Ok("json:full")
|
||||
@Api(tags = "提案管理系统-提案附议")
|
||||
public class ProposalSecondedController {
|
||||
/** 提案附议列表允许排序的页面字段与 SQL 字段或查询别名映射。 */
|
||||
private static final Map<String, String> ORDER_COLUMNS = Map.of(
|
||||
"code", "info.code",
|
||||
"name", "info.name",
|
||||
"createUserName", "info.createUserName",
|
||||
"typeName", "type.name",
|
||||
"delegationName", "tcd.name",
|
||||
"taskActorName", "taskActorName",
|
||||
"curTaskName", "curTaskName",
|
||||
"instanceState", "ins.state"
|
||||
);
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@@ -59,6 +72,8 @@ public class ProposalSecondedController {
|
||||
@Inject
|
||||
private ProposalSecondedService proposalSecondedService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At("")
|
||||
@@ -141,7 +156,10 @@ public class ProposalSecondedController {
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 用户未指定有效排序字段时,继续沿用原有任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafePageOrder(cnd, pageForm, ORDER_COLUMNS)) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -96,6 +96,8 @@ public class ProposalUnSubmitQueryController {
|
||||
cnd.and("info.sessionId", "=", pageForm.getSessionId());
|
||||
}
|
||||
|
||||
// 未提交查询包含子查询统计列,统一通过页面独立白名单排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "unSubmitQuery");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -137,6 +137,8 @@ public class ProposalUnderTakeReadController {
|
||||
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id","task.id","JSON_EXTRACT( unit_data.DATA, '$.underTakeId' )");
|
||||
// 初步阅览列表的计算字段使用固定查询别名排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "unitRead");
|
||||
// cnd.groupBy("task.id");
|
||||
// cnd.groupBy("JSON_EXTRACT( unit_data.DATA, '$.underTakeId' ) ");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
+4
-1
@@ -148,7 +148,10 @@ public class ProposalUnderTakeReplyController {
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
// 承办答复列表未指定有效排序时,继续按任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "unitReply")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
|
||||
+4
-1
@@ -100,7 +100,10 @@ public class ProposalUndertakeSuggestionController {
|
||||
cnd.groupBy("t.id");
|
||||
|
||||
cnd.having(Cnd.where("count", approval ? ">" : "=", 0));
|
||||
cnd.desc("t.createdAt");
|
||||
// 承办意见列表未指定有效排序时,继续按任务创建时间倒序。
|
||||
if (!proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "suggestion")) {
|
||||
cnd.desc("t.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+2
@@ -80,6 +80,8 @@ public class ProposalViceDelegationController {
|
||||
cnd.and("info.delegationId", "in", proposalCommonService.getSelfManageDelegationIds());
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
// 副团长查阅列表仅允许页面已展示字段参与排序。
|
||||
proposalCommonService.applySafeProposalListOrder(cnd, pageForm, "viceDelegation");
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
+4
@@ -21,6 +21,8 @@ public class ProposalQueryComprehensiveParam extends PageForm {
|
||||
private String code;
|
||||
@ApiModelProperty(name = "教代会ID")
|
||||
private String sessionId;
|
||||
@ApiModelProperty(name = "search session id")
|
||||
private String searchSessionId;
|
||||
@ApiModelProperty(name = "教代会ID")
|
||||
private String[] sessionIds;
|
||||
@ApiModelProperty(name = "代表团ID")
|
||||
@@ -79,6 +81,8 @@ public class ProposalQueryComprehensiveParam extends PageForm {
|
||||
} else {
|
||||
// cnd.andEX("info.sessionId", "=", searchParam.getSessionId());
|
||||
}
|
||||
// Isolated single-session filter for pages that should not reuse sessionId semantics.
|
||||
cnd.andEX("info.sessionId", "=", searchParam.getSearchSessionId());
|
||||
|
||||
//提案名称
|
||||
if (StrUtil.isNotBlank(searchParam.getName())) {
|
||||
|
||||
+32
@@ -1,17 +1,49 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.service.common;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ProposalCommonService extends BaseService<ProposalInfo> {
|
||||
|
||||
/**
|
||||
* 按页面允许的字段白名单添加排序条件,避免前端字段直接进入SQL。
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param pageForm 分页及排序参数
|
||||
* @param allowedOrderColumns 前端字段与数据库字段或查询别名的映射
|
||||
* @return 是否成功添加安全排序条件
|
||||
*/
|
||||
boolean applySafePageOrder(Cnd cnd, PageForm pageForm, Map<String, String> allowedOrderColumns);
|
||||
|
||||
/**
|
||||
* 按提案列表页面注册的独立字段白名单添加排序条件。
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param pageForm 分页及排序参数
|
||||
* @param pageCode 提案列表页面代码
|
||||
* @return 是否成功添加安全排序条件
|
||||
*/
|
||||
boolean applySafeProposalListOrder(Cnd cnd, PageForm pageForm, String pageCode);
|
||||
|
||||
/**
|
||||
* 按白名单字段对已汇总的统计结果进行后端排序。
|
||||
*
|
||||
* @param rows 统计结果行
|
||||
* @param pageForm 排序字段及方向参数
|
||||
* @param allowedOrderColumns 允许排序的统计字段
|
||||
*/
|
||||
void sortStatisticsRows(List<NutMap> rows, PageForm pageForm, Set<String> allowedOrderColumns);
|
||||
|
||||
/**
|
||||
* 查询提案信息
|
||||
*/
|
||||
|
||||
+179
@@ -9,8 +9,10 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
@@ -58,7 +60,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.Collator;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -66,6 +70,9 @@ import java.util.stream.Collectors;
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> implements ProposalCommonService {
|
||||
|
||||
/** PC端提案列表页面的排序字段白名单,页面代码由对应Controller固定传入。 */
|
||||
private static final Map<String, Map<String, String>> PROPOSAL_LIST_ORDER_COLUMNS = createProposalListOrderColumns();
|
||||
|
||||
//找出富文本里面上传的图片
|
||||
static String IMG_SRC_REGEX = "<img\\s+[^>]*src\\s*=\\s*([\"'])(/platform/sys/file/download\\?id=.*?)\\1[^>]*>";
|
||||
|
||||
@@ -88,6 +95,178 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
super(dao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用业务页面提供的字段白名单构建排序条件,非法字段或非法排序方向将被忽略。
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param pageForm 分页及排序参数
|
||||
* @param allowedOrderColumns 前端字段与数据库字段或查询别名的映射
|
||||
* @return 是否成功添加安全排序条件
|
||||
*/
|
||||
@Override
|
||||
public boolean applySafePageOrder(Cnd cnd, PageForm pageForm, Map<String, String> allowedOrderColumns) {
|
||||
if (cnd == null || pageForm == null || allowedOrderColumns == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 仅允许白名单中的字段参与排序,防止构造任意SQL排序字段。
|
||||
String orderColumn = allowedOrderColumns.get(pageForm.getPageOrderName());
|
||||
String orderBy = PageUtil.getOrder(pageForm.getPageOrderBy());
|
||||
if (StrUtil.isBlank(orderColumn) || StrUtil.isBlank(orderBy)) {
|
||||
return false;
|
||||
}
|
||||
cnd.orderBy(orderColumn, orderBy);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据页面代码读取独立白名单并应用排序,未注册页面不会接受前端排序字段。
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param pageForm 分页及排序参数
|
||||
* @param pageCode 提案列表页面代码
|
||||
* @return 是否成功添加安全排序条件
|
||||
*/
|
||||
@Override
|
||||
public boolean applySafeProposalListOrder(Cnd cnd, PageForm pageForm, String pageCode) {
|
||||
if (StrUtil.isBlank(pageCode)) {
|
||||
return false;
|
||||
}
|
||||
return applySafePageOrder(cnd, pageForm, PROPOSAL_LIST_ORDER_COLUMNS.get(pageCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建各列表页独立排序白名单,显示字段与真实SQL字段或固定查询别名一一对应。
|
||||
*
|
||||
* @return 不可变的页面排序白名单
|
||||
*/
|
||||
private static Map<String, Map<String, String>> createProposalListOrderColumns() {
|
||||
Map<String, Map<String, String>> pages = new HashMap<>();
|
||||
pages.put("invite", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("viceDelegation", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("unSubmitQuery", orderColumns("proposalCode", "info.code", "proposalName", "info.name", "username", "vu.username", "mobile", "vu.mobile", "unitName", "vu.unitName", "delegationName", "tcd.name", "typeName", "pt.name", "mannerName", "manner.name", "secondedNum", "secondedNum", "secondedAgreeNum", "secondedAgreeNum", "delegationAudit", "delegationAudit"));
|
||||
pages.put("unitReply", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "caseFilingResult", "info.caseFilingResult", "merge", "merge", "underTakeName", "underTakeName", "underTakeIsMaster", "underTakeIsMaster", "curTaskName", "curTaskName", "auditUser", "auditUser", "instanceState", "ins.state", "transfer", "transferUserName"));
|
||||
pages.put("unitRead", orderColumns("code", "info.code", "name", "info.name", "createUserName", "info.createUserName", "delegationName", "tcd.name", "caseFilingResult", "info.caseFilingResult", "isConsolidation", "isConsolidation", "isMasterUnderTake", "isMasterUnderTake", "underTakeName", "underTakeName", "processInstanceNodeName", "inst.processInstanceNodeName"));
|
||||
pages.put("suggestion", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "suggestUnits", "info.suggestUnits", "count", "count", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("commissioner", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "CONFIRM_FILING_COUNT", "CONFIRM_FILING_COUNT", "SUGGESTION_COUNT", "SUGGESTION_COUNT", "NOT_COUNT", "NOT_COUNT", "taskName", "taskName", "instanceState", "ins.state"));
|
||||
pages.put("feedbackEvaluation", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "merge", "merge", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("delegation", standardOrderColumns());
|
||||
pages.put("control", standardOrderColumns());
|
||||
pages.put("schoolLeaderApproval", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "undertakeUnits", "masterUnitName", "merge", "merge", "curTaskName", "curTaskName", "auditUser", "auditUser", "instanceState", "ins.state"));
|
||||
pages.put("committeeFilingUnit", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "sessionName", "tcs.fullName", "caseFilingResult", "info.caseFilingResult", "delegationName", "tcd.name", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("allFinished", orderColumns("code", "info.code", "name", "info.name", "createUserName", "info.createUserName", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "instanceState", "ins.state"));
|
||||
pages.put("preAudit", standardOrderColumns());
|
||||
pages.put("committeeFiling", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "sessionName", "tcs.fullName", "caseFilingResult", "info.caseFilingResult", "delegationName", "tcd.name", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("caseCheck", orderColumns("code", "info.code", "name", "info.name", "createUserName", "info.createUserName", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "curTaskName", "curTaskName", "instanceState", "ins.state", "finishTime", "t.finishTime"));
|
||||
pages.put("exportComprehensive", orderColumns("code", "info.code", "name", "info.name", "createUserName", "info.createUserName", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "caseFilingResult", "info.caseFilingResult", "caseFilingType", "info.caseFilingType", "merge", "merge", "brief", "info.brief", "measures", "info.measures", "undertakeUnits", "masterUnitName", "curTaskName", "curTaskName", "instanceState", "ins.state"));
|
||||
pages.put("exportSingleCustom", standardOrderColumns());
|
||||
pages.put("configUnit", orderColumns("name", "t1.name", "code", "t1.code", "unitLeader", "u2.username"));
|
||||
pages.put("configType", orderColumns("name", "name", "code", "code"));
|
||||
pages.put("seniorBasic", seniorOrderColumns());
|
||||
pages.put("expediting", orderColumns("code", "info.code", "name", "info.name", "typeName", "type.name", "delegationName", "tcd.name", "caseFilingResult", "info.caseFilingResult", "curTaskName", "curTaskName", "underTakeName", "underTakeName", "taskName", "t.displayName", "actorName", "ta.actorName", "instanceState", "ins.state"));
|
||||
pages.put("seniorDelete", seniorOrderColumns());
|
||||
pages.put("seniorFeedback", mergeOrderColumns(seniorOrderColumns(), orderColumns("tf_feedback", "tf_feedback")));
|
||||
pages.put("seniorType", seniorOrderColumns());
|
||||
return Collections.unmodifiableMap(pages);
|
||||
}
|
||||
|
||||
/** 创建常规流程列表共用的字段映射。 */
|
||||
private static Map<String, String> standardOrderColumns() {
|
||||
return orderColumns("code", "info.code", "name", "info.name", "createUserName", "info.createUserName", "typeName", "type.name", "sessionName", "tcs.fullName", "delegationName", "tcd.name", "curTaskName", "curTaskName", "instanceState", "ins.state");
|
||||
}
|
||||
|
||||
/** 创建高级管理列表共用的字段映射。 */
|
||||
private static Map<String, String> seniorOrderColumns() {
|
||||
return orderColumns("code", "info.code", "name", "info.name", "createUserName", "info.createUserName", "typeName", "type.name", "delegationName", "tcd.name", "caseFilingResult", "info.caseFilingResult", "isConsolidation", "merge", "curTaskName", "curTaskName", "instanceState", "ins.state");
|
||||
}
|
||||
|
||||
/**
|
||||
* 按前端字段、SQL字段成对创建不可变映射。
|
||||
*
|
||||
* @param mappings 交替排列的前端字段和SQL字段
|
||||
* @return 不可变字段映射
|
||||
*/
|
||||
private static Map<String, String> orderColumns(String... mappings) {
|
||||
if (mappings == null || mappings.length % 2 != 0) {
|
||||
throw new IllegalArgumentException("排序字段映射必须成对配置");
|
||||
}
|
||||
Map<String, String> columns = new LinkedHashMap<>();
|
||||
for (int i = 0; i < mappings.length; i += 2) {
|
||||
columns.put(mappings[i], mappings[i + 1]);
|
||||
}
|
||||
return Collections.unmodifiableMap(columns);
|
||||
}
|
||||
|
||||
/** 合并基础字段和页面扩展字段,并返回不可变映射。 */
|
||||
private static Map<String, String> mergeOrderColumns(Map<String, String> base, Map<String, String> extension) {
|
||||
Map<String, String> columns = new LinkedHashMap<>(base);
|
||||
columns.putAll(extension);
|
||||
return Collections.unmodifiableMap(columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按白名单字段对统计结果执行后端排序,数字按数值比较,文本按中文区域规则比较。
|
||||
*
|
||||
* @param rows 统计结果行
|
||||
* @param pageForm 排序字段及方向参数
|
||||
* @param allowedOrderColumns 允许排序的统计字段
|
||||
*/
|
||||
@Override
|
||||
public void sortStatisticsRows(List<NutMap> rows, PageForm pageForm, Set<String> allowedOrderColumns) {
|
||||
if (rows == null || pageForm == null || allowedOrderColumns == null) {
|
||||
return;
|
||||
}
|
||||
String orderName = pageForm.getPageOrderName();
|
||||
String orderBy = pageForm.getPageOrderBy();
|
||||
boolean ascending = "ascending".equals(orderBy);
|
||||
boolean descending = "descending".equals(orderBy);
|
||||
if (StrUtil.isBlank(orderName) || !allowedOrderColumns.contains(orderName) || (!ascending && !descending)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 空值始终排在末尾,降序只反转有效值的比较结果。
|
||||
rows.sort((leftRow, rightRow) -> {
|
||||
Object leftValue = leftRow.get(orderName);
|
||||
Object rightValue = rightRow.get(orderName);
|
||||
if (leftValue == null && rightValue == null) {
|
||||
return 0;
|
||||
}
|
||||
if (leftValue == null) {
|
||||
return 1;
|
||||
}
|
||||
if (rightValue == null) {
|
||||
return -1;
|
||||
}
|
||||
int result = compareStatisticsValue(leftValue, rightValue);
|
||||
return descending ? -result : result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较统计字段值,兼容不同整数类型以及中文文本。
|
||||
*
|
||||
* @param leftValue 左侧字段值
|
||||
* @param rightValue 右侧字段值
|
||||
* @return 标准比较结果
|
||||
*/
|
||||
private int compareStatisticsValue(Object leftValue, Object rightValue) {
|
||||
if (leftValue instanceof Number && rightValue instanceof Number) {
|
||||
BigDecimal leftNumber = new BigDecimal(leftValue.toString());
|
||||
BigDecimal rightNumber = new BigDecimal(rightValue.toString());
|
||||
return leftNumber.compareTo(rightNumber);
|
||||
}
|
||||
String leftText = String.valueOf(leftValue);
|
||||
String rightText = String.valueOf(rightValue);
|
||||
String leftPercent = StrUtil.removeSuffix(leftText, "%");
|
||||
String rightPercent = StrUtil.removeSuffix(rightText, "%");
|
||||
// 百分比展示值按实际数值比较,避免字符串顺序导致10%排在9%之前。
|
||||
if (leftText.endsWith("%") && rightText.endsWith("%")
|
||||
&& NumberUtil.isNumber(leftPercent) && NumberUtil.isNumber(rightPercent)) {
|
||||
return new BigDecimal(leftPercent).compareTo(new BigDecimal(rightPercent));
|
||||
}
|
||||
return Collator.getInstance(Locale.CHINA).compare(leftText, rightText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap info(String id) {
|
||||
if (StrUtil.isBlank(id)) {
|
||||
|
||||
+5
-1
@@ -118,7 +118,11 @@ public class ProposalWriteServiceImpl extends BaseServiceImpl<ProposalInfo> impl
|
||||
@Override
|
||||
public List<Sys_dict> listSourceByCode(String code) {
|
||||
Sys_dict dict = sysDictService.fetch(Cnd.where("code", "=", code));
|
||||
return dict == null ? new ArrayList<>() : sysDictService.query(Cnd.where("parentId", "=", Strings.sNull(dict.getId())).asc("location"));
|
||||
return dict == null ? new ArrayList<>() : sysDictService.query(
|
||||
Cnd.NEW().where("parentId", "=", Strings.sNull(dict.getId()))
|
||||
.and("disabled","=",0)
|
||||
.asc("location")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+26
-73
@@ -7,7 +7,6 @@ import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
@@ -20,15 +19,14 @@ import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation_union;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation_unit;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.service.TeacherCongressDelegationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
@@ -43,7 +41,6 @@ import org.nutz.mvc.annotation.Param;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/delegation")
|
||||
@@ -63,6 +60,9 @@ public class TeacherCongressDelegationController {
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Inject
|
||||
private TeacherCongressDelegationService teacherCongressDelegationService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegation/index.html")
|
||||
@SaCheckPermission("tc.delegation")
|
||||
@@ -288,97 +288,50 @@ public class TeacherCongressDelegationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询团长
|
||||
* 查询代表团负责人,副团长返回多条以兼容V3多个副团长。
|
||||
*
|
||||
* @param sessionId
|
||||
* @param delegationId
|
||||
* @return
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param type 负责人角色编码
|
||||
* @return 负责人列表
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("tc.delegation")
|
||||
public Result headUser(@Valid String sessionId, @Valid String delegationId, @Param(value = "type", df = "TEACHER_CONGRESS_DELEGATION_HEAD") String type) {
|
||||
Sys_role role = null;
|
||||
if (type.equals(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD.name())) {
|
||||
role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
} else if (type.equals(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD.name())) {
|
||||
role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
} else if (type.equals(RoleConstant.TEACHER_CONGRESS_DELEGATION_CONTACT.name())) {
|
||||
role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_CONTACT);
|
||||
} else {
|
||||
throw new BaseException("参数错误");
|
||||
}
|
||||
|
||||
Record record = dao.fetch("sys_user_role", Cnd.where("tcSessionId", "=", sessionId).and("tcDelegationId", "=", delegationId).and("roleId", "=", role.getId()));
|
||||
String userId = Optional.ofNullable(record).map(r -> r.getString("userId")).orElse(null);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id as userId,
|
||||
u.loginname as loginName,
|
||||
u.username as userName,
|
||||
u.mobile,
|
||||
n.name as unitName
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN sys_unit n on n.id = u.unitId
|
||||
WHERE
|
||||
u.id = @userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
return Result.success().addData(user);
|
||||
List<NutMap> users = teacherCongressDelegationService.listHeadUsers(sessionId, delegationId, type);
|
||||
return Result.success().addData(users);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置团长
|
||||
* 设置代表团团长、副团长和联络人。
|
||||
*
|
||||
* @param delegationId 代表团ID
|
||||
* @param sessionId 届次ID
|
||||
* @param userId 团长id
|
||||
* @param viceUserId 副团长id
|
||||
* @param contactUserId 联络人
|
||||
* @return
|
||||
* @param userId 团长ID
|
||||
* @param viceUserIds 副团长ID数组
|
||||
* @param contactUserId 联络人ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("tc.delegation")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result insertHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId, @Valid String viceUserId, String contactUserId) {
|
||||
// 团长
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId).and(Sys_user_role::getTcSessionId, "=", sessionId).and(Sys_user_role::getRoleId, "=", role.getId()));
|
||||
dao.insert("sys_user_role", Chain.make("userId", userId).add("roleId", role.getId()).add("tcDelegationId", delegationId).add("tcSessionId", sessionId));
|
||||
|
||||
// 副团长
|
||||
Sys_role role2 = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId).and(Sys_user_role::getTcSessionId, "=", sessionId).and(Sys_user_role::getRoleId, "=", role2.getId()));
|
||||
dao.insert("sys_user_role", Chain.make("userId", viceUserId).add("roleId", role2.getId()).add("tcDelegationId", delegationId).add("tcSessionId", sessionId));
|
||||
|
||||
// 联络人
|
||||
Sys_role role3 = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_CONTACT);
|
||||
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId).and(Sys_user_role::getTcSessionId, "=", sessionId).and(Sys_user_role::getRoleId, "=", role3.getId()));
|
||||
dao.insert("sys_user_role", Chain.make("userId", contactUserId).add("roleId", role3.getId()).add("tcDelegationId", delegationId).add("tcSessionId", sessionId));
|
||||
|
||||
sysUserService.clearCache();
|
||||
public Result insertHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId, @Param("viceUserIds") String[] viceUserIds, String contactUserId) {
|
||||
teacherCongressDelegationService.setHeadUsers(sessionId, delegationId, userId, viceUserIds, contactUserId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除团长角色
|
||||
* 删除代表团负责人角色。
|
||||
*
|
||||
* @param delegationId
|
||||
* @param sessionId
|
||||
* @param userId
|
||||
* @return
|
||||
* @param delegationId 代表团ID
|
||||
* @param sessionId 届次ID
|
||||
* @param userId 用户ID
|
||||
* @param type 负责人角色编码
|
||||
* @return 操作结果
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("tc.delegation")
|
||||
public Result deleteHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId) {
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
//先删除角色
|
||||
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId).and(Sys_user_role::getTcSessionId, "=", sessionId).and(Sys_user_role::getRoleId, "=", role.getId()).and(Sys_user_role::getUserId, "=", userId));
|
||||
sysUserService.clearCache();
|
||||
public Result deleteHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId, @Param(value = "type", df = "TEACHER_CONGRESS_DELEGATION_HEAD") String type) {
|
||||
teacherCongressDelegationService.deleteHeadUser(sessionId, delegationId, userId, type);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegation.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教代会代表团业务服务。
|
||||
*/
|
||||
public interface TeacherCongressDelegationService extends BaseService<Teacher_congress_delegation> {
|
||||
|
||||
/**
|
||||
* 按角色查询代表团负责人信息。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param type 负责人角色编码
|
||||
* @return 负责人用户列表
|
||||
*/
|
||||
List<NutMap> listHeadUsers(String sessionId, String delegationId, String type);
|
||||
|
||||
/**
|
||||
* 设置代表团团长、副团长和联络人。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param userId 团长用户ID
|
||||
* @param viceUserIds 副团长用户ID列表
|
||||
* @param contactUserId 联络人用户ID
|
||||
*/
|
||||
void setHeadUsers(String sessionId, String delegationId, String userId, String[] viceUserIds, String contactUserId);
|
||||
|
||||
/**
|
||||
* 删除代表团指定负责人角色。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param userId 用户ID
|
||||
* @param type 负责人角色编码
|
||||
*/
|
||||
void deleteHeadUser(String sessionId, String delegationId, String userId, String type);
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegation.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.service.TeacherCongressDelegationService;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教代会代表团业务服务实现。
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class TeacherCongressDelegationServiceImpl extends BaseServiceImpl<Teacher_congress_delegation> implements TeacherCongressDelegationService {
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
public TeacherCongressDelegationServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按角色查询代表团负责人信息,副团长允许返回多条记录以兼容V3多副团长数据。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param type 负责人角色编码
|
||||
* @return 负责人用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<NutMap> listHeadUsers(String sessionId, String delegationId, String type) {
|
||||
Sys_role role = getHeadRole(type);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id as userId,
|
||||
u.loginname as loginName,
|
||||
u.username as userName,
|
||||
u.mobile,
|
||||
n.name as unitName
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON u.id = sur.userId
|
||||
LEFT JOIN sys_unit n ON n.id = u.unitId
|
||||
WHERE
|
||||
sur.tcSessionId = @sessionId
|
||||
AND sur.tcDelegationId = @delegationId
|
||||
AND sur.roleId = @roleId
|
||||
ORDER BY u.loginname
|
||||
""");
|
||||
sql.setParam("sessionId", sessionId);
|
||||
sql.setParam("delegationId", delegationId);
|
||||
sql.setParam("roleId", role.getId());
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置代表团团长、副团长和联络人,保存前按角色清理旧值,避免同一角色残留脏数据。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param userId 团长用户ID
|
||||
* @param viceUserIds 副团长用户ID列表
|
||||
* @param contactUserId 联络人用户ID
|
||||
*/
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void setHeadUsers(String sessionId, String delegationId, String userId, String[] viceUserIds, String contactUserId) {
|
||||
// 团长仍然保持单人设置。
|
||||
Sys_role headRole = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
replaceRoleUsers(sessionId, delegationId, headRole.getId(), new String[]{userId});
|
||||
|
||||
// 副团长支持多人设置,完整保留V3迁移后的多个副团长关系。
|
||||
Sys_role viceHeadRole = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
replaceRoleUsers(sessionId, delegationId, viceHeadRole.getId(), viceUserIds);
|
||||
|
||||
// 联络人保持单人设置,未选择时只清理旧联络人。
|
||||
Sys_role contactRole = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_CONTACT);
|
||||
replaceRoleUsers(sessionId, delegationId, contactRole.getId(), new String[]{contactUserId});
|
||||
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代表团指定负责人角色,按角色类型精确删除,避免删除副团长时影响团长。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param userId 用户ID
|
||||
* @param type 负责人角色编码
|
||||
*/
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void deleteHeadUser(String sessionId, String delegationId, String userId, String type) {
|
||||
Sys_role role = getHeadRole(type);
|
||||
dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId)
|
||||
.and(Sys_user_role::getTcSessionId, "=", sessionId)
|
||||
.and(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getUserId, "=", userId));
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
/**
|
||||
* 根据负责人类型解析系统角色,集中校验避免 controller 层出现业务分支。
|
||||
*
|
||||
* @param type 负责人角色编码
|
||||
* @return 系统角色
|
||||
*/
|
||||
private Sys_role getHeadRole(String type) {
|
||||
if (RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD.name().equals(type)) {
|
||||
return sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
}
|
||||
if (RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD.name().equals(type)) {
|
||||
return sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
}
|
||||
if (RoleConstant.TEACHER_CONGRESS_DELEGATION_CONTACT.name().equals(type)) {
|
||||
return sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_CONTACT);
|
||||
}
|
||||
throw new BaseException("参数错误");
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换指定角色用户关系,先清理再按去重后的用户ID批量插入。
|
||||
*
|
||||
* @param sessionId 届次ID
|
||||
* @param delegationId 代表团ID
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID数组
|
||||
*/
|
||||
private void replaceRoleUsers(String sessionId, String delegationId, String roleId, String[] userIds) {
|
||||
dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId)
|
||||
.and(Sys_user_role::getTcSessionId, "=", sessionId)
|
||||
.and(Sys_user_role::getRoleId, "=", roleId));
|
||||
if (userIds == null || userIds.length == 0) {
|
||||
return;
|
||||
}
|
||||
Arrays.stream(userIds)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.forEach(userId -> dao().insert("sys_user_role", Chain.make("userId", userId)
|
||||
.add("roleId", roleId)
|
||||
.add("tcDelegationId", delegationId)
|
||||
.add("tcSessionId", sessionId)));
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.prepare.controller.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 届次提案类型下拉选项。
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@ApiModel("届次提案类型选项")
|
||||
public class TeacherCongressSessionProposalTypeVO {
|
||||
|
||||
@ApiModelProperty("提案类型,自定义类型保存后也会成为后续届次的可选项")
|
||||
private String proposalType;
|
||||
}
|
||||
+1
@@ -98,6 +98,7 @@ public class MemberApplyBranchUnionApprovalController {
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN member_apply_record info ON info.id = ins.businessNo
|
||||
LEFT JOIN vw_user u ON u.id = info.userId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
|
||||
+1
@@ -113,6 +113,7 @@ public class MemberApplySchoolUnionApprovalController {
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN member_apply_record info ON info.id = ins.businessNo
|
||||
LEFT JOIN vw_user u ON u.id = info.userId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
|
||||
+1
@@ -87,6 +87,7 @@ public class MemberApplyUnionGroupApprovalController {
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN member_apply_record info ON info.id = ins.businessNo
|
||||
LEFT JOIN vw_user u ON u.id = info.userId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
|
||||
+9
-1
@@ -34,6 +34,9 @@ public class MemberApplyPageForm extends PageForm {
|
||||
|
||||
private String userAttribute; //人员属性
|
||||
|
||||
/** 人员属性多选值,供开启多选查询的页面使用。 */
|
||||
private List<String> userAttributes;
|
||||
|
||||
public static void buildSearch(Cnd cnd, MemberApplyPageForm pageForm) {
|
||||
if (cnd == null) {
|
||||
cnd = Cnd.NEW();
|
||||
@@ -50,6 +53,11 @@ public class MemberApplyPageForm extends PageForm {
|
||||
cnd.andEX("info.personType","in",pageForm.getPersonTypes());
|
||||
cnd.andEX("info.preparedBy","in",pageForm.getPreparedBys());
|
||||
cnd.andEX("u.aidFundMemberUserType","=",pageForm.getAidFundMemberUserType());
|
||||
cnd.andEX("u.userAttribute","=",pageForm.getUserAttribute());
|
||||
// 多选值优先使用IN查询;未传多选值时保留原单值查询,兼容其他调用页面。
|
||||
if (pageForm.getUserAttributes() != null && !pageForm.getUserAttributes().isEmpty()) {
|
||||
cnd.and("u.userAttribute", "in", pageForm.getUserAttributes());
|
||||
} else {
|
||||
cnd.andEX("u.userAttribute", "=", pageForm.getUserAttribute());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -47,6 +47,9 @@ public class MemberChangePageForm extends PageForm {
|
||||
@ApiModelProperty("人员属性")
|
||||
private String userAttribute;
|
||||
|
||||
@ApiModelProperty("人员属性组")
|
||||
private List<String> userAttributes;
|
||||
|
||||
|
||||
public void buildSearch(Cnd cnd, String prefix){
|
||||
if (cnd == null) {
|
||||
@@ -66,6 +69,11 @@ public class MemberChangePageForm extends PageForm {
|
||||
cnd.andEX(prefix + "preparedBy", "in", this.getPreparedBys());
|
||||
cnd.andEX(prefix + "personType", "in", this.getPersonTypes());
|
||||
cnd.andEX(prefix + "aidFundMemberUserType", "=", this.getAidFundMemberUserType());
|
||||
cnd.andEX(prefix + "userAttribute", "=", this.getUserAttribute());
|
||||
// 多选条件优先,兼容仍按单值提交人员属性的旧页面。
|
||||
if (this.getUserAttributes() != null && !this.getUserAttributes().isEmpty()) {
|
||||
cnd.and(prefix + "userAttribute", "in", this.getUserAttributes());
|
||||
} else {
|
||||
cnd.andEX(prefix + "userAttribute", "=", this.getUserAttribute());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -162,10 +162,11 @@ public class MemberInfoPageForm extends PageForm {
|
||||
} else if (Lang.isNotEmpty(this.getPersonTypes())) {
|
||||
cnd.and(prefix + "personType", "in", this.getPersonTypes());
|
||||
}
|
||||
if (StrUtil.isNotBlank(this.getUserAttribute())) {
|
||||
cnd.and(prefix + "userAttribute", "=", this.getUserAttribute());
|
||||
} else if (Lang.isNotEmpty(this.getUserAttributes())) {
|
||||
// 多选条件优先,兼容仍按单值提交人员属性的旧页面。
|
||||
if (Lang.isNotEmpty(this.getUserAttributes())) {
|
||||
cnd.and(prefix + "userAttribute", "in", this.getUserAttributes());
|
||||
} else if (StrUtil.isNotBlank(this.getUserAttribute())) {
|
||||
cnd.and(prefix + "userAttribute", "=", this.getUserAttribute());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(this.getAidFundMemberUserType())) {
|
||||
|
||||
+15
-2
@@ -42,6 +42,9 @@ public class MemberManagePageForm extends PageForm {
|
||||
|
||||
private String userAttribute;
|
||||
|
||||
/** 人员属性多选查询条件。 */
|
||||
private List<String> userAttributes;
|
||||
|
||||
private String changeType;
|
||||
|
||||
//变更状态数组
|
||||
@@ -93,7 +96,12 @@ public class MemberManagePageForm extends PageForm {
|
||||
cnd.andEX("u.sex", "=", pageForm.getSex());
|
||||
cnd.andEX("u.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("u.aidFundMemberUserType", "=", pageForm.getAidFundMemberUserType());
|
||||
cnd.andEX("u.userAttribute", "=", pageForm.getUserAttribute());
|
||||
// 多选条件优先,兼容仍按单值提交人员属性的旧页面。
|
||||
if (Lang.isNotEmpty(pageForm.getUserAttributes())) {
|
||||
cnd.and("u.userAttribute", "in", pageForm.getUserAttributes());
|
||||
} else {
|
||||
cnd.andEX("u.userAttribute", "=", pageForm.getUserAttribute());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getChangeDateBefore()) && StrUtil.isNotBlank(pageForm.getChangeDateEnd())) {
|
||||
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", pageForm.getChangeDateBefore(), pageForm.getChangeDateEnd())));
|
||||
@@ -148,7 +156,12 @@ public class MemberManagePageForm extends PageForm {
|
||||
cnd.andEX("record.preparedBy", "=", pageForm.getPreparedBy());
|
||||
cnd.andEX("record.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("record.aidFundMemberUserType", "=", pageForm.getAidFundMemberUserType());
|
||||
cnd.andEX("record.userAttribute", "=", pageForm.getUserAttribute());
|
||||
// 历史记录查询与当前会员查询使用一致的人员属性多选规则。
|
||||
if (Lang.isNotEmpty(pageForm.getUserAttributes())) {
|
||||
cnd.and("record.userAttribute", "in", pageForm.getUserAttributes());
|
||||
} else {
|
||||
cnd.andEX("record.userAttribute", "=", pageForm.getUserAttribute());
|
||||
}
|
||||
|
||||
cnd.groupBy("record.id,task.id");
|
||||
}
|
||||
|
||||
+6
@@ -396,6 +396,12 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
|
||||
cnd.andEX("mh.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("mh.preparedBy", "=", pageForm.getPreparedBy());
|
||||
cnd.andEX("mh.userState", "=", pageForm.getUserState());
|
||||
// 历史台账未复用通用 buildSearch,需要在此显式处理人员属性多选条件。
|
||||
if (Lang.isNotEmpty(pageForm.getUserAttributes())) {
|
||||
cnd.and("mh.userAttribute", "in", pageForm.getUserAttributes());
|
||||
} else {
|
||||
cnd.andEX("mh.userAttribute", "=", pageForm.getUserAttribute());
|
||||
}
|
||||
if (StrUtil.isAllNotBlank(pageForm.getMemberSearchName(), pageForm.getMemberSearchKeyWord())) {
|
||||
cnd.and(new SqlExpressionGroup().andLike("u." + pageForm.getMemberSearchName(), pageForm.getMemberSearchKeyWord()));
|
||||
}
|
||||
|
||||
+6
@@ -175,6 +175,12 @@ public class MemberManageServiceImpl extends BaseServiceImpl<Sys_user> implement
|
||||
cnd.andEX("his.unitId", "=", pageForm.getUnitId());
|
||||
cnd.andEX("his.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("his.userState", "=", pageForm.getUserState());
|
||||
// 变更记录查询自行拼接历史表条件,需要单独补充人员属性多选及旧单值兼容。
|
||||
if (Lang.isNotEmpty(pageForm.getUserAttributes())) {
|
||||
cnd.and("his.userAttribute", "in", pageForm.getUserAttributes());
|
||||
} else {
|
||||
cnd.andEX("his.userAttribute", "=", pageForm.getUserAttribute());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getChangeType())){
|
||||
cnd.and(new Static("JSON_CONTAINS(his.changeTypes, JSON_ARRAY('%s'), '$')".formatted(pageForm.getChangeType())));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user