first commit
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
<?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-jdh</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>15</maven.compiler.source>
|
||||
<maven.compiler.target>15</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Hutool 拓展工具包(含拼音工具) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-extra</artifactId>
|
||||
<version>5.8.22</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 拼音支持库(必须) -->
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 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-jdh</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-api-system</artifactId>
|
||||
</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>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||
</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,24 @@
|
||||
package com.ruoyi.jdh;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ClassName RuoYiJdhApplication
|
||||
* @Description TODO
|
||||
* @Author zhaoxinyu
|
||||
* @Date 2022/12/13 16:54
|
||||
* @Version 1.0
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
public class RuoYiJdhApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RuoYiJdhApplication.class, args);
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.ruoyi.jdh.controller.common;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Session;
|
||||
import com.ruoyi.jdh.service.JdhCommonService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gdh/common")
|
||||
public class GdhCommonController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
private JdhCommonService jdhCommonService;
|
||||
|
||||
@Autowired
|
||||
public GdhCommonController(JdhCommonService jdhCommonService) {
|
||||
this.jdhCommonService = jdhCommonService;
|
||||
}
|
||||
|
||||
@GetMapping("getOpenGdh")
|
||||
public AjaxResult getOpenGdh() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("startState", "=", true).desc("year").desc("startTime");
|
||||
List<Session> query = dao.query(Session.class, cnd);
|
||||
return AjaxResult.success(query);
|
||||
}
|
||||
|
||||
@GetMapping("getDbt")
|
||||
public AjaxResult getDbt(String jdhId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*
|
||||
FROM
|
||||
workers_congress_delegation dbt
|
||||
WHERE
|
||||
dbt.gdh_id = @gdh_id
|
||||
ORDER BY
|
||||
dbt.`code`
|
||||
""").setParam("gdh_id", jdhId);
|
||||
List list = jdhCommonService.list(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
package com.ruoyi.jdh.controller.common;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzllx;
|
||||
import com.ruoyi.jdh.api.domain.workData.Jdh_gzzllx;
|
||||
import com.ruoyi.jdh.service.JdhCommonService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class JdhCommonController {
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private JdhCommonService jdhCommonService;
|
||||
|
||||
@Autowired
|
||||
public JdhCommonController(JdhCommonService jdhCommonService) {
|
||||
this.jdhCommonService = jdhCommonService;
|
||||
}
|
||||
|
||||
@GetMapping("/getAllJdhxx")
|
||||
public AjaxResult getAllJdhxx() {
|
||||
List<Jdh_jdhxx> allJdhxx = jdhCommonService.getAllJdhxx();
|
||||
return AjaxResult.success(allJdhxx);
|
||||
}
|
||||
|
||||
@GetMapping("/getOpenJdhxx")
|
||||
public AjaxResult getOpenJdhxx() {
|
||||
List<Jdh_jdhxx> allJdhxx = jdhCommonService.getOpenJdhxx();
|
||||
return AjaxResult.success(allJdhxx);
|
||||
}
|
||||
|
||||
@GetMapping("/getGzzllx")
|
||||
public AjaxResult getGzzllx() {
|
||||
List<Jdh_gzzllx> gzzllx = jdhCommonService.getGzzllx();
|
||||
return AjaxResult.success(gzzllx);
|
||||
}
|
||||
|
||||
@GetMapping("/getJdh2Gzzllx")
|
||||
public AjaxResult getJdh2Gzzllx() {
|
||||
List<Jdh2_gzzllx> gzzllx = jdhCommonService.dao().query(Jdh2_gzzllx.class, Cnd.NEW().asc("xh"));
|
||||
return AjaxResult.success(gzzllx);
|
||||
}
|
||||
|
||||
@GetMapping("/getDbt")
|
||||
public AjaxResult getDbt(String jdhId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*
|
||||
FROM
|
||||
jdh_dbt dbt
|
||||
WHERE
|
||||
dbt.jdhid = @jdhid
|
||||
ORDER BY
|
||||
dbt.`code`
|
||||
""").setParam("jdhid", jdhId);
|
||||
List list = jdhCommonService.list(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("findDbxx")
|
||||
public AjaxResult findDbxx(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.nation mz,
|
||||
u.education xl,
|
||||
u.political zzmm,
|
||||
u.mobile,
|
||||
u.jobTitle zc,
|
||||
u.position zw,
|
||||
u.vita grjl,
|
||||
u.deptName AS dwname ,
|
||||
db.files,
|
||||
db.rewards,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) as age
|
||||
FROM
|
||||
jdh_db db
|
||||
LEFT JOIN `user` u ON db.dbid = u.userId
|
||||
WHERE
|
||||
u.userId =@id
|
||||
""");
|
||||
sql.setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
jdhCommonService.dao().execute(sql);
|
||||
NutMap result = (NutMap) sql.getResult();
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("findDb")
|
||||
public AjaxResult findDb(@RequestParam String id, @RequestParam String teacherMeetId) {
|
||||
Jdh_db db = jdhCommonService.dao().fetch(Jdh_db.class, Cnd.where("dbid", "=", id)
|
||||
.and("jdhid", "=", teacherMeetId));
|
||||
return AjaxResult.success(db);
|
||||
}
|
||||
|
||||
@GetMapping("getUnionsByDelegationId")
|
||||
public AjaxResult getUnionsByDelegationId(String delegationId) {
|
||||
if (Strings.isBlank(delegationId)) {
|
||||
Sql sql = Sqls.create("""
|
||||
select * from `union` order by unionCode asc
|
||||
""");
|
||||
List list = jdhCommonService.listMap(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.id dbtid,
|
||||
dbt.dbtname,
|
||||
uni.*
|
||||
FROM
|
||||
`union` uni
|
||||
LEFT JOIN jdh_dbt_zcfgh zc ON zc.fghid = uni.id
|
||||
LEFT JOIN jdh_dbt dbt ON zc.dbtid = dbt.id $condition
|
||||
""");
|
||||
|
||||
cnd.and("zc.dbtid", "=", delegationId)
|
||||
.groupBy("uni.id")
|
||||
.asc("uni.unionCode");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return AjaxResult.success(jdhCommonService.listMap(sql));
|
||||
}
|
||||
|
||||
@GetMapping("getJdhByDb")
|
||||
public AjaxResult getJdhByDb() {
|
||||
if (AuthUtil.hasAnyRoles("admin,tamange,jdh10,jdh12,xgh01")) {
|
||||
List<Record> query = jdhCommonService.dao().query("jdh_jdhxx", Cnd.NEW().desc("jdhkqsj"));
|
||||
return AjaxResult.success(query);
|
||||
} else {
|
||||
//查询教代会
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", SecurityUtils.getUserId()),
|
||||
new FeignCnd("jdhid", "is not", null)
|
||||
);
|
||||
List<SysUserRole> data = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<String> jdhIdList = data.stream().map(SysUserRole::getJdhid).distinct().collect(Collectors.toList());
|
||||
|
||||
List<Jdh_jdhxx> list = jdhCommonService.dao().query(Jdh_jdhxx.class, Cnd.where("id", "in", jdhIdList).desc("jdhkqsj"));
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("getOpenMeeting")
|
||||
public AjaxResult getOpenMeeting() {
|
||||
if (AuthUtil.hasAnyRoles("admin,tamange,jdh10,jdh12,xgh01,T04")) {
|
||||
List<Record> query = jdhCommonService.dao().query("jdh_jdhxx", Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
return AjaxResult.success(query);
|
||||
} else {
|
||||
//查询教代会
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", SecurityUtils.getUserId()),
|
||||
new FeignCnd("jdhid", "is not", null)
|
||||
);
|
||||
List<SysUserRole> data = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<String> jdhIdList = data.stream().map(SysUserRole::getJdhid).distinct().collect(Collectors.toList());
|
||||
|
||||
List<Jdh_jdhxx> list = jdhCommonService.dao().query(Jdh_jdhxx.class, Cnd.where("id", "in", jdhIdList)
|
||||
.and("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
+344
@@ -0,0 +1,344 @@
|
||||
package com.ruoyi.jdh.controller.delegation;
|
||||
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_dbt;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_dbt_zcfgh;
|
||||
import com.ruoyi.jdh.service.DelegationManageService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUnionService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysUnion;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/21
|
||||
* @Description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/delegationManage")
|
||||
public class DelegationManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteDictService remoteDictService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUnionService remoteUnionService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private DelegationManageService delegationManageService;
|
||||
|
||||
@Autowired
|
||||
public DelegationManageController(DelegationManageService delegationManageService) {
|
||||
this.delegationManageService = delegationManageService;
|
||||
}
|
||||
|
||||
@GetMapping("getTreeData")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult getTreeData(String jdhid) {
|
||||
Record record = new Record();
|
||||
record.set("dbtname", "教代会代表团");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,
|
||||
jdh.jdhallname,
|
||||
jdh.jdhkqsj
|
||||
FROM
|
||||
jdh_dbt dbt
|
||||
LEFT JOIN jdh_dbt_zcfgh jdz ON jdz.dbtid = dbt.id
|
||||
AND jdz.jdhid = dbt.jdhid
|
||||
LEFT JOIN jdh_jdhxx jdh ON dbt.`jdhid` = dbt.jdhid
|
||||
$condition
|
||||
""");
|
||||
cnd.and("jdh.jdhkqzt", "=", 1);
|
||||
cnd.and("dbt.jdhid", "=", jdhid);
|
||||
cnd.groupBy("dbt.id");
|
||||
cnd.asc("dbt.code");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
record.set("children", delegationManageService.list(sql));
|
||||
return AjaxResult.success(record);
|
||||
}
|
||||
|
||||
@RequestMapping("pageData")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm, @RequestParam(value = "jdhid", required = false) String jdhid, @RequestParam(value = "dbtid", required = false) String dbtid) {
|
||||
|
||||
Pagination pagination = delegationManageService.pageData(pageForm, jdhid, dbtid);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@GetMapping("queryKyDbtMc")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult queryKyDbtMc(String jdhid) {
|
||||
|
||||
//查询教代会下的代表团
|
||||
List<Jdh_dbt> dbtList = dao.query(Jdh_dbt.class, Cnd.where("jdhid", "=", jdhid));
|
||||
List<String> names = dbtList.stream().map(Jdh_dbt::getDbtname).collect(Collectors.toList());
|
||||
R<List<Record>> canChooseDbt = remoteDictService.getCanChooseDbt(names);
|
||||
return AjaxResult.success(canChooseDbt.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增代表团
|
||||
* @param dbt
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult doAdd(@RequestBody Jdh_dbt dbt) {
|
||||
int count = dao.count(Jdh_dbt.class, Cnd.where("jdhid", "=", dbt.getJdhid()).and("dbtname", "=", dbt.getDbtname()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("代表团名称已存在");
|
||||
}
|
||||
dao.insert(dbt);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代表团
|
||||
*
|
||||
* @param dbt
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("updateDelegation")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult updateDelegation(@RequestBody Jdh_dbt dbt) {
|
||||
dao.updateIgnoreNull(dbt);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("findfgh")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult findfgh(@RequestParam String jdhid, @RequestParam String dbtid) {
|
||||
//获取所有工会
|
||||
List<SysUnion> unionList = remoteUnionService.listAll().getData();
|
||||
//工会分组成map,方便后边直接get到工会名称
|
||||
Map<String, String> unionMap = unionList.stream().collect(Collectors.toMap(SysUnion::getId, SysUnion::getUnionName));
|
||||
|
||||
//查询这个代表团已经设置了的工会
|
||||
List<Jdh_dbt_zcfgh> fghList = dao.query(Jdh_dbt_zcfgh.class, Cnd.where("jdhid", "=", jdhid).and("dbtid", "!=", dbtid));
|
||||
List<String> fghIdList = fghList.stream().map(Jdh_dbt_zcfgh::getFghid).collect(Collectors.toList());
|
||||
|
||||
//在所有工会的数据中过滤掉已经设置的工会
|
||||
List<SysUnion> canUnions = unionList.stream().filter(o -> !fghIdList.contains(o.getId())).collect(Collectors.toList());
|
||||
|
||||
//已经设置的工会
|
||||
List<Record> dbtFgh = dao.query("jdh_dbt_zcfgh", Cnd.where("dbtid", "=", dbtid));
|
||||
dbtFgh.forEach(item -> {
|
||||
item.put("unionName", unionMap.get(item.getString("fghid")));
|
||||
});
|
||||
|
||||
NutMap data = NutMap.NEW().addv("data", canUnions).addv("value", dbtFgh);
|
||||
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
@PostMapping("fghdoAdd")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult fghdoAdd(@RequestBody String[] fghValue, @RequestParam(value = "jdhid") String jdhid, @RequestParam(value = "dbtid") String dbtid) {
|
||||
|
||||
dao.clear(Jdh_dbt_zcfgh.class, Cnd.where("jdhid", "=", jdhid).and("dbtid", "=", dbtid));
|
||||
List<Jdh_dbt_zcfgh> list = new ArrayList<>();
|
||||
for (String fgh : fghValue) {
|
||||
Jdh_dbt_zcfgh jdh_dbt_zcfgh = new Jdh_dbt_zcfgh();
|
||||
jdh_dbt_zcfgh.setFghid(fgh);
|
||||
jdh_dbt_zcfgh.setJdhid(jdhid);
|
||||
jdh_dbt_zcfgh.setDbtid(dbtid);
|
||||
list.add(jdh_dbt_zcfgh);
|
||||
}
|
||||
dao.insert(list);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
//查询该代表团下的没有被设为团长副团长的代表
|
||||
@GetMapping("queryUser")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult queryUser(@RequestParam String jdhid, @RequestParam String dbtid) {
|
||||
|
||||
//根据jdhid和dbtid在代表表中查询出所有的代表
|
||||
List<Jdh_db> dbs = dao.query(Jdh_db.class, Cnd.where("jdhid", "=", jdhid).and("dbtid", "=", dbtid));
|
||||
List<Long> dbIds = dbs.stream().map(Jdh_db::getDbid).collect(Collectors.toList());
|
||||
|
||||
//查询团长副团长
|
||||
List<FeignCnd> cndList = List.of(new FeignCnd("jdhid", "=", jdhid), new FeignCnd("dbtid", "=", dbtid), new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ)));
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<Long> userIds = userRoles.stream().map(SysUserRole::getUserId).collect(Collectors.toList());
|
||||
|
||||
dbIds.removeAll(userIds);
|
||||
|
||||
Sql sql = Sqls.create("select * from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "in", dbIds);
|
||||
sql.setCondition(cnd);
|
||||
List list = delegationManageService.listMap(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("doAddTz")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult doAddTz(String dbtid, String jdhid, long userid, Integer num) {
|
||||
if (num == 2) {
|
||||
List<FeignCnd> cndList = List.of(new FeignCnd("jdhid", "=", jdhid), new FeignCnd("dbtid", "=", dbtid), new FeignCnd("role_id", "=", Roles.DBT_TZ));
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
if (userRoles.size() > 0) {
|
||||
return AjaxResult.error("团长只能设置一位!");
|
||||
}
|
||||
}
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setUserId(userid);
|
||||
sysUserRole.setJdhid(jdhid);
|
||||
sysUserRole.setDbtid(dbtid);
|
||||
sysUserRole.setRoleId(num == 1 ? Roles.DBT_FTZ : Roles.DBT_TZ);
|
||||
R<Boolean> booleanR = remoteUserRoleService.addUserRole(sysUserRole);
|
||||
return booleanR.getCode() == R.SUCCESS ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return AjaxResult.error("参数为空!");
|
||||
}
|
||||
dao.clear(Jdh_dbt.class, Cnd.where("id", "=", id));
|
||||
//删除组成基层工会
|
||||
dao.clear(Jdh_dbt_zcfgh.class, Cnd.where("dbtid", "=", id));
|
||||
//删除团长 副团长 操作员的权限,删除正式代表权限
|
||||
List<FeignCnd> cndList = List.of(new FeignCnd("dbtid", "=", id), new FeignCnd("role_id", "in", List.of(Roles.ZSDB, Roles.DBT_TZ, Roles.DBT_FTZ)));
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
//删除jdh_db 表用户
|
||||
dao.clear(Jdh_db.class, Cnd.where("dbtid", "=", id));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("adminPageData")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult adminPageData(String dbtid) {
|
||||
//获取所有工会
|
||||
List<SysUnion> unionList = remoteUnionService.listAll().getData();
|
||||
//工会分组成map,方便后边直接get到工会名称
|
||||
Map<String, String> unionMap = unionList.stream().collect(Collectors.toMap(SysUnion::getId, SysUnion::getUnionName));
|
||||
List<Record> dbtFgh = dao.query("jdh_dbt_zcfgh", Cnd.where("dbtid", "=", dbtid));
|
||||
dbtFgh.forEach(item -> {
|
||||
item.put("unionName", unionMap.get(item.getString("fghid")));
|
||||
});
|
||||
return AjaxResult.success(dbtFgh);
|
||||
}
|
||||
|
||||
@PostMapping("fghdoDelete/{id}")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult fghdoDelete(@PathVariable String id) {
|
||||
int num = dao.clear(Jdh_dbt_zcfgh.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@GetMapping("getTzList")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult getTzList(String dbtid) {
|
||||
List<FeignCnd> cndList = List.of(new FeignCnd("dbtid", "=", dbtid), new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ)));
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<Long> users = userRoles.stream().map(SysUserRole::getUserId).collect(Collectors.toList());
|
||||
|
||||
Sql sql = Sqls.create("select * from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "in", users);
|
||||
cnd.asc("deptCode");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = delegationManageService.listMap(sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
list.forEach(item -> {
|
||||
SysUserRole sysUserRole = userRoles.stream().filter(o -> o.getUserId() == item.getLong("userId")).findAny().orElse(null);
|
||||
item.addv("roleName", roleMap.get(sysUserRole.getRoleId()));
|
||||
item.addv("roleId", sysUserRole.getRoleId());
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("userDoDelete")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult userDoDelete(String userid, String dbtid, String jdhid, String roleid) {
|
||||
List<FeignCnd> cndList = List.of(new FeignCnd("dbtid", "=", dbtid), new FeignCnd("jdhid", "=", jdhid), new FeignCnd("user_id", "=", userid), new FeignCnd("role_id", "=", roleid));
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("dbTableData")
|
||||
@RequiresPermissions("jdh:delegation:delegationManage")
|
||||
public AjaxResult dbTableData(@RequestBody PageForm page, @RequestParam(value = "dbtid") String dbtid, @RequestParam(value = "jdhid") String jdhid, @RequestParam(value = "unionid") String unionid, @RequestParam(value = "unitid") String unitid) {
|
||||
|
||||
List<FeignCnd> cndList = List.of(new FeignCnd("dbtid", "=", dbtid), new FeignCnd("jdhid", "=", jdhid), new FeignCnd("role_id", "in", Lang.array(Roles.ZSDB, Roles.LXDB, Roles.TYDB)));
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<Long> users = userRoles.stream().map(SysUserRole::getUserId).collect(Collectors.toList());
|
||||
|
||||
List<Jdh_db> dbs = dao.query(Jdh_db.class, Cnd.where("jdhid", "=", jdhid).and("dbtid", "=", dbtid));
|
||||
List<Long> dbList = dbs.stream().map(Jdh_db::getDbid).collect(Collectors.toList());
|
||||
|
||||
Sql sql = Sqls.create("select * from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "in", dbList);
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(unitid)) {
|
||||
cnd.and("deptId", "=", unitid);
|
||||
}
|
||||
if (Strings.isNotBlank(unionid)) {
|
||||
cnd.and("unionId", "=", unionid);
|
||||
}
|
||||
cnd.asc("deptCode");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = delegationManageService.listMap(sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
list.forEach(item -> {
|
||||
Jdh_db db = dbs.stream().filter(o -> o.getDbid() == item.getLong("userId")).findAny().orElse(null);
|
||||
item.addv("roleName", roleMap.get(db.getRoleid()));
|
||||
item.addv("roleId", db.getRoleid());
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
+394
@@ -0,0 +1,394 @@
|
||||
package com.ruoyi.jdh.controller.deputy;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.redis.service.RedisService;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_dbt_zcfgh;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Representative;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Session;
|
||||
import com.ruoyi.jdh.service.DeputyPushService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description 代表审查
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deputy/audit")
|
||||
@Slf4j
|
||||
public class DeputyAuditController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
@Autowired
|
||||
private DeputyPushService deputyPushService;
|
||||
@Autowired
|
||||
private RemoteDictService dictService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:deputy:audit")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId,
|
||||
@RequestParam(value = "isAudit", required = false) String isAudit,
|
||||
@RequestParam(value = "isFormalOrAttendance", required = false) String isFormalOrAttendance) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tmd.*,
|
||||
CASE
|
||||
tmd.stateCode
|
||||
WHEN 0 THEN
|
||||
'待填写'
|
||||
WHEN 50 THEN
|
||||
'填写完成'
|
||||
WHEN 100 THEN
|
||||
'待审查'
|
||||
WHEN 200 THEN
|
||||
'未通过'
|
||||
WHEN 300 THEN
|
||||
'审查通过' ELSE '未知'
|
||||
END stateName
|
||||
FROM
|
||||
`teacher_meet_delegate` tmd
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!"全部".equals(isFormalOrAttendance)) {
|
||||
cnd.and("tmd.representativeType", "=", isFormalOrAttendance);
|
||||
}
|
||||
|
||||
switch (isAudit) {
|
||||
case "true":
|
||||
cnd.and("tmd.stateCode", "in", Lang.array(200, 300));
|
||||
break;
|
||||
case "false":
|
||||
cnd.and("tmd.stateCode", "in", Lang.array(100));
|
||||
break;
|
||||
case "all":
|
||||
cnd.and("tmd.stateCode", ">=", 100);
|
||||
break;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(teacherMeetId)) {
|
||||
cnd.and("tmd.teacherMeetId", "=", teacherMeetId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("tmd.unionId", "=", unionId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(unitId)) {
|
||||
cnd.and("tmd.unitId", "=", unitId);
|
||||
}
|
||||
cnd.asc("tmd.stateCode").asc("tmd.unionName");
|
||||
cnd.desc("tmd.representativeType");
|
||||
cnd.desc("tmd.stateCode").asc("tmd.unionName");
|
||||
cnd.groupBy("tmd.userId");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = deputyPushService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAudit")
|
||||
@RequiresPermissions("jdh:deputy:audit")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult doAudit(@RequestBody String[] ids,
|
||||
@RequestParam Boolean result) {
|
||||
for (String id : ids) {
|
||||
TeacherMeetDelegate delegate = dao.fetch(TeacherMeetDelegate.class, id);
|
||||
Sql sql = Sqls.create("""
|
||||
select * from `user` where userId = @id
|
||||
""").setParam("id", delegate.getUserId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
|
||||
if (result) {
|
||||
if (delegate.getIsJdh()) {
|
||||
dao.clear(Jdh_db.class, Cnd.where("dbid", "=", delegate.getUserId())
|
||||
.and("jdhid", "=", delegate.getTeacherMeetId()));
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", delegate.getUserId()),
|
||||
new FeignCnd("role_id", "=", Roles.ZSDB)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
|
||||
|
||||
Jdh_db db = new Jdh_db();
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
|
||||
db.setDbid(delegate.getUserId());
|
||||
db.setJdhid(delegate.getTeacherMeetId());
|
||||
db.setUserName(delegate.getUserName());
|
||||
db.setLoginName(delegate.getLoginName());
|
||||
db.setSex(delegate.getSex());
|
||||
Date birthday = delegate.getBirthday();
|
||||
// 转为LocalDate
|
||||
if(birthday != null){
|
||||
db.setBirthday(birthday.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
|
||||
}
|
||||
db.setAge(delegate.getAge());
|
||||
db.setNation(delegate.getNation());
|
||||
db.setPolitical(delegate.getPolitical());
|
||||
db.setEducation(delegate.getEducation());
|
||||
db.setAcademicDegree(delegate.getAcademicDegree());
|
||||
db.setTechnicalTitle(delegate.getTechnicalTitle());
|
||||
db.setTechnicalTitleLevel(delegate.getTechnicalTitleLevel());
|
||||
db.setJobTitle(delegate.getJobTitle());
|
||||
db.setJobTitleLevel(delegate.getJobTitleLevel());
|
||||
db.setPosition(delegate.getPosition());
|
||||
db.setOrdinaryTeacher(delegate.getOrdinaryTeacher());
|
||||
db.setSeniorTeacher(delegate.getSeniorTeacher());
|
||||
db.setUnitId(delegate.getUnitId());
|
||||
db.setUnitName(delegate.getUnitName());
|
||||
db.setUnionId(delegate.getUnionId());
|
||||
db.setUnionName(delegate.getUnionName());
|
||||
db.setMobile(delegate.getMobile());
|
||||
db.setEmail(delegate.getEmail());
|
||||
db.setSfyx(true);
|
||||
|
||||
db.setDbunitid(delegate.getUnitId());
|
||||
db.setDbunitname(delegate.getUnitName());
|
||||
db.setDbfghid(delegate.getUnionId());
|
||||
db.setDbfghname(delegate.getUnionName());
|
||||
|
||||
// db.setDbunitid(user.getString("deptId"));
|
||||
// db.setDbunitname(user.getString("deptName"));
|
||||
// db.setDbfghid(user.getString("unionId"));
|
||||
// db.setDbfghname(user.getString("unionName"));
|
||||
|
||||
//查询出所属代表团
|
||||
Jdh_dbt_zcfgh zcfgh = dao.fetch(Jdh_dbt_zcfgh.class, Cnd.where("fghid", "=", db.getUnionId())
|
||||
.and("jdhid", "=", delegate.getTeacherMeetId()));
|
||||
if (ObjectUtil.isNotEmpty(zcfgh)) {
|
||||
db.setDbtid(zcfgh.getDbtid());
|
||||
userRole.setDbtid(zcfgh.getDbtid());
|
||||
} else {
|
||||
throw new ServiceException(user.getString("unionName") + "没有设置到代表团,请先在代表团管理里设置。");
|
||||
}
|
||||
|
||||
if ("正式代表".equals(delegate.getRepresentativeType())) {
|
||||
db.setRoleid(Roles.ZSDB);
|
||||
userRole.setRoleId(Roles.ZSDB);
|
||||
}
|
||||
if ("列席代表".equals(delegate.getRepresentativeType())) {
|
||||
db.setRoleid(Roles.LXDB);
|
||||
userRole.setRoleId(Roles.LXDB);
|
||||
}
|
||||
db.setDbzt(2);
|
||||
dao.insert(db);
|
||||
|
||||
userRole.setUserId(delegate.getUserId());
|
||||
userRole.setJdhid(delegate.getTeacherMeetId());
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
}
|
||||
if (delegate.getIsGdh()) {
|
||||
Session session = dao.fetch(Session.class, Cnd.where("1", "=", 1).desc("startTime"));
|
||||
|
||||
Representative representative = new Representative();
|
||||
representative.setGdh_id(session.getId());
|
||||
representative.setUserId(delegate.getUserId());
|
||||
representative.setRoleId(Roles.GDHDB);
|
||||
dao.insert(representative);
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(delegate.getUserId());
|
||||
userRole.setRoleId(Roles.GDHDB);
|
||||
userRole.setGdhid(session.getId());
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
}
|
||||
delegate.setStateCode(300);
|
||||
} else {
|
||||
delegate.setStateCode(200);
|
||||
}
|
||||
dao.updateIgnoreNull(delegate);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("doRevoke")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public AjaxResult doRevoke(@RequestParam("id") String id) {
|
||||
try {
|
||||
TeacherMeetDelegate delegate = dao.fetch(TeacherMeetDelegate.class, id);
|
||||
dao.clear(Jdh_db.class, Cnd.where("dbid", "=", delegate.getUserId()).and("jdhid", "=", delegate.getTeacherMeetId()));
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", delegate.getUserId()),
|
||||
new FeignCnd("role_id", "in", Lang.array(Roles.LXDB, Roles.ZSDB))
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
delegate.setStateCode(100);
|
||||
dao.updateIgnoreNull(delegate);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @param teacherMeetId 教代会届次
|
||||
* @param unionId 分工会id
|
||||
* @param isAudit 是否已审核
|
||||
* @param response response
|
||||
*/
|
||||
@RequestMapping("exportXlsx")
|
||||
@RequiresPermissions("jdh:deputy:audit")
|
||||
public void exportXlsx(@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId,
|
||||
@RequestParam(value = "isAudit", required = false) String isAudit,
|
||||
@RequestParam(value = "isFormalOrAttendance", required = false) String isFormalOrAttendance,
|
||||
HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tmd.*,
|
||||
CASE
|
||||
tmd.stateCode
|
||||
WHEN 0 THEN
|
||||
'待填写'
|
||||
WHEN 50 THEN
|
||||
'填写完成'
|
||||
WHEN 100 THEN
|
||||
'待审查'
|
||||
WHEN 200 THEN
|
||||
'未通过'
|
||||
WHEN 300 THEN
|
||||
'审查通过' ELSE '未知'
|
||||
END stateName
|
||||
FROM
|
||||
`teacher_meet_delegate` tmd
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!"全部".equals(isFormalOrAttendance)) {
|
||||
cnd.and("tmd.representativeType", "=", isFormalOrAttendance);
|
||||
}
|
||||
switch (isAudit) {
|
||||
case "true":
|
||||
cnd.and("tmd.stateCode", "in", Lang.array(200, 300));
|
||||
break;
|
||||
case "false":
|
||||
cnd.and("tmd.stateCode", "in", Lang.array(100));
|
||||
break;
|
||||
case "all":
|
||||
cnd.and("tmd.stateCode", ">=", 100);
|
||||
break;
|
||||
}
|
||||
cnd.andEX("tmd.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("tmd.unionId", "=", unionId);
|
||||
cnd.andEX("tmd.unitId", "=", unitId);
|
||||
cnd.asc("tmd.stateCode").asc("tmd.unionName");
|
||||
cnd.desc("tmd.representativeType");
|
||||
cnd.desc("tmd.stateCode").asc("tmd.unionName");
|
||||
cnd.groupBy("tmd.userId");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = deputyPushService.listMap(sql);
|
||||
|
||||
List<SysDictData> userSex = dictService.dictType("sys_user_sex").getData();
|
||||
Map<String, String> sexMap = userSex.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
|
||||
for (NutMap delegate : list) {
|
||||
delegate.put("sex", sexMap.getOrDefault(delegate.getString("sex", ""), ""));
|
||||
delegate.put("ordinaryTeacher", delegate.getBoolean("ordinaryTeacher") ? "√" : "");
|
||||
delegate.put("seniorTeacher", delegate.getBoolean("seniorTeacher") ? "√" : "");
|
||||
delegate.put("isJdh", delegate.getBoolean("isJdh") ? "√" : "");
|
||||
delegate.put("isGdh", delegate.getBoolean("isGdh") ? "√" : "");
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entities.add(new ExcelExportEntity("年龄", "age", 20));
|
||||
entities.add(new ExcelExportEntity("学历", "education", 20));
|
||||
entities.add(new ExcelExportEntity("学位", "academicDegree", 20));
|
||||
entities.add(new ExcelExportEntity("职称", "jobTitle", 20));
|
||||
entities.add(new ExcelExportEntity("职级", "jobTitleLevel", 20));
|
||||
entities.add(new ExcelExportEntity("职务", "position", 20));
|
||||
entities.add(new ExcelExportEntity("专任教师", "ordinaryTeacher", 20));
|
||||
entities.add(new ExcelExportEntity("高级职称专任教师", "seniorTeacher", 20));
|
||||
entities.add(new ExcelExportEntity("教代会代表", "isJdh", 20));
|
||||
entities.add(new ExcelExportEntity("工代会代表", "isGdh", 20));
|
||||
entities.add(new ExcelExportEntity("手机号码", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("电子邮箱", "email", 20));
|
||||
entities.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
entities.add(new ExcelExportEntity("类型", "representativeType", 20));
|
||||
|
||||
Jdh_jdhxx session = dao.fetch(Jdh_jdhxx.class, teacherMeetId);
|
||||
|
||||
// 文件导出设置
|
||||
final String FILE_NAME = session.getJdhallname() + "代表资格审查名单.xlsx";
|
||||
final String ENCODING = "utf-8";
|
||||
|
||||
try {
|
||||
response.setCharacterEncoding(ENCODING);
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(FILE_NAME, ENCODING));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(session.getJdhallname() + "代表名单");
|
||||
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list); OutputStream outputStream = response.getOutputStream()) {
|
||||
workbook.write(outputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录异常日志
|
||||
log.error("Error occurred while exporting Excel file.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+486
@@ -0,0 +1,486 @@
|
||||
package com.ruoyi.jdh.controller.deputy;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetWrite;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_mefp;
|
||||
import com.ruoyi.jdh.service.DeputyPushService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description 推选代表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deputy/push")
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class DeputyPushController {
|
||||
|
||||
private final Dao dao;
|
||||
|
||||
private DeputyPushService deputyPushService;
|
||||
|
||||
private RemoteDictService dictService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId,
|
||||
@RequestParam(value = "isFormalOrAttendance", required = false) String isFormalOrAttendance,
|
||||
@RequestParam(value = "isSwitch", required = false) Boolean isSwitch,
|
||||
@RequestParam(value = "unionId", required = false) String unionId) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.id,
|
||||
db.userId,
|
||||
db.teacherMeetId,
|
||||
db.delegationId,
|
||||
db.userName,
|
||||
db.loginName,
|
||||
db.sex,
|
||||
db.nation,
|
||||
db.political,
|
||||
db.education,
|
||||
db.academicDegree,
|
||||
db.jobTitle,
|
||||
db.jobTitleLevel,
|
||||
db.position,
|
||||
db.age,
|
||||
db.twoWork,
|
||||
db.stateCode,
|
||||
db.roleId,
|
||||
db.isJdh,
|
||||
db.isGdh,
|
||||
db.bz,
|
||||
db.representativeType,
|
||||
db.ordinaryTeacher,
|
||||
db.seniorTeacher,
|
||||
CASE
|
||||
db.stateCode
|
||||
WHEN 0 THEN
|
||||
'待填写'
|
||||
WHEN 50 THEN
|
||||
'填写完成'
|
||||
WHEN 100 THEN
|
||||
'待审查'
|
||||
WHEN 200 THEN
|
||||
'未通过'
|
||||
WHEN 300 THEN
|
||||
'审查通过' ELSE '未知'
|
||||
END stateName
|
||||
FROM
|
||||
`teacher_meet_delegate` db
|
||||
LEFT JOIN `user` u ON u.userId = db.userId
|
||||
$condition
|
||||
""");
|
||||
if (AuthUtil.hasAnyRoles("admin,A06") && !isSwitch) {
|
||||
cnd.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRole("admin")) {
|
||||
cnd.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
if (!"全部".equals(isFormalOrAttendance)) {
|
||||
cnd.and("db.representativeType", "=", isFormalOrAttendance);
|
||||
}
|
||||
cnd.andEX("db.teacherMeetId", "=", teacherMeetId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.desc("db.representativeType");
|
||||
cnd.asc("db.stateCode");
|
||||
cnd.groupBy("db.userid");
|
||||
sql.setCondition(cnd);
|
||||
return AjaxResult.success(deputyPushService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本分工会下的非代表用户
|
||||
*
|
||||
* @param teacherMeetId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getUnionUser")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult getUnionUser(String teacherMeetId,@RequestParam(required = false) String unionId) {
|
||||
// 查询预选中的代表
|
||||
Cnd cndx = Cnd.where("teacherMeetId", "=", teacherMeetId);
|
||||
cndx.andEX("unionId","=",unionId);
|
||||
List<TeacherMeetDelegate> delegateList = dao.query(TeacherMeetDelegate.class, cndx);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId,
|
||||
u.loginName,
|
||||
u.userName,
|
||||
u.jobTitle,
|
||||
u.jobTitleLevel,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN jdh_db j ON u.userId = j.dbid AND j.jdhid = @teacherMeetId
|
||||
LEFT JOIN teacher_meet_delegate t ON u.userId = t.userId AND t.teacherMeetId = @teacherMeetId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("teacherMeetId", teacherMeetId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.member", "=", 1);
|
||||
cnd.and("j.dbid", "is", null);
|
||||
cnd.and("t.userId", "is", null);
|
||||
cnd.and("u.unionId", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
List userList = deputyPushService.listMap(sql);
|
||||
return AjaxResult.success(Map.of("userData", userList, "userValue", delegateList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 推选代表
|
||||
*/
|
||||
@PostMapping("addPreselectionDb")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public AjaxResult addPreselectionDb(@RequestBody String[] userValue,
|
||||
@RequestParam String teacherMeetId,
|
||||
@RequestParam String representativeType) {
|
||||
|
||||
List<TeacherMeetDelegate> list = new ArrayList<>();
|
||||
for (String id : userValue) {
|
||||
Sql sql = Sqls.create("select * from `user` where userId = @id").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
|
||||
TeacherMeetDelegate tmd = new TeacherMeetDelegate();
|
||||
tmd.setUserId(user.getLong("userId"));
|
||||
tmd.setTeacherMeetId(teacherMeetId);
|
||||
tmd.setDelegationId(null);
|
||||
tmd.setUserName(user.getString("userName"));
|
||||
tmd.setLoginName(user.getString("loginName"));
|
||||
tmd.setSex(user.getString("sex"));
|
||||
tmd.setNation(user.getString("nation"));
|
||||
tmd.setPosition(user.getString("position"));
|
||||
tmd.setEducation(user.getString("education"));
|
||||
tmd.setAcademicDegree(user.getString("academicDegree"));
|
||||
tmd.setJobTitle(user.getString("jobTitle"));
|
||||
tmd.setJobTitleLevel(user.getString("jobTitleLevel"));
|
||||
tmd.setPolitical(user.getString("political"));
|
||||
|
||||
tmd.setBirthday(user.getTime("birthday"));
|
||||
tmd.setUnitId(user.getString("deptId"));
|
||||
tmd.setUnitName(user.getString("deptName"));
|
||||
tmd.setUnionId(user.getString("unionId"));
|
||||
tmd.setUnionName(user.getString("unionName"));
|
||||
|
||||
tmd.setOrdinaryTeacher(false);
|
||||
tmd.setSeniorTeacher(false);
|
||||
|
||||
tmd.setMobile(user.getString("mobile"));
|
||||
tmd.setEmail(user.getString("email"));
|
||||
|
||||
tmd.setIsJdh(true);
|
||||
tmd.setIsGdh(false);
|
||||
tmd.setRepresentativeType(representativeType);
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
if (Strings.isNotBlank(user.getString("birthday"))) {
|
||||
// Integer age = year - Integer.parseInt(user.getString("birthday").substring(0, 4));
|
||||
// tmd.setAge(age);
|
||||
String birthdayStr = user.getString("birthday");
|
||||
String datePart = birthdayStr.substring(0, 10);
|
||||
LocalDate birthday = LocalDate.parse(datePart);
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
int age = Period.between(birthday, currentDate).getYears();
|
||||
tmd.setAge(age);
|
||||
}
|
||||
if (representativeType.equals("正式代表")) {
|
||||
tmd.setStateCode(0);
|
||||
} else {
|
||||
tmd.setStateCode(100);
|
||||
}
|
||||
|
||||
tmd.setPushTime(new Date());
|
||||
list.add(tmd);
|
||||
}
|
||||
dao.insert(list);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("getUnionDeputies")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult getUnionDeputies(String teacherMeetId, Boolean isSwitch, String unionId) {
|
||||
return AjaxResult.success(deputyPushService.getUnionDb(teacherMeetId, isSwitch, unionId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 本单位代表上报情况
|
||||
*
|
||||
* @param teacherMeetId 教代会届次
|
||||
*/
|
||||
@GetMapping("selfUnionPushMetric")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult selfUnionPushMetric(String teacherMeetId, String unionId) {
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
unionId = SecurityUtils.getUnionId();
|
||||
}
|
||||
Jdh_mefp mefp = dao.fetch(Jdh_mefp.class, Cnd.where("jdhid", "=", teacherMeetId).and("fghid", "=", unionId));
|
||||
|
||||
// 查询单位已上报的名单
|
||||
List<TeacherMeetDelegate> writeList = dao.query(TeacherMeetDelegate.class, Cnd.where("unionid", "=", unionId)
|
||||
.and("representativeType", "=", "正式代表"));
|
||||
|
||||
// 上报总人数
|
||||
int total = writeList.size();
|
||||
// 女代表人数
|
||||
int female = (int) writeList.stream().filter(v -> "1".equals(v.getSex())).count();
|
||||
// 高级职称专任教师人数
|
||||
int seniorTeacher = (int) writeList.stream().filter(TeacherMeetDelegate::getSeniorTeacher).count();
|
||||
// 专任教师人数
|
||||
int ordinaryTeacher = (int) writeList.stream().filter(TeacherMeetDelegate::getOrdinaryTeacher).count();
|
||||
// 45岁以下代表
|
||||
int under45 = (int) writeList.stream().filter(v -> Convert.toInt(v.getAge(), 0) <= 45).count();
|
||||
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
|
||||
HashMap<String, Object> totalMap = new HashMap<>();
|
||||
totalMap.put("current", total);
|
||||
totalMap.put("target", mefp.getQuota());
|
||||
totalMap.put("progress", mefp.getQuota() != 0 ? (double) total / mefp.getQuota() : 0.0);
|
||||
totalMap.put("remaining", mefp.getQuota() - total);
|
||||
hashMap.put("total", totalMap);
|
||||
|
||||
HashMap<String, Object> femaleMap = new HashMap<>();
|
||||
femaleMap.put("current", female);
|
||||
femaleMap.put("target", mefp.getFemaleNum());
|
||||
femaleMap.put("progress", mefp.getFemaleNum() != 0 ? (double) female / mefp.getFemaleNum() : 0.0);
|
||||
femaleMap.put("remaining", mefp.getFemaleNum() - female);
|
||||
hashMap.put("female", femaleMap);
|
||||
|
||||
HashMap<String, Object> seniorTeaMap = new HashMap<>();
|
||||
seniorTeaMap.put("current", seniorTeacher);
|
||||
seniorTeaMap.put("target", mefp.getSeniorTeaNum());
|
||||
seniorTeaMap.put("progress", mefp.getSeniorTeaNum() != 0 ? (double) seniorTeacher / mefp.getSeniorTeaNum() : 0.0);
|
||||
seniorTeaMap.put("remaining", mefp.getSeniorTeaNum() - seniorTeacher);
|
||||
hashMap.put("seniorTeacher", seniorTeaMap);
|
||||
|
||||
HashMap<String, Object> ordinaryTeaMap = new HashMap<>();
|
||||
ordinaryTeaMap.put("current", ordinaryTeacher);
|
||||
ordinaryTeaMap.put("target", mefp.getOrdinaryTeaNum());
|
||||
ordinaryTeaMap.put("progress", mefp.getOrdinaryTeaNum() != 0 ? (double) ordinaryTeacher / mefp.getOrdinaryTeaNum() : 0.0);
|
||||
ordinaryTeaMap.put("remaining", mefp.getOrdinaryTeaNum() - ordinaryTeacher);
|
||||
hashMap.put("ordinaryTeacher", ordinaryTeaMap);
|
||||
|
||||
HashMap<String, Object> under45Map = new HashMap<>();
|
||||
under45Map.put("current", under45);
|
||||
under45Map.put("target", mefp.getLess45Num());
|
||||
under45Map.put("progress", mefp.getLess45Num() != 0 ? (double) under45 / mefp.getLess45Num() : 0.0);
|
||||
under45Map.put("remaining", mefp.getLess45Num() - under45);
|
||||
hashMap.put("under45", under45Map);
|
||||
|
||||
return AjaxResult.success(hashMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报代表校验
|
||||
*
|
||||
* @param teacherMeetId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("validSubmit")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult validSubmit(String teacherMeetId, String unionId) {
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
unionId = SecurityUtils.getUnionId();
|
||||
}
|
||||
String tips = deputyPushService.validSubmit(teacherMeetId, unionId);
|
||||
return AjaxResult.success(Map.of("valid", StrUtil.isBlank(tips), "tips", tips));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个上报代表
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("doSubmit/{id}")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult doSubmit(@PathVariable String id) {
|
||||
dao.update(TeacherMeetDelegate.class, Chain.make("stateCode", 100), Cnd.where("id", "=", id));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 撤销上报
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("doRevoke/{id}")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult doRevoke(@PathVariable String id) {
|
||||
dao.update(TeacherMeetDelegate.class, Chain.make("stateCode", 50), Cnd.where("id", "=", id));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
int num = dao.clear(TeacherMeetDelegate.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上报代表
|
||||
*
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("batchSubmit")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public AjaxResult batchSubmit(@RequestBody List<String> ids, String teacherMeetId, String unionId) {
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
unionId = SecurityUtils.getUnionId();
|
||||
}
|
||||
|
||||
String validTips = deputyPushService.validSubmit(teacherMeetId, unionId);
|
||||
if (StrUtil.isNotBlank(validTips)) {
|
||||
return AjaxResult.warn(validTips);
|
||||
}
|
||||
|
||||
List<TeacherMeetDelegate> delegates = dao.query(TeacherMeetDelegate.class, Cnd.where("teacherMeetId", "=", teacherMeetId).and("unionId", "=", unionId)
|
||||
.and("representativeType", "=", "正式代表"));
|
||||
// List<TeacherMeetDelegate> delegates = dao.query(TeacherMeetDelegate.class, Cnd.where("id", "in", ids));
|
||||
// List<TeacherMeetDelegate> delegateList = delegates.stream().filter(v -> v.getRepresentativeType().equals("正式代表")).collect(Collectors.toList());
|
||||
|
||||
StringBuffer tips = new StringBuffer();
|
||||
for (TeacherMeetDelegate delegate : delegates) {
|
||||
if (delegate.getStateCode() == 0) {
|
||||
tips.append(delegate.getUserName()).append("未填写!");
|
||||
continue;
|
||||
}
|
||||
if(delegate.getStateCode()==50){
|
||||
delegate.setStateCode(100);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(tips)) {
|
||||
return AjaxResult.warn(tips.toString());
|
||||
}
|
||||
|
||||
dao.update(delegates, "stateCode");
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@RequestMapping("exportXlsx")
|
||||
@RequiresPermissions("jdh:deputy:push")
|
||||
public void exportXlsx(String teacherMeetId, String unionId, HttpServletResponse response) {
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
unionId = SecurityUtils.getUnionId();
|
||||
}
|
||||
List<TeacherMeetDelegate> delegates = dao.query(TeacherMeetDelegate.class, Cnd.where("teacherMeetId", "=", teacherMeetId).and("unionId", "=", unionId));
|
||||
List<NutMap> list = Lang.collection2list(delegates, NutMap.class);
|
||||
|
||||
List<SysDictData> userSex = dictService.dictType("sys_user_sex").getData();
|
||||
Map<String, String> sexMap = userSex.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
|
||||
for (NutMap delegate : list) {
|
||||
delegate.put("sex", sexMap.getOrDefault(delegate.getString("sex", ""), ""));
|
||||
delegate.put("ordinaryTeacher", delegate.getBoolean("ordinaryTeacher") ? "√" : "");
|
||||
delegate.put("seniorTeacher", delegate.getBoolean("seniorTeacher") ? "√" : "");
|
||||
delegate.put("isJdh", delegate.getBoolean("isJdh") ? "√" : "");
|
||||
delegate.put("isGdh", delegate.getBoolean("isGdh") ? "√" : "");
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entities.add(new ExcelExportEntity("年龄", "age", 20));
|
||||
entities.add(new ExcelExportEntity("学历", "education", 20));
|
||||
entities.add(new ExcelExportEntity("学位", "academicDegree", 20));
|
||||
entities.add(new ExcelExportEntity("职称", "jobTitle", 20));
|
||||
entities.add(new ExcelExportEntity("职级", "jobTitleLevel", 20));
|
||||
entities.add(new ExcelExportEntity("职务", "position", 20));
|
||||
entities.add(new ExcelExportEntity("专任教师", "ordinaryTeacher", 20));
|
||||
entities.add(new ExcelExportEntity("高级职称专任教师", "seniorTeacher", 20));
|
||||
entities.add(new ExcelExportEntity("教代会代表", "isJdh", 20));
|
||||
entities.add(new ExcelExportEntity("工代会代表", "isGdh", 20));
|
||||
entities.add(new ExcelExportEntity("手机号码", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("电子邮箱", "email", 20));
|
||||
entities.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
entities.add(new ExcelExportEntity("类型", "representativeType", 20));
|
||||
|
||||
Jdh_jdhxx session = dao.fetch(Jdh_jdhxx.class, teacherMeetId);
|
||||
|
||||
// 文件导出设置
|
||||
final String FILE_NAME = session.getJdhallname() + "代表名单.xlsx";
|
||||
final String ENCODING = "utf-8";
|
||||
|
||||
try {
|
||||
response.setCharacterEncoding(ENCODING);
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(FILE_NAME, ENCODING));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(session.getJdhallname() + "代表名单");
|
||||
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list); OutputStream outputStream = response.getOutputStream()) {
|
||||
workbook.write(outputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录异常日志
|
||||
log.error("Error occurred while exporting Excel file.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+361
@@ -0,0 +1,361 @@
|
||||
package com.ruoyi.jdh.controller.deputy;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Session;
|
||||
import com.ruoyi.jdh.service.DeputyReadInfoService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description 代表阅览
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deputy/readInfo")
|
||||
@Slf4j
|
||||
public class DeputyReadInfoController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
@Autowired
|
||||
private RemoteDictService dictService;
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
@Autowired
|
||||
private DeputyReadInfoService deputyReadInfoServicel;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:deputy:readInfo")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId,
|
||||
@RequestParam(value = "dbtid", required = false) String dbtid,
|
||||
@RequestParam(value = "dbsf", required = false) String dbsf) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
dbt.dbtName
|
||||
FROM
|
||||
jdh_db db
|
||||
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.asc("db.unionName").asc("db.unitName");
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andEX("db.jdhid", "=", jdhid);
|
||||
cnd.andEX("db.dbtid", "=", dbtid);
|
||||
cnd.andEX("db.unionId", "=", unionId);
|
||||
cnd.andEX("db.unitId", "=", unitId);
|
||||
cnd.andEX("db.roleid", "=", dbsf);
|
||||
if (!AuthUtil.hasAnyRoles("admin,A06,tamange")) {
|
||||
cnd.and("db.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = deputyReadInfoServicel.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
item.put("roleName", roleMap.get(item.getLong("roleid")));
|
||||
});
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@RequestMapping("downloadDbList")
|
||||
public void downloadDbList(String jdh_id, HttpServletResponse response) throws IOException {
|
||||
|
||||
//List<SysDictData> nations = dictService.dictType("sys_nation").getData();
|
||||
//Map<String, String> nationMap = nations.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
|
||||
Sql dbtSql = Sqls.create("SELECT dbt.*,(SELECT count(1) from jdh_db db WHERE db.dbtid = dbt.id) dbnum from jdh_dbt dbt where dbt.jdhid = @jdhid ORDER BY dbt.code").setParam("jdhid", jdh_id);
|
||||
Sql dbSql = Sqls.create("SELECT u.userId,(case u.sex when '1' then CONCAT(u.userName,'(女)') else u.userName end) username,u.nation mz,db.dbtid,db.roleid from jdh_db db left join `user` u on db.dbid = u.userId WHERE db.jdhid = @jdhid ORDER BY u.userName").setParam("jdhid", jdh_id);
|
||||
//查询团长
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("jdhid", "=", jdh_id),
|
||||
new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ))
|
||||
);
|
||||
List<SysUserRole> roles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
Map<Long, List<SysUserRole>> listMap = roles.stream().collect(Collectors.groupingBy(SysUserRole::getUserId));
|
||||
|
||||
Sql tzSql = Sqls.create("select u.userId,( CASE u.sex WHEN '1' THEN CONCAT( u.userName, '(女)' ) ELSE u.userName END ) username, u.nation mz from `user` u $condition ORDER BY u.userName");
|
||||
Cnd tzCnd = Cnd.NEW();
|
||||
tzCnd.and("userId", "in", roles.stream().map(SysUserRole::getUserId).collect(Collectors.toList()));
|
||||
tzSql.setCondition(tzCnd);
|
||||
|
||||
List<Record> dbtList = deputyReadInfoServicel.list(dbtSql);
|
||||
List<Record> dbs = deputyReadInfoServicel.list(dbSql);
|
||||
List<Record> tzs = deputyReadInfoServicel.list(tzSql);
|
||||
|
||||
dbs.forEach(db -> {
|
||||
if (db.getString("mz") != null && !db.getString("mz").contains("汉")) {
|
||||
db.set("username", db.getString("username") + '(' + db.getString("mz") + ')');
|
||||
}
|
||||
});
|
||||
|
||||
tzs.forEach(item -> {
|
||||
item.put("dbtid", listMap.get(item.getLong("userId")).get(0).getDbtid());
|
||||
item.put("roleid", listMap.get(item.getLong("userId")).get(0).getRoleId());
|
||||
if (item.getString("mz") != null && !item.getString("mz").contains("汉")) {
|
||||
item.set("username", item.getString("username") + '(' + item.getString("mz") + ')');
|
||||
}
|
||||
});
|
||||
|
||||
dbtList.forEach(dbt -> {
|
||||
dbt.set("tz", tzs.stream().filter(v -> {
|
||||
return dbt.getString("id").equals(v.getString("dbtid")) && Roles.DBT_TZ.equals(v.getLong("roleid"));
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
dbt.set("ftz", tzs.stream().filter(v -> {
|
||||
return dbt.getString("id").equals(v.getString("dbtid")) && Roles.DBT_FTZ.equals(v.getLong("roleid"));
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
dbt.set("cy", dbs.stream().filter(v -> {
|
||||
return dbt.getString("id").equals(v.getString("dbtid")) && Roles.ZSDB.equals(v.getLong("roleid")) && tzs.stream().noneMatch(x -> {
|
||||
return StrUtil.isNotBlank(x.getString("userId")) && x.getString("userId").equals(v.getString("userId"));
|
||||
});
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
});
|
||||
|
||||
String jdh_name = dao.fetch(Jdh_jdhxx.class, jdh_id).getJdhallname();
|
||||
String fileName = jdh_name + "代表名单.docx";
|
||||
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8);
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("jdh_name", jdh_name);
|
||||
map.put("dbts", dbtList);
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
Configure config = Configure.builder().bind("dbts", policy).build();
|
||||
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("templates/dbList.docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
@RequestMapping("exportList")
|
||||
public void exportList(String jdhid, String dbtid, HttpServletResponse response) throws IOException {
|
||||
Jdh_jdhxx jdhxx = dao.fetch(Jdh_jdhxx.class, jdhid);
|
||||
|
||||
Sql sql = Sqls.create("select * from jdh_db $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userName", "is not", null);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = deputyReadInfoServicel.listMap(sql);
|
||||
|
||||
List<SysDictData> userSex = dictService.dictType("sys_user_sex").getData();
|
||||
Map<String, String> sexMap = userSex.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
for (NutMap delegate : list) {
|
||||
delegate.put("sex", sexMap.getOrDefault(delegate.getString("sex", ""), ""));
|
||||
delegate.put("ordinaryTeacher", delegate.getBoolean("ordinaryTeacher") ? "√" : "");
|
||||
delegate.put("seniorTeacher", delegate.getBoolean("seniorTeacher") ? "√" : "");
|
||||
delegate.put("isJdh", delegate.getBoolean("isJdh") ? "√" : "");
|
||||
delegate.put("isGdh", delegate.getBoolean("isGdh") ? "√" : "");
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entities.add(new ExcelExportEntity("年龄", "age", 20));
|
||||
entities.add(new ExcelExportEntity("学历", "education", 20));
|
||||
entities.add(new ExcelExportEntity("学位", "academicDegree", 20));
|
||||
entities.add(new ExcelExportEntity("职称", "jobTitle", 20));
|
||||
entities.add(new ExcelExportEntity("职级", "jobTitleLevel", 20));
|
||||
entities.add(new ExcelExportEntity("职务", "position", 20));
|
||||
entities.add(new ExcelExportEntity("专任教师", "ordinaryTeacher", 20));
|
||||
entities.add(new ExcelExportEntity("高级职称专任教师", "seniorTeacher", 20));
|
||||
entities.add(new ExcelExportEntity("教代会代表", "isJdh", 20));
|
||||
entities.add(new ExcelExportEntity("工代会代表", "isGdh", 20));
|
||||
entities.add(new ExcelExportEntity("手机号码", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("电子邮箱", "email", 20));
|
||||
entities.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
entities.add(new ExcelExportEntity("类型", "representativeType", 20));
|
||||
|
||||
Jdh_jdhxx session = dao.fetch(Jdh_jdhxx.class, jdhid);
|
||||
|
||||
// 文件导出设置
|
||||
final String FILE_NAME = session.getJdhallname() + "代表资格审查名单.xlsx";
|
||||
final String ENCODING = "utf-8";
|
||||
|
||||
try {
|
||||
response.setCharacterEncoding(ENCODING);
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(FILE_NAME, ENCODING));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(session.getJdhallname() + "代表名单");
|
||||
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list); OutputStream outputStream = response.getOutputStream()) {
|
||||
workbook.write(outputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录异常日志
|
||||
log.error("Error occurred while exporting Excel file.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("doExport")
|
||||
public void doExport(String jdhid, HttpServletResponse response) throws IOException {
|
||||
|
||||
List<SysDictData> userSex = dictService.dictType("sys_user_sex").getData();
|
||||
List<SysDictData> nation = dictService.dictType("sys_nation").getData();
|
||||
List<SysDictData> education = dictService.dictType("sys_user_education").getData();
|
||||
|
||||
Map<String, String> sexMap = userSex.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
Map<String, String> nationMap = nation.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
Map<String, String> educationMap = education.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tea.*,u.unionName
|
||||
FROM
|
||||
teacher_meet_delegate tea
|
||||
LEFT JOIN `user` u ON u.userId = tea.userid
|
||||
$condition
|
||||
""").setParam("jdhid", jdhid);
|
||||
cnd.and("tea.teacherMeetId", "=", jdhid);
|
||||
cnd.and("tea.stateCode", "in", Lang.array(100, 300));
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
cnd.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
cnd.desc("u.unionName");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> maps = deputyReadInfoServicel.listMap(sql);
|
||||
|
||||
Session session = dao.fetch(Session.class, Cnd.where("startState", "=", 1).desc("year"));
|
||||
Jdh_jdhxx jdhxx = dao.fetch(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
|
||||
for (int i = 0; i < maps.size(); i++) {
|
||||
maps.get(i).put("number", i + 1);
|
||||
maps.get(i).setv("age", maps.get(i).getInt("age") < 40 ? "√" : "");
|
||||
maps.get(i).setv("twoWork", maps.get(i).getBoolean("twoWork") ? "√" : "");
|
||||
maps.get(i).setv("isJdh", maps.get(i).getBoolean("isJdh") ? "√" : "");
|
||||
maps.get(i).setv("isGdh", maps.get(i).getBoolean("isGdh") ? "√" : "");
|
||||
maps.get(i).put("sex", sexMap.get(maps.get(i).getString("sex")));
|
||||
maps.get(i).put("nation", nationMap.get(maps.get(i).getString("nation")));
|
||||
maps.get(i).put("education", educationMap.get(maps.get(i).getString("education")));
|
||||
}
|
||||
|
||||
map.put("unionname", SecurityUtils.getUnion().getUnionName().replaceAll("分工会*", ""));
|
||||
|
||||
String fileName = null;
|
||||
if (session != null) {
|
||||
fileName = jdhxx.getJdhjs() + "届教代会和" + session.getGdhJs() + "届工代会代表名册.xlsx";
|
||||
map.put("headerTitle", "%s届教代会和%s届工代会代表名册".formatted(jdhxx.getJdhjs(), session.getGdhJs()));
|
||||
} else {
|
||||
fileName = jdhxx.getJdhjs() + "届教代会代表名册.xlsx";
|
||||
map.put("headerTitle", "%s届教代会代表名册".formatted(jdhxx.getJdhjs()));
|
||||
}
|
||||
map.put("maplist", maps);
|
||||
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
TemplateExportParams params = new TemplateExportParams(
|
||||
"templates/jdh_gdh_db.xlsx");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DB implements Serializable {
|
||||
@Excel(name = "工号", width = 20)
|
||||
private String loginname;
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String username;
|
||||
@Excel(name = "性别", width = 10)
|
||||
private String sex;
|
||||
@Excel(name = "联系方式", width = 20)
|
||||
private String mobile;
|
||||
@Excel(name = "代表身份", width = 20)
|
||||
private String rolename;
|
||||
@Excel(name = "所属代表团", width = 30)
|
||||
private String dbtname;
|
||||
@Excel(name = "所属工会", width = 30)
|
||||
private String unionname;
|
||||
@Excel(name = "所属单位", width = 30)
|
||||
private String unitname;
|
||||
@Excel(name = "教代会", width = 20)
|
||||
private String jdh;
|
||||
}
|
||||
}
|
||||
+404
@@ -0,0 +1,404 @@
|
||||
package com.ruoyi.jdh.controller.deputy;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_dbt_zcfgh;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Session;
|
||||
import com.ruoyi.jdh.service.DeputyPushService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description 代表高级管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deputy/seniorManage")
|
||||
public class DeputySeniorManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
private DeputyPushService deputyPushService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
@Autowired
|
||||
public DeputySeniorManageController(DeputyPushService deputyPushService) {
|
||||
this.deputyPushService = deputyPushService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId,
|
||||
@RequestParam(value = "dbtid", required = false) String dbtid,
|
||||
@RequestParam(value = "dbsf", required = false) String dbsf) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
dbt.dbtName
|
||||
FROM
|
||||
jdh_db db
|
||||
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.asc("db.unionName").asc("db.unitName");
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andEX("db.jdhid", "=", jdhid);
|
||||
cnd.andEX("db.dbtid", "=", dbtid);
|
||||
cnd.andEX("db.unionId", "=", unionId);
|
||||
cnd.andEX("db.unitId", "=", unitId);
|
||||
cnd.andEX("db.roleid", "=", dbsf);
|
||||
if (!AuthUtil.hasAnyRoles("admin,A06,tamange")) {
|
||||
cnd.and("db.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = deputyPushService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
item.put("roleName", roleMap.get(item.getLong("roleid")));
|
||||
});
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@GetMapping("representativeRoleOptions")
|
||||
public AjaxResult representativeRoleOptions() {
|
||||
List<Map<String, ? extends Serializable>> list = List.of(
|
||||
Map.of("label", "正式代表", "value", Roles.ZSDB),
|
||||
Map.of("label", "列席代表", "value", Roles.LXDB),
|
||||
Map.of("label", "特邀代表", "value", Roles.TYDB)
|
||||
);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("queryNotDbUser")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
public AjaxResult queryNotDbUser(String jdhid, String dbtid, String keyword) {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tu.userId as id,u.loginName,u.userName,deptId as dwid,deptName as dwname," +
|
||||
"\tunionId as ghid,unionName \n" +
|
||||
"FROM\n" +
|
||||
"\t`user` u\n" +
|
||||
"WHERE\n" +
|
||||
"\tunionId IN ( SELECT fghid FROM jdh_dbt_zcfgh WHERE jdhid = @jdhid AND dbtid = @dbtid ) \n" +
|
||||
"\tAND u.userId NOT IN ( SELECT dbid FROM jdh_db WHERE jdhid = @jdhid ) \n" +
|
||||
"\tAND (u.userName like @keyword or u.loginName like @keyword)");
|
||||
sql.setParam("jdhid", jdhid);
|
||||
sql.setParam("dbtid", dbtid);
|
||||
sql.setParam("keyword", "%" + keyword + "%");
|
||||
Pagination pagination = deputyPushService.listPage(1, 10, sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
public AjaxResult doAdd(@RequestParam(value = "jdhid") String jdhid,
|
||||
@RequestParam(value = "dbtid") String dbtid,
|
||||
@RequestParam(value = "role") Long role,
|
||||
@RequestBody List<NutMap> userList) {
|
||||
|
||||
List<String> userIds = userList.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||
Sql sql = Sqls.create("select * from `user` where userId in (@ids)").setParam("ids", userIds);
|
||||
List<NutMap> list = deputyPushService.listMap(sql);
|
||||
|
||||
// 删掉原来的 如果有脏数据
|
||||
dao.clear(Jdh_db.class, Cnd.where("jdhid", "=", jdhid).and("roleid", "=", role).and("dbid", "in", userIds));
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "in", userIds),
|
||||
new FeignCnd("jdhid", "=", jdhid),
|
||||
new FeignCnd("role_id", "=", role)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
|
||||
for (NutMap delegate : list) {
|
||||
Jdh_db db = new Jdh_db();
|
||||
|
||||
db.setDbid(delegate.getLong("userId"));
|
||||
db.setJdhid(jdhid);
|
||||
db.setUserName(delegate.getString("userName"));
|
||||
db.setLoginName(delegate.getString("loginName"));
|
||||
db.setSex(delegate.getString("sex"));
|
||||
|
||||
Date birthday = delegate.getTime("birthday");
|
||||
// 转为LocalDate
|
||||
if (birthday != null) {
|
||||
db.setBirthday(birthday.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
int age = Period.between(db.getBirthday(), currentDate).getYears();
|
||||
db.setAge(age);
|
||||
}
|
||||
|
||||
db.setNation(delegate.getString("nation"));
|
||||
db.setPosition(delegate.getString("position"));
|
||||
db.setEducation(delegate.getString("education"));
|
||||
db.setAcademicDegree(delegate.getString("academicDegree"));
|
||||
db.setJobTitle(delegate.getString("jobTitle"));
|
||||
db.setJobTitleLevel(delegate.getString("jobTitleLevel"));
|
||||
db.setPolitical(delegate.getString("political"));
|
||||
|
||||
db.setUnitId(delegate.getString("deptId"));
|
||||
db.setUnitName(delegate.getString("deptName"));
|
||||
db.setUnionId(delegate.getString("unionId"));
|
||||
db.setUnionName(delegate.getString("unionName"));
|
||||
|
||||
db.setOrdinaryTeacher(false);
|
||||
db.setSeniorTeacher(false);
|
||||
|
||||
db.setMobile(delegate.getString("mobile"));
|
||||
db.setEmail(delegate.getString("email"));
|
||||
|
||||
db.setDbunitid(db.getUnitId());
|
||||
db.setDbunitname(db.getUnitName());
|
||||
db.setDbfghid(db.getUnionId());
|
||||
db.setDbfghname(db.getUnionName());
|
||||
|
||||
//查询出所属代表团
|
||||
Jdh_dbt_zcfgh zcfgh = dao.fetch(Jdh_dbt_zcfgh.class, Cnd.where("fghid", "=", db.getUnionId())
|
||||
.and("jdhid", "=", db.getJdhid()));
|
||||
if (ObjectUtil.isNotEmpty(zcfgh)) {
|
||||
db.setDbtid(zcfgh.getDbtid());
|
||||
} else {
|
||||
throw new ServiceException(delegate.getString("unionName") + "没有设置到代表团,请先在代表团管理里设置。");
|
||||
}
|
||||
db.setRoleid(role);
|
||||
dao.insert(db);
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setDbtid(db.getDbtid());
|
||||
userRole.setRoleId(role);
|
||||
userRole.setUserId(db.getDbid());
|
||||
userRole.setJdhid(db.getJdhid());
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doDelete")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult doDelete(@RequestBody List<NutMap> dataMapList) {
|
||||
Long delRoles[] = new Long[]{Roles.ZSDB, Roles.LXDB, Roles.TYDB, Roles.DBT_TZ, Roles.DBT_FTZ};
|
||||
|
||||
for (NutMap map : dataMapList) {
|
||||
//删除代表信息 团长 副团长 代表权限
|
||||
dao.clear("jdh_db", Cnd.where("id", "=", map.getString("id")));
|
||||
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", map.getLong("dbid")),
|
||||
new FeignCnd("jdhid", "=", map.getString("jdhid")),
|
||||
new FeignCnd("role_id", "in", delRoles)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("representativeInfo/{id}")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
public AjaxResult representativeInfo(@PathVariable String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
u.userName,
|
||||
u.loginName
|
||||
FROM
|
||||
jdh_db db
|
||||
left join `user` u on db.dbid = u.userId
|
||||
WHERE
|
||||
db.id = @id
|
||||
""").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
return AjaxResult.success(sql.getResult());
|
||||
}
|
||||
|
||||
@PostMapping("modifyRepresentativeInfo")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult modifyRepresentativeInfo(@RequestBody Jdh_db db) {
|
||||
Record fetch = dao.fetch("jdh_db", Cnd.where("dbid", "=", db.getDbid()).and("jdhid", "=", db.getJdhid()));
|
||||
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", db.getDbid()),
|
||||
new FeignCnd("jdhid", "=", db.getJdhid()),
|
||||
new FeignCnd("role_id", "=", fetch.getString("roleid"))
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(db.getDbid());
|
||||
userRole.setJdhid(db.getJdhid());
|
||||
userRole.setRoleId(db.getRoleid());
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
|
||||
dao.updateIgnoreNull(db);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("queryXldUser")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
public AjaxResult queryXldUser(String query, String jdhid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId,
|
||||
u.userName,
|
||||
u.sex,
|
||||
u.loginName,
|
||||
u.deptId AS dwid,
|
||||
u.deptName AS dwname,
|
||||
u.unionId AS ghid,
|
||||
u.unionName
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
u.userId NOT IN ( SELECT dbid FROM jdh_db WHERE jdhid = @jdhid )
|
||||
AND (u.userName LIKE @query OR u.loginName LIKE @query)
|
||||
""");
|
||||
sql.setParam("query", "%" + query + "%");
|
||||
sql.setParam("jdhid", jdhid);
|
||||
Pagination pagination = deputyPushService.listPage(1, 10, sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("fpXldToDbt")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
public AjaxResult fpXldToDbt(@RequestBody List<NutMap> userMapList,
|
||||
@RequestParam String jdhid) {
|
||||
for (NutMap userMap : userMapList) {
|
||||
Jdh_db db = new Jdh_db();
|
||||
db.setId(R.UU32());
|
||||
db.setDbid(userMap.getLong("userid"));
|
||||
db.setDbunitid(userMap.getString("dwid"));
|
||||
db.setDbunitname(userMap.getString("dwname"));
|
||||
db.setDbfghid(userMap.getString("ghid"));
|
||||
db.setDbfghname(userMap.getString("unionname"));
|
||||
db.setDbtid(userMap.getString("dbtid"));
|
||||
db.setJdhid(jdhid);
|
||||
db.setDbzt(2);
|
||||
db.setRoleid(Roles.ZSDB);
|
||||
dao.insert("jdh_db", Chain.from(db));
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(userMap.getLong("userid"));
|
||||
userRole.setJdhid(jdhid);
|
||||
userRole.setRoleId(Roles.ZSDB);
|
||||
userRole.setDbtid(userMap.getString("dbtid"));
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("dofpdbt")
|
||||
@RequiresPermissions("jdh:deputy:seniorManage")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult dofpdbt(String jdhid) {
|
||||
List<TeacherMeetDelegate> jdhList = dao.query(TeacherMeetDelegate.class, Cnd.where("stateCode", "=", 300).and("isJdh", "=", 1).and("teacherMeetId", "=", jdhid));
|
||||
List<TeacherMeetDelegate> gdhList = dao.query(TeacherMeetDelegate.class, Cnd.where("stateCode", "=", 300).and("isGdh", "=", 1).and("teacherMeetId", "=", jdhid));
|
||||
|
||||
jdhList.forEach(v -> {
|
||||
Sql sql = Sqls.create("select * from `user` where userId = @id").setParam("id", v.getUserId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
|
||||
Record fetch = dao.fetch("jdh_dbt_zcfgh",
|
||||
Cnd.where("fghid", "=", user.getString("unionId"))
|
||||
.and("jdhid", "=", v.getTeacherMeetId()));
|
||||
if (fetch == null) {
|
||||
throw new ServiceException("【" + user.getString("userName") + "】所属工会没有设置对应的代表团");
|
||||
}
|
||||
|
||||
dao.update("jdh_db",
|
||||
Chain.make("dbtid", fetch.getString("dbtid"))
|
||||
.add("dbfghid", user.getString("unionId"))
|
||||
.add("dbfghname", user.getString("unionName"))
|
||||
.add("dbunitid", user.getString("deptId"))
|
||||
.add("dbunitname", user.getString("deptName")),
|
||||
Cnd.where("jdhid", "=", v.getTeacherMeetId())
|
||||
.and("dbid", "=", v.getUserId()));
|
||||
});
|
||||
|
||||
Session session = dao.fetch(Session.class, Cnd.where("startState", "=", 1).desc("startTime"));
|
||||
gdhList.forEach(z -> {
|
||||
Sql sql = Sqls.create("select * from `user` where userId = @id").setParam("id", z.getUserId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
|
||||
Record fetch = dao.fetch("workers_congress_delegation_make_up_union",
|
||||
Cnd.where("union_id", "=", user.getString("unionid")).and("gdh_id", "=", session.getId()));
|
||||
|
||||
if (Lang.isNotEmpty(fetch)) {
|
||||
dao.update("workers_congress_representative",
|
||||
Chain.make("dbt_id", fetch.getString("dbt_id")),
|
||||
Cnd.where("userid", "=", user.getString("userId"))
|
||||
.and("gdh_id", "=", session.getId()));
|
||||
}
|
||||
});
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一个代表的信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param teacherMeetId 教代会id
|
||||
* @return {@link AjaxResult}
|
||||
*/
|
||||
@RequestMapping("/fineOne")
|
||||
public AjaxResult findOne(@RequestParam Long userId, @RequestParam String teacherMeetId) {
|
||||
return AjaxResult.success(dao.fetch(Jdh_db.class, Cnd.where("dbid", "=", userId).and("jdhid", "=", teacherMeetId)));
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.jdh.controller.deputy;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetWrite;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.service.IDeputyWriteService;
|
||||
import com.ruoyi.system.api.RemoteFileService;
|
||||
import com.ruoyi.system.api.domain.SysConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:DeputyWriteController
|
||||
* @Date 2024/5/15 17:52
|
||||
* @注释 代表信息填写
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/deputy/write")
|
||||
public class DeputyWriteController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
@Autowired
|
||||
private IDeputyWriteService deputyWriteService;
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 代表信息初始信息
|
||||
*
|
||||
* @param teacherMeetId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("info")
|
||||
@RequiresPermissions("jdh:deputy:write")
|
||||
@Deprecated
|
||||
public AjaxResult info(String teacherMeetId, String userId) {
|
||||
userId = StrUtil.blankToDefault(userId, SecurityUtils.getUserId().toString());
|
||||
TeacherMeetDelegate delegate = dao.fetch(TeacherMeetDelegate.class, Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("userId", "=", userId));
|
||||
if (ObjectUtil.isNull(delegate)) {
|
||||
return AjaxResult.success(Map.of("isSelected", false));
|
||||
}
|
||||
return AjaxResult.success(Map.of("isSelected", true, "delegate", delegate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 代表信息填写提交
|
||||
*/
|
||||
@PostMapping("submit")
|
||||
@RequiresPermissions("jdh:deputy:write")
|
||||
public AjaxResult submit(@RequestBody TeacherMeetDelegate delegate) {
|
||||
// 代表上报状态改为50 代表填写完成
|
||||
if (delegate.getOrdinaryTeacher() && StrUtil.isNotBlank(delegate.getJobTitleLevel()) && delegate.getJobTitleLevel().contains("高级")) {
|
||||
delegate.setSeniorTeacher(true);
|
||||
}
|
||||
delegate.setStateCode(50);
|
||||
dao.updateIgnoreNull(delegate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 代表信息填写保存
|
||||
*/
|
||||
@PostMapping("save")
|
||||
@RequiresPermissions("jdh:deputy:write")
|
||||
public AjaxResult save(@RequestBody TeacherMeetDelegate delegate) {
|
||||
if (delegate.getOrdinaryTeacher() && StrUtil.isNotBlank(delegate.getJobTitleLevel()) && delegate.getJobTitleLevel().contains("高级")) {
|
||||
delegate.setSeniorTeacher(true);
|
||||
}
|
||||
dao.updateIgnoreNull(delegate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
package com.ruoyi.jdh.controller.election;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.election.TeacherMeetCommission;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgcy;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgsz;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.OrganizationUser;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Session;
|
||||
import com.ruoyi.jdh.service.election.ICommissionerService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysRole;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/recommend/commissioner")
|
||||
public class CommissionerController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private ICommissionerService commissionerService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
@Autowired
|
||||
private RemoteDictService remoteDictService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("election:recommend:commissioner")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unionName,
|
||||
u.deptName,
|
||||
IF
|
||||
(
|
||||
db.zmwyhId IS NOT NULL,
|
||||
jj.`name`,
|
||||
IF
|
||||
( db.zmwyhId IS NULL AND db.isJdh = 1 AND db.isGdh IS NULL, '执行委员会', '工会委员会' )) `name`
|
||||
FROM
|
||||
`teacher_meet_commission` db
|
||||
LEFT JOIN `user` u ON u.userId = db.userId
|
||||
LEFT JOIN `jdh_jgsz` jj ON jj.id = db.zmwyhId
|
||||
$condition
|
||||
""");
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
cnd.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
cnd.andEX("db.teacherMeetId", "=", teacherMeetId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("db.stateCode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = commissionerService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
item.put("roleName", roleMap.get(item.getLong("roleId")));
|
||||
});
|
||||
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getUnionUser")
|
||||
@RequiresPermissions("election:recommend:commissioner")
|
||||
public AjaxResult getUnionUser(String teacherMeetId, String wylb) {
|
||||
|
||||
Cnd cnd1 = Cnd.NEW();
|
||||
Sql sql1 = Sqls.create("""
|
||||
SELECT
|
||||
db.*,u.userName
|
||||
FROM
|
||||
`teacher_meet_commission` db
|
||||
LEFT JOIN `user` u ON db.userId = u.userId
|
||||
$condition
|
||||
""");
|
||||
cnd1.andEX("db.teacherMeetId", "=", teacherMeetId);
|
||||
if(!AuthUtil.hasRole("admin")){
|
||||
cnd1.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
sql1.setCondition(cnd1);
|
||||
List<NutMap> userValue = commissionerService.listMap(sql1);
|
||||
List<Long> userId = userValue.stream().map(v -> v.getLong("userId")).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,u.userName
|
||||
FROM
|
||||
`teacher_meet_delegate` db
|
||||
LEFT JOIN `user` u ON db.userId = u.userId
|
||||
$condition
|
||||
""");
|
||||
if(!AuthUtil.hasRole("admin")){
|
||||
cnd.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.userId","not in",userId);
|
||||
cnd.andEX("db.teacherMeetId", "=", teacherMeetId);
|
||||
//只有正式代表才能推荐委员
|
||||
cnd.and("db.stateCode","=",300);
|
||||
cnd.andEX("zxwyh".equals(wylb) || "zmwyh".equals(wylb) ? "isJdh" : "isGdh", "=", 1);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = commissionerService.listMap(sql);
|
||||
|
||||
return AjaxResult.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getZwhInfo")
|
||||
@RequiresPermissions("election:recommend:commissioner")
|
||||
public AjaxResult getZwhInfo(){
|
||||
List<Jdh_jgsz> jdhJgszs = commissionerService.dao().query(Jdh_jgsz.class, Cnd.NEW());
|
||||
Jdh_jgsz zmwyh = jdhJgszs.stream().filter(v -> v.getName().contains("专门委员会")).collect(Collectors.toList()).stream().findFirst().orElse(null);
|
||||
List<Jdh_jgsz> jgszArrayList = new ArrayList<>();
|
||||
try {
|
||||
jdhJgszs.forEach(v -> {
|
||||
if (v.getParentId().equals(zmwyh.getId())){
|
||||
jgszArrayList.add(v);
|
||||
}
|
||||
});
|
||||
return AjaxResult.success(jgszArrayList);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
//执委会机构ID
|
||||
private static final String ZXWYH_ID = "d9e2ea079038467893ea040a9772fc9b";
|
||||
private static final String GHWYH_CODE = "gdhwyh1";
|
||||
|
||||
@PostMapping("/addCommission")
|
||||
@RequiresPermissions("election:recommend:commissioner")
|
||||
public AjaxResult addCommission(@RequestBody String[] userValue,@RequestParam String wylb,
|
||||
@RequestParam String teacherMeetId,@RequestParam(required = false)String zmwyhId){
|
||||
try {
|
||||
if (userValue.length == 0){
|
||||
return AjaxResult.error("请选择要推荐的委员!");
|
||||
}
|
||||
Sql sql = Sqls.create("select * from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("userId", "in", userValue);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userList = commissionerService.listMap(sql);
|
||||
|
||||
//教代会委员代表
|
||||
List<TeacherMeetCommission> commissionList = new ArrayList<>();
|
||||
//工代会组织机构成员
|
||||
List<OrganizationUser> organizationUserList = new ArrayList<>();
|
||||
//教代会组织机构成员
|
||||
List<Jdh_jgcy> jgcyList = new ArrayList<>();
|
||||
|
||||
|
||||
//工代会开启状态和字典表的工会委员会机构
|
||||
Session gdhOpenSession = commissionerService.dao().fetch(Session.class, Cnd.where("startState", "=", 1));
|
||||
List<SysDictData> dictList = remoteDictService.dictType("gdhwyh").getData();
|
||||
SysDictData gdhData = dictList.stream().filter(v -> v.getDictValue().equals(GHWYH_CODE)).collect(Collectors.toList()).stream().findFirst().orElse(null);
|
||||
|
||||
for (NutMap user : userList) {
|
||||
Jdh_jgcy jgcy = new Jdh_jgcy();
|
||||
jgcy.setUserId(user.getLong("userId"));
|
||||
jgcy.setJdhid(teacherMeetId);
|
||||
jgcy.setSf(1);
|
||||
|
||||
TeacherMeetCommission commission = new TeacherMeetCommission();
|
||||
commission.setUserId(user.getLong("userId"));
|
||||
commission.setTeacherMeetId(teacherMeetId);
|
||||
commission.setDelegationId(null);
|
||||
commission.setUserName(user.getString("userName"));
|
||||
commission.setLoginName(user.getString("loginName"));
|
||||
|
||||
if ("zxwyh".equals(wylb)) {
|
||||
commission.setIsJdh(true);
|
||||
//执委会委员id
|
||||
jgcy.setJgid(ZXWYH_ID);
|
||||
} else if ("ghwyh".equals(wylb)) {
|
||||
//工会委员会
|
||||
commission.setIsGdh(true);
|
||||
commission.setGdhId(gdhOpenSession.getId());
|
||||
|
||||
OrganizationUser organizationUser = new OrganizationUser();
|
||||
organizationUser.setUser_id(user.getLong("userId"));
|
||||
organizationUser.setStatus(0);
|
||||
organizationUser.setGdh_id(gdhOpenSession.getId());
|
||||
assert gdhData != null;
|
||||
organizationUser.setOrganization_code(GHWYH_CODE);
|
||||
organizationUser.setOrganization_id(gdhData.getDictCode().toString());
|
||||
organizationUser.setOrganization_name(gdhData.getDictLabel());
|
||||
organizationUserList.add(organizationUser);
|
||||
} else {
|
||||
//专门委员会
|
||||
commission.setIsZwh(true);
|
||||
commission.setZmwyhId(zmwyhId);
|
||||
jgcy.setJgid(zmwyhId);
|
||||
}
|
||||
commissionList.add(commission);
|
||||
jgcyList.add(jgcy);
|
||||
}
|
||||
|
||||
commissionerService.dao().insert(commissionList);
|
||||
if (!"ghwyh".equals(wylb)){
|
||||
commissionerService.dao().insert(jgcyList);
|
||||
}
|
||||
if (!organizationUserList.isEmpty()) {
|
||||
commissionerService.dao().insert(organizationUserList);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("election:recommend:commissioner")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
TeacherMeetCommission commission = dao.fetch(TeacherMeetCommission.class, Cnd.where("id", "=", id));
|
||||
int i = 0;
|
||||
if (commission.getIsJdh()!=null){
|
||||
i = dao.clear(Jdh_jgcy.class, Cnd.where("userId", "=", commission.getUserId()).and("jdhId", "=", commission.getTeacherMeetId()));
|
||||
}else if (commission.getIsGdh()!=null){
|
||||
i = dao.clear(OrganizationUser.class, Cnd.where("user_id","=",commission.getUserId()).and("gdh_id","=",commission.getGdhId()));
|
||||
}else if (commission.getIsZwh()!=null){
|
||||
i = dao.clear(Jdh_jgcy.class, Cnd.where("userId","=",commission.getUserId()).and("jgid","=",commission.getZmwyhId()));
|
||||
}
|
||||
int num = dao.clear(TeacherMeetCommission.class, Cnd.where("id", "=", id));
|
||||
return num+i > 1 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.ruoyi.jdh.controller.executiveCommittee;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeConfig;
|
||||
import com.ruoyi.jdh.service.executiveCommittee.ExecutiveCommitteeConfigService;
|
||||
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.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfigController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:30
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/executiveCommittee/executiveCommitteeConfig")
|
||||
public class ExecutiveCommitteeConfigController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
@Autowired
|
||||
private ExecutiveCommitteeConfigService committeeConfigService;
|
||||
|
||||
@RequestMapping("fetchConfig")
|
||||
@RequiresPermissions("jdh:executiveCommittee:executiveCommitteeConfig")
|
||||
public AjaxResult fetchConfig(@RequestParam(value = "jdhId", required = false) String jdhId) {
|
||||
ExecutiveCommitteeConfig config = committeeConfigService.fetch(Cnd.where("teacherMeetId", "=", jdhId));
|
||||
if(config == null) {
|
||||
config = new ExecutiveCommitteeConfig();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id as delegationId,
|
||||
dbtname as delegationName,
|
||||
code as delegationCode,
|
||||
(SELECT count( 1 ) FROM user where unionId IN ( SELECT fghid FROM jdh_dbt_zcfgh jbz WHERE jbz.dbtid = dbt.id ) and member = 1) as memberCount,
|
||||
0 as quotaCount
|
||||
FROM
|
||||
jdh_dbt dbt
|
||||
WHERE dbt.jdhId = @jdhId
|
||||
ORDER BY CODE ASC
|
||||
""").setParam("jdhId", jdhId);
|
||||
List<NutMap> listMap = committeeConfigService.listMap(sql);
|
||||
config.setDelegationQuotaList(listMap);
|
||||
}
|
||||
return AjaxResult.success(config);
|
||||
}
|
||||
|
||||
@RequestMapping("onHandle")
|
||||
@RequiresPermissions("jdh:executiveCommittee:executiveCommitteeConfig")
|
||||
public AjaxResult onHandle(@RequestBody ExecutiveCommitteeConfig config) {
|
||||
committeeConfigService.insertOrUpdate(config);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
package com.ruoyi.jdh.controller.executiveCommittee;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeConfig;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeOnePush;
|
||||
import com.ruoyi.jdh.service.election.ICommissionerService;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/6/20 16:08
|
||||
* @description 执委会推选
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/executiveCommittee/delegationOnePush")
|
||||
public class ExecutiveCommitteeDelegationOnePushController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private ICommissionerService commissionerService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationOnePush")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId,
|
||||
@RequestParam(value = "unionId", required = false) String unionId) {
|
||||
Jdh_db db = dao.fetch(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.and("dbid", "=", SecurityUtils.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return AjaxResult.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.dept_name AS unitName,
|
||||
t3.unionName,
|
||||
t4.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t4.birthday,
|
||||
CURDATE()) AS age
|
||||
FROM
|
||||
`executive_committee_one_push` t1
|
||||
LEFT JOIN dept t2 ON t1.unitId = t2.dept_id
|
||||
LEFT JOIN `union` t3 ON t3.id = t2.union_id
|
||||
LEFT JOIN `user` t4 ON t4.userId = t1.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.delegationId", "=", db.getDbtid());
|
||||
cnd.andEX("t3.id", "=", unionId);
|
||||
cnd.andEX("t1.addType", "=", 1);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("t1.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return AjaxResult.success(commissionerService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getDelegationUser")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationOnePush")
|
||||
public AjaxResult getDelegationUser(String teacherMeetId) {
|
||||
Jdh_db db = dao.fetch(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.and("dbid", "=", SecurityUtils.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return AjaxResult.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
List<ExecutiveCommitteeOnePush> userValue = dao.query(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 1));
|
||||
List<ExecutiveCommitteeOnePush> onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW());
|
||||
List<Long> userIds = onePushList.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("jdhid", "=", teacherMeetId);
|
||||
cnd.andEX("dbid", "not in", userIds);
|
||||
cnd.andEX("dbid", "!=", SecurityUtils.getUserId());
|
||||
cnd.and("dbtid", "=", db.getDbtid());
|
||||
Sql sql = Sqls.create("select * from jdh_db $condition");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = commissionerService.listMap(sql);
|
||||
return AjaxResult.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
@PostMapping("/addOnePush")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationOnePush")
|
||||
public AjaxResult addOnePush(@RequestBody Long[] userValue,
|
||||
@RequestParam String teacherMeetId) {
|
||||
try {
|
||||
Jdh_db db = dao.fetch(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.and("dbid", "=", SecurityUtils.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return AjaxResult.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return AjaxResult.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return AjaxResult.error("请等待预选开始时间");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return AjaxResult.error("预选已结束");
|
||||
}
|
||||
List<NutMap> delegationQuotaList = config.getDelegationQuotaList();
|
||||
|
||||
NutMap delegationQuota = delegationQuotaList.stream().filter(v -> v.getString("delegationId").equals(db.getDbtid())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(delegationQuota)) {
|
||||
return AjaxResult.error("请先配置代表团人数");
|
||||
}
|
||||
|
||||
int dbCount = dao.count(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("delegationId", "=", db.getDbtid())
|
||||
.and("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 1));
|
||||
if (dbCount + userValue.length > delegationQuota.getInt("quotaCount")) {
|
||||
return AjaxResult.error("代表团人数限报" + delegationQuota.getInt("quotaCount") + "人");
|
||||
}
|
||||
|
||||
List<Jdh_db> dbList = dao.query(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.andEX("dbid", "in", userValue));
|
||||
List<ExecutiveCommitteeOnePush> list = new ArrayList<>();
|
||||
for (Long id : userValue) {
|
||||
Jdh_db jdhDb = dbList.stream().filter(v -> v.getDbid().equals(id)).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jdhDb)) {
|
||||
return AjaxResult.error("请选择正确的代表!");
|
||||
}
|
||||
ExecutiveCommitteeOnePush onePush = new ExecutiveCommitteeOnePush();
|
||||
onePush.setPushDate(DateUtil.date());
|
||||
onePush.setUserId(jdhDb.getDbid());
|
||||
onePush.setUserName(jdhDb.getUserName());
|
||||
onePush.setLoginName(jdhDb.getLoginName());
|
||||
onePush.setJobTitle(jdhDb.getJobTitle());
|
||||
onePush.setJobTitleLevel(jdhDb.getJobTitleLevel());
|
||||
onePush.setDelegationId(jdhDb.getDbtid());
|
||||
onePush.setUnitId(jdhDb.getUnitId());
|
||||
onePush.setTeacherMeetId(teacherMeetId);
|
||||
String firstLetter = String.valueOf(getFirstLetter(jdhDb.getUserName()));
|
||||
onePush.setFirstLetter(firstLetter);
|
||||
onePush.setAddType(1);
|
||||
list.add(onePush);
|
||||
}
|
||||
dao.insert(list);
|
||||
return AjaxResult.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("添加失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationOnePush")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.NEW());
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return AjaxResult.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return AjaxResult.error(" 预选已结束不能删除!");
|
||||
}
|
||||
int num = dao.clear(ExecutiveCommitteeOnePush.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
public static char getFirstLetter(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
throw new IllegalArgumentException("字符串不能为空");
|
||||
}
|
||||
char firstChar = str.charAt(0);
|
||||
if (Validator.isChinese(String.valueOf(firstChar))) {
|
||||
return Character.toUpperCase(PinyinUtil.getPinyin(firstChar).charAt(0));
|
||||
} else if (Character.isLetter(firstChar)) {
|
||||
return Character.toUpperCase(firstChar);
|
||||
} else {
|
||||
return firstChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
package com.ruoyi.jdh.controller.executiveCommittee;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeConfig;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeOnePush;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeTwoPush;
|
||||
import com.ruoyi.jdh.service.election.ICommissionerService;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/6/23 15:25
|
||||
* @description 团长二次推选
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/executiveCommittee/delegationTwoPush")
|
||||
public class ExecutiveCommitteeDelegationTwoPushController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private ICommissionerService commissionerService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationTwoPush")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId,
|
||||
@RequestParam(value = "delegationId", required = false) String delegationId,
|
||||
@RequestParam(value = "unionId", required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.loginName,
|
||||
t2.userName,
|
||||
t2.jobTitle,
|
||||
t2.jobTitleLevel,
|
||||
t3.dept_name AS unitName,
|
||||
t4.unionName,
|
||||
t5.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t5.birthday,
|
||||
CURDATE()) AS age,
|
||||
t6.dbtname AS delegationName
|
||||
FROM
|
||||
`executive_committee_two_push` t1
|
||||
LEFT JOIN executive_committee_one_push t2 on t2.userId=t1.userId and t2.teacherMeetId=t1.teacherMeetId
|
||||
LEFT JOIN dept t3 ON t2.unitId = t3.dept_id
|
||||
LEFT JOIN `union` t4 ON t4.id = t3.union_id
|
||||
LEFT JOIN `user` t5 ON t5.userId = t1.userId
|
||||
LEFT JOIN jdh_dbt t6 ON t6.id = t2.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.pushUserId", "=", SecurityUtils.getUserId());
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t2.delegationId", "=", delegationId);
|
||||
cnd.andEX("t4.id", "=", unionId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("t6.code").asc("t2.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return AjaxResult.success(commissionerService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
@GetMapping("getDelegationUser")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationTwoPush")
|
||||
public AjaxResult getDelegationUser(String teacherMeetId) {
|
||||
|
||||
List<ExecutiveCommitteeTwoPush> userValue = dao.query(ExecutiveCommitteeTwoPush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("pushUserId", "=", SecurityUtils.getUserId()));
|
||||
List<Long> userIds = userValue.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.userId", "not in", userIds);
|
||||
cnd.andEX("t1.userId", "!=", SecurityUtils.getUserId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t2.birthday,
|
||||
CURDATE()) age
|
||||
FROM
|
||||
executive_committee_one_push t1
|
||||
LEFT JOIN `user` t2 ON t1.userId = t2.userId
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = commissionerService.listMap(sql);
|
||||
return AjaxResult.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
@PostMapping("/addOnePush")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationTwoPush")
|
||||
public AjaxResult addOnePush(@RequestBody Long[] userValue,
|
||||
@RequestParam String teacherMeetId) {
|
||||
try {
|
||||
Jdh_db db = dao.fetch(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.and("dbid", "=", SecurityUtils.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return AjaxResult.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return AjaxResult.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getSecondStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return AjaxResult.error("请等待二次预选开始时间");
|
||||
}
|
||||
if (config.getSecondEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return AjaxResult.error("二次预选已结束");
|
||||
}
|
||||
int dbCount = dao.count(ExecutiveCommitteeTwoPush.class,
|
||||
Cnd.where("pushUserId", "=", SecurityUtils.getUserId())
|
||||
.and("teacherMeetId", "=", teacherMeetId));
|
||||
if (dbCount + userValue.length > config.getCommitteeQuotaCount()) {
|
||||
return AjaxResult.error("人数限报" + config.getCommitteeQuotaCount() + "人");
|
||||
}
|
||||
|
||||
List<Jdh_db> dbList = dao.query(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.andEX("dbid", "in", userValue));
|
||||
List<ExecutiveCommitteeTwoPush> list = new ArrayList<>();
|
||||
for (Long id : userValue) {
|
||||
Jdh_db jdhDb = dbList.stream().filter(v -> v.getDbid().equals(id)).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jdhDb)) {
|
||||
return AjaxResult.error("请选择正确的代表!");
|
||||
}
|
||||
ExecutiveCommitteeTwoPush twoPush = new ExecutiveCommitteeTwoPush();
|
||||
twoPush.setPushDate(DateUtil.date());
|
||||
twoPush.setUserId(jdhDb.getDbid());
|
||||
twoPush.setPushDelegationId(jdhDb.getDbtid());
|
||||
twoPush.setPushUserId(SecurityUtils.getUserId());
|
||||
twoPush.setPushUserName(SecurityUtils.getNickName());
|
||||
twoPush.setPushLoginName(SecurityUtils.getUsername());
|
||||
twoPush.setTeacherMeetId(teacherMeetId);
|
||||
list.add(twoPush);
|
||||
}
|
||||
dao.insert(list);
|
||||
return AjaxResult.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("添加失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:executiveCommittee:delegationTwoPush")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.NEW());
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return AjaxResult.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getSecondEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return AjaxResult.error("预选已结束不能删除!");
|
||||
}
|
||||
int num = dao.clear(ExecutiveCommitteeTwoPush.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
package com.ruoyi.jdh.controller.executiveCommittee;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.service.executiveCommittee.ExecutiveCommitteeConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.Strings;
|
||||
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.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeMemberController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/23 14:57
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/executiveCommittee/executiveCommitteeMember")
|
||||
public class ExecutiveCommitteeMemberController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
@Autowired
|
||||
private ExecutiveCommitteeConfigService committeeConfigService;
|
||||
|
||||
@RequestMapping("pageData")
|
||||
@RequiresPermissions("jdh:executiveCommittee:executiveCommitteeMember")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(required = false) String jdhId,
|
||||
@RequestParam(required = false) String unitId,
|
||||
@RequestParam(required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
op.*,
|
||||
u.sex,
|
||||
u.deptName,
|
||||
u.unionName,
|
||||
u.mobile,
|
||||
dbt.dbtname as delegationName,
|
||||
( SELECT count( 1 ) FROM executive_committee_two_push tp WHERE tp.userId = op.userId ) as pushCount
|
||||
FROM
|
||||
executive_committee_one_push op
|
||||
left join user u on op.userId = u.userId
|
||||
left join jdh_dbt dbt on dbt.id = op.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("op.teacherMeetId", "=", jdhId);
|
||||
cnd.andEX("u.deptId", "=", unitId);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.desc("pushCount");
|
||||
cnd.asc("op.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = committeeConfigService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@RequestMapping("onView")
|
||||
@RequiresPermissions("jdh:executiveCommittee:executiveCommitteeMember")
|
||||
public AjaxResult onView(@RequestParam(required = false) String jdhId,
|
||||
@RequestParam(required = false) String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
tp.*,
|
||||
u.deptName,
|
||||
u.unionName,
|
||||
(case u.sex when 0 then '男' when 1 then '女' else '未知' end) as sex,
|
||||
u.mobile,
|
||||
dbt.dbtname as delegationName
|
||||
from
|
||||
executive_committee_two_push tp
|
||||
left join user u on u.userId = tp.pushUserId
|
||||
left join jdh_dbt dbt on dbt.id = tp.pushDelegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tp.teacherMeetId", "=", jdhId);
|
||||
cnd.and("tp.userId", "=", userId);
|
||||
cnd.desc("tp.pushDate");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = committeeConfigService.listMap(sql);
|
||||
return AjaxResult.success(listMap);
|
||||
}
|
||||
|
||||
@PostMapping("doExport")
|
||||
@RequiresPermissions("jdh:executiveCommittee:executiveCommitteeMember")
|
||||
public void doExport(@RequestBody PageForm pageForm,
|
||||
@RequestParam(required = false) String jdhId,
|
||||
@RequestParam(required = false) String unitId,
|
||||
@RequestParam(required = false) String unionId,
|
||||
HttpServletResponse response) {
|
||||
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
|
||||
Jdh_jdhxx jdhxx = dao.fetch(Jdh_jdhxx.class, jdhId);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
op.*,
|
||||
(case u.sex when 0 then '男' when 1 then '女' else '未知' end) as sex,
|
||||
u.deptName,
|
||||
u.unionName,
|
||||
u.mobile,
|
||||
dbt.dbtname as delegationName,
|
||||
( SELECT count( 1 ) FROM executive_committee_two_push tp WHERE tp.userId = op.userId ) as pushCount
|
||||
FROM
|
||||
executive_committee_one_push op
|
||||
left join user u on op.userId = u.userId
|
||||
left join jdh_dbt dbt on dbt.id = op.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("op.teacherMeetId", "=", jdhId);
|
||||
cnd.andEX("u.deptId", "=", unitId);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.desc("pushCount");
|
||||
cnd.asc("op.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> dataList = committeeConfigService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 10));
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 10));
|
||||
entities.add(new ExcelExportEntity("性别", "sex", 10));
|
||||
entities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("所属单位", "deptName", 20));
|
||||
entities.add(new ExcelExportEntity("所属代表团", "delegationName", 20));
|
||||
entities.add(new ExcelExportEntity("票数", "pushCount", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, dataList);
|
||||
response.setContentType("application/octet-stream");
|
||||
String fileName = jdhxx.getJdhallname() + "委员会预选名单";
|
||||
response.setHeader("Content-Disposition", "attachment;filename=%s".formatted(URLEncoder.encode(fileName + ".xlsx", StandardCharsets.UTF_8)));
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
package com.ruoyi.jdh.controller.executiveCommittee;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeConfig;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeOnePush;
|
||||
import com.ruoyi.jdh.service.election.ICommissionerService;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/6/23 13:49
|
||||
* @description 执委会推选
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/executiveCommittee/push")
|
||||
public class ExecutiveCommitteePushController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private ICommissionerService commissionerService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:executiveCommittee:push")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "teacherMeetId", required = false) String teacherMeetId,
|
||||
@RequestParam(value = "delegationId", required = false) String delegationId,
|
||||
@RequestParam(value = "unionId", required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.dept_name AS unitName,
|
||||
t3.unionName,
|
||||
t4.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t4.birthday,
|
||||
CURDATE()) AS age,
|
||||
t5.dbtname AS delegationName
|
||||
FROM
|
||||
`executive_committee_one_push` t1
|
||||
LEFT JOIN dept t2 ON t1.unitId = t2.dept_id
|
||||
LEFT JOIN `union` t3 ON t3.id = t2.union_id
|
||||
LEFT JOIN `user` t4 ON t4.userId = t1.userId
|
||||
LEFT JOIN jdh_dbt t5 ON t5.id = t1.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.delegationId", "=", delegationId);
|
||||
cnd.andEX("t3.id", "=", unionId);
|
||||
cnd.andEX("t1.addType", "=", 2);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("t5.code").asc("t1.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return AjaxResult.success(commissionerService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getDelegationUser")
|
||||
@RequiresPermissions("jdh:executiveCommittee:push")
|
||||
public AjaxResult getDelegationUser(String teacherMeetId) {
|
||||
List<ExecutiveCommitteeOnePush> userValue = dao.query(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 2));
|
||||
List<ExecutiveCommitteeOnePush> onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW());
|
||||
List<Long> userIds = onePushList.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("jdhid", "=", teacherMeetId);
|
||||
cnd.andEX("dbid", "not in", userIds);
|
||||
cnd.andEX("dbid", "!=", SecurityUtils.getUserId());
|
||||
Sql sql = Sqls.create("select * from jdh_db $condition");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = commissionerService.listMap(sql);
|
||||
return AjaxResult.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
@PostMapping("/addOnePush")
|
||||
@RequiresPermissions("jdh:executiveCommittee:push")
|
||||
public AjaxResult addOnePush(@RequestBody Long[] userValue,
|
||||
@RequestParam String teacherMeetId) {
|
||||
try {
|
||||
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return AjaxResult.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return AjaxResult.error("请等待一次预选开始时间");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return AjaxResult.error("一次预选已结束");
|
||||
}
|
||||
|
||||
int dbCount = dao.count(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 2));
|
||||
if (dbCount + userValue.length > config.getPrepareGroupQuotaCount()) {
|
||||
return AjaxResult.error("人数限报" + config.getPrepareGroupQuotaCount() + "人");
|
||||
}
|
||||
|
||||
List<Jdh_db> dbList = dao.query(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId)
|
||||
.andEX("dbid", "in", userValue));
|
||||
List<ExecutiveCommitteeOnePush> list = new ArrayList<>();
|
||||
for (Long id : userValue) {
|
||||
Jdh_db jdhDb = dbList.stream().filter(v -> v.getDbid().equals(id)).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jdhDb)) {
|
||||
return AjaxResult.error("请选择正确的代表!");
|
||||
}
|
||||
ExecutiveCommitteeOnePush onePush = new ExecutiveCommitteeOnePush();
|
||||
onePush.setPushDate(DateUtil.date());
|
||||
onePush.setUserId(jdhDb.getDbid());
|
||||
onePush.setUserName(jdhDb.getUserName());
|
||||
onePush.setLoginName(jdhDb.getLoginName());
|
||||
onePush.setJobTitle(jdhDb.getJobTitle());
|
||||
onePush.setJobTitleLevel(jdhDb.getJobTitleLevel());
|
||||
onePush.setDelegationId(jdhDb.getDbtid());
|
||||
onePush.setUnitId(jdhDb.getUnitId());
|
||||
onePush.setTeacherMeetId(teacherMeetId);
|
||||
String firstLetter = String.valueOf(getFirstLetter(jdhDb.getUserName()));
|
||||
onePush.setFirstLetter(firstLetter);
|
||||
onePush.setAddType(2);
|
||||
list.add(onePush);
|
||||
}
|
||||
dao.insert(list);
|
||||
return AjaxResult.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("添加失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:executiveCommittee:push")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.NEW());
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return AjaxResult.error("请先配置基础信息");
|
||||
}
|
||||
int num = dao.clear(ExecutiveCommitteeOnePush.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
public static char getFirstLetter(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
throw new IllegalArgumentException("字符串不能为空");
|
||||
}
|
||||
char firstChar = str.charAt(0);
|
||||
if (Validator.isChinese(String.valueOf(firstChar))) {
|
||||
return Character.toUpperCase(PinyinUtil.getPinyin(firstChar).charAt(0));
|
||||
} else if (Character.isLetter(firstChar)) {
|
||||
return Character.toUpperCase(firstChar);
|
||||
} else {
|
||||
return firstChar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.jdh.controller.executiveCommittee;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeQuota
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 16:12
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class ExecutiveCommitteeQuota {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属教代会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String teacherMeetId;
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
package com.ruoyi.jdh.controller.mechanism;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.election.TeacherMeetCommission;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgcy;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgsz;
|
||||
import com.ruoyi.jdh.service.JdhOrganizationService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description 教代会组织机构
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/organization")
|
||||
public class JdhOrganizationController {
|
||||
|
||||
private JdhOrganizationService jdhOrganizationService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
@Autowired
|
||||
public JdhOrganizationController(JdhOrganizationService jdhOrganizationService) {
|
||||
this.jdhOrganizationService = jdhOrganizationService;
|
||||
}
|
||||
|
||||
@GetMapping("getTreeData")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult getTreeData() {
|
||||
List<Jdh_jgsz> treeData = jdhOrganizationService.getTreeData();
|
||||
return AjaxResult.success(treeData);
|
||||
}
|
||||
|
||||
@RequestMapping("pageData")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "parentId", required = false) String parentId,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
Pagination pagination = jdhOrganizationService.pageData(pageForm, parentId, jdhid);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doHandle")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult doHandle(@RequestBody Jdh_jgsz jdh_jgsz) {
|
||||
if (StringUtils.isBlank(jdh_jgsz.getId())) {
|
||||
Boolean addResult = jdhOrganizationService.doAdd(jdh_jgsz);
|
||||
return addResult ? AjaxResult.success() : AjaxResult.error();
|
||||
} else {
|
||||
Boolean editResult = jdhOrganizationService.doEdit(jdh_jgsz);
|
||||
return editResult ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
Boolean result = jdhOrganizationService.doDelete(id);
|
||||
return result ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("cyPageData")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult cyPageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "jgid", required = false) String jgid) {
|
||||
Pagination pagination = jdhOrganizationService.cyPageData(pageForm, jdhid, jgid);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doSaveCy")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult doSaveCy(@RequestBody Jdh_jgcy jdh_jgcy) {
|
||||
Boolean result = jdhOrganizationService.doSaveCy(jdh_jgcy);
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(jdh_jgcy.getUserId());
|
||||
userRole.setRoleId(jdh_jgcy.getRoleId());
|
||||
userRole.setJdhid(jdh_jgcy.getJdhid());
|
||||
userRole.setJgid(jdh_jgcy.getJgid());
|
||||
R<Boolean> booleanR = remoteUserRoleService.addUserRole(userRole);
|
||||
return result && booleanR.getCode() == R.SUCCESS ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("doDeleteCy")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult doDeleteCy(@RequestBody Jdh_jgcy jdh_jgcy) {
|
||||
//删除委员
|
||||
Boolean result = jdhOrganizationService.doDeleteCy(jdh_jgcy);
|
||||
//删除角色表数据
|
||||
List<FeignCnd> feignCnds = List.of(
|
||||
new FeignCnd("role_id", "=", jdh_jgcy.getRoleId()),
|
||||
new FeignCnd("user_id", "=", jdh_jgcy.getUserId()),
|
||||
new FeignCnd("jdhid", "=", jdh_jgcy.getJdhid()),
|
||||
new FeignCnd("jgid", "=", jdh_jgcy.getJgid())
|
||||
);
|
||||
R<Boolean> booleanR = remoteUserRoleService.delUserRole(feignCnds);
|
||||
return result && booleanR.getCode() == R.SUCCESS ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("updateSf")
|
||||
@RequiresPermissions("jdh:mechanism:organization")
|
||||
public AjaxResult updateSf(@RequestBody Jdh_jgcy jdh_jgcy, @RequestParam long newRoleId) {
|
||||
|
||||
//删除角色表中的旧角色
|
||||
List<FeignCnd> feignCnds = List.of(
|
||||
new FeignCnd("role_id", "=", jdh_jgcy.getRoleId()),
|
||||
new FeignCnd("user_id", "=", jdh_jgcy.getUserId()),
|
||||
new FeignCnd("jdhid", "=", jdh_jgcy.getJdhid()),
|
||||
new FeignCnd("jgid", "=", jdh_jgcy.getJgid())
|
||||
);
|
||||
remoteUserRoleService.delUserRole(feignCnds);
|
||||
|
||||
//修改成员表信息
|
||||
Boolean result = jdhOrganizationService.updateSf(jdh_jgcy, newRoleId);
|
||||
jdhOrganizationService.dao().update(TeacherMeetCommission.class, Chain.make("stateCode",100), Cnd.where("userId","=",jdh_jgcy.getUserId()).and("teacherMeetId","=",jdh_jgcy.getJdhid()));
|
||||
|
||||
//再添加新角色
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(jdh_jgcy.getUserId());
|
||||
userRole.setRoleId(newRoleId);
|
||||
userRole.setJdhid(jdh_jgcy.getJdhid());
|
||||
userRole.setJgid(jdh_jgcy.getJgid());
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
return result ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
package com.ruoyi.jdh.controller.meetingActivity;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.meetingActivity.Jdh_hyhd;
|
||||
import com.ruoyi.jdh.service.MeetingActivityManageService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/25
|
||||
* @Description 会议活动
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/meetingActivity")
|
||||
public class MeetingActivityManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
private MeetingActivityManageService meetingActivityManageService;
|
||||
|
||||
@Autowired
|
||||
public MeetingActivityManageController(MeetingActivityManageService meetingActivityManageService) {
|
||||
this.meetingActivityManageService = meetingActivityManageService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "lx", required = false) Integer lx) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
hyhd.*,
|
||||
jdh.jdhallname
|
||||
FROM
|
||||
jdh_hyhd hyhd
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = hyhd.jdhid
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(jdhid)) {
|
||||
cnd.and("hyhd.jdhid", "=", jdhid);
|
||||
}
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.and("name", "like", "%" + name + "%");
|
||||
}
|
||||
if (lx != null) {
|
||||
cnd.and("lx", "=", lx);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = meetingActivityManageService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doHandle")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult doHandle(@RequestBody Jdh_hyhd hyhd) {
|
||||
//新增
|
||||
if (StringUtils.isBlank(hyhd.getId())) {
|
||||
String id = R.UU32();
|
||||
hyhd.setId(id);
|
||||
hyhd.setUserid(SecurityUtils.getUserId());
|
||||
dao.insert(Jdh_hyhd.class, Chain.from(hyhd));
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
//编辑
|
||||
dao.update("jdh_hyhd", Chain.from(hyhd), Cnd.where("id", "=", hyhd.getId()));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("findOne/{id}")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult findOne(@PathVariable String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
hyhd.*,
|
||||
jdh.jdhallname,
|
||||
u.userName as username
|
||||
FROM
|
||||
jdh_hyhd hyhd
|
||||
LEFT JOIN `user` u ON u.userId = hyhd.userid
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = hyhd.jdhid
|
||||
WHERE
|
||||
hyhd.id = @hyhdid
|
||||
""");
|
||||
sql.setParam("hyhdid", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
return AjaxResult.success(sql.getResult());
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
dao.clear("jdh_hyhd", Cnd.where("id", "=", id));
|
||||
dao.clear("jdh_hyhd_cy", Cnd.where("hyhdid", "=", id));
|
||||
//TODO:后续这里需要增加删除文件服务器的代码
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("userData/{id}")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult userData(@PathVariable String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId as id,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.deptName as dwname
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
u.userId IN ( SELECT userid FROM jdh_hyhd_cy WHERE hyhdid = @hyhdid )
|
||||
""");
|
||||
sql.setParam("hyhdid", id);
|
||||
List list = meetingActivityManageService.list(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("queryUser")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult queryUser(String query, String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId as id,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.deptName as dwname
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
u.userId NOT IN ( SELECT userid FROM jdh_hyhd_cy WHERE hyhdid = @hyhdid )
|
||||
AND ( u.userName LIKE @keyword OR u.loginName LIKE @keyword )
|
||||
""");
|
||||
sql.setParam("hyhdid", id);
|
||||
sql.setParam("keyword", "%" + query + "%");
|
||||
List<Object> list = meetingActivityManageService.listPage(1, 10, sql).getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("doAddUser")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult doAddUser(String id, String userid) {
|
||||
Chain chain = Chain.make("id", R.UU32()).add("userid", userid).add("hyhdid", id);
|
||||
dao.insert("jdh_hyhd_cy", chain);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doDeleteUser")
|
||||
@RequiresPermissions("jdh:meetingActivity:manage")
|
||||
public AjaxResult doDeleteUser(String id, String userid) {
|
||||
dao.clear("jdh_hyhd_cy", Cnd.where("hyhdid", "=", id).and("userid", "=", userid));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.ruoyi.jdh.controller.meetingData;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.workData.Jdh_gzzllx;
|
||||
import com.ruoyi.jdh.service.WorkDataTypeService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/26
|
||||
* @Description 工作资料类型
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/meetingData/workDataType")
|
||||
public class WorkDataTypeController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
private WorkDataTypeService workDataTypeService;
|
||||
|
||||
@Autowired
|
||||
public WorkDataTypeController(WorkDataTypeService workDataTypeService) {
|
||||
this.workDataTypeService = workDataTypeService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:meetingData:workDataType")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "lxname", required = false) String lxname,
|
||||
@RequestParam(value = "jdzllxhcs", required = false) String jdzllxhcs
|
||||
) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(lxname)) {
|
||||
cnd.and("lxname", "like", "%" + lxname + "%");
|
||||
}
|
||||
cnd.andEX("zllx", "=", jdzllxhcs);
|
||||
cnd.asc("xh");
|
||||
Pagination pagination = workDataTypeService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), "jdh_gzzllx", cnd);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("jdh:meetingData:workDataType")
|
||||
public AjaxResult doAdd(@RequestBody Jdh_gzzllx gzzllx) {
|
||||
int count = dao.count("jdh_gzzllx", Cnd.where("code", "=", gzzllx.getCode()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("编码重复!");
|
||||
}
|
||||
gzzllx.setId(R.UU32());
|
||||
int totalCount = dao.count("jdh_gzzllx");
|
||||
gzzllx.setXh(totalCount + 1);
|
||||
dao.insert("jdh_gzzllx", Chain.from(gzzllx));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doEdit")
|
||||
@RequiresPermissions("jdh:meetingData:workDataType")
|
||||
public AjaxResult doEdit(@RequestBody Jdh_gzzllx gzzllx) {
|
||||
int count = dao.count("jdh_gzzllx", Cnd.where("code", "=", gzzllx.getCode()).and("id", "!=", gzzllx.getId()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("编码重复");
|
||||
}
|
||||
dao.update("jdh_gzzllx", Chain.from(gzzllx), Cnd.where("id", "=", gzzllx.getId()));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("jdh:meetingData:workDataType")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
dao.clear("jdh_gzzllx", Cnd.where("id", "=", id));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("rowChange")
|
||||
@RequiresPermissions("jdh:meetingData:workDataType")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult rowChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
Record next = dao.fetch("jdh_gzzllx", Cnd.where("xh", "=", xh + 1));
|
||||
next.set("xh", next.getInt("xh") - 1);
|
||||
dao.update("jdh_gzzllx", Chain.from(next), Cnd.where("id", "=", next.getString("id")));
|
||||
dao.update("jdh_gzzllx", Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
|
||||
} else {
|
||||
Record pre = dao.fetch("jdh_gzzllx", Cnd.where("xh", "=", xh - 1));
|
||||
pre.set("xh", pre.getInt("xh") + 1);
|
||||
dao.update("jdh_gzzllx", Chain.from(pre), Cnd.where("id", "=", pre.getString("id")));
|
||||
dao.update("jdh_gzzllx", Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.ruoyi.jdh.controller.prepare;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_cbwj;
|
||||
import com.ruoyi.jdh.service.JdhPrepareService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description 教代会筹备文件
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/prepareFile")
|
||||
public class JdhPrepareFileController {
|
||||
|
||||
private JdhPrepareService jdhPrepareService;
|
||||
|
||||
@Autowired
|
||||
public JdhPrepareFileController(JdhPrepareService jdhPrepareService) {
|
||||
this.jdhPrepareService = jdhPrepareService;
|
||||
}
|
||||
|
||||
@RequestMapping("/pageData")
|
||||
@RequiresPermissions("jdh:prepare:prepareFile")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "zlname", required = false) String zlname,
|
||||
@RequestParam(value = "union_id", required = false) String union_id,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "zllx", required = false) String zllx) {
|
||||
Pagination pagination = jdhPrepareService.prepareFilePageData(pageForm, zlname, union_id, jdhid, zllx);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("/doHandle")
|
||||
@RequiresPermissions("jdh:prepare:prepareFile")
|
||||
public AjaxResult doHandle(@RequestBody Jdh_cbwj jdh_cbwj) {
|
||||
if (StringUtils.isBlank(jdh_cbwj.getId())) {
|
||||
//新增
|
||||
Boolean addResult = jdhPrepareService.prepareFileAdd(jdh_cbwj);
|
||||
return addResult ? AjaxResult.success() : AjaxResult.error();
|
||||
} else {
|
||||
//编辑
|
||||
Boolean editResult = jdhPrepareService.prepareFileEdit(jdh_cbwj);
|
||||
return editResult ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("doDelete")
|
||||
@RequiresPermissions("jdh:prepare:prepareFile")
|
||||
public AjaxResult doDelete(@RequestParam("id") String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return AjaxResult.error("id不能为空!");
|
||||
}
|
||||
Boolean result = jdhPrepareService.prepareFileDoDelete(id);
|
||||
//TODO:后续这里需要增加删除文件服务器的代码
|
||||
return result ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
package com.ruoyi.jdh.controller.prepare;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_mefp;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_lxty_db;
|
||||
import com.ruoyi.jdh.domain.vo.UnionLimitVo;
|
||||
import com.ruoyi.jdh.service.prepare.IJdhQuotaAllocationService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:JdhMefpController
|
||||
* @Date 2024/5/16 9:10
|
||||
* @注释
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/prepare/quotaAllocation")
|
||||
@Slf4j
|
||||
public class JdhQuotaAllocationController {
|
||||
|
||||
@Autowired
|
||||
private IJdhQuotaAllocationService jdhQuotaAllocationService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult pageData(@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "unionId", required = false) String unionId) {
|
||||
return AjaxResult.success(jdhQuotaAllocationService.getData(jdhid, unionId));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("doMefp")
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult doMefp(@RequestBody Jdh_mefp mefp) {
|
||||
try {
|
||||
int count = jdhQuotaAllocationService.count("jdh_mefp", Cnd.where("jdhid", "=", mefp.getJdhid())
|
||||
.and("fghid", "=", mefp.getFghid()));
|
||||
if (count == 0) {
|
||||
//没有分配过
|
||||
mefp.setId(R.UU32());
|
||||
jdhQuotaAllocationService.insert("jdh_mefp", Chain.from(mefp));
|
||||
} else {
|
||||
//进行修改
|
||||
Chain upChain = Chain.make("fps", mefp.getFps());
|
||||
jdhQuotaAllocationService.update("jdh_mefp", upChain, Cnd.where("jdhid", "=", mefp.getJdhid())
|
||||
.and("fghid", "=", mefp.getFghid()));
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询该代表团下的列席特邀代表
|
||||
*
|
||||
* @param fghid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("lxtydbPgaeData")
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult lxtydbPgaeData(@RequestParam(value = "fghid", required = false) String fghid,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
return AjaxResult.success(jdhQuotaAllocationService.lxtydbPgaeData(fghid, jdhid));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询本届没有被设置为列席特邀或者是正式代表的用户
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("queryNolxtyDb")
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult queryNolxtyDb(@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "keyword", required = false) String keyword) {
|
||||
return AjaxResult.success(jdhQuotaAllocationService.queryNolxtyDb(jdhid, keyword));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列席特邀代表添加
|
||||
*
|
||||
* @param db
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("doAddLxTyDb")
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult doAddLxTyDb(@RequestBody Jdh_lxty_db db,
|
||||
@RequestParam(value = "lx", required = false) Integer lx) {
|
||||
jdhQuotaAllocationService.doAddLxTyDb(db, lx);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("delLxtyDb")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult delLxtyDb(String dbid, String jdhid) {
|
||||
try {
|
||||
jdhQuotaAllocationService.dao().clear(Jdh_db.class, Cnd.where("dbid", "=", dbid).and("jdhid", "=", jdhid));
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", dbid),
|
||||
new FeignCnd("jdhid", "=", jdhid)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getUnionLimit")
|
||||
@RequiresPermissions("jdh:prepare:quotaAllocation")
|
||||
public AjaxResult getUnionLimit(String sessionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id AS fghid,
|
||||
gh.unionName AS unionname,
|
||||
gh.unionCode AS unioncode,
|
||||
(SELECT count(1) FROM `user` WHERE unionId = gh.id AND member = 1) AS teacherCount,
|
||||
t2.jdhid,
|
||||
t2.fps,
|
||||
t2.quota,
|
||||
t2.ratio,
|
||||
t2.seniorTeaNum,
|
||||
t2.ordinaryTeaNum,
|
||||
t2.femaleNum,
|
||||
t2.less45Num
|
||||
FROM
|
||||
`union` gh
|
||||
left join jdh_mefp t2 on t2.fghid = gh.id and t2.jdhid = @sessionId
|
||||
ORDER BY
|
||||
gh.unionCode
|
||||
""");
|
||||
sql.setParam("sessionId", sessionId);
|
||||
List<NutMap> nutMaps = jdhQuotaAllocationService.listMap(sql);
|
||||
return AjaxResult.success(nutMaps);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("doQuotaAllocation")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public AjaxResult doQuotaAllocation(@RequestBody List<Jdh_mefp> mefpList,
|
||||
@RequestParam(value = "teacherMeetId") String teacherMeetId) {
|
||||
try {
|
||||
jdhQuotaAllocationService.dao().clear(Jdh_mefp.class, Cnd.where("jdhid", "=", teacherMeetId));
|
||||
for (Jdh_mefp mefp : mefpList) {
|
||||
mefp.setJdhid(teacherMeetId);
|
||||
mefp.setFps(mefp.getQuota());
|
||||
}
|
||||
jdhQuotaAllocationService.dao().insert(mefpList);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.ruoyi.jdh.controller.prepare;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.service.JdhPrepareService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/15
|
||||
* @Description 教代会届次管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/prepare")
|
||||
public class JdhSessionManageController {
|
||||
|
||||
private JdhPrepareService jdhPrepareService;
|
||||
|
||||
@Autowired
|
||||
public JdhSessionManageController(JdhPrepareService jdhPrepareService) {
|
||||
this.jdhPrepareService = jdhPrepareService;
|
||||
}
|
||||
|
||||
@RequestMapping("/pageData")
|
||||
@RequiresPermissions("jdh:prepare:sessionManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "searchYear", required = false) String searchYear,
|
||||
@RequestParam(value = "jdhjs", required = false) String jdhjs,
|
||||
@RequestParam(value = "jdhcs", required = false) String jdhcs) {
|
||||
Pagination pagination = jdhPrepareService.pageData(pageForm, searchYear, jdhjs, jdhcs);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("/jdhztChange")
|
||||
@RequiresPermissions("jdh:prepare:sessionManage")
|
||||
public AjaxResult jdhztChange(String id, boolean status) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return AjaxResult.error("教代会id不能为空!");
|
||||
}
|
||||
Boolean result = jdhPrepareService.jdhztChange(id, status);
|
||||
return result ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("/doHandle")
|
||||
@RequiresPermissions("jdh:prepare:sessionManage")
|
||||
public AjaxResult doHandle(@RequestBody Jdh_jdhxx jdhxx, @RequestParam("isExtend") Boolean isExtend) {
|
||||
if (StringUtils.isBlank(jdhxx.getId())) {
|
||||
//查询教代会是否存在
|
||||
Boolean isExist = jdhPrepareService.jdhIsExist(jdhxx);
|
||||
if (isExist) {
|
||||
return AjaxResult.error("当前届次的教代会已存在,无法重复创建!");
|
||||
}
|
||||
//新增
|
||||
Boolean addResult = jdhPrepareService.doAdd(jdhxx, isExtend);
|
||||
return addResult ? AjaxResult.success() : AjaxResult.error();
|
||||
} else {
|
||||
//编辑
|
||||
Boolean editResult = jdhPrepareService.doEdit(jdhxx);
|
||||
return editResult ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("doDelete")
|
||||
@RequiresPermissions("jdh:prepare:sessionManage")
|
||||
public AjaxResult doDelete(@RequestParam("id") String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return AjaxResult.error("教代会id不能为空!");
|
||||
}
|
||||
Boolean result = jdhPrepareService.doDelete(id);
|
||||
return result ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
package com.ruoyi.jdh.controller.queryStatistics;
|
||||
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.service.JdhCommonService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/26
|
||||
* @Description 教代会数据总览
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/queryStatistics/dataScreening")
|
||||
public class DataScreeningController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private JdhCommonService jdhCommonService;
|
||||
|
||||
@PostMapping("getData")
|
||||
@RequiresPermissions("jdh:queryStatistics:dataScreening")
|
||||
public AjaxResult getData(String jdhid) {
|
||||
NutMap res = NutMap.NEW();
|
||||
|
||||
Cnd cnd = Cnd.where("jdhid", "=", jdhid);
|
||||
Cnd cbldxz = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "7c3be7fd3d7e4eb2b7fb7b0cb565c02c");
|
||||
Cnd zgscxz = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "579ea46651c2496b98d3f46a7da36b47");
|
||||
Cnd zxt = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "61d0177e63c14f41953532ad757bea29");
|
||||
Cnd zxwyh = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "d9e2ea079038467893ea040a9772fc9b");
|
||||
Cnd zmwyh = Cnd.where(new Static("jdhid='" + jdhid + "' and jgid in (select id from jdh_jgsz where parentId='84519c3978404af89147c42f19e9c5d8')"));
|
||||
|
||||
res.setv("jdhxx", dao.fetch("jdh_jdhxx", Cnd.where("id", "=", jdhid)));
|
||||
|
||||
res.setv("cbldxz", dao.count("jdh_jgcy", cbldxz));
|
||||
|
||||
res.setv("zgscxz", dao.count("jdh_jgcy", zgscxz));
|
||||
|
||||
res.setv("zxt", dao.count("jdh_jgcy", zxt));
|
||||
|
||||
res.setv("zxwyh", dao.count("jdh_jgcy", zxwyh));
|
||||
|
||||
res.setv("db", dao.count("jdh_db", Cnd.where("jdhid", "=", jdhid).and("dbzt", "=", 2)));
|
||||
|
||||
res.setv("dbt", dao.count("jdh_dbt", cnd));
|
||||
|
||||
res.setv("zmwyh", dao.count("jdh_jgcy", zmwyh));
|
||||
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
@PostMapping("cbldxz")
|
||||
@RequiresPermissions("jdh:queryStatistics:dataScreening")
|
||||
public AjaxResult cbldxz(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
|
||||
Pagination userData = getUserData(pageForm, jdhid, "7c3be7fd3d7e4eb2b7fb7b0cb565c02c");
|
||||
return AjaxResult.success(userData);
|
||||
}
|
||||
|
||||
@PostMapping("zgscxz")
|
||||
@RequiresPermissions("jdh:queryStatistics:dataScreening")
|
||||
public AjaxResult zgscxz(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
|
||||
Pagination userData = getUserData(pageForm, jdhid, "579ea46651c2496b98d3f46a7da36b47");
|
||||
return AjaxResult.success(userData);
|
||||
}
|
||||
|
||||
@PostMapping("zxt")
|
||||
@RequiresPermissions("jdh:queryStatistics:dataScreening")
|
||||
public AjaxResult zxt(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
|
||||
Pagination userData = getUserData(pageForm, jdhid, "61d0177e63c14f41953532ad757bea29");
|
||||
return AjaxResult.success(userData);
|
||||
}
|
||||
|
||||
@PostMapping("zxwyh")
|
||||
@RequiresPermissions("jdh:queryStatistics:dataScreening")
|
||||
public AjaxResult zxwyh(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
|
||||
Pagination userData = getUserData(pageForm, jdhid, "d9e2ea079038467893ea040a9772fc9b");
|
||||
return AjaxResult.success(userData);
|
||||
}
|
||||
|
||||
@PostMapping("zmwyh")
|
||||
@RequiresPermissions("jdh:queryStatistics:dataScreening")
|
||||
public AjaxResult zmwyh(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sz.id,
|
||||
sz.mcid,
|
||||
sz.NAME AS wyhname,
|
||||
sz.bz gzzz,
|
||||
sz.jdhid,
|
||||
(SELECT GROUP_CONCAT( userName, mobile ) FROM `user` WHERE userId IN ( SELECT userid FROM jdh_jgcy WHERE jgid = sz.id AND sf = 3 and jdhid=@jdhid) ) as zrmobile
|
||||
FROM
|
||||
jdh_jgsz sz
|
||||
WHERE
|
||||
sz.parentId = @parentId
|
||||
""");
|
||||
sql.setParam("jdhid", jdhid);
|
||||
sql.setParam("parentId", "84519c3978404af89147c42f19e9c5d8");
|
||||
Pagination pagination = jdhCommonService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@GetMapping("sjkb")
|
||||
public AjaxResult sjkb(String jdhid) {
|
||||
Sql sqldb = Sqls.create("select\n" +
|
||||
"(SELECT count(1) FROM jdh_db where roleid = @zsdbroleid and jdhid = @jdhid) as 正式代表,\n" +
|
||||
"(select count(1) from jdh_db where roleid = @lxdbroleid and jdhid = @jdhid) as 列席代表,\n" +
|
||||
"(select count(1) from jdh_db where roleid = @tydbroleid and jdhid = @jdhid) as 特邀代表,\n" +
|
||||
"(SELECT count(1) FROM jdh_db db left join `user` u on u.userId = db.dbid where db.roleid is not null and u.sex = '1' and jdhid = @jdhid) as 女教师代表,\n" +
|
||||
"(SELECT count(1) FROM jdh_db db left join `user` u on u.userId = db.dbid where db.roleid is not null and u.nation != '01' and jdhid = @jdhid) as 少数民族代表");
|
||||
sqldb.setParam("jdhid", jdhid);
|
||||
sqldb.setParam("lxdbroleid", Roles.LXDB)
|
||||
.setParam("zsdbroleid", Roles.ZSDB)
|
||||
.setParam("tydbroleid", Roles.TYDB);
|
||||
Object o = jdhCommonService.list(sqldb).get(0);
|
||||
|
||||
|
||||
Sql sqldbt = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,
|
||||
dbt.dbtname delegationName,
|
||||
dbt.`code` delegationCode,
|
||||
( SELECT count( 1 ) FROM jdh_db WHERE dbtid = dbt.id ) AS num
|
||||
FROM
|
||||
jdh_dbt dbt
|
||||
WHERE
|
||||
dbt.jdhid = @jdhid
|
||||
ORDER BY
|
||||
dbt.`code`
|
||||
""").setParam("jdhid", jdhid);
|
||||
List<NutMap> dbtlist = jdhCommonService.listMap(sqldbt);
|
||||
|
||||
Sql sqlhyhd = Sqls.create("select * from jdh_hyhd where jdhid = @jdhid").setParam("jdhid", jdhid);
|
||||
List hyhdlist = jdhCommonService.list(sqlhyhd);
|
||||
|
||||
NutMap addv = NutMap.NEW().addv("db", o).addv("dbt", dbtlist).addv("hyhd", hyhdlist);
|
||||
return AjaxResult.success(addv);
|
||||
}
|
||||
|
||||
public Pagination getUserData(PageForm pageForm, String jdhid, String jgid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cy.id,
|
||||
cy.userid,
|
||||
cy.sf,
|
||||
u.loginName as loginname,
|
||||
u.userName as username,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.nation mz,
|
||||
u.education xl,
|
||||
u.political zzmm,
|
||||
u.position zc,
|
||||
u.jobTitle zw,
|
||||
u.email,
|
||||
u.mobile,
|
||||
u.deptName AS dwname,
|
||||
u.unionName as unionname,
|
||||
jdh.id as jdhid,
|
||||
jdh.jdhallname
|
||||
FROM
|
||||
jdh_jgcy cy
|
||||
LEFT JOIN `user` u ON u.userId = cy.userid
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = cy.jdhid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.desc("jdh.jdhkqsj").desc("cy.sf");
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(jdhid)) {
|
||||
cnd.and("cy.jdhid", "=", jdhid);
|
||||
}
|
||||
cnd.and("cy.jgid", "=", jgid);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = jdhCommonService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package com.ruoyi.jdh.controller.queryStatistics;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.service.JdhCommonService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/26
|
||||
* @Description 教代会代表统计
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/queryStatistics/deputyStatistics")
|
||||
public class DeputyStatisticsController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private JdhCommonService jdhCommonService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("jdh:queryStatistics:deputyStatistics")
|
||||
public AjaxResult pageData(String jdhid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.id,
|
||||
dbt.dbtname,
|
||||
( SELECT count( 1 ) FROM `user` WHERE unionId IN ( SELECT fghid FROM jdh_dbt_zcfgh jbz WHERE jbz.dbtid = dbt.id )) AS ghzrs,
|
||||
( SELECT count( 1 ) FROM `jdh_db` WHERE dbtid = dbt.id ) AS dbzrs,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND ordinaryTeacher =1) AS ordinaryTeacherNum,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND seniorTeacher =1) AS seniorTeacherNum,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND sex =0) AS sexTeacherNum,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND age <= 45) AS less45Num,
|
||||
( SELECT COUNT( 1 ) FROM jdh_db WHERE dbtid = dbt.id AND roleid IN (@lx, @ty)) AS lxty
|
||||
FROM
|
||||
`jdh_dbt` dbt
|
||||
$condition
|
||||
""").setParam("lx", Roles.LXDB).setParam("ty", Roles.TYDB);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt.jdhid", "=", jdhid);
|
||||
sql.setCondition(cnd);
|
||||
return AjaxResult.success(jdhCommonService.listMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param jdhid 届次id
|
||||
*/
|
||||
@PostMapping("exportExcel")
|
||||
@RequiresPermissions("jdh:queryStatistics:deputyStatistics")
|
||||
public void exportExcel(String jdhid, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.id,
|
||||
dbt.dbtname,
|
||||
( SELECT count( 1 ) FROM `user` WHERE unionId IN ( SELECT fghid FROM jdh_dbt_zcfgh jbz WHERE jbz.dbtid = dbt.id )) AS ghzrs,
|
||||
( SELECT count( 1 ) FROM `jdh_db` WHERE dbtid = dbt.id ) AS dbzrs,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND ordinaryTeacher =1) AS ordinaryTeacherNum,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND seniorTeacher =1) AS seniorTeacherNum,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND sex =0) AS sexTeacherNum,
|
||||
(SELECT count(1) FROM `jdh_db` WHERE dbtid = dbt.id AND age <= 45) AS less45Num,
|
||||
( SELECT COUNT( 1 ) FROM jdh_db WHERE dbtid = dbt.id AND roleid IN (@lx, @ty)) AS lxty
|
||||
FROM
|
||||
`jdh_dbt` dbt
|
||||
$condition
|
||||
""").setParam("lx", Roles.LXDB).setParam("ty", Roles.TYDB);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt.jdhid", "=", jdhid);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = jdhCommonService.listMap(sql);
|
||||
|
||||
// 构造一个合计行
|
||||
int sumTotal = list.stream().mapToInt(v -> v.getInt("dbzrs", 0)).sum();
|
||||
int sumOrdinaryTeacherNum = list.stream().mapToInt(v -> v.getInt("ordinaryTeacherNum", 0)).sum();
|
||||
int sumSeniorTeacherNum = list.stream().mapToInt(v -> v.getInt("seniorTeacherNum", 0)).sum();
|
||||
int sumSexTeacherNum = list.stream().mapToInt(v -> v.getInt("sexTeacherNum", 0)).sum();
|
||||
int sumLess45Num = list.stream().mapToInt(v -> v.getInt("less45Num", 0)).sum();
|
||||
int sumLxty = list.stream().mapToInt(v -> v.getInt("lxty", 0)).sum();
|
||||
|
||||
list.add(NutMap.NEW().addv("dbtname", "合计").addv("dbzrs", sumTotal).addv("ordinaryTeacherNum", sumOrdinaryTeacherNum).addv("seniorTeacherNum", sumSeniorTeacherNum).addv("sexTeacherNum", sumSexTeacherNum).addv("less45Num", sumLess45Num).addv("lxty", sumLxty));
|
||||
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=%s".formatted(URLEncoder.encode("代表统计.xlsx", StandardCharsets.UTF_8)));
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("代表团名称", "dbtname", 30));
|
||||
entityList.add(new ExcelExportEntity("代表总数", "dbzrs", 20));
|
||||
entityList.add(new ExcelExportEntity("高级职称专任教师代表数", "ordinaryTeacherNum", 30));
|
||||
entityList.add(new ExcelExportEntity("专任教师代表数", "seniorTeacherNum", 30));
|
||||
entityList.add(new ExcelExportEntity("女教师代表数", "sexTeacherNum", 30));
|
||||
entityList.add(new ExcelExportEntity("45岁以下教师代表数", "less45Num", 30));
|
||||
entityList.add(new ExcelExportEntity("列席/特邀代表人数", "lxty", 30));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("导出数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
package com.ruoyi.jdh.controller.secondLevelJdh;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzl;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzllx;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.JdhLevel2;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.MeetingState;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.MeetingLevelTwoService;
|
||||
import com.ruoyi.system.api.RemoteSysLocalProcessService;
|
||||
import com.ruoyi.system.api.RemoteUnionService;
|
||||
import com.ruoyi.system.api.domain.SysUnion;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/29
|
||||
* @Description 二级教代会会议请示
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/secondLevelJdh/meetingApply")
|
||||
public class MeetingApplyController {
|
||||
|
||||
@Resource
|
||||
private Dao dao;
|
||||
|
||||
@Resource
|
||||
private RemoteUnionService remoteUnionService;
|
||||
|
||||
@Resource
|
||||
private MeetingLevelTwoService meetingLevelTwoService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RemoteSysLocalProcessService localProcessService;
|
||||
|
||||
// @Autowired
|
||||
// public MeetingApplyController(MeetingLevelTwoService meetingLevelTwoService) {
|
||||
// this.meetingLevelTwoService = meetingLevelTwoService;
|
||||
// }
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingRead")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (AuthUtil.hasRole("H04")) {
|
||||
List<SysUnion> data = remoteUnionService.getCurrentUserManageUnion().getData();
|
||||
List<String> ids = data.stream().map(SysUnion::getId).collect(Collectors.toList());
|
||||
cnd.and("fo.unionId", "IN", ids);
|
||||
}
|
||||
Pagination pagination = meetingLevelTwoService.pageData(cnd, pageForm, unionId, unitId);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingApply")
|
||||
public AjaxResult doAdd(@RequestBody JdhLevel2 jdhLevel2) {
|
||||
jdhLevel2.setFounder(SecurityUtils.getUserId());
|
||||
jdhLevel2.setCreate_time(DateUtils.getDate());
|
||||
jdhLevel2.setUnit_id(SecurityUtils.getDeptId());
|
||||
jdhLevel2.setUnion_id(SecurityUtils.getUnionId());
|
||||
jdhLevel2.setAudit_state(MeetingState.T300);
|
||||
JdhLevel2 insert = dao.insert(jdhLevel2);
|
||||
//新增双代会会议时,将附件同时添加到会议资料表中
|
||||
if (jdhLevel2.getFiles().size() > 0) {
|
||||
Jdh2_gzzl jdh2_gzzl = new Jdh2_gzzl();
|
||||
String id = R.UU32();
|
||||
jdh2_gzzl.setId(id);
|
||||
jdh2_gzzl.setUserid(SecurityUtils.getUserId());
|
||||
jdh2_gzzl.setUsername(SecurityUtils.getUsername());
|
||||
jdh2_gzzl.setTime(DateUtils.getDate());
|
||||
jdh2_gzzl.setJdhid(jdhLevel2.getJdhallname());
|
||||
String str = jdhLevel2.getMeeting_name().contains("请示") ? "资料" : "请示资料";
|
||||
jdh2_gzzl.setZlname(jdhLevel2.getMeeting_name() + str);
|
||||
jdh2_gzzl.setZllx(dao.fetch(Jdh2_gzzllx.class, Cnd.NEW().and("lxname", "=", "会议请示")).getId());
|
||||
jdh2_gzzl.setIspass(true);
|
||||
jdh2_gzzl.setFiles(jdhLevel2.getFiles());
|
||||
jdh2_gzzl.setFromid(insert.getId());
|
||||
|
||||
dao.insert("jdh2_gzzl", Chain.from(jdh2_gzzl));
|
||||
}
|
||||
String processUniqueId = "SECONDLEVELJDH_MEETING_APPLY@" + insert.getId();
|
||||
// 创建实例
|
||||
localProcessService.initCreateInstance(
|
||||
processUniqueId,
|
||||
insert.getId(),
|
||||
"[院级双待会会议请示]" + SecurityUtils.getNickName(),
|
||||
"/secondLevelJdh/meetingApply",
|
||||
null,
|
||||
SecurityConstants.INNER
|
||||
);
|
||||
|
||||
// 获取负责人
|
||||
com.ruoyi.common.core.domain.R<List<String>> assignments = localProcessService.getAssignments(null,
|
||||
null,
|
||||
Roles.SCHOOL_ADMIN,
|
||||
SecurityConstants.INNER);
|
||||
List<String> loginNameList = assignments.getData();
|
||||
|
||||
localProcessService.initCreateTask(
|
||||
processUniqueId,
|
||||
String.valueOf(MeetingState.T300),
|
||||
"待校工会审核",
|
||||
loginNameList,
|
||||
"/secondLevelJdh/meetingReply",
|
||||
null,
|
||||
SecurityConstants.INNER
|
||||
);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doEdit")
|
||||
@DSTransactional
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingApply")
|
||||
public AjaxResult doEdit(@RequestBody JdhLevel2 jdhLevel2) {
|
||||
if (jdhLevel2.getAudit_state().equals(MeetingState.T200) || jdhLevel2.getAudit_state().equals(MeetingState.T400)) {
|
||||
String processUniqueId = "SECONDLEVELJDH_MEETING_APPLY@" + jdhLevel2.getId();
|
||||
// 先完成当前节点的任务
|
||||
localProcessService.completeTask(processUniqueId,
|
||||
String.valueOf(MeetingState.T400),
|
||||
"待校工会审核",
|
||||
SecurityConstants.INNER);
|
||||
// 获取负责人
|
||||
com.ruoyi.common.core.domain.R<List<String>> assignments = localProcessService.getAssignments(null,
|
||||
null,
|
||||
Roles.SCHOOL_ADMIN,
|
||||
SecurityConstants.INNER);
|
||||
List<String> loginNameList = assignments.getData();
|
||||
|
||||
localProcessService.initCreateTask(
|
||||
processUniqueId,
|
||||
String.valueOf(MeetingState.T300),
|
||||
"待校工会审核",
|
||||
loginNameList,
|
||||
"/secondLevelJdh/meetingReply",
|
||||
null,
|
||||
SecurityConstants.INNER);
|
||||
}
|
||||
if (jdhLevel2.getAudit_state().equals(MeetingState.T200) || jdhLevel2.getAudit_state().equals(MeetingState.T400)) {
|
||||
jdhLevel2.setAudit_state(MeetingState.T300);
|
||||
jdhLevel2.setParty_committee_id(null);
|
||||
jdhLevel2.setSchool_union_id(null);
|
||||
}
|
||||
//修改双代会会议时,将附件同时添加到会议资料表中
|
||||
if (jdhLevel2.getFiles().size() > 0) {
|
||||
Jdh2_gzzl gzzl = dao.fetch(Jdh2_gzzl.class, Cnd.NEW().and("fromid", "=", jdhLevel2.getId()));
|
||||
if (Lang.isNotEmpty(gzzl)) {
|
||||
gzzl.setFiles(jdhLevel2.getFiles());
|
||||
dao.updateIgnoreNull(gzzl);
|
||||
}
|
||||
}
|
||||
dao.update(jdhLevel2);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("getMeetingInfo/{id}")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingRead")
|
||||
public AjaxResult getMeetingInfo(@PathVariable String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
jdh2.*,
|
||||
s.color,
|
||||
s.`name` state_name,
|
||||
fo.userName as username,
|
||||
party.userName party_name,
|
||||
school.userName school_name,
|
||||
fo.deptName unit_name,
|
||||
fo.unionName union_name
|
||||
FROM
|
||||
jdh_level2 jdh2
|
||||
LEFT JOIN jdh_level2_state s ON s.id = jdh2.audit_state
|
||||
LEFT JOIN `user` fo ON fo.userId = jdh2.founder
|
||||
LEFT JOIN `user` party ON party.userId = jdh2.party_committee_id
|
||||
LEFT JOIN `user` school ON school.userId = jdh2.school_union_id
|
||||
WHERE
|
||||
jdh2.id = @id
|
||||
ORDER BY
|
||||
jdh2.audit_state ASC,
|
||||
jdh2.create_time DESC
|
||||
""").setParam("id", id);
|
||||
|
||||
List<Record> list = meetingLevelTwoService.list(sql);
|
||||
return AjaxResult.success(list.isEmpty() ? null : list.get(0));
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingRead")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
|
||||
JdhLevel2 jdhLevel2 = dao.fetch(JdhLevel2.class, id);
|
||||
|
||||
dao.delete(JdhLevel2.class, id);
|
||||
dao.clear("jdh2_gzzl", Cnd.NEW().and("fromid", "=", id));
|
||||
localProcessService.deleteProcessInstance("SECONDLEVELJDH_MEETING_APPLY@" + id, SecurityConstants.INNER);
|
||||
|
||||
//TODO:后续这里需要增加删除文件服务器的代码
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("findOne/{id}")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingApply")
|
||||
public AjaxResult findOne(@PathVariable String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
jdh2.*,
|
||||
un.dept_name unit_name,
|
||||
uni.unionName union_name
|
||||
FROM
|
||||
jdh_level2 jdh2
|
||||
LEFT JOIN `dept` un ON un.dept_id = jdh2.unit_id
|
||||
LEFT JOIN `union` uni ON uni.id = jdh2.union_id
|
||||
WHERE
|
||||
jdh2.id = @id
|
||||
""").setParam("id", id);
|
||||
List<Record> list = meetingLevelTwoService.list(sql);
|
||||
return AjaxResult.success(list.isEmpty() ? null : list.get(0));
|
||||
}
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package com.ruoyi.jdh.controller.secondLevelJdh;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.domain.SysFile;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzl;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzllx;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.JdhLevel2;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.MeetingState;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.MeetingLevelTwoService;
|
||||
import com.ruoyi.system.api.RemoteSysLocalProcessService;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description 会议批复
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/secondLevelJdh/meetingReply")
|
||||
public class MeetingReplyController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
private MeetingLevelTwoService meetingLevelTwoService;
|
||||
|
||||
@Autowired
|
||||
private RemoteSysLocalProcessService localProcessService;
|
||||
|
||||
@Autowired
|
||||
public MeetingReplyController(MeetingLevelTwoService meetingLevelTwoService) {
|
||||
this.meetingLevelTwoService = meetingLevelTwoService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingReply")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId,
|
||||
@RequestParam(value = "isAudit", required = false) Boolean isAudit) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRole("admin")) {
|
||||
if (AuthUtil.hasRole("Y01")) {
|
||||
cnd.and("jdh2.party_committee_id", isAudit ? "IS NOT" : "IS", null);
|
||||
cnd.and("jdh2.audit_state", ">=", MeetingState.T100);
|
||||
} else if (AuthUtil.hasRole("A06")) {
|
||||
if (isAudit != null) {
|
||||
if (isAudit) {
|
||||
cnd.and("jdh2.school_union_id", "IS NOT", null).and("jdh2.school_union_id", "!=", "");
|
||||
} else {
|
||||
cnd.and("jdh2.school_union_id", "IS", null).or("jdh2.school_union_id", "=", "");
|
||||
}
|
||||
}
|
||||
cnd.and("jdh2.audit_state", ">=", MeetingState.T300);
|
||||
}
|
||||
} else {
|
||||
if (isAudit != null) {
|
||||
if (isAudit) {
|
||||
cnd.where().andIn("jdh2.audit_state", MeetingState.T200, MeetingState.T400, MeetingState.T500);
|
||||
} else {
|
||||
cnd.where().andIn("jdh2.audit_state", MeetingState.T100, MeetingState.T300);
|
||||
}
|
||||
}
|
||||
}
|
||||
Pagination pagination = meetingLevelTwoService.pageData(cnd, pageForm, unionId, unitId);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAudit")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingReply")
|
||||
@Transactional
|
||||
public AjaxResult doAudit(String id, String opinion, Boolean flag, @RequestBody(required = false) List<SysFile> fileList) {
|
||||
JdhLevel2 fetch = meetingLevelTwoService.dao().fetch(JdhLevel2.class, id);
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Chain chain = null;
|
||||
if (fetch.getAudit_state().equals(MeetingState.T100) && AuthUtil.hasAnyRoles("admin,gh03")) {
|
||||
chain = Chain.make("party_committee_id", userId).add("party_committee_time", DateUtils.getDate())
|
||||
.add("party_committee_opinion", opinion).add("audit_state", flag ? MeetingState.T300 : MeetingState.T200);
|
||||
|
||||
} else if (fetch.getAudit_state().equals(MeetingState.T300) && AuthUtil.hasAnyRoles("admin,A06")) {
|
||||
chain = Chain.make("school_union_id", userId).add("school_union_time", DateUtils.getDate())
|
||||
.add("school_union_opinion", opinion).add("audit_state", flag ? MeetingState.T500 : MeetingState.T400);
|
||||
chain.add("school_files", fileList);
|
||||
}
|
||||
|
||||
//批复双代会会议时,将附件同时添加到会议资料表中
|
||||
if (fileList != null && !fileList.isEmpty()) {
|
||||
Jdh2_gzzl jdh2_gzzl = new Jdh2_gzzl();
|
||||
String rid = R.UU32();
|
||||
jdh2_gzzl.setId(rid);
|
||||
jdh2_gzzl.setUserid(SecurityUtils.getUserId());
|
||||
jdh2_gzzl.setUsername(SecurityUtils.getUsername());
|
||||
jdh2_gzzl.setTime(DateUtils.getDate());
|
||||
jdh2_gzzl.setJdhid(fetch.getJdhallname());
|
||||
String str = fetch.getMeeting_name().contains("批复") ? "资料" : "批复资料";
|
||||
jdh2_gzzl.setZlname(fetch.getMeeting_name().replace("请示", "") + str);
|
||||
jdh2_gzzl.setZllx(dao.fetch(Jdh2_gzzllx.class, Cnd.NEW().and("lxname", "=", "会议批复")).getId());
|
||||
jdh2_gzzl.setIspass(true);
|
||||
jdh2_gzzl.setFiles(fileList);
|
||||
jdh2_gzzl.setFromid(id);
|
||||
|
||||
dao.insert("jdh2_gzzl", Chain.from(jdh2_gzzl));
|
||||
}
|
||||
|
||||
meetingLevelTwoService.dao().update(JdhLevel2.class, chain, Cnd.where("id", "=", id));
|
||||
|
||||
String processUniqueId = "SECONDLEVELJDH_MEETING_APPLY@" + fetch.getId();
|
||||
if (flag) {
|
||||
// 先完成当前节点的任务
|
||||
localProcessService.completeTask(processUniqueId,
|
||||
String.valueOf(MeetingState.T300),
|
||||
"已完结",
|
||||
SecurityConstants.INNER);
|
||||
localProcessService.completeProcess(processUniqueId, false, SecurityConstants.INNER);
|
||||
} else {
|
||||
//退回
|
||||
// 先完成当前节点的任务
|
||||
localProcessService.completeTask(processUniqueId,
|
||||
String.valueOf(MeetingState.T300),
|
||||
"校工会退回",
|
||||
SecurityConstants.INNER);
|
||||
Sql sql = Sqls.create("select loginName FROM `user` where userId=@userId").setParam("userId", fetch.getFounder());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap userMap = (NutMap) sql.getResult();
|
||||
localProcessService.initCreateTask(
|
||||
processUniqueId,
|
||||
String.valueOf(MeetingState.T400),
|
||||
"校工会退回",
|
||||
List.of(userMap.getString("loginName")),
|
||||
"/secondLevelJdh/meetingRead",
|
||||
null,
|
||||
SecurityConstants.INNER
|
||||
);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("callback/{id}")
|
||||
@RequiresPermissions("secondLevelJdh:meetingManage:meetingReply")
|
||||
public AjaxResult callback(@PathVariable String id) {
|
||||
meetingLevelTwoService.callback(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package com.ruoyi.jdh.controller.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.UnionCadre;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.UnionCadreAuditState;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.MeetingTradeUnionManageService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description 工会委员会
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/secondLevelJdh/tradeUnionManage")
|
||||
public class MeetingTradeUnionManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private MeetingTradeUnionManageService tradeUnionManageService;
|
||||
|
||||
@Autowired
|
||||
public MeetingTradeUnionManageController(MeetingTradeUnionManageService tradeUnionManageService) {
|
||||
this.tradeUnionManageService = tradeUnionManageService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("secondLevelJdh:tradeUnionCommittee:tradeUnionManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "unionId", required = false) String unionId) {
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
u.userName as username,
|
||||
u.loginName loginname,
|
||||
u.mobile,
|
||||
state.stateName,
|
||||
state.stateColor,
|
||||
(uc.auditStateId != @can) can
|
||||
FROM
|
||||
union_cadre uc
|
||||
LEFT JOIN `user` u ON uc.userId = u.userId
|
||||
LEFT JOIN audit_state state ON uc.auditStateId = state.stateId
|
||||
$condition
|
||||
""").setParam("can", UnionCadreAuditState.SCHOOL_UNION);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.desc("uc.session");
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = tradeUnionManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
item.put("rolename", roleMap.get(item.getLong("roleId")));
|
||||
});
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@GetMapping("searchUser")
|
||||
@RequiresPermissions("secondLevelJdh:tradeUnionCommittee:tradeUnionManage")
|
||||
public AjaxResult searchUser(String query, String unionId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId as id,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.mobile,
|
||||
u.email,
|
||||
u.sex,
|
||||
u.deptName unitname,
|
||||
u.unionName as unionname
|
||||
FROM
|
||||
`user` u
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(query)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("u.userName", query);
|
||||
group.orLike("u.loginName", query);
|
||||
cnd.and(group);
|
||||
}
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
cnd.and("u.unionId", "=", unionId);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return AjaxResult.success(tradeUnionManageService.listPage(1, 50, sql));
|
||||
}
|
||||
|
||||
@PostMapping("createCadre")
|
||||
@RequiresPermissions("secondLevelJdh:tradeUnionCommittee:tradeUnionManage")
|
||||
public AjaxResult createCadre(@RequestBody UnionCadre cadre,
|
||||
@RequestParam String roleCode) {
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Record role = roleList.stream().filter(o -> o.getString("role_key").equals(roleCode)).findAny().orElse(null);
|
||||
|
||||
if (role == null) {
|
||||
throw new ServiceException("请先在角色设置中配置该分工!");
|
||||
}
|
||||
|
||||
Cnd cnd = Cnd.where("userId", "=", cadre.getUserId()).and("roleId", "=", role.getLong("role_id"))
|
||||
.and("unionId", "=", cadre.getUnionId()).and("session", "=", cadre.getSession());
|
||||
if (dao.count(UnionCadre.class, cnd) > 0) {
|
||||
throw new ServiceException("此操作重复!");
|
||||
}
|
||||
cadre.setJoining(true).setRoleId(role.getLong("role_id")).setAuditStateId(UnionCadreAuditState.SUCCESS);
|
||||
dao.insert(cadre);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("removeCadre/{id}")
|
||||
@RequiresPermissions("secondLevelJdh:tradeUnionCommittee:tradeUnionManage")
|
||||
public AjaxResult removeCadre(@PathVariable String id) {
|
||||
UnionCadre cadre = dao.fetch(UnionCadre.class, id);
|
||||
if (UnionCadreAuditState.SUCCESS != cadre.getAuditStateId() && cadre.getJoining()) {
|
||||
dao.delete(UnionCadre.class, id);
|
||||
} else {
|
||||
cadre.setJoining(false).setAuditStateId(UnionCadreAuditState.SCHOOL_UNION);
|
||||
dao.update(cadre);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
package com.ruoyi.jdh.controller.secondLevelJdh;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzl;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.WorkDataManageService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Criteria;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description 二级教代会工作资料管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/secondLevelJdh/workDataManage")
|
||||
public class WorkDataManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private WorkDataManageService workDataManageService;
|
||||
|
||||
@Autowired
|
||||
public WorkDataManageController(WorkDataManageService workDataManageService) {
|
||||
this.workDataManageService = workDataManageService;
|
||||
}
|
||||
|
||||
@RequestMapping("pageData")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "year", required = false) String year,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "jdhid", required = false) String jdhid,
|
||||
@RequestParam(value = "zllx", required = false) String zllx) {
|
||||
Pagination pagination = workDataManageService.pageData(pageForm, year, unionId, jdhid, zllx);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@GetMapping("getJdh2")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataManage")
|
||||
public AjaxResult getJdh2(String unionId) {
|
||||
//如果系统管理员或者校工会管理员,返回二级教代会中所有的届次
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
jdh_level2
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasAnyRoles("admin, A06")) {
|
||||
cnd.and("union_id", "=", SecurityUtils.getUnionId());
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("union_id", "=", unionId);
|
||||
}
|
||||
}
|
||||
cnd.groupBy("jdhallname");
|
||||
sql.setCondition(cnd);
|
||||
List list = workDataManageService.list(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("getTreeData")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataManage")
|
||||
public AjaxResult getTreeData(String year, String jdhid, String zllx) {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.setv("unionName", "工会委员会");
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
un.*,
|
||||
(select count(*) from jdh2_gzzl g left join `user` u on g.userid=u.userId where u.unionId = un.id $zlCount) as zlCount
|
||||
from
|
||||
`union` un
|
||||
$condition
|
||||
order by unioncode asc
|
||||
""");
|
||||
Criteria criteria = Cnd.cri();
|
||||
criteria.where().setTop(false);
|
||||
if (StringUtils.isNotBlank(year)) {
|
||||
criteria.where().and("year(time)", "=", year);
|
||||
}
|
||||
if (StringUtils.isNotBlank(jdhid)) {
|
||||
criteria.where().and("g.jdhid", "=", jdhid);
|
||||
}
|
||||
if (StringUtils.isNotBlank(zllx)) {
|
||||
criteria.where().and("g.zllx", "=", zllx);
|
||||
}
|
||||
if (!criteria.where().isEmpty()) {
|
||||
sql.vars().set("zlCount", "and " + criteria.toSql(null));
|
||||
}
|
||||
if (!AuthUtil.hasAnyRoles("admin, A06")) {
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", SecurityUtils.getUserId()),
|
||||
new FeignCnd("role_id", "in", List.of(Roles.FGH_ADMIN))
|
||||
);
|
||||
List<SysUserRole> data = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<String> unionIds = data.stream().map(SysUserRole::getUnionId).distinct().collect(Collectors.toList());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("id", "in", unionIds);
|
||||
sql.setCondition(cnd);
|
||||
}
|
||||
nutMap.setv("children", workDataManageService.listMap(sql));
|
||||
return AjaxResult.success(List.of(nutMap));
|
||||
}
|
||||
|
||||
@PostMapping("doHandle")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataManage")
|
||||
public AjaxResult doHandle(@RequestBody Jdh2_gzzl gzzl) {
|
||||
if (StringUtils.isBlank(gzzl.getId())) {
|
||||
//新增
|
||||
Boolean addResult = workDataManageService.doAdd(gzzl);
|
||||
return addResult ? AjaxResult.success() : AjaxResult.error();
|
||||
} else {
|
||||
//编辑
|
||||
Boolean editResult = workDataManageService.doEdit(gzzl);
|
||||
return editResult ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
}
|
||||
@PostMapping("doDelete")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataManage")
|
||||
public AjaxResult doDelete(@RequestParam("id") String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return AjaxResult.error("id不能为空!");
|
||||
}
|
||||
Boolean result = workDataManageService.doDelete(id);
|
||||
//TODO:后续这里需要增加删除文件服务器的代码
|
||||
return result ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.ruoyi.jdh.controller.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzllx;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.WorkDataTypeManageService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description 工作资料类型管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/secondLevelJdh/workDataTypeManage")
|
||||
public class WorkDataTypeManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
private WorkDataTypeManageService workDataTypeManageService;
|
||||
|
||||
@Autowired
|
||||
public WorkDataTypeManageController(WorkDataTypeManageService workDataTypeManageService) {
|
||||
this.workDataTypeManageService = workDataTypeManageService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataTypeManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "lxname", required = false) String lxname) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(lxname)) {
|
||||
cnd.and("lxname", "like", "%" + lxname + "%");
|
||||
}
|
||||
cnd.asc("xh");
|
||||
Pagination pagination = workDataTypeManageService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), "jdh2_gzzllx", cnd);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataTypeManage")
|
||||
public AjaxResult doAdd(@RequestBody Jdh2_gzzllx gzzllx) {
|
||||
int count = dao.count("jdh2_gzzllx", Cnd.where("code", "=", gzzllx.getCode()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("编码重复!");
|
||||
}
|
||||
gzzllx.setId(R.UU32());
|
||||
int totalCount = dao.count("jdh2_gzzllx");
|
||||
gzzllx.setXh(totalCount + 1);
|
||||
dao.insert("jdh2_gzzllx", Chain.from(gzzllx));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doEdit")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataTypeManage")
|
||||
public AjaxResult doEdit(@RequestBody Jdh2_gzzllx gzzllx) {
|
||||
int count = dao.count("jdh2_gzzllx", Cnd.where("code", "=", gzzllx.getCode()).and("id", "!=", gzzllx.getId()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("编码重复");
|
||||
}
|
||||
dao.update("jdh2_gzzllx", Chain.from(gzzllx), Cnd.where("id", "=", gzzllx.getId()));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doDelete/{id}")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataTypeManage")
|
||||
public AjaxResult doDelete(@PathVariable String id) {
|
||||
dao.clear("jdh2_gzzllx", Cnd.where("id", "=", id));
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("rowChange")
|
||||
@RequiresPermissions("secondLevelJdh:secondLevelJdhMeetingData:workDataTypeManage")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult rowChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
Record next = dao.fetch("jdh2_gzzllx", Cnd.where("xh", "=", xh + 1));
|
||||
next.set("xh", next.getInt("xh") - 1);
|
||||
dao.update("jdh2_gzzllx", Chain.from(next), Cnd.where("id", "=", next.getString("id")));
|
||||
dao.update("jdh2_gzzllx", Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
|
||||
} else {
|
||||
Record pre = dao.fetch("jdh2_gzzllx", Cnd.where("xh", "=", xh - 1));
|
||||
pre.set("xh", pre.getInt("xh") + 1);
|
||||
dao.update("jdh2_gzzllx", Chain.from(pre), Cnd.where("id", "=", pre.getString("id")));
|
||||
dao.update("jdh2_gzzllx", Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
package com.ruoyi.jdh.controller.workersCongress;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Delegation;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.DelegationMakeUpUnion;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Representative;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhDelegationService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUnionService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysUnion;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description 工代会代表团
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gdh/delegation")
|
||||
public class GdhDelegationController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteDictService remoteDictService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUnionService remoteUnionService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private GdhDelegationService gdhDelegationService;
|
||||
|
||||
@Autowired
|
||||
public GdhDelegationController(GdhDelegationService gdhDelegationService) {
|
||||
this.gdhDelegationService = gdhDelegationService;
|
||||
}
|
||||
|
||||
@GetMapping("getTreeData")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult getTreeData(String gdh_id) {
|
||||
Record record = new Record();
|
||||
record.set("dbt_name", "工代会代表团");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,gdh.gdhAllName
|
||||
FROM
|
||||
`workers_congress_delegation` dbt
|
||||
LEFT JOIN workers_congress_session gdh ON gdh.id = dbt.gdh_id $condition
|
||||
""");
|
||||
cnd.and("dbt.gdh_id", "=", gdh_id);
|
||||
cnd.asc("dbt.`code`");
|
||||
sql.setCondition(cnd);
|
||||
record.set("children", gdhDelegationService.list(sql));
|
||||
return AjaxResult.success(record);
|
||||
}
|
||||
|
||||
@RequestMapping("pageData")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "gdh_id", required = false) String gdh_id,
|
||||
@RequestParam(value = "dbt_id", required = false) String dbt_id) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,gdh.gdhAllName
|
||||
FROM
|
||||
`workers_congress_delegation` dbt
|
||||
LEFT JOIN workers_congress_session gdh ON gdh.id = dbt.gdh_id $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt.gdh_id", "=", gdh_id);
|
||||
cnd.andEX("dbt.id", "=", dbt_id);
|
||||
cnd.asc("dbt.code");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = gdhDelegationService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@GetMapping("getDbtFind")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult getDbtFind(String gdh_id) {
|
||||
List<Delegation> dbtList = dao.query(Delegation.class, Cnd.where("gdh_id", "=", gdh_id));
|
||||
List<String> names = dbtList.stream().map(Delegation::getDbt_name).collect(Collectors.toList());
|
||||
R<List<Record>> canChooseDbt = remoteDictService.getCanChooseDbt(names);
|
||||
return AjaxResult.success(canChooseDbt.getData());
|
||||
}
|
||||
|
||||
@PostMapping("doAddDbt")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult doAddDbt(@RequestBody Delegation delegation) {
|
||||
delegation.setFound_time(DateUtil.now());
|
||||
dao.insert(delegation);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("editDbt")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult editDbt(@RequestBody Delegation delegation){
|
||||
dao.updateIgnoreNull(delegation);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("delDbt")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult delDbt(String dbt_id, String gdh_id) {
|
||||
|
||||
dao.clear(Delegation.class, Cnd.where("id", "=", dbt_id).and("gdh_id", "=", gdh_id));
|
||||
dao.clear(DelegationMakeUpUnion.class, Cnd.where("id", "=", dbt_id).and("gdh_id", "=", gdh_id));
|
||||
dao.clear(Representative.class, Cnd.where("id", "=", dbt_id).and("gdh_id", "=", gdh_id));
|
||||
|
||||
//删除团长 副团长 操作员的权限
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("dbtid", "=", dbt_id),
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("role_id", "in", List.of(Roles.ZSDB, Roles.DBT_TZ, Roles.DBT_FTZ))
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("getDbTableData")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult getDbTableData(String gdh_id, String dbt_id) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("wo.gdh_id", "=", gdh_id);
|
||||
cnd.andEX("wo.dbt_id", "=", dbt_id);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wo.*,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unionName as unionname,
|
||||
u.deptName as unitname,
|
||||
dbt.dbt_name
|
||||
FROM
|
||||
`workers_congress_representative` wo
|
||||
LEFT JOIN `user` u ON wo.userId = u.userId
|
||||
LEFT JOIN workers_congress_delegation dbt ON dbt.id = wo.dbt_id $condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
List list = gdhDelegationService.list(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("unionPageData")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult unionPageData(String gdh_id, String dbt_id) {
|
||||
|
||||
List<Record> unionList = findUnionList(dbt_id, gdh_id);
|
||||
return AjaxResult.success(unionList);
|
||||
}
|
||||
|
||||
@GetMapping("unionOpenAddList")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult unionOpenAddList(String gdh_id, String dbt_id) {
|
||||
|
||||
List<DelegationMakeUpUnion> unions = dao.query(DelegationMakeUpUnion.class, Cnd.where("gdh_id", "=", gdh_id).and("dbt_id", "!=", dbt_id));
|
||||
List<String> ids = unions.stream().map(DelegationMakeUpUnion::getUnion_id).collect(Collectors.toList());
|
||||
|
||||
//获取所有工会
|
||||
List<SysUnion> unionList = remoteUnionService.listAll().getData();
|
||||
|
||||
List<SysUnion> result = new ArrayList<>();
|
||||
unionList.forEach(item -> {
|
||||
if (!ids.contains(item.getId())) {
|
||||
result.add(item);
|
||||
}
|
||||
});
|
||||
|
||||
Record set = Record.create().set("data", result).set("value", findUnionList(dbt_id, gdh_id));
|
||||
return AjaxResult.success(set);
|
||||
}
|
||||
|
||||
@PostMapping("doUnion")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult doUnion(@RequestBody String[] unionValue,
|
||||
@RequestParam(value = "gdh_id") String gdh_id,
|
||||
@RequestParam(value = "dbt_id") String dbt_id) {
|
||||
dao.clear(DelegationMakeUpUnion.class, Cnd.where("gdh_id", "=", gdh_id).and("dbt_id", "=", dbt_id));
|
||||
List<DelegationMakeUpUnion> list = new ArrayList<>();
|
||||
for (String unionId : unionValue) {
|
||||
DelegationMakeUpUnion makeUpUnion = new DelegationMakeUpUnion();
|
||||
makeUpUnion.setUnion_id(unionId);
|
||||
makeUpUnion.setDbt_id(dbt_id);
|
||||
makeUpUnion.setGdh_id(gdh_id);
|
||||
list.add(makeUpUnion);
|
||||
}
|
||||
dao.insert(list);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("getTzList")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult getTzList(String gdh_id, String dbt_id) {
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("dbtid", "=", dbt_id),
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ))
|
||||
);
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<Long> users = userRoles.stream().map(SysUserRole::getUserId).collect(Collectors.toList());
|
||||
|
||||
Sql sql = Sqls.create("select * from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "in", users);
|
||||
cnd.asc("deptCode");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = gdhDelegationService.listMap(sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
list.forEach(item -> {
|
||||
SysUserRole sysUserRole = userRoles.stream().filter(o -> o.getUserId() == item.getLong("userId")).findAny().orElse(null);
|
||||
item.addv("roleName", roleMap.get(sysUserRole.getRoleId()));
|
||||
item.addv("roleId", sysUserRole.getRoleId());
|
||||
});
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("queryUser")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult queryUser(String gdh_id, String dbt_id) {
|
||||
|
||||
//根据jdhid和dbtid在代表表中查询出所有的代表
|
||||
List<Representative> dbs = dao.query(Representative.class, Cnd.where("gdh_id", "=", gdh_id).and("dbt_id", "=", dbt_id));
|
||||
List<Long> dbIds = dbs.stream().map(Representative::getUserId).collect(Collectors.toList());
|
||||
|
||||
//查询团长副团长
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("dbtid", "=", dbt_id),
|
||||
new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ))
|
||||
);
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
List<Long> userIds = userRoles.stream().map(SysUserRole::getUserId).collect(Collectors.toList());
|
||||
|
||||
dbIds.removeAll(userIds);
|
||||
|
||||
Sql sql = Sqls.create("select * from `user` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "in", dbIds);
|
||||
sql.setCondition(cnd);
|
||||
List list = gdhDelegationService.listMap(sql);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("doAddTz")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult doAddTz(String dbt_id, String gdh_id, Long userid, Integer sf) {
|
||||
if (sf == 2) {
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("dbtid", "=", dbt_id),
|
||||
new FeignCnd("role_id", "=", Roles.DBT_TZ)
|
||||
);
|
||||
List<SysUserRole> userRoles = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
if (userRoles.size() > 0) {
|
||||
return AjaxResult.error("团长只能设置一位!");
|
||||
}
|
||||
}
|
||||
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setUserId(userid);
|
||||
sysUserRole.setJdhid(gdh_id);
|
||||
sysUserRole.setDbtid(dbt_id);
|
||||
sysUserRole.setRoleId(sf == 1 ? Roles.DBT_FTZ : Roles.DBT_TZ);
|
||||
R<Boolean> booleanR = remoteUserRoleService.addUserRole(sysUserRole);
|
||||
return booleanR.getCode() == R.SUCCESS ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("delUser")
|
||||
@RequiresPermissions("workersCongress:delegation")
|
||||
public AjaxResult delUser(String gdh_id, String userId, String roleId, String dbt_id) {
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("dbtid", "=", dbt_id),
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("user_id", "=", userId),
|
||||
new FeignCnd("role_id", "=", roleId)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private List<Record> findUnionList(String dbt_id, String gdh_id) {
|
||||
|
||||
//获取所有工会
|
||||
List<SysUnion> unionList = remoteUnionService.listAll().getData();
|
||||
//工会分组成map,方便后边直接get到工会名称
|
||||
Map<String, String> unionMap = unionList.stream().collect(Collectors.toMap(SysUnion::getId, SysUnion::getUnionName));
|
||||
|
||||
List<Record> dbtFgh = dao.query("workers_congress_delegation_make_up_union", Cnd.where("dbt_id", "=", dbt_id).and("gdh_id", "=", gdh_id));
|
||||
dbtFgh.forEach(item -> {
|
||||
item.put("unionName", unionMap.get(item.getString("union_id")));
|
||||
});
|
||||
return dbtFgh;
|
||||
}
|
||||
}
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
package com.ruoyi.jdh.controller.workersCongress;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.Representative;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhDeputySeniorManageService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.lang.Mirror;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/28
|
||||
* @Description 工代会代表高级管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gdh/deputySeniorManage")
|
||||
public class GdhDeputySeniorManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
@Autowired
|
||||
private RemoteDictService dictService;
|
||||
|
||||
@Autowired
|
||||
private GdhDeputySeniorManageService gdhDeputySeniorManageService;
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "gdh_id", required = false) String gdh_id,
|
||||
@RequestParam(value = "dbt_id", required = false) String dbt_id,
|
||||
@RequestParam(value = "unionId", required = false) String unionId,
|
||||
@RequestParam(value = "unitId", required = false) String unitId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wo.*,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
dbt.dbt_name
|
||||
FROM
|
||||
`workers_congress_representative` wo
|
||||
LEFT JOIN `user` u ON wo.userId = u.userId
|
||||
LEFT JOIN workers_congress_delegation dbt ON dbt.id = wo.dbt_id
|
||||
$condition
|
||||
""");
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andEX("wo.gdh_id", "=", gdh_id);
|
||||
cnd.andEX("wo.dbt_id", "=", dbt_id);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.andEX("u.deptId", "=", unitId);
|
||||
cnd.asc("u.unionId");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = gdhDeputySeniorManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
item.put("roleName", roleMap.get(item.getLong("roleId")));
|
||||
});
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可选代表
|
||||
*/
|
||||
@GetMapping("getUserDbChange")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult getUserDbChange(String dbt_id, String gdh_id, String query) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId as id,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.unionName as unionname,
|
||||
u.deptName as unitname
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
u.unionId IN ( SELECT union_id FROM workers_congress_delegation_make_up_union upunion WHERE gdh_id = @gdh_id AND dbt_id = @dbt_id )
|
||||
AND u.userId NOT IN ( SELECT userId FROM workers_congress_representative )
|
||||
AND ( u.userName LIKE @keyword OR u.loginName LIKE @keyword )
|
||||
""").setParam("dbt_id", dbt_id).setParam("gdh_id", gdh_id).setParam("keyword", "%" + query + "%");
|
||||
;
|
||||
List list = gdhDeputySeniorManageService.listPage(1, 100, sql).getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult doAdd(
|
||||
@RequestBody Long[] userData,
|
||||
@RequestParam String gdh_id,
|
||||
@RequestParam String dbt_id,
|
||||
@RequestParam Integer identity) {
|
||||
|
||||
Sql sql = Sqls.create("select userId,deptId as unitId,deptName as unitName,unionId,unionName from user where userId in (@userIds)");
|
||||
sql.setParam("userIds", userData);
|
||||
List<NutMap> userList = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
||||
Map<Long, NutMap> userMap = userList.stream().collect(Collectors.toMap(v -> v.getLong("userId"), v -> v));
|
||||
|
||||
for (Long userId : userData) {
|
||||
Representative workers = new Representative();
|
||||
workers.setUserId(userId);
|
||||
workers.setDbt_id(dbt_id);
|
||||
workers.setGdh_id(gdh_id);
|
||||
workers.setRoleId(identity == 1 ? Roles.GDHDB : identity == 2 ? Roles.GDHLX : Roles.GDHTY);
|
||||
|
||||
workers.setUnitId(Optional.ofNullable(userMap.get(userId)).map(u -> u.getString("unitId")).orElse(null));
|
||||
workers.setUnitName(Optional.ofNullable(userMap.get(userId)).map(u -> u.getString("unitName")).orElse(null));
|
||||
workers.setUnionId(Optional.ofNullable(userMap.get(userId)).map(u -> u.getString("unionId")).orElse(null));
|
||||
workers.setUnionName(Optional.ofNullable(userMap.get(userId)).map(u -> u.getString("unionName")).orElse(null));
|
||||
|
||||
dao.insert(workers);
|
||||
|
||||
SysUserRole sys_user_role = new SysUserRole();
|
||||
sys_user_role.setUserId(userId);
|
||||
sys_user_role.setRoleId(identity == 1 ? Roles.GDHDB : identity == 2 ? Roles.GDHLX : Roles.GDHTY);
|
||||
sys_user_role.setDbtid(dbt_id);
|
||||
sys_user_role.setJdhid(gdh_id);
|
||||
remoteUserRoleService.addUserRole(sys_user_role);
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("userDoDelete")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult userDoDelete(String userId, String dbt_id, String gdh_id, Long roleId) {
|
||||
|
||||
dao.clear(Representative.class, Cnd.where("userId", "=", userId).and("dbt_id", "=", dbt_id).and("gdh_id", "=", gdh_id));
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", userId),
|
||||
new FeignCnd("dbtid", "=", dbt_id),
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("role_id", "=", roleId)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doDeleteUserList")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult doDeleteUserList(@RequestBody List<NutMap> userData,
|
||||
@RequestParam String gdh_id) {
|
||||
|
||||
for (NutMap userMap : userData) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt_id", "=", userMap.getString("dbt_id"));
|
||||
cnd.andEX("userId", "=", userMap.getLong("userId"));
|
||||
cnd.andEX("gdh_id", "=", gdh_id);
|
||||
cnd.andEX("roleId", "=", userMap.getLong("roleId"));
|
||||
dao.clear(Representative.class, cnd);
|
||||
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("user_id", "=", userMap.getLong("userId")),
|
||||
new FeignCnd("dbtid", "=", userMap.getString("dbt_id")),
|
||||
new FeignCnd("jdhid", "=", gdh_id),
|
||||
new FeignCnd("role_id", "=", userMap.getLong("roleId"))
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("queryXldUser")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult queryXldUser(String query, String gdhid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId as id,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.unionName as unionname,
|
||||
u.deptName as unitname,
|
||||
u.sex
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
userId NOT IN
|
||||
(
|
||||
SELECT
|
||||
wcr.userId
|
||||
FROM
|
||||
`workers_congress_representative` wcr
|
||||
LEFT JOIN `user` u ON u.userId = wcr.userId WHERE wcr.gdh_id=@gdhid AND (u.userName LIKE @query OR u.loginName LIKE @query
|
||||
))
|
||||
AND (u.userName LIKE @query OR u.loginName LIKE @query)
|
||||
""").setParam("gdhid", gdhid).setParam("query", "%" + query + "%");
|
||||
List list = gdhDeputySeniorManageService.listPageMap(1, 100, sql).getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("fpXldToDbt")
|
||||
@RequiresPermissions("workersCongress:deputySeniorManage")
|
||||
public AjaxResult fpXldToDbt(@RequestBody List<NutMap> userMapList, @RequestParam String gdhid) {
|
||||
|
||||
userMapList.forEach(v -> {
|
||||
Representative workers = new Representative();
|
||||
workers.setUserId(v.getLong("id"));
|
||||
workers.setDbt_id(v.getString("dbtid"));
|
||||
workers.setGdh_id(gdhid);
|
||||
workers.setRoleId(Roles.GDHDB);
|
||||
dao.insert(workers);
|
||||
|
||||
SysUserRole sys_user_role = new SysUserRole();
|
||||
sys_user_role.setUserId(v.getLong("id"));
|
||||
sys_user_role.setRoleId(Roles.GDHDB);
|
||||
sys_user_role.setDbtid(v.getString("dbtid"));
|
||||
sys_user_role.setJdhid(gdhid);
|
||||
remoteUserRoleService.addUserRole(sys_user_role);
|
||||
});
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@RequestMapping("doExcel")
|
||||
public void doExcel(String gdhId, String gdhAllName, String dbtId, HttpServletResponse response) throws IOException {
|
||||
|
||||
List<SysDictData> userSex = dictService.dictType("sys_user_sex").getData();
|
||||
Map<String, String> sexMap = userSex.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wo.*,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unionName as unionname,
|
||||
u.deptName as unitname,
|
||||
dbt.dbt_name
|
||||
FROM
|
||||
`workers_congress_representative` wo
|
||||
LEFT JOIN `user` u ON wo.userId = u.userId
|
||||
LEFT JOIN workers_congress_delegation dbt ON dbt.id = wo.dbt_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andEX("wo.gdh_id", "=", gdhId);
|
||||
cnd.andEX("wo.dbt_id", "=", dbtId);
|
||||
cnd.asc("u.unionId");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
sql.setEntity(dao.getEntity(Mirror.me(db_excel_data.class).getType()));
|
||||
sql.setCallback(Sqls.callback.entities());
|
||||
dao.execute(sql);
|
||||
List<db_excel_data> dbList = sql.getList(db_excel_data.class);
|
||||
|
||||
dbList.forEach(item -> {
|
||||
item.setSex(sexMap.get(item.getSex()));
|
||||
});
|
||||
|
||||
String fileName = gdhAllName + "代表名单.xlsx";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), db_excel_data.class, dbList);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出代表实体类
|
||||
*/
|
||||
@Data
|
||||
public static class db_excel_data implements Serializable {
|
||||
@Excel(name = "工号", width = 20)
|
||||
private String loginname;
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String username;
|
||||
@Excel(name = "性别", width = 10)
|
||||
private String sex;
|
||||
@Excel(name = "联系方式", width = 20)
|
||||
private String mobile;
|
||||
@Excel(name = "所属代表团", width = 30)
|
||||
private String dbt_name;
|
||||
@Excel(name = "所属工会", width = 30)
|
||||
private String unionname;
|
||||
@Excel(name = "所属单位", width = 30)
|
||||
private String unitname;
|
||||
}
|
||||
}
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
package com.ruoyi.jdh.controller.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.election.TeacherMeetCommission;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.OrganizationUser;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhOrganizationService;
|
||||
import com.ruoyi.system.api.RemoteDictService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysDictData;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/28
|
||||
* @Description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gdh/gdhOrganization")
|
||||
public class GdhOrganizationController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteDictService remoteDictService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private GdhOrganizationService gdhOrganizationService;
|
||||
|
||||
@Autowired
|
||||
public GdhOrganizationController(GdhOrganizationService gdhOrganizationService) {
|
||||
this.gdhOrganizationService = gdhOrganizationService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("workersCongress:gdhOrganization")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "gdh_id", required = false) String gdh_id,
|
||||
@RequestParam(value = "organization_id", required = false) String organization_id) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wo.*,
|
||||
u.userName as username,
|
||||
u.loginName as loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unionName as unionname,
|
||||
u.deptName as unitname,
|
||||
se.gdhAllName gdh_name
|
||||
FROM
|
||||
workers_congress_organization_user wo
|
||||
LEFT JOIN workers_congress_session se ON se.id = wo.gdh_id
|
||||
LEFT JOIN `user` u ON u.userId = wo.user_id
|
||||
$condition
|
||||
""");
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andEX("wo.gdh_id", "=", gdh_id);
|
||||
cnd.andEX("wo.organization_id", "=", organization_id);
|
||||
cnd.desc("wo.status");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = gdhOrganizationService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<Long, String> roleMap = new HashMap<>();
|
||||
roleList.forEach(item -> {
|
||||
roleMap.put(item.getLong("role_id"), item.getString("role_name"));
|
||||
});
|
||||
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
item.put("role_name", roleMap.get(item.getLong("role_id")));
|
||||
});
|
||||
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("delUser/{id}")
|
||||
@RequiresPermissions("workersCongress:gdhOrganization")
|
||||
public AjaxResult delUser(@PathVariable String id) {
|
||||
OrganizationUser organizationUser = dao.fetch(OrganizationUser.class, id);
|
||||
dao.clear(OrganizationUser.class, Cnd.where("id", "=", id));
|
||||
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("gdhid", "=", organizationUser.getGdh_id()),
|
||||
new FeignCnd("role_id", "=", organizationUser.getRole_id()),
|
||||
new FeignCnd("user_id", "=", organizationUser.getUser_id())
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("updateStatus")
|
||||
@RequiresPermissions("workersCongress:gdhOrganization")
|
||||
public AjaxResult updateStatus(String id, Integer status) {
|
||||
OrganizationUser organizationUser = dao.fetch(OrganizationUser.class, id);
|
||||
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("gdhid", "=", organizationUser.getGdh_id()),
|
||||
new FeignCnd("role_id", "=", organizationUser.getRole_id()),
|
||||
new FeignCnd("user_id", "=", organizationUser.getUser_id())
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cndList);
|
||||
|
||||
Chain chain = Chain.make("status", status);
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(organizationUser.getUser_id());
|
||||
userRole.setGdhid(organizationUser.getGdh_id());
|
||||
if ("gdhwyh1".equals(organizationUser.getOrganization_code())) {
|
||||
switch (status) {
|
||||
case 1 -> {
|
||||
userRole.setRoleId(Roles.GH_WYH_CY);
|
||||
chain.add("role_id", Roles.GH_WYH_CY);
|
||||
}
|
||||
case 2 -> {
|
||||
userRole.setRoleId(Roles.GH_WYH_FZX);
|
||||
chain.add("role_id", Roles.GH_WYH_FZX);
|
||||
}
|
||||
case 3 -> {
|
||||
userRole.setRoleId(Roles.GH_WYH_CWFZX);
|
||||
chain.add("role_id", Roles.GH_WYH_CWFZX);
|
||||
}
|
||||
case 4 -> {
|
||||
userRole.setRoleId(Roles.GH_WYH_ZX);
|
||||
chain.add("role_id", Roles.GH_WYH_ZX);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
dao.update(OrganizationUser.class, chain, Cnd.where("id", "=", id));
|
||||
dao.update(TeacherMeetCommission.class, Chain.make("stateCode",100), Cnd.where("userId","=",organizationUser.getUser_id()).and("gdhId","=", organizationUser.getGdh_id()));
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("getTreeData")
|
||||
@RequiresPermissions("workersCongress:gdhOrganization")
|
||||
public AjaxResult getTreeData() {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.addv("name", "工代会机构设置");
|
||||
List<SysDictData> gdhwyh = remoteDictService.dictType("gdhwyh").getData();
|
||||
List<NutMap> mapList = Lang.collection2list(gdhwyh, NutMap.class);
|
||||
mapList.forEach(item -> {
|
||||
item.setv("name", item.getString("dictLabel"));
|
||||
item.setv("id", item.getString("dictCode"));
|
||||
item.setv("code", item.getString("dictValue"));
|
||||
});
|
||||
nutMap.addv("children", mapList);
|
||||
return AjaxResult.success(nutMap);
|
||||
}
|
||||
|
||||
@GetMapping("getUserList")
|
||||
@RequiresPermissions("workersCongress:gdhOrganization")
|
||||
public AjaxResult getUserList(String gdh_id, String organization_id, String key) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
userId as id,
|
||||
userName as username,
|
||||
loginName as loginname,
|
||||
unionName as unionname,
|
||||
mobile,
|
||||
deptName as unitname
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
member = 1
|
||||
AND (userName like @key or loginName like @key)
|
||||
AND userId NOT IN (
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
workers_congress_organization_user
|
||||
WHERE
|
||||
gdh_id= @gdh_id
|
||||
AND organization_id= @organization_id)
|
||||
""").setParam("organization_id", organization_id).setParam("gdh_id", gdh_id).setParam("key", "%" + key + "%");
|
||||
Pagination pagination = gdhOrganizationService.listPage(1, 50, sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("workersCongress:gdhOrganization")
|
||||
public AjaxResult doAdd(@RequestBody OrganizationUser organizationUser) {
|
||||
int count = dao.count(OrganizationUser.class, Cnd.where("user_id", "=", organizationUser.getUser_id())
|
||||
.and("organization_id", "=", organizationUser.getOrganization_id()).and("gdh_id", "=", organizationUser.getGdh_id()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.success("人员已存在,请勿重复录入");
|
||||
}
|
||||
SysUserRole sysRole = new SysUserRole();
|
||||
sysRole.setUserId(organizationUser.getUser_id());
|
||||
sysRole.setGdhid(organizationUser.getGdh_id());
|
||||
if ("gdhwyh1".equals(organizationUser.getOrganization_code())) {
|
||||
switch (organizationUser.getStatus()) {
|
||||
case 1 -> {
|
||||
organizationUser.setRole_id(Roles.GH_WYH_CY);
|
||||
sysRole.setRoleId(Roles.GH_WYH_CY);
|
||||
}
|
||||
case 2 -> {
|
||||
organizationUser.setRole_id(Roles.GH_WYH_FZX);
|
||||
sysRole.setRoleId(Roles.GH_WYH_FZX);
|
||||
}
|
||||
case 3 -> {
|
||||
organizationUser.setRole_id(Roles.GH_WYH_CWFZX);
|
||||
sysRole.setRoleId(Roles.GH_WYH_CWFZX);
|
||||
}
|
||||
case 4 -> {
|
||||
organizationUser.setRole_id(Roles.GH_WYH_ZX);
|
||||
sysRole.setRoleId(Roles.GH_WYH_ZX);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
remoteUserRoleService.addUserRole(sysRole);
|
||||
dao.insert(organizationUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
package com.ruoyi.jdh.controller.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.jdh.api.domain.workersCongress.*;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhSessionManageService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description 工代会届次管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/workersCongress/sessionManage")
|
||||
public class GdhSessionManageController {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
private GdhSessionManageService gdhSessionManageService;
|
||||
|
||||
@Autowired
|
||||
public GdhSessionManageController(GdhSessionManageService gdhSessionManageService) {
|
||||
this.gdhSessionManageService = gdhSessionManageService;
|
||||
}
|
||||
|
||||
@PostMapping("pageData")
|
||||
@RequiresPermissions("workersCongress:sessionManage")
|
||||
public AjaxResult pageData(@RequestBody PageForm pageForm,
|
||||
@RequestParam(value = "year", required = false) Integer year,
|
||||
@RequestParam(value = "gdhJs", required = false) String gdhJs,
|
||||
@RequestParam(value = "gdhCs", required = false) String gdhCs) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("select * from workers_congress_session $condition");
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.andEX("gdhJs", "=", gdhJs);
|
||||
cnd.andEX("gdhCs", "=", gdhCs);
|
||||
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.desc("startTime");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = gdhSessionManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return AjaxResult.success(pagination);
|
||||
}
|
||||
|
||||
@PostMapping("doAdd")
|
||||
@RequiresPermissions("workersCongress:sessionManage")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult doAdd(@RequestBody Session workersCongressSession,
|
||||
@RequestParam(value = "isExtend", required = false) Boolean isExtend) {
|
||||
|
||||
//判断新建的教代会届次是否存在
|
||||
int count = dao.count(Session.class, Cnd.where("gdhJs", "=", workersCongressSession.getGdhJs()).and("gdhCs", "=", workersCongressSession.getGdhCs()));
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("当前届次的工代会已存在,无法重复创建!");
|
||||
}
|
||||
workersCongressSession.setStartState(true);
|
||||
workersCongressSession.setStartTime(DateUtils.getDate());
|
||||
Session insert = dao.insert(workersCongressSession);
|
||||
|
||||
if (isExtend) {
|
||||
Cnd preJdh = Cnd.NEW();
|
||||
preJdh.and("gdhJs", "=", workersCongressSession.getGdhJs()).and("gdhCs", "=", getCs(workersCongressSession.getGdhCs()));
|
||||
List<Record> preGdhxxList = dao.query("workers_congress_session", preJdh);
|
||||
//存在上一次教代会信息才能延用
|
||||
if (preGdhxxList.size() > 0) {
|
||||
String gdhId = preGdhxxList.get(0).getString("id");
|
||||
//代表团
|
||||
List<Delegation> dbtList = dao.query(Delegation.class, Cnd.where("gdh_id", "=", gdhId));
|
||||
dbtList.forEach(z -> {
|
||||
Delegation delegation = new Delegation();
|
||||
delegation.setGdh_id(insert.getId());
|
||||
delegation.setDbt_name(z.getDbt_name());
|
||||
delegation.setCode(z.getCode());
|
||||
delegation.setFound_time(DateUtils.getDate());
|
||||
Delegation dbtListNew = dao.insert(delegation);
|
||||
|
||||
//组成基层工会
|
||||
List<DelegationMakeUpUnion> zcfghList = dao.query(DelegationMakeUpUnion.class, Cnd.where("dbt_id", "=", z.getId()));
|
||||
zcfghList.forEach(zz -> {
|
||||
DelegationMakeUpUnion upUnion = new DelegationMakeUpUnion();
|
||||
upUnion.setDbt_id(dbtListNew.getId());
|
||||
upUnion.setGdh_id(insert.getId());
|
||||
upUnion.setUnion_id(zz.getUnion_id());
|
||||
dao.insert(upUnion);
|
||||
});
|
||||
//团长 副团长
|
||||
List<FeignCnd> cndList = List.of(
|
||||
new FeignCnd("jdhid", "=", gdhId),
|
||||
new FeignCnd("dbtid", "=", z.getId()),
|
||||
new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ))
|
||||
);
|
||||
List<SysUserRole> ftzList = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
|
||||
ftzList.forEach(tzftz -> {
|
||||
SysUserRole user_role = new SysUserRole();
|
||||
user_role.setUserId(tzftz.getUserId());
|
||||
user_role.setJdhid(insert.getId());
|
||||
user_role.setDbtid(dbtListNew.getId());
|
||||
user_role.setRoleId(tzftz.getRoleId());
|
||||
remoteUserRoleService.addUserRole(user_role);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//正式代表
|
||||
List<Representative> dbList = dao.query(Representative.class, Cnd.where("gdh_id", "=", gdhId));
|
||||
|
||||
List<Long> dbIdList = dbList.stream().map(db -> db.getUserId()).collect(Collectors.toList());
|
||||
List<NutMap> dbUserList = new ArrayList<>();
|
||||
|
||||
if (Lang.isNotEmpty(dbIdList)) {
|
||||
Sql sql = Sqls.create("select userId,deptId as unitId,deptName as unitName,unionId,unionName from user where userId in (@userIds)");
|
||||
sql.setParam("userIds", dbIdList);
|
||||
dbUserList = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
||||
}
|
||||
Map<Long, NutMap> dbUserMap = dbUserList.stream().collect(Collectors.toMap(v -> v.getLong("userId"), v -> v));
|
||||
|
||||
dbList.forEach(zzz -> {
|
||||
|
||||
Representative representative = new Representative();
|
||||
representative.setGdh_id(insert.getId());
|
||||
representative.setUserId(zzz.getUserId());
|
||||
representative.setRoleId(Roles.GDHDB);
|
||||
|
||||
representative.setUnitId(Optional.ofNullable(dbUserMap.get(zzz.getUserId())).map(u -> u.getString("unitId")).orElse(null));
|
||||
representative.setUnitName(Optional.ofNullable(dbUserMap.get(zzz.getUserId())).map(u -> u.getString("unitName")).orElse(null));
|
||||
representative.setUnionId(Optional.ofNullable(dbUserMap.get(zzz.getUserId())).map(u -> u.getString("unionId")).orElse(null));
|
||||
representative.setUnionName(Optional.ofNullable(dbUserMap.get(zzz.getUserId())).map(u -> u.getString("unionName")).orElse(null));
|
||||
|
||||
//看看用户的分工会属于哪个代表团
|
||||
DelegationMakeUpUnion makeUpUnion = dao.fetch(DelegationMakeUpUnion.class, Cnd.where("gdh_id", "=", insert.getId()).and("union_id", "=", representative.getUnionId()));
|
||||
representative.setDbt_id(Optional.ofNullable(makeUpUnion).map(mu -> mu.getDbt_id()).orElse(null));
|
||||
dao.insert(representative);
|
||||
|
||||
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(Roles.GDHDB);
|
||||
userRole.setJdhid(zzz.getGdh_id());
|
||||
userRole.setUserId(zzz.getUserId());
|
||||
userRole.setDbtid(Optional.ofNullable(makeUpUnion).map(mu -> mu.getDbt_id()).orElse(null));
|
||||
remoteUserRoleService.addUserRole(userRole);
|
||||
});
|
||||
|
||||
|
||||
//组织机构
|
||||
List<OrganizationUser> zzjgList = dao.query(OrganizationUser.class, Cnd.where("gdh_id", "=", gdhId));
|
||||
|
||||
zzjgList.forEach(jg -> {
|
||||
OrganizationUser organizationUser = new OrganizationUser();
|
||||
organizationUser.setUser_id(jg.getUser_id());
|
||||
organizationUser.setStatus(jg.getStatus());
|
||||
organizationUser.setOrganization_id(jg.getOrganization_id());
|
||||
organizationUser.setOrganization_name(jg.getOrganization_name());
|
||||
organizationUser.setOrganization_code(jg.getOrganization_code());
|
||||
organizationUser.setGdh_id(insert.getId());
|
||||
dao.insert(organizationUser);
|
||||
});
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("startStateChange")
|
||||
@RequiresPermissions("workersCongress:sessionManage")
|
||||
public AjaxResult startStateChange(Boolean startState, String id) {
|
||||
boolean state = !startState;
|
||||
int num = dao.update(Session.class, Chain.make("startState", state), Cnd.where("id", "=", id));
|
||||
return num >= 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PostMapping("doDelete")
|
||||
@RequiresPermissions("workersCongress:sessionManage")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult doDelete(String id) {
|
||||
|
||||
dao.clear(Session.class, Cnd.where("id", "=", id));
|
||||
dao.clear(Delegation.class, Cnd.where("gdh_id", "=", id));
|
||||
dao.clear(OrganizationUser.class, Cnd.where("gdh_id", "=", id));
|
||||
dao.clear(DelegationMakeUpUnion.class, Cnd.where("gdh_id", "=", id));
|
||||
dao.clear(Representative.class, Cnd.where("gdh_id", "=", id));
|
||||
|
||||
List<FeignCnd> cnd = List.of(
|
||||
new FeignCnd("jdhid", "=", id)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cnd);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("doEdit")
|
||||
@RequiresPermissions("workersCongress:sessionManage")
|
||||
public AjaxResult doEdit(@RequestBody Session workersCongressSession,
|
||||
@RequestParam(value = "isExtend", required = false) Boolean isExtend) {
|
||||
if (!isExtend) {
|
||||
workersCongressSession.setStartTime(DateUtils.getDate());
|
||||
dao.updateIgnoreNull(workersCongressSession);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
public static String getCs(String cs) {
|
||||
if (cs.equals("六")) {
|
||||
return "五";
|
||||
} else if (cs.equals("五")) {
|
||||
return "四";
|
||||
} else if (cs.equals("四")) {
|
||||
return "三";
|
||||
} else if (cs.equals("三")) {
|
||||
return "二";
|
||||
} else if (cs.equals("二")) {
|
||||
return "一";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.jdh.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.ColDefine;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.entity.annotation.Column;
|
||||
import org.nutz.dao.entity.annotation.Comment;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:UnionLimitVo
|
||||
* @Date 2024/5/21 11:48
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
public class UnionLimitVo {
|
||||
|
||||
private String id;
|
||||
private String unionname;
|
||||
private String unioncode;
|
||||
private Integer teacherCount;
|
||||
private Integer ratio;
|
||||
private Integer limitCount;
|
||||
private Integer seniorTeaNum;
|
||||
private Integer ordinaryTeaNum;
|
||||
private Integer femaleNum;
|
||||
private Integer less45Num;
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/21
|
||||
* @Description
|
||||
*/
|
||||
public interface DelegationManageService extends BaseService {
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*
|
||||
* @param pageForm:
|
||||
* @return com.ruoyi.common.core.page.Pagination
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String jdhid, String dbtid);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description
|
||||
*/
|
||||
public interface DeputyPushService extends BaseService {
|
||||
|
||||
NutMap getUnionDb(String teacherMeetId,Boolean isSwitch,String unionId);
|
||||
|
||||
String validSubmit(String teacherMeetId, String unionId);
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description
|
||||
*/
|
||||
public interface DeputyReadInfoService extends BaseService {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:IDeputyWriteService
|
||||
* @Date 2024/5/15 18:03
|
||||
* @注释
|
||||
*/
|
||||
public interface IDeputyWriteService extends BaseService {
|
||||
|
||||
NutMap findWriteById(String id);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.api.domain.workData.Jdh_gzzllx;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description
|
||||
*/
|
||||
public interface JdhCommonService extends BaseService {
|
||||
|
||||
/***
|
||||
* 获取所有教代会信息
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @return java.util.List<com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx>
|
||||
*/
|
||||
List<Jdh_jdhxx> getAllJdhxx();
|
||||
|
||||
/***
|
||||
* 获取所有开启的教代会
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
* @return java.util.List<com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx>
|
||||
*/
|
||||
List<Jdh_jdhxx> getOpenJdhxx();
|
||||
|
||||
/***
|
||||
* 获取教代会工作资料类型
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @return java.util.List<com.ruoyi.jdh.api.domain.prepare.Jdh_gzzllx>
|
||||
*/
|
||||
List<Jdh_gzzllx> getGzzllx();
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgcy;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgsz;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description
|
||||
*/
|
||||
public interface JdhOrganizationService extends BaseService {
|
||||
|
||||
/**
|
||||
* 教代会机构设置获取树形数据
|
||||
*
|
||||
* @return java.util.List<com.ruoyi.jdh.api.domain.prepare.Jdh_jgsz>
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
*/
|
||||
List<Jdh_jgsz> getTreeData();
|
||||
|
||||
/**
|
||||
* 查询机构
|
||||
*
|
||||
* @param pageForm:
|
||||
* @param parentId:
|
||||
* @return com.ruoyi.common.core.page.Pagination
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String parentId, String jdhid);
|
||||
|
||||
/**
|
||||
* 机构设置新增
|
||||
*
|
||||
* @param jdh_jgsz:
|
||||
* @return java.lang.Boolean
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Boolean doAdd(Jdh_jgsz jdh_jgsz);
|
||||
|
||||
/**
|
||||
* 机构设置修改
|
||||
*
|
||||
* @param jdh_jgsz:
|
||||
* @return java.lang.Boolean
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Boolean doEdit(Jdh_jgsz jdh_jgsz);
|
||||
|
||||
/**
|
||||
* 删除机构
|
||||
*
|
||||
* @param id:
|
||||
* @return java.lang.Boolean
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Boolean doDelete(String id);
|
||||
|
||||
/**
|
||||
* 查询委员
|
||||
*
|
||||
* @param pageForm:
|
||||
* @param jdhid:
|
||||
* @param jgid:
|
||||
* @return com.ruoyi.common.core.page.Pagination
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Pagination cyPageData(PageForm pageForm, String jdhid, String jgid);
|
||||
|
||||
/**
|
||||
* 设置委员
|
||||
*
|
||||
* @param jdh_jgcy:
|
||||
* @return java.lang.Boolean
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
Boolean doSaveCy(Jdh_jgcy jdh_jgcy);
|
||||
|
||||
/**
|
||||
* 删除委员
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/21
|
||||
* @param jdh_jgcy:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doDeleteCy(Jdh_jgcy jdh_jgcy);
|
||||
|
||||
/**
|
||||
* 修改委员身份
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/21
|
||||
* @param jdh_jgcy: 旧信息
|
||||
* @param roleId: 新角色id
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean updateSf(Jdh_jgcy jdh_jgcy, long roleId);
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_cbwj;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/16
|
||||
* @Description 教代会筹备
|
||||
*/
|
||||
public interface JdhPrepareService extends BaseService {
|
||||
|
||||
/***
|
||||
* 分页查询教代会信息
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/16
|
||||
* @param pageForm: 分页
|
||||
* @param searchYear: 年份
|
||||
* @param jdhjs: 届数
|
||||
* @param jdhcs: 次数
|
||||
* @return com.ruoyi.common.core.web.domain.AjaxResult
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String searchYear, String jdhjs, String jdhcs);
|
||||
|
||||
/***
|
||||
* 新增教代会
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/16
|
||||
* @param jdhxx: 教代会实体类
|
||||
* @param isExtend: 是否继承上一届教代会信息
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doAdd(Jdh_jdhxx jdhxx, Boolean isExtend);
|
||||
|
||||
/***
|
||||
* 修改教代会
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/16
|
||||
* @param jdhxx: 教代会实体类
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doEdit(Jdh_jdhxx jdhxx);
|
||||
|
||||
/**
|
||||
* 查询教代会是否存在
|
||||
*
|
||||
* @param jdhxx: 教代会实体类
|
||||
* @return java.lang.Boolean
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/16
|
||||
*/
|
||||
Boolean jdhIsExist(Jdh_jdhxx jdhxx);
|
||||
|
||||
/***
|
||||
* 修改教代会状态
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/16
|
||||
* @param id: 教代会id
|
||||
* @param status: 状态
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean jdhztChange(String id, boolean status);
|
||||
|
||||
/***
|
||||
* 删除教代会
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param id: 教代会id
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doDelete(String id);
|
||||
|
||||
/***
|
||||
* 筹备文件查询表格数据
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param pageForm:
|
||||
* @param zlname:
|
||||
* @param union_id:
|
||||
* @param jdhid:
|
||||
* @param zllx:
|
||||
* @return com.ruoyi.common.core.web.domain.AjaxResult
|
||||
*/
|
||||
Pagination prepareFilePageData(PageForm pageForm, String zlname, String union_id, String jdhid, String zllx);
|
||||
|
||||
/***
|
||||
* 筹备文件新增
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param cbwj:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean prepareFileAdd(Jdh_cbwj cbwj);
|
||||
|
||||
/***
|
||||
* 筹备文件修改
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param cbwj:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean prepareFileEdit(Jdh_cbwj cbwj);
|
||||
|
||||
/***
|
||||
* 筹备文件删除
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param id:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean prepareFileDoDelete(String id);
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/25
|
||||
* @Description
|
||||
*/
|
||||
public interface MeetingActivityManageService extends BaseService {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/26
|
||||
* @Description
|
||||
*/
|
||||
public interface WorkDataTypeService extends BaseService {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.jdh.service.election;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
public interface ICommissionerService extends BaseService {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.jdh.service.executiveCommittee;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeConfig;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfigService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:31
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface ExecutiveCommitteeConfigService extends BaseService<ExecutiveCommitteeConfig> {
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.DelegationManageService;
|
||||
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.Strings;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/21
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class DelegationManageServiceImpl extends BaseServiceImpl implements DelegationManageService {
|
||||
|
||||
public DelegationManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String jdhid, String dbtid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,
|
||||
jdh.jdhallname,
|
||||
jdh.jdhkqsj
|
||||
FROM
|
||||
jdh_dbt dbt
|
||||
LEFT JOIN jdh_dbt_zcfgh jdz ON jdz.dbtid = dbt.id
|
||||
AND jdz.jdhid = dbt.jdhid
|
||||
LEFT JOIN jdh_jdhxx jdh ON dbt.`jdhid` = dbt.jdhid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("jdh.jdhkqzt", "=", 1).and("dbt.jdhid", "=", jdhid);
|
||||
|
||||
if (Strings.isNotBlank(dbtid)) {
|
||||
cnd.and("dbt.id", "=", dbtid);
|
||||
}
|
||||
|
||||
cnd.groupBy("dbt.id");
|
||||
cnd.asc("dbt.code");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_mefp;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.service.DeputyPushService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class DeputyPushServiceImpl extends BaseServiceImpl implements DeputyPushService {
|
||||
|
||||
|
||||
|
||||
public DeputyPushServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NutMap getUnionDb(String teacherMeetId, Boolean isSwitch, String unionId) {
|
||||
if (!AuthUtil.hasAnyRoles("admin,A06")){
|
||||
unionId = Strings.isNotBlank(unionId) ? unionId : SecurityUtils.getUnionId();
|
||||
}
|
||||
|
||||
if (!isSwitch){
|
||||
unionId = SecurityUtils.getUnionId();
|
||||
}
|
||||
|
||||
//代表总名额
|
||||
int allDeputies = 0;
|
||||
|
||||
//查正式代表
|
||||
Cnd jdhDeputiesCnd = Cnd.NEW();
|
||||
jdhDeputiesCnd.and("jdhid","=",teacherMeetId);
|
||||
jdhDeputiesCnd.and("roleid","=", Roles.ZSDB);
|
||||
|
||||
//查推选的代表
|
||||
Cnd pushDeputiesCnd = Cnd.NEW();
|
||||
pushDeputiesCnd.and("tmd.teacherMeetId","=",teacherMeetId);
|
||||
pushDeputiesCnd.and("tmd.stateCode","in", Lang.list(0,100,300));
|
||||
pushDeputiesCnd.and("tmd.representativeType","=","正式代表");
|
||||
|
||||
//查已上报的
|
||||
Cnd determineCnd = Cnd.NEW();
|
||||
determineCnd.and("tmd.teacherMeetId","=",teacherMeetId);
|
||||
determineCnd.and("tmd.stateCode","in",Lang.list(100,300));
|
||||
determineCnd.and("tmd.representativeType","=","正式代表");
|
||||
|
||||
jdhDeputiesCnd.andEX("dbfghid", "=", unionId);
|
||||
//推选的正式代表人数()
|
||||
pushDeputiesCnd.andEX("u.unionid", "=", unionId);
|
||||
//上报的正式代表人数
|
||||
determineCnd.andEX("u.unionid", "=", unionId);
|
||||
|
||||
NutMap nutMap = new NutMap();
|
||||
|
||||
if (AuthUtil.hasAnyRoles("admin,A06") && isSwitch){
|
||||
//如果是系统管理员,查看全部代表
|
||||
List<Jdh_mefp> allMeNum = dao().query(Jdh_mefp.class, Cnd.where("jdhid", "=", teacherMeetId));
|
||||
if (Lang.isNotEmpty(allMeNum)){
|
||||
//查找名额分配表的分配数
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
(select fps from `jdh_mefp` where fghid = dbt.id and jdhid = @jdhid) as fps
|
||||
FROM
|
||||
`union` dbt
|
||||
$condition
|
||||
""").setParam("jdhid",teacherMeetId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt.id","=",unionId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
allDeputies = list.stream().mapToInt(v -> v.getInt("fps")).sum();
|
||||
|
||||
// allDeputies = allMeNum.stream().mapToInt(Jdh_mefp::getFps).sum();
|
||||
// int sum = allMeNum.stream().mapToInt(Jdh_mefp::getFps).sum();
|
||||
// List<String> collect = allMeNum.stream().map(Jdh_mefp::getFghid).collect(Collectors.toList());
|
||||
// //查询没有被分配名额的工会
|
||||
// int count = baseService.dao().count(User.class, Cnd.where("unionid", "not in", collect).and("member", "=", 1));
|
||||
// //没有分配,就会员*0.09
|
||||
// int otherUnionNum = (int) Math.round(count * 0.09);
|
||||
// allDeputies = sum + otherUnionNum;
|
||||
} else {
|
||||
int count = dao().count("`user`", Cnd.where("member", "=", 1));
|
||||
allDeputies = (int) Math.round(count * 0.09);
|
||||
}
|
||||
Record union = dao().fetch("`union`", Cnd.where("id", "=", unionId));
|
||||
nutMap.setv("unionname",Strings.isNotBlank(unionId) ? union.getString("unionName") : "全部分工会");
|
||||
} else {
|
||||
//看分工会的
|
||||
Jdh_mefp unionDeputiesNum = dao().fetch(Jdh_mefp.class, Cnd.where("jdhid", "=", teacherMeetId).and("fghid", "=", unionId));
|
||||
if (Lang.isNotEmpty(unionDeputiesNum)){
|
||||
allDeputies = unionDeputiesNum.getFps();
|
||||
}else {
|
||||
int unionPeoNum = dao().count("`user`", Cnd.where("unionid", "=", unionId).and("member","=",1));
|
||||
allDeputies = (int) Math.round(unionPeoNum * 0.09);
|
||||
}
|
||||
|
||||
nutMap.setv("unionname",SecurityUtils.getUnion().getUnionName());
|
||||
}
|
||||
|
||||
jdhDeputiesCnd.groupBy("dbid");
|
||||
//查询已将上报的代表和正式代表
|
||||
int jdhDeputies = dao().count(Jdh_db.class, jdhDeputiesCnd);
|
||||
|
||||
//推选的代表数
|
||||
Sql pushSql = Sqls.create("select count(1) from `teacher_meet_delegate` tmd left join `user` u on u.userId = tmd.userId $condition");
|
||||
pushSql.setCondition(pushDeputiesCnd);
|
||||
int pushDeputies = count(pushSql);
|
||||
|
||||
//上报的代表数
|
||||
Sql determineSql = Sqls.create("select count(1) from `teacher_meet_delegate` tmd left join `user` u on u.userId = tmd.userId $condition");
|
||||
determineSql.setCondition(determineCnd);
|
||||
int determineDeputies = count(determineSql);
|
||||
|
||||
nutMap.setv("pushDeputies",pushDeputies);
|
||||
nutMap.setv("determineDeputies",determineDeputies);
|
||||
nutMap.setv("allDeputies",allDeputies);
|
||||
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String validSubmit(String teacherMeetId, String unionId) {
|
||||
Jdh_mefp mefp = dao().fetch(Jdh_mefp.class, Cnd.where("jdhid", "=", teacherMeetId).and("fghid", "=", unionId));
|
||||
|
||||
// 查询单位已上报的名单
|
||||
List<TeacherMeetDelegate> writeList = dao().query(TeacherMeetDelegate.class, Cnd.where("unionid", "=", unionId)
|
||||
.and("representativeType", "=", "正式代表"));
|
||||
|
||||
// 上报总人数
|
||||
int total = writeList.size();
|
||||
// 女代表人数
|
||||
int female = (int) writeList.stream().filter(v -> "1".equals(v.getSex())).count();
|
||||
// 高级职称专任教师人数
|
||||
int seniorTeacher = (int) writeList.stream().filter(TeacherMeetDelegate::getSeniorTeacher).count();
|
||||
// 专任教师人数
|
||||
int ordinaryTeacher = (int) writeList.stream().filter(TeacherMeetDelegate::getOrdinaryTeacher).count();
|
||||
// 45岁以下代表
|
||||
int under45 = (int) writeList.stream().filter(v -> Convert.toInt(v.getAge(), 0) <= 45).count();
|
||||
|
||||
StringBuffer tips = new StringBuffer();
|
||||
|
||||
if (total > mefp.getQuota()) {
|
||||
tips.append("上报总人数超出分配名额!");
|
||||
}
|
||||
if (total < mefp.getQuota()) {
|
||||
tips.append("上报总人数不足分配名额!");
|
||||
}
|
||||
|
||||
if (female < mefp.getFemaleNum()) {
|
||||
tips.append("女教师代表数不满足分配名额数!");
|
||||
}
|
||||
|
||||
if (seniorTeacher < mefp.getSeniorTeaNum()) {
|
||||
tips.append("高级职称专任教师数不满足分配名额数!");
|
||||
}
|
||||
|
||||
if (ordinaryTeacher < mefp.getOrdinaryTeaNum()) {
|
||||
tips.append("专任教师数不满足分配名额数!");
|
||||
}
|
||||
|
||||
if (under45 < mefp.getLess45Num()) {
|
||||
tips.append("45岁以下教师代表数不满足分配名额数!");
|
||||
}
|
||||
|
||||
return tips.toString();
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.DeputyReadInfoService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/23
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class DeputyReadInfoServiceImpl extends BaseServiceImpl implements DeputyReadInfoService {
|
||||
|
||||
public DeputyReadInfoServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.common.Audit;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetWrite;
|
||||
import com.ruoyi.jdh.service.IDeputyWriteService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:DeputyWriteServicrImpl
|
||||
* @Date 2024/5/15 18:03
|
||||
* @注释
|
||||
*/
|
||||
@Service
|
||||
public class DeputyWriteServiceImpl extends BaseServiceImpl implements IDeputyWriteService {
|
||||
public DeputyWriteServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findWriteById(String userId) {
|
||||
try {
|
||||
TeacherMeetWrite meetWrite = dao().fetch(TeacherMeetWrite.class, Cnd.where("userId", "=", Strings.isNotBlank(userId) ? userId : SecurityUtils.getUserId()));
|
||||
NutMap nutMap = Lang.obj2nutmap(meetWrite);
|
||||
nutMap.setv("deptname",meetWrite.getUnitname());
|
||||
nutMap.setv("writeExportTime", DateUtil.format(DateUtil.parse(nutMap.getString("writeTime")), "yyyy年MM月dd日"));
|
||||
nutMap.setv("birthday",nutMap.getString("age"));
|
||||
|
||||
if (Strings.isNotBlank(meetWrite.getUnionAuditId())) {
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", meetWrite.getUnionAuditId()));
|
||||
nutMap.setv("unionAudit", audit);
|
||||
}
|
||||
if (Strings.isNotBlank(meetWrite.getTwoOrganizationAuditId())) {
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", meetWrite.getTwoOrganizationAuditId()));
|
||||
nutMap.setv("twoOrganizationAudit", audit);
|
||||
}
|
||||
if (Strings.isNotBlank(meetWrite.getSchoolAuditId())) {
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", meetWrite.getSchoolAuditId()));
|
||||
nutMap.setv("schoolAudit", audit);
|
||||
}
|
||||
return nutMap;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jdhxx;
|
||||
import com.ruoyi.jdh.api.domain.workData.Jdh_gzzllx;
|
||||
import com.ruoyi.jdh.service.JdhCommonService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class JdhCommonServiceImpl extends BaseServiceImpl implements JdhCommonService {
|
||||
|
||||
public JdhCommonServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Jdh_jdhxx> getAllJdhxx() {
|
||||
return dao().query(Jdh_jdhxx.class, Cnd.NEW().desc("jdhkqsj"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Jdh_jdhxx> getOpenJdhxx() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("jdhkqzt", "=", 1).desc("jdhkqsj");
|
||||
return dao().query(Jdh_jdhxx.class, cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Jdh_gzzllx> getGzzllx() {
|
||||
return dao().query(Jdh_gzzllx.class, Cnd.NEW().asc("xh"));
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgcy;
|
||||
import com.ruoyi.jdh.api.domain.prepare.Jdh_jgsz;
|
||||
import com.ruoyi.jdh.service.JdhOrganizationService;
|
||||
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.Strings;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/19
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class JdhOrganizationServiceImpl extends BaseServiceImpl implements JdhOrganizationService {
|
||||
|
||||
public JdhOrganizationServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Jdh_jgsz> getTreeData() {
|
||||
List<Jdh_jgsz> list = new ArrayList();
|
||||
Jdh_jgsz jdhJgsz = dao().fetch(Jdh_jgsz.class, Cnd.where("parentId", "=", "0"));
|
||||
if (jdhJgsz != null) {
|
||||
jdhJgsz.setChildren(child(jdhJgsz.getId()));
|
||||
list.add(jdhJgsz);
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String parentId, String jdhid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT jgsz.*,jdh.jdhallname FROM `jdh_jgsz` jgsz LEFT JOIN jdh_jdhxx jdh ON jdh.id=jgsz.jdhid $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("jgsz.mechanismcode");
|
||||
cnd.andEX("parentId", "=", StringUtils.isBlank(parentId) ? "5972c34ff68e4b0cbc6d0834fe88982b" : parentId);
|
||||
/* cnd.andExcludeEmpty("jgsz.jdhid", "=", jdhid);*/
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doAdd(Jdh_jgsz jdh_jgsz) {
|
||||
int count = dao().count(Jdh_jgsz.class, Cnd.where("mechanismcode", "=", jdh_jgsz.getMechanismcode()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("机构代码已存在!");
|
||||
}
|
||||
dao().update("jdh_jgsz", Chain.make("hasChildren", true), Cnd.where("id", "=", jdh_jgsz.getParentId()));
|
||||
Jdh_jgsz jgsz = dao().insert(jdh_jgsz);
|
||||
return jgsz != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doEdit(Jdh_jgsz jdh_jgsz) {
|
||||
int i = dao().updateIgnoreNull(jdh_jgsz);
|
||||
return i > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doDelete(String id) {
|
||||
|
||||
int num = dao().delete(Jdh_jgsz.class, id);
|
||||
dao().clear(Jdh_jgcy.class, Cnd.where("jgid", "=", id));
|
||||
return num > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination cyPageData(PageForm pageForm, String jdhid, String jgid) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cy.*,
|
||||
us.userName,
|
||||
us.mobile,
|
||||
us.deptName,
|
||||
us.deptCode,
|
||||
us.sex,
|
||||
us.loginName,
|
||||
jdh.jdhallname
|
||||
FROM
|
||||
jdh_jgcy cy
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id=cy.jdhid
|
||||
LEFT JOIN `user` us ON us.userId = cy.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("cy.jgid", "=", jgid);
|
||||
cnd.andEX("cy.jdhid", "=", jdhid);
|
||||
cnd.desc("cy.sf");
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doSaveCy(Jdh_jgcy jdh_jgcy) {
|
||||
Jdh_jgcy jgcy = dao().insert(jdh_jgcy);
|
||||
return jgcy != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doDeleteCy(Jdh_jgcy jdh_jgcy) {
|
||||
int num = dao().delete(Jdh_jgcy.class, jdh_jgcy.getId());
|
||||
return num > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateSf(Jdh_jgcy jdh_jgcy, long roleId) {
|
||||
jdh_jgcy.setRoleId(roleId);
|
||||
int i = dao().updateIgnoreNull(jdh_jgcy);
|
||||
return i >= 0;
|
||||
}
|
||||
|
||||
private List<Jdh_jgsz> child(String parentId) {
|
||||
List<Jdh_jgsz> jgsz = dao().query(Jdh_jgsz.class, Cnd.where("parentId", "=", parentId).asc("mechanismcode"));
|
||||
jgsz.stream().forEach(jdhJgsz -> {
|
||||
jdhJgsz.setChildren(child(jdhJgsz.getId()));
|
||||
});
|
||||
return jgsz;
|
||||
}
|
||||
}
|
||||
+458
@@ -0,0 +1,458 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.constant.Roles;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetDelegate;
|
||||
import com.ruoyi.jdh.api.domain.db.TeacherMeetWrite;
|
||||
import com.ruoyi.jdh.api.domain.election.TeacherMeetCommission;
|
||||
import com.ruoyi.jdh.api.domain.prepare.*;
|
||||
import com.ruoyi.jdh.service.JdhPrepareService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.RemoteUserService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import com.ruoyi.system.api.model.FeignCnd;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.trans.Trans;
|
||||
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;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/16
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class JdhPrepareServiceImpl extends BaseServiceImpl implements JdhPrepareService {
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
public JdhPrepareServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String searchYear, String jdhjs, String jdhcs) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(searchYear)) {
|
||||
cnd.and("jdhnf", "=", searchYear);
|
||||
}
|
||||
if (Strings.isNotBlank(jdhjs)) {
|
||||
cnd.and("jdhjs", "=", jdhjs);
|
||||
}
|
||||
if (Strings.isNotBlank(jdhcs)) {
|
||||
cnd.and("jdhcs", "=", jdhcs);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.desc("jdhkqsj").desc("jdhjs").desc("jdhcs");
|
||||
}
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), "jdh_jdhxx", cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doAdd(Jdh_jdhxx jdhxx, Boolean isExtend) {
|
||||
jdhxx.setId(R.UU32());
|
||||
jdhxx.setJdhkqzt(true);
|
||||
jdhxx.setJdhkqsj(DateUtils.getTime());
|
||||
jdhxx.setJdhallname(jdhxx.getJdhjs() + "届" + jdhxx.getJdhcs() + "次");
|
||||
dao().insert("jdh_jdhxx", Chain.from(jdhxx));
|
||||
|
||||
try {
|
||||
//是否继承上一次教代会的数据
|
||||
if (isExtend) {
|
||||
//根据此次教代会信息找到上一次教代会的信息
|
||||
Cnd preJdh = Cnd.NEW();
|
||||
preJdh.and("jdhjs", "=", jdhxx.getJdhjs()).and("jdhcs", "=", getCs(jdhxx.getJdhcs()));
|
||||
List<Record> preJdhxxList = dao().query("jdh_jdhxx", preJdh);
|
||||
//存在上一次教代会信息才能延用
|
||||
if (preJdhxxList.size() > 0) {
|
||||
String oldjdhid = preJdhxxList.get(0).getString("id");
|
||||
this.extendPreJdh(oldjdhid, jdhxx.getId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doEdit(Jdh_jdhxx jdhxx) {
|
||||
jdhxx.setJdhallname(jdhxx.getJdhjs() + "届" + jdhxx.getJdhcs() + "次");
|
||||
int result = dao().update(jdhxx);
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean jdhIsExist(Jdh_jdhxx jdhxx) {
|
||||
//判断新建的教代会届次是否存在
|
||||
int count = dao().count("jdh_jdhxx", Cnd.where("jdhjs", "=", jdhxx.getJdhjs()).and("jdhcs", "=", jdhxx.getJdhcs()));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean jdhztChange(String id, boolean status) {
|
||||
int result = dao().update("jdh_jdhxx", Chain.make("jdhkqzt", !status), Cnd.where("id", "=", id));
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean doDelete(String id) {
|
||||
|
||||
Cnd jdhcnd = Cnd.where("jdhid", "=", id);
|
||||
dao().clear("jdh_jdhxx", Cnd.where("id", "=", id));
|
||||
dao().clear("jdh_dbt", jdhcnd);
|
||||
dao().clear("jdh_dbt_zcfgh", jdhcnd);
|
||||
|
||||
//删除筹备文件
|
||||
dao().clear("jdh_cbwj", Cnd.where("jdhid", "=", id));
|
||||
|
||||
//删除机构
|
||||
dao().clear(Jdh_jgsz.class, Cnd.where("jdhid", "=", id));
|
||||
//删除机构成员
|
||||
dao().clear(Jdh_jgcy.class, Cnd.where("jdhid", "=", id));
|
||||
|
||||
//删除正式代表
|
||||
dao().clear("jdh_db", jdhcnd);
|
||||
|
||||
//删除列席特邀代表
|
||||
dao().clear("jdh_lxty_db", jdhcnd);
|
||||
|
||||
List<Record> hyhdList = list(Sqls.create("select * from jdh_hyhd where jdhid = @jdhid").setParam("jdhid", id));
|
||||
for (Record hyhd : hyhdList) {
|
||||
//删除会议活动成员
|
||||
dao().clear("jdh_hyhd_cy", Cnd.where("hyhdid", "=", hyhd.getString("id")));
|
||||
}
|
||||
//删除会议活动信息
|
||||
dao().clear("jdh_hyhd", jdhcnd);
|
||||
|
||||
//删除名额分配(旧)
|
||||
dao().clear(Jdh_mefp.class, Cnd.where("jdhid", "=", id));
|
||||
|
||||
//删除名额分配
|
||||
dao().clear(Jdh_quotaAllocation.class, Cnd.where("teacherMeetId", "=", id));
|
||||
|
||||
//删除代表推选
|
||||
dao().clear(TeacherMeetCommission.class, Cnd.where("teacherMeetId", "=", id));
|
||||
dao().clear(TeacherMeetDelegate.class, Cnd.where("teacherMeetId", "=", id));
|
||||
// dao().clear(TeacherMeetWrite.class, Cnd.where("teacherMeetId", "=", id));
|
||||
|
||||
//删除用户权限
|
||||
List<FeignCnd> cnds = List.of(
|
||||
new FeignCnd("jdhid", "=", id)
|
||||
);
|
||||
remoteUserRoleService.delUserRole(cnds);
|
||||
|
||||
//删除提案信息表
|
||||
/* List<Record> taxxList = list(Sqls.create("select * from ta_xx where jdh_id = @id").setParam("id", id));
|
||||
for (Record ta : taxxList) {
|
||||
//附议表
|
||||
dao().clear("ta_fy", Cnd.where("ta_id", "=", ta.getString("id")));
|
||||
//答复表
|
||||
dao().clear("ta_df", Cnd.where("ta_id", "=", ta.getString("id")));
|
||||
//反馈评价
|
||||
dao().clear("ta_fkpj", Cnd.where("ta_id", "=", ta.getString("id")));
|
||||
}
|
||||
dao().clear("ta_xx", Cnd.where("jdh_id", "=", id));*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination prepareFilePageData(PageForm pageForm, String zlname, String union_id, String jdhid, String zllx) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cbwj.*,
|
||||
jdh.jdhallname,
|
||||
lx.lxname
|
||||
FROM
|
||||
jdh_cbwj cbwj
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = cbwj.jdhid
|
||||
LEFT JOIN jdh_gzzllx lx ON lx.id = cbwj.zllx
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
}
|
||||
if (Strings.isNotBlank(zlname)) {
|
||||
cnd.and("cbwj.zlname", "like", "%" + zlname + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(jdhid)) {
|
||||
cnd.and("cbwj.jdhid", "=", jdhid);
|
||||
}
|
||||
if (Strings.isNotBlank(zllx)) {
|
||||
cnd.and("cbwj.zllx", "=", zllx);
|
||||
}
|
||||
if (!AuthUtil.hasAnyRoles("admin, A06")) {
|
||||
cnd.and("u.unionid", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
cnd.desc("jdh.jdhallname");
|
||||
sql.setCondition(cnd);
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean prepareFileAdd(Jdh_cbwj jdh_cbwj) {
|
||||
String id = R.UU32();
|
||||
jdh_cbwj.setId(id);
|
||||
jdh_cbwj.setUserid(SecurityUtils.getUserId());
|
||||
jdh_cbwj.setUsername(SecurityUtils.getUsername());
|
||||
jdh_cbwj.setTime(DateUtils.getDate());
|
||||
dao().insert("jdh_cbwj", Chain.from(jdh_cbwj));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean prepareFileEdit(Jdh_cbwj jdh_cbwj) {
|
||||
int num = dao().update("jdh_cbwj", Chain.from(jdh_cbwj), Cnd.where("id", "=", jdh_cbwj.getId()));
|
||||
return num > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean prepareFileDoDelete(String id) {
|
||||
int num = dao().clear("jdh_cbwj", Cnd.where("id", "=", id));
|
||||
return num > 0;
|
||||
}
|
||||
|
||||
|
||||
private void extendPreJdh(String oldid, String newid) {
|
||||
//机构成员复用
|
||||
List<Jdh_jgcy> jgcyList = dao().query(Jdh_jgcy.class, Cnd.where("jdhid", "=", oldid));
|
||||
List<Jdh_jgcy> newJgcyList = new ArrayList<>();
|
||||
jgcyList.forEach(item -> {
|
||||
item.setId(R.UU32());
|
||||
item.setJdhid(newid);
|
||||
newJgcyList.add(item);
|
||||
});
|
||||
dao().insert(newJgcyList);
|
||||
|
||||
//代表团复用
|
||||
List<Jdh_dbt> lastSessionDelegations = dao().query(Jdh_dbt.class, Cnd.where("jdhid", "=", oldid));
|
||||
|
||||
for (Jdh_dbt lastSessionDelegation : lastSessionDelegations) {
|
||||
//新增代表团
|
||||
Jdh_dbt newSessionDelegation = new Jdh_dbt();
|
||||
Lang.copyProperties(lastSessionDelegation, newSessionDelegation);
|
||||
newSessionDelegation.setId(R.UU32());
|
||||
newSessionDelegation.setCjsj(DateUtil.now());
|
||||
newSessionDelegation.setJdhid(newid);
|
||||
dao().fastInsert(newSessionDelegation);
|
||||
|
||||
//组成基层工会
|
||||
List<Jdh_dbt_zcfgh> lastSessionComposeUnions = dao().query(Jdh_dbt_zcfgh.class, Cnd.where("dbtid", "=", lastSessionDelegation.getId()));
|
||||
List<Jdh_dbt_zcfgh> newSessionComposeUnions = lastSessionComposeUnions.stream().map(v -> {
|
||||
v.setId(R.UU32());
|
||||
v.setJdhid(newid);
|
||||
v.setDbtid(newSessionDelegation.getId());
|
||||
return v;
|
||||
}).collect(Collectors.toList());
|
||||
dao().fastInsert(newSessionComposeUnions);
|
||||
|
||||
//组成二级单位
|
||||
List<Jdh_dbt_zcdw> lastSessionComposeUnits = dao().query(Jdh_dbt_zcdw.class, Cnd.where("dbtid", "=", lastSessionDelegation.getId()));
|
||||
List<Jdh_dbt_zcdw> newSessionComposeUnits = lastSessionComposeUnits.stream().map(v -> {
|
||||
v.setId(R.UU32());
|
||||
v.setJdhid(newid);
|
||||
v.setDbtid(newSessionDelegation.getId());
|
||||
return v;
|
||||
}).collect(Collectors.toList());
|
||||
dao().fastInsert(newSessionComposeUnits);
|
||||
|
||||
//团长、副团长权限
|
||||
com.ruoyi.common.core.domain.R<List<SysUserRole>> lastSessionLeaderRolesR = remoteUserRoleService.getUserRole(List.of(new FeignCnd("dbtid", "=", lastSessionDelegation.getId()),
|
||||
new FeignCnd("role_id", "in", Lang.array(Roles.DBT_TZ, Roles.DBT_FTZ))));
|
||||
if (lastSessionLeaderRolesR.getCode() == com.ruoyi.common.core.domain.R.FAIL) {
|
||||
throw new ServiceException(lastSessionLeaderRolesR.getMsg());
|
||||
}
|
||||
List<SysUserRole> lastSessionLeaderRoles = lastSessionLeaderRolesR.getData();
|
||||
List<SysUserRole> newSessionLeaderRoles = lastSessionLeaderRoles.stream().map(v -> {
|
||||
SysUserRole newUserRole = new SysUserRole();
|
||||
Lang.copyProperties(v, newUserRole);
|
||||
newUserRole.setJdhid(newid);
|
||||
newUserRole.setDbtid(newSessionDelegation.getId());
|
||||
return newUserRole;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
com.ruoyi.common.core.domain.R<Boolean> addUserRolesR = remoteUserRoleService.addUserRoles(newSessionLeaderRoles);
|
||||
if (addUserRolesR.getCode() == com.ruoyi.common.core.domain.R.FAIL) {
|
||||
throw new ServiceException(addUserRolesR.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
//代表
|
||||
List<Jdh_db> lastSessionRepresentatives = dao().query(Jdh_db.class, Cnd.where("jdhid", "=", oldid));
|
||||
List<Jdh_db> newSessionRepresentatives = lastSessionRepresentatives.stream().map(v -> {
|
||||
Jdh_db newSessionRepresentative = new Jdh_db();
|
||||
Lang.copyProperties(v, newSessionRepresentative);
|
||||
|
||||
newSessionRepresentative.setId(R.UU32());
|
||||
newSessionRepresentative.setJdhid(newid);
|
||||
//查询该代表最新的单位和分工会信息、代表团信息
|
||||
Sql userSql = Sqls.create("select deptId,deptCode,deptName,unionId,unionName,unionCode from user where userId = @userId").setParam("userId", v.getDbid());
|
||||
NutMap userMap = (NutMap) Daos.query(dao(), userSql.toString(), Sqls.callback.map());
|
||||
|
||||
if (Lang.isNotEmpty(userMap)) {
|
||||
newSessionRepresentative.setDbunitname(userMap.getString("deptName"));
|
||||
newSessionRepresentative.setDbunitid(userMap.getString("deptId"));
|
||||
newSessionRepresentative.setDbfghid(userMap.getString("unionId"));
|
||||
newSessionRepresentative.setDbfghname(userMap.getString("unionName"));
|
||||
if (StrUtil.isNotBlank(userMap.getString("unionId"))) {
|
||||
Jdh_dbt_zcfgh composeUnion = dao().fetch(Jdh_dbt_zcfgh.class, Cnd.where("jdhid", "=", newid).and("fghid", "=", userMap.getString("unionId")));
|
||||
newSessionRepresentative.setDbtid(Optional.ofNullable(composeUnion).map(x -> x.getDbtid()).orElse(null));
|
||||
} else {
|
||||
newSessionRepresentative.setDbtid(null);
|
||||
}
|
||||
}
|
||||
return newSessionRepresentative;
|
||||
}).collect(Collectors.toList());
|
||||
dao().fastInsert(newSessionRepresentatives);
|
||||
|
||||
//代表权限
|
||||
List<SysUserRole> newSessionRepresentativeRoles = newSessionRepresentatives.stream().filter(v -> v.getRoleid() == Roles.ZSDB).map(v -> {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(Roles.ZSDB);
|
||||
userRole.setJdhid(v.getJdhid());
|
||||
userRole.setUserId(v.getDbid());
|
||||
userRole.setDbtid(v.getDbtid());
|
||||
return userRole;
|
||||
}).collect(Collectors.toList());
|
||||
com.ruoyi.common.core.domain.R<Boolean> addedUserRolesR = remoteUserRoleService.addUserRoles(newSessionRepresentativeRoles);
|
||||
if (addedUserRolesR.getCode() == com.ruoyi.common.core.domain.R.FAIL) {
|
||||
throw new ServiceException(addedUserRolesR.getMsg());
|
||||
}
|
||||
|
||||
// //继承上一届的机构成员
|
||||
// List<Jdh_jgcy> jgcyList = dao().query(Jdh_jgcy.class, Cnd.where("jdhid", "=", oldid));
|
||||
// jgcyList.forEach(item -> {
|
||||
// item.setId(R.UU32());
|
||||
// item.setJdhid(newid);
|
||||
// dao().insert(Jdh_jgcy.class, Chain.from(item));
|
||||
//
|
||||
// //插入到用户角色表中
|
||||
// SysUserRole userRole = new SysUserRole();
|
||||
// userRole.setRoleId(item.getRoleId());
|
||||
// userRole.setUserId(item.getUserId());
|
||||
// userRole.setJdhid(newid);
|
||||
//
|
||||
// remoteUserRoleService.addUserRole(userRole);
|
||||
// });
|
||||
//
|
||||
// //代表团
|
||||
// List<Record> dbtList = dao().query("jdh_dbt", Cnd.where("jdhid", "=", oldid));
|
||||
// for (Record r : dbtList) {
|
||||
// //新增本届代表团
|
||||
// String olddbtid = r.getString("id");
|
||||
// String code = r.getString("code");
|
||||
// String newdbtid = R.UU32();
|
||||
// r.set("id", newdbtid);
|
||||
// r.set("jdhid", newid);
|
||||
// r.set("code", code);
|
||||
// r.set("cjsj", DateUtils.getDate());
|
||||
// dao().insert("jdh_dbt", Chain.from(r));
|
||||
// //组成基层工会
|
||||
// List<Record> zcfghList = dao().query("jdh_dbt_zcfgh", Cnd.where("dbtid", "=", olddbtid));
|
||||
// for (Record fgh : zcfghList) {
|
||||
// fgh.set("id", R.UU32());
|
||||
// fgh.set("dbtid", newdbtid);
|
||||
// fgh.set("jdhid", newid);
|
||||
// dao().insert("jdh_dbt_zcfgh", Chain.from(fgh));
|
||||
// }
|
||||
// //查询团长副团长
|
||||
// List<FeignCnd> cndList = List.of(
|
||||
// new FeignCnd("dbtid", "=", olddbtid),
|
||||
// new FeignCnd("role_id", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ))
|
||||
// );
|
||||
// List<SysUserRole> tzftzList = remoteUserRoleService.getUserRole(cndList).getData();
|
||||
// for (SysUserRole tzftz : tzftzList) {
|
||||
// tzftz.setJdhid(newid);
|
||||
// tzftz.setDbtid(newdbtid);
|
||||
// remoteUserRoleService.addUserRole(tzftz);
|
||||
// }
|
||||
// //操作员
|
||||
// List<FeignCnd> czyCndList = List.of(
|
||||
// new FeignCnd("dbtid", "=", olddbtid),
|
||||
// new FeignCnd("role_id", "in", List.of(Roles.DBT_CZY))
|
||||
// );
|
||||
// List<SysUserRole> czyList = remoteUserRoleService.getUserRole(czyCndList).getData();
|
||||
// for (SysUserRole czy : czyList) {
|
||||
// czy.setJdhid(newid);
|
||||
// czy.setDbtid(newdbtid);
|
||||
// remoteUserRoleService.addUserRole(czy);
|
||||
// }
|
||||
// //正式代表
|
||||
// List<Record> dbList = dao().query("jdh_db", Cnd.where("jdhid", "=", oldid).and("dbtid", "=", olddbtid).and("dbzt", "=", 2));
|
||||
// for (Record db : dbList) {
|
||||
// db.set("id", R.UU32());
|
||||
// db.set("jdhid", newid);
|
||||
// db.set("dbtid", newdbtid);
|
||||
// dao().insert("jdh_db", Chain.from(db));
|
||||
//
|
||||
// SysUserRole userRole = new SysUserRole();
|
||||
// userRole.setRoleId(db.getLong("roleid"));
|
||||
// userRole.setJdhid(db.getString("jdhid"));
|
||||
// userRole.setUserId(db.getLong("dbid"));
|
||||
// userRole.setDbtid(newdbtid);
|
||||
// remoteUserRoleService.addUserRole(userRole);
|
||||
// }
|
||||
// //列席特邀代表
|
||||
// List<Record> lxtydbList = dao().query("jdh_lxty_db", Cnd.where("jdhid", "=", oldid).and("dbtid", "=", olddbtid));
|
||||
// for (Record lxtydb : lxtydbList) {
|
||||
// lxtydb.set("id", R.UU32());
|
||||
// lxtydb.set("jdhid", newid);
|
||||
// lxtydb.set("dbtid", newdbtid);
|
||||
// dao().insert("jdh_lxty_db", Chain.from(lxtydb));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
public static String getCs(String cs) {
|
||||
if (cs.equals("六")) {
|
||||
return "五";
|
||||
} else if (cs.equals("五")) {
|
||||
return "四";
|
||||
} else if (cs.equals("四")) {
|
||||
return "三";
|
||||
} else if (cs.equals("三")) {
|
||||
return "二";
|
||||
} else if (cs.equals("二")) {
|
||||
return "一";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.MeetingActivityManageService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/25
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class MeetingActivityManageServiceImpl extends BaseServiceImpl implements MeetingActivityManageService {
|
||||
|
||||
public MeetingActivityManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.WorkDataTypeService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/26
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class WorkDataTypeServiceImpl extends BaseServiceImpl implements WorkDataTypeService {
|
||||
|
||||
public WorkDataTypeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.jdh.service.impl.election;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.election.ICommissionerService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CommissionerServiceImpl extends BaseServiceImpl implements ICommissionerService {
|
||||
|
||||
public CommissionerServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.jdh.service.impl.executiveCommittee;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.api.domain.executiveCommittee.ExecutiveCommitteeConfig;
|
||||
import com.ruoyi.jdh.service.executiveCommittee.ExecutiveCommitteeConfigService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfigServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:31
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Service
|
||||
public class ExecutiveCommitteeConfigServiceImpl extends BaseServiceImpl<ExecutiveCommitteeConfig> implements ExecutiveCommitteeConfigService {
|
||||
|
||||
public ExecutiveCommitteeConfigServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package com.ruoyi.jdh.service.impl.prepare;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_db;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_lxty_db;
|
||||
import com.ruoyi.jdh.service.prepare.IJdhQuotaAllocationService;
|
||||
import com.ruoyi.system.api.RemoteUserRoleService;
|
||||
import com.ruoyi.system.api.domain.SysUserRole;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:JdhMefpServiceImpl
|
||||
* @Date 2024/5/16 10:29
|
||||
* @注释
|
||||
*/
|
||||
@Service
|
||||
public class JdhQuotaAllocationServiceImpl extends BaseServiceImpl implements IJdhQuotaAllocationService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RemoteUserRoleService remoteUserRoleService;
|
||||
|
||||
//列席代表
|
||||
private static final Long LXDB_ROLE_ID = 107L;
|
||||
|
||||
//特邀代表
|
||||
private static final Long TYDB_ROLE_ID = 108L;
|
||||
|
||||
|
||||
public JdhQuotaAllocationServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getData(String jdhid, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.id,
|
||||
dbt.unionname,
|
||||
(
|
||||
SELECT
|
||||
count( 1 )
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
unionId IN ( SELECT fghid FROM jdh_dbt_zcfgh jbz WHERE jbz.fghid = dbt.id )
|
||||
and member = '1') AS ghzrs,
|
||||
( SELECT count( 1 ) FROM `jdh_db` WHERE dbfghid = dbt.id and jdhid = @jdhid) AS dbzrs,
|
||||
( SELECT COUNT( 1 ) FROM jdh_db WHERE dbfghid = dbt.id and jdhid = @jdhid AND roleid IN ( '107', '108' )) AS lxty,
|
||||
IFNULL((select quota from `jdh_mefp` where fghid = dbt.id and jdhid = @jdhid),0) as quota
|
||||
FROM
|
||||
`union` dbt
|
||||
$condition
|
||||
""").setParam("jdhid", jdhid);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("dbt.id", "=", unionId);
|
||||
cnd.asc("dbt.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<NutMap> lxtydbPgaeData(String fghid, String jdhid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.mobile,
|
||||
u.sex
|
||||
FROM
|
||||
jdh_db db
|
||||
LEFT JOIN `user` u ON u.userId = db.dbid
|
||||
WHERE
|
||||
db.dbfghid = @fghid
|
||||
AND db.jdhid = @jdhid
|
||||
AND db.roleid IN (
|
||||
'107',
|
||||
'108')
|
||||
""").setParam("fghid", fghid).setParam("jdhid", jdhid);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
List<Record> roleList = remoteUserRoleService.getAllRole().getData();
|
||||
Map<String, String> roleMap = roleList.stream().collect(Collectors.toMap(v -> v.getString("roleId"), v -> v.getString("roleName")));
|
||||
|
||||
list.forEach(v -> {
|
||||
String roleName = roleMap.get(v.getString("roleid"));
|
||||
if (StrUtil.isNotBlank(roleName)) v.setv("rolename", roleList);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Pagination queryNolxtyDb(String jdhid, String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.userId as id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
dw.dept_id AS dbunitid,
|
||||
dw.dept_name AS dbunitname,
|
||||
dw.dept_name AS dwname,
|
||||
fgh.id AS fghid,
|
||||
fgh.id AS dbfghid,
|
||||
fgh.unionname AS dbfghname
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN `dept` dw ON dw.dept_id = u.deptId
|
||||
LEFT JOIN `union` fgh ON fgh.id = dw.union_id
|
||||
WHERE
|
||||
( u.userName LIKE @keyword OR u.loginName LIKE @keyword )
|
||||
AND
|
||||
NOT EXISTS ( SELECT 1 FROM jdh_db WHERE jdhid = @jdhid AND dbid = u.userId )
|
||||
""");
|
||||
sql.setParam("jdhid", jdhid).setParam("keyword", "%" + keyword + "%");
|
||||
return listPage(1, 10, sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doAddLxTyDb(Jdh_lxty_db db, Integer lx) {
|
||||
Jdh_db zsdb = new Jdh_db();
|
||||
zsdb.setId(R.UU32());
|
||||
zsdb.setDbid(Long.parseLong(db.getDbid()));
|
||||
zsdb.setDbunitid(db.getDbunitid());
|
||||
zsdb.setDbunitname(db.getDbunitname());
|
||||
zsdb.setDbfghid(db.getDbfghid());
|
||||
zsdb.setDbfghname(db.getDbfghname());
|
||||
zsdb.setDbtid(db.getDbtid());
|
||||
zsdb.setJdhid(db.getJdhid());
|
||||
zsdb.setDbzt(2);
|
||||
zsdb.setRoleid(lx == 1 ? TYDB_ROLE_ID : LXDB_ROLE_ID);
|
||||
dao().insert(Jdh_db.class, Chain.from(zsdb));
|
||||
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setUserId(Long.valueOf(db.getDbid()));
|
||||
sysUserRole.setJdhid(db.getJdhid());
|
||||
sysUserRole.setDbtid(db.getDbtid());
|
||||
sysUserRole.setRoleId(lx == 1 ? TYDB_ROLE_ID : LXDB_ROLE_ID);
|
||||
remoteUserRoleService.addUserRole(sysUserRole);
|
||||
}
|
||||
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.jdh.service.impl.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.JdhLevel2;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.MeetingState;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.MeetingLevelTwoService;
|
||||
import com.ruoyi.system.api.RemoteSysLocalProcessService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/29
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class MeetingLevelTwoServiceImpl extends BaseServiceImpl implements MeetingLevelTwoService {
|
||||
|
||||
public MeetingLevelTwoServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
@Autowired
|
||||
private RemoteSysLocalProcessService localProcessService;
|
||||
|
||||
|
||||
@Override
|
||||
public Pagination pageData(Cnd cnd, PageForm pageForm, String unionId, String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
jdh2.*,
|
||||
s.color,
|
||||
s.`name` state_name,
|
||||
fo.userName as username,
|
||||
party.userName party_name,
|
||||
school.userName school_name,
|
||||
fo.`deptName` unit_name,
|
||||
fo.unionName union_name
|
||||
FROM
|
||||
jdh_level2 jdh2
|
||||
LEFT JOIN jdh_jdhxx jdh ON jdh.id = jdh2.session_id
|
||||
LEFT JOIN jdh_level2_state s ON s.id = jdh2.audit_state
|
||||
LEFT JOIN `user` fo ON fo.userId = jdh2.founder
|
||||
LEFT JOIN `user` party ON party.userId = jdh2.party_committee_id
|
||||
LEFT JOIN `user` school ON school.userId = jdh2.school_union_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andEX(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.andEX("fo.deptId", "=", unitId);
|
||||
cnd.andEX("fo.unionId", "=", unionId);
|
||||
cnd.asc("jdh2.audit_state").desc("jdh2.create_time");
|
||||
sql.setCondition(cnd);
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean callback(String id) {
|
||||
JdhLevel2 jdhLevel2 = dao().fetch(JdhLevel2.class, id);
|
||||
|
||||
//找到小于当前状态的第一个审核节点
|
||||
List<Record> auditPoints = dao().query("jdh_level2_state",
|
||||
Cnd.NEW().and("id", "<", jdhLevel2.getAudit_state()).and("type", "=", "0").orderBy("id", "desc"));
|
||||
|
||||
if (auditPoints == null || auditPoints.size() == 0) {
|
||||
throw new ServiceException("没有可退回的状态!");
|
||||
}
|
||||
|
||||
jdhLevel2.setAudit_state(auditPoints.get(0).getInt("id"));
|
||||
jdhLevel2.setSchool_union_id(null);
|
||||
jdhLevel2.setSchool_union_time("");
|
||||
jdhLevel2.setSchool_union_opinion("");
|
||||
jdhLevel2.setSchool_files(null);
|
||||
dao().update(jdhLevel2);
|
||||
|
||||
//删除批复附件
|
||||
dao().clear("jdh2_gzzl", Cnd.NEW().and("fromid", "=", id));
|
||||
localProcessService.revokeTask("SECONDLEVELJDH_MEETING_APPLY@" + jdhLevel2.getId(),
|
||||
String.valueOf(MeetingState.T300), SecurityConstants.INNER);
|
||||
//TODO:此处需要添加删除附件的代码
|
||||
/*List<Sys_file> files = jdhLevel2.getFiles();
|
||||
for (Sys_file file : files) {
|
||||
fileService.delete(file.getId(), file.getFilepath());
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.MeetingTradeUnionManageService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class MeetingTradeUnionManageServiceImpl extends BaseServiceImpl implements MeetingTradeUnionManageService {
|
||||
|
||||
public MeetingTradeUnionManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.ruoyi.jdh.service.impl.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzl;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.WorkDataManageService;
|
||||
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.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class WorkDataManageServiceImpl extends BaseServiceImpl implements WorkDataManageService {
|
||||
|
||||
public WorkDataManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String year, String unionId, String jdhid, String zllx) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gzzl.*,
|
||||
lx.lxname,
|
||||
u.unionName as unionname
|
||||
FROM
|
||||
jdh2_gzzl gzzl
|
||||
LEFT JOIN jdh2_gzzllx lx ON lx.id = gzzl.zllx
|
||||
LEFT JOIN `user` u ON u.userId = gzzl.userid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
}
|
||||
if (Strings.isNotBlank(year)) {
|
||||
cnd.and("year(gzzl.time)", "=", year);
|
||||
}
|
||||
if (Strings.isNotBlank(jdhid)) {
|
||||
cnd.and("gzzl.jdhid", "=", jdhid);
|
||||
}
|
||||
if (Strings.isNotBlank(zllx)) {
|
||||
cnd.and("gzzl.zllx", "=", zllx);
|
||||
}
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
cnd.and("u.unionId", "=", unionId);
|
||||
}
|
||||
if (!AuthUtil.hasAnyRoles("admin, A06")) {
|
||||
cnd.and("u.unionId", "=", SecurityUtils.getUnionId());
|
||||
}
|
||||
cnd.desc("gzzl.jdhid");
|
||||
sql.setCondition(cnd);
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doAdd(Jdh2_gzzl gzzl) {
|
||||
String id = R.UU32();
|
||||
gzzl.setId(id);
|
||||
gzzl.setUserid(SecurityUtils.getUserId());
|
||||
gzzl.setUsername(SecurityUtils.getUsername());
|
||||
gzzl.setTime(DateUtils.getDate());
|
||||
dao().insert("jdh2_gzzl", Chain.from(gzzl));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doEdit(Jdh2_gzzl gzzl) {
|
||||
int num = dao().update("jdh2_gzzl", Chain.from(gzzl), Cnd.where("id", "=", gzzl.getId()));
|
||||
return num > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean doDelete(String id) {
|
||||
int num = dao().clear("jdh2_gzzl", Cnd.where("id", "=", id));
|
||||
return num > 0;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.secondLevelJdh.WorkDataTypeManageService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class WorkDataTypeManageServiceImpl extends BaseServiceImpl implements WorkDataTypeManageService {
|
||||
|
||||
public WorkDataTypeManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhDelegationService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class GdhDelegationServiceImpl extends BaseServiceImpl implements GdhDelegationService {
|
||||
|
||||
public GdhDelegationServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhDeputySeniorManageService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/28
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class GdhDeputySeniorManageServiceImpl extends BaseServiceImpl implements GdhDeputySeniorManageService {
|
||||
|
||||
public GdhDeputySeniorManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhOrganizationService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/28
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class GdhOrganizationServiceImpl extends BaseServiceImpl implements GdhOrganizationService {
|
||||
|
||||
public GdhOrganizationServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.jdh.service.impl.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseServiceImpl;
|
||||
import com.ruoyi.jdh.service.workersCongress.GdhSessionManageService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description
|
||||
*/
|
||||
@Service
|
||||
public class GdhSessionManageServiceImpl extends BaseServiceImpl implements GdhSessionManageService {
|
||||
|
||||
public GdhSessionManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.jdh.service.prepare;
|
||||
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.jdh.api.domain.db.Jdh_lxty_db;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:IJdhMefpService
|
||||
* @Date 2024/5/16 10:29
|
||||
* @注释
|
||||
*/
|
||||
public interface IJdhQuotaAllocationService extends BaseService {
|
||||
|
||||
List<NutMap> getData(String jdhid, String unionId);
|
||||
|
||||
|
||||
List<NutMap> lxtydbPgaeData(String fghid, String jdhid);
|
||||
|
||||
|
||||
Pagination queryNolxtyDb(String jdhid,String keyword);
|
||||
|
||||
void doAddLxTyDb(Jdh_lxty_db db, Integer lx);
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.jdh.service.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/29
|
||||
* @Description
|
||||
*/
|
||||
public interface MeetingLevelTwoService extends BaseService {
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*
|
||||
* @param cnd:
|
||||
* @param pageForm:
|
||||
* @param unionId:
|
||||
* @param unitId:
|
||||
* @return com.ruoyi.common.core.page.Pagination
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/29
|
||||
*/
|
||||
Pagination pageData(Cnd cnd, PageForm pageForm, String unionId, String unitId);
|
||||
|
||||
/**
|
||||
* 撤回
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/30
|
||||
* @param id:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean callback(String id);
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description
|
||||
*/
|
||||
public interface MeetingTradeUnionManageService extends BaseService {
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.jdh.service.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageForm;
|
||||
import com.ruoyi.common.core.page.Pagination;
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
import com.ruoyi.jdh.api.domain.secondLevelJdh.Jdh2_gzzl;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description
|
||||
*/
|
||||
public interface WorkDataManageService extends BaseService {
|
||||
|
||||
/***
|
||||
* 工作资料查询表格数据
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param pageForm:
|
||||
* @param year:
|
||||
* @param unionId:
|
||||
* @param jdhid:
|
||||
* @param zllx:
|
||||
* @return com.ruoyi.common.core.web.domain.AjaxResult
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String year, String unionId, String jdhid, String zllx);
|
||||
|
||||
/***
|
||||
* 新增工作资料
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param gzzl:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doAdd(Jdh2_gzzl gzzl);
|
||||
|
||||
/***
|
||||
* 编辑工作资料
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param gzzl:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doEdit(Jdh2_gzzl gzzl);
|
||||
|
||||
/***
|
||||
* 工作资料删除
|
||||
* @author JyuHsin
|
||||
* @date 2022/12/19
|
||||
* @param id:
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean doDelete(String id);
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service.secondLevelJdh;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/30
|
||||
* @Description
|
||||
*/
|
||||
public interface WorkDataTypeManageService extends BaseService {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description
|
||||
*/
|
||||
public interface GdhDelegationService extends BaseService {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/28
|
||||
* @Description
|
||||
*/
|
||||
public interface GdhDeputySeniorManageService extends BaseService {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/28
|
||||
* @Description
|
||||
*/
|
||||
public interface GdhOrganizationService extends BaseService {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.jdh.service.workersCongress;
|
||||
|
||||
import com.ruoyi.common.core.service.BaseService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/12/27
|
||||
* @Description
|
||||
*/
|
||||
public interface GdhSessionManageService extends BaseService {
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 9400
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: ruoyi-jdh
|
||||
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}
|
||||
|
||||
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.jdh.api.domain
|
||||
sql-manager:
|
||||
#自定义sql管理模式 file和xml
|
||||
mode: file
|
||||
# 自定义sql文件路径
|
||||
paths:
|
||||
- sqls
|
||||
|
||||
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-jdh" />
|
||||
<!-- 日志输出格式 -->
|
||||
<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>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.jdh;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class RuoyiJdhTest {
|
||||
|
||||
@Autowired
|
||||
private Dao dao;
|
||||
|
||||
@Test
|
||||
public void t001() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user