|
@@ -12,14 +12,19 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.SqlInjectionUtil;
|
|
|
import org.jeecg.common.util.encryption.AesEncryptUtil;
|
|
|
import org.jeecg.modules.salary.entity.*;
|
|
|
+import org.jeecg.modules.salary.mapper.SalaryManagementDetailMapper;
|
|
|
import org.jeecg.modules.salary.service.*;
|
|
|
import org.jeecg.modules.salary.vo.ExcelDemo;
|
|
|
+import org.jeecg.modules.salary.vo.ExcelTemp;
|
|
|
+import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.system.mapper.SysUserMapper;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.def.TemplateExcelConstants;
|
|
@@ -66,6 +71,18 @@ public class SalaryManagementController {
|
|
|
private ISalaryManagementExtraService salaryManagementExtraService;
|
|
|
@Autowired
|
|
|
private ISalaryChangeRecordService salaryChangeRecordService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper sysUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private SalaryManagementDetailMapper salaryManagementDetailMapper;
|
|
|
+
|
|
|
+ @ModelAttribute
|
|
|
+ public void get() {
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ if(!"T0003".equals(sysUser.getUsername())){
|
|
|
+ throw new JeecgBootException("无权操作此功能!!!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询 (工资单)
|
|
@@ -192,7 +209,7 @@ public class SalaryManagementController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) throws IOException, IllegalAccessException {
|
|
|
+ public static void main1(String[] args) throws IOException, IllegalAccessException {
|
|
|
// SalaryChangeRecord userParams = new SalaryChangeRecord();
|
|
|
// userParams.setId("sssss");
|
|
|
// Map<String, Object> map = new HashMap<>();
|
|
@@ -744,11 +761,20 @@ public class SalaryManagementController {
|
|
|
ExcelDemo demo = new ExcelDemo();
|
|
|
demo.setCode(o.getYearWithMonth());
|
|
|
demo.setName(o.getName());
|
|
|
+ demo.setOrgName(o.getOrgName());
|
|
|
|
|
|
String totalPayable = o.getTotalPayable();
|
|
|
if (StringUtils.isNotBlank(totalPayable)) {
|
|
|
demo.setCardNo(AesEncryptUtil.desEncrypt(totalPayable).trim());
|
|
|
}
|
|
|
+ String payTaxes = o.getPayTaxes();
|
|
|
+ if (StringUtils.isNotBlank(payTaxes)) {
|
|
|
+ demo.setPayTaxes(AesEncryptUtil.desEncrypt(payTaxes).trim());
|
|
|
+ }
|
|
|
+ String cumulative = o.getCumulative();
|
|
|
+ if (StringUtils.isNotBlank(cumulative)) {
|
|
|
+ demo.setCumulative(AesEncryptUtil.desEncrypt(cumulative).trim());
|
|
|
+ }
|
|
|
demo.setWages(o.getPersonalTax().toString());
|
|
|
demo.setTest1(o.getTotalDeduction().toString());
|
|
|
demo.setTest("月度工资单");
|
|
@@ -778,6 +804,7 @@ public class SalaryManagementController {
|
|
|
demo.setWages(o.getPersonalTax().toString());
|
|
|
demo.setTest1(o.getPersonalTax().toString());
|
|
|
|
|
|
+ demo.setOrgName(o.getOrgName());
|
|
|
String actualOccurrence = o.getActualOccurrence();
|
|
|
if (StringUtils.isNotBlank(actualOccurrence)) {
|
|
|
demo.setTest2(AesEncryptUtil.desEncrypt(actualOccurrence).trim());
|
|
@@ -803,6 +830,7 @@ public class SalaryManagementController {
|
|
|
demo.setWages(o.getPersonalTax().toString());
|
|
|
demo.setTest1(o.getPersonalTax().toString());
|
|
|
|
|
|
+ demo.setOrgName(o.getOrgName());
|
|
|
String actualOccurrence = o.getActualOccurrence();
|
|
|
if (StringUtils.isNotBlank(actualOccurrence)) {
|
|
|
demo.setTest2(AesEncryptUtil.desEncrypt(actualOccurrence).trim());
|
|
@@ -832,6 +860,7 @@ public class SalaryManagementController {
|
|
|
demo.setWages(o.getPersonalTax().toString());
|
|
|
demo.setTest1(o.getPersonalTax().toString());
|
|
|
|
|
|
+ demo.setOrgName(o.getOrgName());
|
|
|
String actualOccurrence = o.getAfterTaxAmount();
|
|
|
if (StringUtils.isNotBlank(actualOccurrence)) {
|
|
|
demo.setTest2(AesEncryptUtil.desEncrypt(actualOccurrence).trim());
|
|
@@ -855,6 +884,7 @@ public class SalaryManagementController {
|
|
|
demo.setName(o.getName());
|
|
|
demo.setTest("年终奖");
|
|
|
|
|
|
+ demo.setOrgName(o.getOrgName());
|
|
|
String getBeforeTaxAmount = o.getBeforeTaxAmount();
|
|
|
if (StringUtils.isNotBlank(getBeforeTaxAmount)) {
|
|
|
demo.setCardNo(AesEncryptUtil.desEncrypt(getBeforeTaxAmount).trim());
|
|
@@ -1215,4 +1245,163 @@ public class SalaryManagementController {
|
|
|
return "true";
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
+ ImportParams params = new ImportParams();
|
|
|
+ params.setTitleRows(0);
|
|
|
+ params.setHeadRows(0);
|
|
|
+ //params.setSheetNum(9);
|
|
|
+ params.setNeedSave(false);
|
|
|
+ long start = new Date().getTime();
|
|
|
+ List<ExcelTemp> list = ExcelImportUtil.importExcel(new File(
|
|
|
+ "e:/一月考勤 - 正织.xlsx"), ExcelTemp.class, params);
|
|
|
+// AesEncryptUtil.desEncrypt(Salary).trim()
|
|
|
+
|
|
|
+ for(ExcelTemp o:list){
|
|
|
+ String name = o.getName();
|
|
|
+ BigDecimal deduction = o.getDeduction();
|
|
|
+
|
|
|
+ System.out.println(name);
|
|
|
+ System.out.println(deduction);
|
|
|
+
|
|
|
+
|
|
|
+// String wages = AesEncryptUtil.encrypt(personalTax.toString()).trim();
|
|
|
+// System.out.println("update sys_user set adjustment = '"+wages+"' where realname='" +name+"';");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/tempChange")
|
|
|
+ public void tempChange(@RequestParam(name = "excelName", required = true)String excelName,
|
|
|
+ @RequestParam(name = "month", required = true)String month) throws Exception {
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(excelName)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(month)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ImportParams params = new ImportParams();
|
|
|
+ params.setTitleRows(0);
|
|
|
+ params.setHeadRows(0);
|
|
|
+ params.setNeedSave(false);
|
|
|
+ List<ExcelTemp> list = ExcelImportUtil.importExcel(new File(
|
|
|
+ "e:/"+excelName+".xlsx"), ExcelTemp.class, params);
|
|
|
+
|
|
|
+ SalaryManagement salaryManagement = new SalaryManagement(); //主表
|
|
|
+ //发放薪资合计(用于主表统计)
|
|
|
+ BigDecimal salary = new BigDecimal("0");
|
|
|
+ //个税合计(用于主表统计)
|
|
|
+ BigDecimal personalTax = new BigDecimal("0");
|
|
|
+
|
|
|
+
|
|
|
+ List<SalaryManagementDetail> salaryAttendanceDetailList = new ArrayList<>();//子表
|
|
|
+ String org = "";
|
|
|
+ for(ExcelTemp o:list){
|
|
|
+
|
|
|
+ String orgName = o.getOrgName();//组织
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(org)){
|
|
|
+
|
|
|
+ org = orgName;
|
|
|
+ }
|
|
|
+
|
|
|
+ String code = o.getCode();//编码
|
|
|
+ String name = o.getName();//员工姓名
|
|
|
+ BigDecimal deduction = o.getDeduction();//工资抵扣
|
|
|
+ BigDecimal wages = o.getWages();//基本工资
|
|
|
+ BigDecimal yingfa = o.getYingfa();//应发
|
|
|
+ BigDecimal shebao = o.getShebao();//社保
|
|
|
+ BigDecimal zhufangjijin = o.getZhufangjijin();//住房基金
|
|
|
+ BigDecimal gerenshuodeshui = o.getGerenshuodeshui();//个人所得税
|
|
|
+ BigDecimal hejiyingkou = o.getHejiyingkou();//合计应扣
|
|
|
+ BigDecimal shifaheji = o.getShifaheji();//实发合计
|
|
|
+ BigDecimal yingnashuie = o.getYingnashuie()==null||BigDecimal.ZERO.compareTo(o.getYingnashuie())>=0?BigDecimal.ZERO:o.getYingnashuie();//纳税金额
|
|
|
+
|
|
|
+ List<SysUser> listUser = sysUserMapper.getUserByRealName(name);
|
|
|
+ if(listUser.size() == 0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String userId = listUser.get(0).getId();
|
|
|
+ String cardNo = listUser.get(0).getNCardNo();
|
|
|
+
|
|
|
+ salary = salary.add(shifaheji);
|
|
|
+ personalTax = personalTax.add(gerenshuodeshui);
|
|
|
+
|
|
|
+ //累计所得额 = 本年度当前人员所有应纳税所得之和
|
|
|
+ BigDecimal cumulative = new BigDecimal("0");
|
|
|
+ List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, "2024", month);
|
|
|
+
|
|
|
+ if (cumulativeList.size() > 0) {
|
|
|
+ for (SalaryManagementDetail detail : cumulativeList) {
|
|
|
+
|
|
|
+ String hisPayTaxes = detail.getPayTaxes();//应纳税所得额
|
|
|
+ hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
+ BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
+ cumulative = cumulative.add(bigPayTaxes);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cumulative = cumulative.add(yingnashuie).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
+
|
|
|
+ SalaryManagementDetail detail = new SalaryManagementDetail();
|
|
|
+
|
|
|
+ detail.setCardNo(cardNo);
|
|
|
+ detail.setYearWithMonth(month);
|
|
|
+ detail.setVersion("1");
|
|
|
+ detail.setUserId(userId);
|
|
|
+ detail.setCode(code);
|
|
|
+ detail.setName(name);
|
|
|
+ detail.setOrgName(orgName);
|
|
|
+
|
|
|
+ String wagesHis = AesEncryptUtil.encrypt(wages.toString()).trim();
|
|
|
+ detail.setWages(wagesHis);//基本薪资
|
|
|
+
|
|
|
+ String yingfaHis = AesEncryptUtil.encrypt(yingfa.toString()).trim();
|
|
|
+ detail.setTotalPayable(yingfaHis);//合计应发
|
|
|
+
|
|
|
+ detail.setTotalDeduction(hejiyingkou);//合计应扣
|
|
|
+ detail.setSocialSecurity(shebao);//社保
|
|
|
+ detail.setAccumulationFund(zhufangjijin);//公积金
|
|
|
+ detail.setPersonalTax(gerenshuodeshui);//个税
|
|
|
+
|
|
|
+ String shifahejiHis = AesEncryptUtil.encrypt(shifaheji.toString()).trim();
|
|
|
+ detail.setActualOccurrence(shifahejiHis);//实发合计
|
|
|
+ detail.setDeduction(deduction);//工资抵扣
|
|
|
+
|
|
|
+ String yingnashuieHis = AesEncryptUtil.encrypt(yingnashuie.toString()).trim();
|
|
|
+ detail.setPayTaxes(yingnashuieHis);//应纳税所得额
|
|
|
+
|
|
|
+ String cumulativeHis = AesEncryptUtil.encrypt(cumulative.toString()).trim();
|
|
|
+ detail.setCumulative(cumulativeHis);//累计所得额
|
|
|
+
|
|
|
+ salaryAttendanceDetailList.add(detail);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String salaryHis = AesEncryptUtil.encrypt(salary.toString()).trim();
|
|
|
+ String personalTaxHis = AesEncryptUtil.encrypt(personalTax.toString()).trim();
|
|
|
+ salaryManagement.setSalary(salaryHis);
|
|
|
+ salaryManagement.setPersonalTax(personalTaxHis);
|
|
|
+ salaryManagement.setType("月度工资单");
|
|
|
+ salaryManagement.setYearWithMonth(month);
|
|
|
+ salaryManagement.setOrgName(org);
|
|
|
+ salaryManagement.setVersion("1");
|
|
|
+ salaryManagement.setNumberPeople(salaryAttendanceDetailList.size());
|
|
|
+ salaryManagement.setGenerationTime(new Date());
|
|
|
+ salaryManagementService.save(salaryManagement);
|
|
|
+
|
|
|
+
|
|
|
+ for(SalaryManagementDetail o:salaryAttendanceDetailList){
|
|
|
+ o.setHeadId(salaryManagement.getId());
|
|
|
+ o.setActionLog("薪资初始化");
|
|
|
+ salaryManagementDetailService.save(o);
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println("==============================================");
|
|
|
+ System.out.println("========执行结束==========:"+salaryAttendanceDetailList.size());
|
|
|
+ System.out.println("==============================================");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|