init
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.constants;
|
||||
|
||||
public class SwufeDifficultSubsidyStateCode {
|
||||
|
||||
/**
|
||||
* 待提交
|
||||
*/
|
||||
public static final Integer TO_BE_SUBMITTED = 7000;
|
||||
|
||||
/**
|
||||
* 待分工会审核
|
||||
*/
|
||||
public static final Integer BRANCH_UNION_AUDIT = 7010;
|
||||
|
||||
/**
|
||||
* 分工会拒绝
|
||||
*/
|
||||
public static final Integer BRANCH_UNION_REFUSE = 7020;
|
||||
|
||||
/**
|
||||
* 分工会退回
|
||||
*/
|
||||
public static final Integer BRANCH_UNION_BACK = 7030;
|
||||
|
||||
/**
|
||||
* 待校工会审核
|
||||
*/
|
||||
public static final Integer SCHOOL_AUDIT = 7040;
|
||||
|
||||
/**
|
||||
* 校工会拒绝
|
||||
*/
|
||||
public static final Integer SCHOOL_REFUSE = 7050;
|
||||
|
||||
/**
|
||||
* 校工会退回
|
||||
*/
|
||||
public static final Integer SCHOOL_BACK = 7060;
|
||||
|
||||
/**
|
||||
* 通过
|
||||
*/
|
||||
public static final Integer PASS = 7070;
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller;
|
||||
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyProject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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 java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/difficultSubsidy/common")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidyCommonController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
dao.fetchLinks(subsidyApply, null);
|
||||
return subsidyApply;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@ViReturn
|
||||
public Object projectInfo() {
|
||||
List<SwufeDifficultSubsidyProject> projects = dao.query(SwufeDifficultSubsidyProject.class, Cnd.NEW());
|
||||
dao.fetchLinks(projects, null);
|
||||
return projects;
|
||||
}
|
||||
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller.basicSetting;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyDiseaseType;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyProject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.ioc.aop.Aop;
|
||||
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
|
||||
@At("/platform/difficultSubsidy/basicSetting/project")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidyBasicSettingProjectController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@Ok("beetl:/platform/swufeDifficultSubsidy/basicSetting/project.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@ViReturn
|
||||
public Object saveProject(SwufeDifficultSubsidyProject project) {
|
||||
dao.insertOrUpdate(project);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At(value = {"/pageData", "/projectList"})
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@ViReturn
|
||||
public Object pageData() {
|
||||
List<SwufeDifficultSubsidyProject> list = dao.queryByJoin(SwufeDifficultSubsidyProject.class, "diseaseTypeList", Cnd.NEW());
|
||||
return list;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object delProject(Integer id) {
|
||||
dao.clear(SwufeDifficultSubsidyProject.class, Cnd.where("id", "=", id));
|
||||
dao.clear(SwufeDifficultSubsidyDiseaseType.class, Cnd.where("typeId", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@ViReturn
|
||||
public Object diseaseList(Integer projectId, @Param(value = "projectName", required = false) String projectName) {
|
||||
Cnd cnd = Cnd.where("typeId", "=", projectId);
|
||||
cnd.and(Cnd.likeEX("diseaseName", projectName));
|
||||
List<SwufeDifficultSubsidyDiseaseType> diseaseTypes = dao.query(SwufeDifficultSubsidyDiseaseType.class, cnd);
|
||||
return diseaseTypes;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@ViReturn
|
||||
public Object saveDisease(SwufeDifficultSubsidyDiseaseType diseaseType) {
|
||||
dao.insertOrUpdate(diseaseType);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.basicSetting.project")
|
||||
@ViReturn
|
||||
public Object delDisease(Integer id) {
|
||||
dao.delete(SwufeDifficultSubsidyDiseaseType.class, id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller.process;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.constants.SwufeDifficultSubsidyStateCode;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyProject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/difficultSubsidy/apply")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidyApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@Ok("beetl:/platform/swufeDifficultSubsidy/process/apply.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@ViReturn
|
||||
public Object projectInfo() {
|
||||
List<SwufeDifficultSubsidyProject> projects = dao.query(SwufeDifficultSubsidyProject.class, Cnd.NEW());
|
||||
dao.fetchLinks(projects, null);
|
||||
return projects;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@ViReturn
|
||||
public Object save(@Param(value = "apply") SwufeDifficultSubsidyApply apply) {
|
||||
apply.setUnitId(Vi.getUnit().getId());
|
||||
apply.setUnionName(Vi.getUnion().getUnionname());
|
||||
apply.setUnionId(Vi.getUnionId());
|
||||
apply.setStateId(7000);
|
||||
dao.insertOrUpdate(apply);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@ViReturn
|
||||
public Object submit(@Param(value = "apply") SwufeDifficultSubsidyApply apply) {
|
||||
apply.setUnitId(Vi.getUnit().getId());
|
||||
apply.setUnionName(Vi.getUnion().getUnionname());
|
||||
apply.setUnionId(Vi.getUnionId());
|
||||
if (Objects.equals(apply.getStateId(), SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT)) {
|
||||
apply.setStateId(SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT);
|
||||
} else {
|
||||
apply.setStateId(7010);
|
||||
}
|
||||
dao.insertOrUpdate(apply);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
return subsidyApply;
|
||||
}
|
||||
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller.process;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyProject;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.service.SwufeDifficultSubsidyApplyService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
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.Lang;
|
||||
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.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/difficultSubsidy/applyHistory")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidyApplyHistoryController {
|
||||
|
||||
@Inject
|
||||
private SwufeDifficultSubsidyApplyService applyService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("swufe.difficultSubsidy.applyHistory")
|
||||
@Ok("beetl:/platform/swufeDifficultSubsidy/process/applyHistory.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.applyHistory")
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "year", required = false) Integer year) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(applyDate)", "=", year);
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("loginName", "=", ShiroUtil.getPrincipalProperty("loginname"));
|
||||
}
|
||||
if (StrUtil.isBlank(pageForm.getPageOrderName()) || StrUtil.isBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.desc("applyDate");
|
||||
}
|
||||
|
||||
Pagination pagination = applyService.listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "state");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.applyHistory")
|
||||
@ViReturn
|
||||
public Object delete(String id) {
|
||||
dao.delete(SwufeDifficultSubsidyApply.class, id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.apply")
|
||||
@Ok("void")
|
||||
public void exportApplyInfo(String id, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
userName,
|
||||
loginName,
|
||||
sex,
|
||||
age,
|
||||
unitName,
|
||||
homeAddress,
|
||||
mobile,
|
||||
subsidyType,
|
||||
reason,
|
||||
files,
|
||||
branchUnionAuditId,
|
||||
schoolAuditId
|
||||
FROM
|
||||
swufe_difficult_subsidy_apply
|
||||
WHERE id = @id
|
||||
""");
|
||||
sql.setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.entity());
|
||||
sql.setEntity(dao.getEntity(SwufeDifficultSubsidyApply.class));
|
||||
dao.execute(sql);
|
||||
SwufeDifficultSubsidyApply applyInfo = (SwufeDifficultSubsidyApply) sql.getResult();
|
||||
|
||||
List<Integer> subsidyTypes = applyInfo.getSubsidyType();
|
||||
List<Sys_file> files = applyInfo.getFiles();
|
||||
|
||||
List<SwufeDifficultSubsidyProject> projects = dao.query(SwufeDifficultSubsidyProject.class, null);
|
||||
|
||||
NutMap applyInfoMap = Lang.obj2nutmap(applyInfo);
|
||||
String subsidyTypeNames = projects.stream().filter(x -> subsidyTypes.contains(x.getId())).map(x -> x.getProjectName()).collect(Collectors.joining("、"));
|
||||
applyInfoMap.put("subsidyTypeNames", subsidyTypeNames);
|
||||
|
||||
List picFiles = files.stream().map(x -> {
|
||||
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
||||
String filename = x.getFilename();
|
||||
String filepath = x.getFilepath();
|
||||
ftpService.download(filepath, os);
|
||||
PictureRenderData pictureRenderData = new PictureRenderData(100, 100, PictureType.PNG, new ByteArrayInputStream(os.toByteArray()));
|
||||
Map<String, Object> fileMap = new HashMap<>();
|
||||
fileMap.put("file", pictureRenderData);
|
||||
fileMap.put("fileName", filename);
|
||||
return fileMap;
|
||||
} catch (IOException e) {
|
||||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
applyInfoMap.put("picFiles", picFiles);
|
||||
|
||||
//单位、学校审核意见
|
||||
if (StrUtil.isNotBlank(applyInfo.getBranchUnionAuditId())) {
|
||||
Audit unitAudit = dao.fetch(Audit.class, applyInfo.getBranchUnionAuditId());
|
||||
applyInfoMap.put("unitOpinion", unitAudit.getAuditOpinion());
|
||||
applyInfoMap.put("unitAuditDate", DateUtil.format(unitAudit.getAuditTime(), "yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(applyInfo.getSchoolAuditId())) {
|
||||
Audit schoolAudit = dao.fetch(Audit.class, applyInfo.getSchoolAuditId());
|
||||
applyInfoMap.put("schoolOpinion", schoolAudit.getAuditOpinion());
|
||||
applyInfoMap.put("schoolAuditDate", DateUtil.format(schoolAudit.getAuditTime(), "yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
Configure config = Configure.builder().build();
|
||||
|
||||
try (ServletOutputStream os = response.getOutputStream()) {
|
||||
ViTool.excelResponse(response, "test.docx");
|
||||
// XWPFTemplate.compile("C:\\Users\\jug\\Desktop\\swufe2.docx", config).render(applyInfoMap).writeAndClose(os);
|
||||
XWPFTemplate.compile(officeTemplateUtil.getInputStream("swufe_difficult_apply"), config).render(applyInfoMap).writeAndClose(os);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller.process;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.constants.SwufeDifficultSubsidyStateCode;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.service.SwufeDifficultSubsidyApplyService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/difficultSubsidy/branchUnionAudit")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidyBranchUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SwufeDifficultSubsidyApplyService applyService;
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("swufe.difficultSubsidy.branchUnionAudit")
|
||||
@Ok("beetl:/platform/swufeDifficultSubsidy/process/branchUnionAudit.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.branchUnionAudit")
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "year", required = false) Integer year, Integer isAudit) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
apply.*,
|
||||
project.projectName
|
||||
FROM
|
||||
`swufe_difficult_subsidy_apply` apply
|
||||
LEFT JOIN swufe_difficult_subsidy_project project ON project.id = apply.subsidyType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
switch (isAudit) {
|
||||
case 0 -> cnd.and("stateId", ">=", SwufeDifficultSubsidyStateCode.BRANCH_UNION_AUDIT);
|
||||
case 1 -> cnd.and("stateId", ">", SwufeDifficultSubsidyStateCode.BRANCH_UNION_AUDIT);
|
||||
case -1 -> cnd.and("stateId", "=", SwufeDifficultSubsidyStateCode.BRANCH_UNION_AUDIT);
|
||||
}
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(applyDate)", "=", year);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = applyService.listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "state");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.branchUnionAudit")
|
||||
@ViReturn
|
||||
public Object revoke(String id) {
|
||||
dao.update(SwufeDifficultSubsidyApply.class, Chain.make("branchUnionAuditId", null).add("stateId", SwufeDifficultSubsidyStateCode.BRANCH_UNION_AUDIT), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拒绝
|
||||
*
|
||||
* @param audit 审计
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.branchUnionAudit")
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object refuse(Audit audit, String id) {
|
||||
audit.setAuditType(Audit.auditType.REFUSE.getCode());
|
||||
dao.insert(audit);
|
||||
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
|
||||
subsidyApply.setStateId(SwufeDifficultSubsidyStateCode.BRANCH_UNION_REFUSE);
|
||||
subsidyApply.setBranchUnionAuditId(audit.getId());
|
||||
subsidyApply.getBranchUnionAuditIds().add(audit.getId());
|
||||
|
||||
dao.update(subsidyApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回
|
||||
*
|
||||
* @param audit 审计
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.branchUnionAudit")
|
||||
@ViReturn
|
||||
public Object back(Audit audit, String id) {
|
||||
audit.setAuditType(Audit.auditType.BACK.getCode());
|
||||
dao.insert(audit);
|
||||
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
|
||||
subsidyApply.setStateId(SwufeDifficultSubsidyStateCode.BRANCH_UNION_BACK);
|
||||
subsidyApply.setBranchUnionAuditId(audit.getId());
|
||||
subsidyApply.getBranchUnionAuditIds().add(audit.getId());
|
||||
|
||||
dao.update(subsidyApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过
|
||||
*
|
||||
* @param audit 审计
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.branchUnionAudit")
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object pass(Audit audit, String id) {
|
||||
audit.setAuditType(Audit.auditType.PASS.getCode());
|
||||
dao.insert(audit);
|
||||
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
|
||||
subsidyApply.setStateId(SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT);
|
||||
subsidyApply.setBranchUnionAuditId(audit.getId());
|
||||
subsidyApply.getBranchUnionAuditIds().add(audit.getId());
|
||||
|
||||
dao.update(subsidyApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller.process;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
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.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.constants.SwufeDifficultSubsidyStateCode;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyDiseaseType;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.service.SwufeDifficultSubsidyApplyService;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/difficultSubsidy/query")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidyQueryController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SwufeDifficultSubsidyApplyService applyService;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("swufe.difficultSubsidy.query")
|
||||
@Ok("beetl:/platform/swufeDifficultSubsidy/query.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "year", required = false) Integer year, @Param(value = "unionId", required = false) String unionId, @Param(value = "unitId", required = false) String unitId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(applyDate)", "=", year);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("unionId", "=", unionId);
|
||||
cnd.and("stateId", "=", SwufeDifficultSubsidyStateCode.PASS);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
Pagination pagination = applyService.listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "state");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@Ok("void")
|
||||
public void exportSummary(Integer year, HttpServletResponse response) {
|
||||
Date now = new Date();
|
||||
int quarter = DateUtil.quarter(now);
|
||||
DateTime startTime = DateUtil.beginOfQuarter(now);
|
||||
DateTime endTime = DateUtil.endOfQuarter(now);
|
||||
|
||||
|
||||
//查询此季度的申请记录
|
||||
List<SwufeDifficultSubsidyApply> list = dao.query(SwufeDifficultSubsidyApply.class, Cnd.where(new SqlExpressionGroup().andBetween("applyDate", startTime, endTime)));
|
||||
|
||||
//1 重大疾病
|
||||
//2 门诊第二类特殊疾病
|
||||
//3 重大变故
|
||||
//4 普通疾病/住院护理
|
||||
|
||||
List<SwufeDifficultSubsidyApply> majorDiseasesList = list.stream().filter(v -> v.getSubsidyType().contains(1)).collect(Collectors.toList());
|
||||
List<SwufeDifficultSubsidyApply> outpatient2SpecialDiseasesList = list.stream().filter(v -> v.getSubsidyType().contains(2)).collect(Collectors.toList());
|
||||
List<SwufeDifficultSubsidyApply> severeCalamityList = list.stream().filter(v -> v.getSubsidyType().contains(3)).collect(Collectors.toList());
|
||||
List<SwufeDifficultSubsidyApply> inpatientCareList = list.stream().filter(v -> v.getSubsidyType().contains(4)).collect(Collectors.toList());
|
||||
|
||||
setMoreInfo(majorDiseasesList);
|
||||
setMoreInfo(outpatient2SpecialDiseasesList);
|
||||
setMoreInfo(severeCalamityList);
|
||||
setMoreInfo(inpatientCareList);
|
||||
|
||||
NutMap renderMap = NutMap.NEW();
|
||||
renderMap.put("year", year);
|
||||
renderMap.put("quarter", quarter);
|
||||
|
||||
renderMap.put("majorDiseasesCount", majorDiseasesList.size());
|
||||
renderMap.put("majorDiseasesList", majorDiseasesList);
|
||||
|
||||
renderMap.put("outpatient2SpecialDiseasesCount", outpatient2SpecialDiseasesList.size());
|
||||
renderMap.put("outpatient2SpecialDiseasesList", outpatient2SpecialDiseasesList);
|
||||
|
||||
renderMap.put("severeCalamityCount", severeCalamityList.size());
|
||||
renderMap.put("severeCalamityList", severeCalamityList);
|
||||
|
||||
renderMap.put("inpatientCareCount", inpatientCareList.size());
|
||||
renderMap.put("inpatientCareList", inpatientCareList);
|
||||
|
||||
renderMap.put("totalNum", list.stream().map(v -> v.getLoginName()).distinct().count());
|
||||
renderMap.put("totalMoney", list.stream().filter(v -> v.getFinalSubsidyAmount() != null).mapToDouble(v -> v.getFinalSubsidyAmount()).sum());
|
||||
renderMap.put("exportDate", DateUtil.format(now, "yyyy年MM月dd日"));
|
||||
|
||||
HackLoopTableRenderPolicy hackLoopTableRenderPolicy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.builder()
|
||||
.bind("majorDiseasesList", hackLoopTableRenderPolicy)
|
||||
.bind("outpatient2SpecialDiseasesList", hackLoopTableRenderPolicy)
|
||||
.bind("severeCalamityList", hackLoopTableRenderPolicy)
|
||||
.bind("inpatientCareList", hackLoopTableRenderPolicy)
|
||||
.build();
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, year + "年第" + quarter + "季度教职工特困部署申请汇总表.docx");
|
||||
// XWPFTemplate.compile(new File("C:\\Users\\jug\\Desktop\\swufe3.docx"), config).render(renderMap).writeAndClose(response.getOutputStream());
|
||||
XWPFTemplate.compile(officeTemplateUtil.getInputStream("swufe_difficult_summary"), config).render(renderMap).writeAndClose(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<SwufeDifficultSubsidyDiseaseType> diseaseTypes = new ArrayList<>();
|
||||
|
||||
private void setMoreInfo(List<SwufeDifficultSubsidyApply> list) {
|
||||
if (diseaseTypes.isEmpty()) {
|
||||
diseaseTypes = dao.query(SwufeDifficultSubsidyDiseaseType.class, null);
|
||||
}
|
||||
for (SwufeDifficultSubsidyApply apply : list) {
|
||||
List<NutMap> hospitalRecords = apply.getHospitalRecords();
|
||||
|
||||
//病情
|
||||
List<Integer> diseaseDetail = hospitalRecords.stream().flatMap(v -> v.getList("diseaseDetail", Integer.class).stream()).collect(Collectors.toList());
|
||||
String disease = diseaseTypes.stream().filter(v -> diseaseDetail.contains(v.getId())).map(v -> v.getDiseaseName()).collect(Collectors.joining("、"));
|
||||
apply.setDisease("病情:" + disease);
|
||||
|
||||
//住院天数
|
||||
|
||||
List<HashMap<String, Object>> HospitalizationDayList = hospitalRecords.stream().map(v -> {
|
||||
Date startDate = v.getTime("startDate");
|
||||
Date endDate = v.getTime("endDate");
|
||||
long day = DateUtil.betweenDay(startDate, endDate, true);
|
||||
|
||||
String startDateStr = DateUtil.format(startDate, "yyyy年MM月dd日");
|
||||
String endDateStr = DateUtil.format(endDate, "yyyy年MM月dd日");
|
||||
|
||||
return new HashMap<String, Object>() {{
|
||||
put("startDateStr", startDateStr);
|
||||
put("endDateStr", endDateStr);
|
||||
put("day", day);
|
||||
}};
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
String days = HospitalizationDayList.stream().map(v -> v.get("day") + "天").collect(Collectors.joining("+"));
|
||||
String dayInfos = HospitalizationDayList.stream().map(v -> v.get("startDateStr") + "-" + v.get("endDateStr")).collect(Collectors.joining(","));
|
||||
apply.setHospitalizationDays("住院天数:" + days + "(" + dayInfos + ")");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+407
@@ -0,0 +1,407 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.controller.process;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.constants.SwufeDifficultSubsidyStateCode;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyProject;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.service.SwufeDifficultSubsidyApplyService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.*;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
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.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/difficultSubsidy/schoolAudit")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SwufeDifficultSubsidySchoolAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SwufeDifficultSubsidyApplyService applyService;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@At("")
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@Ok("beetl:/platform/swufeDifficultSubsidy/process/schoolAudit.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, @Param(value = "year", required = false) Integer year, Integer isAudit, @Param(value = "unionId", required = false) String unionId, @Param(value = "unitId", required = false) String unitId
|
||||
|
||||
) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
switch (isAudit) {
|
||||
case 0 -> cnd.and("stateId", ">=", SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT);
|
||||
case 1 -> cnd.and("stateId", ">", SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT);
|
||||
case -1 -> cnd.and("stateId", "=", SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT);
|
||||
}
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(applyDate)", "=", year);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("unionId", "=", unionId);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
Pagination pagination = applyService.listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "state");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object revoke(String id) {
|
||||
dao.update(SwufeDifficultSubsidyApply.class, Chain.make("schoolAuditId", null).add("stateId", SwufeDifficultSubsidyStateCode.SCHOOL_AUDIT), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拒绝
|
||||
*
|
||||
* @param audit 审计
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object refuse(Audit audit, String id) {
|
||||
audit.setAuditType(Audit.auditType.REFUSE.getCode());
|
||||
dao.insert(audit);
|
||||
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
|
||||
subsidyApply.setStateId(SwufeDifficultSubsidyStateCode.SCHOOL_REFUSE);
|
||||
subsidyApply.setSchoolAuditId(audit.getId());
|
||||
subsidyApply.getSchoolAuditIds().add(audit.getId());
|
||||
|
||||
dao.update(subsidyApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回
|
||||
*
|
||||
* @param audit 审计
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object back(Audit audit, String id) {
|
||||
audit.setAuditType(Audit.auditType.BACK.getCode());
|
||||
dao.insert(audit);
|
||||
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
|
||||
subsidyApply.setStateId(SwufeDifficultSubsidyStateCode.SCHOOL_BACK);
|
||||
subsidyApply.setSchoolAuditId(audit.getId());
|
||||
subsidyApply.getSchoolAuditIds().add(audit.getId());
|
||||
|
||||
dao.update(subsidyApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过
|
||||
*
|
||||
* @param audit 审计
|
||||
* @param id id
|
||||
* @param subsidyAmount 补助金额
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object pass(Audit audit, String id, Float subsidyAmount, String hospitalRecords) {
|
||||
audit.setAuditType(Audit.auditType.PASS.getCode());
|
||||
dao.insert(audit);
|
||||
|
||||
List<NutMap> hospitals = Json.fromJsonAsList(NutMap.class, hospitalRecords);
|
||||
|
||||
SwufeDifficultSubsidyApply subsidyApply = dao.fetch(SwufeDifficultSubsidyApply.class, id);
|
||||
|
||||
subsidyApply.setStateId(SwufeDifficultSubsidyStateCode.PASS);
|
||||
subsidyApply.setSchoolAuditId(audit.getId());
|
||||
subsidyApply.getSchoolAuditIds().add(audit.getId());
|
||||
subsidyApply.setHospitalRecords(hospitals);
|
||||
subsidyApply.setSubsidyAmount(subsidyAmount);
|
||||
|
||||
dao.update(subsidyApply);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object getDiseaseDetail(String id) {
|
||||
Dao ext = Daos.ext(dao, FieldFilter.create(SwufeDifficultSubsidyApply.class, "^hospitalRecords$"));
|
||||
SwufeDifficultSubsidyApply subsidyApply = ext.fetch(SwufeDifficultSubsidyApply.class, Cnd.where("id", "=", id));
|
||||
List<NutMap> hospitalRecords = subsidyApply.getHospitalRecords();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@Ok("void")
|
||||
public void exportZip(Integer year, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
userName,
|
||||
loginName,
|
||||
sex,
|
||||
age,
|
||||
unitName,
|
||||
unionName,
|
||||
homeAddress,
|
||||
mobile,
|
||||
subsidyType,
|
||||
reason,
|
||||
files,
|
||||
branchUnionAuditId,
|
||||
schoolAuditId,
|
||||
applyDate
|
||||
FROM
|
||||
swufe_difficult_subsidy_apply
|
||||
WHERE YEAR(applyDate) = @year
|
||||
""");
|
||||
sql.setParam("year", year);
|
||||
sql.setCallback(Sqls.callback.entities());
|
||||
sql.setEntity(dao.getEntity(SwufeDifficultSubsidyApply.class));
|
||||
dao.execute(sql);
|
||||
List<SwufeDifficultSubsidyApply> applyInfos = (List<SwufeDifficultSubsidyApply>) sql.getResult();
|
||||
|
||||
Path root = Files.createTempDirectory("exportZip");
|
||||
|
||||
Map<String, List<SwufeDifficultSubsidyApply>> userApplyInfos = applyInfos.stream().collect(Collectors.groupingBy(v -> v.getLoginName()));
|
||||
|
||||
List<SwufeDifficultSubsidyProject> projects = dao.query(SwufeDifficultSubsidyProject.class, null);
|
||||
|
||||
for (Map.Entry<String, List<SwufeDifficultSubsidyApply>> entry : userApplyInfos.entrySet()) {
|
||||
List<SwufeDifficultSubsidyApply> s_applyInfo = entry.getValue();
|
||||
SwufeDifficultSubsidyApply firstApply = s_applyInfo.get(0);
|
||||
|
||||
Path userPath = Files.createDirectory(root.resolve(firstApply.getUserName() + "-" + firstApply.getUnionName()));
|
||||
for (int i = 0; i < s_applyInfo.size(); i++) {
|
||||
SwufeDifficultSubsidyApply applyInfo = s_applyInfo.get(i);
|
||||
|
||||
List<Integer> subsidyTypes = applyInfo.getSubsidyType();
|
||||
List<Sys_file> files = applyInfo.getFiles();
|
||||
|
||||
NutMap applyInfoMap = Lang.obj2nutmap(applyInfo);
|
||||
String subsidyTypeNames = projects.stream().filter(x -> subsidyTypes.contains(x.getId())).map(x -> x.getProjectName()).collect(Collectors.joining("、"));
|
||||
applyInfoMap.put("subsidyTypeNames", subsidyTypeNames);
|
||||
|
||||
List picFiles = files.stream().map(x -> {
|
||||
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
||||
String filename = x.getFilename();
|
||||
String filepath = x.getFilepath();
|
||||
ftpService.download(filepath, os);
|
||||
PictureRenderData pictureRenderData = new PictureRenderData(100, 100, PictureType.PNG, new ByteArrayInputStream(os.toByteArray()));
|
||||
Map<String, Object> fileMap = new HashMap<>();
|
||||
fileMap.put("file", pictureRenderData);
|
||||
fileMap.put("fileName", filename);
|
||||
return fileMap;
|
||||
} catch (IOException e) {
|
||||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
applyInfoMap.put("picFiles", picFiles);
|
||||
|
||||
String applyDate = DateUtil.format(applyInfo.getApplyDate(), "yyyy-MM-dd");
|
||||
Path file = Files.createFile(userPath.resolve(subsidyTypeNames + applyDate + "申请.docx"));
|
||||
|
||||
Configure config = Configure.builder().build();
|
||||
XWPFTemplate.compile(officeTemplateUtil.getInputStream("swufe_difficult_apply"), config).render(applyInfoMap).writeToFile(file.toString());
|
||||
}
|
||||
}
|
||||
|
||||
File zipFile = ZipUtil.zip(root.toString());
|
||||
ViTool.excelResponse(response, year + "年困难补助.zip");
|
||||
try (ServletOutputStream outputStream = response.getOutputStream(); FileInputStream zipFis = new FileInputStream(zipFile);) {
|
||||
IOUtils.copy(zipFis, outputStream);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
FileUtil.del(root);
|
||||
FileUtil.del(zipFile);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object calcSubsidyMoney(String id) {
|
||||
//本次申请记录
|
||||
SwufeDifficultSubsidyApply apply = dao.fetch(SwufeDifficultSubsidyApply.class, Cnd.where("id", "=", id));
|
||||
List<NutMap> hospitalRecords = apply.getHospitalRecords();
|
||||
|
||||
//补助金额
|
||||
long totalSubsidyMoney = 0;
|
||||
//住院费
|
||||
long totalHospitalMoney = 0;
|
||||
|
||||
//计算money
|
||||
for (NutMap hospitalRecord : hospitalRecords) {
|
||||
//计算补助
|
||||
List<Integer> diseaseDetail = hospitalRecord.getAsList("diseaseDetail", Integer.class);
|
||||
if (diseaseDetail.contains(1)) {
|
||||
//器官移植
|
||||
totalSubsidyMoney += 20000;
|
||||
hospitalRecord.put("subsidyMoney", 20000);
|
||||
} else if (Stream.of(7, 8, 9, 10, 11, 12).anyMatch(diseaseDetail::contains)) {
|
||||
//门诊第二类特殊疾病
|
||||
totalSubsidyMoney += 8000;
|
||||
hospitalRecord.put("subsidyMoney", 8000);
|
||||
} else if (Stream.of(13, 14, 15).anyMatch(diseaseDetail::contains)) {
|
||||
//重大变故
|
||||
if (hospitalRecord.getInt("selfFundedAmount") > 20000) {
|
||||
totalSubsidyMoney += 2000;
|
||||
hospitalRecord.put("subsidyMoney", 2000);
|
||||
}
|
||||
}
|
||||
|
||||
//计算住院
|
||||
int subsidyType = hospitalRecord.getInt("subsidyType");
|
||||
if (subsidyType == 1 || subsidyType == 2) {
|
||||
long hospitalDays = DateUtil.betweenDay(hospitalRecord.getTime("startDate"), hospitalRecord.getTime("endDate"), true);
|
||||
int hospitalMoney = calcHospitalMoney(hospitalDays, false);
|
||||
totalHospitalMoney += hospitalMoney;
|
||||
hospitalRecord.put("hospitalMoney", hospitalMoney);
|
||||
} else if (subsidyType == 4) {
|
||||
long hospitalDays = DateUtil.betweenDay(hospitalRecord.getTime("startDate"), hospitalRecord.getTime("endDate"), true);
|
||||
int hospitalMoney = calcHospitalMoney(hospitalDays, true);
|
||||
totalHospitalMoney += hospitalMoney;
|
||||
hospitalRecord.put("hospitalMoney", hospitalMoney);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//查询历史申请记录
|
||||
List<SwufeDifficultSubsidyApply> historyApply = dao.query(SwufeDifficultSubsidyApply.class, Cnd.where("id", "!=", id).and("loginName", "=", apply.getLoginName()).and("applyDate", "<", apply.getApplyDate()).desc("applyDate"));
|
||||
List<List<NutMap>> historyHospitalRecords = historyApply.stream().map(x -> x.getHospitalRecords()).collect(Collectors.toList());
|
||||
|
||||
return Map.of("hospitalRecords", hospitalRecords, "historyHospitalRecords", historyHospitalRecords, "totalSubsidyMoney", totalSubsidyMoney, "totalHospitalMoney", totalHospitalMoney);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hospitalDays 住院天数
|
||||
* @param generalDiseases 是否普通疾病
|
||||
* @return int 住院费
|
||||
* 住院护理补助
|
||||
* 住院1天-15天按半月算,住院16天-30天按一个月算 一般病住院400元/月
|
||||
* 重大疾病及第二类特殊疾病住院800元/月
|
||||
*/
|
||||
private int calcHospitalMoney(long hospitalDays, boolean generalDiseases) {
|
||||
if (hospitalDays <= 15) {
|
||||
if (generalDiseases) {
|
||||
return 200;
|
||||
} else {
|
||||
return 400;
|
||||
}
|
||||
} else if (hospitalDays <= 30) {
|
||||
if (generalDiseases) {
|
||||
return 400;
|
||||
} else {
|
||||
return 800;
|
||||
}
|
||||
} else {
|
||||
//这里要判断 超过30天的住院时间按一个月计算 看有几个月 然后计算剩下的天数是否满足16-30
|
||||
double m = (int) Math.floor(hospitalDays / 30);
|
||||
long s = hospitalDays % 30;
|
||||
if (s <= 15) {
|
||||
m += 0.5;
|
||||
} else {
|
||||
m += 1;
|
||||
}
|
||||
|
||||
if (generalDiseases) {
|
||||
return (int) (400 * m);
|
||||
} else {
|
||||
return (int) (800 * m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("swufe.difficultSubsidy.schoolAudit")
|
||||
@ViReturn
|
||||
public Object modifyFinalSubsidyMoney(String id, Float finalSubsidyAmount) {
|
||||
dao.update(SwufeDifficultSubsidyApply.class, Chain.make("finalSubsidyAmount", finalSubsidyAmount), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.model.AuditState;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.dao.interceptor.annotation.PrevUpdate;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
public class SwufeDifficultSubsidyApply extends BaseModel {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("ID")
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("姓名")
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("工号")
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1)
|
||||
@Comment("性别")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("年龄")
|
||||
private Integer age;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("部门ID")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("部门")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("分工会ID")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("分工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("家庭住址")
|
||||
private String homeAddress;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("联系电话")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("补助项目ID")
|
||||
@PrevInsert(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
@PrevUpdate(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
private List<Integer> subsidyType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("申请补助原因")
|
||||
private String reason;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("证明材料")
|
||||
@PrevInsert(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
@PrevUpdate(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
private List<Sys_file> files;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("住院记录")
|
||||
@PrevInsert(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
@PrevUpdate(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
private List<NutMap> hospitalRecords;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("申请时间")
|
||||
@PrevInsert(now = true)
|
||||
private Date applyDate;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("申请人所在单位审核ID")
|
||||
private String branchUnionAuditId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("申请人所在单位审核ID集合")
|
||||
@PrevInsert(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
private List<String> branchUnionAuditIds;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("学校审核ID")
|
||||
private String schoolAuditId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("学校审核ID集合")
|
||||
@PrevInsert(els = {@EL("$me.emptyList()")}, nullEffective = true)
|
||||
private List<String> schoolAuditIds;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("审核状态")
|
||||
private Integer stateId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.FLOAT, width = 10)
|
||||
@Comment("补助金额")
|
||||
private Float subsidyAmount;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.FLOAT, width = 10)
|
||||
@Comment("最终补助金额")
|
||||
private Float finalSubsidyAmount;
|
||||
|
||||
@One(field = "stateId")
|
||||
private AuditState state;
|
||||
|
||||
@One(field = "branchUnionAuditId")
|
||||
private Audit branchUnionAudit;
|
||||
|
||||
@One(field = "schoolAuditId")
|
||||
private Audit schoolAudit;
|
||||
|
||||
public List<NutMap> emptyList() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
//病情
|
||||
private String disease;
|
||||
|
||||
//住院天数
|
||||
private String hospitalizationDays;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
public class SwufeDifficultSubsidyDiseaseType extends BaseModel {
|
||||
|
||||
@Id
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("ID")
|
||||
private Integer id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("补助范围分类Id")
|
||||
private Integer typeId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
@Comment("疾病名称")
|
||||
private String diseaseName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("补助金额上限")
|
||||
private String subsidyAmountUpperLimit;
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 西南财大困难补贴项目
|
||||
*
|
||||
* @author jug
|
||||
* @date 2023/07/25
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
public class SwufeDifficultSubsidyProject extends BaseModel {
|
||||
|
||||
@Id
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("ID")
|
||||
private Integer id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("补助项目名称")
|
||||
private String projectName;
|
||||
|
||||
@Many(target = SwufeDifficultSubsidyDiseaseType.class, field = "typeId", key = "id")
|
||||
private List<SwufeDifficultSubsidyDiseaseType> diseaseTypeList;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.service;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
|
||||
public interface SwufeDifficultSubsidyApplyService extends BaseService<SwufeDifficultSubsidyApply> {
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package io.v.nutz.zhgh.swufeDifficultSubsidy.service.impl;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.model.SwufeDifficultSubsidyApply;
|
||||
import io.v.nutz.zhgh.swufeDifficultSubsidy.service.SwufeDifficultSubsidyApplyService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SwufeDifficultSubsidyApplyServiceImpl extends BaseServiceImpl<SwufeDifficultSubsidyApply> implements SwufeDifficultSubsidyApplyService {
|
||||
public SwufeDifficultSubsidyApplyServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user