|
@@ -51,6 +51,7 @@ import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -167,13 +168,21 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
@ResponseBody
|
|
|
@PreAuthorize("@ss.hasPermi('business:housingFundConfirm:list')")
|
|
|
public TableDataInfo getList(BizHousingFundConfirm conditions) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ String chooseYear = conditions.getYear();
|
|
|
+ int nwoYear = LocalDate.now().getYear();
|
|
|
setTenantId(conditions);
|
|
|
startPage();
|
|
|
startOrderBy();
|
|
|
+ conditions.setYear(String.valueOf(nwoYear));
|
|
|
List<BizHousingFundConfirm> list = housingFundConfirmService.getListByBean(conditions);
|
|
|
if (!list.isEmpty()) {
|
|
|
Map<String, Object> detailConditions = new HashMap<>();
|
|
|
- detailConditions.put("year", conditions.getYear());
|
|
|
+ if (!chooseYear.equals(nwoYear)) {
|
|
|
+ detailConditions.put("year", chooseYear);
|
|
|
+ } else {
|
|
|
+ detailConditions.put("year", conditions.getYear());
|
|
|
+ }
|
|
|
+
|
|
|
detailConditions.put("mainIds", list.stream().map(BizHousingFundConfirm::getId).collect(Collectors.toList()));
|
|
|
List<BizHousingFundConfirmDetail> details = housingFundConfirmDetailService.getList2(detailConditions);
|
|
|
list.forEach(l -> {
|
|
@@ -226,11 +235,11 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
// 获取上个月的人员信息
|
|
|
List<BizHousingFundConfirmDetailEmployee> employees = detail.getDetails();
|
|
|
BizHousingFundConfirmDetail old = housingFundConfirmDetailService.query().eq("housing_fund_confirm_id", detail.getHousingFundConfirmId()).lt("concat(year,month)", detail.getYear() + detail.getMonth()).orderByDesc("concat(year, month)").last("limit 1").one();
|
|
|
- if(old != null) {
|
|
|
+ if (old != null) {
|
|
|
List<BizHousingFundConfirmDetailEmployee> oldEmployees = housingFundConfirmDetailEmployeeService.query().eq("housing_fund_confirm_detail_id", old.getId()).ne("change_status", 2).list();
|
|
|
employees.forEach(l -> {
|
|
|
// 判断是新增还是不变
|
|
|
- if(oldEmployees.stream().anyMatch(v -> v.getPhone().equals(l.getPhone()) && v.getEmployeeName().equals(l.getEmployeeName()))) {
|
|
|
+ if (oldEmployees.stream().anyMatch(v -> v.getPhone().equals(l.getPhone()) && v.getEmployeeName().equals(l.getEmployeeName()))) {
|
|
|
l.setChangeStatus(0);
|
|
|
}
|
|
|
if (oldEmployees.stream().noneMatch(v -> v.getPhone().equals(l.getPhone()) && v.getEmployeeName().equals(l.getEmployeeName()))) {
|
|
@@ -252,6 +261,7 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
}
|
|
|
return toAjax(housingFundConfirmDetailService.updateById(detail) && addRecord(detail.getHousingFundConfirmId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), "修改公积金人员信息"));
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation("获取之前的员工信息")
|
|
|
@PostMapping("/getPrevEmployee")
|
|
|
@ResponseBody
|
|
@@ -394,8 +404,7 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
@Log(title = "公积金导入", businessType = BusinessType.IMPORT)
|
|
|
@PreAuthorize("@ss.hasPermi('business:housingFundConfirm:import')")
|
|
|
@PostMapping("/importData")
|
|
|
- public AjaxResult importData(MultipartFile file, @RequestParam String year, @RequestParam String month) throws Exception
|
|
|
- {
|
|
|
+ public AjaxResult importData(MultipartFile file, @RequestParam String year, @RequestParam String month) throws Exception {
|
|
|
ExcelUtil<BizHousingFundConfirmDetailEmployee> util = new ExcelUtil<>(BizHousingFundConfirmDetailEmployee.class);
|
|
|
List<BizHousingFundConfirmDetailEmployee> detailList = util.importExcel(file.getInputStream());
|
|
|
|
|
@@ -403,17 +412,17 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
List<String> excelHeaders = util.readExcelHeaders(file.getInputStream());
|
|
|
|
|
|
//获取实体类字段
|
|
|
- List<String> names=getExcelAnnotatedFields(BizHousingFundConfirmDetailEmployee.class);
|
|
|
+ List<String> names = getExcelAnnotatedFields(BizHousingFundConfirmDetailEmployee.class);
|
|
|
//如果不存在模板中的字段,返回错误
|
|
|
if (!excelHeaders.containsAll(names)) {
|
|
|
return error("导入数据与模板不匹配!");
|
|
|
}
|
|
|
- String message=housingFundConfirmService.importHousingFundCon(detailList,year,month,getTenantId()==null?0:getTenantId());
|
|
|
+ String message = housingFundConfirmService.importHousingFundCon(detailList, year, month, getTenantId() == null ? 0 : getTenantId());
|
|
|
return success(message);
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<String> getExcelAnnotatedFields(Class<?> clazz) {
|
|
|
+ public List<String> getExcelAnnotatedFields(Class<?> clazz) {
|
|
|
Field[] fields = clazz.getDeclaredFields();
|
|
|
List<String> result = new ArrayList<>();
|
|
|
for (Field field : fields) {
|
|
@@ -433,26 +442,25 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('business:housingFundConfirm:export')")
|
|
|
@Log(title = "个税详情", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, BizHousingFundConfirm housingFundConfirm) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public void export(HttpServletResponse response, BizHousingFundConfirm housingFundConfirm) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(housingFundConfirm);
|
|
|
startOrderBy();
|
|
|
List<BizHousingFundConfirm> list = housingFundConfirmService.getListByBean(housingFundConfirm);
|
|
|
- for (BizHousingFundConfirm l: list){
|
|
|
- l.setCurrentPeriod(housingFundConfirm.getYear()+"-"+housingFundConfirm.getMonth());
|
|
|
+ for (BizHousingFundConfirm l : list) {
|
|
|
+ l.setCurrentPeriod(housingFundConfirm.getYear() + "-" + housingFundConfirm.getMonth());
|
|
|
BizHousingFundConfirmDetail detail = new BizHousingFundConfirmDetail();
|
|
|
detail.setHousingFundConfirmId(l.getId());
|
|
|
detail.setYear(housingFundConfirm.getYear());
|
|
|
detail.setMonth(housingFundConfirm.getMonth());
|
|
|
List<BizHousingFundConfirmDetail> details = housingFundConfirmDetailService.getListByBean(detail);
|
|
|
- if(details.size() == 0){
|
|
|
+ if (details.size() == 0) {
|
|
|
l.setStatusText("未开始");
|
|
|
l.setServiceName("");
|
|
|
- }else{
|
|
|
- detail=details.get(0);
|
|
|
+ } else {
|
|
|
+ detail = details.get(0);
|
|
|
SysUser sysUser = sysUserMapper.selectUserById(detail.getVerifierId());
|
|
|
- l.setServiceName(sysUser==null?"":sysUser.getNickName());
|
|
|
- switch (detail.getStatus()){
|
|
|
+ l.setServiceName(sysUser == null ? "" : sysUser.getNickName());
|
|
|
+ switch (detail.getStatus()) {
|
|
|
case 0:
|
|
|
l.setStatusText("未开始");
|
|
|
break;
|
|
@@ -579,13 +587,13 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
housingFundConfirm.setDetails(financialSalaryDetailEmployeeList);
|
|
|
company = companyService.getById(housingFundConfirm.getCompanyId());
|
|
|
housingFundConfirm.setCompanyName(company.getName());
|
|
|
- housingFundConfirm.setTime(housingFundConfirm.getYear()+"年"+" "+"第"+housingFundConfirm.getMonth()+"期");
|
|
|
+ housingFundConfirm.setTime(housingFundConfirm.getYear() + "年" + " " + "第" + housingFundConfirm.getMonth() + "期");
|
|
|
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
- paramMap.put("housingFundConfirm" , housingFundConfirm);
|
|
|
+ paramMap.put("housingFundConfirm", housingFundConfirm);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
Writer out = new StringWriter();
|
|
|
//获取模板地址
|
|
@@ -596,7 +604,7 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
|
String templateContent = out.toString();
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
response.setContentType("application/pdf");
|
|
|
- String fileName ="公积金人员信息表";
|
|
|
+ String fileName = "公积金人员信息表";
|
|
|
response.setHeader("Content-Disposition", "filename=" + new String(fileName.getBytes()));
|
|
|
byte[] resources = PdfUtil.html2Pdf(templateContent);
|
|
|
ServletOutputStream outputStream = response.getOutputStream();
|