first commit

This commit is contained in:
2026-09-08 20:09:15 +08:00
commit c7e76e98ab
1647 changed files with 210480 additions and 0 deletions
+134
View File
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-modules-threeEducation</artifactId>
<version>1.0.0</version>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<!-- nutz -->
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-system</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-threeEducation</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,17 @@
package com.ruoyi.threeEducation;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class RuoYiThreeEducationApplication {
public static void main(String[] args) {
SpringApplication.run(RuoYiThreeEducationApplication.class, args);
}
}
@@ -0,0 +1,42 @@
package com.ruoyi.threeEducation.projectApply.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/pa/apply")
public class ThreeEducationPaApplyController {
@Autowired
private ThreeEducationPaService threeEducationPaService;
@PostMapping("/doSave")
@RequiresPermissions("threeEducation:projectApply:apply")
public AjaxResult doSave(@RequestBody ThreeEducation threeEducation) {
threeEducationPaService.doSave(threeEducation);
return AjaxResult.success();
}
@PostMapping("/doSubmit")
@RequiresPermissions("threeEducation:projectApply:apply")
public AjaxResult doSubmit(@RequestBody ThreeEducation threeEducation) {
threeEducationPaService.doSubmit(threeEducation);
return AjaxResult.success();
}
/**
* 获取当前登录用户的工会小组信息 小组名称 组长 联系电话 小组人数
*
* @return {@link AjaxResult}
*/
@GetMapping("/getCurrentUserUnionGroupInfo")
@RequiresPermissions("threeEducation:projectApply:apply")
public AjaxResult getCurrentUserUnionGroupInfo() {
return AjaxResult.success(threeEducationPaService.getCurrentUserUnionGroupInfo());
}
}
@@ -0,0 +1,52 @@
package com.ruoyi.threeEducation.projectApply.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaBranchUnionAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/pa/branchUnionAudit")
public class ThreeEducationPaBranchUnionAuditController {
@Autowired
private ThreeEducationPaBranchUnionAuditService threeEducationPaBranchUnionAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:projectApply:branchUnionAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationPaBranchUnionAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:projectApply:branchUnionAudit")
public AjaxResult doPass(@RequestBody ThreeEducationApprovalAudit audit) {
threeEducationPaBranchUnionAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:projectApply:branchUnionAudit")
public AjaxResult doReject(@RequestBody ThreeEducationApprovalAudit audit) {
threeEducationPaBranchUnionAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:projectApply:branchUnionAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationApprovalAudit audit) {
threeEducationPaBranchUnionAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:projectApply:branchUnionAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationPaBranchUnionAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,26 @@
package com.ruoyi.threeEducation.projectApply.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/pa/query")
public class ThreeEducationPaQueryController {
@Autowired
private ThreeEducationPaQueryService threeEducationPaQueryService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:projectApply:query")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationPaQueryService.pageData(pageForm));
}
}
@@ -0,0 +1,104 @@
package com.ruoyi.threeEducation.projectApply.controller;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditType;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaService;
import lombok.extern.slf4j.Slf4j;
import org.ddr.poi.html.HtmlRenderPolicy;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.stream.Collectors;
/**
* 申请记录
*
* @author jug
* @date 2023/02/05
*/
@RestController
@RequestMapping("/pa/record")
@Slf4j
public class ThreeEducationPaRecordController {
@Autowired
private ThreeEducationPaService threeEducationPaService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:projectApply:applyRecord")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationPaService.pageData(pageForm));
}
@PostMapping("/doDelete")
@RequiresPermissions("threeEducation:projectApply:applyRecord")
public AjaxResult doDelete(@RequestParam String id) {
threeEducationPaService.doDelete(id);
return AjaxResult.success();
}
@GetMapping("/findOne")
@RequiresPermissions("threeEducation:projectApply:applyRecord")
public AjaxResult findOne(@RequestParam String id) {
return AjaxResult.success(threeEducationPaService.fetch(id));
}
@GetMapping("/getApplyInfo")
@RequiresPermissions("threeEducation:projectApply:applyRecord")
public AjaxResult getApplyInfo(@RequestParam String id) {
ThreeEducation threeEducation = threeEducationPaService.fetch(id);
NutMap threeEducationMapData = Lang.obj2nutmap(threeEducation);
Dao dao = threeEducationPaService.dao();
List<ThreeEducationApprovalAudit> audits = dao.query(ThreeEducationApprovalAudit.class, Cnd.where("projectId", "=", id));
threeEducationMapData.setv("branchUnionAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationApprovalAuditType.BRANCH_UNION).collect(Collectors.toList()));
threeEducationMapData.setv("schoolUnionAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationApprovalAuditType.SCHOOL_UNION).collect(Collectors.toList()));
return AjaxResult.success(threeEducationMapData);
}
/**
* 导出申请表
*
* @param projectId 项目id
*/
@PostMapping("/exportPaForm")
@RequiresPermissions("threeEducation:projectApply:applyRecord")
public void exportPaForm(@RequestParam(name = "id") String projectId, HttpServletResponse response) {
try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/threeEducationApply.docx");
ServletOutputStream outputStream = response.getOutputStream()) {
assert inputStream != null;
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=%s".formatted(URLEncoder.encode("三育人活动立项方案.docx", StandardCharsets.UTF_8)));
NutMap dataMap = threeEducationPaService.exportRmForm(projectId);
LoopRowTableRenderPolicy hackLoopTableRenderPolicy = new LoopRowTableRenderPolicy();
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
Configure config = Configure.builder()
.bind("budgetDetails", hackLoopTableRenderPolicy)
.bind("reimbursementDetails ", hackLoopTableRenderPolicy)
.bind("approvalContent ", htmlRenderPolicy)
.useSpringEL(false)
.build();
XWPFTemplate.compile(inputStream, config).render(dataMap, outputStream);
} catch (Exception e) {
log.error("三育人申请表导出失败{}", e.getMessage());
}
}
}
@@ -0,0 +1,52 @@
package com.ruoyi.threeEducation.projectApply.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaSchoolUnionAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/pa/schoolUnionAudit")
public class ThreeEducationPaSchoolUnionAuditController {
@Autowired
private ThreeEducationPaSchoolUnionAuditService threeEducationPaSchoolUnionAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:projectApply:schoolUnionAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationPaSchoolUnionAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:projectApply:schoolUnionAudit")
public AjaxResult doPass(@RequestBody ThreeEducationApprovalAudit audit) {
threeEducationPaSchoolUnionAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:projectApply:schoolUnionAudit")
public AjaxResult doReject(@RequestBody ThreeEducationApprovalAudit audit) {
threeEducationPaSchoolUnionAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:projectApply:schoolUnionAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationApprovalAudit audit) {
threeEducationPaSchoolUnionAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:projectApply:schoolUnionAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationPaSchoolUnionAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,41 @@
package com.ruoyi.threeEducation.projectApply.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
public interface ThreeEducationPaBranchUnionAuditService extends BaseService<ThreeEducation> {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationApprovalAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationApprovalAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationApprovalAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,12 @@
package com.ruoyi.threeEducation.projectApply.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
public interface ThreeEducationPaQueryService extends BaseService<ThreeEducation> {
Pagination pageData(ThreeEducationPageForm pageForm);
}
@@ -0,0 +1,41 @@
package com.ruoyi.threeEducation.projectApply.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
public interface ThreeEducationPaSchoolUnionAuditService extends BaseService<ThreeEducation> {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationApprovalAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationApprovalAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationApprovalAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,23 @@
package com.ruoyi.threeEducation.projectApply.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import org.nutz.lang.util.NutMap;
public interface ThreeEducationPaService extends BaseService<ThreeEducation> {
void doSave(ThreeEducation threeEducation);
void doSubmit(ThreeEducation threeEducation);
void doDelete(String id);
Pagination pageData(ThreeEducationPageForm pageForm);
NutMap getCurrentUserUnionGroupInfo();
NutMap exportRmForm(String projectId);
}
@@ -0,0 +1,171 @@
package com.ruoyi.threeEducation.projectApply.service.impl;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditType;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaBranchUnionAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class ThreeEducationPaBranchUnionAuditServiceImpl extends BaseServiceImpl<ThreeEducation> implements ThreeEducationPaBranchUnionAuditService {
public ThreeEducationPaBranchUnionAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
@Transactional
void doAudit(ThreeEducationApprovalAudit audit) {
audit.setAuditType(ThreeEducationApprovalAuditType.BRANCH_UNION);
dao().insert(audit);
String condolenceId = audit.getProjectId();
Chain chain = Chain.make("branchUnionAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS -> chain.add("stateId", ThreeEducationApprovalAuditState.SCHOOL_UNION_READY);
case AuditConstants.REJECT -> chain.add("stateId", ThreeEducationApprovalAuditState.BRANCH_UNION_REJECTED);
case AuditConstants.BACK -> chain.add("stateId", ThreeEducationApprovalAuditState.BRANCH_UNION_BACK_MODIFY);
}
dao().update(ThreeEducation.class, chain, Cnd.where("id", "=", condolenceId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
e.*,
state.stateName
FROM
`three_education` e
LEFT JOIN audit_state state ON state.stateId = e.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("e.stateId", ">", ThreeEducationApprovalAuditState.NOT_SUBMIT);
cnd.andEX("YEAR(e.applyTime)", "=", pageForm.getYear());
if (AuthUtil.hasRole("admin")) {
cnd.andEX("e.applyUserUnionId", "=", pageForm.getUnionId());
} else {
cnd.andEX("e.applyUserUnionId", "=", SecurityUtils.getUnionId());
}
cnd.andEX("e.unionGroupId", "=", pageForm.getUnionGroupId());
cnd.andEX("e.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("e.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
if (pageForm.getIsAudit() == null) {
cnd.and("e.stateId", ">=", ThreeEducationApprovalAuditState.BRANCH_UNION_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("e.stateId", ">", ThreeEducationApprovalAuditState.BRANCH_UNION_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("e.stateId", "=", ThreeEducationApprovalAuditState.BRANCH_UNION_READY);
}
cnd.and(Cnd.likeEX("e.projectName", pageForm.getSearchKeyword()));
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Transactional
public void doPass(ThreeEducationApprovalAudit audit) {
audit.setAuditResult(AuditConstants.PASS);
this.doAudit(audit);
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId(),
String.valueOf(ThreeEducationApprovalAuditState.BRANCH_UNION_READY),
"待校工会审核",
SecurityConstants.INNER);
R<List<String>> assignments = localProcessService.getAssignments(null, null, Roles.SCHOOL_ADMIN, SecurityConstants.INNER);
List<String> loginNameList = assignments.getData();
localProcessService.initCreateTask(
"THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId(),
String.valueOf(ThreeEducationApprovalAuditState.SCHOOL_UNION_READY),
"待校工会审核",
loginNameList,
"/threeEducation/projectApply/schoolUnionAudit",
null,
SecurityConstants.INNER
);
}
@Override
@Transactional
public void doReject(ThreeEducationApprovalAudit audit) {
audit.setAuditResult(AuditConstants.REJECT);
this.doAudit(audit);
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId(),
String.valueOf(ThreeEducationApprovalAuditState.BRANCH_UNION_READY),
"分工会审核拒绝",
SecurityConstants.INNER);
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId(), true, SecurityConstants.INNER);
}
@Override
@Transactional
public void doBackTo(ThreeEducationApprovalAudit audit) {
String processUniqueId = "THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId();
ThreeEducation threeEducation = fetch(audit.getProjectId());
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationApprovalAuditState.BRANCH_UNION_READY),
"分工会审核退回修改",
SecurityConstants.INNER);
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", threeEducation.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationApprovalAuditState.BRANCH_UNION_BACK_MODIFY),
"分工会审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/projectApply/applyRecord",
null,
SecurityConstants.INNER
);
audit.setAuditResult(AuditConstants.BACK);
this.doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducation threeEducation = fetch(id);
String branchUnionAuditId = threeEducation.getBranchUnionAuditId();
dao().clear(ThreeEducationApprovalAudit.class, Cnd.where("id", "=", branchUnionAuditId));
Chain chain = Chain.make("branchUnionAuditId", null);
chain.add("stateId", ThreeEducationApprovalAuditState.BRANCH_UNION_READY);
dao().update(ThreeEducation.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_PROJECT_APPLY@" + id,
String.valueOf(ThreeEducationApprovalAuditState.BRANCH_UNION_READY),
SecurityConstants.INNER);
}
}
@@ -0,0 +1,47 @@
package com.ruoyi.threeEducation.projectApply.service.impl;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaQueryService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.springframework.stereotype.Service;
@Service
public class ThreeEducationPaQueryServiceImpl extends BaseServiceImpl<ThreeEducation> implements ThreeEducationPaQueryService {
public ThreeEducationPaQueryServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
e.*,
state.stateName
FROM
`three_education` e
LEFT JOIN audit_state state ON state.stateId = e.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("e.stateId", "=", ThreeEducationApprovalAuditState.SCHOOL_UNION_PASS);
cnd.andEX("YEAR(e.applyTime)", "=", pageForm.getYear());
cnd.andEX("e.applyUserUnionId", "=", pageForm.getUnionId());
cnd.andEX("e.unionGroupId", "=", pageForm.getUnionGroupId());
cnd.andEX("e.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("e.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
cnd.and(Cnd.likeEX("e.projectName", pageForm.getSearchKeyword()));
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
}
@@ -0,0 +1,169 @@
package com.ruoyi.threeEducation.projectApply.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditType;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationApprovalAudit;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaSchoolUnionAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@Service
public class ThreeEducationPaSchoolUnionAuditServiceImpl extends BaseServiceImpl<ThreeEducation> implements ThreeEducationPaSchoolUnionAuditService {
public ThreeEducationPaSchoolUnionAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
@Transactional
void doAudit(ThreeEducationApprovalAudit audit) {
audit.setAuditType(ThreeEducationApprovalAuditType.SCHOOL_UNION);
dao().insert(audit);
String projectId = audit.getProjectId();
Chain chain = Chain.make("schoolUnionAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS -> chain.add("stateId", ThreeEducationApprovalAuditState.SCHOOL_UNION_PASS);
case AuditConstants.REJECT -> chain.add("stateId", ThreeEducationApprovalAuditState.SCHOOL_UNION_REJECTED);
case AuditConstants.BACK -> chain.add("stateId", ThreeEducationApprovalAuditState.SCHOOL_UNION_BACK_MODIFY);
}
dao().update(ThreeEducation.class, chain, Cnd.where("id", "=", projectId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
e.*,
state.stateName
FROM
`three_education` e
LEFT JOIN audit_state state ON state.stateId = e.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("e.stateId", ">=", ThreeEducationApprovalAuditState.SCHOOL_UNION_READY);
cnd.andEX("YEAR(e.applyTime)", "=", pageForm.getYear());
cnd.andEX("e.applyUserUnionId", "=", pageForm.getUnionId());
cnd.andEX("e.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("e.unionGroupId", "=", pageForm.getUnionGroupId());
cnd.andEX("e.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
if (pageForm.getIsAudit() == null) {
cnd.and("e.stateId", ">=", ThreeEducationApprovalAuditState.SCHOOL_UNION_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("e.stateId", ">", ThreeEducationApprovalAuditState.SCHOOL_UNION_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("e.stateId", "=", ThreeEducationApprovalAuditState.SCHOOL_UNION_READY);
}
cnd.and(Cnd.likeEX("e.projectName", pageForm.getSearchKeyword()));
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@DSTransactional
public void doPass(ThreeEducationApprovalAudit audit) {
audit.setAuditResult(AuditConstants.PASS);
this.doAudit(audit);
ThreeEducationReimbursement reimbursement = new ThreeEducationReimbursement();
reimbursement.setProjectId(audit.getProjectId());
reimbursement.setStateId(ThreeEducationReimbursementAuditState.NOT_SUBMIT);
reimbursement.setReimbursementDetails(new ArrayList<>());
insert(reimbursement);
String processUniqueId = "THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId();
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationApprovalAuditState.SCHOOL_UNION_READY),
"校工会审核通过",
SecurityConstants.INNER);
localProcessService.completeProcess(processUniqueId, false, SecurityConstants.INNER);
}
@Override
@DSTransactional
public void doReject(ThreeEducationApprovalAudit audit) {
audit.setAuditResult(AuditConstants.REJECT);
this.doAudit(audit);
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId(),
String.valueOf(ThreeEducationApprovalAuditState.SCHOOL_UNION_READY),
"校工会审核拒绝",
SecurityConstants.INNER);
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId(), true, SecurityConstants.INNER);
}
@Override
@DSTransactional
public void doBackTo(ThreeEducationApprovalAudit audit) {
String processUniqueId= "THREEEDUCATION_PROJECT_APPLY@" + audit.getProjectId();
ThreeEducation threeEducation = fetch(audit.getProjectId());
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationApprovalAuditState.SCHOOL_UNION_READY),
"校工会审核退回修改",
SecurityConstants.INNER);
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", threeEducation.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationApprovalAuditState.SCHOOL_UNION_BACK_MODIFY),
"校工会审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/projectApply/applyRecord",
null,
SecurityConstants.INNER
);
audit.setAuditResult(AuditConstants.BACK);
this.doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducation threeEducation = fetch(id);
String schoolUnionAuditId = threeEducation.getSchoolUnionAuditId();
dao().clear(ThreeEducationApprovalAudit.class, Cnd.where("id", "=", schoolUnionAuditId));
Chain chain = Chain.make("schoolUnionAuditId", null);
chain.add("stateId", ThreeEducationApprovalAuditState.SCHOOL_UNION_READY);
dao().update(ThreeEducation.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_PROJECT_APPLY@" + id,
String.valueOf(ThreeEducationApprovalAuditState.SCHOOL_UNION_READY),
SecurityConstants.INNER);
}
}
@@ -0,0 +1,227 @@
package com.ruoyi.threeEducation.projectApply.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.deepoove.poi.data.PictureType;
import com.deepoove.poi.data.Pictures;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.datasource.annotation.Slave;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysUnion;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.common.Audit;
import com.ruoyi.threeEducation.projectApply.service.ThreeEducationPaService;
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.Lang;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@Service
public class ThreeEducationPaServiceImpl extends BaseServiceImpl<ThreeEducation> implements ThreeEducationPaService {
@Autowired
private RemoteSysLocalProcessService localProcessService;
public ThreeEducationPaServiceImpl(Dao dao) {
super(dao);
}
private void setApplyInfo(ThreeEducation threeEducation) {
threeEducation.setApplyTime(new Date());
threeEducation.setApplyUserId(SecurityUtils.getUserId());
threeEducation.setApplyUserName(SecurityUtils.getNickName());
threeEducation.setApplyUserLoginName(SecurityUtils.getUsername());
threeEducation.setApplyUserUnionId(SecurityUtils.getUnionId());
threeEducation.setApplyUserUnionName(Optional.ofNullable(SecurityUtils.getUnion()).map(SysUnion::getUnionName).orElse(null));
threeEducation.setUnionGroupName(SecurityUtils.getUnionGroupName());
threeEducation.setUnionGroupId(SecurityUtils.getUnionGroupId());
threeEducation.setApplyUserUnitId(String.valueOf(SecurityUtils.getDeptId()));
threeEducation.setApplyUserUnitName(Optional.ofNullable(SecurityUtils.getDept()).map(SysDept::getDeptName).orElse(null));
threeEducation.setApplyUserThreeUnitId(String.valueOf(SecurityUtils.getThreeDeptId()));
threeEducation.setApplyUserThreeUnitName(Optional.ofNullable(SecurityUtils.getThreeDept()).map(SysDept::getDeptName).orElse(null));
if (threeEducation.getBudgetDetails() != null) {
double sum = threeEducation.getBudgetDetails().stream().mapToDouble(v -> v.getMoney()).sum();
threeEducation.setBudgetTotal(sum);
}
}
@Override
@DSTransactional
public void doSave(ThreeEducation threeEducation) {
threeEducation.setStateId(ThreeEducationApprovalAuditState.NOT_SUBMIT);
setApplyInfo(threeEducation);
dao().insertOrUpdate(threeEducation);
String processUniqueId = "THREEEDUCATION_PROJECT_APPLY@" + threeEducation.getId();
// 创建实例
localProcessService.initCreateInstance(
processUniqueId,
threeEducation.getId(),
"[三育人项目申请]" + SecurityUtils.getNickName(),
"/threeEducation/projectApply/applyRecord",
null,
SecurityConstants.INNER
);
}
@Override
@DSTransactional
public void doSubmit(ThreeEducation threeEducation) {
if (threeEducation.getStateId() != null) {
// 先完成当前节点的任务
localProcessService.completeReturnTask(
"THREEEDUCATION_PROJECT_APPLY@" + threeEducation.getId(),
SecurityConstants.INNER
);
}
threeEducation.setStateId(ThreeEducationApprovalAuditState.BRANCH_UNION_READY);
setApplyInfo(threeEducation);
dao().insertOrUpdate(threeEducation);
String processUniqueId = "THREEEDUCATION_PROJECT_APPLY@" + threeEducation.getId();
// 创建实例
localProcessService.initCreateInstance(
processUniqueId,
threeEducation.getId(),
"[三育人项目申请]" + SecurityUtils.getNickName(),
"/threeEducation/projectApply/applyRecord",
null,
SecurityConstants.INNER
);
// 获取负责人
R<List<String>> assignments = localProcessService.getAssignments(SecurityUtils.getUnionId(),
null,
Roles.FGH_ADMIN,
SecurityConstants.INNER);
List<String> loginNameList = assignments.getData();
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationApprovalAuditState.BRANCH_UNION_READY),
"待分工会审核",
loginNameList,
"/threeEducation/projectApply/branchUnionAudit",
null,
SecurityConstants.INNER
);
}
@Override
@Transactional
public void doDelete(String id) {
dao().clear(ThreeEducation.class, Cnd.where("id", "=", id));
localProcessService.deleteProcessInstance("THREEEDUCATION_PROJECT_APPLY@" + id, SecurityConstants.INNER);
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
te.*,
state.stateName,
state.stateColor
FROM
three_education te
LEFT JOIN audit_state state ON state.stateId = te.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (!AuthUtil.hasRole("admin")) {
cnd.and("te.applyUserId", "=", SecurityUtils.getUserId());
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Slave
public NutMap getCurrentUserUnionGroupInfo() {
NutMap nutMap = NutMap.NEW();
String unionGroupId = SecurityUtils.getUnionGroupId();
nutMap.setv("unionGroupId", unionGroupId);
if (StrUtil.isBlank(unionGroupId)) {
nutMap.setv("unionGroupName", null);
nutMap.setv("unionGroupUserNum", 0);
nutMap.setv("unionGroupLeaderUserName", null);
nutMap.setv("unionGroupLeaderMobile", null);
} else {
nutMap.setv("unionGroupName", SecurityUtils.getUnionGroupName());
Sql unionGroupUserNumSql = Sqls.create("""
select count(1) from `user` where threeUnitId in (
select dept_id from sys_dept where union_group_id = @unionGroupId
)
""");
unionGroupUserNumSql.setParam("unionGroupId", unionGroupId);
nutMap.setv("unionGroupUserNum", count(unionGroupUserNumSql));
Sql unionGroupLeaderSql = Sqls.create("""
SELECT
DISTINCT u.nick_name as unionGroupLeaderUserName,
u.mobile as unionGroupLeaderMobile
FROM
sys_user_role sur
LEFT JOIN sys_user u ON u.user_id = sur.user_id
WHERE
sur.role_id = 112
AND sur.unionGroupId = @unionGroupId
GROUP BY u.user_id
""");
unionGroupLeaderSql.setParam("unionGroupId", unionGroupId);
NutMap unionGroupLeaderMapData = fetch(unionGroupLeaderSql);
if (unionGroupLeaderMapData != null) {
nutMap.putAll(unionGroupLeaderMapData);
} else {
nutMap.setv("unionGroupLeaderUserName", null);
nutMap.setv("unionGroupLeaderMobile", null);
}
}
return nutMap;
}
@Override
public NutMap exportRmForm(String projectId) {
ThreeEducation threeEducation = fetch(projectId);
fetchLinks(threeEducation, null);
NutMap nutMap = Lang.obj2nutmap(threeEducation);
Calendar calendar = Calendar.getInstance();
calendar.setTime(threeEducation.getApplyTime());
int year = calendar.get(Calendar.YEAR);
nutMap.setv("year", year);
String sign = Optional.ofNullable(threeEducation.getBranchUnionAudit()).map(Audit::getAuditSign).orElse(null);
if (StrUtil.isNotBlank(sign)) {
nutMap.put("branchUnionSign", Pictures.ofBase64(sign, PictureType.JPEG).size(200, 50).create());
}
nutMap.put("approvalContent", HtmlUtil.unwrapHtmlTag(nutMap.getString("approvalContent"), "p"));
return nutMap;
}
}
@@ -0,0 +1,57 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmAcceptanceCertifierAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 验收证明人审核
*
* @author jug
* @date 2023/02/07
*/
@RestController
@RequestMapping("/rm/acceptanceCertifierAudit")
public class ThreeEducationRmAcceptanceCertifierAuditController {
@Autowired
private ThreeEducationRmAcceptanceCertifierAuditService threeEducationRmAcceptanceCertifierAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:acceptanceCertifierAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmAcceptanceCertifierAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:reimburseMent:acceptanceCertifierAudit")
public AjaxResult doPass(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmAcceptanceCertifierAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:reimburseMent:acceptanceCertifierAudit")
public AjaxResult doReject(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmAcceptanceCertifierAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:reimburseMent:acceptanceCertifierAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmAcceptanceCertifierAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:reimburseMent:acceptanceCertifierAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationRmAcceptanceCertifierAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,87 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.api.RemoteUserRoleService;
import com.ruoyi.system.api.domain.SysUserRole;
import com.ruoyi.system.api.model.FeignCnd;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmService;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 三育人报销申请
*
* @author jug
* @date 2023/02/06
*/
@RestController
@RequestMapping("/rm/apply")
public class ThreeEducationRmApplyController {
@Autowired
private ThreeEducationRmService threeEducationRmService;
@Autowired
private RemoteUserRoleService remoteUserRoleService;
@PostMapping("/doSave")
@RequiresPermissions("threeEducation:reimburseMent:apply")
public AjaxResult doSave(@RequestBody ThreeEducationReimbursement reimbursement) {
threeEducationRmService.doSave(reimbursement);
return AjaxResult.success();
}
@PostMapping("/doSubmit")
@RequiresPermissions("threeEducation:reimburseMent:apply")
public AjaxResult doSubmit(@RequestBody ThreeEducationReimbursement reimbursement) {
//经手人Id
List<FeignCnd> jsrCndList = List.of(
new FeignCnd("user_id", "=", reimbursement.getBranchUnionHandlerId()),
new FeignCnd("role_id","=",Roles.THREE_EDUCATION_JSR)
);
List<SysUserRole> jsrRoles = remoteUserRoleService.getUserRole(jsrCndList).getData();
SysUserRole sysUserRole = new SysUserRole();
if (jsrRoles.isEmpty()){
sysUserRole.setUserId(Long.parseLong(reimbursement.getBranchUnionHandlerId()));
sysUserRole.setRoleId(Roles.THREE_EDUCATION_JSR);
remoteUserRoleService.addUserRole(sysUserRole);
}
//验收证明人id
List<FeignCnd> zmrCndList = List.of(
new FeignCnd("user_id", "=", reimbursement.getBranchUnionAcceptanceCertifierId()),
new FeignCnd("role_id","=",Roles.THREE_EDUCATION_YSZMR)
);
List<SysUserRole> zmrRoles = remoteUserRoleService.getUserRole(zmrCndList).getData();
if (zmrRoles.isEmpty()){
sysUserRole.setUserId(Long.parseLong(reimbursement.getBranchUnionAcceptanceCertifierId()));
sysUserRole.setRoleId(Roles.THREE_EDUCATION_YSZMR);
remoteUserRoleService.addUserRole(sysUserRole);
}
//立项联络人id
List<FeignCnd> llrCndList = List.of(
new FeignCnd("user_id", "=", reimbursement.getSchoolUnionApprovalContactId()),
new FeignCnd("role_id","=",Roles.THREE_EDUCATION_YSZMR)
);
List<SysUserRole> llrRoles = remoteUserRoleService.getUserRole(llrCndList).getData();
if (zmrRoles.isEmpty()){
sysUserRole.setUserId(Long.parseLong(reimbursement.getSchoolUnionApprovalContactId()));
sysUserRole.setRoleId(Roles.THREE_EDUCATION_LXLLR);
remoteUserRoleService.addUserRole(sysUserRole);
}
threeEducationRmService.doSubmit(reimbursement);
return AjaxResult.success();
}
@GetMapping("/queryUser")
@RequiresPermissions("threeEducation:reimburseMent:apply")
public AjaxResult queryUser(@RequestParam String query, @RequestParam Integer type) {
List<NutMap> list = threeEducationRmService.queryUser(query, type);
return AjaxResult.success(list);
}
}
@@ -0,0 +1,52 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmApprovalContactAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/rm/acceptApprovalContactAudit")
public class ThreeEducationRmApprovalContactAuditController {
@Autowired
private ThreeEducationRmApprovalContactAuditService threeEducationRmApprovalContactAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:acceptApprovalContactAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmApprovalContactAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:reimburseMent:acceptApprovalContactAudit")
public AjaxResult doPass(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmApprovalContactAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:reimburseMent:acceptApprovalContactAudit")
public AjaxResult doReject(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmApprovalContactAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:reimburseMent:acceptApprovalContactAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmApprovalContactAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:reimburseMent:acceptApprovalContactAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationRmApprovalContactAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,57 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmBranchUnionAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 分工会审核
*
* @author jug
* @date 2023/02/07
*/
@RestController
@RequestMapping("/rm/branchUnionAudit")
public class ThreeEducationRmBranchUnionAuditController {
@Autowired
private ThreeEducationRmBranchUnionAuditService threeEducationRmBranchUnionAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:branchUnionAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmBranchUnionAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:reimburseMent:branchUnionAudit")
public AjaxResult doPass(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmBranchUnionAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:reimburseMent:branchUnionAudit")
public AjaxResult doReject(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmBranchUnionAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:reimburseMent:branchUnionAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmBranchUnionAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:reimburseMent:branchUnionAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationRmBranchUnionAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,57 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmHandlerAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 经手人审核
*
* @author jug
* @date 2023/02/07
*/
@RestController
@RequestMapping("/rm/handlerAudit")
public class ThreeEducationRmHandlerAuditController {
@Autowired
private ThreeEducationRmHandlerAuditService threeEducationRmHandlerAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:handlerAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmHandlerAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:reimburseMent:handlerAudit")
public AjaxResult doPass(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmHandlerAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:reimburseMent:handlerAudit")
public AjaxResult doReject(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmHandlerAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:reimburseMent:handlerAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmHandlerAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:reimburseMent:handlerAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationRmHandlerAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,26 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/rm/query")
public class ThreeEducationRmQueryController {
@Autowired
private ThreeEducationRmQueryService threeEducationRmQueryService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:query")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmQueryService.pageData(pageForm));
}
}
@@ -0,0 +1,103 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditType;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmService;
import lombok.extern.slf4j.Slf4j;
import org.ddr.poi.html.HtmlRenderPolicy;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.stream.Collectors;
/**
* 报销记录
*
* @author jug
* @date 2023/02/05
*/
@RestController
@RequestMapping("/rm/record")
@Slf4j
public class ThreeEducationRmRecordController {
@Autowired
private ThreeEducationRmService threeEducationRmService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:applyRecord")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmService.pageData(pageForm));
}
@GetMapping("/findOne")
@RequiresPermissions("threeEducation:reimburseMent:applyRecord")
public AjaxResult findOne(@RequestParam String id) {
ThreeEducationReimbursement reimbursement = threeEducationRmService.fetch(Cnd.where("projectId", "=", id));
threeEducationRmService.fetchLinks(reimbursement, null);
return AjaxResult.success(reimbursement);
}
@GetMapping("/getApplyInfo")
@RequiresPermissions("threeEducation:reimburseMent:applyRecord")
public AjaxResult getApplyInfo(@RequestParam String id) {
ThreeEducationReimbursement reimbursement = threeEducationRmService.fetch(Cnd.where("projectId", "=", id));
threeEducationRmService.fetchLinks(reimbursement, null);
NutMap reimbursementMapData = Lang.obj2nutmap(reimbursement);
Dao dao = threeEducationRmService.dao();
List<ThreeEducationReimbursementAudit> audits = dao.query(ThreeEducationReimbursementAudit.class, Cnd.where("projectId", "=", id));
reimbursementMapData.setv("branchUnionHandlerAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationReimbursementAuditType.BRANCH_UNION_HANDLER).collect(Collectors.toList()));
reimbursementMapData.setv("branchUnionAcceptanceCertifierAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationReimbursementAuditType.BRANCH_UNION_ACCEPTANCE_CERTIFIER).collect(Collectors.toList()));
reimbursementMapData.setv("branchUnionAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationReimbursementAuditType.BRANCH_UNION).collect(Collectors.toList()));
reimbursementMapData.setv("schoolUnionApprovalContactAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationReimbursementAuditType.SCHOOL_UNION_APPROVAL_CONTACT).collect(Collectors.toList()));
reimbursementMapData.setv("schoolUnionAudits", audits.stream().filter(v -> v.getAuditType() == ThreeEducationReimbursementAuditType.SCHOOL_UNION).collect(Collectors.toList()));
return AjaxResult.success(reimbursementMapData);
}
/**
* 导出报销表
*
* @param projectId 项目id
*/
@PostMapping("/exportRmForm")
@RequiresPermissions("threeEducation:reimburseMent:applyRecord")
public void exportRmForm(@RequestParam(name = "id") String projectId, HttpServletResponse response) {
try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/threeEducationReimbursement.docx");
ServletOutputStream outputStream = response.getOutputStream()) {
assert inputStream != null;
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=%s".formatted(URLEncoder.encode("立项报销表.docx", StandardCharsets.UTF_8)));
NutMap dataMap = threeEducationRmService.exportRmForm(projectId);
LoopRowTableRenderPolicy hackLoopTableRenderPolicy = new LoopRowTableRenderPolicy();
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
Configure config = Configure.builder()
.bind("budgetDetails", hackLoopTableRenderPolicy)
.bind("reimbursementDetails ", hackLoopTableRenderPolicy)
.bind("approvalContent ", htmlRenderPolicy)
.useSpringEL()
.build();
XWPFTemplate.compile(inputStream, config).render(dataMap, outputStream);
} catch (Exception e) {
log.error("三育人报销导出失败{}", e.getMessage());
}
}
}
@@ -0,0 +1,52 @@
package com.ruoyi.threeEducation.reimbursement.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmSchoolUnionAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/rm/schoolUnionAudit")
public class ThreeEducationRmSchoolUnionAuditController {
@Autowired
private ThreeEducationRmSchoolUnionAuditService threeEducationRmSchoolUnionAuditService;
@PostMapping("/pageData")
@RequiresPermissions("threeEducation:reimburseMent:schoolUnionAudit")
public AjaxResult pageData(@RequestBody ThreeEducationPageForm pageForm) {
return AjaxResult.success(threeEducationRmSchoolUnionAuditService.pageData(pageForm));
}
@PostMapping("/doPass")
@RequiresPermissions("threeEducation:reimburseMent:schoolUnionAudit")
public AjaxResult doPass(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmSchoolUnionAuditService.doPass(audit);
return AjaxResult.success();
}
@PostMapping("/doReject")
@RequiresPermissions("threeEducation:reimburseMent:schoolUnionAudit")
public AjaxResult doReject(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmSchoolUnionAuditService.doReject(audit);
return AjaxResult.success();
}
@PostMapping("/doBackTo")
@RequiresPermissions("threeEducation:reimburseMent:schoolUnionAudit")
public AjaxResult doBackTo(@RequestBody ThreeEducationReimbursementAudit audit) {
threeEducationRmSchoolUnionAuditService.doBackTo(audit);
return AjaxResult.success();
}
@PostMapping("/doRevoke")
@RequiresPermissions("threeEducation:reimburseMent:schoolUnionAudit")
public AjaxResult doRevoke(@RequestParam String id) {
threeEducationRmSchoolUnionAuditService.doRevoke(id);
return AjaxResult.success();
}
}
@@ -0,0 +1,41 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
public interface ThreeEducationRmAcceptanceCertifierAuditService extends BaseService<ThreeEducationReimbursement> {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationReimbursementAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationReimbursementAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationReimbursementAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,37 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
public interface ThreeEducationRmApprovalContactAuditService {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationReimbursementAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationReimbursementAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationReimbursementAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,41 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
public interface ThreeEducationRmBranchUnionAuditService extends BaseService<ThreeEducationReimbursement> {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationReimbursementAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationReimbursementAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationReimbursementAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,42 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
public interface ThreeEducationRmHandlerAuditService extends BaseService<ThreeEducationReimbursement> {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationReimbursementAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationReimbursementAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationReimbursementAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,12 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
public interface ThreeEducationRmQueryService extends BaseService<ThreeEducationReimbursement> {
Pagination pageData(ThreeEducationPageForm pageForm);
}
@@ -0,0 +1,41 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
public interface ThreeEducationRmSchoolUnionAuditService extends BaseService<ThreeEducationReimbursement> {
Pagination pageData(ThreeEducationPageForm pageForm);
/**
* 通过
*
* @param audit 审计
*/
void doPass(ThreeEducationReimbursementAudit audit);
/**
* 拒绝
*
* @param audit 审计
*/
void doReject(ThreeEducationReimbursementAudit audit);
/**
* 退回
*
* @param audit 审计
*/
void doBackTo(ThreeEducationReimbursementAudit audit);
/**
* 撤销
*
* @param id id
*/
void doRevoke(String id);
}
@@ -0,0 +1,25 @@
package com.ruoyi.threeEducation.reimbursement.service;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import org.nutz.lang.util.NutMap;
import java.util.List;
public interface ThreeEducationRmService extends BaseService<ThreeEducationReimbursement> {
void doSave(ThreeEducationReimbursement reimbursement);
void doSubmit(ThreeEducationReimbursement reimbursement);
Pagination pageData(ThreeEducationPageForm pageForm);
List<NutMap> queryUser(String query, int type);
NutMap fetchUser(String userId);
NutMap exportRmForm(String projectId);
}
@@ -0,0 +1,173 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditType;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmAcceptanceCertifierAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class ThreeEducationRmAcceptanceCertifierAuditServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmAcceptanceCertifierAuditService {
public ThreeEducationRmAcceptanceCertifierAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
void doAudit(ThreeEducationReimbursementAudit audit) {
audit.setAuditType(ThreeEducationReimbursementAuditType.BRANCH_UNION_ACCEPTANCE_CERTIFIER);
dao().insert(audit);
String projectId = audit.getProjectId();
Chain chain = Chain.make("branchUnionAcceptanceCertifierAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS -> chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_READY);
case AuditConstants.REJECT ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_REJECTED);
case AuditConstants.BACK ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_BACK_MODIFY);
}
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("projectId", "=", projectId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (!AuthUtil.hasRole("admin")) {
cnd.and("ter.branchUnionAcceptanceCertifierId", "=", SecurityUtils.getUserId());
}
if (pageForm.getIsAudit() == null) {
cnd.and("ter.stateId", ">=", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("ter.stateId", ">", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("ter.stateId", "=", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY);
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Transactional
public void doPass(ThreeEducationReimbursementAudit audit) {
String processUniqueId = "THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId();
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY),
"待分工会审核",
SecurityConstants.INNER);
// 获取负责人
R<List<String>> assignments = localProcessService.getAssignments(SecurityUtils.getUnionId(),
null,
Roles.FGH_ADMIN,
SecurityConstants.INNER);
List<String> loginNameList = assignments.getData();
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_READY),
"待分工会审核",
loginNameList,
"/threeEducation/Reimbursement/branchUnionAudit",
null,
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.PASS);
doAudit(audit);
}
@Override
@Transactional
public void doReject(ThreeEducationReimbursementAudit audit) {
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(), true, SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.REJECT);
doAudit(audit);
}
@Override
@Transactional
public void doBackTo(ThreeEducationReimbursementAudit audit) {
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_BACK_MODIFY),
"验收证明人审核退回修改",
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.BACK);
ThreeEducation threeEducation = dao().fetch(ThreeEducation.class,audit.getProjectId());
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", threeEducation.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
"THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_BACK_MODIFY),
"验收证明人审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/Reimbursement/applyRecord",
null,
SecurityConstants.INNER
);
doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducationReimbursement reimbursement = fetch(id);
String branchUnionAcceptanceCertifierAuditId = reimbursement.getBranchUnionAcceptanceCertifierAuditId();
dao().clear(ThreeEducationReimbursementAudit.class, Cnd.where("id", "=", branchUnionAcceptanceCertifierAuditId));
Chain chain = Chain.make("branchUnionAcceptanceCertifierAuditId", null);
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY);
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + id,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY), SecurityConstants.INNER);
}
}
@@ -0,0 +1,179 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditType;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmApprovalContactAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class ThreeEducationRmApprovalContactAuditServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmApprovalContactAuditService {
public ThreeEducationRmApprovalContactAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
void doAudit(ThreeEducationReimbursementAudit audit) {
audit.setAuditType(ThreeEducationReimbursementAuditType.SCHOOL_UNION_APPROVAL_CONTACT);
dao().insert(audit);
String projectId = audit.getProjectId();
Chain chain = Chain.make("schoolUnionApprovalContactAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS -> chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY);
case AuditConstants.REJECT ->
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_REJECTED);
case AuditConstants.BACK ->
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_BACK_MODIFY);
}
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("projectId", "=", projectId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (!AuthUtil.hasRole("admin")) {
cnd.and("ter.schoolUnionApprovalContactId", "=", SecurityUtils.getUserId());
}
if (pageForm.getIsAudit() == null) {
cnd.and("ter.stateId", ">=", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("ter.stateId", ">", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("ter.stateId", "=", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY);
}
cnd.andEX("te.applyUserUnionId", "=", pageForm.getUnionId());
cnd.andEX("te.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("te.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
cnd.andEX("te.unionGroupId", "=", pageForm.getUnionGroupId());
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Transactional
public void doPass(ThreeEducationReimbursementAudit audit) {
String processUniqueId = "THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId();
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY),
"待校工会审核",
SecurityConstants.INNER);
// 获取负责人
R<List<String>> assignments = localProcessService.getAssignments(null,
null,
Roles.SCHOOL_ADMIN,
SecurityConstants.INNER);
List<String> loginNameList = assignments.getData();
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY),
"待校工会审核",
loginNameList,
"/threeEducation/Reimbursement/schoolUnionAudit",
null,
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.PASS);
doAudit(audit);
}
@Override
@Transactional
public void doReject(ThreeEducationReimbursementAudit audit) {
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(), true, SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.REJECT);
doAudit(audit);
}
@Override
@Transactional
public void doBackTo(ThreeEducationReimbursementAudit audit) {
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_BACK_MODIFY),
"立项联络人审核退回修改",
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.BACK);
ThreeEducation threeEducation = dao().fetch(ThreeEducation.class,audit.getProjectId());
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", threeEducation.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
"THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_BACK_MODIFY),
"立项联络人审核审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/Reimbursement/applyRecord",
null,
SecurityConstants.INNER
);
doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducationReimbursement reimbursement = fetch(id);
String schoolUnionApprovalContactAuditId = reimbursement.getSchoolUnionApprovalContactAuditId();
dao().clear(ThreeEducationReimbursementAudit.class, Cnd.where("id", "=", schoolUnionApprovalContactAuditId));
Chain chain = Chain.make("schoolUnionApprovalContactAuditId", null);
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY);
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + id,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY), SecurityConstants.INNER);
}
}
@@ -0,0 +1,174 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditType;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmBranchUnionAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class ThreeEducationRmBranchUnionAuditServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmBranchUnionAuditService {
public ThreeEducationRmBranchUnionAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
void doAudit(ThreeEducationReimbursementAudit audit) {
audit.setAuditType(ThreeEducationReimbursementAuditType.BRANCH_UNION);
dao().insert(audit);
String projectId = audit.getProjectId();
Chain chain = Chain.make("branchUnionAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS ->
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY);
case AuditConstants.REJECT ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_REJECTED);
case AuditConstants.BACK ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_BACK_MODIFY);
}
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("projectId", "=", projectId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (!AuthUtil.hasRole("admin")) {
cnd.and("te.applyUserUnionId", "=", SecurityUtils.getUnionId());
}
if (pageForm.getIsAudit() == null) {
cnd.and("ter.stateId", ">=", ThreeEducationReimbursementAuditState.BRANCH_UNION_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("ter.stateId", ">", ThreeEducationReimbursementAuditState.BRANCH_UNION_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("ter.stateId", "=", ThreeEducationReimbursementAuditState.BRANCH_UNION_READY);
}
cnd.andEX("te.applyUserUnionId", "=", pageForm.getUnionId());
cnd.andEX("te.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("te.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
cnd.andEX("te.unionGroupId", "=", pageForm.getUnionGroupId());
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Transactional
public void doPass(ThreeEducationReimbursementAudit audit) {
ThreeEducationReimbursement reimbursement = fetch(audit.getId());
String processUniqueId = "THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId();
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_READY),
"待立项联络人审核",
SecurityConstants.INNER);
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_READY),
"待立项联络人审核",
List.of(reimbursement.getSchoolUnionApprovalContactLoginName()),
"/threeEducation/Reimbursement/approvalContactAudit",
null,
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.PASS);
doAudit(audit);
}
@Override
@Transactional
public void doReject(ThreeEducationReimbursementAudit audit) {
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(), true, SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.REJECT);
doAudit(audit);
}
@Override
@Transactional
public void doBackTo(ThreeEducationReimbursementAudit audit) {
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_BACK_MODIFY),
"分工会审核退回修改",
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.BACK);
ThreeEducation threeEducation = dao().fetch(ThreeEducation.class,audit.getProjectId());
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", threeEducation.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
"THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_BACK_MODIFY),
"分工会审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/Reimbursement/applyRecord",
null,
SecurityConstants.INNER
);
doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducationReimbursement reimbursement = fetch(id);
String branchUnionAuditId = reimbursement.getBranchUnionAuditId();
dao().clear(ThreeEducationReimbursementAudit.class, Cnd.where("id", "=", branchUnionAuditId));
Chain chain = Chain.make("branchUnionAuditId", null);
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_READY);
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + id,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_READY), SecurityConstants.INNER);
}
}
@@ -0,0 +1,173 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditType;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmHandlerAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class ThreeEducationRmHandlerAuditServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmHandlerAuditService {
public ThreeEducationRmHandlerAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
void doAudit(ThreeEducationReimbursementAudit audit) {
audit.setAuditType(ThreeEducationReimbursementAuditType.BRANCH_UNION_HANDLER);
dao().insert(audit);
String projectId = audit.getProjectId();
Chain chain = Chain.make("branchUnionHandlerAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY);
case AuditConstants.REJECT ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_REJECTED);
case AuditConstants.BACK ->
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_BACK_MODIFY);
}
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("projectId", "=", projectId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (!AuthUtil.hasRole("admin")) {
cnd.and("ter.branchUnionHandlerId", "=", SecurityUtils.getUserId());
}
if (pageForm.getIsAudit() == null) {
cnd.and("ter.stateId", ">=", ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("ter.stateId", ">", ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("ter.stateId", "=", ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY);
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Transactional
public void doPass(ThreeEducationReimbursementAudit audit) {
ThreeEducationReimbursement reimbursement = fetch(audit.getId());
String processUniqueId = "THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId();
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY),
"待验收证明人审核",
SecurityConstants.INNER);
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_READY),
"待验收证明人审核",
List.of(reimbursement.getBranchUnionAcceptanceCertifierLoginName()),
"/threeEducation/Reimbursement/acceptanceCertifierAudit",
null,
SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.PASS);
doAudit(audit);
}
@Override
@Transactional
public void doReject(ThreeEducationReimbursementAudit audit) {
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(), true, SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.REJECT);
doAudit(audit);
}
@Override
@Transactional
public void doBackTo(ThreeEducationReimbursementAudit audit) {
// 先完成当前节点的任务
localProcessService.completeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_BACK_MODIFY),
"经手人审核退回修改",
SecurityConstants.INNER);
ThreeEducation threeEducation = dao().fetch(ThreeEducation.class,audit.getProjectId());
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", threeEducation.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
"THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(),
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_BACK_MODIFY),
"经手人审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/Reimbursement/applyRecord",
null,
SecurityConstants.INNER
);
audit.setAuditResult(AuditConstants.BACK);
doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducationReimbursement reimbursement = fetch(id);
String branchUnionHandlerAuditId = reimbursement.getBranchUnionHandlerAuditId();
dao().clear(ThreeEducationReimbursementAudit.class, Cnd.where("id", "=", branchUnionHandlerAuditId));
Chain chain = Chain.make("branchUnionHandlerAuditId", null);
chain.add("stateId", ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY);
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + id,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY), SecurityConstants.INNER);
}
}
@@ -0,0 +1,55 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmQueryService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.springframework.stereotype.Service;
@Service
public class ThreeEducationRmQueryServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmQueryService {
public ThreeEducationRmQueryServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("ter.stateId", "=", ThreeEducationReimbursementAuditState.SCHOOL_UNION_PASS);
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
cnd.andEX("te.applyUserUnionId", "=", pageForm.getUnionId());
cnd.andEX("te.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("te.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
cnd.andEX("te.unionGroupId", "=", pageForm.getUnionGroupId());
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
}
@@ -0,0 +1,155 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.ruoyi.common.core.constant.AuditConstants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditType;
import com.ruoyi.threeEducation.api.domain.ThreeEducation;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmSchoolUnionAuditService;
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.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class ThreeEducationRmSchoolUnionAuditServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmSchoolUnionAuditService {
public ThreeEducationRmSchoolUnionAuditServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
void doAudit(ThreeEducationReimbursementAudit audit) {
audit.setAuditType(ThreeEducationReimbursementAuditType.SCHOOL_UNION);
dao().insert(audit);
String projectId = audit.getProjectId();
Chain chain = Chain.make("schoolUnionAuditId", audit.getId());
switch (audit.getAuditResult()) {
case AuditConstants.PASS -> chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_PASS);
case AuditConstants.REJECT ->
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_REJECTED);
case AuditConstants.BACK ->
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_BACK_MODIFY);
}
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("projectId", "=", projectId));
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (pageForm.getIsAudit() == null) {
cnd.and("ter.stateId", ">=", ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY);
} else if (pageForm.getIsAudit()) {
cnd.and("ter.stateId", ">", ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY);
} else if (!pageForm.getIsAudit()) {
cnd.and("ter.stateId", "=", ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY);
}
cnd.andEX("te.applyUserUnionId", "=", pageForm.getUnionId());
cnd.andEX("te.applyUserUnitId", "=", pageForm.getUnitId());
cnd.andEX("te.applyUserThreeUnitId", "=", pageForm.getThreeUnitId());
cnd.andEX("te.unionGroupId", "=", pageForm.getUnionGroupId());
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Transactional
public void doPass(ThreeEducationReimbursementAudit audit) {
String processUniqueId = "THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId();
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY),
"校工会审核通过",
SecurityConstants.INNER);
localProcessService.completeProcess(processUniqueId, false, SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.PASS);
doAudit(audit);
}
@Override
@Transactional
public void doReject(ThreeEducationReimbursementAudit audit) {
// 审核不通过,流程结束
localProcessService.completeProcess("THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId(), true, SecurityConstants.INNER);
audit.setAuditResult(AuditConstants.REJECT);
doAudit(audit);
}
@Override
@DSTransactional
public void doBackTo(ThreeEducationReimbursementAudit audit) {
String processUniqueId="THREEEDUCATION_REIMBURSEMENT_APPLY@" + audit.getId();
ThreeEducation reimbursement = dao().fetch(ThreeEducation.class, audit.getProjectId());
// 先完成当前节点的任务
localProcessService.completeTask(processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY),
"校工会审核退回修改",
SecurityConstants.INNER);
// 退回修改,流程继续
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", reimbursement.getApplyUserId());
NutMap userMap = fetch(sql);
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_BACK_MODIFY),
"校工会审核退回修改",
List.of(userMap.getString("loginName")),
"/threeEducation/Reimbursement/applyRecord",
null,
SecurityConstants.INNER
);
audit.setAuditResult(AuditConstants.BACK);
doAudit(audit);
}
@Override
@Transactional
public void doRevoke(String id) {
ThreeEducationReimbursement reimbursement = fetch(id);
String schoolUnionAuditId = reimbursement.getSchoolUnionAuditId();
dao().clear(ThreeEducationReimbursementAudit.class, Cnd.where("id", "=", schoolUnionAuditId));
Chain chain = Chain.make("schoolUnionAuditId", null);
chain.add("stateId", ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY);
dao().update(ThreeEducationReimbursement.class, chain, Cnd.where("id", "=", id));
localProcessService.revokeTask("THREEEDUCATION_REIMBURSEMENT_APPLY@" + id,
String.valueOf(ThreeEducationReimbursementAuditState.SCHOOL_UNION_READY), SecurityConstants.INNER);
}
}
@@ -0,0 +1,268 @@
package com.ruoyi.threeEducation.reimbursement.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.ruoyi.common.core.constant.Roles;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Pagination;
import com.ruoyi.common.core.service.BaseServiceImpl;
import com.ruoyi.common.datasource.annotation.Slave;
import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteSysLocalProcessService;
import com.ruoyi.threeEducation.api.constant.ThreeEducationApprovalAuditState;
import com.ruoyi.threeEducation.api.constant.ThreeEducationPageForm;
import com.ruoyi.threeEducation.api.constant.ThreeEducationReimbursementAuditState;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursement;
import com.ruoyi.threeEducation.api.domain.ThreeEducationReimbursementAudit;
import com.ruoyi.threeEducation.api.domain.common.ThreeEducationFund;
import com.ruoyi.threeEducation.reimbursement.service.ThreeEducationRmService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
@Service
public class ThreeEducationRmServiceImpl extends BaseServiceImpl<ThreeEducationReimbursement> implements ThreeEducationRmService {
public ThreeEducationRmServiceImpl(Dao dao) {
super(dao);
}
@Autowired
private RemoteSysLocalProcessService localProcessService;
/**
* 未申请状态
*/
static List<Integer> NOT_APPLY_STATES = Lang.list(ThreeEducationReimbursementAuditState.NOT_SUBMIT,
ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_BACK_MODIFY,
ThreeEducationReimbursementAuditState.BRANCH_UNION_ACCEPTANCE_CERTIFIER_BACK_MODIFY,
ThreeEducationReimbursementAuditState.BRANCH_UNION_BACK_MODIFY,
ThreeEducationReimbursementAuditState.SCHOOL_UNION_APPROVAL_CONTACT_BACK_MODIFY,
ThreeEducationReimbursementAuditState.SCHOOL_UNION_BACK_MODIFY
);
/**
* 设置经办人 验收证明人 经手人信息
*
* @param reimbursement
*/
private void setAuditUserInfo(ThreeEducationReimbursement reimbursement) {
DynamicDataSourceContextHolder.push("slave");
if (StrUtil.isNotBlank(reimbursement.getBranchUnionHandlerId())) {
NutMap nutMap = fetchUser(reimbursement.getBranchUnionHandlerId());
reimbursement.setBranchUnionHandlerLoginName(Optional.ofNullable(nutMap).map(v -> v.getString("loginName")).orElse(null));
reimbursement.setBranchUnionHandlerUserName(Optional.ofNullable(nutMap).map(v -> v.getString("userName")).orElse(null));
}
if (StrUtil.isNotBlank(reimbursement.getBranchUnionAcceptanceCertifierId())) {
NutMap nutMap = fetchUser(reimbursement.getBranchUnionAcceptanceCertifierId());
reimbursement.setBranchUnionAcceptanceCertifierLoginName(Optional.ofNullable(nutMap).map(v -> v.getString("loginName")).orElse(null));
reimbursement.setBranchUnionAcceptanceCertifierUserName(Optional.ofNullable(nutMap).map(v -> v.getString("userName")).orElse(null));
}
if (StrUtil.isNotBlank(reimbursement.getSchoolUnionApprovalContactId())) {
NutMap nutMap = fetchUser(reimbursement.getSchoolUnionApprovalContactId());
reimbursement.setSchoolUnionApprovalContactLoginName(Optional.ofNullable(nutMap).map(v -> v.getString("loginName")).orElse(null));
reimbursement.setSchoolUnionApprovalContactUserName(Optional.ofNullable(nutMap).map(v -> v.getString("userName")).orElse(null));
}
DynamicDataSourceContextHolder.clear();
}
@Override
public void doSave(ThreeEducationReimbursement reimbursement) {
// if (reimbursement.getStateId() == null) {
// reimbursement.setStateId(ThreeEducationReimbursementAuditState.NOT_SUBMIT);
// }
reimbursement.setStateId(ThreeEducationReimbursementAuditState.NOT_SUBMIT);
if (reimbursement.getReimbursementDetails() != null) {
double sum = reimbursement.getReimbursementDetails().stream().mapToDouble(v -> v.getMoney()).sum();
reimbursement.setReimbursementTotal(sum);
}
setAuditUserInfo(reimbursement);
insertOrUpdate(reimbursement);
}
@Override
@Transactional
public void doSubmit(ThreeEducationReimbursement reimbursement) {
if (reimbursement.getStateId() != null) {
localProcessService.completeReturnTask(
"THREEEDUCATION_REIMBURSEMENT_APPLY@" + reimbursement.getId(),
SecurityConstants.INNER
);
}
reimbursement.setStateId(ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY);
if (reimbursement.getReimbursementDetails() != null) {
double sum = reimbursement.getReimbursementDetails().stream().mapToDouble(v -> v.getMoney()).sum();
reimbursement.setReimbursementTotal(sum);
}
setAuditUserInfo(reimbursement);
insertOrUpdate(reimbursement);
String processUniqueId = "THREEEDUCATION_REIMBURSEMENT_APPLY@" + reimbursement.getId();
// 创建实例
localProcessService.initCreateInstance(
processUniqueId,
reimbursement.getId(),
"[三育人费用报销申请]" + SecurityUtils.getNickName(),
"/threeEducation/Reimbursement/applyRecord",
null,
SecurityConstants.INNER
);
localProcessService.initCreateTask(
processUniqueId,
String.valueOf(ThreeEducationReimbursementAuditState.BRANCH_UNION_HANDLER_READY),
"待经手人审核",
List.of(reimbursement.getBranchUnionHandlerLoginName()),
"/threeEducation/Reimbursement/handlerAudit",
null,
SecurityConstants.INNER
);
}
@Override
public Pagination pageData(ThreeEducationPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
ter.id,
te.id as projectId,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.applyUserUnitName,
te.applyUserThreeUnitName,
te.approvalTime,
ter.stateId,
ter.update_time,
state.stateName
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
LEFT JOIN audit_state state ON state.stateId = ter.stateId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(te.applyTime)", "=", pageForm.getYear());
if (!AuthUtil.hasRole("admin")) {
cnd.and("te.applyUserId", "=", SecurityUtils.getUserId());
}
if (pageForm.getIsAudit() == null) {
} else if (pageForm.getIsAudit()) {
cnd.and("ter.stateId", ">", ThreeEducationReimbursementAuditState.NOT_SUBMIT);
cnd.and("ter.stateId", "not in", NOT_APPLY_STATES);
} else if (!pageForm.getIsAudit()) {
cnd.and("ter.stateId", "in", NOT_APPLY_STATES);
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
@Slave
public List<NutMap> queryUser(String query, int type) {
Sql sql = Sqls.create("select CONCAT(userId,'') as userId ,userName,loginName from `user` $condition limit 0,10");
Cnd cnd = Cnd.NEW();
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("userName", query);
seg.orLike("loginName", query);
cnd.and(seg);
if (type == 1) {
cnd.and("unionId", "=", SecurityUtils.getUnionId());
}
sql.setCondition(cnd);
return listMap(sql);
}
@Override
@Slave
public NutMap fetchUser(String userId) {
Sql sql = Sqls.create("select userId,userName,loginName from `user` where userId = @userId");
sql.setParam("userId", userId);
return fetch(sql);
}
@Override
public NutMap exportRmForm(String projectId) {
Sql sql = Sqls.create("""
SELECT
YEAR(te.applyTime) as year,
te.projectName,
te.applyUserName,
te.applyUserUnionName,
te.unionGroupName,
te.unionGroupUserNum,
te.unionGroupLeaderUserName,
te.unionGroupUserNum,
te.unionGroupLeaderMobile,
te.approvalTime,
te.approvalPlace,
te.approvalTeacherNum,
te.approvalStudentNum,
te.approvalContent,
te.budgetDetails,
te.budgetTotal,
ter.reimbursementDetails,
ter.reimbursementTotal,
ter.ticketNumber,
ter.branchUnionAuditId,
ter.branchUnionAcceptanceCertifierAuditId,
ter.branchUnionHandlerAuditId,
ter.schoolUnionApprovalContactAuditId,
ter.schoolUnionAuditId
FROM
three_education_reimbursement ter
LEFT JOIN three_education te ON ter.projectId = te.id
WHERE ter.projectId = @projectId
""");
sql.setParam("projectId", projectId);
NutMap dataMap = fetch(sql);
String budgetDetailsStr = dataMap.getString("budgetDetails");
List<ThreeEducationFund> budgetDetails = Json.fromJsonAsList(ThreeEducationFund.class, budgetDetailsStr);
dataMap.setv("budgetDetails", budgetDetails);
String reimbursementDetailsStr = dataMap.getString("reimbursementDetails");
List<ThreeEducationFund> reimbursementDetails = Json.fromJsonAsList(ThreeEducationFund.class, reimbursementDetailsStr);
dataMap.setv("reimbursementDetails", reimbursementDetails);
ThreeEducationReimbursementAudit branchUnionAudit = dao().fetch(ThreeEducationReimbursementAudit.class, dataMap.getString("branchUnionAuditId"));
dataMap.setv("branchUnionAudit", branchUnionAudit);
ThreeEducationReimbursementAudit branchUnionAcceptanceCertifierAudit = dao().fetch(ThreeEducationReimbursementAudit.class, dataMap.getString("branchUnionAcceptanceCertifierAuditId"));
dataMap.setv("branchUnionAcceptanceCertifierAudit", branchUnionAcceptanceCertifierAudit);
ThreeEducationReimbursementAudit branchUnionHandlerAudit = dao().fetch(ThreeEducationReimbursementAudit.class, dataMap.getString("branchUnionHandlerAuditId"));
dataMap.setv("branchUnionHandlerAudit", branchUnionHandlerAudit);
ThreeEducationReimbursementAudit schoolUnionApprovalContactAudit = dao().fetch(ThreeEducationReimbursementAudit.class, dataMap.getString("schoolUnionApprovalContactAuditId"));
dataMap.setv("schoolUnionApprovalContactAudit", schoolUnionApprovalContactAudit);
ThreeEducationReimbursementAudit schoolUnionAudit = dao().fetch(ThreeEducationReimbursementAudit.class, dataMap.getString("schoolUnionAuditId"));
dataMap.setv("schoolUnionAudit", schoolUnionAudit);
dataMap.put("approvalContent", HtmlUtil.unwrapHtmlTag(dataMap.getString("approvalContent"), "p"));
return dataMap;
}
}
@@ -0,0 +1,65 @@
# Tomcat
server:
port: 9213
# Spring
spring:
application:
# 应用名称
name: ruoyi-threeEducation
profiles:
# 环境配置
active: prod
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
jackson:
default-property-inclusion: always
date-format: yyyy-MM-dd HH:mm:ss
nutz:
dao:
runtime:
#是否自动建表 默认true
create: true
#是否自动变更 建议不要打开 会出问题
migration: true
# 是否添加列 默认true
add-column: true
# 是否删除列 默认true
delete-column: false
# 是否删表重建,注意此功能会删除全部表及数据,一般应用于demo或测试 默认false
foce-create: false
# 是否检查索引 默认true
check-index: true
# 相关实体所在包
basepackage:
- com.ruoyi.threeEducation.api.domain
sql-manager:
#自定义sql管理模式 file和xml
mode: file
# 自定义sql文件路径
paths:
- sqls
json:
enabled: false
auto-unicode: true
quote-name: true
ignore-null: false
null-as-emtry: true
mode: FULL
logging:
file:
name: logs/${spring.application.name}/info.log
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/ruoyi-threeEducation" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>