first commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package io.v.nutz.sickHelp.constant;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 历史excel模型
|
||||
*
|
||||
* @FileName io.v.nutz.sickHelp.constant.HistoryExcelModel
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/5/7:16:56
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
public class HistoryExcelModel {
|
||||
private String userId;
|
||||
|
||||
@Excel(name = "工资号", width = 20d)
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "姓名", width = 20d)
|
||||
private String userName;
|
||||
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "自费金额(元)", width = 20)
|
||||
private BigDecimal selfPayMoney;
|
||||
|
||||
@Excel(name = "补助金额(元)", width = 20)
|
||||
private BigDecimal subsidyMoney;
|
||||
|
||||
@Excel(name = "最近年度", width = 20)
|
||||
private Integer lastTimeSubsidyYear;
|
||||
|
||||
@Excel(name = "补助比例", width = 20)
|
||||
private String subsidyRatio;
|
||||
|
||||
@Excel(name = "补助说明", width = 20)
|
||||
private String subsidyDesc;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.v.nutz.sickHelp.constant;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.constant.NutzExcelExportEntity
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/5/13:16:32
|
||||
* @Version V1.0
|
||||
**/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class NutzExcelExportEntity extends ExcelExportEntity {
|
||||
|
||||
public NutzExcelExportEntity(String name, Object key, int width, boolean needMerge) {
|
||||
super.name = name;
|
||||
super.setKey(key);
|
||||
super.setWidth(width);
|
||||
super.setNeedMerge(needMerge);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package io.v.nutz.sickHelp.constant;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.sickHelp.model.SickFundMember;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import lombok.Data;
|
||||
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 java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.constant.SickHelpApply
|
||||
* @Description: 判断大病用户连续参加互助会多少年了
|
||||
* @Author zxc
|
||||
* @Date 2022/4/22:17:03
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@IocBean
|
||||
public class SickHelpApply {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
|
||||
/**
|
||||
* 南中医计算方法
|
||||
* 一般是今年算去年的数据
|
||||
* 判断大病用户连续参加互助会多少年了 并计算出额外的补助比例
|
||||
*
|
||||
* @param loginName 登录名
|
||||
* @param year 排除的year 编辑的时候需要把本身年度排除 新增的时候这个值为空
|
||||
* @return double
|
||||
*/
|
||||
public double continuousJoinYear(String loginName, Integer year) {
|
||||
|
||||
SickFundMember fundMember = dao.fetch(SickFundMember.class, Cnd.where("loginName", "=", loginName));
|
||||
|
||||
if (fundMember == null) {
|
||||
return 0d;
|
||||
}
|
||||
|
||||
//起扣年度
|
||||
int mutualGoldStartYear = Integer.parseInt(fundMember.getMutualGoldStartTime());
|
||||
|
||||
//当前年度
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
|
||||
//补助年度
|
||||
int grantYear = currentYear - 1;
|
||||
|
||||
Cnd recordCnd = Cnd.where("loginName", "=", loginName);
|
||||
SqlExpressionGroup sqlExpression = new SqlExpressionGroup();
|
||||
sqlExpression.andBetween("year", mutualGoldStartYear, grantYear);
|
||||
recordCnd.and(sqlExpression);
|
||||
recordCnd.andEX("year", "!=", year);
|
||||
List<SickHelp> recordList = dao.query(SickHelp.class, recordCnd);
|
||||
|
||||
//多少年未申请
|
||||
int notApplyYear = 0;
|
||||
|
||||
if (recordList == null || recordList.size() == 0) {
|
||||
//参加了从来没有申请过
|
||||
notApplyYear = grantYear - mutualGoldStartYear;
|
||||
} else {
|
||||
//参加了申请过 要看看距离上一次申请是否超过了5年或者10年
|
||||
SickHelp maxRecord = recordList.stream().max(Comparator.comparingInt(v -> v.getYear())).get();
|
||||
Integer maxYear = maxRecord.getYear();
|
||||
notApplyYear = grantYear - maxYear;
|
||||
}
|
||||
|
||||
if (notApplyYear >= 10) {
|
||||
return 0.1d;
|
||||
} else if (notApplyYear >= 5) {
|
||||
return 0.05d;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多少年没申请
|
||||
*
|
||||
* @param loginName 登录名
|
||||
* @param year 排除的year 编辑的时候需要把本身年度排除 新增的时候这个值为空
|
||||
* @return int
|
||||
*/
|
||||
public int howManyYearsDidNotApply(String loginName, Integer year) {
|
||||
SickFundMember fundMember = dao.fetch(SickFundMember.class, Cnd.where("loginName", "=", loginName));
|
||||
|
||||
//起扣年度
|
||||
DateTime mgsTime = DateUtil.parse(fundMember.getMutualGoldStartTime());
|
||||
int mutualGoldStartYear = mgsTime.getField(DateField.YEAR);
|
||||
|
||||
//补助年度
|
||||
int grantYear = year;
|
||||
|
||||
Cnd recordCnd = Cnd.where("loginName", "=", loginName);
|
||||
SqlExpressionGroup sqlExpression = new SqlExpressionGroup();
|
||||
sqlExpression.andBetween("year", mutualGoldStartYear, grantYear);
|
||||
recordCnd.and(sqlExpression);
|
||||
recordCnd.andEX("year", "!=", year);
|
||||
List<SickHelp> recordList = dao.query(SickHelp.class, recordCnd);
|
||||
|
||||
//多少年未申请
|
||||
int notApplyYear = 0;
|
||||
|
||||
//从来没有申请过 从加入那一年开始计算
|
||||
//申请过的 从申请过的第二年开始计算
|
||||
|
||||
if (recordList == null || recordList.size() == 0) {
|
||||
//参加了从来没有申请过
|
||||
notApplyYear = grantYear - mutualGoldStartYear + 1;
|
||||
} else {
|
||||
//参加了申请过 要看看距离上一次申请是否超过了5年或者15年
|
||||
SickHelp maxRecord = recordList.stream().max(Comparator.comparingInt(v -> v.getYear())).get();
|
||||
Integer maxYear = maxRecord.getYear();
|
||||
notApplyYear = grantYear - maxYear;
|
||||
}
|
||||
|
||||
return notApplyYear;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
package io.v.nutz.sickHelp.constant;
|
||||
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import lombok.Getter;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 大病互助算钱 算比例
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum SickHelpCalc {
|
||||
|
||||
/**
|
||||
* 江苏南京中医药计算方法
|
||||
*/
|
||||
NJUCM {
|
||||
@Override
|
||||
public SickHelp calc(SickHelp sr) {
|
||||
//???? out
|
||||
if (sr.getSelfPayMoney() == null || sr.getYear() == null) {
|
||||
sr.setSubsidyMoney(null);
|
||||
sr.setTotalSubsidyRatio(null);
|
||||
return sr;
|
||||
}
|
||||
|
||||
//补助比例
|
||||
double subsidyRatio = 0d;
|
||||
|
||||
//年度补助最高金额
|
||||
double maxSubsidyMoney = 40000.00;
|
||||
|
||||
//自付金额
|
||||
double spd = sr.getSelfPayMoney().doubleValue();
|
||||
|
||||
//小于3000???? 直接out
|
||||
if (spd < 3000) {
|
||||
sr.setSubsidyMoney(null);
|
||||
sr.setTotalSubsidyRatio(null);
|
||||
return sr;
|
||||
}
|
||||
|
||||
if (spd >= 3000 && spd <= 20000) {
|
||||
subsidyRatio += 0.3d;
|
||||
sr.setSelfPaySubsidyRatio(0.3d);
|
||||
} else if (20000 < spd && spd <= 30000) {
|
||||
subsidyRatio += 0.4d;
|
||||
sr.setSelfPaySubsidyRatio(0.4d);
|
||||
} else if (spd > 30000) {
|
||||
subsidyRatio += 0.5d;
|
||||
sr.setSelfPaySubsidyRatio(0.5d);
|
||||
}
|
||||
|
||||
//额外的补助比例
|
||||
double otherSubsidyRatio = sickHelpApply.continuousJoinYear(sr.getLoginName(), sr.getId() == null ? null : sr.getYear());
|
||||
sr.setOtherSubsidyRatio(otherSubsidyRatio);
|
||||
subsidyRatio += otherSubsidyRatio;
|
||||
|
||||
//算出补助金额
|
||||
double subsidyMoney = spd * subsidyRatio;
|
||||
|
||||
//计算是否超过限额
|
||||
if (subsidyMoney > maxSubsidyMoney) {
|
||||
subsidyMoney += (subsidyMoney - maxSubsidyMoney) * 0.1;
|
||||
}
|
||||
|
||||
//返回最终的补助比例 和 补助金额
|
||||
sr.setTotalSubsidyRatio(subsidyRatio);
|
||||
sr.setSubsidyMoney(new BigDecimal(String.valueOf(subsidyMoney)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
//补助说明
|
||||
if (otherSubsidyRatio == 0.05) {
|
||||
sr.setSubsidyDesc("满五年且未补助");
|
||||
} else if (otherSubsidyRatio == 0.1) {
|
||||
sr.setSubsidyDesc("满十年且未补助");
|
||||
} else if (otherSubsidyRatio == 0) {
|
||||
if (sr.getLastTimeSubsidyYear() == null) {
|
||||
sr.setSubsidyDesc("未满五年");
|
||||
} else {
|
||||
sr.setSubsidyDesc("是");
|
||||
}
|
||||
}
|
||||
|
||||
//南中医默认接受补助
|
||||
sr.setIsAccept(true);
|
||||
return sr;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 江苏河海大学计算方法
|
||||
*/
|
||||
HHU {
|
||||
@Override
|
||||
public SickHelp calc(SickHelp sr) {
|
||||
if (sr.getSelfPayMoney() == null || sr.getYear() == null) {
|
||||
sr.setSubsidyMoney(null);
|
||||
sr.setTotalSubsidyRatio(null);
|
||||
return sr;
|
||||
}
|
||||
//补助比例
|
||||
double subsidyRatio = 0d;
|
||||
|
||||
//年度补助最高金额
|
||||
double maxSubsidyMoney = 30000.00;
|
||||
|
||||
//自付金额
|
||||
double spd = sr.getSelfPayMoney().doubleValue();
|
||||
|
||||
//小于4000???? 直接out
|
||||
if (spd < 4000) {
|
||||
sr.setSubsidyMoney(null);
|
||||
sr.setTotalSubsidyRatio(null);
|
||||
return sr;
|
||||
}
|
||||
|
||||
//增加的比例
|
||||
double otherSubsidyRatio = 0;
|
||||
|
||||
Integer calcYear = null;
|
||||
if (sr.getId() == null) {
|
||||
if (sr.getYear() != null) {
|
||||
calcYear = sr.getYear();
|
||||
}
|
||||
} else {
|
||||
calcYear = sr.getYear();
|
||||
}
|
||||
|
||||
int howManyDidNotApplyYears = sickHelpApply.howManyYearsDidNotApply(sr.getLoginName(), calcYear);
|
||||
|
||||
if (howManyDidNotApplyYears >= 15) {
|
||||
otherSubsidyRatio = 0.1d;
|
||||
sr.setSubsidyDesc("满十五年且未补助");
|
||||
} else if (howManyDidNotApplyYears >= 5) {
|
||||
otherSubsidyRatio = howManyDidNotApplyYears >= 10 ? 0.1d : howManyDidNotApplyYears * 0.01;
|
||||
sr.setSubsidyDesc("满五年且未补助");
|
||||
}
|
||||
|
||||
sr.setOtherSubsidyRatio(otherSubsidyRatio);
|
||||
|
||||
//按照比例算出来的钱
|
||||
double subsidyMoney = 0.00d;
|
||||
|
||||
if (spd > 30000) {
|
||||
subsidyMoney = subsidyMoney + ((10000 - 4000) * (0.25d + otherSubsidyRatio));
|
||||
subsidyMoney = subsidyMoney + ((20000 - 10000) * (0.40d + otherSubsidyRatio));
|
||||
subsidyMoney = subsidyMoney + ((30000 - 20000) * (0.50d + otherSubsidyRatio));
|
||||
subsidyMoney = subsidyMoney + ((spd - 30000) * (0.60d + otherSubsidyRatio));
|
||||
}
|
||||
|
||||
if (spd > 20000 && spd <= 30000) {
|
||||
subsidyMoney = subsidyMoney + ((10000 - 4000) * (0.25d + otherSubsidyRatio));
|
||||
subsidyMoney = subsidyMoney + ((20000 - 10000) * (0.40d + otherSubsidyRatio));
|
||||
subsidyMoney = subsidyMoney + ((spd - 20000) * (0.50d + otherSubsidyRatio));
|
||||
}
|
||||
|
||||
if (spd > 10000 && spd <= 20000) {
|
||||
subsidyMoney = subsidyMoney + ((10000 - 4000) * (0.25d + otherSubsidyRatio));
|
||||
subsidyMoney = subsidyMoney + ((spd - 10000) * (0.40d + otherSubsidyRatio));
|
||||
}
|
||||
|
||||
if (spd > 4000 && spd <= 10000) {
|
||||
subsidyMoney = subsidyMoney + ((spd - 4000) * (0.25d + otherSubsidyRatio));
|
||||
}
|
||||
|
||||
sr.setNoLimitSubsidyMoney(NumberUtil.round(subsidyMoney, 2, RoundingMode.UP));
|
||||
|
||||
if (subsidyMoney > 30000) {
|
||||
if (howManyDidNotApplyYears >= 15) {
|
||||
sr.setSubsidyMoney(NumberUtil.round(subsidyMoney, 0, RoundingMode.UP));
|
||||
} else {
|
||||
sr.setSubsidyMoney(NumberUtil.round(30000, 0, RoundingMode.UP));
|
||||
}
|
||||
} else {
|
||||
sr.setSubsidyMoney(NumberUtil.round(subsidyMoney, 0, RoundingMode.UP));
|
||||
}
|
||||
|
||||
sr.setIsAccept(null);
|
||||
|
||||
//补助说明
|
||||
|
||||
if (otherSubsidyRatio == 0.05) {
|
||||
sr.setSubsidyDesc("满五年且未补助");
|
||||
} else if (otherSubsidyRatio == 0.15) {
|
||||
sr.setSubsidyDesc("满十五年且未补助");
|
||||
} else if (otherSubsidyRatio == 0) {
|
||||
if (sr.getLastTimeSubsidyYear() == null) {
|
||||
sr.setSubsidyDesc("未满五年");
|
||||
} else {
|
||||
sr.setSubsidyDesc("是");
|
||||
}
|
||||
}
|
||||
|
||||
return sr;
|
||||
}
|
||||
|
||||
// //???? out
|
||||
// if (StrUtil.isBlank(sr.getUserId()) || sr.getSelfPayMoney() == null || sr.getYear() == null) {
|
||||
// sr.setSubsidyMoney(null);
|
||||
// sr.setTotalSubsidyRatio(null);
|
||||
// return sr;
|
||||
// }
|
||||
//
|
||||
// //补助比例
|
||||
// double subsidyRatio = 0d;
|
||||
//
|
||||
// //不解释
|
||||
// double siK = 4000.00;
|
||||
// double yiW = 10000.00;
|
||||
// double erW = 20000.00;
|
||||
// double sanW = 30000.00;
|
||||
//
|
||||
// double siK2yiW = 0.25;
|
||||
// double yiW2erW = 0.40;
|
||||
// double erW2sanW = 0.50;
|
||||
// double sanWYiShang = 0.60;
|
||||
//
|
||||
// //年度补助最高金额
|
||||
// double maxSubsidyMoney = 30000.00;
|
||||
//
|
||||
// //自付金额
|
||||
// double spd = sr.getSelfPayMoney().doubleValue();
|
||||
//
|
||||
// //小于4000???? 直接out
|
||||
// if (spd < siK) {
|
||||
// sr.setSubsidyMoney(null);
|
||||
// sr.setTotalSubsidyRatio(null);
|
||||
// return sr;
|
||||
// }
|
||||
//
|
||||
//// //连续参加多少年了
|
||||
//// Integer continuousJoinYear = new SickHelpApply().continuousJoinYear(sr.getUserId());
|
||||
////
|
||||
//// //是否申请过
|
||||
//// boolean hasHistoryApplyRecord = sr.getLastTimeSubsidyYear() != null;
|
||||
////
|
||||
//// //增加的比例
|
||||
//// double addRatio = 0;
|
||||
////
|
||||
//// //没有申请过
|
||||
//// if (!hasHistoryApplyRecord) {
|
||||
//// if (continuousJoinYear >= 15) {
|
||||
//// //连续参加十五年且没申请过
|
||||
//// //最高就10个点
|
||||
//// addRatio = 0.1;
|
||||
//// } else if (continuousJoinYear >= 5) {
|
||||
//// //连续参加五年且小于十五年没申请过
|
||||
//// //最高就10个点 小于10年的每年加1个点
|
||||
//// addRatio = continuousJoinYear >= 10 ? 0.1 : continuousJoinYear * 0.01;
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
//// siK2yiW += addRatio;
|
||||
//// yiW2erW += addRatio;
|
||||
//// erW2sanW += addRatio;
|
||||
//// sanWYiShang += addRatio;
|
||||
//
|
||||
// //按照比例算出来的钱
|
||||
// double subsidyMoney = 0.00d;
|
||||
//
|
||||
// if (spd < yiW) {
|
||||
// subsidyMoney += spd * siK2yiW;
|
||||
// }
|
||||
// if (spd > yiW && spd < erW) {
|
||||
// subsidyMoney += spd * yiW2erW;
|
||||
// }
|
||||
// if (spd > erW && spd < sanW) {
|
||||
// subsidyMoney += spd * erW2sanW;
|
||||
// }
|
||||
// if (spd > sanW) {
|
||||
// subsidyMoney += subsidyMoney * sanWYiShang;
|
||||
// }
|
||||
//
|
||||
// //返回最终的补助比例 和 补助金额
|
||||
// sr.setTotalSubsidyRatio(subsidyRatio);
|
||||
// if (subsidyMoney > sanW) {
|
||||
// //大于三万了除非没申请过且连续参加十五年 该补助多少钱就多少 否则超过三万了都按三万来算
|
||||
// if (!hasHistoryApplyRecord && continuousJoinYear >= 15) {
|
||||
// sr.setSubsidyMoney(new BigDecimal(String.valueOf(subsidyMoney)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
// } else {
|
||||
// sr.setSubsidyMoney(new BigDecimal(String.valueOf(sanW)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
// }
|
||||
// } else {
|
||||
// sr.setSubsidyMoney(new BigDecimal(String.valueOf(subsidyMoney)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
// }
|
||||
//
|
||||
// //河海需要用户去手动选择接受不接受
|
||||
// sr.setIsAccept(null);
|
||||
// return sr;
|
||||
// }
|
||||
},
|
||||
|
||||
/**
|
||||
* 南京大学
|
||||
*/
|
||||
NJU {
|
||||
@Override
|
||||
public SickHelp calc(SickHelp sr) {
|
||||
|
||||
return sr;
|
||||
// double yiW = 10000.00;
|
||||
// double erW = 20000.00;
|
||||
// double sanW = 30000.00;
|
||||
// double wuW = 50000.00;
|
||||
//
|
||||
// double yiWYiXia = 0.20;
|
||||
// double yiW2erW = 0.30;
|
||||
// double erW2sanW = 0.35;
|
||||
// double sanW2wuW = 0.40;
|
||||
// double wuWYiShang = 0.45;
|
||||
//
|
||||
// //年度补助最高金额
|
||||
// double maxSubsidyMoney = 50000.00;
|
||||
//
|
||||
// //自付金额
|
||||
// double spd = sr.getSelfPayMoney().doubleValue();
|
||||
//
|
||||
// //连续参加多少年了
|
||||
// Integer continuousJoinYear = new SickHelpApply().continuousJoinYear(sr.getUserId());
|
||||
// //是否申请过
|
||||
// boolean hasHistoryApplyRecord = sr.getLastTimeSubsidyYear() != null;
|
||||
//
|
||||
// //增加的比例
|
||||
// double addRatio = 0;
|
||||
//
|
||||
// //没有申请过
|
||||
// if (!hasHistoryApplyRecord) {
|
||||
// if (continuousJoinYear >= 10) {
|
||||
// //连续参加十年且没申请过
|
||||
// //最高就15个点
|
||||
// addRatio = 0.15d;
|
||||
// } else if (continuousJoinYear >= 5) {
|
||||
// //连续参加五年没申请过
|
||||
// //最高就10个点
|
||||
// addRatio = 0.10d;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// yiWYiXia += addRatio;
|
||||
// yiW2erW += addRatio;
|
||||
// erW2sanW += addRatio;
|
||||
// sanW2wuW += addRatio;
|
||||
// wuWYiShang += addRatio;
|
||||
//
|
||||
// //按照比例算出来的钱
|
||||
// double subsidyMoney = 0.00d;
|
||||
//
|
||||
// if (spd < yiW) {
|
||||
// subsidyMoney += spd * yiWYiXia;
|
||||
// }
|
||||
// if (spd > yiW && spd < erW) {
|
||||
// subsidyMoney += spd * yiW2erW;
|
||||
// }
|
||||
// if (spd > erW && spd < sanW) {
|
||||
// subsidyMoney += spd * erW2sanW;
|
||||
// }
|
||||
// if (spd > sanW && spd < wuW) {
|
||||
// subsidyMoney += spd * sanW2wuW;
|
||||
// }
|
||||
// if (spd > wuW) {
|
||||
// subsidyMoney += spd * wuWYiShang;
|
||||
// }
|
||||
//
|
||||
// if (subsidyMoney > maxSubsidyMoney) {
|
||||
// sr.setSubsidyMoney(new BigDecimal(String.valueOf(maxSubsidyMoney)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
// } else {
|
||||
// sr.setSubsidyMoney(new BigDecimal(String.valueOf(subsidyMoney)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
// }
|
||||
//
|
||||
// //南大默认接受补助
|
||||
// sr.setIsAccept(true);
|
||||
// return sr;
|
||||
}
|
||||
};
|
||||
|
||||
public SickHelpApply sickHelpApply = Mvcs.getIoc().get(SickHelpApply.class);
|
||||
|
||||
public Dao dao = Mvcs.getIoc().get(Dao.class);
|
||||
|
||||
/**
|
||||
* 计算用户本次补助的比例 和 补助的金额
|
||||
*/
|
||||
public abstract SickHelp calc(SickHelp sickHelp);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package io.v.nutz.sickHelp.constant;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.SelectEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.constant.SickHelpStateEnum
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/5/12:15:07
|
||||
* @Version V1.0
|
||||
**/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@SelectEnum
|
||||
public enum SickHelpStateEnum {
|
||||
|
||||
/**
|
||||
* 待基层工会审核
|
||||
*/
|
||||
DFGHSH(100, "待基层工会审核", "#1867b0"),
|
||||
|
||||
/**
|
||||
* 基层工会拒绝
|
||||
*/
|
||||
FGHJJ(200, "基层工会拒绝", "#f56c6c"),
|
||||
|
||||
|
||||
/**
|
||||
* 待申请人填写
|
||||
*/
|
||||
DTJ(210, "待申请人填写", "#1867b0"),
|
||||
|
||||
|
||||
/**
|
||||
* 待校医院审核
|
||||
*/
|
||||
DXYYSH(300, "待校医院审核", "#1867b0"),
|
||||
|
||||
/**
|
||||
* 校医院拒绝
|
||||
*/
|
||||
XYYJJ(400, "校医院拒绝", "#f56c6c"),
|
||||
|
||||
/**
|
||||
* 待校工会审核
|
||||
*/
|
||||
DXGHSH(500, "待校工会审核", "#1867b0"),
|
||||
|
||||
/**
|
||||
* 校工会拒绝
|
||||
*/
|
||||
XGHJJ(600, "校工会拒绝", "#f56c6c"),
|
||||
|
||||
/**
|
||||
* 校工会通过
|
||||
*/
|
||||
XGHTG(700, "校工会通过", "#15db81 ");
|
||||
|
||||
|
||||
/**
|
||||
* 缓存状态map
|
||||
*/
|
||||
static Map<Integer, String> stateCacheMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
SickHelpStateEnum[] values = SickHelpStateEnum.values();
|
||||
for (SickHelpStateEnum stateEnum : values) {
|
||||
stateCacheMap.put(stateEnum.getStateCode(), stateEnum.getStateName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private final Integer stateCode;
|
||||
/**
|
||||
* 状态名称
|
||||
*/
|
||||
private final String stateName;
|
||||
/**
|
||||
* 状态颜色
|
||||
*/
|
||||
private final String stateColor;
|
||||
|
||||
|
||||
/**
|
||||
* 赋值state完整信息
|
||||
*
|
||||
* @param pagination 分页数据
|
||||
* @return
|
||||
*/
|
||||
public static Pagination assignStateInfo(Pagination pagination) {
|
||||
SickHelpStateEnum[] values = SickHelpStateEnum.values();
|
||||
|
||||
List<NutMap> list = pagination.getList();
|
||||
for (NutMap m : list) {
|
||||
int state = m.getInt("stateCode", -1);
|
||||
m.put("stateName", stateCacheMap.get(state));
|
||||
String stateColor = Arrays.stream(values).filter(v -> v.getStateCode().equals(state)).findFirst().map(v -> v.getStateColor()).orElse(null);
|
||||
m.put("stateColor", stateColor);
|
||||
}
|
||||
return pagination;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.sickHelp.constant;
|
||||
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.constant.SubsidyResult
|
||||
* @Description: 大病互助计算结果类
|
||||
* @Author zxc
|
||||
* @Date 2022/4/21:10:22
|
||||
* @Version V1.0
|
||||
**/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SubsidyResult extends SickHelp {
|
||||
|
||||
/**
|
||||
* 单位名字
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 是否校验成功
|
||||
*/
|
||||
private Boolean valid;
|
||||
|
||||
/**
|
||||
* 是否校验成功
|
||||
*/
|
||||
private List<String> validMsg;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.v.nutz.sickHelp.controller;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.sickHelp.service.SickHelpChartService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.SickHelpChartController
|
||||
* @Description: 大病图表
|
||||
* @Author zxc
|
||||
* @Date 2022/4/22:10:26
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/chart")
|
||||
public class SickHelpChartController {
|
||||
|
||||
@Inject
|
||||
private SickHelpChartService sickHelpChartService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/chart/index.html")
|
||||
@RequiresPermissions("sickHelp.chart")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object getSickCountData() {
|
||||
return sickHelpChartService.getSickCountData();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object getYearCountData() {
|
||||
return sickHelpChartService.getYearCountData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package io.v.nutz.sickHelp.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpImportService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/import")
|
||||
@Slf4j
|
||||
public class SickHelpImportController {
|
||||
|
||||
static List<ExcelExportEntity> excelTemplateEntityList = new ArrayList<>();
|
||||
|
||||
static {
|
||||
// excelTemplateEntityList.add(new ExcelExportEntity("申报年度", "year", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("人员代码", "loginName", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
// excelTemplateEntityList.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("个人支付金额(元)", "selfPayMoney", 20));
|
||||
// excelTemplateEntityList.add(new ExcelExportEntity("账号", "hospitalAccount", 20));
|
||||
// excelTemplateEntityList.add(new ExcelExportEntity("补助金额(元)", "", 20));
|
||||
// excelTemplateEntityList.add(new ExcelExportEntity("最近年度", "", 20));
|
||||
// excelTemplateEntityList.add(new ExcelExportEntity("补助比例", "", 20));
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SickHelpImportService sickHelpImportService;
|
||||
|
||||
@At(value = "/platform/sickHelp/importByExcel", top = true)
|
||||
@Ok("beetl:/platform/sickHelp/import/excel.html")
|
||||
@RequiresPermissions("sickHelp.import.excel")
|
||||
public void excel() {
|
||||
|
||||
}
|
||||
|
||||
@At(value = "/platform/sickHelp/importByForm", top = true)
|
||||
@Ok("beetl:/platform/sickHelp/import/form.html")
|
||||
@RequiresPermissions("sickHelp.import.form")
|
||||
public void form() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取excel数据
|
||||
*
|
||||
* @param tempFile
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@ViReturn
|
||||
public Object readExcel(@Param("file") TempFile tempFile) {
|
||||
ImportParams importParams = new ImportParams();
|
||||
List<SickHelp> sickHelpList = ExcelImportUtil.importExcel(tempFile.getFile(), SickHelp.class, importParams);
|
||||
if (Lang.isEmpty(sickHelpList)) {
|
||||
return Result.error("excel为空");
|
||||
}
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
for (SickHelp sick : sickHelpList) {
|
||||
sick.setYear(currentYear - 1);
|
||||
}
|
||||
List<SickHelp> checkList = sickHelpImportService.checkData(sickHelpList);
|
||||
return checkList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验数据
|
||||
*
|
||||
* @param sickHelps
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object checkData(@Param("sickHelps") SickHelp[] sickHelps) {
|
||||
try {
|
||||
return sickHelpImportService.checkData(Arrays.asList(sickHelps));
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param sickHelps
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object doImport(@Param("sickHelps") SickHelp[] sickHelps) {
|
||||
sickHelpImportService.importData(Arrays.asList(sickHelps));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
public void downLoadTemplate(HttpServletResponse response) {
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelTemplateEntityList, Collections.emptyList());
|
||||
try {
|
||||
ViTool.excelResponse(response, "导入模板.xlsx");
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@At("/searchUser/?")
|
||||
@Ok("json")
|
||||
@ViReturn
|
||||
public Object searchUser(String key) {
|
||||
if (StrUtil.isBlank(key)) {
|
||||
return null;
|
||||
}
|
||||
return sickHelpImportService.searchUser(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户历史补贴记录
|
||||
*
|
||||
* @param loginName 登录名
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/getHistorySubsidyByUser/?/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object getHistorySubsidyByUser(String loginName, Integer year) {
|
||||
return sickHelpImportService.getHistorySubsidyByUser(loginName, year);
|
||||
}
|
||||
|
||||
/**
|
||||
* 一条记录
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/findOne/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
return sickHelpImportService.dao().fetch(SickHelp.class, id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package io.v.nutz.sickHelp.controller;
|
||||
|
||||
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.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpApply;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpListService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.SickHelpListController
|
||||
* @Description: 大病数据查询
|
||||
* @Author zxc
|
||||
* @Date 2022/4/22:10:26
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/list")
|
||||
@Slf4j
|
||||
public class SickHelpListController {
|
||||
|
||||
static List<ExcelExportEntity> excelTemplateEntityList = new ArrayList<>();
|
||||
|
||||
static {
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("工资号", "", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("姓名", "", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("自费金额(元)", "", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("补助金额(元)", "", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("最近年度", "", 20));
|
||||
excelTemplateEntityList.add(new ExcelExportEntity("补助比例", "", 20));
|
||||
}
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SickHelpListService sickHelpListService;
|
||||
@Inject
|
||||
private SickHelpApply sickHelpApply;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/list/index.html")
|
||||
@RequiresPermissions("sickHelp.list")
|
||||
public void excel() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.list")
|
||||
public Object pageData(PageForm pageForm, Integer year, String subsidyUser, String unionId, String unitId, Integer isMember) {
|
||||
return sickHelpListService.pageData(pageForm, year, subsidyUser, unionId, unitId,isMember);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.list")
|
||||
public void downLoadTemplate(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "大病互助历史数据导入模板.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setHeight((short) 10);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SickHelp.class, Collections.emptyList());
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取excel数据
|
||||
*
|
||||
* @param tempFile 临时文件
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@Ok("json:full")
|
||||
public Object readExcelData(@Param("file") TempFile tempFile) {
|
||||
try {
|
||||
List<SickHelp> sickHelpList = sickHelpListService.readExcelData(tempFile);
|
||||
return Result.success().addData(sickHelpList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入历史数据
|
||||
*
|
||||
* @param data 数据
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
public Object importHistoryData(@Param("data") String data) {
|
||||
List<SickHelp> sickHelpList = Json.fromJsonAsList(SickHelp.class, data);
|
||||
sickHelpListService.importHistoryData(sickHelpList);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 做删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/doDelete/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
dao.clear(SickHelp.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 做编辑
|
||||
*
|
||||
* @param sickHelp 生病帮助
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/doEdit")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object doEdit(SickHelp sickHelp) {
|
||||
dao.update(sickHelp);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出补助数据
|
||||
*
|
||||
* @param year 年度
|
||||
* @param unitName 单位名字
|
||||
* @param response 响应
|
||||
*/
|
||||
@At("/exportData")
|
||||
@Ok("void")
|
||||
@ViReturn
|
||||
public void exportData(Integer year, String unitName, HttpServletResponse response) {
|
||||
// List<SickHelp> subsidyList = sickHelpListService.findSubsidyList(year, unitName);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sick.loginName,
|
||||
sick.userName,
|
||||
sick.unitName,
|
||||
sick.selfPayMoney,
|
||||
sick.subsidyMoney,
|
||||
sick.remarks,
|
||||
sfm.userState\s
|
||||
FROM
|
||||
sick_help sick
|
||||
LEFT JOIN sick_fund_member sfm ON sfm.loginName = sick.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("sick.year", "=", year);
|
||||
cnd.andEX("sick.unitName", "=", unitName);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sickHelpListService.listMap(sql);
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(year + "教职工大病医疗互助金补助汇总表");
|
||||
|
||||
ArrayList<ExcelExportEntity> excelExportEntities = new ArrayList<>();
|
||||
excelExportEntities.add(new ExcelExportEntity("工资号", "loginName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("状态", "userState", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("自费金额", "selfPayMoney", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("补助金额", "subsidyMoney", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("备注", "remarks", 20));
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelExportEntities, list);
|
||||
try {
|
||||
ViTool.excelResponse(response, year + "教职工大病医疗互助金补助汇总表.xlsx");
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新是满足需求
|
||||
*
|
||||
* @param sickHelp 生病帮助
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object updateIsMeetRequirements(SickHelp sickHelp) {
|
||||
dao.updateIgnoreNull(sickHelp);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键设置满足申请要求
|
||||
*
|
||||
* @param year 年度
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object oneKeyUpdateIsMeetRequirements(Integer year) {
|
||||
dao.update(SickHelp.class, Chain.make("isMeetRequirements", 1),
|
||||
Cnd.where("year", "=", year));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package io.v.nutz.sickHelp.controller;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpMySubsidyRecordService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.SickHelpAcceptController
|
||||
* @Description: 我的补助记录
|
||||
* @Author zxc
|
||||
* @Date 2022/4/27:10:32
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/mySubsidyRecord")
|
||||
public class SickHelpMySubsidyRecordController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SickHelpMySubsidyRecordService sickHelpMySubsidyRecordService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/mine/index.html")
|
||||
@RequiresPermissions("sickHelp.mySubsidyRecord")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.mySubsidyRecord")
|
||||
public Object pageData(PageForm pageForm, Integer year, String subsidyUser) {
|
||||
return sickHelpMySubsidyRecordService.pageData(pageForm, year, subsidyUser);
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.mySubsidyRecord")
|
||||
public Object acceptSubsidy(String id, boolean isAccept) {
|
||||
sickHelpMySubsidyRecordService.isAcceptSubSidy(id, isAccept);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请用户信息
|
||||
*
|
||||
* @param loginName 登录名
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.mySubsidyRecord")
|
||||
public Object getApplyUserInfo(String loginName) {
|
||||
/*Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname as loginName,
|
||||
u.username as userName,
|
||||
u.sex,
|
||||
u.unitname as unitName,
|
||||
u.homeAddress,
|
||||
u.birthday,
|
||||
sfm.mutualGoldStartTime
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN sick_fund_member sfm ON sfm.loginName = u.loginname
|
||||
where u.loginname = @loginName
|
||||
""");*/
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
sfm.*,
|
||||
u.unionid as unionId
|
||||
from
|
||||
sick_fund_member sfm
|
||||
left join user u on u.loginName = sfm.loginName
|
||||
where sfm.loginname = @loginName
|
||||
""");
|
||||
sql.setParam("loginName", loginName);
|
||||
return sickHelpMySubsidyRecordService.fetch(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.mySubsidyRecord")
|
||||
public Object doApply(SickHelp sickHelp, String sex, String birthday, String homeAddress, String applyUserSign) {
|
||||
sickHelp.setApplyUserSign(applyUserSign);
|
||||
sickHelpMySubsidyRecordService.doApply(sickHelp, sex, birthday, homeAddress);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到补贴信息通过id
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/findSubsidyInfoById/?")
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresRoles(value = {"sysadmin", "H04", "ltxgbc", "A06", "public"}, logical = Logical.OR)
|
||||
public Object findSubsidyInfoById(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sfm.sex,
|
||||
sfm.unitName,
|
||||
sfm.birthday,
|
||||
sfm.homeAddress,
|
||||
sfm.mutualGoldStartTime,
|
||||
h.*
|
||||
FROM
|
||||
sick_help h
|
||||
LEFT JOIN sick_fund_member sfm ON sfm.loginName = h.loginname
|
||||
where h.id = @id
|
||||
""");
|
||||
sql.setParam("id", id);
|
||||
NutMap sickMap = sickHelpMySubsidyRecordService.fetch(sql);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "H04", "A06"}) && !id.equals(sickMap.getString("userId"))) {
|
||||
return Result.error("没有权限");
|
||||
}
|
||||
|
||||
String branchUnionAuditId = sickMap.getString("branchUnionAuditId", "");
|
||||
String schoolHospitalAuditId = sickMap.getString("schoolHospitalAuditId", "");
|
||||
String schoolUnionAuditId = sickMap.getString("schoolUnionAuditId", "");
|
||||
|
||||
sickMap.put("branchUnionAuditInfo", dao.fetch(Audit.class, branchUnionAuditId));
|
||||
sickMap.put("schoolHospitalAuditInfo", dao.fetch(Audit.class, schoolHospitalAuditId));
|
||||
sickMap.put("schoolUnionAuditInfo", dao.fetch(Audit.class, schoolUnionAuditId));
|
||||
|
||||
|
||||
return sickMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出申请表
|
||||
*
|
||||
* @param id
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.mySubsidyRecord")
|
||||
public void exportApplyPaper(@Param("id") String id, HttpServletResponse response) {
|
||||
Assert.notBlank(id);
|
||||
|
||||
List<NutMap> infos = sickHelpMySubsidyRecordService.exportInfo(List.of(id));
|
||||
|
||||
for (NutMap info : infos) {
|
||||
Configure config = Configure.newBuilder().build();
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/sickHelp/sickHelpApply.docx");
|
||||
try {
|
||||
ViTool.excelResponse(response, "申请表.docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(info, response.getOutputStream());
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package io.v.nutz.sickHelp.controller;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
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.StrUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.constant.NutzExcelExportEntity;
|
||||
import io.v.nutz.sickHelp.service.SickHelpSubsidySummaryService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/sickHelp/subsidyRecord")
|
||||
@Slf4j
|
||||
public class SickHelpSubsidySummaryController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SickHelpSubsidySummaryService sickHelpSubsidySummaryService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/subsidy/index.html")
|
||||
@RequiresPermissions("sickHelp.subsidyRecord")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
static List<ExcelExportEntity> subsidiesAmountTableEntities = new ArrayList<>() {{
|
||||
add(new NutzExcelExportEntity("年度", "year", 20, true));
|
||||
add(new NutzExcelExportEntity("部门", "unitName", 20, true));
|
||||
add(new NutzExcelExportEntity("姓名", "userName", 20, true));
|
||||
add(new NutzExcelExportEntity("工号", "loginName", 20, true));
|
||||
add(new NutzExcelExportEntity("性别", "sex", 20, true));
|
||||
add(new NutzExcelExportEntity("状态", "userState", 20, true));
|
||||
add(new NutzExcelExportEntity("连续没补助年份", "consecutiveYearOfNoSubsidies", 20, true));
|
||||
|
||||
ExcelExportEntity subsidyHead = new ExcelExportEntity("本年补助金额", "subsidyGroup", 60);
|
||||
subsidyHead.setList(new ArrayList<>() {{
|
||||
add(new ExcelExportEntity("个人支付", "selfPayMoney", 20));
|
||||
add(new ExcelExportEntity("分段计算补助金额", "subsidyMoney", 20));
|
||||
add(new ExcelExportEntity("已经享受补助金额", "totalSubsidy", 20));
|
||||
}});
|
||||
|
||||
add(subsidyHead);
|
||||
|
||||
add(new NutzExcelExportEntity("是否申请补助", "isAcceptText", 20, true));
|
||||
}};
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 分页参数
|
||||
* @param year 年度
|
||||
* @param unitId 单位
|
||||
* @param unionId 工会
|
||||
* @param isAccept 是接受
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.subsidyRecord")
|
||||
public Object pageData(PageForm pageForm, Integer year, Integer startYear, Integer endYear, String unitId, String unionId, Integer isAccept) {
|
||||
return sickHelpSubsidySummaryService.pageData(pageForm, year, startYear, endYear, unitId, unionId, isAccept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口补贴金额表
|
||||
*
|
||||
* @param response 响应
|
||||
* @param startYear 开始一年
|
||||
* @param endYear 结束一年
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.subsidyRecord")
|
||||
public void exportSubsidiesAmountTable(Integer startYear, Integer endYear, Integer isAccept, HttpServletResponse response) {
|
||||
List<NutMap> list = sickHelpSubsidySummaryService.exportSubsidiesAmountTable(startYear, endYear, isAccept);
|
||||
/* String yearName = null;
|
||||
if (startYear != null && endYear != null) {
|
||||
yearName = startYear + "-" + endYear;
|
||||
} else if (startYear != null) {
|
||||
yearName = startYear + "至今";
|
||||
} else if (endYear != null) {
|
||||
yearName = endYear + "前";
|
||||
}*/
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, "补助金额情况表.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle("补助金额情况表");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, subsidiesAmountTableEntities, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class subsidiesAmountTableExcelModel {
|
||||
|
||||
@Excel(name = "部门", width = 20)
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "工号", width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "性别", width = 20)
|
||||
private String sex;
|
||||
|
||||
@Excel(name = "状态", width = 20)
|
||||
private String userState;
|
||||
|
||||
@Excel(name = "连续没补助年份", width = 20)
|
||||
private String consecutiveYearOfNoSubsidies;
|
||||
|
||||
@ExcelCollection(name = "本年补助金额")
|
||||
private List<childExcelModel> childList;
|
||||
|
||||
@Excel(name = "是否放弃申请", width = 20)
|
||||
private String isAcceptText;
|
||||
}
|
||||
|
||||
@Data
|
||||
static class childExcelModel {
|
||||
@Excel(name = "个人支付", width = 20)
|
||||
private String selfPayMoney;
|
||||
|
||||
@Excel(name = "分段计算补助金额", width = 20)
|
||||
private String subsidyMoney;
|
||||
|
||||
@Excel(name = "已经享受补助金额", width = 20)
|
||||
private String totalSubsidy;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
package io.v.nutz.sickHelp.controller.audit;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpListService;
|
||||
import io.v.nutz.sickHelp.service.SickHelpMySubsidyRecordService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import io.v.nutz.web.commons.utils.FileUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
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.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.audit.SickBranchAuditController
|
||||
* @Description: 分工会审核
|
||||
* @Author zxc
|
||||
* @Date 2022/5/12:15:13
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/branchUnionAudit")
|
||||
public class sickBranchAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private SickHelpListService sickHelpListService;
|
||||
|
||||
@Inject
|
||||
private SickHelpMySubsidyRecordService sickHelpMySubsidyRecordService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/audit/branchUnionAudit.html")
|
||||
@RequiresPermissions("sickHelp.branchUnionAudit")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.branchUnionAudit")
|
||||
public Object pageData(PageForm pageForm, Integer year, String keyword, int auditState, String unionId, String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
h.id,
|
||||
h.userId,
|
||||
h.loginName,
|
||||
h.year,
|
||||
h.selfPayMoney,
|
||||
h.subsidyMoney,
|
||||
h.subsidyRatio,
|
||||
h.lastTimeSubsidyYear,
|
||||
h.remarks,
|
||||
h.isAccept,
|
||||
h.canApply,
|
||||
h.userName,
|
||||
h.totalSubsidyRatio,
|
||||
h.selfPaySubsidyRatio,
|
||||
h.otherSubsidyRatio,
|
||||
h.subsidyDesc,
|
||||
h.isCanApply,
|
||||
h.isMeetRequirements,
|
||||
h.applyReason,
|
||||
h.applyUserSign,
|
||||
h.branchUnionAuditId,
|
||||
h.schoolHospitalAuditId,
|
||||
h.schoolUnionAuditId,
|
||||
h.stateCode,
|
||||
h.unionId,
|
||||
h.hospitalAccount,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName
|
||||
FROM
|
||||
`sick_help` h
|
||||
left join `user` u on u.loginname = h.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.unitid", "!=", "52500");
|
||||
|
||||
if (ShiroUtil.lacksRole("sysadmin")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("h.year", "=", year);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
seg.orLike("h.loginName", keyword);
|
||||
seg.orLike("h.userName", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("h.isMeetRequirements", "=", 1);
|
||||
cnd.and("h.stateCode", ">=", SickHelpStateEnum.DTJ.getStateCode());
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sickHelpListService.list(pageForm, sql);
|
||||
return SickHelpStateEnum.assignStateInfo(pagination);
|
||||
}
|
||||
|
||||
/*/**
|
||||
* 批量导出应用论文
|
||||
* 做审核
|
||||
*
|
||||
* @param ids id
|
||||
* @param response 响应
|
||||
*/
|
||||
/*
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doAudit(String id, Audit audit) {
|
||||
dao.insert(audit);
|
||||
Chain chain = Chain.make("branchUnionAuditId", audit.getId());
|
||||
if (audit.getAuditPass()) {
|
||||
chain.add("stateCode", SickHelpStateEnum.DXYYSH.getStateCode());
|
||||
} else {
|
||||
chain.add("stateCode", SickHelpStateEnum.FGHJJ.getStateCode());
|
||||
}
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/doRevoke/?")
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
public Object doRevoke(String id) {
|
||||
Chain chain = Chain.make("stateCode", SickHelpStateEnum.DFGHSH.getStateCode());
|
||||
chain.add("branchUnionAuditInfo", null);
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* 批量导出个人申请表
|
||||
*
|
||||
* @param ids id
|
||||
* @param response 响应
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.branchUnionAudit")
|
||||
public void batchExportApplyPaper(@Param("ids") String[] ids, HttpServletResponse response) {
|
||||
Assert.notNull(ids);
|
||||
List<NutMap> infos = sickHelpMySubsidyRecordService.exportInfo(Arrays.asList(ids));
|
||||
|
||||
String tmpPath = "tmp/" + DateFormatUtils.format(new Date(), "yyyyMMddHHmmss", Locale.CHINA) + "/";
|
||||
File tmpDir = new File(tmpPath);
|
||||
tmpDir.mkdirs();
|
||||
|
||||
for (NutMap info : infos) {
|
||||
try {
|
||||
Configure config = Configure.newBuilder().build();
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/sickHelp/sickHelpApply.docx");
|
||||
FileOutputStream outputStream = new FileOutputStream(tmpPath + info.getString("xm") + "-" + info.getString("unitName") + ".docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(info, outputStream);
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String fileName = "大病申请表批量导出";
|
||||
|
||||
String aimsDir = "zipTmp/" + R.UU32();
|
||||
String aimsName = fileName + ".zip";
|
||||
String aimsPath = aimsDir + "/" + aimsName;
|
||||
FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName);
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(aimsName, "UTF-8"));
|
||||
File aimsFile = new File(aimsPath);
|
||||
FileInputStream inputStream = new FileInputStream(aimsFile);
|
||||
IOUtils.copy(inputStream, response.getOutputStream());
|
||||
inputStream.close();
|
||||
aimsFile.delete();
|
||||
FileUtil.deleteDir(new File(tmpPath));
|
||||
FileUtil.deleteDir(new File(aimsDir));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出汇总
|
||||
*
|
||||
* @param year 一年
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param response 响应
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.branchUnionAudit")
|
||||
public void exportSummary(@Param("year") Integer year, @Param("unionId") String unionId,
|
||||
@Param("unitId") String unitId, HttpServletResponse response) {
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
|
||||
ExcelExportEntity noEntity = new ExcelExportEntity("序号", "nu", 10);
|
||||
noEntity.setFormat("isAddIndex");
|
||||
entityList.add(noEntity);
|
||||
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
// entityList.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
// entityList.add(new ExcelExportEntity("年度", "year", 20));
|
||||
entityList.add(new ExcelExportEntity("个人支付金额", "selfPayMoney", 20));
|
||||
entityList.add(new ExcelExportEntity("计算金额", "noLimitSubsidyMoney", 20));
|
||||
entityList.add(new ExcelExportEntity("补助金额", "subsidyMoney", 20));
|
||||
// entityList.add(new ExcelExportEntity("申请理由", "applyReason", 20));
|
||||
// entityList.add(new ExcelExportEntity("是否申请补助", "isAccept", 20));
|
||||
// entityList.add(new ExcelExportEntity("备注", "remarks", 20));
|
||||
entityList.add(new ExcelExportEntity("备注", "isAccept", 20));
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sick.userName,
|
||||
sick.loginName,
|
||||
sick.year,
|
||||
sick.selfPayMoney,
|
||||
sick.noLimitSubsidyMoney,
|
||||
CAST( sick.subsidyMoney AS UNSIGNED ) AS subsidyMoney,
|
||||
sick.applyReason,
|
||||
(case sick.isAccept when 1 then '申请' when 0 then '放弃' else null end) as isAccept,
|
||||
sick.remarks,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName
|
||||
FROM sick_help sick
|
||||
LEFT JOIN sys_union gh on gh.id = sick.unionId
|
||||
LEFT JOIN user u on u.id = sick.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.unionid","=",unionId);
|
||||
cnd.andEX("u.unitid","=",unitId);
|
||||
|
||||
cnd.and("u.unitname", "not in", List.of("离退休工作处", "退休", "离退休工作党工委、离退休工作处"));
|
||||
cnd.andEX("sick.year", "=", year);
|
||||
cnd.and("sick.isMeetRequirements", "=", 1);
|
||||
cnd.and("sick.stateCode", ">=", SickHelpStateEnum.DTJ.getStateCode());
|
||||
if (ShiroUtil.lacksRole("sysadmin")) {
|
||||
cnd.and("u.unionid", "0", Vi.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sickHelpListService.listMap(sql);
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, year + "年度教职工大病医疗互助金补助汇总表.xls");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(year + "年度教职工大病医疗互助金补助汇总表");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量申请
|
||||
*
|
||||
* @param ids id
|
||||
* @param isAccept 是接受
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.branchUnionAudit")
|
||||
public Object batchApply(@Param("ids") String[] ids, boolean isAccept) {
|
||||
Chain chain = Chain.make("stateCode", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
chain.add("isAccept", true);
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "in", ids));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请
|
||||
*
|
||||
* @param sickHelp 生病帮助
|
||||
* @param sex 性
|
||||
* @param birthday 生日
|
||||
* @param homeAddress 家庭住址
|
||||
* @param applyUserSign 应用用户信号
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.branchUnionAudit")
|
||||
public Object doApply(SickHelp sickHelp, String sex, String birthday, String homeAddress, String applyUserSign) {
|
||||
sickHelp.setApplyUserSign(applyUserSign);
|
||||
sickHelpMySubsidyRecordService.doApply(sickHelp, sex, birthday, homeAddress);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package io.v.nutz.sickHelp.controller.audit;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpListService;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 校医院审核
|
||||
*
|
||||
* @author jug
|
||||
* @date 2022/05/12
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/hospitalAudit")
|
||||
public class sickHospitalAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SickHelpListService sickHelpListService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/audit/hospitalAudit.html")
|
||||
@RequiresPermissions("sickHelp.hospitalAudit")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 分页参数
|
||||
* @param year 年度
|
||||
* @param keyword 关键字
|
||||
* @param auditState 审核状态
|
||||
* @param unionId 工会
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
public Object pageData(PageForm pageForm, Integer year, String keyword, int auditState, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
h.*
|
||||
FROM
|
||||
`sick_help` h
|
||||
LEFT JOIN `user` u ON u.loginname = h.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.andEX("h.year", "=", year);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
seg.orLike("h.loginName", keyword);
|
||||
seg.orLike("h.userName", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("h.isMeetRequirements", "=", 1);
|
||||
switch (auditState) {
|
||||
case -1 -> cnd.and("h.stateCode", "=", SickHelpStateEnum.DXYYSH.getStateCode());
|
||||
case 0 -> cnd.and("h.stateCode", ">=", SickHelpStateEnum.DXYYSH.getStateCode());
|
||||
case 1 -> cnd.and("h.stateCode", ">", SickHelpStateEnum.DXYYSH.getStateCode());
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sickHelpListService.list(pageForm, sql);
|
||||
return SickHelpStateEnum.assignStateInfo(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 做审核
|
||||
*
|
||||
* @param id scik_help id
|
||||
* @param audit 审核
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
public Object doAudit(String id, Audit audit) {
|
||||
dao.insert(audit);
|
||||
Chain chain = Chain.make("schoolHospitalAuditId", audit.getId());
|
||||
if (audit.getAuditPass()) {
|
||||
chain.add("stateCode", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
} else {
|
||||
chain.add("stateCode", SickHelpStateEnum.XYYJJ.getStateCode());
|
||||
}
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/doRevoke/?")
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
public Object doRevoke(String id) {
|
||||
Chain chain = Chain.make("stateCode", SickHelpStateEnum.DXYYSH.getStateCode());
|
||||
chain.add("schoolHospitalAuditId", null);
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
package io.v.nutz.sickHelp.controller.audit;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.controller.SickHelpMySubsidyRecordController;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpListService;
|
||||
import io.v.nutz.sickHelp.service.SickHelpMySubsidyRecordService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import io.v.nutz.web.commons.utils.FileUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
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.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.audit.SickBranchAuditController
|
||||
* @Description: 退休人员审核
|
||||
* @Author zxc
|
||||
* @Date 2022/5/12:15:13
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/retireesAudit")
|
||||
public class sickRetireesAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private SickHelpListService sickHelpListService;
|
||||
|
||||
@Inject
|
||||
private SickHelpMySubsidyRecordService sickHelpMySubsidyRecordService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/audit/retireesAudit.html")
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public Object pageData(PageForm pageForm, Integer year, String keyword, int auditState, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
h.id,
|
||||
h.userId,
|
||||
h.loginName,
|
||||
h.year,
|
||||
h.selfPayMoney,
|
||||
h.subsidyMoney,
|
||||
h.subsidyRatio,
|
||||
h.lastTimeSubsidyYear,
|
||||
h.remarks,
|
||||
h.isAccept,
|
||||
h.canApply,
|
||||
h.userName,
|
||||
h.totalSubsidyRatio,
|
||||
h.selfPaySubsidyRatio,
|
||||
h.otherSubsidyRatio,
|
||||
h.subsidyDesc,
|
||||
h.isCanApply,
|
||||
h.isMeetRequirements,
|
||||
h.applyReason,
|
||||
h.applyUserSign,
|
||||
h.branchUnionAuditId,
|
||||
h.schoolHospitalAuditId,
|
||||
h.schoolUnionAuditId,
|
||||
h.stateCode,
|
||||
h.hospitalAccount,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName
|
||||
FROM
|
||||
`sick_help` h
|
||||
left join `user` u on u.loginname = h.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// if (ShiroUtil.lacksRole("sysadmin")) {
|
||||
// cnd.and("u.unionid", "in", new Static(vi.getMangeUnionStr()));
|
||||
cnd.where().andLike("u.unitName", "退休");
|
||||
cnd.and("u.userState","=","退休");
|
||||
// }
|
||||
cnd.andEX("h.year", "=", year);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
seg.orLike("h.loginName", keyword);
|
||||
seg.orLike("h.userName", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("h.isMeetRequirements", "=", 1);
|
||||
cnd.and("h.stateCode", ">=", SickHelpStateEnum.DTJ.getStateCode());
|
||||
// cnd.and("u.unitName", "in", List.of("离退休工作处", "退休", "离退休工作党工委、离退休工作处"));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sickHelpListService.list(pageForm, sql);
|
||||
return SickHelpStateEnum.assignStateInfo(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导出个人申请表
|
||||
*
|
||||
* @param ids id
|
||||
* @param response 响应
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public void batchExportApplyPaper(@Param("ids") String[] ids, HttpServletResponse response) {
|
||||
Assert.notNull(ids);
|
||||
List<NutMap> infos = sickHelpMySubsidyRecordService.exportInfo(Arrays.asList(ids));
|
||||
|
||||
String tmpPath = "tmp/" + DateFormatUtils.format(new Date(), "yyyyMMddHHmmss", Locale.CHINA) + "/";
|
||||
File tmpDir = new File(tmpPath);
|
||||
tmpDir.mkdirs();
|
||||
|
||||
for (NutMap info : infos) {
|
||||
try {
|
||||
Configure config = Configure.newBuilder().build();
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/sickHelp/sickHelpApply.docx");
|
||||
FileOutputStream outputStream = new FileOutputStream(tmpPath + info.getString("xm") + "-" + info.getString("unitName") + ".docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(info, outputStream);
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String fileName = "大病申请表批量导出";
|
||||
|
||||
String aimsDir = "zipTmp/" + R.UU32();
|
||||
String aimsName = fileName + ".zip";
|
||||
String aimsPath = aimsDir + "/" + aimsName;
|
||||
FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName);
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(aimsName, "UTF-8"));
|
||||
File aimsFile = new File(aimsPath);
|
||||
FileInputStream inputStream = new FileInputStream(aimsFile);
|
||||
IOUtils.copy(inputStream, response.getOutputStream());
|
||||
inputStream.close();
|
||||
aimsFile.delete();
|
||||
FileUtil.deleteDir(new File(tmpPath));
|
||||
FileUtil.deleteDir(new File(aimsDir));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出汇总
|
||||
*
|
||||
* @param year 一年
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param response 响应
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public void exportSummary(@Param("year") Integer year, @Param("unionId") String unionId,
|
||||
@Param("unitId") String unitId, HttpServletResponse response) {
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
// entityList.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
// entityList.add(new ExcelExportEntity("年度", "year", 20));
|
||||
entityList.add(new ExcelExportEntity("个人支付金额", "selfPayMoney", 20));
|
||||
entityList.add(new ExcelExportEntity("计算金额", "noLimitSubsidyMoney", 20));
|
||||
entityList.add(new ExcelExportEntity("补助金额", "subsidyMoney", 20));
|
||||
// entityList.add(new ExcelExportEntity("申请理由", "applyReason", 20));
|
||||
// entityList.add(new ExcelExportEntity("是否申请", "isAccept", 20));
|
||||
// entityList.add(new ExcelExportEntity("备注", "remarks", 20));
|
||||
entityList.add(new ExcelExportEntity("备注", "isAccept", 20));
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
sick.userName,
|
||||
sick.loginName,
|
||||
sick.year,
|
||||
sick.selfPayMoney,
|
||||
sick.noLimitSubsidyMoney,
|
||||
CAST( sick.subsidyMoney AS UNSIGNED ) AS subsidyMoney,
|
||||
sick.applyReason,
|
||||
(case sick.isAccept when 1 then '申请' when 0 then '放弃' else null end) as isAccept,
|
||||
sick.remarks,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName
|
||||
FROM sick_help sick
|
||||
LEFT JOIN sys_union gh on gh.id = sick.unionId
|
||||
LEFT JOIN user u on u.id = sick.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.unitname", "in", List.of("离退休工作处", "退休", "离退休工作党工委、离退休工作处"));
|
||||
cnd.and("sick.year", "=", year);
|
||||
cnd.and("sick.isMeetRequirements", "=", 1);
|
||||
// cnd.and("sick.stateCode", ">", SickHelpStateEnum.DTJ.getStateCode());
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sickHelpListService.listMap(sql);
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, year + "年度教职工大病医疗互助金补助汇总表.xls");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(year + "年度教职工大病医疗互助金补助汇总表");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户单位修改
|
||||
*
|
||||
* @param unitId 单位id
|
||||
* @param loginName 登录名
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public Object userUnitMove(String unitId, @Param("loginName[]") String[] loginName) {
|
||||
dao.update(Sys_user.class, Chain.make("unitid", unitId), Cnd.where("loginname", "in", loginName));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量申请
|
||||
*
|
||||
* @param ids id
|
||||
* @param isAccept 是接受
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public Object batchApply(@Param("ids") String[] ids, boolean isAccept) {
|
||||
Chain chain = Chain.make("stateCode", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
chain.add("isAccept", true);
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "in", ids));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请
|
||||
*
|
||||
* @param sickHelp 生病帮助
|
||||
* @param sex 性
|
||||
* @param birthday 生日
|
||||
* @param homeAddress 家庭住址
|
||||
* @param applyUserSign 应用用户信号
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public Object doApply(SickHelp sickHelp, String sex, String birthday, String homeAddress, String applyUserSign) {
|
||||
sickHelp.setApplyUserSign(applyUserSign);
|
||||
sickHelpMySubsidyRecordService.doApply(sickHelp, sex, birthday, homeAddress);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickHelp.retireesAudit")
|
||||
public Object getApplyUserInfo(String loginName) {
|
||||
SickHelpMySubsidyRecordController proxyCon = Mvcs.getIoc().get(SickHelpMySubsidyRecordController.class);
|
||||
return proxyCon.getApplyUserInfo(loginName);
|
||||
}
|
||||
}
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
package io.v.nutz.sickHelp.controller.audit;
|
||||
|
||||
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.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpListService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.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 org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.audit.schoolUnionAuditController
|
||||
* @Description: 校工会审核
|
||||
* @Author zxc
|
||||
* @Date 2022/5/12:15:13
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/schoolUnionAudit")
|
||||
public class sickSchoolUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private SickHelpListService sickHelpListService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/audit/schoolUnionAudit.html")
|
||||
@RequiresPermissions("sickHelp.schoolUnionAudit")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 分页参数
|
||||
* @param year 年度
|
||||
* @param keyword 关键字
|
||||
* @param auditState 审核状态
|
||||
* @param unionId 工会
|
||||
* @param unitId 单位id
|
||||
* @param isMember 是成员
|
||||
* @param isAccept 是接受
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.schoolUnionAudit")
|
||||
public Object pageData(PageForm pageForm, Integer year, String keyword, int auditState, String unionId, String unitId, Integer isMember, Integer isAccept) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
h.id,
|
||||
h.userId,
|
||||
h.loginName,
|
||||
h.year,
|
||||
h.selfPayMoney,
|
||||
h.noLimitSubsidyMoney,
|
||||
h.subsidyMoney,
|
||||
h.subsidyRatio,
|
||||
h.lastTimeSubsidyYear,
|
||||
h.remarks,
|
||||
h.isAccept,
|
||||
h.canApply,
|
||||
h.userName,
|
||||
h.totalSubsidyRatio,
|
||||
h.selfPaySubsidyRatio,
|
||||
h.otherSubsidyRatio,
|
||||
h.subsidyDesc,
|
||||
h.isCanApply,
|
||||
h.isMeetRequirements,
|
||||
h.applyReason,
|
||||
h.applyUserSign,
|
||||
h.branchUnionAuditId,
|
||||
h.schoolHospitalAuditId,
|
||||
h.schoolUnionAuditId,
|
||||
h.stateCode,
|
||||
h.unionId,
|
||||
h.hospitalAccount,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName
|
||||
FROM
|
||||
`sick_help` h
|
||||
LEFT JOIN `user` u ON u.loginname = h.loginName
|
||||
LEFT JOIN sick_fund_member sfm ON sfm.loginName = h.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("sfm.isMember", "=", isMember);
|
||||
cnd.andEX("h.isAccept", "=", isAccept);
|
||||
|
||||
cnd.andEX("h.year", "=", year);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
seg.orLike("h.loginName", keyword);
|
||||
seg.orLike("h.userName", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.and("h.isMeetRequirements", "=", 1);
|
||||
switch (auditState) {
|
||||
case -1 -> cnd.and("h.stateCode", "=", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
case 0 -> cnd.and("h.stateCode", ">=", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
case 1 -> cnd.and("h.stateCode", ">", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sickHelpListService.list(pageForm, sql);
|
||||
return SickHelpStateEnum.assignStateInfo(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 做审核
|
||||
*
|
||||
* @param id scik_help id
|
||||
* @param audit 审核
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.schoolUnionAudit")
|
||||
public Object doAudit(String id, Audit audit) {
|
||||
dao.insert(audit);
|
||||
Chain chain = Chain.make("schoolUnionAuditId", audit.getId());
|
||||
if (audit.getAuditPass()) {
|
||||
chain.add("stateCode", SickHelpStateEnum.XGHTG.getStateCode());
|
||||
} else {
|
||||
chain.add("stateCode", SickHelpStateEnum.XGHJJ.getStateCode());
|
||||
}
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审核
|
||||
*
|
||||
* @param ids id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.schoolUnionAudit")
|
||||
public Object batchAudit(@Param("ids") String[] ids) {
|
||||
Trans.exec(() -> {
|
||||
for (String id : ids) {
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditPass(true);
|
||||
audit.setAuditOpinion("通过");
|
||||
dao.insert(audit);
|
||||
|
||||
Chain chain = Chain.make("schoolUnionAuditId", audit.getId());
|
||||
chain.add("stateCode", SickHelpStateEnum.XGHTG.getStateCode());
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At("/doRevoke/?")
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("sickHelp.schoolUnionAudit")
|
||||
public Object doRevoke(String id) {
|
||||
Chain chain = Chain.make("stateCode", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
chain.add("schoolUnionAuditId", null);
|
||||
dao.update(SickHelp.class, chain, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/doExport")
|
||||
@ViReturn
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sickHelp.schoolUnionAudit")
|
||||
public void doExport(@Param("year") Integer year,
|
||||
@Param("auditState") Integer auditState, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
h.userName,
|
||||
h.loginName,
|
||||
u.unitname AS unitName,
|
||||
h.YEAR,
|
||||
h.selfPayMoney,
|
||||
CAST( h.subsidyMoney AS UNSIGNED ) AS subsidyMoney,
|
||||
h.stateCode,
|
||||
CASE WHEN h.isAccept = 1 AND h.stateCode = 700 THEN '申请'\s
|
||||
WHEN h.isAccept = 1 AND h.stateCode = 700 THEN '放弃'\s
|
||||
ELSE NULL END AS 'remarks'
|
||||
FROM
|
||||
`sick_help` h
|
||||
LEFT JOIN `user` u ON u.loginname = h.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("h.year", "=", year);
|
||||
cnd.and("h.isMeetRequirements", "=", 1);
|
||||
switch (auditState) {
|
||||
case -1 -> cnd.and("h.stateCode", "=", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
case 0 -> cnd.and("h.stateCode", ">=", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
case 1 -> cnd.and("h.stateCode", ">", SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sickHelpListService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("年度", "year", 20));
|
||||
entityList.add(new ExcelExportEntity("自费金额(元)", "selfPayMoney", 20));
|
||||
entityList.add(new ExcelExportEntity("补助金额(元)", "subsidyMoney", 20));
|
||||
entityList.add(new ExcelExportEntity("备注", "remarks", 20));
|
||||
entityList.add(new ExcelExportEntity("审核状态", "stateName", 20));
|
||||
|
||||
Pagination pagination = new Pagination();
|
||||
pagination.setList(list);
|
||||
SickHelpStateEnum.assignStateInfo(pagination);
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, year + "年校工会汇总表.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package io.v.nutz.sickHelp.controller.member;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sickHelp.model.SickFundMember;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
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.POST;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
/**
|
||||
* 生病基金列表
|
||||
*
|
||||
* @FileName io.v.nutz.sickHelp.controller.SickFundListController
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/5/9:11:01
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@At("/platform/sickFund/member")
|
||||
@Slf4j
|
||||
public class SickFundListController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/member/list.html")
|
||||
@RequiresPermissions("sickFund.member.list")
|
||||
public void excel() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 页面形式
|
||||
* @param mutualGoldStartTime 互助金开始时间
|
||||
* @param keyWord 关键字
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickFund.member.list")
|
||||
public Object pageData(PageForm pageForm, Integer mutualGoldStartTime, String keyWord, String unitName, String unionId, String unitId, String userState) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
sfm.id,
|
||||
sfm.loginName,
|
||||
sfm.userName,
|
||||
sfm.userState,
|
||||
sfm.mutualGoldStartTime,
|
||||
sfm.sex,
|
||||
sfm.isMember,
|
||||
sfm.remark,
|
||||
u.unitid as unitId,
|
||||
u.unitname as unitName
|
||||
from sick_fund_member sfm
|
||||
left join `user` u on u.loginname = sfm.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(mutualGoldStartTime)", "=", mutualGoldStartTime);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (StrUtil.isNotBlank(keyWord)) {
|
||||
seg.orLike("sfm.loginName", keyWord);
|
||||
seg.orLike("sfm.userName", keyWord);
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
|
||||
if (StrUtil.isNotBlank(unitId)) {
|
||||
SqlExpressionGroup unitSeg = new SqlExpressionGroup();
|
||||
unitSeg.or("u.unitid", "=", unitId);
|
||||
unitSeg.or("sfm.unitId", "=", unitId);
|
||||
cnd.and(unitSeg);
|
||||
}
|
||||
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
if ("ascending".equals(pageForm.getPageOrderBy())) {
|
||||
cnd.asc(pageForm.getPageOrderName());
|
||||
} else {
|
||||
cnd.desc(pageForm.getPageOrderName());
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 做删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/doDelete/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickFund.member.list")
|
||||
public Object doDelete(String id) {
|
||||
dao.clear(SickFundMember.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 做编辑
|
||||
*
|
||||
* @param fundMember 基金组织成员
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/doEdit")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickFund.member.list")
|
||||
public Object doEdit(SickFundMember fundMember) {
|
||||
/* int count = dao.count(SickFundMember.class, Cnd.where("loginName", "=", fundMember.getLoginName()).and("YEAR(mutualGoldStartTime)", "=", fundMember.getMutualGoldStartTime()));
|
||||
if (count > 0) {
|
||||
return Result.error("该记录已存在,请勿重复添加!");
|
||||
}*/
|
||||
Trans.exec(()->{
|
||||
dao.update(Sys_user.class, Chain.make("unitId", fundMember.getUnitId()), Cnd.where("loginname", "=", fundMember.getLoginName()));
|
||||
dao.update(fundMember);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 做添加
|
||||
*
|
||||
* @param fundMember 基金组织成员
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/doAdd")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("sickFund.member.list")
|
||||
public Object doAdd(SickFundMember fundMember) {
|
||||
/* int count = dao.count(SickFundMember.class, Cnd.where("loginName", "=", fundMember.getLoginName()).and("YEAR(mutualGoldStartTime)", "=", fundMember.getMutualGoldStartTime()));
|
||||
if (count > 0) {
|
||||
return Result.error("该记录已存在,请勿重复添加!");
|
||||
}*/
|
||||
dao.insert(fundMember);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package io.v.nutz.sickHelp.controller.member;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.sickHelp.model.SickFundMember;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.controller.SickHelpMemberController
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/5/9:10:41
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@At("/platform/sickHelp/member/importByExcel")
|
||||
@Slf4j
|
||||
public class SickHelpMemberController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sickHelp/member/execlImport.html")
|
||||
@RequiresPermissions("sickHelp.member.import.excel")
|
||||
public void excel() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取excel数据
|
||||
*
|
||||
* @param tempFile 临时文件
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public Object readExcelData(@Param("file") TempFile tempFile) {
|
||||
ImportParams importParams = new ImportParams();
|
||||
List<SickFundMember> list = ExcelImportUtil.importExcel(tempFile.getFile(), SickFundMember.class, importParams);
|
||||
List<String> loginNames = list.stream().map(v -> v.getLoginName()).collect(Collectors.toList());
|
||||
Sql userSql = Sqls.create("select id,loginname,username,unitid,unitname,sex from user where loginname in (@loginNames)");
|
||||
userSql.setParam("loginNames", loginNames);
|
||||
List<NutMap> users = (List<NutMap>) Daos.query(dao, userSql.toString(), Sqls.callback.maps());
|
||||
Map<String, NutMap> userMap = users.stream().collect(Collectors.toMap(v -> v.getString("loginname"), v -> v));
|
||||
|
||||
List<SickFundMember> oldSickFundMembers = dao.query(SickFundMember.class, Cnd.where("loginName", "in", loginNames));
|
||||
|
||||
// Map<String, Long> collect = loginNames.stream().filter(v -> StrUtil.isNotBlank(v)).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
|
||||
|
||||
for (SickFundMember fundMember : list) {
|
||||
// Cnd cnd = Cnd.where("loginName", "=", fundMember.getLoginName());
|
||||
// cnd.and("userName", "=", fundMember.getUserName());
|
||||
// SickFundMember oldFundMember = dao.fetch(SickFundMember.class, cnd);
|
||||
// if (oldFundMember != null) {
|
||||
// fundMember.setId(oldFundMember.getId());
|
||||
// }
|
||||
Optional<SickFundMember> fundMemberOptional = oldSickFundMembers.stream().filter(v -> v.getLoginName().equals(fundMember.getLoginName())).findFirst();
|
||||
if (fundMemberOptional.isPresent()) {
|
||||
fundMember.setId(fundMemberOptional.get().getId());
|
||||
}
|
||||
NutMap user = userMap.get(fundMember.getLoginName());
|
||||
if (Lang.isNotEmpty(user)) {
|
||||
fundMember.setUnitId(user.getString("unitid"));
|
||||
fundMember.setUnitName(user.getString("unitname"));
|
||||
fundMember.setSex(user.getString("sex"));
|
||||
fundMember.setIsMember(true);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param fundMembers
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object doImport(@Param("data") SickFundMember[] fundMembers) {
|
||||
List<List<SickFundMember>> splitFundMembers = ListUtil.split(Arrays.asList(fundMembers), 500);
|
||||
for (List<SickFundMember> splitFundMember : splitFundMembers) {
|
||||
new Thread(() -> {
|
||||
dao.insertOrUpdate(splitFundMember);
|
||||
}).start();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresAuthentication
|
||||
public void downLoadTemplate(HttpServletResponse response) {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SickFundMember.class, Collections.emptyList());
|
||||
try {
|
||||
ViTool.excelResponse(response, "会员导入模板.xlsx");
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package io.v.nutz.sickHelp.model;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* 生病基金成员
|
||||
*
|
||||
* @FileName io.v.nutz.sickHelp.model.SickFundMember
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/5/9:10:27
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Table
|
||||
public class SickFundMember {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("userId")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "工资号", width = 20)
|
||||
private String loginName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("userId")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("在职状态")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "状态", width = 20)
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
@Excel(name = "单位", width = 20)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("互助金开始起扣时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "入会时间", width = 20)
|
||||
private String mutualGoldStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("是否会员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Excel(name = "是否会员", width = 20)
|
||||
private Boolean isMember;
|
||||
|
||||
@Column
|
||||
@Comment("出生日期")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String birthday;
|
||||
|
||||
@Column
|
||||
@Comment("家庭住址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String homeAddress;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Excel(name = "备注", width = 20)
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
package io.v.nutz.sickHelp.model;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.json.JsonField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 大病互助
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
@Accessors(chain = true)
|
||||
public class SickHelp {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("userId")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Excel(name = "人员代码", width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
@Excel(name = "单位", width = 20)
|
||||
private String unitName;
|
||||
|
||||
/* @Column
|
||||
@Comment("工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "工会", width = 20)
|
||||
private String unionName;*/
|
||||
|
||||
@Column
|
||||
@Comment("工会Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Excel(name = "工会", width = 20)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("申报年度")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Excel(name = "申报年度", width = 20)
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@Comment("个人支付金额(元)")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
@Excel(name = "个人支付金额(元)", numFormat = "#.##", width = 20)
|
||||
@JsonField(forceString = true)
|
||||
private BigDecimal selfPayMoney;
|
||||
|
||||
@Column
|
||||
@Comment("按照比例计算的补助金额(元)")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
@Excel(name = "计算金额(元)", numFormat = "#.##", width = 20)
|
||||
@JsonField(forceString = true)
|
||||
private BigDecimal noLimitSubsidyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("补助金额")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
@Excel(name = "补助金额(元)", numFormat = "#.##", width = 20)
|
||||
@JsonField(forceString = true)
|
||||
private BigDecimal subsidyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("总补助比例")
|
||||
@ColDefine(type = ColType.FLOAT, width = 3, precision = 2)
|
||||
@Excel(name = "总补助比例", width = 20, numFormat = "#.##%")
|
||||
private Double totalSubsidyRatio;
|
||||
|
||||
@Column
|
||||
@Comment("自费补助比例")
|
||||
@ColDefine(type = ColType.FLOAT, width = 3, precision = 2)
|
||||
@Excel(name = "自费补助比例", width = 20, numFormat = "#.##%")
|
||||
private Double selfPaySubsidyRatio;
|
||||
|
||||
@Column
|
||||
@Comment("额外补助比例")
|
||||
@ColDefine(type = ColType.FLOAT, width = 3, precision = 2)
|
||||
@Excel(name = "额外补助比例", width = 20, numFormat = "#.##%")
|
||||
private Double otherSubsidyRatio;
|
||||
|
||||
@Column
|
||||
@Comment("上一次补助年度")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Excel(name = "最近年度", width = 20)
|
||||
private Integer lastTimeSubsidyYear;
|
||||
|
||||
@Column
|
||||
@Comment("入会年限∕是否享受过补助")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Excel(name = "入会年限∕是否享受过补助", width = 40)
|
||||
private String subsidyDesc;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Excel(name = "备注", width = 20)
|
||||
private String remarks;
|
||||
|
||||
@Column
|
||||
@Comment("是否能申请")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isCanApply;
|
||||
|
||||
@Column
|
||||
@Comment("是否符合申请要求")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isMeetRequirements;
|
||||
|
||||
@Column
|
||||
@Comment("是否接受补助")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAccept;
|
||||
|
||||
@Column
|
||||
@Comment("申请理由")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String applyReason;
|
||||
|
||||
@Column
|
||||
@Comment("申请人签字")
|
||||
@ColDefine(customType = "mediumtext")
|
||||
private String applyUserSign;
|
||||
|
||||
@Column
|
||||
@Comment("分工会审核记录id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String branchUnionAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("校医院审核记录id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String schoolHospitalAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("校工会审核记录id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String schoolUnionAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("审核状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer stateCode;
|
||||
|
||||
@Column
|
||||
@Comment("医院导入账号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String hospitalAccount;
|
||||
|
||||
/**
|
||||
* 是否校验成功
|
||||
*/
|
||||
private Boolean valid;
|
||||
|
||||
/**
|
||||
* 是否校验成功
|
||||
*/
|
||||
private List<String> validMsg;
|
||||
|
||||
/**
|
||||
* 互助基金起扣时间
|
||||
*/
|
||||
private String mutualGoldStartTime;
|
||||
|
||||
public void setSubsidyMoney(BigDecimal subsidyMoney) {
|
||||
if (subsidyMoney != null) {
|
||||
subsidyMoney = subsidyMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
this.subsidyMoney = subsidyMoney;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelfPayMoney(BigDecimal selfPayMoney) {
|
||||
if (selfPayMoney != null) {
|
||||
selfPayMoney = selfPayMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
this.selfPayMoney = selfPayMoney;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.v.nutz.sickHelp.service;
|
||||
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
public interface SickHelpChartService extends ViService {
|
||||
|
||||
/**
|
||||
* 统计服务人数 服务次数 补助总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Object getSickCountData();
|
||||
|
||||
/**
|
||||
* 每年的用户数
|
||||
* 每年补助的钱
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Object getYearCountData();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package io.v.nutz.sickHelp.service;
|
||||
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sickHelp.model.SickFundMember;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SickHelpImportService extends ViService<SickHelp> {
|
||||
|
||||
/**
|
||||
* 校验数据合法性
|
||||
*
|
||||
* @param SickHelps
|
||||
* @return
|
||||
*/
|
||||
List<SickHelp> checkData(List<SickHelp> SickHelps);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param sickHelps
|
||||
*/
|
||||
void importData(List<SickHelp> sickHelps);
|
||||
|
||||
/**
|
||||
* 查找基金会员
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
List<SickFundMember> searchUser(String key);
|
||||
|
||||
/**
|
||||
* 查询某人历史补助记录
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SickHelp> getHistorySubsidyByUser(String userId, Integer year);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.v.nutz.sickHelp.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SickHelpListService extends ViService<SickHelp> {
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 页面形式
|
||||
* @param year 一年
|
||||
* @param subsidyUser 补贴用户
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param isMember 是成员
|
||||
* @return {@link Pagination}
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Integer year, String subsidyUser, String unionId, String unitId,Integer isMember);
|
||||
|
||||
|
||||
/**
|
||||
* 读取excel数据
|
||||
*
|
||||
* @param tempFile 临时文件
|
||||
* @return {@link List}<{@link SickHelp}>
|
||||
*/
|
||||
List<SickHelp> readExcelData(TempFile tempFile);
|
||||
|
||||
/**
|
||||
* 导入历史数据
|
||||
*
|
||||
* @param sickHelpList 生病帮助列表
|
||||
*/
|
||||
void importHistoryData(List<SickHelp> sickHelpList);
|
||||
|
||||
|
||||
/**
|
||||
* 找到补贴名单
|
||||
*
|
||||
* @param year 一年
|
||||
* @param unitName 单位名字
|
||||
* @return {@link List}<{@link SickHelp}>
|
||||
*/
|
||||
List<SickHelp> findSubsidyList(Integer year, String unitName);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package io.v.nutz.sickHelp.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SickHelpMySubsidyRecordService extends ViService {
|
||||
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 分页参数
|
||||
* @param year 年度
|
||||
* @param subsidyUser 补贴用户
|
||||
* @return {@link Pagination}
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Integer year, String subsidyUser);
|
||||
|
||||
/**
|
||||
* 是否接受补助
|
||||
*
|
||||
* @param id 记录id
|
||||
* @param isAccept 是否接受
|
||||
*/
|
||||
void isAcceptSubSidy(String id, boolean isAccept);
|
||||
|
||||
/**
|
||||
* 申请
|
||||
*
|
||||
* @param sickHelp 生病帮助
|
||||
* @param sex 性别
|
||||
* @param birthday 生日
|
||||
* @param homeAddress 家庭住址
|
||||
*/
|
||||
void doApply(SickHelp sickHelp, String sex, String birthday, String homeAddress);
|
||||
|
||||
/**
|
||||
* 申请表信息
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> exportInfo(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.v.nutz.sickHelp.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SickHelpSubsidySummaryService extends ViService {
|
||||
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 分页参数
|
||||
* @param year 年度
|
||||
* @param unitId 单位
|
||||
* @param unionId 工会
|
||||
* @param isAccept 是接受
|
||||
* @return {@link Pagination}
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Integer year,Integer startYear,Integer endYear, String unitId, String unionId, Integer isAccept);
|
||||
|
||||
|
||||
/**
|
||||
* 补助金额汇总表
|
||||
*
|
||||
* @param startYear 开始一年
|
||||
* @param endYear 结束一年
|
||||
* @return {@link List}<{@link NutMap}>
|
||||
*/
|
||||
List<NutMap> exportSubsidiesAmountTable(Integer startYear, Integer endYear,Integer isAccept);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package io.v.nutz.sickHelp.service.impl;
|
||||
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sickHelp.service.SickHelpChartService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.service.impl.SickHelpChartServiceImpl
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/4/22:11:09
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SickHelpChartServiceImpl extends ViServiceImpl implements SickHelpChartService {
|
||||
public SickHelpChartServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSickCountData() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( id ) AS servedCount,
|
||||
count( DISTINCT loginName ) servedUserCount,
|
||||
sum( subsidyMoney ) AS subsidyMoneySum,
|
||||
sum(case when `year` = YEAR(NOW()) then subsidyMoney else 0 end) as currentYearSubsidyMoneySum
|
||||
FROM
|
||||
sick_help
|
||||
""");
|
||||
return fetch(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getYearCountData() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
`year`,
|
||||
count( DISTINCT loginName ) AS userCount,
|
||||
sum( subsidyMoney ) subsidyMoneySum
|
||||
FROM
|
||||
sick_help
|
||||
GROUP BY `year`
|
||||
ORDER BY `year`
|
||||
""");
|
||||
|
||||
List<Map> list = listMap(sql);
|
||||
List<Map> year = list.stream().sorted(Comparator.comparingInt(value -> (int) value.get("year"))).collect(Collectors.toList());
|
||||
return year;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package io.v.nutz.sickHelp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpCalc;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.model.SickFundMember;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpImportService;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class SickHelpImportServiceImpl extends ViServiceImpl<SickHelp> implements SickHelpImportService {
|
||||
static String schoolCode = Globals.MyConfig.getString("schoolCode");
|
||||
|
||||
public SickHelpImportServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验数据合法性
|
||||
*
|
||||
* @param sickHelps
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SickHelp> checkData(List<SickHelp> sickHelps) {
|
||||
|
||||
for (SickHelp sick : sickHelps) {
|
||||
sick.setValidMsg(new ArrayList<>());
|
||||
|
||||
if (sick.getYear() == null) {
|
||||
sick.getValidMsg().add("年度为空");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
if (StrUtil.isBlank(sick.getLoginName())) {
|
||||
sick.getValidMsg().add("工号为空");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
if (StrUtil.isBlank(sick.getUserName())) {
|
||||
sick.getValidMsg().add("姓名为空");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
if (Lang.isEmpty(sick.getSelfPayMoney())) {
|
||||
sick.getValidMsg().add("个人支付金额为空");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
|
||||
//基金会员数据
|
||||
SickFundMember fundMember = dao().fetch(SickFundMember.class, Cnd.where("loginName", "=", sick.getLoginName()));
|
||||
|
||||
//用户数据
|
||||
User user = dao().fetch(User.class, Cnd.where("loginname", "=", sick.getLoginName()));
|
||||
if (user != null) {
|
||||
sick.setUnitName(user.getUnitname());
|
||||
sick.setUserId(user.getId());
|
||||
} else {
|
||||
sick.setUnitName("退休");
|
||||
}
|
||||
|
||||
|
||||
if (fundMember != null) {
|
||||
|
||||
// sick.setUnitName(fundMember.getUnitName());
|
||||
|
||||
//本次导入的excel人员是否有重复数据
|
||||
boolean isRepeat = sickHelps.stream().filter(v ->
|
||||
StrUtil.isNotBlank(v.getUserName()) && StrUtil.isNotBlank(v.getLoginName())
|
||||
&& v.getUserName().equals(fundMember.getUserName()) && v.getLoginName().equals(fundMember.getLoginName())
|
||||
).count() > 1;
|
||||
|
||||
if (isRepeat) {
|
||||
sick.getValidMsg().add("姓名或工号重复");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
|
||||
//本年是否有重复记录 这里只对新增的判断
|
||||
if (StrUtil.isBlank(sick.getId())) {
|
||||
Cnd duplicateCnd = Cnd.NEW();
|
||||
duplicateCnd.and("loginName", "=", fundMember.getLoginName());
|
||||
duplicateCnd.and("year", "=", sick.getYear());
|
||||
int count = dao().count(SickHelp.class, duplicateCnd);
|
||||
if (count > 0) {
|
||||
sick.getValidMsg().add("数据库中该用户已存在" + sick.getYear() + "年记录");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//上一次的补助年份
|
||||
if (sick.getYear() != null) {
|
||||
Sql sqlYear = Sqls.create("SELECT max(`year`) from sick_help where year < @year AND loginName = @loginName $Cnd");
|
||||
sqlYear.setParam("year", sick.getYear());
|
||||
sqlYear.setParam("loginName", fundMember.getLoginName());
|
||||
|
||||
//河海不一样
|
||||
if (StrUtil.isNotBlank(schoolCode) && "HHU".equals(schoolCode)) {
|
||||
sqlYear.setVar("Cnd", "AND isAccept = 1 AND stateCode = %d".formatted(SickHelpStateEnum.XGHTG.getStateCode()));
|
||||
}
|
||||
|
||||
Integer maxYear = (Integer) Daos.query(dao(), sqlYear.toString(), Sqls.callback.integer());
|
||||
sick.setLastTimeSubsidyYear(maxYear == 0 ? null : maxYear);
|
||||
}
|
||||
} else {
|
||||
sick.setSubsidyMoney(new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
sick.setOtherSubsidyRatio(0d);
|
||||
sick.getValidMsg().add("找不到该用户的会员数据");
|
||||
sick.setValidMsg(sick.getValidMsg());
|
||||
}
|
||||
|
||||
if (Lang.isEmpty(sick.getValidMsg())) {
|
||||
sick.setValid(true);
|
||||
sick.setValidMsg(List.of("校验成功!"));
|
||||
} else {
|
||||
sick.setValid(false);
|
||||
}
|
||||
|
||||
//算钱
|
||||
if (fundMember != null) {
|
||||
SickHelpCalc[] enumConstants = SickHelpCalc.class.getEnumConstants();
|
||||
Optional<SickHelpCalc> calcOptional = Arrays.stream(enumConstants).filter(v -> v.name().equals(schoolCode)).findFirst();
|
||||
if (calcOptional.isPresent()) {
|
||||
sick = calcOptional.get().calc(sick);
|
||||
} else {
|
||||
throw new RuntimeException("本学校没有实现大病互助计算方法");
|
||||
}
|
||||
}
|
||||
|
||||
log.info("补助计算>>>>>:" + sick.toString());
|
||||
}
|
||||
|
||||
return sickHelps;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void importData(List<SickHelp> sickHelps) {
|
||||
for (SickHelp sickHelp : sickHelps) {
|
||||
sickHelp.setStateCode(SickHelpStateEnum.DTJ.getStateCode());
|
||||
}
|
||||
dao().insertOrUpdate(sickHelps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SickFundMember> searchUser(String key) {
|
||||
Cnd cnd = Cnd.where(Cnd.likeEX("userName", key)).or(Cnd.likeEX("loginName", key));
|
||||
|
||||
Sql sql = Sqls.create("select * from sick_fund_member $condition");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(1, 10, sql);
|
||||
return pagination.getList();
|
||||
|
||||
// List<SickFundMember> fundMembers = dao().query(SickFundMember.class, cnd);
|
||||
// return fundMembers;
|
||||
|
||||
// FieldFilter fieldFilter = FieldFilter.create(User.class, "id|loginname|username|unitname");
|
||||
// cnd.limit(1, 10);
|
||||
// List<User> user = Daos.ext(dao(), fieldFilter).query(User.class, cnd);
|
||||
// return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SickHelp> getHistorySubsidyByUser(String loginName, Integer year) {
|
||||
//m.mutualGoldStartTime 不知道为什么要查这个字段 先注释
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
h.*
|
||||
FROM
|
||||
`sick_help` h
|
||||
LEFT JOIN sick_fund_member m ON m.loginName = h.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("h.loginName", "=", loginName);
|
||||
cnd.andEX("year", "<", year);
|
||||
cnd.desc("h.year");
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao().execute(sql);
|
||||
List<NutMap> list = sql.getList(NutMap.class);
|
||||
List<SickHelp> sickHelpList = Lang.collection2list(list, SickHelp.class);
|
||||
return sickHelpList;
|
||||
// return dao().query(SickHelp.class, Cnd.where("loginName", "=", loginName).desc("year"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package io.v.nutz.sickHelp.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpApply;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpListService;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.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.mvc.upload.TempFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.service.impl.SickHelpListServiceImpl
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/4/22:10:40
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SickHelpListServiceImpl extends ViServiceImpl<SickHelp> implements SickHelpListService {
|
||||
|
||||
@Inject
|
||||
private SickHelpApply sickHelpApply;
|
||||
|
||||
public SickHelpListServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Integer year, String subsidyUser, String unionId, String unitId, Integer isMember) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sick.*,
|
||||
u.unionname as unionName,
|
||||
sfm.isMember
|
||||
FROM
|
||||
`sick_help` sick
|
||||
LEFT JOIN sick_fund_member sfm on sfm.loginName = sick.loginName
|
||||
LEFT JOIN `user` u ON u.loginname = sick.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("sick.year", "=", year);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.andEX("u.unitId", "=", unitId);
|
||||
|
||||
cnd.andEX("sfm.isMember", "=", isMember);
|
||||
|
||||
if (StrUtil.isNotBlank(subsidyUser)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("sick.userName", subsidyUser);
|
||||
seg.orLike("sick.loginName", subsidyUser);
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
switch (pageForm.getPageOrderBy()) {
|
||||
case "descending" -> cnd.desc(pageForm.getPageOrderName());
|
||||
case "ascending" -> cnd.asc(pageForm.getPageOrderName());
|
||||
}
|
||||
}
|
||||
cnd.desc("sick.year");
|
||||
sql.setCondition(cnd);
|
||||
return list(pageForm, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取excel数据
|
||||
*
|
||||
* @param tempFile 临时文件
|
||||
* @return {@link List}<{@link SickHelp}>
|
||||
*/
|
||||
@Override
|
||||
public List<SickHelp> readExcelData(TempFile tempFile) {
|
||||
List<SickHelp> list = ExcelImportUtil.importExcel(tempFile.getFile(), SickHelp.class, new ImportParams());
|
||||
List<String> loginNameList = list.stream().map(SickHelp::getLoginName).collect(Collectors.toList());
|
||||
|
||||
List<User> userList = dao().query(User.class, Cnd.where("loginname", "in", loginNameList));
|
||||
Map<String, User> loginNameMap = userList.stream().collect(Collectors.toMap(User::getLoginname, user -> user));
|
||||
|
||||
for (SickHelp excelModel : list) {
|
||||
|
||||
if (excelModel.getYear() == null) {
|
||||
throw new RuntimeException("年度为空,请检查excel数据!");
|
||||
}
|
||||
|
||||
User user = loginNameMap.get(excelModel.getLoginName());
|
||||
if (null != user) {
|
||||
excelModel.setUserId(user.getId());
|
||||
excelModel.setUnitName(user.getUnitname());
|
||||
excelModel.setUserName(user.getUsername());
|
||||
}
|
||||
|
||||
|
||||
if (excelModel.getSelfPayMoney() != null) {
|
||||
double v = excelModel.getSelfPayMoney().doubleValue();
|
||||
if (v >= 3000 && v <= 20000) {
|
||||
excelModel.setSelfPaySubsidyRatio(0.3d);
|
||||
} else if (v > 20000 && v <= 30000) {
|
||||
excelModel.setSelfPaySubsidyRatio(0.4d);
|
||||
} else if (v > 30000) {
|
||||
excelModel.setSelfPaySubsidyRatio(0.5d);
|
||||
} else {
|
||||
//薛启玲 sw0012 2010年
|
||||
excelModel.setSelfPaySubsidyRatio(0.3d);
|
||||
}
|
||||
} else {
|
||||
excelModel.setSelfPaySubsidyRatio(0d);
|
||||
}
|
||||
|
||||
if (excelModel.getOtherSubsidyRatio() == null) {
|
||||
excelModel.setOtherSubsidyRatio(0d);
|
||||
// double v = sickHelpApply.continuousJoinYear(excelModel.getLoginName());
|
||||
}
|
||||
|
||||
excelModel.setTotalSubsidyRatio(excelModel.getSelfPaySubsidyRatio() + excelModel.getOtherSubsidyRatio());
|
||||
|
||||
if (excelModel.getYear() < 2016) {
|
||||
excelModel.setSubsidyDesc("未满五年");
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("SELECT max(`year`) FROM `sick_help` where loginName = @loginName and `year` < @year");
|
||||
sql.setParam("loginName", excelModel.getLoginName());
|
||||
sql.setParam("year", excelModel.getYear());
|
||||
Integer lastYear = (Integer) Daos.query(dao(), sql.toString(), Sqls.callback.integer());
|
||||
excelModel.setLastTimeSubsidyYear(lastYear == 0 ? null : lastYear);
|
||||
|
||||
if (excelModel.getOtherSubsidyRatio() == 0.05) {
|
||||
excelModel.setSubsidyDesc("满五年且未补助");
|
||||
}
|
||||
if (excelModel.getOtherSubsidyRatio() == 0.1) {
|
||||
excelModel.setSubsidyDesc("满十年且未补助");
|
||||
}
|
||||
|
||||
if (excelModel.getSubsidyDesc() == null) {
|
||||
if (lastYear != null) {
|
||||
excelModel.setSubsidyDesc("是");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入历史数据
|
||||
*
|
||||
* @param sickHelpList 生病帮助列表
|
||||
*/
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void importHistoryData(List<SickHelp> sickHelpList) {
|
||||
List<SickHelp> insertList = new ArrayList<>();
|
||||
for (SickHelp sickHelp : sickHelpList) {
|
||||
Cnd cnd = Cnd.where("loginName", "=", sickHelp.getLoginName());
|
||||
cnd.and("year", "=", sickHelp.getYear());
|
||||
SickHelp sameSick = dao().fetch(SickHelp.class, cnd);
|
||||
if (sameSick != null) {
|
||||
sickHelp.setId(sameSick.getId());
|
||||
}
|
||||
sickHelp.setIsAccept(true);
|
||||
insertList.add(sickHelp);
|
||||
}
|
||||
dao().insertOrUpdate(insertList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到补贴名单
|
||||
*
|
||||
* @param year 一年
|
||||
* @param unitName 单位名字
|
||||
* @return {@link List}<{@link SickHelp}>
|
||||
*/
|
||||
@Override
|
||||
public List<SickHelp> findSubsidyList(Integer year, String unitName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.andEX("unitName", "=", unitName);
|
||||
List<SickHelp> list = dao().query(SickHelp.class, cnd);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package io.v.nutz.sickHelp.service.impl;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.model.SickFundMember;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpMySubsidyRecordService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.sickHelp.service.impl.SickHelpMySubsidyRecordServiceImpl
|
||||
* @Description: TODO
|
||||
* @Author zxc
|
||||
* @Date 2022/4/27:10:40
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SickHelpMySubsidyRecordServiceImpl extends ViServiceImpl implements SickHelpMySubsidyRecordService {
|
||||
|
||||
public SickHelpMySubsidyRecordServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Integer year, String subsidyUser) {
|
||||
String schoolCode = Globals.MyConfig.getString("schoolCode");
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sick.*,
|
||||
gh.unionname as unionName
|
||||
FROM
|
||||
`sick_help` sick
|
||||
left join sys_union gh on gh.id = sick.unionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("sick.loginName", "=", ShiroUtil.getPrincipalProperty("loginname"));
|
||||
}
|
||||
cnd.desc("year");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = list(pageForm, sql);
|
||||
return SickHelpStateEnum.assignStateInfo(pagination);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isAcceptSubSidy(String id, boolean isAccept) {
|
||||
dao().update(SickHelp.class, Chain.make("isAccept", isAccept).add("stateCode", SickHelpStateEnum.DXGHSH.getStateCode()), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doApply(SickHelp sickHelp, String sex, String birthday, String homeAddress) {
|
||||
sickHelp.setStateCode(SickHelpStateEnum.DXGHSH.getStateCode());
|
||||
sickHelp.setIsAccept(true);
|
||||
dao().updateIgnoreNull(sickHelp);
|
||||
|
||||
Chain userChain = Chain.make("sex", sex);
|
||||
userChain.add("birthday", birthday);
|
||||
userChain.add("homeAddress", homeAddress);
|
||||
dao().update(Sys_user.class, userChain, Cnd.where("loginname", "=", sickHelp.getLoginName()));
|
||||
|
||||
Chain sickMemberChain = Chain.make("sex", sex);
|
||||
sickMemberChain.add("birthday", birthday);
|
||||
sickMemberChain.add("homeAddress", homeAddress);
|
||||
dao().update(SickFundMember.class, sickMemberChain, Cnd.where("loginName", "=", sickHelp.getLoginName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> exportInfo(List<String> ids) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sick.userName AS xm,
|
||||
sick.unitName,
|
||||
sick.applyReason,
|
||||
sick.selfPayMoney,
|
||||
CAST( sick.subsidyMoney AS UNSIGNED ) AS subsidyMoney,
|
||||
fm.sex,
|
||||
fm.birthday AS csrq,
|
||||
fm.mutualGoldStartTime AS cjsj,
|
||||
fm.homeAddress
|
||||
FROM
|
||||
sick_help sick
|
||||
LEFT JOIN sick_fund_member fm ON fm.loginName = sick.loginName\s
|
||||
WHERE
|
||||
sick.id in (@ids)
|
||||
""");
|
||||
sql.setParam("ids", ids);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package io.v.nutz.sickHelp.service.impl;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sickHelp.constant.SickHelpStateEnum;
|
||||
import io.v.nutz.sickHelp.model.SickHelp;
|
||||
import io.v.nutz.sickHelp.service.SickHelpSubsidySummaryService;
|
||||
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.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SickHelpSubsidySummaryServiceImpl extends ViServiceImpl implements SickHelpSubsidySummaryService {
|
||||
public SickHelpSubsidySummaryServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*
|
||||
* @param pageForm 分页参数
|
||||
* @param year 年度
|
||||
* @param unitId 单位
|
||||
* @param unionId 工会
|
||||
* @param isAccept 是接受
|
||||
* @return {@link Pagination}
|
||||
*/
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Integer year, Integer startYear, Integer endYear, String unitId, String unionId, Integer isAccept) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
DISTINCT sick.loginName as loginName,
|
||||
sick.id,
|
||||
sick.userName,
|
||||
sick.year,
|
||||
sick.selfPayMoney,
|
||||
sick.subsidyMoney,
|
||||
sick.isAccept,
|
||||
sick.stateCode,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName
|
||||
FROM
|
||||
`sick_help` sick
|
||||
LEFT JOIN `user` u ON u.loginname = sick.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
|
||||
cnd.andEX("sick.year", ">=", startYear);
|
||||
cnd.andEX("sick.year", "<=", endYear);
|
||||
|
||||
|
||||
/*SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(Cnd.exps("sick.stateCode", "=", SickHelpStateEnum.XGHTG.getStateCode()).and("sick.isAccept", "=", 1));
|
||||
seg.or("sick.isAccept", "=", 0);
|
||||
cnd.and(seg);*/
|
||||
|
||||
switch (isAccept) {
|
||||
case -1 -> cnd.andEX("sick.isAccept", "=", 0);
|
||||
case 1 -> cnd.andEX("sick.isAccept", "=", 1);
|
||||
}
|
||||
|
||||
cnd.desc("sick.id").desc("u.unitid");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = list(pageForm, sql);
|
||||
return SickHelpStateEnum.assignStateInfo(pagination);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> exportSubsidiesAmountTable(Integer startYear, Integer endYear, Integer isAccept) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sick.id,
|
||||
sick.userName,
|
||||
sick.loginName,
|
||||
sick.year,
|
||||
sick.selfPayMoney,
|
||||
sick.subsidyMoney,
|
||||
sick.isAccept,
|
||||
sick.lastTimeSubsidyYear,
|
||||
sick.stateCode,
|
||||
u.unitname as unitName,
|
||||
u.unionname as unionName,
|
||||
u.sex,
|
||||
u.userState,
|
||||
CASE WHEN sick.isAccept = 1 AND sick.stateCode = 700 THEN '申请'\s
|
||||
WHEN sick.isAccept = 0 AND sick.stateCode = 700 THEN '放弃'\s
|
||||
ELSE NULL END AS 'isAcceptText'
|
||||
FROM
|
||||
`sick_help` sick
|
||||
LEFT JOIN `user` u ON u.loginname = sick.loginName
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("sick.year", ">=", startYear);
|
||||
cnd.andEX("sick.year", "<=", endYear);
|
||||
switch (isAccept) {
|
||||
case -1 -> cnd.andEX("sick.isAccept", "=", 0);
|
||||
case 1 -> cnd.andEX("sick.isAccept", "=", 1);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
for (NutMap map : list) {
|
||||
Integer lastTimeSubsidyYear = (Integer) map.get("lastTimeSubsidyYear", null);
|
||||
int applyYear = map.getInt("year");
|
||||
map.put("consecutiveYearOfNoSubsidies", lastTimeSubsidyYear == null ? null : applyYear - lastTimeSubsidyYear);
|
||||
|
||||
Cnd subsidyCnd = Cnd.where("loginName", "=", map.getString("loginName"));
|
||||
cnd.andEX("year", ">=", startYear);
|
||||
cnd.andEX("year", "<=", endYear);
|
||||
// cnd.andEX("isAccept", "=", 1);
|
||||
if (isAccept != 0) {
|
||||
cnd.andEX("isAccept", "=", isAccept);
|
||||
}
|
||||
|
||||
cnd.andEX("stateCode", "=", SickHelpStateEnum.XGHTG.getStateCode());
|
||||
|
||||
int totalSubsidy = dao().func(SickHelp.class, "sum", "subsidyMoney", subsidyCnd);
|
||||
|
||||
map.put("totalSubsidy", totalSubsidy);
|
||||
map.put("subsidyGroup", new ArrayList<Map>() {{
|
||||
add(Map.of(
|
||||
"selfPayMoney", map.getDouble("selfPayMoney"),
|
||||
"subsidyMoney", Math.ceil(map.getDouble("subsidyMoney")),
|
||||
"totalSubsidy", map.getDouble("totalSubsidy")));
|
||||
}});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user