|
@@ -15,29 +15,41 @@ import cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetai
|
|
import cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetailEmployee;
|
|
import cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetailEmployee;
|
|
import cn.ezhizao.project.business.housingFund.domain.BizHousingFundDeclare;
|
|
import cn.ezhizao.project.business.housingFund.domain.BizHousingFundDeclare;
|
|
import cn.ezhizao.project.business.housingFund.domain.BizHousingFundDeclareDetail;
|
|
import cn.ezhizao.project.business.housingFund.domain.BizHousingFundDeclareDetail;
|
|
|
|
+import cn.ezhizao.project.business.housingFund.domain.vo.EmployeeExcel;
|
|
|
|
+import cn.ezhizao.project.business.housingFund.domain.vo.HousingFundEmployeeVo;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundConfirmDetailEmployeeService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundConfirmDetailEmployeeService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundConfirmDetailService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundConfirmDetailService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundDeclareDetailService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundDeclareDetailService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundDeclareService;
|
|
import cn.ezhizao.project.business.housingFund.service.IBizHousingFundDeclareService;
|
|
-import cn.ezhizao.project.business.socialSecurity.domain.BizSocialSecurityDeclare;
|
|
|
|
-import cn.ezhizao.project.business.socialSecurity.domain.BizSocialSecurityDeclareDetail;
|
|
|
|
import cn.ezhizao.project.business.workOrder.domain.BizWorkOrderRecord;
|
|
import cn.ezhizao.project.business.workOrder.domain.BizWorkOrderRecord;
|
|
import cn.ezhizao.project.business.workOrder.service.IBizWorkOrderRecordService;
|
|
import cn.ezhizao.project.business.workOrder.service.IBizWorkOrderRecordService;
|
|
import cn.ezhizao.project.system.domain.SysFileStorage;
|
|
import cn.ezhizao.project.system.domain.SysFileStorage;
|
|
import cn.ezhizao.project.system.domain.SysUser;
|
|
import cn.ezhizao.project.system.domain.SysUser;
|
|
import cn.ezhizao.project.system.mapper.SysUserMapper;
|
|
import cn.ezhizao.project.system.mapper.SysUserMapper;
|
|
import cn.ezhizao.project.system.service.ISysFileStorageService;
|
|
import cn.ezhizao.project.system.service.ISysFileStorageService;
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
|
|
+import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
|
+import com.alibaba.excel.write.metadata.fill.FillConfig;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
|
+import org.springframework.core.io.ResourceLoader;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.BufferedOutputStream;
|
|
|
|
+import java.io.InputStream;
|
|
|
|
+import java.io.OutputStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.net.URLEncoder;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@@ -67,6 +79,8 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
IBizDeductionService deductionService;
|
|
IBizDeductionService deductionService;
|
|
@Resource
|
|
@Resource
|
|
IBizWorkOrderRecordService bizWorkOrderRecordService;
|
|
IBizWorkOrderRecordService bizWorkOrderRecordService;
|
|
|
|
+ @Resource
|
|
|
|
+ ResourceLoader resourceLoader;
|
|
|
|
|
|
@ApiOperation(value = "根据id查询", notes = "根据id查询")
|
|
@ApiOperation(value = "根据id查询", notes = "根据id查询")
|
|
@GetMapping("/getById/{id}")
|
|
@GetMapping("/getById/{id}")
|
|
@@ -82,6 +96,92 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
return (housingFundDeclare.getId() == null ? housingFundDeclareService.save(housingFundDeclare) : housingFundDeclareService.updateById(housingFundDeclare)) ? success() : error();
|
|
return (housingFundDeclare.getId() == null ? housingFundDeclareService.save(housingFundDeclare) : housingFundDeclareService.updateById(housingFundDeclare)) ? success() : error();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("/exportDetail")
|
|
|
|
+ public void exportDetail(HttpServletResponse response, HousingFundEmployeeVo vo) throws Exception {
|
|
|
|
+ OutputStream out = null;
|
|
|
|
+ BufferedOutputStream bos = null;
|
|
|
|
+ List<BizHousingFundConfirmDetailEmployee> employees = new ArrayList<>();
|
|
|
|
+ List<EmployeeExcel> employeeExcels = new ArrayList<>();
|
|
|
|
+ try {
|
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("importTemplate/公积金模板.xlsx");
|
|
|
|
+ InputStream inputStream = classPathResource.getInputStream();
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
|
+ String fileName = URLEncoder.encode("公积金明细导出.xls", "utf-8");
|
|
|
|
+ response.setHeader("Content-disposition", "attachment; filename=" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1"));
|
|
|
|
+
|
|
|
|
+ out = response.getOutputStream();
|
|
|
|
+ bos = new BufferedOutputStream(out);
|
|
|
|
+
|
|
|
|
+ //读取Excel
|
|
|
|
+ ExcelWriter excelWriter = EasyExcel.write(bos).withTemplate(inputStream).build();
|
|
|
|
+ WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
|
+
|
|
|
|
+ FillConfig fillConfig = FillConfig.builder()
|
|
|
|
+ // 开启填充换行
|
|
|
|
+ .forceNewRow(true)
|
|
|
|
+ .build();
|
|
|
|
+ // 直接写入Excel数据
|
|
|
|
+ List<EmployeeExcel> list = getList(vo, employees, employeeExcels);
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
+ String titleName = vo.getYear() + "年" + vo.getMonth() + "月" + "公积金明细";
|
|
|
|
+ AtomicReference<BigDecimal> totat1 = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
|
+ AtomicReference<BigDecimal> totat2 = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
|
+ AtomicReference<BigDecimal> totat3 = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
|
+ list.forEach(item -> {
|
|
|
|
+ totat1.updateAndGet(v -> v .add(item.getCompanyAmount()));
|
|
|
|
+ totat2.updateAndGet(v -> v .add(item.getOneSelfAmount()));
|
|
|
|
+ totat3.updateAndGet(v -> v .add(item.getTotalAmount()));
|
|
|
|
+ });
|
|
|
|
+ map.put("titleName", titleName);
|
|
|
|
+ map.put("totat1", totat1.get());
|
|
|
|
+ map.put("totat2", totat2.get());
|
|
|
|
+ map.put("totat3", totat3.get());
|
|
|
|
+ excelWriter.fill(list, fillConfig, writeSheet);
|
|
|
|
+ excelWriter.fill(map, fillConfig, writeSheet);
|
|
|
|
+ excelWriter.finish();
|
|
|
|
+ bos.flush();
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ bos.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<EmployeeExcel> getList(HousingFundEmployeeVo vo, List<BizHousingFundConfirmDetailEmployee> employees, List<EmployeeExcel> employeeExcels) {
|
|
|
|
+ BizHousingFundConfirmDetail housingFundConfirmDetail = housingFundConfirmDetailService
|
|
|
|
+ .query().eq("company_id", vo.getCompanyId())
|
|
|
|
+ .eq("year", vo.getYear())
|
|
|
|
+ .eq("month", vo.getMonth())
|
|
|
|
+ .eq("deleted", 0).one();
|
|
|
|
+ if (housingFundConfirmDetail != null) {
|
|
|
|
+ employees = housingFundConfirmDetailEmployeeService.query()
|
|
|
|
+ .eq("housing_fund_confirm_detail_id", housingFundConfirmDetail.getId())
|
|
|
|
+ .eq("deleted", 0)
|
|
|
|
+ .ne("change_status", 2)
|
|
|
|
+ .list();
|
|
|
|
+ }
|
|
|
|
+ if (!CollectionUtils.isEmpty(employees)) {
|
|
|
|
+ for (int i = 0; i < employees.size(); i++) {
|
|
|
|
+ BizHousingFundConfirmDetailEmployee employee = employees.get(i);
|
|
|
|
+ //去掉百分比
|
|
|
|
+ BigDecimal ratio = employee.getRatio().divide(BigDecimal.valueOf(100)).setScale(2);
|
|
|
|
+ EmployeeExcel employeeExcel = new EmployeeExcel();
|
|
|
|
+ employeeExcel.setIndex(i + 1);
|
|
|
|
+ employeeExcel.setEmployeeName(employee.getEmployeeName());
|
|
|
|
+ employeeExcel.setCardinalNumber(employee.getCardinalNumber());
|
|
|
|
+ employeeExcel.setRatio(ratio);
|
|
|
|
+ employeeExcel.setCompanyAmount(employee.getCardinalNumber().multiply(ratio).setScale(2));
|
|
|
|
+ employeeExcel.setOneSelfAmount(employee.getCardinalNumber().multiply(ratio).setScale(2));
|
|
|
|
+ employeeExcel.setTotalAmount(employeeExcel.getCompanyAmount().add(employeeExcel.getOneSelfAmount()));
|
|
|
|
+ employeeExcels.add(employeeExcel);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return employeeExcels;
|
|
|
|
+ }
|
|
|
|
+
|
|
@PostMapping("/saveBatch")
|
|
@PostMapping("/saveBatch")
|
|
@ApiOperation(value = "批量保存", notes = "批量保存")
|
|
@ApiOperation(value = "批量保存", notes = "批量保存")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@@ -108,7 +208,7 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public TableDataInfo getList(BizHousingFundDeclare conditions) throws NoSuchFieldException, IllegalAccessException {
|
|
public TableDataInfo getList(BizHousingFundDeclare conditions) throws NoSuchFieldException, IllegalAccessException {
|
|
- setTenantId(conditions);
|
|
|
|
|
|
+ setTenantId(conditions);
|
|
startPage();
|
|
startPage();
|
|
startOrderBy();
|
|
startOrderBy();
|
|
List<BizHousingFundDeclare> list = housingFundDeclareService.getListByBean(conditions);
|
|
List<BizHousingFundDeclare> list = housingFundDeclareService.getListByBean(conditions);
|
|
@@ -170,9 +270,9 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
String formattedMonth = String.format("%02d", nowMonth);
|
|
String formattedMonth = String.format("%02d", nowMonth);
|
|
String year = condition.getYear();
|
|
String year = condition.getYear();
|
|
String month = condition.getMonth();
|
|
String month = condition.getMonth();
|
|
- String s1= year+month;
|
|
|
|
- String s2 = nowYear+ formattedMonth;
|
|
|
|
- if(!s1.equals(s2) && housingFundDeclareDetails.isEmpty()){
|
|
|
|
|
|
+ String s1 = year + month;
|
|
|
|
+ String s2 = nowYear + formattedMonth;
|
|
|
|
+ if (!s1.equals(s2) && housingFundDeclareDetails.isEmpty()) {
|
|
return error("当前月未找到数据");
|
|
return error("当前月未找到数据");
|
|
}
|
|
}
|
|
if (housingFundDeclareDetails.isEmpty()) {
|
|
if (housingFundDeclareDetails.isEmpty()) {
|
|
@@ -204,31 +304,30 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
@PreAuthorize("@ss.hasPermi('business:housingFundDeclare:export')")
|
|
@PreAuthorize("@ss.hasPermi('business:housingFundDeclare:export')")
|
|
@Log(title = "公积金申报任务", businessType = BusinessType.EXPORT)
|
|
@Log(title = "公积金申报任务", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public void export(HttpServletResponse response, BizHousingFundDeclare conditions) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
- {
|
|
|
|
|
|
+ public void export(HttpServletResponse response, BizHousingFundDeclare conditions) throws NoSuchFieldException, IllegalAccessException {
|
|
setTenantId(conditions);
|
|
setTenantId(conditions);
|
|
startOrderBy();
|
|
startOrderBy();
|
|
List<BizHousingFundDeclare> list = housingFundDeclareService.getListByBean(conditions);
|
|
List<BizHousingFundDeclare> list = housingFundDeclareService.getListByBean(conditions);
|
|
- for (BizHousingFundDeclare l: list){
|
|
|
|
- l.setCurrentPeriod(conditions.getYear()+"-"+conditions.getMonth());
|
|
|
|
|
|
+ for (BizHousingFundDeclare l : list) {
|
|
|
|
+ l.setCurrentPeriod(conditions.getYear() + "-" + conditions.getMonth());
|
|
BizHousingFundDeclareDetail detail = new BizHousingFundDeclareDetail();
|
|
BizHousingFundDeclareDetail detail = new BizHousingFundDeclareDetail();
|
|
detail.setHousingFundDeclareId(l.getId());
|
|
detail.setHousingFundDeclareId(l.getId());
|
|
detail.setYear(conditions.getYear());
|
|
detail.setYear(conditions.getYear());
|
|
detail.setMonth(conditions.getMonth());
|
|
detail.setMonth(conditions.getMonth());
|
|
List<BizHousingFundDeclareDetail> details = housingFundDeclareDetailService.getListByBean(detail);
|
|
List<BizHousingFundDeclareDetail> details = housingFundDeclareDetailService.getListByBean(detail);
|
|
- if(details.size() == 0){
|
|
|
|
|
|
+ if (details.size() == 0) {
|
|
l.setStatusText("未开始");
|
|
l.setStatusText("未开始");
|
|
l.setMakeOut("未填写");
|
|
l.setMakeOut("未填写");
|
|
- }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();
|
|
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());
|
|
SysUser sysUser = sysUserMapper.selectUserById(records.get(0).getRecorderId());
|
|
- l.setServiceName(sysUser==null?"":sysUser.getNickName());
|
|
|
|
- }else{
|
|
|
|
|
|
+ l.setServiceName(sysUser == null ? "" : sysUser.getNickName());
|
|
|
|
+ } else {
|
|
l.setServiceName("");
|
|
l.setServiceName("");
|
|
}
|
|
}
|
|
- switch (detail.getStatus()){
|
|
|
|
|
|
+ switch (detail.getStatus()) {
|
|
case 0:
|
|
case 0:
|
|
l.setStatusText("未开始");
|
|
l.setStatusText("未开始");
|
|
l.setMakeOut("未填写");
|
|
l.setMakeOut("未填写");
|
|
@@ -315,6 +414,7 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
@ApiOperation("获取公积金人员信息")
|
|
@ApiOperation("获取公积金人员信息")
|
|
@PostMapping("/getMembersNoDelete")
|
|
@PostMapping("/getMembersNoDelete")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@@ -325,12 +425,19 @@ public class BizHousingFundDeclareController extends BaseController {
|
|
.eq("housing_fund_confirm_detail_id", housingFundConfirmDetail.getId())
|
|
.eq("housing_fund_confirm_detail_id", housingFundConfirmDetail.getId())
|
|
.ne("change_status", 2)
|
|
.ne("change_status", 2)
|
|
.list();
|
|
.list();
|
|
|
|
+
|
|
|
|
+ for (BizHousingFundConfirmDetailEmployee employee : employees) {
|
|
|
|
+ employee.setCompanyAmount(employee.getRatio().divide(BigDecimal.valueOf(100)).multiply(employee.getCardinalNumber()));
|
|
|
|
+ employee.setOneSelfAmount(employee.getRatio().divide(BigDecimal.valueOf(100)).multiply(employee.getCardinalNumber()));
|
|
|
|
+ employee.setTotalAmount(employee.getCompanyAmount().add(employee.getOneSelfAmount()));
|
|
|
|
+ }
|
|
return success(employees);
|
|
return success(employees);
|
|
} else {
|
|
} else {
|
|
return success(new ArrayList<>());
|
|
return success(new ArrayList<>());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
private Boolean checkDeduction(BizHousingFundDeclareDetail detail) {
|
|
private Boolean checkDeduction(BizHousingFundDeclareDetail detail) {
|
|
BizHousingFundDeclare main = housingFundDeclareService.getById(detail.getHousingFundDeclareId());
|
|
BizHousingFundDeclare main = housingFundDeclareService.getById(detail.getHousingFundDeclareId());
|
|
if (detail.getAmount() != null && detail.getAmount().compareTo(BigDecimal.ZERO) > 0 && detail.getStatus().equals(3)) {
|
|
if (detail.getAmount() != null && detail.getAmount().compareTo(BigDecimal.ZERO) > 0 && detail.getStatus().equals(3)) {
|