ly 1 tahun lalu
induk
melakukan
6478648509

+ 86 - 19
src/main/java/cn/ezhizao/project/business/socialSecurity/controller/SocialSecurityDeclareController.java

@@ -13,6 +13,7 @@ import cn.ezhizao.project.business.deduction.domain.BizDeduction;
 import cn.ezhizao.project.business.deduction.service.IBizDeductionService;
 import cn.ezhizao.project.business.reportTaxIsZero.domain.BizFinancialReportTaxDetail;
 import cn.ezhizao.project.business.socialSecurity.domain.*;
+import cn.ezhizao.project.business.socialSecurity.domain.vo.SocialSecurityDetailVo;
 import cn.ezhizao.project.business.socialSecurity.service.IBizSocialSecurityConfirmDetailEmployeeService;
 import cn.ezhizao.project.business.socialSecurity.service.IBizSocialSecurityConfirmDetailService;
 import cn.ezhizao.project.business.socialSecurity.service.IBizSocialSecurityDeclareDetailService;
@@ -133,32 +134,31 @@ public class SocialSecurityDeclareController extends BaseController {
     @PreAuthorize("@ss.hasPermi('business:socialSecurityConfirm:export')")
     @Log(title = "个税详情", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, BizSocialSecurityDeclare conditions) throws NoSuchFieldException, IllegalAccessException
-    {
+    public void export(HttpServletResponse response, BizSocialSecurityDeclare conditions) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(conditions);
         startOrderBy();
         List<BizSocialSecurityDeclare> list = socialSecurityDeclareService.getListByBean(conditions);
-        for (BizSocialSecurityDeclare l: list){
-            l.setCurrentPeriod(conditions.getYear()+"-"+conditions.getMonth());
+        for (BizSocialSecurityDeclare l : list) {
+            l.setCurrentPeriod(conditions.getYear() + "-" + conditions.getMonth());
             BizSocialSecurityDeclareDetail detail = new BizSocialSecurityDeclareDetail();
             detail.setSocialSecurityDeclareId(l.getId());
             detail.setYear(conditions.getYear());
             detail.setMonth(conditions.getMonth());
             List<BizSocialSecurityDeclareDetail> details = socialSecurityDeclareDetailService.getListByBean(detail);
-            if(details.size() == 0){
+            if (details.size() == 0) {
                 l.setStatusText("未开始");
                 l.setMakeOut("未填写");
                 l.setServiceName("");
-            }else{
-                detail=details.get(0);
+            } else {
+                detail = details.get(0);
                 List<BizWorkOrderRecord> records = bizWorkOrderRecordService.query().eq("work_order_id", l.getWorkOrderId()).eq("year", conditions.getYear()).eq("month", conditions.getMonth()).eq("from_id", 0).list();
-                if(records.size()>0){
+                if (records.size() > 0) {
                     SysUser sysUser = sysUserMapper.selectUserById(records.get(0).getRecorderId());
-                    l.setServiceName(sysUser==null?"":sysUser.getNickName());
-                }else{
+                    l.setServiceName(sysUser == null ? "" : sysUser.getNickName());
+                } else {
                     l.setServiceName("");
                 }
-                switch (detail.getStatus()){
+                switch (detail.getStatus()) {
                     case 0:
                         l.setStatusText("未开始");
                         l.setMakeOut("未填写");
@@ -201,7 +201,6 @@ public class SocialSecurityDeclareController extends BaseController {
     }
 
 
-
     @ApiOperation(value = "整体保存", notes = "整体保存")
     @PostMapping("/saveFile")
     @Transactional(rollbackFor = Exception.class)
@@ -221,12 +220,12 @@ public class SocialSecurityDeclareController extends BaseController {
         String formattedMonth = String.format("%02d", nowMonth);
         String year = condition.getYear();
         String month = condition.getMonth();
-        String s1= year+month;
-        String s2 = nowYear+ formattedMonth;
+        String s1 = year + month;
+        String s2 = nowYear + formattedMonth;
 //        if(s1.equals(s2) && socialSecurityConfirmDetails .isEmpty()){
 //            return success(new BizSocialSecurityDeclareDetail());
 //        }
-        if(!s1.equals(s2) && socialSecurityConfirmDetails.isEmpty()){
+        if (!s1.equals(s2) && socialSecurityConfirmDetails.isEmpty()) {
             return error("当前月未找到数据");
         }
         if (socialSecurityConfirmDetails.isEmpty()) {
@@ -234,10 +233,10 @@ public class SocialSecurityDeclareController extends BaseController {
             // 先获取之前的一个月是否已填报,然后获取填报后的工资人员信息
             BizSocialSecurityDeclareDetail detail = socialSecurityDeclareDetailService.query().eq("social_security_declare_id", condition.getSocialSecurityDeclareId()).lt("concat(year,month)", condition.getYear() + condition.getMonth()).orderByDesc("concat(year, month)").last("limit 1").one();
             if (detail != null) {
-                List<SysFileStorage> files = fileStorageService.query().eq("master_table_name", "biz_social_security_declare_detail").eq("master_id", detail.getId()).eq("type","evidenceFile").list();
+                List<SysFileStorage> files = fileStorageService.query().eq("master_table_name", "biz_social_security_declare_detail").eq("master_id", detail.getId()).eq("type", "evidenceFile").list();
                 files.forEach(l -> l.setId(null));
                 condition.setEvidenceFiles(files);
-                List<SysFileStorage> reportFiles = fileStorageService.query().eq("master_table_name", "biz_social_security_declare_detail").eq("master_id", detail.getId()).eq("type","reportFile").list();
+                List<SysFileStorage> reportFiles = fileStorageService.query().eq("master_table_name", "biz_social_security_declare_detail").eq("master_id", detail.getId()).eq("type", "reportFile").list();
                 reportFiles.forEach(l -> l.setId(null));
                 condition.setReportFiles(reportFiles);
             } else {
@@ -283,7 +282,7 @@ public class SocialSecurityDeclareController extends BaseController {
         delCondition.setMasterId(detail.getId());
         delCondition.setMasterTableName("biz_social_security_declare_detail");
         fileStorageService.physicalDelete(delCondition);
-        bool = bool && (reportFiles.isEmpty() || fileStorageService.saveOrUpdateBatch(reportFiles))&& (fileStorages.isEmpty() || fileStorageService.saveOrUpdateBatch(fileStorages)) && addRecord(detail.getSocialSecurityDeclareId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), detail.getAmount().compareTo(BigDecimal.ZERO) > 0 ? "社保申报保存" : "社保申报完成", detail.getAmount().compareTo(BigDecimal.ZERO) > 0 ? 1 : 3);
+        bool = bool && (reportFiles.isEmpty() || fileStorageService.saveOrUpdateBatch(reportFiles)) && (fileStorages.isEmpty() || fileStorageService.saveOrUpdateBatch(fileStorages)) && addRecord(detail.getSocialSecurityDeclareId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), detail.getAmount().compareTo(BigDecimal.ZERO) > 0 ? "社保申报保存" : "社保申报完成", detail.getAmount().compareTo(BigDecimal.ZERO) > 0 ? 1 : 3);
         return bool ? success(detail) : error();
     }
 
@@ -349,6 +348,7 @@ public class SocialSecurityDeclareController extends BaseController {
             return success(new ArrayList<>());
         }
     }
+
     @PreAuthorize("@ss.hasPermi('business:socialSecurityDeclare:query')")
     @ApiOperation("获取社保人员信息")
     @PostMapping("/getMembersNoDelete")
@@ -365,6 +365,73 @@ public class SocialSecurityDeclareController extends BaseController {
             return success(new ArrayList<>());
         }
     }
+
+    @ApiOperation("获取社保人员信息")
+    @PostMapping("/getTableDetail")
+    @ResponseBody
+    public AjaxResult getTableDetail(@RequestBody BizSocialSecurityConfirmDetail detail) {
+        ArrayList<SocialSecurityDetailVo> vos = new ArrayList<>();
+        BizSocialSecurityConfirmDetail financialSocialSecurityConfirmDetail = socialSecurityConfirmDetailService.query().eq("company_id", detail.getCompanyId()).eq("year", detail.getYear()).eq("month", detail.getMonth()).one();
+        if (financialSocialSecurityConfirmDetail != null) {
+            List<BizSocialSecurityConfirmDetailEmployee> employees = socialSecurityConfirmDetailEmployeeService.query()
+                    .eq("social_security_confirm_detail_id", financialSocialSecurityConfirmDetail.getId())
+                    .ne("change_status", 2)
+                    .list();
+            //0.05%
+            BigDecimal zeroPointZeroFiveDecimal = new BigDecimal("0.0005");
+            //0.2%
+            BigDecimal ZeroPointTwoDecimal = new BigDecimal("0.002");
+            //0.5%
+            BigDecimal halfOneDecimal = new BigDecimal("0.005");
+            //1%
+            BigDecimal onePercent = new BigDecimal("0.01");
+            //2%
+            BigDecimal twoPercent = new BigDecimal("0.02");
+            //8%
+            BigDecimal eightDecimal = new BigDecimal("0.08");
+            //16%
+            BigDecimal sixteenPercent = new BigDecimal("0.16");
+            for (BizSocialSecurityConfirmDetailEmployee employee : employees) {
+                SocialSecurityDetailVo vo = new SocialSecurityDetailVo();
+                vo.setName(employee.getEmployeeName());
+                vo.setBasePayment(employee.getCardinalNumber());
+                //医疗、生育缴费基数
+                vo.setMmBasePayment(employee.getMedicalCardinalNumber());
+                vo.setHeatingPayment(employee.getHeatingFee());
+
+                vo.setCompanyBirth(this.multiplication(employee.getMedicalCardinalNumber(), onePercent));
+                vo.setCompanyLargeMedical(this.multiplication(employee.getMedicalCardinalNumber(), ZeroPointTwoDecimal));
+                vo.setCompanyMedical(this.multiplication(employee.getMedicalCardinalNumber(), eightDecimal));
+                vo.setCompanyElderly(this.multiplication(employee.getMedicalCardinalNumber(), sixteenPercent));
+                vo.setCompanyUnemployment(this.multiplication(employee.getCardinalNumber(), halfOneDecimal));
+                vo.setCompanyInjury(this.multiplication(employee.getCardinalNumber(), detail.getInjuryRadio().divide(BigDecimal.valueOf(100))));
+                vo.setCompanyHeat(this.multiplication(employee.getHeatingFee(), onePercent));
+                vo.setCompanyCount(
+                        vo.getCompanyBirth().add(vo.getCompanyLargeMedical()).add(vo.getCompanyMedical())
+                                .add(vo.getCompanyElderly()).add(vo.getCompanyUnemployment()).add(vo.getCompanyInjury()).add(vo.getCompanyHeat())
+                );
+                vo.setOneSelfLargeMedical(this.multiplication(employee.getMedicalCardinalNumber(), zeroPointZeroFiveDecimal));
+                vo.setOneSelfElderly(this.multiplication(employee.getCardinalNumber(), eightDecimal));
+                vo.setOneSelfUnemployment(this.multiplication(employee.getCardinalNumber(), halfOneDecimal));
+                vo.setOneSelfEMedical(this.multiplication(employee.getMedicalCardinalNumber(), twoPercent));
+                vo.setOneSelfCount(
+                        vo.getOneSelfLargeMedical().add(vo.getOneSelfElderly()).add(vo.getOneSelfUnemployment()).add(vo.getOneSelfEMedical())
+                );
+                vo.setTotalAmount(vo.getCompanyCount().add(vo.getOneSelfCount()));
+                vos.add(vo);
+            }
+            return success(vos);
+        } else {
+            return success(new ArrayList<>());
+        }
+    }
+
+    public BigDecimal multiplication(BigDecimal a, BigDecimal b) {
+
+        return a.multiply(b).setScale(2, BigDecimal.ROUND_DOWN);
+    }
+
+
     @PreAuthorize("@ss.hasPermi('business:socialSecurityDeclare:edit')")
     @ApiOperation("退回")
     @PostMapping("/turnBackDetail")
@@ -378,7 +445,7 @@ public class SocialSecurityDeclareController extends BaseController {
             return error("该社保记录已扣款");
         }
         deductionService.removeBatchByIds(deductions.stream().map(BizDeduction::getId).collect(Collectors.toList()));
-        return socialSecurityDeclareDetailService.updateById(detail) && addRecord(detail.getSocialSecurityDeclareId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), "社保申报退回", 1)? success() : error();
+        return socialSecurityDeclareDetailService.updateById(detail) && addRecord(detail.getSocialSecurityDeclareId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), "社保申报退回", 1) ? success() : error();
     }
 
 

+ 4 - 0
src/main/java/cn/ezhizao/project/business/socialSecurity/domain/BizSocialSecurityConfirmDetail.java

@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -79,4 +80,7 @@ public class BizSocialSecurityConfirmDetail extends BaseEntity implements Serial
     private Integer isChanged;
     @ApiModelProperty("审核人")
     private Date verifierTime;
+
+    @TableField(exist = false)
+    private BigDecimal injuryRadio;
 }

+ 41 - 0
src/main/java/cn/ezhizao/project/business/socialSecurity/domain/vo/SocialSecurityDetailVo.java

@@ -0,0 +1,41 @@
+package cn.ezhizao.project.business.socialSecurity.domain.vo;
+
+import io.swagger.annotations.ApiOperation;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class SocialSecurityDetailVo {
+    private String name;
+    private BigDecimal basePayment;
+    /**
+     * 医疗基数
+     */
+    private BigDecimal mmBasePayment;
+    /**
+     * 采暖基数
+     */
+    private BigDecimal heatingPayment;
+    /**
+     * 生育保险公司
+     */
+    private BigDecimal companyBirth;
+    private BigDecimal companyLargeMedical;
+    private BigDecimal companyMedical;
+    /**
+     * 养老
+     */
+    private BigDecimal companyElderly;
+    private BigDecimal companyUnemployment;
+    private BigDecimal companyInjury;
+    private BigDecimal companyHeat;
+    private BigDecimal companyCount;
+    private BigDecimal oneSelfLargeMedical;
+    private BigDecimal oneSelfElderly;
+    private BigDecimal oneSelfUnemployment;
+    private BigDecimal oneSelfEMedical;
+    private BigDecimal oneSelfCount;
+    private BigDecimal totalAmount;
+
+}