This commit is contained in:
Paidax
2024-11-29 09:03:59 +08:00
commit 2ffadd89a7
3480 changed files with 879405 additions and 0 deletions
@@ -0,0 +1,28 @@
package io.v.nutz.zhgh.leadthought.constant;
import io.v.nutz.base.annontation.SelectEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 活动申报审核代码
*
* @author jug
* @date 2024/01/17
*/
@Getter
@SelectEnum
@AllArgsConstructor
public enum LeadThoughtAuditStateConstant {
NOT_SUBMIT(10, "待提交"),
BRANCH_UNION_AUDIT(20, "待分工会审核"),
BRANCH_UNION_REJECT(30, "分工会审核拒绝"),
SCHOOL_UNION_AUDIT(40, "待校工会审核"),
SCHOOL_UNION_REJECT(50, "校工会拒绝"),
PASS(60, "申请通过");
private final int code;
private final String desc;
}
@@ -0,0 +1,111 @@
package io.v.nutz.zhgh.leadthought.controller;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.result.Result;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.leadthought.constant.LeadThoughtAuditStateConstant;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtFunds;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtInfo;
import io.v.nutz.zhgh.leadthought.service.LeadThoughtInfoService;
import io.v.nutz.sys.models.Sys_user;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.Date;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/apply")
public class LeadThoughtApplyController {
@Inject
private Dao dao;
@Inject
private LeadThoughtInfoService leadThoughtInfoService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@At("")
@Ok("beetl:/platform/leadthought/apply.html")
@RequiresPermissions("leadThought.apply")
public void index() {
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("leadThought.apply")
public Object doSubmit(LeadThoughtInfo info) {
try {
info.setApplyTime(new Date());
info.setState(LeadThoughtAuditStateConstant.BRANCH_UNION_AUDIT.getCode());
leadThoughtInfoService.insertOrUpdate(info);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("leadThought.apply")
public Object doSave(LeadThoughtInfo info) {
try {
info.setApplyTime(new Date());
info.setState(LeadThoughtAuditStateConstant.NOT_SUBMIT.getCode());
leadThoughtInfoService.insertOrUpdate(info);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@ViReturn
public Object findOne(String id) {
return leadThoughtInfoService.findOne(id);
}
@At
@RequiresPermissions("leadThought.myApply")
public Result getApplyInfo(){
Sql sql = Sqls.create("""
SELECT
unitname AS applyUnitName,
unitid AS applyUnit,
username AS headName,
id AS userId,
mobile
FROM
USER
WHERE id = @id
""");
sql.setParam("id",ShiroUtil.getPrincipalProperty("id"));
sql.setCallback(Sqls.callback.map());
leadThoughtInfoService.dao().execute(sql);
NutMap user = (NutMap)sql.getResult();
return Result.success(user);
}
}
@@ -0,0 +1,110 @@
package io.v.nutz.zhgh.leadthought.controller;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.leadthought.constant.LeadThoughtAuditStateConstant;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtInfo;
import io.v.nutz.zhgh.leadthought.service.LeadThoughtInfoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/fghOption")
public class LeadThoughtFghOptionController {
@Inject
private Dao dao;
@Inject
private LeadThoughtInfoService leadThoughtInfoService;
@At("")
@Ok("beetl:/platform/leadthought/fghOption.html")
@RequiresPermissions("leadThought.fghOption")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("leadThought.fghOption")
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "manageId", required = false) String manageId,
@Param(value = "typeId", required = false) String typeId,
@Param(value = "projectName", required = false) String projectName) {
Sql sql = Sqls.create("""
SELECT
lti.*,
ltp.manageName
FROM
`lead_thought_info` lti
LEFT JOIN `user` u ON u.id = lti.userId
LEFT JOIN lead_thought_project ltp on ltp.id = lti.manageId
$condition
""");
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("lti.userid", "=", ShiroUtil.getPrincipalProperty("id"));
}
cnd.and("lti.state", isAudit.equals("true") ? ">" : isAudit.equals("false") ? "=" : ">=", LeadThoughtAuditStateConstant.BRANCH_UNION_AUDIT.getCode());
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.andEX("YEAR(lti.applyTime)", "=", year);
cnd.andEX("lti.manageId", "=", manageId);
cnd.andEX("lti.typeId", "=", typeId);
if (Strings.isNotBlank(projectName)) {
cnd.and("lti.projectName", "like", "%" + projectName + "%");
}
cnd.desc("lti.applyTime");
sql.setCondition(cnd);
return leadThoughtInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("leadThought.fghOption")
public Object doHandle(@Param("info") LeadThoughtInfo info,Integer flag) {
if(flag==1){
info.setState(LeadThoughtAuditStateConstant.BRANCH_UNION_REJECT.getCode());
}else if(flag==2){
info.setState(LeadThoughtAuditStateConstant.BRANCH_UNION_REJECT.getCode());
}else if(flag==3){
info.setState(LeadThoughtAuditStateConstant.SCHOOL_UNION_AUDIT.getCode());
}
info.setFghFzr((String) ShiroUtil.getPrincipalProperty("username"));
info.setFghTime(DateUtil.getDate());
leadThoughtInfoService.dao().update(info,"fghFzr|fghFzrQz|fghOption|fghTime|state");
return null;
}
@At
@ViReturn
@RequiresPermissions("leadThought.fghOption")
public Object doRollBack(String id) {
Chain chain = Chain.make("fghFzr", null);
chain.add("fghFzrQz", null);
chain.add("fghOption", null);
chain.add("fghTime", null);
chain.add("state", LeadThoughtAuditStateConstant.BRANCH_UNION_AUDIT.getCode());
dao.update(LeadThoughtInfo.class, chain, Cnd.where("id", "=", id));
return null;
}
}
@@ -0,0 +1,98 @@
package io.v.nutz.zhgh.leadthought.controller;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtFunds;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtInfo;
import io.v.nutz.zhgh.leadthought.service.LeadThoughtInfoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.Date;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/myApply")
public class LeadThoughtMineApplyController {
@Inject
private Dao dao;
@Inject
private LeadThoughtInfoService leadThoughtInfoService;
@At("")
@Ok("beetl:/platform/leadthought/myApply.html")
@RequiresPermissions("leadThought.myApply")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("leadThought.myApply")
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "manageId", required = false) String manageId,
@Param(value = "typeId", required = false) String typeId,
@Param(value = "projectName", required = false) String projectName) {
Sql sql = Sqls.create("""
SELECT
lti.*,
ltp.manageName
FROM
`lead_thought_info` lti
LEFT JOIN `user` u ON u.id = lti.userId
LEFT JOIN lead_thought_project ltp on ltp.id = lti.manageId
$condition
""");
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("lti.userid", "=", ShiroUtil.getPrincipalProperty("id"));
}
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.andEX("YEAR(lti.applyTime)", "=", year);
cnd.andEX("lti.manageId", "=", manageId);
cnd.andEX("lti.typeId", "=", typeId);
if (Strings.isNotBlank(projectName)) {
cnd.and("lti.projectName", "like", "%" + projectName + "%");
}
cnd.desc("lti.applyTime");
sql.setCondition(cnd);
return leadThoughtInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("leadThought.myApply")
public Object doDelete(String id) {
try {
dao.clear(LeadThoughtInfo.class, Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,293 @@
package io.v.nutz.zhgh.leadthought.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.zhgh.leadthought.constant.LeadThoughtAuditStateConstant;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtType;
import io.v.nutz.zhgh.leadthought.service.LeadThoughtInfoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.ddr.poi.html.HtmlRenderPolicy;
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.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/stat")
public class LeadThoughtStatController {
@Inject
private Dao dao;
@Inject
private LeadThoughtInfoService leadThoughtInfoService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@At("")
@Ok("beetl:/platform/leadthought/statistics.html")
@RequiresPermissions("leadThought.stat")
public void index() {
}
@At
@ViReturn
@RequiresPermissions(value = {"leadThought.myApply", "leadThought.stat"}, logical = Logical.OR)
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "manageId", required = false) String manageId,
@Param(value = "typeId", required = false) String typeId,
@Param(value = "projectName", required = false) String projectName) {
Sql sql = Sqls.create("""
SELECT
lti.*,
ltp.manageName
FROM
`lead_thought_info` lti
LEFT JOIN `user` u ON u.id = lti.userId
LEFT JOIN lead_thought_project ltp on ltp.id = lti.manageId
$condition
""");
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionActivityAdmin")) {
cnd.and("lti.userid", "=", ShiroUtil.getPrincipalProperty("id"));
}
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.andEX("YEAR(lti.applyTime)", "=", year);
cnd.andEX("lti.manageId", "=", manageId);
cnd.andEX("lti.typeId", "=", typeId);
if (Strings.isNotBlank(projectName)) {
cnd.and("lti.projectName", "like", "%" + projectName + "%");
}
cnd.desc("lti.applyTime");
sql.setCondition(cnd);
return leadThoughtInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@Ok("void")
@RequiresPermissions(value = {"leadThought.apply", "leadThought.fghOption", "leadThought.xghOption", "leadThought.myApply", "leadThought.stat"}, logical = Logical.OR)
public void exportAllInfo(@Param(value = "searchName", required = false) String searchName,
@Param(value = "searchKeyword", required = false) String searchKeyword,
@Param(value = "year", required = false) Integer year,
@Param(value = "manageId", required = false) String manageId,
@Param(value = "typeId", required = false) String typeId,
@Param(value = "projectName", required = false) String projectName,
HttpServletResponse response) throws IOException {
Sql sql = Sqls.create("""
SELECT
lti.*,
au.stateColor,
au.stateName,
su.`name` AS applyUnitName,
ssu.`name` AS jointUnitName
FROM
`lead_thought_info` lti
LEFT JOIN `audit_state` au ON lti.state = au.stateId
LEFT JOIN `user` u ON u.id = lti.userId
LEFT JOIN `sys_unit` su ON su.id = lti.applyUnit
LEFT JOIN `sys_unit` ssu ON ssu.id = lti.jointUnit
$condition
""");
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("lti.userid", "=", ShiroUtil.getPrincipalProperty("id"));
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "like", "%" + searchKeyword + "%");
}
cnd.andEX("YEAR(lti.applyTime)", "=", year);
cnd.andEX("lti.manageId", "=", manageId);
cnd.andEX("lti.typeId", "=", typeId);
if (Strings.isNotBlank(projectName)) {
cnd.and("lti.projectName", "like", "%" + projectName + "%");
}
cnd.and("lti.state", "=", 6250);
cnd.desc("lti.applyTime");
sql.setCondition(cnd);
List<Record> list = leadThoughtInfoService.list(sql);
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.newBuilder().bind("funds", policy)
.bind("content", htmlRenderPolicy)
.build();
list.forEach(v -> {
try {
NutMap nutMap = getExportData(v.getString("id"));
String fileName = nutMap.getString("manageName") + nutMap.getString("applyUnitName") + "登记表.docx";
zipOutputStream.putNextEntry(new ZipEntry(fileName));
XWPFTemplate.compile(officeTemplateUtil.getPath("leadThought"), config).render(nutMap).write(zipOutputStream);
zipOutputStream.closeEntry();
} catch (IOException e) {
throw new RuntimeException(e);
}
});
zipOutputStream.finish();
zipOutputStream.close();
response.getOutputStream().close();
}
@At
@Ok("void")
@RequiresPermissions(value = {"leadThought.apply", "leadThought.fghOption", "leadThought.xghOption", "leadThought.myApply", "leadThought.stat"}, logical = Logical.OR)
public void exportInfo(String id, HttpServletResponse response) {
try {
Sql sql = Sqls.create("""
SELECT
t.projectName,
t.applyUnitName,
t.jointUnitName,
t.headName,
t.mobile,
t.numberPeople,
t.startDate,
t.endDate,
t.programme,
t.budget,
t.fghOption,
t.fghTime,
t.xghOption,
t.xghTime,
t.manageId,
t.typeId
FROM
`lead_thought_info` t
WHERE id = @id
""").setParam("id", id);
NutMap data = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
Date startDate = data.getTime("startDate");
Date endDate = data.getTime("endDate");
String time = DateUtil.format(startDate, "yyyy-MM-dd") + "" + DateUtil.format(endDate, "yyyy-MM-dd");
data.put("time", time);
data.put("jointUnitName", StrUtil.blankToDefault(data.getString("jointUnitName"), ""));
if (data.getString("manageId").equals("8afa276f6580476db61c2cdc03be62ef")) {
//工会主题
List<LeadThoughtType> types = dao.query(LeadThoughtType.class, Cnd.orderBy().desc("sortNum"));
List<String> wordTypes = types.stream().map(t -> {
String typeName = t.getTypeName();
boolean typeEQ = t.getId().equals(data.getString("typeId"));
if (typeEQ) {
return "" + typeName;
} else {
return "" + typeName;
}
}).collect(Collectors.toList());
data.put("wordTypes", wordTypes);
}
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.builder()
.bind("programme", htmlRenderPolicy)
.bind("budget", htmlRenderPolicy)
.build();
String fileName = data.getString("projectName");
String templateCode = data.getString("manageId").equals("1628eccadd0c412d8fa668b987a24a3d") ? "承办校级工会活动项目申报" : "工会主题活动项目申报";
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
XWPFTemplate.compile(officeTemplateUtil.getPath(templateCode), config).render(data, response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
public NutMap getExportData(String id) {
try {
NutMap infoMap = leadThoughtInfoService.findOne(id);
if (Strings.isNotBlank(infoMap.getString("fghFzrQz"))) {
infoMap.setv("fqz", Vi.getImg(infoMap.getString("fghFzrQz")));
}
if (Strings.isNotBlank(infoMap.getString("xghFzrQz"))) {
infoMap.setv("xqz", Vi.getImg(infoMap.getString("xghFzrQz")));
}
infoMap.setv("xfu", infoMap.getString("xghFundsAmount"));
infoMap.setv("dfu", infoMap.getString("deptFundsAmount"));
infoMap.setv("sfu", infoMap.getString("sumFundsAmount"));
infoMap.setv("nup", infoMap.getString("numberPeople"));
infoMap.setv("nul", infoMap.getString("numberLeader"));
infoMap.setv("nut", infoMap.getString("numberTeacher"));
infoMap.setv("unitp", infoMap.getString("unitPercentage"));
infoMap.setv("ldp", infoMap.getString("leaderPercentage"));
infoMap.setv("teap", infoMap.getString("teacherPercentage"));
List<NutMap> funds = infoMap.getAsList("funds", NutMap.class);
funds.forEach(v -> {
v.setv("epa", v.getString("expenseAccount"));
v.setv("axm", v.getString("applyXghMoney"));
v.setv("adm", v.getString("deptMoney"));
v.setv("att", v.getString("amountTo"));
});
String fghTime = infoMap.getString("fghTime");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
if (Strings.isNotBlank(fghTime)) {
Date parse = format.parse(fghTime);
String s = cn.hutool.core.date.DateUtil.formatChineseDate(parse, false, false);
infoMap.setv("fghTime", s);
}
String xghTime = infoMap.getString("xghTime");
if (Strings.isNotBlank(xghTime)) {
Date parse = format.parse(xghTime);
String s = cn.hutool.core.date.DateUtil.formatChineseDate(parse, false, false);
infoMap.setv("xghTime", s);
}
List<LeadThoughtType> typeList = leadThoughtInfoService.dao().query(LeadThoughtType.class, Cnd.NEW());
typeList.forEach(v -> {
if (v.getTypeName().equals(infoMap.getString("typeName"))) {
v.setTypeName("(√)" + v.getTypeName());
}
});
infoMap.setv("types", typeList);
return infoMap;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
@@ -0,0 +1,108 @@
package io.v.nutz.zhgh.leadthought.controller;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.leadthought.constant.LeadThoughtAuditStateConstant;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtInfo;
import io.v.nutz.zhgh.leadthought.service.LeadThoughtInfoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/xghOption")
public class LeadThoughtXghOptionController {
@Inject
private Dao dao;
@Inject
private LeadThoughtInfoService leadThoughtInfoService;
@At("")
@Ok("beetl:/platform/leadthought/xghOption.html")
@RequiresPermissions("leadThought.xghOption")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("leadThought.xghOption")
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "manageId", required = false) String manageId,
@Param(value = "typeId", required = false) String typeId,
@Param(value = "projectName", required = false) String projectName) {
Sql sql = Sqls.create("""
SELECT
lti.*,
ltp.manageName
FROM
`lead_thought_info` lti
LEFT JOIN lead_thought_project ltp on ltp.id = lti.manageId
$condition
""");
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("lti.userid", "=", ShiroUtil.getPrincipalProperty("id"));
}
cnd.and("lti.state", isAudit.equals("true") ? ">" : isAudit.equals("false") ? "=" : ">=", LeadThoughtAuditStateConstant.SCHOOL_UNION_AUDIT.getCode());
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.andEX("YEAR(lti.applyTime)", "=", year);
cnd.andEX("lti.manageId", "=", manageId);
cnd.andEX("lti.typeId", "=", typeId);
if (Strings.isNotBlank(projectName)) {
cnd.and("lti.projectName", "like", "%" + projectName + "%");
}
cnd.desc("lti.applyTime");
sql.setCondition(cnd);
return leadThoughtInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("leadThought.xghOption")
public Object doHandle(@Param("info") LeadThoughtInfo info,Integer flag) {
if(flag==1){
info.setState(LeadThoughtAuditStateConstant.SCHOOL_UNION_REJECT.getCode());
}else if(flag==2){
info.setState(LeadThoughtAuditStateConstant.SCHOOL_UNION_REJECT.getCode());
}else if(flag==3){
info.setState(LeadThoughtAuditStateConstant.PASS.getCode());
}
info.setXghFzr((String) ShiroUtil.getPrincipalProperty("username"));
info.setXghTime(DateUtil.getDate());
leadThoughtInfoService.updateIgnoreNull(info);
return null;
}
@At
@ViReturn
@RequiresPermissions("leadThought.xghOption")
public Object doRollBack(String id) {
Chain chain = Chain.make("xghFzr", null);
chain.add("xghFzrQz", null);
chain.add("xghOption", null);
chain.add("xghTime", null);
chain.add("state", LeadThoughtAuditStateConstant.SCHOOL_UNION_AUDIT);
dao.update(LeadThoughtInfo.class, chain, Cnd.where("id", "=", id));
return null;
}
}
@@ -0,0 +1,92 @@
package io.v.nutz.zhgh.leadthought.controller.basic;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtProject;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/manage")
public class LeadThoughtManageController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/leadthought/basic/manage.html")
@RequiresPermissions("leadThought.manage")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("leadThought.manage")
public Object pageData(PageForm pageForm,
@Param(value = "projectName", required = false) String projectName,
@Param(value = "year", required = false) Integer year) {
Sql sql = Sqls.create("""
select
*
from
lead_thought_project
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(projectName)) {
cnd.where().andLike("projectName", projectName);
}
cnd.andEX("YEAR(createTime)", "=", year);
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("leadThought.manage")
public Object doAdd(LeadThoughtProject project) {
project.setCreateTime(DateUtil.now());
baseService.dao().insert(project);
return null;
}
@At
@ViReturn
@RequiresPermissions("leadThought.manage")
public Object doEdit(LeadThoughtProject project) {
baseService.dao().updateIgnoreNull(project);
return null;
}
@At
@ViReturn
@RequiresPermissions("leadThought.manage")
public Object doDelete(String id) {
baseService.dao().clear(LeadThoughtProject.class, Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
@RequiresPermissions(value = {"leadThought.manage", "leadThought.apply"}, logical = Logical.OR)
public Object getProjectList() {
List<LeadThoughtProject> list = baseService.dao().query(LeadThoughtProject.class, Cnd.where("isOpen", "=", 1));
return list;
}
}
@@ -0,0 +1,101 @@
package io.v.nutz.zhgh.leadthought.controller.basic;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtType;
import io.v.nutz.base.query.PageForm;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/leadThought/type")
public class LeadThoughtTypeController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/leadthought/basic/type.html")
@RequiresPermissions("leadThought.type")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("leadThought.type")
public Object pageData(PageForm pageForm, @Param(value = "typeName", required = false) String typeName) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("select * from lead_thought_type $condition");
cnd.and(Cnd.likeEX("typeName", typeName));
cnd.asc("sortNum");
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@RequiresPermissions("leadThought.type")
public Object doAdd(LeadThoughtType type) {
try {
int count = baseService.count("lead_thought_type", Cnd.where("typeCode", "=", type.getTypeCode()));
if (count > 0) {
return Result.error("编码重复");
}
baseService.dao().insert(type);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("leadThought.type")
public Object doEdit(LeadThoughtType type) {
try {
int count = baseService.count("lead_thought_type", Cnd.where("typeCode", "=", type.getTypeCode()).and("id", "!=", type.getId()));
if (count > 0) {
return Result.error("编码重复");
}
baseService.dao().update(type);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("leadThought.type")
public Object doDelete(String id) {
try {
baseService.clear("lead_thought_type", Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@ViReturn
@RequiresPermissions(value = {"leadThought.manage", "leadThought.apply", "leadThought.type"}, logical = Logical.OR)
public Object findAllType() {
return baseService.dao().query(LeadThoughtType.class, Cnd.where("isOpen", "=", 1).asc("sortNum"));
}
}
@@ -0,0 +1,46 @@
package io.v.nutz.zhgh.leadthought.model;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@EqualsAndHashCode(callSuper = true)
@Data
@Table
public class LeadThoughtFunds extends BaseModel {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("项目Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String projectId;
@Column
@Comment("开支科目")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String expenseAccount;
@Column
@Comment("向校工会申请经费")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String applyXghMoney;
@Column
@Comment("部门配套经费")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String deptMoney;
@Column
@Comment("合计")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String amountTo;
}
@@ -0,0 +1,208 @@
package io.v.nutz.zhgh.leadthought.model;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
@Table
@Comment("活动项目申报")
public class LeadThoughtInfo extends BaseModel {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("项目id(年度项目)")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String manageId;
@Column
@Comment("项目名称")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String projectName;
@Column
@Comment("申报单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String applyUnit;
@Column
@Comment("申报单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String applyUnitName;
@Column
@Comment("联合单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String jointUnit;
@Column
@Comment("联合单位")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String jointUnitName;
@Column
@Comment("项目负责人")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String headName;
@Column
@Comment("负责人Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("手机")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile;
@Column
@Comment("邮箱")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String email;
@Column
@Comment("项目规模(人数)")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String numberPeople;
@Column
@Comment("活动开始时间")
@ColDefine(type = ColType.DATE)
private Date startDate;
@Column
@Comment("活动结束时间")
@ColDefine(type = ColType.DATE)
private Date endDate;
@Column
@Comment("活动方案")
@ColDefine(type = ColType.TEXT)
private String programme;
@Column
@Comment("经费预算")
@ColDefine(type = ColType.TEXT)
private String budget;
@Column
@Comment("领导参加人数")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String numberLeader;
@Column
@Comment("骨干教师参加人数")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String numberTeacher;
@Column
@Comment("占本单位人数%比")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String unitPercentage;
@Column
@Comment("占本领导人数%比")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String leaderPercentage;
@Column
@Comment("占本骨干教师人数%比")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String teacherPercentage;
@Column
@Comment("立项类别")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String projectTheme;
@Column
@Comment("活动项目类别")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String typeId;
@Column
@Comment("项目主要内容/进度安排")
@ColDefine(type = ColType.TEXT)
private String content;
@Many(field = "projectId")
private List<LeadThoughtFunds> leadThoughtFunds;
@Column
@Comment("校工会经费合计")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String xghFundsAmount;
@Column
@Comment("部门经费合计")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String deptFundsAmount;
@Column
@Comment("总计")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String sumFundsAmount;
@Column
@ColDefine(type = ColType.VARCHAR, width = 10)
@Comment("分工会负责人")
private String fghFzr;
@Column
@ColDefine(type = ColType.TEXT)
@Comment("分工会负责人签字")
private String fghFzrQz;
@Column
@ColDefine(type = ColType.VARCHAR, width = 300)
@Comment("分工会意见")
private String fghOption;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("分工会审核时间")
private String fghTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 10)
@Comment("校工会负责人")
private String xghFzr;
@Column
@ColDefine(type = ColType.TEXT)
@Comment("校工会负责人签字")
private String xghFzrQz;
@Column
@ColDefine(type = ColType.VARCHAR, width = 300)
@Comment("校工会意见")
private String xghOption;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("校工会审核时间")
private String xghTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("填报时间")
private Date applyTime;
@Column
@ColDefine(type = ColType.INT)
@Comment("状态")
private Integer state;
}
@@ -0,0 +1,42 @@
package io.v.nutz.zhgh.leadthought.model;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@Table
@EqualsAndHashCode(callSuper = true)
public class LeadThoughtProject extends BaseModel {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String manageName;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String createTime;
@Column
@Comment("排序编号")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String sortNum;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否开启")
private boolean isOpen;
}
@@ -0,0 +1,46 @@
package io.v.nutz.zhgh.leadthought.model;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@Table
@EqualsAndHashCode(callSuper = true)
@Comment("活动项目申报类型")
public class LeadThoughtType extends BaseModel {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("类别编码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String typeCode;
@Column
@Comment("类型名称")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String typeName;
@Column
@Comment("类型描述")
@ColDefine(type = ColType.VARCHAR, width = 200)
private String typeDesc;
@Column
@Comment("排序编号")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String sortNum;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否开启")
private boolean isOpen;
}
@@ -0,0 +1,10 @@
package io.v.nutz.zhgh.leadthought.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtInfo;
import org.nutz.lang.util.NutMap;
public interface LeadThoughtInfoService extends BaseService<LeadThoughtInfo> {
NutMap findOne(String id);
}
@@ -0,0 +1,54 @@
package io.v.nutz.zhgh.leadthought.service.impl;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtFunds;
import io.v.nutz.zhgh.leadthought.model.LeadThoughtInfo;
import io.v.nutz.zhgh.leadthought.service.LeadThoughtInfoService;
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.Daos;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class LeadThoughtInfoServiceImpl extends BaseServiceImpl<LeadThoughtInfo> implements LeadThoughtInfoService {
public LeadThoughtInfoServiceImpl(Dao dao) {
super(dao);
}
@Inject
private BaseService baseService;
@Override
public NutMap findOne(String id) {
Sql sql = Sqls.create("""
SELECT
lti.*,
ltp.manageName,
ltt.typeName,
su.`name` AS applyUnitName,
ssu.`name` AS jointUnitName
FROM
`lead_thought_info` lti
LEFT JOIN `lead_thought_project` ltp ON ltp.id = lti.manageId
LEFT JOIN `sys_unit` su ON su.id = lti.applyUnit
LEFT JOIN `sys_unit` ssu ON ssu.id = lti.jointUnit
LEFT JOIN `lead_thought_type` ltt ON ltt.id = lti.typeId
LEFT JOIN `audit_state` au ON lti.state = au.stateId
LEFT JOIN `user` u ON u.id = lti.userId
where lti.id=@id
""");
sql.setParam("id", id);
NutMap record = (NutMap) Daos.query(baseService.dao(), sql.toString(), Sqls.callback.map());
List<LeadThoughtFunds> fundsList = baseService.dao().query(LeadThoughtFunds.class, Cnd.where("projectId", "=", record.getString("id")));
record.setv("funds", fundsList);
return record;
}
}