git查看用户
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.budwk.app.base.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author FKY
|
||||
* @name:FileExcelUtil
|
||||
* @Date 2026/1/31 15:33
|
||||
* @注释
|
||||
*/
|
||||
@Slf4j
|
||||
public class FileExcelUtil {
|
||||
|
||||
public static Map<String, String> readExcelTable(File file){
|
||||
Map<String, String> dataMap = new HashMap<>();
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
Workbook workbook = new XSSFWorkbook(fis);
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
// 遍历所有行
|
||||
for (Row row : sheet) {
|
||||
int rowColumnIndex = 0 ;
|
||||
String keyName = "";
|
||||
String keyValue = "";
|
||||
|
||||
// 遍历所有单元格
|
||||
for (Cell cell : row) {
|
||||
String cellValue = String.valueOf(getCellValue(cell));
|
||||
|
||||
log.info("| " + cellValue + " ");
|
||||
|
||||
if((rowColumnIndex % 2) <= 0) {
|
||||
keyName = cellValue;
|
||||
} else {
|
||||
keyValue = cellValue;
|
||||
}
|
||||
if(StrUtil.isNotBlank(keyName) && StrUtil.isNotBlank(keyValue)) {
|
||||
if(keyName.contains("*")) {
|
||||
keyName = keyName.replace("*", "");
|
||||
}
|
||||
dataMap.put(keyName, keyValue);
|
||||
keyName = "";
|
||||
keyValue = "";
|
||||
}
|
||||
rowColumnIndex ++;
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public static Object getCellValue(Cell cell) {
|
||||
CellType cellType = cell.getCellType();
|
||||
|
||||
if (cellType == CellType.FORMULA) {
|
||||
cellType = cell.getCachedFormulaResultType();
|
||||
}
|
||||
|
||||
switch (cellType) {
|
||||
case STRING:
|
||||
return cell.getStringCellValue();
|
||||
case NUMERIC:
|
||||
if (isCellDateType(cell)) {
|
||||
return cell.getDateCellValue();
|
||||
}
|
||||
return cell.getNumericCellValue();
|
||||
case BOOLEAN:
|
||||
return cell.getBooleanCellValue();
|
||||
case BLANK:
|
||||
return "";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean isCellDateType(Cell cell) {
|
||||
try {
|
||||
cell.getDateCellValue();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.budwk.app.base.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author FKY
|
||||
* @name:FileWordUtil
|
||||
* @Date 2026/1/31 15:01
|
||||
* @注释
|
||||
*/
|
||||
@Slf4j
|
||||
public class FileWordUtil {
|
||||
|
||||
public static List<Map<String, String>> readWordTable(File file) {
|
||||
List<Map<String, String>> dataMaps = new ArrayList<>();
|
||||
try{
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
XWPFDocument document = new XWPFDocument(fis);
|
||||
|
||||
// 获取所有表格
|
||||
List<XWPFTable> tables = document.getTables();
|
||||
log .info("文档中共有 " + tables.size() + " 个表格");
|
||||
|
||||
// 遍历每个表格
|
||||
for (int t = 0; t < tables.size(); t++) {
|
||||
log.info("\n--- 表格 " + (t + 1) + " ---");
|
||||
XWPFTable table = tables.get(t);
|
||||
Map<String, String> dataMap = new HashMap<>();
|
||||
|
||||
// 遍历表格的每一行
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
int rowColumnIndex = 0 ;
|
||||
String keyName = "";
|
||||
String keyValue = "";
|
||||
// 遍历行中的每个单元格
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
// 获取单元格文本并打印
|
||||
String cellText = cell.getText();
|
||||
log.info("| " + cellText + " ");
|
||||
if((rowColumnIndex % 2) <= 0) {
|
||||
keyName = cellText;
|
||||
} else {
|
||||
keyValue = cellText;
|
||||
}
|
||||
if(StrUtil.isNotBlank(keyName) && StrUtil.isNotBlank(keyValue)) {
|
||||
if(keyName.contains("*")) {
|
||||
keyName = keyName.replace("*", "");
|
||||
}
|
||||
|
||||
dataMap.put(keyName, keyValue);
|
||||
keyName = "";
|
||||
keyValue = "";
|
||||
}
|
||||
rowColumnIndex ++;
|
||||
}
|
||||
log.info("|"); // 换行
|
||||
}
|
||||
if(!dataMap.isEmpty()){
|
||||
dataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("读取word文件出错",e);
|
||||
}
|
||||
return dataMaps;
|
||||
}
|
||||
}
|
||||
@@ -3,19 +3,34 @@ package com.budwk.app.flow.service;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.event.flow.jumptofirsttask.FlowJumpToFirstTaskNodePublisher;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.engine.event.ProcessEvent;
|
||||
import com.budwk.app.flow.engine.event.ProcessPublisher;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.*;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
public class FlowCommonService {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
/**
|
||||
* 执行任务
|
||||
* @param args
|
||||
@@ -70,4 +85,40 @@ public class FlowCommonService {
|
||||
}
|
||||
}
|
||||
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result revokeTask(Long taskId) {
|
||||
// 自己任务
|
||||
ProcessTask selfTask = dao.fetch(ProcessTask.class, taskId);
|
||||
selfTask.setTaskState(ProcessTaskStateEnum.DOING.getCode());
|
||||
|
||||
// 撤销任务
|
||||
List<ProcessTask> taskList = dao.query(ProcessTask.class, Cnd.where(ProcessTask::getTaskParentId, "=", taskId));
|
||||
for (ProcessTask task : taskList) {
|
||||
task.setTaskState(ProcessTaskStateEnum.WITHDRAW.getCode());
|
||||
dao.update(task);
|
||||
}
|
||||
// 会签并行任务 撤销后续任务
|
||||
if (selfTask.getPerformType().equals(ProcessTaskPerformTypeEnum.COUNTERSIGN.getCode())) {
|
||||
List<ProcessTask> doingTasks = dao.query(ProcessTask.class, Cnd.where(ProcessTask::getTaskState, "=", ProcessTaskStateEnum.DOING.getCode())
|
||||
.and(ProcessTask::getProcessInstanceId, "=", selfTask.getProcessInstanceId()));
|
||||
for (ProcessTask doingTask : doingTasks) {
|
||||
doingTask.setTaskState(ProcessTaskStateEnum.WITHDRAW.getCode());
|
||||
dao.update(doingTask);
|
||||
}
|
||||
}
|
||||
|
||||
// 激活
|
||||
dao.update(selfTask);
|
||||
|
||||
// 流程激活
|
||||
dao.update(ProcessInstance.class, Chain.make("state", ProcessInstanceStateEnum.DOING.getCode()),Cnd.where(ProcessInstance::getId, "=", selfTask.getProcessInstanceId()));
|
||||
|
||||
// 发送任务撤回事件 确保上面执行成功
|
||||
for (ProcessTask task : taskList) {
|
||||
ProcessPublisher.notify(ProcessEvent.builder().eventType(ProcessEventTypeEnum.PROCESS_TASK_REVOKE).sourceId(task.getId()).build());
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -211,4 +211,12 @@ public interface ProcessTaskService extends BaseService<ProcessTask> {
|
||||
*/
|
||||
List<ProcessTask> getDoingTaskByBizIdTaskName(List<String> bizIds, String taskName);
|
||||
|
||||
/**
|
||||
* 获取已结束的任务
|
||||
*
|
||||
* @param bizIds 业务ID
|
||||
* @param taskName 任务名称
|
||||
* @return
|
||||
*/
|
||||
List<ProcessTask> getDoneTaskByBizIdTaskName(List<String> bizIds, String taskName);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,16 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcessTask> getDoneTaskByBizIdTaskName(List<String> bizIds, String taskName) {
|
||||
List<ProcessInstance> instances = dao().query(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "in", bizIds));
|
||||
List<Long> instanceIds = instances.stream().map(ProcessInstance::getId).toList();
|
||||
List<ProcessTask> tasks = dao().query(ProcessTask.class, Cnd.where(ProcessTask::getProcessInstanceId, "in", instanceIds)
|
||||
.and(ProcessTask::getTaskName, "=", taskName)
|
||||
.and(ProcessTask::getTaskState, "=", ProcessTaskStateEnum.FINISHED.getCode()));
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void saveProcessTask(ProcessTask processTask) {
|
||||
|
||||
@@ -197,4 +197,5 @@ public interface SysUserService extends BaseService<Sys_user> {
|
||||
*/
|
||||
String loginPlus(Sys_user user, LoginType loginType, HttpServletRequest request);
|
||||
|
||||
Sys_user getByLoginName(String loginName);
|
||||
}
|
||||
|
||||
@@ -449,4 +449,13 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
|
||||
return Globals.AppDomain + "/platform/home";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sys_user getByLoginName(String loginName) {
|
||||
Sql sql = Sqls.create("select * from sys_user where loginname = @loginname");
|
||||
sql.params().set("loginname", loginName);
|
||||
sql.setCallback(Sqls.callback.record());
|
||||
this.dao().execute(sql);
|
||||
return sql.getObject(Sys_user.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.budwk.app.web.controllers;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/12/3 8:50
|
||||
* @Description: TODO
|
||||
*/
|
||||
@At("/platform/basics")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class BasicsController {
|
||||
private static final Log log = Logs.get();
|
||||
|
||||
private final String TEMPLATE_PATH = "templates";
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
*
|
||||
* @param filePath
|
||||
* @param fileName
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
public void downloadTemplate(String filePath, String fileName, HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
response.setHeader("Content-Disposition", "attachment;filename="
|
||||
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
|
||||
|
||||
if (filePath.startsWith("/")) {
|
||||
filePath = filePath.substring(1);
|
||||
}
|
||||
InputStream fin = Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_PATH + "/" + filePath);
|
||||
|
||||
IOUtils.copy(fin, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.constants;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-01-27 09:54
|
||||
* @description: 提案状态
|
||||
**/
|
||||
public interface ProposalState {
|
||||
|
||||
/**
|
||||
* 未提交
|
||||
*/
|
||||
Integer UNSUBMIT = 100;
|
||||
|
||||
/**
|
||||
* 邀请附议人
|
||||
*/
|
||||
Integer INVIRTE = 150;
|
||||
|
||||
/**
|
||||
* 待团长审核
|
||||
*/
|
||||
Integer DELEGATION = 200;
|
||||
|
||||
/**
|
||||
* 预审核
|
||||
*/
|
||||
Integer PREAUDIT = 250;
|
||||
|
||||
/**
|
||||
* 待提案委员会立案审核
|
||||
*/
|
||||
Integer CASE = 300;
|
||||
|
||||
/**
|
||||
* 执委会建议
|
||||
*/
|
||||
Integer EXECUTORREAD = 310;
|
||||
|
||||
/**
|
||||
* 分管校领导建议
|
||||
*/
|
||||
Integer BRANCHLEADERREAD = 320;
|
||||
|
||||
/**
|
||||
* 校长、书记建议
|
||||
*/
|
||||
Integer PRINCIPALREAD = 330;
|
||||
|
||||
/**
|
||||
* 待提案委员会确认承办单位
|
||||
*/
|
||||
Integer CASEUNIT = 400;
|
||||
|
||||
/**
|
||||
* 待承办单位答复
|
||||
*/
|
||||
Integer UNITREPLY = 500;
|
||||
|
||||
/**
|
||||
* 待承办单位分管校领导审批
|
||||
*/
|
||||
Integer LEADERAUDIT = 600;
|
||||
|
||||
/**
|
||||
* 待反馈评分
|
||||
*/
|
||||
Integer FEEDBACKSCORE = 700;
|
||||
|
||||
/**
|
||||
* 待提案委员会审查
|
||||
*/
|
||||
Integer CASE_CHECK = 800;
|
||||
|
||||
/**
|
||||
* 已完结
|
||||
*/
|
||||
Integer FINISH = 900;
|
||||
}
|
||||
+1
-1
@@ -102,7 +102,7 @@ public class ProposalCommonController {
|
||||
@Ok("void")
|
||||
@SaCheckPermission("proposal")
|
||||
public void exportProposalAsDocx(String id, HttpServletResponse response) {
|
||||
proposalCommonService.exportProposalAsDocx(id, response);
|
||||
proposalCommonService.exportProposalAsDocx(id, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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 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.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
|
||||
* @Author FKY
|
||||
* @name:ProposalAllFinishedController
|
||||
* @Date 2026/3/17 15:33
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/proposal/all/finished")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@Api(tags = "提案管理-办结")
|
||||
public class ProposalAllFinishedController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/allFinished/index.html")
|
||||
@SaCheckPermission("proposal.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.allFinishedQuery")
|
||||
@ApiOperation("分页列表")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId
|
||||
FROM wf_process_instance ins
|
||||
LEFT 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ins.state", "=", "20");
|
||||
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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 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.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
|
||||
* @Author FKY
|
||||
* @name:ProposalCaseCheckController
|
||||
* @Date 2026/3/17 13:35
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/proposal/case/check")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@Api(tags = "提案管理-提案委员会审查")
|
||||
public class ProposalCaseCheckController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/caseCheck/index.html")
|
||||
@SaCheckPermission("proposal.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.caseCheck")
|
||||
@ApiOperation("分页列表")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
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
|
||||
LEFT 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "caseCheck");
|
||||
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+130
-102
@@ -1,23 +1,26 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
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.bpm.enums.BpmProcessTaskStatusEnum;
|
||||
import com.budwk.app.bpm.models.BpmProcessTask;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.entity.ProcessTaskActor;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.flow.service.ProcessTaskService;
|
||||
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.controller.vo.ProposalInfoPageVO;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalCommitteeFilingUnitApprovalParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalCommitteeFilingUnitService;
|
||||
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;
|
||||
@@ -25,10 +28,10 @@ import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
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.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
@@ -46,10 +49,15 @@ public class ProposalCommitteeFilingUnitController {
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private BpmService bpmService;
|
||||
@Inject
|
||||
private ProposalCommitteeFilingUnitService proposalCommitteeFilingUnitService;
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
@Inject
|
||||
private ProcessTaskService processTaskService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/committeeFilingUnit/index.html")
|
||||
@SaCheckPermission("proposal.committeeFilingUnit")
|
||||
@@ -64,123 +72,143 @@ public class ProposalCommitteeFilingUnitController {
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
inst.id processInstanceId,
|
||||
inst.processInstanceNodeId,
|
||||
inst.processInstanceNodeName,
|
||||
inst.processInstanceTaskIds,
|
||||
inst.processInstanceStatus,
|
||||
task.id processInstanceTaskId,
|
||||
task.taskStatus processInstanceTaskStatus,
|
||||
COUNT(p.consolidationIds) > 0 AS isConsolidation,
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM bpm_process_task next_task
|
||||
WHERE next_task.prevTaskId = task.id
|
||||
AND next_task.taskStatus = 'COMPLETE'
|
||||
) AS nextTaskIsComplete
|
||||
IF(mer.proposalId IS NOT NULL, 1, 0) AS merge,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL OR (ins.state = 20 AND info.caseFilingResult = 'NOT'), 1, 0) AS canRevoke
|
||||
FROM
|
||||
bpm_process_task task
|
||||
INNER JOIN bpm_process_node_define nd ON nd.id = task.processTaskNodeId
|
||||
INNER JOIN bpm_process_instance inst ON inst.id = task.processInstanceId
|
||||
INNER JOIN proposal_info info ON info.id = inst.processInstanceBusinessId
|
||||
LEFT JOIN proposal_consolidation p ON JSON_CONTAINS(p.consolidationIds, JSON_QUOTE(info.id))
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
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
|
||||
LEFT 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
|
||||
LEFT JOIN bpm_process_task nt ON nt.prevTaskId = task.id AND nt.taskStatus = 'COMPLETE'
|
||||
LEFT JOIN proposal_merge mer ON mer.proposalId = info.id
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "committeeFilingUnit");
|
||||
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and(new Static("JSON_CONTAINS( task.assignments, '\"%s\"' )".formatted(SecurityUtil.getUserLoginname())));
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
cnd.and("nd.nodeCode", "=", 70);
|
||||
if (approval) {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.COMPLETE);
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.ACTIVE);
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS(
|
||||
SELECT 1
|
||||
FROM bpm_process_task t2
|
||||
WHERE t2.processInstanceId = task.processInstanceId
|
||||
AND t2.processTaskNodeCode = task.processTaskNodeCode
|
||||
AND t2.createdOn > task.createdOn
|
||||
)
|
||||
"""));
|
||||
cnd.groupBy("info.id");
|
||||
cnd.groupBy("task.id");
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageVO(pageForm, sql, ProposalInfoPageVO.class);
|
||||
Pagination pagination = proposalCommitteeFilingUnitService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.committeeFilingUnit")
|
||||
@ApiOperation("执行任务")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "委员会确认承办单位", msg = "委员会确认承办单位")
|
||||
@ApiOperation("委员会确认承办单位")
|
||||
public Result approval(@Valid @Param("approval") ProposalCommitteeFilingUnitApprovalParam approvalParam) {
|
||||
proposalCommitteeFilingUnitService.approval(approvalParam);
|
||||
return Result.success();
|
||||
}
|
||||
public Result executeTask(@Param("data") String data) {
|
||||
Dict args = Json.fromJson(Dict.class, data);
|
||||
String proposalId = args.getStr("proposalId");
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.committeeFilingUnit")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "委员会确认承办单位", msg = "委员会确认承办单位撤回")
|
||||
public Result revoke(@Valid String taskId) {
|
||||
proposalCommitteeFilingUnitService.revoke(taskId);
|
||||
return Result.success();
|
||||
}
|
||||
// 查询是否提案
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.committeeFilingUnit")
|
||||
@ApiOperation("查询立案的结果及承办单位")
|
||||
public Result committeeFiling(@Valid String processInstanceId, @Valid String processInstanceTaskId) {
|
||||
JSONObject newJson = new JSONObject();
|
||||
|
||||
BpmProcessTask caseUnitTask = proposalCommitteeFilingUnitService.dao().fetch(BpmProcessTask.class,
|
||||
Cnd.where(BpmProcessTask::getId, "=", processInstanceTaskId)
|
||||
.and(BpmProcessTask::getProcessInstanceId, "=", processInstanceId)
|
||||
.and(BpmProcessTask::getProcessTaskNodeCode, "=", 70)
|
||||
.and(BpmProcessTask::getDelFlag, "=", 0)
|
||||
);
|
||||
if (ObjectUtil.isNotNull(caseUnitTask) && ObjectUtil.isNotEmpty(caseUnitTask.getExtVariable())) {
|
||||
JSONObject jsonObject = caseUnitTask.getExtVariable();
|
||||
newJson.set("caseFilingResult", jsonObject.get("caseFilingResult"));
|
||||
newJson.set("hostUnitId", jsonObject.get("hostUnitId"));
|
||||
newJson.set("helpUnitIds", jsonObject.getBeanList("helpUnitIds", String.class));
|
||||
newJson.set("approvalOpinion", jsonObject.get("approvalOpinion"));
|
||||
newJson.set("consolidationIds", jsonObject.getBeanList("consolidationIds", String.class));
|
||||
return Result.success(newJson);
|
||||
// 单条审核
|
||||
List<String> mergeProposalIds = proposalCommonService.mergeProposal(proposalId);
|
||||
if (ObjectUtil.isEmpty(mergeProposalIds)) {
|
||||
flowCommonService.executeTask(args);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
BpmProcessTask caseTask = proposalCommitteeFilingUnitService.dao().fetch(BpmProcessTask.class,
|
||||
Cnd.where(BpmProcessTask::getProcessInstanceId, "=", processInstanceId)
|
||||
.and(BpmProcessTask::getDelFlag, "=", 0)
|
||||
.and(BpmProcessTask::getProcessTaskNodeCode, "=", 60)
|
||||
.desc(BpmProcessTask::getCreatedOn)
|
||||
);
|
||||
JSONObject jsonObject = caseTask.getExtVariable();
|
||||
newJson.set("caseFilingResult", jsonObject.get("caseFilingResult"));
|
||||
newJson.set("hostUnitId", jsonObject.get("hostUnitId"));
|
||||
newJson.set("helpUnitIds", jsonObject.getBeanList("helpUnitIds", String.class));
|
||||
newJson.set("approvalOpinion", jsonObject.get("approvalOpinion"));
|
||||
newJson.set("consolidationIds", jsonObject.getBeanList("consolidationIds", String.class));
|
||||
return Result.success(newJson);
|
||||
// 并案审核
|
||||
ProcessTask thisTask = baseService.dao().fetch(ProcessTask.class, args.getLong(FlowConst.PROCESS_TASK_ID_KEY));
|
||||
List<ProcessTask> mergeTasks = processTaskService.getDoingTaskByBizIdTaskName(mergeProposalIds, thisTask.getTaskName());
|
||||
for (ProcessTask mergeTask : mergeTasks) {
|
||||
Dict cloneArgs = args.clone();
|
||||
cloneArgs.put(FlowConst.PROCESS_TASK_ID_KEY, mergeTask.getId());
|
||||
flowCommonService.executeTask(cloneArgs);
|
||||
}
|
||||
|
||||
ProposalInfo info = proposalCommonService.fetch(proposalId);
|
||||
info.setCaseFilingResult(args.getStr("caseFilingResult"));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("撤销任务")
|
||||
public Result revokeTask(@Param("taskId") Long taskId,@Param("proposalId")String proposalId) {
|
||||
// 单条审核
|
||||
List<String> mergeProposalIds = proposalCommonService.mergeProposal(proposalId);
|
||||
if (ObjectUtil.isEmpty(mergeProposalIds)) {
|
||||
flowCommonService.revokeTask(taskId);
|
||||
return Result.success();
|
||||
}
|
||||
// 并案审核
|
||||
ProcessTask thisTask = baseService.dao().fetch(ProcessTask.class, taskId);
|
||||
List<ProcessTask> mergeTasks = processTaskService.getDoneTaskByBizIdTaskName(mergeProposalIds, thisTask.getTaskName());
|
||||
for (ProcessTask mergeTask : mergeTasks) {
|
||||
flowCommonService.revokeTask(mergeTask.getId());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.committeeFilingUnit")
|
||||
@ApiOperation("查询承办单位")
|
||||
public Result listUnderTake() {
|
||||
List<ProposalUndertake> list = baseService.dao().query(ProposalUndertake.class, Cnd.NEW().asc(ProposalUndertake::getCode));
|
||||
return Result.success(list);
|
||||
public Result doUpData(){
|
||||
List<ProcessTask> tasks = baseService.dao().query(ProcessTask.class, Cnd.where("taskName", "=", "personnelOffice"));
|
||||
List<Long> list = tasks.stream().map(ProcessTask::getId).toList();
|
||||
|
||||
List<ProcessTaskActor> actorList = baseService.dao().query(ProcessTaskActor.class, Cnd.where(ProcessTaskActor::getProcessTaskId, "in", list));
|
||||
|
||||
List<ProcessInstance> instanceList = baseService.dao().query(ProcessInstance.class, Cnd.where(ProcessInstance::getProcessDefineId, "=", 396));
|
||||
|
||||
for (ProcessTask task : tasks) {
|
||||
task.setTaskName("committee");
|
||||
task.setDisplayName("提案委员会立案");
|
||||
task.setFormKey("/platform/proposal/committee");
|
||||
task.setH5FormKey("");
|
||||
}
|
||||
|
||||
for (ProcessTaskActor actor : actorList) {
|
||||
actor.setActorId("1fb89886bf4c43dcb48409c83d3363c3");
|
||||
actor.setActorAccount("018054");
|
||||
actor.setActorName("赵丽霞");
|
||||
actor.setActorUnitName("工会");
|
||||
actor.setActorUnitId("0011");
|
||||
}
|
||||
|
||||
for (ProcessInstance instance : instanceList) {
|
||||
instance.setProcessDefineId(400L);
|
||||
}
|
||||
|
||||
baseService.update(tasks);
|
||||
baseService.update(actorList);
|
||||
baseService.update(instanceList);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+43
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
@@ -9,6 +10,8 @@ import com.budwk.app.base.annotation.SLog;
|
||||
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.FileExcelUtil;
|
||||
import com.budwk.app.base.utils.FileWordUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
@@ -38,13 +41,19 @@ import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@IocBean
|
||||
@@ -83,6 +92,7 @@ public class ProposalMineController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
sd.name as sourceName,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
@@ -110,6 +120,7 @@ public class ProposalMineController {
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
left join sys_dict sd on sd.code = info.source
|
||||
$condition
|
||||
""");
|
||||
|
||||
@@ -372,5 +383,37 @@ public class ProposalMineController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object importProposal(TempFile file, String templateType) throws Exception {
|
||||
if (file == null) {
|
||||
return Result.error("文件不能为空!");
|
||||
}
|
||||
String name = file.getSubmittedFileName();
|
||||
String suffix = FileUtil.getSuffix(name);
|
||||
if(!List.of("xls", "xlsx", "docx", "doc").contains(suffix.toLowerCase())) {
|
||||
throw new RuntimeException("文件格式错误: 不支持该文件{" + suffix + "}导入!");
|
||||
}
|
||||
// word docx 文件导入
|
||||
if(templateType.equals("2")) {
|
||||
List<Map<String, String>> dataMaps = FileWordUtil.readWordTable(file.getFile());
|
||||
if(dataMaps == null || dataMaps.size() == 0) {
|
||||
throw new RuntimeException("文件内容错误: 文件内容不能为空!");
|
||||
}
|
||||
for (Map<String, String> dataMap : dataMaps) {
|
||||
proposalCommonService.importProposal(dataMap);
|
||||
}
|
||||
|
||||
// excel xlsx 文件导入
|
||||
} else {
|
||||
Map<String, String> dataMap = FileExcelUtil.readExcelTable(file.getFile());
|
||||
if(dataMap == null || dataMap.size() == 0) {
|
||||
throw new RuntimeException("文件内容错误: 文件内容不能为空!");
|
||||
}
|
||||
proposalCommonService.importProposal(dataMap);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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 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.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
|
||||
* @Author FKY
|
||||
* @name:ProposalPreAuditController
|
||||
* @Date 2026/3/16 17:30
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/proposal/pre/audit")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@Api(tags = "提案管理-校工会预审核")
|
||||
public class ProposalPreAuditController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/preAudit/index.html")
|
||||
@SaCheckPermission("proposal.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.preAudit")
|
||||
@ApiOperation("分页列表")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
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
|
||||
LEFT 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "preAudit");
|
||||
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("t.id");
|
||||
cnd.desc("t.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -109,7 +109,7 @@ public class ProposalSchoolLeaderApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "school_leader");
|
||||
cnd.and("t.taskName", "=", "schoolLeader");
|
||||
|
||||
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
@@ -145,6 +145,14 @@ public class ProposalSchoolLeaderApprovalController {
|
||||
Dict args = Json.fromJson(Dict.class, data);
|
||||
String proposalId = args.getStr("proposalId");
|
||||
|
||||
ProcessTask thisTask = dao.fetch(ProcessTask.class, args.getLong(FlowConst.PROCESS_TASK_ID_KEY));
|
||||
ProcessTask parentTask = dao.fetch(ProcessTask.class, Cnd.where("id", "=", thisTask.getTaskParentId()));
|
||||
Dict dict = Json.fromJson(Dict.class, parentTask.getVariable());
|
||||
|
||||
args.put("tf_caseFilingResult", dict.getStr("tf_caseFilingResult"));
|
||||
|
||||
// 方案流程实例
|
||||
|
||||
// 单条审核
|
||||
List<String> mergeProposalIds = proposalCommonService.mergeProposal(proposalId);
|
||||
if (ObjectUtil.isEmpty(mergeProposalIds)) {
|
||||
@@ -153,7 +161,7 @@ public class ProposalSchoolLeaderApprovalController {
|
||||
}
|
||||
|
||||
// 并案审核
|
||||
ProcessTask thisTask = dao.fetch(ProcessTask.class, args.getLong(FlowConst.PROCESS_TASK_ID_KEY));
|
||||
|
||||
List<ProcessTask> mergeTasks = processTaskService.getDoingTaskByBizIdTaskName(mergeProposalIds, thisTask.getTaskName());
|
||||
for (ProcessTask mergeTask : mergeTasks) {
|
||||
Dict cloneArgs = args.clone();
|
||||
|
||||
+59
-3
@@ -1,28 +1,41 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.aspose.slides.internal.og.and;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
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.bpm.service.BpmService;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
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.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;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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 org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
@@ -83,9 +96,11 @@ public class ProposalSecondedController {
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
ta.actorName taskActorName,
|
||||
if(t.taskName = 'second', ta.actorId, ps.seconderId) taskActorUserId,
|
||||
if(t.taskName = 'second', ta.actorName, ps.userName) taskActorName,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke,
|
||||
sum( CASE WHEN ps.seconderId=@seconderId and ps.isAgree is not null THEN 1 ELSE 0 END ) as count
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
@@ -93,13 +108,16 @@ public class ProposalSecondedController {
|
||||
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
|
||||
LEFT JOIN proposal_info info ON info.id = ins.businessNo
|
||||
LEFT JOIN proposal_second ps ON ps.proposalId = info.id
|
||||
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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "second");
|
||||
cnd.and("t.taskName", "in", List.of("invite", "second", "delegation", "committee"));
|
||||
cnd.and(new Static("ps.isAgree is null"));
|
||||
sql.setParam("seconderId", SecurityUtil.getUserId());
|
||||
|
||||
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
@@ -122,4 +140,42 @@ public class ProposalSecondedController {
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("修改提案附议信息")
|
||||
@SLog(tag = "提案管理系统-附议提案", msg = "修改提案附议信息")
|
||||
public Result updateInfo(@Param("proposalId") String proposalId,
|
||||
@Param("taskActorUserId") String taskActorUserId,
|
||||
@Param("opinion") String opinion,
|
||||
@Param("submitType") Integer submitType) {
|
||||
// 查询附议信息表
|
||||
ProposalSecond proposalSecond = dao.fetch(
|
||||
ProposalSecond.class,
|
||||
Cnd.where(ProposalSecond::getProposalId, "=", proposalId)
|
||||
.and(ProposalSecond::getSeconderId, "=", taskActorUserId)
|
||||
);
|
||||
proposalSecond.setIsAgree(ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.AGREE.getCode()));
|
||||
proposalSecond.setOpinion(opinion);
|
||||
proposalSecond.setSecondedTime(DateUtil.date());
|
||||
dao.update(proposalSecond);
|
||||
|
||||
// 流程实例
|
||||
ProcessInstance processInstance = dao.fetch(ProcessInstance.class,Cnd.where(ProcessInstance::getBusinessNo, "=", proposalId));
|
||||
if(processInstance == null) return Result.success();
|
||||
|
||||
ProcessTask processTask = dao.fetch(ProcessTask.class,Cnd.where(ProcessTask::getProcessInstanceId, "=", processInstance.getId())
|
||||
.and(ProcessTask::getTaskName, "=", "second")
|
||||
.and(ProcessTask::getTaskState, "=", ProcessTaskStateEnum.ABANDON.getCode())
|
||||
.and(new Static("id in (select processTaskId from wf_process_task_actor where actorId='" + taskActorUserId + "')"))
|
||||
.limit(1,1));
|
||||
if(processTask == null) return Result.success();
|
||||
|
||||
processTask.setTaskState(ProcessTaskStateEnum.FINISHED.getCode());
|
||||
processTask.setFinishTime(DateUtil.date());
|
||||
dao.update(processTask);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpression;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 未提交预审汇总
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/proposal/unSubmitQuery")
|
||||
public class ProposalUnSubmitQueryController {
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/unSubmitQuery/index.html")
|
||||
@SaCheckPermission("proposal.unSubmitQuery")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页列表")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, String searchName, String searchKeyword, String searchName2, String searchKeyword2) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
distinct
|
||||
info.id,
|
||||
info.code as proposalCode,
|
||||
info.name as proposalName,
|
||||
vu.username,
|
||||
vu.mobile,
|
||||
vu.unitName,
|
||||
tcd.name as delegationName,
|
||||
pt.name as typeName,
|
||||
manner.name as mannerName,
|
||||
(select count(DISTINCT(seconderId))from proposal_seconded where proposalId = info.id) AS secondedNum,
|
||||
(select count(DISTINCT(seconderId))from proposal_seconded where proposalId = info.id and isAgree = 1) AS secondedAgreeNum,
|
||||
IF(info.stateCode <= 200 ,'未审核','已审核') AS delegationAudit
|
||||
FROM
|
||||
proposal_info info
|
||||
left join vw_user vu on info.createUserId = vu.id
|
||||
left join teacher_congress_delegation tcd on info.delegationId = tcd.id
|
||||
left join proposal_type pt on info.typeId = pt.id
|
||||
left join sys_dict manner on manner.`code` = info.source
|
||||
left join `wf_process_instance` ins on ins.businessNo = info.id
|
||||
left join wf_process_task nt on nt.processInstanceId = ins.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup group = Cnd.exps("ins.state", "=", 30);
|
||||
group.or("ins.state", "=", 45);
|
||||
group.or("ins.state", "=", 10);
|
||||
group.orIsNull("ins.id");
|
||||
cnd.and(group);
|
||||
|
||||
SqlExpressionGroup group2 = Cnd.exps("ins.state", "=", 30);
|
||||
group2.or("ins.state", "=", 45);
|
||||
group2.or(new Static("ins.id not in (select processInstanceId from wf_process_task where taskName='delegation')"));
|
||||
cnd.and(group2);
|
||||
|
||||
if(searchName != null && StrUtil.isNotBlank(searchKeyword)) {
|
||||
if(searchName.equals("proposalName")) {
|
||||
cnd.and("info.name", "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
if(searchName.equals("proposalCode")) {
|
||||
cnd.and("info.code", "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
}
|
||||
|
||||
if(searchName2 != null && StrUtil.isNotBlank(searchKeyword2)) {
|
||||
if(searchName2.equals("su.username")) {
|
||||
cnd.and("vu.username", "like", "%" + searchKeyword2 + "%");
|
||||
}
|
||||
}
|
||||
if(pageForm.getSessionId() != null) {
|
||||
cnd.and("info.sessionId", "=", pageForm.getSessionId());
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+1
@@ -155,6 +155,7 @@ public class ProposalUnderTakeReplyController {
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("proposal.unitReply")
|
||||
@ApiOperation("执行任务")
|
||||
public Result executeTask(@Param("data") String data) {
|
||||
|
||||
+56
@@ -1,10 +1,13 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.FileExcelUtil;
|
||||
import com.budwk.app.base.utils.FileWordUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
@@ -13,8 +16,10 @@ import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.constants.ProposalState;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalWriteService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -26,11 +31,16 @@ import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 提案撰写
|
||||
@@ -49,6 +59,8 @@ public class ProposalWriteController {
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
|
||||
@At("")
|
||||
@@ -74,6 +86,8 @@ public class ProposalWriteController {
|
||||
if (StrUtil.isBlank(proposalInfo.getCode())) {
|
||||
proposalInfo.setCode(proposalWriteService.generateProposalCode(proposalInfo.getSessionId(), proposalInfo.getDelegationId()));
|
||||
}
|
||||
// 状态码
|
||||
proposalInfo.setStateCode(ProposalState.UNSUBMIT);
|
||||
dao.insertOrUpdate(proposalInfo);
|
||||
return Result.success(proposalInfo);
|
||||
}
|
||||
@@ -103,6 +117,8 @@ public class ProposalWriteController {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
|
||||
// 更新提案状态码
|
||||
proposalCommonService.updateStateCode(proposalInfo.getId(), ProposalState.INVIRTE);
|
||||
return Result.success(proposalInfo);
|
||||
}
|
||||
|
||||
@@ -151,6 +167,14 @@ public class ProposalWriteController {
|
||||
return Result.success().addData(sysDicts);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.write")
|
||||
@ApiOperation("查询自己可撰写的提案方式(个人、代表团、委员会)")
|
||||
public Result listSourceByCode(@Valid String code) {
|
||||
List<Sys_dict> sysDicts = proposalWriteService.listSourceByCode(code);
|
||||
return Result.success().addData(sysDicts);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.write")
|
||||
@ApiOperation("检查提案撰写时间")
|
||||
@@ -160,4 +184,36 @@ public class ProposalWriteController {
|
||||
return Result.success().addData(flag);
|
||||
}
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result importProposal(TempFile file, String templateType) {
|
||||
if (file == null) {
|
||||
return Result.error("文件不能为空!");
|
||||
}
|
||||
String name = file.getSubmittedFileName();
|
||||
String suffix = FileUtil.getSuffix(name);
|
||||
if(!List.of("xls", "xlsx", "docx", "doc").contains(suffix.toLowerCase())) {
|
||||
throw new RuntimeException("文件格式错误: 不支持该文件{" + suffix + "}导入!");
|
||||
}
|
||||
ProposalInfo proposalInfo = null;
|
||||
// word docx 文件导入
|
||||
if(templateType.equals("2")) {
|
||||
List<Map<String, String>> dataMaps = FileWordUtil.readWordTable(file.getFile());
|
||||
if(dataMaps == null || dataMaps.size() == 0) {
|
||||
throw new RuntimeException("文件内容错误: 文件内容不能为空!");
|
||||
}
|
||||
proposalInfo = proposalWriteService.importProposal(dataMaps.get(0));
|
||||
|
||||
// excel xlsx 文件导入
|
||||
} else {
|
||||
Map<String, String> dataMap = FileExcelUtil.readExcelTable(file.getFile());
|
||||
if(dataMap == null || dataMap.size() == 0) {
|
||||
throw new RuntimeException("文件内容错误: 文件内容不能为空!");
|
||||
}
|
||||
proposalInfo = proposalWriteService.importProposal(dataMap);
|
||||
}
|
||||
return Result.success(proposalInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.handler;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import com.budwk.app.flow.engine.AssignmentHandler;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.engine.model.TaskModel;
|
||||
import com.budwk.app.flow.entity.Candidate;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提案主管校领导处理人
|
||||
*/
|
||||
public class ProposalSchoolLeaderAssignmentHandler implements AssignmentHandler {
|
||||
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
ProposalConfig proposalConfig = dao.fetch(ProposalConfig.class, Cnd.NEW());
|
||||
List<String> unitIds = proposalConfig.getSchoolLeaderUnitIds();
|
||||
Sql sql = Sqls.create("select id,username,loginname from vw_user where unitId in (@unitIds)");
|
||||
sql.setParam("unitIds", unitIds);
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(sql);
|
||||
List<NutMap> list = sql.getList(NutMap.class);
|
||||
|
||||
List<Candidate> candidates = list.stream().map(item -> Candidate.builder()
|
||||
.userId(item.getString("id"))
|
||||
.userName(item.getString("username"))
|
||||
.ext(Dict.of("loginName", item.getString("loginname")))
|
||||
.build()
|
||||
).toList();
|
||||
if(candidates.size() > 0) {
|
||||
return candidates.stream().map(Candidate::getUserId).toList();
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "指定主管校领导";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 220;
|
||||
}
|
||||
}
|
||||
@@ -77,4 +77,8 @@ public class ProposalSecond extends BaseModel {
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAgree;
|
||||
|
||||
@Column
|
||||
@Comment("附议人内容")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String opinion;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProposalWriteService extends BaseService<ProposalInfo> {
|
||||
|
||||
@@ -18,4 +20,7 @@ public interface ProposalWriteService extends BaseService<ProposalInfo> {
|
||||
*/
|
||||
String generateProposalCode(String sessionId,String delegationId);
|
||||
|
||||
List<Sys_dict> listSourceByCode(@Valid String code);
|
||||
|
||||
ProposalInfo importProposal(Map<String, String> stringStringMap);
|
||||
}
|
||||
|
||||
+12
@@ -8,6 +8,7 @@ import org.nutz.lang.util.NutMap;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProposalCommonService extends BaseService<ProposalInfo> {
|
||||
|
||||
@@ -113,4 +114,15 @@ public interface ProposalCommonService extends BaseService<ProposalInfo> {
|
||||
*/
|
||||
List<String> mergeProposal(String id);
|
||||
|
||||
/**
|
||||
* 导入提案
|
||||
*
|
||||
* @param dataMap
|
||||
*/
|
||||
void importProposal(Map dataMap);
|
||||
|
||||
/**
|
||||
* 修改提案状态码
|
||||
*/
|
||||
void updateStateCode(String id, Integer stateCode);
|
||||
}
|
||||
|
||||
+214
-8
@@ -1,6 +1,8 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.service.common;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -23,13 +25,15 @@ import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConsolidation;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalMerge;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake;
|
||||
import com.budwk.app.zhgh.democratic.proposal.constants.ProposalState;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.*;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalQueryComprehensiveParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalWriteService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.service.TeacherCongressDelegateService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
@@ -47,11 +51,14 @@ import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -70,6 +77,12 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private TeacherCongressDelegateService teacherCongressDelegateService;
|
||||
@Inject
|
||||
private ProposalWriteService proposalWriteService;
|
||||
|
||||
public ProposalCommonServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
@@ -193,14 +206,15 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
execute(sql);
|
||||
NutMap docData = (NutMap) sql.getResult();
|
||||
|
||||
//处理下富文本
|
||||
String brief = docData.getString("brief");
|
||||
String measures = docData.getString("measures");
|
||||
docData.put("brief", sysOfficeTemplateUtil.convertRichTextToDocText(brief));
|
||||
docData.put("measures", sysOfficeTemplateUtil.convertRichTextToDocText(measures));
|
||||
|
||||
List<Sys_dict> feedBackDict = sysDictService.getSubListByCode("PROPOSAL_FEEDBACK");
|
||||
Map<String, String> feedBackMap = feedBackDict.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
// List<Sys_dict> feedBackDict = sysDictService.getSubListByCode("PROPOSAL_FEEDBACK");
|
||||
// Map<String, String> feedBackMap = feedBackDict.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
|
||||
|
||||
// 流程实例
|
||||
@@ -217,20 +231,86 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
Map<String, List<ProcessTaskVO>> taskGroups = doneTaskVos.stream().collect(Collectors.groupingBy(ProcessTaskVO::getDisplayName));
|
||||
docData.putAll(taskGroups);
|
||||
|
||||
// 提案附议
|
||||
List<NutMap> secondInfos = new ArrayList<>();
|
||||
List<ProcessTaskVO> secondTaskVos = taskGroups.get("提案附议");
|
||||
if(secondTaskVos != null && secondTaskVos.size() > 0) {
|
||||
for (ProcessTaskVO secondTaskVO : secondTaskVos) {
|
||||
Dict taskFormData = secondTaskVO.getTaskFormData();
|
||||
if(taskFormData == null) {
|
||||
continue;
|
||||
}
|
||||
NutMap secondInfo = new NutMap();
|
||||
secondInfo.put("s_username", taskFormData.getStr("userName"));
|
||||
secondInfo.put("s_unitName", taskFormData.getStr("unitName"));
|
||||
Sql taskUserSql = Sqls.create("select mobile from sys_user where loginname=@loginname and delFlag != 1 limit 0,1");
|
||||
taskUserSql.setParam("loginname", taskFormData.getStr("loginName"));
|
||||
taskUserSql.setCallback(Sqls.callback.map());
|
||||
execute(taskUserSql);
|
||||
NutMap taskUserMap = (NutMap) taskUserSql.getResult();
|
||||
secondInfo.put("s_mobile", taskUserMap.getString("mobile"));
|
||||
secondInfos.add(secondInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 代表团意见
|
||||
List<NutMap> delegationAuditList = new ArrayList<>();
|
||||
List<ProcessTaskVO> delegationTaskVos = taskGroups.get("团长审核");
|
||||
if(delegationTaskVos != null && delegationTaskVos.size() > 0) {
|
||||
for (ProcessTaskVO delegationTaskVO : delegationTaskVos) {
|
||||
Dict taskFormData = delegationTaskVO.getTaskFormData();
|
||||
if(taskFormData == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NutMap delegationAudit = new NutMap();
|
||||
delegationAudit.put("opinion", taskFormData.getStr("opinion"));
|
||||
delegationAudit.put("username", taskFormData.getStr("userName"));
|
||||
delegationAudit.put("auditTime", DateUtil.format(delegationTaskVO.getFinishTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
delegationAuditList.add(delegationAudit);
|
||||
}
|
||||
}
|
||||
|
||||
// 导出单元格数据信息
|
||||
Map<String, Object> docCellDataMap = new HashMap<>();
|
||||
// 编号
|
||||
docCellDataMap.put("proposalCode", docData.getString("code"));
|
||||
// 提交时间
|
||||
docCellDataMap.put("createTime", docData.getString("createTime"));
|
||||
// 提案人
|
||||
docCellDataMap.put("username", docData.getString("createUserName"));
|
||||
// 所在代表团
|
||||
docCellDataMap.put("delegationName", docData.getString("delegationName"));
|
||||
// 所在单位
|
||||
docCellDataMap.put("unitName", docData.getString("unitName"));
|
||||
// 联系方式
|
||||
docCellDataMap.put("mobile", docData.getString("mobile"));
|
||||
// 提案名称
|
||||
docCellDataMap.put("proposalName", docData.getString("name"));
|
||||
// 提案内容
|
||||
docCellDataMap.put("brief", docData.getString("brief"));
|
||||
// 建议措施
|
||||
docCellDataMap.put("measures", docData.getString("measures"));
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
||||
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
|
||||
|
||||
Configure config = Configure.builder()
|
||||
.bind("secondedList", policy)
|
||||
.bind("seconders", policy)
|
||||
.bind("提案附议", policy)
|
||||
.bind("brief", htmlRenderPolicy)
|
||||
.bind("measures", htmlRenderPolicy)
|
||||
.bind("taskFormData.tf_opinion", htmlRenderPolicy)
|
||||
.build();
|
||||
|
||||
Map<String, Object> renderDocCellDataMap = MapUtil.of("proposal", docCellDataMap);
|
||||
renderDocCellDataMap.put("secondedList", secondInfos);
|
||||
renderDocCellDataMap.put("delegationAuditList", delegationAuditList);
|
||||
|
||||
try {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("proposal"), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("proposal"), config).render(renderDocCellDataMap).writeAndClose(byteArrayOutputStream);
|
||||
} catch (IOException e) {
|
||||
log.error("提案导出失败{},提案id:{}", e.getMessage(), id);
|
||||
}
|
||||
@@ -632,4 +712,130 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importProposal(Map dataMap) {
|
||||
String loginName = MapUtil.getStr(dataMap, "工号", "");
|
||||
String username = MapUtil.getStr(dataMap, "提案人", "");
|
||||
String proposalDate = MapUtil.getStr(dataMap, "提案时间", "");
|
||||
String proposalType = MapUtil.getStr(dataMap, "提案类型", "");
|
||||
String proposalSource = MapUtil.getStr(dataMap, "提案方式", "");
|
||||
String proposalName = MapUtil.getStr(dataMap, "提案名称", "");
|
||||
String proposalContent = MapUtil.getStr(dataMap, "案由", "");
|
||||
String proposalMeasures = MapUtil.getStr(dataMap, "建议措施", "");
|
||||
|
||||
// 工号
|
||||
if(StrUtil.isBlank(loginName)) {
|
||||
throw new RuntimeException("工号不能为空");
|
||||
}
|
||||
Sys_user user = sysUserService.getByLoginName(loginName);
|
||||
if(user == null){
|
||||
throw new RuntimeException("工号不存在");
|
||||
}
|
||||
if(StrUtil.isNotBlank(username) && !username.equals(user.getUsername())) {
|
||||
throw new RuntimeException("工号和提案人不一致");
|
||||
}
|
||||
|
||||
// 提案时间
|
||||
if(StrUtil.isBlank(proposalDate)) {
|
||||
throw new RuntimeException("提案时间不能为空");
|
||||
}
|
||||
|
||||
// 提案类型
|
||||
if(StrUtil.isBlank(proposalType)) {
|
||||
throw new RuntimeException("提案类型不能为空");
|
||||
}
|
||||
ProposalType proposalTypeObj = dao().fetch(ProposalType.class, Cnd.where(ProposalType::getName, "=", proposalType));
|
||||
if(proposalTypeObj == null) {
|
||||
throw new RuntimeException("提案类型不存在");
|
||||
}
|
||||
|
||||
// 提案方式
|
||||
if(StrUtil.isBlank(proposalSource)) {
|
||||
throw new RuntimeException("提案方式不能为空");
|
||||
}
|
||||
Sys_dict dict = sysDictService.fetch(Cnd.where("code", "=", "PROPOSAL_SOURCE"));
|
||||
if(dict == null) {
|
||||
throw new RuntimeException("提案方式字典配置不存在");
|
||||
}
|
||||
List<Sys_dict> sysDicts = sysDictService.query(Cnd.where("parentId", "=", Strings.sNull(dict.getId())).asc("location"));
|
||||
if(sysDicts == null || sysDicts.size() == 0) {
|
||||
throw new RuntimeException("提案方式字典配置不存在");
|
||||
}
|
||||
Sys_dict proposalSourceDict = sysDicts.stream().filter(v -> v.getName().equals(proposalSource)).findFirst().orElse(null);
|
||||
if(proposalSourceDict == null) {
|
||||
throw new RuntimeException("提案方式不存在");
|
||||
}
|
||||
|
||||
// 提案名称
|
||||
if(StrUtil.isBlank(proposalName)) {
|
||||
throw new RuntimeException("提案名称不能为空");
|
||||
}
|
||||
|
||||
// 案由
|
||||
if(StrUtil.isBlank(proposalContent)) {
|
||||
throw new RuntimeException("案由不能为空");
|
||||
}
|
||||
|
||||
// 建议措施
|
||||
if(StrUtil.isBlank(proposalMeasures)) {
|
||||
throw new RuntimeException("建议措施不能为空");
|
||||
}
|
||||
|
||||
// 判断当前导入用户是否是代表
|
||||
Teacher_congress_delegate delegate = teacherCongressDelegateService.fetch(Cnd.where(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())
|
||||
.and(Teacher_congress_delegate::getDelFlag, "!=", 1).limit(1));
|
||||
if(delegate == null) {
|
||||
throw new RuntimeException("当前用户不是代表");
|
||||
}
|
||||
|
||||
// 教代会
|
||||
List<Teacher_congress_session> teacherCongressSessions = this.dao().query(Teacher_congress_session.class, Cnd.where("enable", "=", 1).desc("startDate"));
|
||||
if(teacherCongressSessions == null || teacherCongressSessions.size() <= 0) {
|
||||
throw new RuntimeException("没有开启的教代会");
|
||||
}
|
||||
Teacher_congress_session teacherCongressSession = teacherCongressSessions.get(0);
|
||||
|
||||
// 保存到数据库
|
||||
ProposalInfo proposalInfo = new ProposalInfo();
|
||||
// 状态码
|
||||
proposalInfo.setStateCode(ProposalState.UNSUBMIT);
|
||||
// 教代会信息
|
||||
proposalInfo.setSessionId(teacherCongressSession.getId());
|
||||
// 代表团ID
|
||||
proposalInfo.setDelegationId(delegate.getDelegationId());
|
||||
// 提案编号
|
||||
Sql sql = Sqls.create("select max(code) proposalCode from proposal_info where sessionId='%s' and stateCode<='%s'".formatted(proposalInfo.getSessionId(), ProposalState.CASE));
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
Map<String, Object> map = this.dao().execute(sql).getObject(Map.class);
|
||||
int proposalCode = MapUtil.getInt(map, "proposalCode", -1);
|
||||
if (proposalCode == -1) {
|
||||
proposalCode = Integer.parseInt(com.budwk.app.sys.utils.DateUtil.getYear() + "01");
|
||||
} else {
|
||||
proposalCode = proposalCode + 1;
|
||||
}
|
||||
proposalInfo.setCode(proposalCode + "");
|
||||
// 提案人
|
||||
proposalInfo.setCreateUserId(user.getId());
|
||||
proposalInfo.setCreateUserName(user.getUsername());
|
||||
// 提案名称
|
||||
proposalInfo.setName(proposalName);
|
||||
// 提案时间
|
||||
proposalInfo.setCreateTime(proposalDate);
|
||||
// 提案方式
|
||||
proposalInfo.setSource(proposalSourceDict.getCode());
|
||||
// 提案类型
|
||||
proposalInfo.setTypeId(proposalTypeObj.getId());
|
||||
// 案由
|
||||
proposalInfo.setBrief(proposalContent);
|
||||
// 建议措施
|
||||
proposalInfo.setMeasures(proposalMeasures);
|
||||
this.insert(proposalInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStateCode(String id, Integer stateCode) {
|
||||
Sql sql = Sqls.create("update proposal_info set stateCode='%s' where id='%s'".formatted(stateCode, id));
|
||||
this.dao().execute(sql);
|
||||
}
|
||||
}
|
||||
|
||||
+170
-21
@@ -1,30 +1,44 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.constants.ProposalState;
|
||||
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.ProposalWriteService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.service.TeacherCongressDelegateService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ProposalWriteServiceImpl extends BaseServiceImpl<ProposalInfo> implements ProposalWriteService {
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private TeacherCongressDelegateService teacherCongressDelegateService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
public ProposalWriteServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
@@ -67,28 +81,163 @@ public class ProposalWriteServiceImpl extends BaseServiceImpl<ProposalInfo> impl
|
||||
@Override
|
||||
public String generateProposalCode(String sessionId, String delegationId) {
|
||||
//查询届次下 某代表团的提案数量
|
||||
Teacher_congress_session session = dao().fetch(Teacher_congress_session.class, sessionId);
|
||||
Teacher_congress_delegation delegation = dao().fetch(Teacher_congress_delegation.class, delegationId);
|
||||
|
||||
Sql sql = Sqls.fetchString("""
|
||||
SELECT
|
||||
MAX( t1.code ) as proposalCode
|
||||
FROM
|
||||
proposal_info t1
|
||||
WHERE
|
||||
t1.sessionId = @sessionId
|
||||
AND t1.delegationId = @delegationId
|
||||
""");
|
||||
sql.setParam("sessionId", sessionId);
|
||||
sql.setParam("delegationId", delegationId);
|
||||
execute(sql);
|
||||
String proposalCode = sql.getString();
|
||||
if (StrUtil.isBlank(proposalCode)) {
|
||||
proposalCode = delegation.getCode() + "-" + "01";
|
||||
// Teacher_congress_session session = dao().fetch(Teacher_congress_session.class, sessionId);
|
||||
// Teacher_congress_delegation delegation = dao().fetch(Teacher_congress_delegation.class, delegationId);
|
||||
//
|
||||
// Sql sql = Sqls.fetchString("""
|
||||
// SELECT
|
||||
// MAX( t1.code ) as proposalCode
|
||||
// FROM
|
||||
// proposal_info t1
|
||||
// WHERE
|
||||
// t1.sessionId = @sessionId
|
||||
// AND t1.delegationId = @delegationId
|
||||
// """);
|
||||
// sql.setParam("sessionId", sessionId);
|
||||
// sql.setParam("delegationId", delegationId);
|
||||
// execute(sql);
|
||||
// String proposalCode = sql.getString();
|
||||
// if (StrUtil.isBlank(proposalCode)) {
|
||||
// proposalCode = delegation.getCode() + "-" + "01";
|
||||
// } else {
|
||||
// String s = String.format("%02d", (Convert.toInt(proposalCode.substring(proposalCode.length() - 2))) + 1);
|
||||
// proposalCode = delegation.getCode() + "-" + s;
|
||||
// }
|
||||
Sql sql = Sqls.create("select max(code) proposalCode from proposal_info where sessionId='%s' and stateCode<='%s'".formatted(sessionId, ProposalState.CASE));
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
Map<String, Object> map = this.dao().execute(sql).getObject(Map.class);
|
||||
int proposalCode = MapUtil.getInt(map, "proposalCode", -1);
|
||||
if (proposalCode == -1) {
|
||||
proposalCode = Integer.parseInt(com.budwk.app.sys.utils.DateUtil.getYear() + "01");
|
||||
} else {
|
||||
String s = String.format("%02d", (Convert.toInt(proposalCode.substring(proposalCode.length() - 2))) + 1);
|
||||
proposalCode = delegation.getCode() + "-" + s;
|
||||
proposalCode = proposalCode + 1;
|
||||
}
|
||||
return proposalCode;
|
||||
return String.valueOf(proposalCode);
|
||||
}
|
||||
|
||||
@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"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProposalInfo importProposal(Map<String, String> dataMap) {
|
||||
String loginName = MapUtil.getStr(dataMap, "工号", "");
|
||||
String username = MapUtil.getStr(dataMap, "提案人", "");
|
||||
String proposalDate = MapUtil.getStr(dataMap, "提案时间", "");
|
||||
String proposalType = MapUtil.getStr(dataMap, "提案类型", "");
|
||||
String proposalSource = MapUtil.getStr(dataMap, "提案方式", "");
|
||||
String proposalName = MapUtil.getStr(dataMap, "提案名称", "");
|
||||
String proposalContent = MapUtil.getStr(dataMap, "案由", "");
|
||||
String proposalMeasures = MapUtil.getStr(dataMap, "建议措施", "");
|
||||
|
||||
// 工号
|
||||
if(StrUtil.isBlank(loginName)) {
|
||||
throw new RuntimeException("工号不能为空");
|
||||
}
|
||||
Sys_user user = sysUserService.getByLoginName(loginName);
|
||||
if(user == null){
|
||||
throw new RuntimeException("工号不存在");
|
||||
}
|
||||
if(StrUtil.isNotBlank(username) && !username.equals(user.getUsername())) {
|
||||
throw new RuntimeException("工号和提案人不一致");
|
||||
}
|
||||
|
||||
// 提案时间
|
||||
if(StrUtil.isBlank(proposalDate)) {
|
||||
throw new RuntimeException("提案时间不能为空");
|
||||
}
|
||||
|
||||
// 提案类型
|
||||
if(StrUtil.isBlank(proposalType)) {
|
||||
throw new RuntimeException("提案类型不能为空");
|
||||
}
|
||||
ProposalType proposalTypeObj = dao().fetch(ProposalType.class, Cnd.where(ProposalType::getName, "=", proposalType));
|
||||
if(proposalTypeObj == null) {
|
||||
throw new RuntimeException("提案类型不存在");
|
||||
}
|
||||
|
||||
// 提案方式
|
||||
if(StrUtil.isBlank(proposalSource)) {
|
||||
throw new RuntimeException("提案方式不能为空");
|
||||
}
|
||||
Sys_dict dict = sysDictService.fetch(Cnd.where("code", "=", "PROPOSAL_SOURCE"));
|
||||
if(dict == null) {
|
||||
throw new RuntimeException("提案方式字典配置不存在");
|
||||
}
|
||||
List<Sys_dict> sysDicts = sysDictService.query(Cnd.where("parentId", "=", Strings.sNull(dict.getId())).asc("location"));
|
||||
if(sysDicts == null || sysDicts.size() == 0) {
|
||||
throw new RuntimeException("提案方式字典配置不存在");
|
||||
}
|
||||
Sys_dict proposalSourceDict = sysDicts.stream().filter(v -> v.getName().equals(proposalSource)).findFirst().orElse(null);
|
||||
if(proposalSourceDict == null) {
|
||||
throw new RuntimeException("提案方式不存在");
|
||||
}
|
||||
|
||||
// 提案名称
|
||||
if(StrUtil.isBlank(proposalName)) {
|
||||
throw new RuntimeException("提案名称不能为空");
|
||||
}
|
||||
|
||||
// 案由
|
||||
if(StrUtil.isBlank(proposalContent)) {
|
||||
throw new RuntimeException("案由不能为空");
|
||||
}
|
||||
|
||||
// 建议措施
|
||||
if(StrUtil.isBlank(proposalMeasures)) {
|
||||
throw new RuntimeException("建议措施不能为空");
|
||||
}
|
||||
|
||||
// 判断当前导入用户是否是代表
|
||||
Teacher_congress_delegate delegate = teacherCongressDelegateService.fetch(Cnd.where(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())
|
||||
.and(Teacher_congress_delegate::getDelFlag, "!=", 1).limit(1));
|
||||
if(delegate == null) {
|
||||
throw new RuntimeException("当前用户不是代表");
|
||||
}
|
||||
|
||||
// 教代会
|
||||
List<Teacher_congress_session> teacherCongressSessions = this.dao().query(Teacher_congress_session.class, Cnd.where("enable", "=", 1).desc("startDate"));
|
||||
if(teacherCongressSessions == null || teacherCongressSessions.size() <= 0) {
|
||||
throw new RuntimeException("没有开启的教代会");
|
||||
}
|
||||
Teacher_congress_session teacherCongressSession = teacherCongressSessions.get(0);
|
||||
|
||||
// 保存到数据库
|
||||
ProposalInfo proposalInfo = new ProposalInfo();
|
||||
// 状态码
|
||||
proposalInfo.setStateCode(ProposalState.UNSUBMIT);
|
||||
// 教代会信息
|
||||
proposalInfo.setSessionId(teacherCongressSession.getId());
|
||||
// 代表团ID
|
||||
proposalInfo.setDelegationId(delegate.getDelegationId());
|
||||
// 提案编号
|
||||
Sql sql = Sqls.create("select max(code) proposalCode from proposal_info where sessionId='%s' and stateCode<='%s'".formatted(proposalInfo.getSessionId(), ProposalState.CASE));
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
Map<String, Object> map = this.dao().execute(sql).getObject(Map.class);
|
||||
int proposalCode = MapUtil.getInt(map, "proposalCode", -1);
|
||||
if (proposalCode == -1) {
|
||||
proposalCode = Integer.parseInt(com.budwk.app.sys.utils.DateUtil.getYear() + "01");
|
||||
} else {
|
||||
proposalCode = proposalCode + 1;
|
||||
}
|
||||
proposalInfo.setCode(proposalCode + "");
|
||||
// 提案人
|
||||
proposalInfo.setCreateUserId(user.getId());
|
||||
proposalInfo.setCreateUserName(user.getUsername());
|
||||
// 提案名称
|
||||
proposalInfo.setName(proposalName);
|
||||
// 提案时间
|
||||
proposalInfo.setCreateTime(proposalDate);
|
||||
// 提案方式
|
||||
proposalInfo.setSource(proposalSourceDict.getCode());
|
||||
// 提案类型
|
||||
proposalInfo.setTypeId(proposalTypeObj.getId());
|
||||
// 案由
|
||||
proposalInfo.setBrief(proposalContent);
|
||||
// 建议措施
|
||||
proposalInfo.setMeasures(proposalMeasures);
|
||||
return proposalInfo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user