Commit ea40aebb authored by hongguangwu's avatar hongguangwu

薪资导入初次提交,待优化

parent b90a9263
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -30,6 +31,8 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* 工资报账主表(工资条)
......@@ -285,13 +288,13 @@ public class TSalaryAccount extends BaseEntity {
*/
@ExcelAttribute(name = "开户行省")
@ExcelProperty("开户行省")
private Integer bankProvince;
private String bankProvince;
/**
* 开户行市
*/
@ExcelAttribute(name = "开户行市")
@ExcelProperty("开户行市")
private Integer bankCity;
private String bankCity;
/**
* 是否个人承担部分税费:0否1是
*/
......@@ -330,4 +333,7 @@ public class TSalaryAccount extends BaseEntity {
@ExcelProperty("个税-单位承担")
private BigDecimal salaryTaxUnit;
@TableField(exist = false)
private List<TSalaryAccountItem> saiList = new ArrayList<>(); //工资组成部分明细
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 报账检测vo
*
* @author hgw
* @date 2021-9-22 16:22:36
*/
@Data
public class AccountCheckVo implements Serializable {
private static final long serialVersionUID = 1L;
// 键值
private String title;
// 应发
private BigDecimal relaySalary;
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 工资导入的返回vo
* @Author: hgw
* @Date: 2021/11/2 15:22
* @return:
**/
@Getter
@Setter
@ToString
public class SalaryUploadReturnVo implements Serializable {
/**
* 用于返回错误信息
*/
private List<ErrorMessage> errorInfo;
// 重复数据
private List<ErrorMessage> repeatInfo;
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class TPaymentBySalaryVo implements Serializable {
private String id;
/**
* 员工身份证
*/
@Length(max = 100, message = "不能超过100个字符")
@ExcelAttribute(name = "身份证号", isNotEmpty = true, maxLength = 100)
private String empIdcard;
/**
* 单位大病金额
*/
@ExcelAttribute(name = "单位大病金额")
private BigDecimal unitBitmailmentFee;
/**
* 单位社保合计
*/
@ExcelAttribute(name = "单位社保合计")
private BigDecimal unitSocialSum;
/**
* 个人社保合计
*/
@ExcelAttribute(name = "个人社保合计")
private BigDecimal personalSocialSum;
/**
* 单位公积金费用
*/
@ExcelAttribute(name = "单位公积金费用")
private BigDecimal unitFundSum;
/**
* 个人公积金费用
*/
@ExcelAttribute(name = "个人公积金费用")
private BigDecimal personalFundSum;
/**
* 工资社保结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length(max = 1, message = "工资社保结算状态 0: 未结算 1: 待结算 2: 已结算不能超过1个字符")
@ExcelAttribute(name = "工资社保结算状态", maxLength = 1, isDataId = true, dataType = "settlement_flag")
private String salarySocialFlag;
/**
* 工资公积金结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length(max = 1, message = "工资公积金结算状态 0: 未结算 1: 待结算 2: 已结算不能超过1个字符")
@ExcelAttribute(name = "工资公积金结算状态", maxLength = 1, isDataId = true, dataType = "settlement_flag")
private String salaryFundFlag;
/**
* 社保缴纳月份
*/
@Length(max = 6, message = "社保缴纳月份不能超过6个字符")
@ExcelAttribute(name = "社保缴纳月份", maxLength = 6, isInteger = true)
private String socialPayMonth;
/**
* 社保生成月份
*/
@Length(max = 6, message = "社保生成月份不能超过6个字符")
@ExcelAttribute(name = "社保生成月份", maxLength = 6, isInteger = true)
private String socialCreateMonth;
/**
* 公积金缴纳月份
*/
@Length(max = 6, message = "公积金缴纳月份不能超过6个字符")
@ExcelAttribute(name = "公积金缴纳月份", maxLength = 6, isInteger = true)
private String providentPayMonth;
/**
* 公积金生成月份
*/
@Length(max = 6, message = "公积金生成月份不能超过6个字符")
@ExcelAttribute(name = "公积金生成月份", maxLength = 6, isInteger = true)
private String providentCreateMonth;
/**
* 部门名称
*/
@Length(max = 50, message = "部门名称不能超过50个字符")
@ExcelAttribute(name = "部门名称", isNotEmpty = true, maxLength = 50, isDataId = true)
private String settleDomainId;
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import lombok.Data;
import java.util.List;
/**
* @author hgw2
* @description 预估
* @date 2022/8/10
*/
@Data
public class TPaymentVo {
List<TPaymentBySalaryVo> paymentList;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 工资报账表附加-工资明细
*
* @author hgw
* @date 2022-08-05 11:40:15
* @date 2019-07-30 15:00:05
*/
@Data
public class TSalaryAccountItemVo extends RowIndex implements Serializable {
public class TSalaryAccountItemVo extends Model<TSalaryAccountItemVo> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@Length(max = 32, message = "主键 不能超过32 个字符")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空", maxLength = 32)
@Schema(description = "主键")
@ExcelProperty("主键")
private String id;
/**
* 工资报账表ID
*/
@NotBlank(message = "工资报账表ID 不能为空")
@Length(max = 32, message = "工资报账表ID 不能超过32 个字符")
@ExcelAttribute(name = "工资报账表ID", isNotEmpty = true, errorInfo = "工资报账表ID 不能为空", maxLength = 32)
@Schema(description = "工资报账表ID")
@ExcelProperty("工资报账表ID")
private String salaryAccountId;
/**
* 表头名称
*/
@NotBlank(message = "表头名称 不能为空")
@Length(max = 50, message = "表头名称 不能超过50 个字符")
@ExcelAttribute(name = "表头名称", isNotEmpty = true, errorInfo = "表头名称 不能为空", maxLength = 50)
@Schema(description = "表头名称")
@ExcelProperty("表头名称")
@Length(max = 50, message = "表头名称不能超过50个字符")
@NotBlank(message = "表头名称不能为空")
@ExcelAttribute(name = "表头名称", isNotEmpty = true, errorInfo = "表头名称不能为空", maxLength = 50)
private String cnName;
/**
* JAVA属性名称
*/
@NotBlank(message = "JAVA属性名称 不能为空")
@Length(max = 32, message = "JAVA属性名称 不能超过32 个字符")
@ExcelAttribute(name = "JAVA属性名称", isNotEmpty = true, errorInfo = "JAVA属性名称 不能为空", maxLength = 32)
@Schema(description = "JAVA属性名称")
@ExcelProperty("JAVA属性名称")
@Length(max = 32, message = "JAVA属性名称不能超过32个字符")
@NotBlank(message = "JAVA属性名称不能为空")
@ExcelAttribute(name = "JAVA属性名称", isNotEmpty = true, errorInfo = "JAVA属性名称不能为空", maxLength = 32)
private String javaFiedName;
/**
* 属性值
*/
@ExcelAttribute(name = "属性值")
@Schema(description = "属性值")
@ExcelProperty("属性值")
private BigDecimal salaryMoney;
/**
* 是否进行计算扣税:1:计算;0:不计算
*/
@NotBlank(message = "是否进行计算扣税:1:计算;0:不计算 不能为空")
@ExcelAttribute(name = "是否进行计算扣税:1:计算;0:不计算", isNotEmpty = true, errorInfo = "是否进行计算扣税:1:计算;0:不计算 不能为空")
@Schema(description = "是否进行计算扣税:1:计算;0:不计算")
@ExcelProperty("是否进行计算扣税:1:计算;0:不计算")
private Integer isTax;
/**
* 文本值
*/
@Length(max = 500, message = "文本值 不能超过500 个字符")
@ExcelAttribute(name = "文本值", maxLength = 500)
@Schema(description = "文本值")
@ExcelProperty("文本值")
@Length(max = 100, message = "文本值不能超过100个字符")
@ExcelAttribute(name = "文本值", maxLength = 100)
private String textValue;
/**
* 是否进行计算扣税:1:计算;0:不计算
*/
@NotBlank(message = "是否进行计算扣税不能为空")
@ExcelAttribute(name = "是否进行计算扣税", isNotEmpty = true, errorInfo = "是否进行计算扣税不能为空")
private Integer isTax;
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 工资报账主表(工资条)VO
*
* @author hgw
* @date 2019-07-30 15:00:05
*/
@Data
@Schema(description = "工资详情VO")
public class TSalaryDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
private TSalaryStandard salary = new TSalaryStandard(); //工资主表
private List<TSalaryAccount> salaryAccountList = new ArrayList<>(); //工资报账
//以下-导出需要:
private Map<String, String> accountTitle = new HashMap<>(); //报账表浮动表头Map
private List<String> titleSortList = new ArrayList<>(); //报账表浮动表头排序List
//非扣税项附件
/**
* 薪资类审核记录 fxj 2021-11-15
*/
private List<TApprovalRecord> auditLogList = new ArrayList<>();
}
package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.service.SalaryUploadService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 标准薪酬上传
*
* @author hgw
* @date 2019-9-4 11:59:33
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/salary")
@Tag(name = "标准薪酬上传")
public class SalaryUploadController {
private final SalaryUploadService salaryUploadService;
/**
* @param jsonString Excel表-JsonString
* @param settleDepart 结算主体id
* @param configId 配置方案id
* @param salaryType 报表类型id
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description:
* @Author: hgw
* @Date: 2019/9/11 15:21
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation(description = "上传:jsonString:表格json;settleDepart:结算主体id;configId:工资配置结算月等信息的id;salaryType:工资类型")
@SysLog("上传薪资表")
@PostMapping("/upload")
public R upload(@RequestBody String jsonString, @RequestParam String settleDepart, @RequestParam String configId
, @RequestParam String salaryType, @RequestParam int repeatFlag) {
return salaryUploadService.salaryUpload(jsonString, settleDepart, configId, salaryType, repeatFlag);
}
/**
* @param savList 工资表volist
* @Description: 保存并提交报账表
* @Author: hgw
* @Date: 2019/9/18 18:17
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation(description = "保存并提交")
@SysLog("保存并提交薪资表")
@PostMapping("/saveAndSubmit")
public R saveAndSubmit(@RequestBody List<TSalaryAccountVo> savList) {
return salaryUploadService.saveAndSubmit(savList);
}
}
......@@ -132,21 +132,6 @@ public class TSalaryAccountController {
return R.ok(tSalaryAccountService.removeById(id));
}
/**
* 工资报账主表(工资条) 批量导入
*
* @author hgw
* @date 2022-08-05 11:40:14
**/
@SneakyThrows
@Operation(description = "批量新增工资报账主表(工资条) hasPermission('salary_tsalaryaccount-batch-import')")
@SysLog("批量新增工资报账主表(工资条)")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('salary_tsalaryaccount-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return tSalaryAccountService.importDiy(file.getInputStream());
}
/**
* 工资报账主表(工资条) 批量导出
*
......
......@@ -13,6 +13,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.List;
/**
* 工资报账表附加-工资明细
*
......@@ -21,13 +24,6 @@ import java.util.Set;
*/
@Mapper
public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem> {
/**
* 工资报账表附加-工资明细简单分页查询
*
* @param tSalaryAccountItem 工资报账表附加-工资明细
* @return
*/
IPage<TSalaryAccountItem> getTSalaryAccountItemPage(Page page, @Param("tSalaryAccountItem") TSalaryAccountItem tSalaryAccountItem);
List<TSalaryAccountItem> getTSalaryAccountItemPage(@Param("tSalaryAccountItem") TSalaryAccountItem tSalaryAccountItem);
/**
......@@ -158,4 +154,11 @@ public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem>
**/
Set<String> getItemSet(@Param("salaryId") String salaryId);
/**
* 工资报账表附加-工资明细简单分页查询
* @param tSalaryAccountItem 工资报账表附加-工资明细
* @return
*/
IPage<TSalaryAccountItem> getTSalaryAccountItemPage(Page<TSalaryAccountItem> page, @Param("tSalaryAccountItem") TSalaryAccountItem tSalaryAccountItem);
}
......@@ -19,10 +19,14 @@ package com.yifu.cloud.plus.v1.yifu.salary.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工资报账主表(工资条)
*
......@@ -37,4 +41,28 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @return
*/
IPage<TSalaryAccount> getTSalaryAccountPage(Page<TSalaryAccount> page, @Param("tSalaryAccount") TSalaryAccount tSalaryAccount);
/**
* @param settleId
* @param settleMonth
* @Description: 版本2.6.6判重:对同一“结算主体”、同一“结算月份”、同一“报表类型”、同一“工资月份”、同一“身份证号”、同一“应发金额”进行校验
*
* 校验导入数据重复的Map格式:# 身份证号_工资月份_报表类型_应发金额
*
* @Author: hgw
* @Date: 2021/9/17 18:06
* @return: java.util.List<java.lang.String>
**/
List<AccountCheckVo> getAccountCheckList(@Param("settleId") String settleId, @Param("settleMonth") String settleMonth);
/**
* @param empIdCard
* @param nowYear
* @Description: 获取当前年最小计税月
* @Author: hgw
* @Date: 2022/1/19 17:56
* @return: java.lang.String
**/
String getMinTaxMonthByNowYear(@Param("empIdCard") String empIdCard, @Param("nowYear") int nowYear);
}
package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo;
import java.util.List;
/**
* 标准薪酬上传
*
* @author hgw
* @date 2019-9-4 15:54:12
*/
public interface SalaryUploadService extends IService<TSalaryStandard> {
/**
* @param jsonString
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description: 普通工资上传
* @Author: hgw
* @Date: 2019/9/4 15:58
* @return: com.yifu.cloud.v1.common.core.util.R
**/
R salaryUpload(String jsonString, String settleDepart, String configId, String formType, int repeatFlag);
/**
* @param savList
* @Description: 保存并提交报账表
* @Author: hgw
* @Date: 2019/9/18 18:42
* @return: com.yifu.cloud.v1.common.core.util.R
**/
R<String> saveAndSubmit(List<TSalaryAccountVo> savList);
}
......@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
......@@ -18,17 +21,6 @@ import java.util.Set;
* @date 2019-07-30 15:00:05
*/
public interface TSalaryAccountItemService extends IService<TSalaryAccountItem> {
/**
* 工资报账表附加-工资明细简单分页查询
*
* @param tSalaryAccountItem 工资报账表附加-工资明细
* @return
*/
IPage<TSalaryAccountItem> getTSalaryAccountItemPage(Page<TSalaryAccountItem> page, TSalaryAccountItem tSalaryAccountItem);
List<TSalaryAccountItem> getTSalaryAccountItemNoPage(TSalaryAccountItem tSalaryAccountItem);
/**
* @param settleDepartId
* @param settleMonth
......@@ -42,6 +34,27 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
List<TSalaryAccountItem> getAllTSalaryAccountItem(String settleDepartId, String settleMonth, String javaFiedName,
String finallyYear, String empIdcard, String accountId);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有报账,组装map,工资导入使用
* @Author: hgw
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
Map<String, List<TSalaryAccountItem>> getAllItemVoList(List<String> idCardList, String invoiceTitle);
/**
* 工资报账表附加-工资明细简单分页查询
*
* @param tSalaryAccountItem 工资报账表附加-工资明细
* @return
*/
IPage<TSalaryAccountItem> getTSalaryAccountItemPage(Page<TSalaryAccountItem> page, TSalaryAccountItem tSalaryAccountItem);
List<TSalaryAccountItem> getTSalaryAccountItemNoPage(TSalaryAccountItem tSalaryAccountItem);
/**
* @param idCard
* @param maxYearMonth
......@@ -53,15 +66,6 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
**/
List<TSalaryAccountItem> getEmpAllSalaryAccountItem(String idCard, String maxYearMonth, String invoiceTitle);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有报账,组装map,工资导入使用
* @Author: hgw
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
Map<String, List<TSalaryAccountItem>> getAllItemVoList(List<String> idCardList, String invoiceTitle);
/**
* @param settleDepartId 结算主体id
......
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
/**
* 工资报账主表(工资条)
......@@ -42,9 +43,29 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
*/
IPage<TSalaryAccount> getTSalaryAccountPage(Page<TSalaryAccount> page, TSalaryAccountSearchVo tSalaryAccount);
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, TSalaryAccountSearchVo searchVo);
List<TSalaryAccount> noPageDiy(TSalaryAccountSearchVo searchVo);
/**
* @param settleId
* @param settleMonth
* @Description: 版本2.6.6判重:对同一“结算主体”、同一“结算月份”、同一“报表类型”、同一“工资月份”、同一“身份证号”、同一“应发金额”进行校验
* 校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
* @Author: hgw
* @Date: 2021/9/17 18:06
* @return: java.util.Map<java.lang.String, java.lang.Integer>
**/
Map<String, Integer> getAccountCheckMap(String settleId, String settleMonth);
/**
* @param empIdCard
* @param nowYear
* @Description: 获取当前年最小计税月
* @Author: hgw
* @Date: 2022/1/19 17:57
* @return: java.lang.String
**/
String getMinTaxMonthByNowYear(String empIdCard, int nowYear);
}
......@@ -11,6 +11,11 @@ import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountItemMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountItemService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
......
......@@ -36,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo;
import lombok.extern.log4j.Log4j2;
......@@ -45,9 +46,12 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 工资报账主表(工资条)
......@@ -171,83 +175,27 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TSalaryAccountVo> util1 = new ExcelUtil<>(TSalaryAccountVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TSalaryAccountVo.class, new ReadListener<TSalaryAccountVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<TSalaryAccountVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TSalaryAccountVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTSalaryAccount(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
public Map<String, Integer> getAccountCheckMap(String settleId, String settleMonth) {
List<AccountCheckVo> list = baseMapper.getAccountCheckList(settleId, settleMonth);
Map<String, Integer> map = new HashMap<>();
if (list != null && !list.isEmpty()) {
for (AccountCheckVo str : list) {
map.put(str.getTitle() + CommonConstants.DOWN_LINE_STRING + str.getRelaySalary().setScale(2, BigDecimal.ROUND_HALF_UP), 1);
}
private void importTSalaryAccount(List<TSalaryAccountVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
TSalaryAccountVo excel = excelVOList.get(i);
// 数据合法情况 TODO
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
return map;
}
/**
* 插入excel bad record
*/
private void insertExcel(TSalaryAccountVo excel) {
TSalaryAccount insert = new TSalaryAccount();
BeanUtil.copyProperties(excel, insert);
this.save(insert);
* @param empIdCard
* @param nowYear
* @Description: 获取当前年最小计税月
* @Author: hgw
* @Date: 2022/1/19 17:57
* @return: java.lang.String
**/
@Override
public String getMinTaxMonthByNowYear(String empIdCard, int nowYear) {
return baseMapper.getMinTaxMonthByNowYear(empIdCard, nowYear);
}
}
......@@ -357,7 +357,67 @@
</where>
order by a.SETTLEMENT_MONTH,a.id desc
</select>
<select id="getSumByAccountId" resultType="java.util.Map">
<resultMap id="tSalaryAccountItemMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem">
<id property="id" column="ID"/>
<result property="salaryAccountId" column="SALARY_ACCOUNT_ID"/>
<result property="cnName" column="CN_NAME"/>
<result property="javaFiedName" column="JAVA_FIED_NAME"/>
<result property="salaryMoney" column="SALARY_MONEY"/>
<result property="isTax" column="IS_TAX"/>
<result property="textValue" column="TEXT_VALUE"/>
</resultMap>
<!-- 工资导入优化使用的vo -->
<resultMap id="itemVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem">
<id property="id" column="ID"/>
<result property="salaryAccountId" column="SALARY_ACCOUNT_ID"/>
<result property="cnName" column="CN_NAME"/>
<result property="javaFiedName" column="JAVA_FIED_NAME"/>
<result property="salaryMoney" column="SALARY_MONEY"/>
<result property="textValue" column="TEXT_VALUE"/>
<result property="isTax" column="IS_TAX"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="settlementMonth" column="SETTLEMENT_MONTH"/>
<result property="salaryType" column="SALARY_TYPE"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.SALARY_ACCOUNT_ID,
a.CN_NAME,
a.JAVA_FIED_NAME,
a.SALARY_MONEY,
a.IS_TAX,
a.TEXT_VALUE
</sql>
<sql id="tSalaryAccountItem_where">
<if test="tSalaryAccountItem != null">
<if test="tSalaryAccountItem.id != null and tSalaryAccountItem.id.trim() != ''">
AND a.ID = #{tSalaryAccountItem.id}
</if>
<if test="tSalaryAccountItem.salaryAccountId != null and tSalaryAccountItem.salaryAccountId.trim() != ''">
AND a.SALARY_ACCOUNT_ID = #{tSalaryAccountItem.salaryAccountId}
</if>
<if test="tSalaryAccountItem.cnName != null and tSalaryAccountItem.cnName.trim() != ''">
AND a.CN_NAME = #{tSalaryAccountItem.cnName}
</if>
<if test="tSalaryAccountItem.javaFiedName != null and tSalaryAccountItem.javaFiedName.trim() != ''">
AND a.JAVA_FIED_NAME = #{tSalaryAccountItem.javaFiedName}
</if>
<if test="tSalaryAccountItem.salaryMoney != null">
AND a.SALARY_MONEY = #{tSalaryAccountItem.salaryMoney}
</if>
<if test="tSalaryAccountItem.isTax != null">
AND a.IS_TAX = #{tSalaryAccountItem.isTax}
</if>
<if test="tSalaryAccountItem.textValue != null and tSalaryAccountItem.textValue.trim() != ''">
AND a.TEXT_VALUE = #{tSalaryAccountItem.textValue}
</if>
</if>
</sql>
<!--tSalaryAccountItem简单分页查询-->
<select id="getTSalaryAccountItemPage" resultMap="tSalaryAccountItemMap">
SELECT
a.SALARY_ACCOUNT_ID as 'key',
a.SALARY_MONEY as 'value'
......@@ -415,4 +475,82 @@
</where>
</select>
<select id="getAllTSalaryAccountItem" resultMap="tSalaryAccountItemMap">
SELECT
i.ID,
i.SALARY_ACCOUNT_ID,
i.CN_NAME,
i.JAVA_FIED_NAME,
i.SALARY_MONEY,
i.TEXT_VALUE,
i.IS_TAX
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
a.DELETE_FLAG = 0
<if test="settleDepartId != null and settleDepartId.trim() != ''">
AND a.SETTLE_DEPART_ID = #{settleDepartId}
</if>
<if test="settleMonth != null and settleMonth.trim() != ''">
AND a.SETTLEMENT_MONTH = #{settleMonth}
</if>
<if test="javaFiedName != null and javaFiedName.trim() != ''">
AND i.JAVA_FIED_NAME = #{javaFiedName}
</if>
<if test="finallyYear != null and finallyYear.trim() != ''">
AND a.SETTLEMENT_MONTH like concat(#{finallyYear}, '%')
</if>
<if test="empIdcard != null and empIdcard.trim() != ''">
AND a.EMP_IDCARD = #{empIdcard}
</if>
<if test="accountId != null and accountId.trim() != ''">
AND a.id != #{accountId}
</if>
</where>
</select>
<!-- 获取所有数据,组装map,工资导入使用 -->
<select id="getAllItemVoList" resultMap="itemVoMap">
SELECT
i.ID,
i.SALARY_ACCOUNT_ID,
i.CN_NAME,
i.JAVA_FIED_NAME,
i.SALARY_MONEY,
i.TEXT_VALUE,
i.IS_TAX,
a.EMP_IDCARD,
a.SETTLEMENT_MONTH,
a.SALARY_TYPE
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
a.SETTLEMENT_MONTH like DATE_FORMAT(now(),"%Y%")
<if test="idCardList != null">
AND a.EMP_IDCARD in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="invoiceTitle != null and invoiceTitle.trim() != ''">
AND a.INVOICE_TITLE = #{invoiceTitle}
</if>
AND a.DELETE_FLAG = 0 and a.SALARY_TYPE != 7
</where>
</select>
<select id="getSumByAccountId" resultType="java.util.Map">
SELECT
a.SALARY_ACCOUNT_ID as 'key',
a.SALARY_MONEY as 'value'
FROM
t_salary_account_item a
WHERE
a.SALARY_ACCOUNT_ID IN
<foreach item="item" index="index" collection="account" open="(" separator="," close=")">
#{item.id}
</foreach>
and
a.JAVA_FIED_NAME='actualSalarySum'
</select>
</mapper>
......@@ -246,4 +246,23 @@
<include refid="tSalaryAccount_where"/>
</where>
</select>
<!-- 获取校验的报账明细 ### 格式:身份证号_工资月份_报表类型_应发金额 -->
<select id="getAccountCheckList" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo">
select
CONCAT(a.EMP_IDCARD,"_",a.SALARY_DATE,"_",a.FORM_TYPE) title,ifnull(ifnull(relaySalary.SALARY_MONEY,actSalary.SALARY_MONEY),0) relaySalary
from t_salary_account a
left join t_salary_account_item relaySalary on relaySalary.SALARY_ACCOUNT_ID = a.id and relaySalary.JAVA_FIED_NAME='relaySalary'
left join t_salary_account_item actSalary on actSalary.SALARY_ACCOUNT_ID = a.id and actSalary.JAVA_FIED_NAME='actualSalarySum'
where a.DELETE_FLAG = 0 and a.SETTLE_DEPART_ID = #{settleId} and a.SETTLEMENT_MONTH = #{settleMonth}
</select>
<!-- 获取当前年最小计税月 -->
<select id="getMinTaxMonthByNowYear" resultType="java.lang.String">
select
min(a.TAX_MONTH - 0)
from t_salary_account a
where a.EMP_IDCARD = #{empIdCard} and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
and a.FORM_TYPE != '3'
</select>
</mapper>
......@@ -225,8 +225,8 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
sysBaseSetInfo.setIsNew(CommonConstants.ONE_STRING);
baseMapper.insert(sysBaseSetInfo);
// TODO-测试用(同步社保公积金查询、预估库),后面可删除
tForecastLibraryService.updateForecastLibaryBySysBase(sysBaseSetInfo);
// 测试用(同步社保公积金查询、预估库),后面可删除
//tForecastLibraryService.updateForecastLibaryBySysBase(sysBaseSetInfo)
}
List<SysPayProportion> payProportionList = sysBaseSetInfo.getFundProList();
if (Common.isNotNull(payProportionList)) {
......
......@@ -1423,7 +1423,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (newSysBaseSetInfo == null) {
sysBaseSetInfoList = sysBaseSetInfoMapper.selectList(
Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getIsNew, CommonConstants.ONE_INT));
.eq(SysBaseSetInfo::getIsNew, CommonConstants.ONE_STRING));
} else {
sysBaseSetInfoList.add(newSysBaseSetInfo);
}
......@@ -1463,6 +1463,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
socialFundInfoMap.put(socialFundInfo.getId(), socialFundInfo);
}
}
sysBaseSetInfo.setIsNew(CommonConstants.ZERO_STRING);
sysBaseSetInfoMapper.updateById(sysBaseSetInfo);
}
for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) {
this.updateForecastLibaryCore(socialFundInfo, socialFundInfo.getDoMonth(), true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment