Merge branch 'release/个税版本' into feature/在线算税

This commit is contained in:
钱涛 2024-06-21 13:59:00 +08:00
commit 3a17e8c833
67 changed files with 1071 additions and 244 deletions

View File

@ -1,5 +1,5 @@
log=false
defaultCloseNonStandard149=true
AESEncryptScrect=990EB004A1C862721C1513AE90038C9E
version=2.14.3.2406.01
version=2.14.4.2406.02
openFormulaForcedEditing=false

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_item add default_value varchar(255);
alter table hrsa_salary_sob_item add default_value varchar(255);
alter table hrsa_salary_sob_back_item add default_value varchar(255);

View File

@ -0,0 +1,6 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_item add default_value VARCHAR(255);
alter table hrsa_salary_sob_item add default_value VARCHAR(255);
alter table hrsa_salary_sob_back_item add default_value VARCHAR(255);

View File

@ -0,0 +1,6 @@
alter table hrsa_salary_item add default_value varchar(255)
go
alter table hrsa_salary_sob_item add default_value varchar(255)
go
alter table hrsa_salary_sob_back_item add default_value varchar(255)
go

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -18,4 +18,4 @@ left join hrmresource e on e.id= result.employee_id
left join hrsa_tax_agent t on a.tax_agent_id=t.id
where a.delete_type=0 and i.delete_type=0 and t.delete_type=0 and c.delete_type=0
and a.employee_id=人员id and t.name=扣缴义务人名称
and effective_time <= now() and c.name='基本工资' order by effective_time desc
c.name='基本工资' order by effective_time desc

View File

@ -980,7 +980,31 @@
"infinite": true
}
]
}
},
{
"name": "DAYSINMONTH",
"chineseName": "返回指定月的天数",
"description": "返回指定月的天数。",
"example": "DAYSINMONTH('2024-01-01')",
"result": "31",
"paramDescs": [
"*日期*(必选)"
],
"formatString": "DAYSINMONTH(日期)",
"paramArray": [],
"paramData": [],
"returnType": "number",
"type": "function",
"validForm": "days_in_month",
"paramCount": -1,
"paramStatuses": [
{
"dataType": "date",
"must": true,
"infinite": true
}
]
},
],
"dataType": "date",
"name": "日期函数",

View File

@ -261,7 +261,7 @@ public class SalaryBillBO {
}
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
log.error("消息发送失败",e);
}
}

View File

@ -0,0 +1,32 @@
package com.engine.salary.entity.salaryBill.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 工资单预览参数
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryPreviewParam {
/**
* 工资单id
*/
private Long salaryInfoId;
/**
* 员工id
*/
private Long recipient;
}

View File

@ -40,8 +40,6 @@ public class SalaryItemBO {
private static final BaseBean baseBean = new BaseBean();
//强制开启账套的公式配置
private static final Boolean openFormulaForcedEditing = "true".equals(baseBean.getPropValue("hrmSalary", "openFormulaForcedEditing"));
@ -86,6 +84,10 @@ public class SalaryItemBO {
if (CollectionUtils.isEmpty(salaryItems)) {
return Collections.emptyList();
}
//强制开启账套的公式配置
boolean openFormulaForcedEditing = "true".equals(baseBean.getPropValue("hrmSalary", "openFormulaForcedEditing"));
Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
Map<Long, String> sysSalaryItemNameMap = SalaryEntityUtil.convert2Map(sysSalaryItemPOS, SysSalaryItemPO::getId, SysSalaryItemPO::getName);
return salaryItems.stream().map(salaryItemPO -> {
@ -134,6 +136,9 @@ public class SalaryItemBO {
if (CollectionUtils.isEmpty(salaryItems)) {
return Collections.emptyList();
}
//强制开启账套的公式配置
boolean openFormulaForcedEditing = "true".equals(baseBean.getPropValue("hrmSalary", "openFormulaForcedEditing"));
Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
Map<Long, String> sysSalaryItemNameMap = SalaryEntityUtil.convert2Map(sysSalaryItemPOS, SysSalaryItemPO::getId, SysSalaryItemPO::getName);
return salaryItems.stream().map(salaryItemPO -> {
@ -171,6 +176,7 @@ public class SalaryItemBO {
.sortedIndex(salaryItemPO.getSortedIndex())
.description(salaryItemPO.getDescription())
.salaryItemType(salaryItemPO.getUseInEmployeeSalary() == 0 ? "薪资项目" : "档案字段")
.defaultValue(salaryItemPO.getDefaultValue())
.build();
}
).collect(Collectors.toList());
@ -202,7 +208,8 @@ public class SalaryItemBO {
.setTaxAgentIds(salaryItemPO.getTaxAgentIds())
.setSharedType(salaryItemPO.getSharedType())
.setSortedIndex(salaryItemPO.getSortedIndex())
.setWidth(salaryItemPO.getWidth());
.setWidth(salaryItemPO.getWidth())
.setDefaultValue(salaryItemPO.getDefaultValue());
}
/**
@ -283,6 +290,7 @@ public class SalaryItemBO {
.taxAgentIds(saveParam.getTaxAgentIds())
.sortedIndex(saveParam.getSortedIndex())
.width(saveParam.getWidth())
.defaultValue(saveParam.getDefaultValue())
.build();
// 开启了"薪资档案引用"取值方式固定为输入
// if (Objects.equals(saveParam.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {

View File

@ -98,4 +98,7 @@ public class SalaryItemFormDTO {
// 宽度
private Integer width;
// 默认值
private String defaultValue;
}

View File

@ -113,6 +113,9 @@ public class SalaryItemSobListDTO {
//排序
private Integer sortedIndex;
// 默认值
private String defaultValue;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;

View File

@ -63,7 +63,7 @@ public class SalaryItemSaveParam {
private Integer roundingMode;
//保留小数位
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 8, message = "小数位最多为8")
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 10, message = "小数位最多为10")
private Integer pattern;
/**
@ -107,4 +107,9 @@ public class SalaryItemSaveParam {
* 宽度
*/
private Integer width;
/**
* 默认值
*/
private String defaultValue;
}

View File

@ -191,4 +191,10 @@ public class SalaryItemPO {
*/
@ElogTransform(name = "宽度")
private Integer width;
/**
* 默认值
*/
@ElogTransform(name = "默认值")
private String defaultValue;
}

View File

@ -144,6 +144,7 @@ public class SalarySobItemAggregateBO {
.canEdit(openFormulaForcedEditing || Objects.equals(salaryItemPO.getCanEdit(), 1))
.canDelete(openFormulaForcedEditing || salaryItemPO.getCanDelete() == null || Objects.equals(salaryItemPO.getCanDelete(), 1))
.width(salaryItemPO.getWidth())
.defaultValue(salaryItemPO.getDefaultValue())
.build());
}
}

View File

@ -112,4 +112,7 @@ public class SalarySobItemDTO {
// 显示宽度
private Integer width;
// 默认值
private String defaultValue;
}

View File

@ -53,7 +53,7 @@ public class SalarySobItemFormDTO {
private Integer roundingMode;
//保留小数位")
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 8, message = "小数位最多为8")
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 10, message = "小数位最多为10")
private Integer pattern;
//取值方式")
@ -83,4 +83,7 @@ public class SalarySobItemFormDTO {
// 薪资档案引用0薪资档案未引用1薪资档案引用
private Integer useInEmployeeSalary;
// 默认值
private String defaultValue;
}

View File

@ -79,6 +79,9 @@ public class SalarySobItemSaveParam {
private Boolean canDelete;
// 默认值
private String defaultValue;
/**
* 进位规则
*/

View File

@ -114,6 +114,11 @@ public class SalarySobBackItemPO{
@JsonIgnore
private Date updateTime;
/**
* 默认值
*/
private String defaultValue;
/**
@ -132,6 +137,7 @@ public class SalarySobBackItemPO{
", valueType=" + valueType +
", formulaId=" + formulaId +
", backCalcType=" + backCalcType +
", defaultValue=" + defaultValue +
'}';
}

View File

@ -131,6 +131,11 @@ public class SalarySobItemPO {
//该分类是否隐藏0不隐藏1隐藏
private Long itemHide;
/**
* 默认值
*/
private String defaultValue;
//in
Collection<Long> ids;
Collection<Long> salarySobIds;
@ -153,6 +158,7 @@ public class SalarySobItemPO {
", pattern=" + pattern +
", valueType=" + valueType +
", itemHide=" + itemHide +
", defaultValue=" + defaultValue +
'}';
}

View File

@ -985,7 +985,31 @@ public class FormluaConstant {
" \"infinite\": true\n" +
" }\n" +
" ]\n" +
" }\n" +
" },\n" +
" {\n" +
" \"name\": \"DAYSINMONTH\",\n" +
" \"chineseName\": \"返回指定月的天数\",\n" +
" \"description\": \"返回指定月的天数。\",\n" +
" \"example\": \"DAYSINMONTH('2024-01-01')\",\n" +
" \"result\": \"31\",\n" +
" \"paramDescs\": [\n" +
" \"*日期*(必选)\"\n" +
" ],\n" +
" \"formatString\": \"DAYSINMONTH(日期)\",\n" +
" \"paramArray\": [],\n" +
" \"paramData\": [],\n" +
" \"returnType\": \"number\",\n" +
" \"type\": \"function\",\n" +
" \"validForm\": \"days_in_month\",\n" +
" \"paramCount\": -1,\n" +
" \"paramStatuses\": [\n" +
" {\n" +
" \"dataType\": \"date\",\n" +
" \"must\": true,\n" +
" \"infinite\": true\n" +
" }\n" +
" ]\n" +
" },\n" +
" ],\n" +
" \"dataType\": \"date\",\n" +
" \"name\": \"日期函数\",\n" +

View File

@ -189,6 +189,7 @@ public class QlExpress {
runner.addFunctionOfServiceMethod("CURRSECOND", dateTimeService, "currSecond", new Class[]{Object[].class}, "");
runner.addFunctionOfServiceMethod("MAXDATE", dateTimeService, "maxDate", new Class[]{Object[].class}, "");
runner.addFunctionOfServiceMethod("MINDATE", dateTimeService, "minDate", new Class[]{Object[].class}, "");
runner.addFunctionOfServiceMethod("DAYSINMONTH", dateTimeService, "daysInMonth", new Class[]{Object[].class}, "");
// runner.addFunctionOfServiceMethod("DAYOFMONTH", dateTimeService, "dayOfMonth", new Class[]{Object[].class}, "");
//聚合函数

View File

@ -1,6 +1,5 @@
package com.engine.salary.formlua.func.compare;
import com.alibaba.fastjson.JSON;
import com.engine.salary.formlua.core.exception.ErrorType;
import com.engine.salary.formlua.entity.parameter.DataType;
import com.engine.salary.formlua.util.CompareUtil;
@ -37,7 +36,6 @@ public class EqOperator extends OperatorEqualsLessMore {
public Object executeInner(Object... list) throws Exception {
DataType result=new DataType();
result.setDataType(DataType.BOOL);
logger.info("等于号参数:"+JSON.toJSONString(list));
String oper="=";
if(list.length!=2){
throw new RuntimeException("[=]"+ ErrorType.MAX_VAR_COUNT.name());
@ -75,7 +73,6 @@ public class EqOperator extends OperatorEqualsLessMore {
int i=0;
for (;i<firstOptions.length;i++){
boolean loopresult=OperatorEqualsLessMore.executeInner("=",firstOptions[i],secondOptions[i]);
logger.info("比较选项结果"+loopresult);
if(!loopresult){
result.setContent(false);
break;
@ -138,7 +135,6 @@ public class EqOperator extends OperatorEqualsLessMore {
}else {
Object firstParam=ExcelParamUtil.getParamContent(dataList.get(0),"");
Object secondParam=ExcelParamUtil.getParamContent(dataList.get(1),"");
logger.info("等于号比较:"+firstParam+"-->"+secondParam);
if((firstParam instanceof String || firstParam instanceof Character) && (secondParam instanceof String || secondParam instanceof Character)){
if(firstParam.toString().length()==1&&secondParam.toString().length()==1){
boolean r=firstParam.toString().equals(secondParam.toString());

View File

@ -1,6 +1,5 @@
package com.engine.salary.formlua.func.compare;
import com.alibaba.fastjson.JSON;
import com.engine.salary.formlua.entity.parameter.DataType;
import com.engine.salary.formlua.util.CompareUtil;
import com.engine.salary.formlua.util.DateUtil;
@ -22,7 +21,6 @@ public class GreaterOperator extends OperatorEqualsLessMore {
result.setDataType(DataType.BOOL);
// IgnoreParamFilter.filterCompareFunc(op1,op2,">");
String datatype = ExcelParamUtil.checkParamType(op1);
logger.info("大于号比较:" + JSON.toJSONString(op1) + "-->" + JSON.toJSONString(op2));
//对option的特殊处理获取option的字符串后根据逗号分割然后排序数组数组长度不一致返回false一致则循环对比直到同样下标的数据不一致返回false否则为true
try {
if (datatype.equals(DataType.OPTION)) {
@ -77,8 +75,6 @@ public class GreaterOperator extends OperatorEqualsLessMore {
}
result.setContent(dateResult);
} else {
logger.info("参数1" + ExcelParamUtil.convertParamValToNumber(op1) + "");
logger.info("参数2" + ExcelParamUtil.convertParamValToNumber(op2) + "");
boolean r;
if (ExcelParamUtil.getParamType(op1).toLowerCase().equals("double") || ExcelParamUtil.getParamType(op2).toLowerCase().equals("double")) {
r = OperatorEqualsLessMore.executeInner(">", ExcelParamUtil.convertParamValToNumber(op1), ExcelParamUtil.convertParamValToNumber(op2));

View File

@ -52,10 +52,9 @@ public class WOperatorDiv extends OperatorMultiDiv {
newList[1] = secondParam;
try {
Object r = super.executeInner(newList);
logger.info("乘法运算:" + r.toString());
result.setContent(new BigDecimal(r + ""));
} catch (Exception e) {
logger.info("除法计算异常返回0" + e.getMessage());
logger.error("除法计算异常返回0" + e.getMessage());
result.setContent(0);
}
return result;

View File

@ -89,4 +89,11 @@ import com.engine.salary.formlua.entity.parameter.DataType;
*/
DataType currSecond(Object... objects);
/**
* 获取月有多少天
* @param objects
* @return
*/
DataType daysInMonth(Object... objects);
}

View File

@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -549,7 +550,6 @@ public class DateTimeServiceImpl implements DateTimeService {
date = lastday;
break;
}
logger.info("firstday:" + firstday + " lastday:" + lastday);
return new DataType(DataType.STRING, date);
}
@ -998,6 +998,37 @@ public class DateTimeServiceImpl implements DateTimeService {
int year = cal.get(Calendar.SECOND);
return new DataType(DataType.NUMBER, year);
}
@Override
public DataType daysInMonth(Object... objects) {
Class[] typeObjects = new Class[]{DateAndString.class};
IgnoreParamFilter.commonFilter("YEAR", 1, 1, typeObjects, objects);
Object obj = objects[0];
Object date = DateUtil.getContent(obj, formatter);
if (ExcelParamUtil.checkIsNull(date, ExcelParamUtil.CHECKLEVEL_STRING)) {
return new DataType(DataType.NUMBER, 0);
}
int year = 0;
try {
year = getDateTimeValue(date, "Y", "YEAR");
} catch (ParseException e) {
logger.error("err", e);
throw new RuntimeException(e);
}
IgnoreParamFilter.commonFilter("MONTH", 1, 1, typeObjects, objects);
int month = 0;
try {
month = getDateTimeValue(date, "M", "MONTH") + 1;
} catch (ParseException e) {
logger.error("err", e);
throw new RuntimeException(e);
}
YearMonth yearMonth = YearMonth.of(year, month);
int daysInMonth = yearMonth.lengthOfMonth();
return new DataType(DataType.NUMBER, daysInMonth);
}
/*******以下为日期函数的一些公共逻辑********/
@ -1256,7 +1287,7 @@ public class DateTimeServiceImpl implements DateTimeService {
r = true;
break;
} catch (ParseException e) {
logger.info(e.getMessage());
logger.error(e.getMessage());
r = false;
}
}

View File

@ -79,7 +79,6 @@ public class FinanceServiceImpl implements FinanceService{
int intLen = integerNum.length();
for (int i = 0; i < intLen; i++) {
String n = integerNum.substring(i, i+1);
logger.info("转换中文:"+n);
int p = intLen - i - 1;
int q = p / 4;
int m = p % 4;

View File

@ -1,6 +1,5 @@
package com.engine.salary.formlua.func.logic;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.salary.formlua.core.exception.ExcelRunTimeException;
import com.engine.salary.formlua.entity.parameter.DataType;
@ -26,7 +25,6 @@ public class IfOperator extends OperatorIf {
throw new ExcelRunTimeException("IF函数只允许三个参数");
}
Object obj = list.get(0).getObject(parent);
logger.info("IF参数" + JSON.toJSONString(obj));
boolean isDataTypeBool = false;
DataType boolDtaType = null;
if (obj != null && obj instanceof DataType) {

View File

@ -477,7 +477,6 @@ public class LogicServiceImpl implements LogicService {
Object obj = objects[i - 1];
String typeStr = ExcelParamUtil.getParamType(obj);
typeStr = ExcelParamUtil.checkParamType(typeStr);
logger.info(typeStr);
if (type == null) {
type = typeStr;
} else {

View File

@ -236,7 +236,6 @@ public class StringFormulaServiceImpl implements StringFormulaService {
int replaceLength=(repIdx-1)+repLenth;
if(replaceLength>sourceStr.length()){
// throw new RunTimeException(errorJson.getString("msg"));
logger.info("REPLACE函数替换位置超过了字符长度");
replaceLength=sourceStr.length();
}
String cutStr=sourceStr.substring(repIdx-1,replaceLength);
@ -463,7 +462,6 @@ public class StringFormulaServiceImpl implements StringFormulaService {
sex = "";
}
}
logger.info(sex);
return new DataType(DataType.STRING,sex);
}
@ -471,7 +469,6 @@ public class StringFormulaServiceImpl implements StringFormulaService {
public DataType nativePlace(String idCard){
int nativePlaceCode=Integer.parseInt(idCard.substring(0, 6));
String nativePlace= NativePlace.getNativePlace(nativePlaceCode);
logger.info("您所在的地区为:\n" + nativePlace);
return new DataType(DataType.STRING,nativePlace);
}
@ -489,7 +486,6 @@ public class StringFormulaServiceImpl implements StringFormulaService {
if(dataType!=null && dataType.getContent()!=null){
age=dataType.getContent();
}
logger.info("年龄:"+age);
}
} catch (ParseException e) {
logger.error("err",e);
@ -526,7 +522,6 @@ public class StringFormulaServiceImpl implements StringFormulaService {
}
String birth=year+"-"+month+"-"+day;
logger.info("生日为:"+birth);
result=birth;
break;
@ -756,12 +751,10 @@ public class StringFormulaServiceImpl implements StringFormulaService {
if(fieldType.equalsIgnoreCase("string")){
if(content!=null){
try {
logger.info("isJson函数的JSON字符转换"+content+"");
JSON.parseObject(content+"");
resultDataType=new DataType(DataType.BOOL,true);
} catch (Exception e) {
logger.info("err",e);
logger.info("不是正常的JSON字符");
logger.error("err",e);
resultDataType=new DataType(DataType.BOOL,false);
}
}else{
@ -800,13 +793,11 @@ public class StringFormulaServiceImpl implements StringFormulaService {
if(fieldType.equalsIgnoreCase("string")){
if(content!=null){
try {
logger.info("isJson函数的JSON字符转换"+content+"");
JSONObject jsonObject=JSON.parseObject(content+"");
Object jsonValue=jsonObject.get(objectKey+"");
resultDataType=new DataType(DataType.STRING,jsonValue==null?"":jsonValue.toString());
} catch (Exception e) {
logger.info("err",e);
logger.info("不是正常的JSON字符");
resultDataType=new DataType(DataType.STRING,"");
}
}else{

View File

@ -87,7 +87,6 @@ public class DateUtil {
try {
format.setLenient(false);
format.parse(dateString);
logger.info(dateString);
} catch (ParseException e) {
// logger.error("err",e);
convertSuccess=false;

View File

@ -1,6 +1,5 @@
package com.engine.salary.formlua.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.salary.formlua.core.exception.ErrorType;
import com.engine.salary.formlua.entity.parameter.DataType;
@ -39,7 +38,6 @@ public class IgnoreParamFilter {
* @return
*/
public static boolean isEmployee(Object object) {
logger.info("校验人员参数" + JSON.toJSONString(object));
// if (object instanceof DataType) {
// DataType dataType = (DataType) object;
// if (dataType.getComponentKey() != null && dataType.getComponentKey().equalsIgnoreCase(ComponentType.Employee.toString())) {
@ -227,7 +225,6 @@ public class IgnoreParamFilter {
* @throws RuntimeException
*/
public static void filterAggFunc(String func, Object... objects) throws RuntimeException {
logger.info("聚合参数:" + JSON.toJSONString(objects));
Integer number = getSetFuncNumber(func);
Map<String, String> map = new HashMap<>();
boolean mustNumber = false;

View File

@ -24,6 +24,9 @@
<result column="shared_type" property="sharedType"/>
<result column="tax_agent_ids" property="taxAgentIds"/>
<result column="sorted_index" property="sortedIndex"/>
<result column="hide_default" property="hideDefault"/>
<result column="width" property="width"/>
<result column="default_value" property="defaultValue"/>
</resultMap>
<!-- 表字段 -->
@ -52,7 +55,8 @@
t.tax_agent_ids,
t.sorted_index,
t.hide_default,
t.width
t.width,
t.default_value
</sql>
<!-- 查询全部 -->
@ -221,6 +225,9 @@
<if test="width != null">
width,
</if>
<if test="defaultValue != null">
default_value,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -295,6 +302,9 @@
<if test="width != null">
#{width},
</if>
<if test="defaultValue != null">
#{defaultValue},
</if>
</trim>
</insert>
@ -369,7 +379,12 @@
<if test="width != null">
width=#{width},
</if>
sorted_index=#{sortedIndex},
<if test="sortedIndex != null">
sorted_index=#{sortedIndex},
</if>
<if test="defaultValue != null">
default_value=#{defaultValue},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>

View File

@ -52,6 +52,7 @@
, t.delete_type
, t.create_time
, t.update_time
, t.default_value
</sql>

View File

@ -17,6 +17,7 @@
<result column="can_delete" property="canDelete"/>
<result column="salary_item_code" property="salaryItemCode"/>
<result column="item_hide" property="itemHide"/>
<result column="default_value" property="defaultValue"/>
<result column="income_category" property="incomeCategory"/>
</resultMap>
@ -41,6 +42,7 @@
, t.rounding_mode
, t.pattern
, t.value_type
, t.default_value
, t.item_hide
, t.income_category
</sql>
@ -174,6 +176,7 @@
value_type=#{valueType},
item_hide=#{itemHide},
income_category=#{incomeCategory},
default_value=#{defaultValue},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -228,6 +231,9 @@
<if test="valueType != null">
value_type=#{valueType},
</if>
<if test="defaultValue != null">
default_value=#{defaultValue},
</if>
<if test="itemHide != null">
item_hide=#{itemHide},
</if>
@ -280,7 +286,7 @@
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_item(salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,salary_item_code,item_hide,income_category)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,salary_item_code,item_hide,income_category,default_value)
VALUES
<foreach collection="collection" item="item" separator=",">
(
@ -301,13 +307,14 @@
#{item.valueType},
#{item.salaryItemCode},
#{item.itemHide},
#{item.incomeCategory}
#{item.incomeCategory},
#{item.defaultValue}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,salary_item_code,item_hide,income_category)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,salary_item_code,item_hide,income_category,default_value)
<foreach collection="collection" item="item" separator="union all">
select
@ -328,14 +335,15 @@
#{item.valueType,jdbcType=INTEGER},
#{item.salaryItemCode,jdbcType=INTEGER},
#{item.itemHide,jdbcType=DOUBLE},
#{item.incomeCategory,jdbcType=VARCHAR}
#{item.incomeCategory,jdbcType=VARCHAR},
#{item.defaultValue,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,salary_item_code,item_hide,income_category)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,salary_item_code,item_hide,income_category,default_value)
VALUES
(
#{item.salarySobId},
@ -355,7 +363,8 @@
#{item.valueType},
#{item.salaryItemCode},
#{item.itemHide},
#{item.incomeCategory}
#{item.incomeCategory},
#{item.defaultValue}
)
</foreach>
</insert>

View File

@ -24,6 +24,7 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelUtilPlus;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -137,6 +138,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
/**
* 获取员工发薪明细列表
*
* @param queryParam
*/
public Map<String, Object> salaryList(SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
@ -147,7 +149,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
// 获取发薪人员
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam);
// 获取薪资核算结果
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList());
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList());
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
Map<String, Object> countResultMap = Maps.newHashMap();
@ -183,7 +185,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
// 结果
if (queryParam.isExport()) {
resultMap.put("columns", weaTableColumns);
resultMap.put("salaryItems",salaryStatisticsEmployeeDetailResult.getSalaryItemList());
resultMap.put("salaryItems", salaryStatisticsEmployeeDetailResult.getSalaryItemList());
resultMap.put("countResult", countResultMap);
} else {
WeaTable table = new WeaTable();
@ -205,6 +207,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
/**
* 获取员工发薪明细列表
*
* @param queryParam
*/
public Map<String, Object> salaryListSum(SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
@ -215,25 +218,37 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
queryParam.setExport(true);
// 获取发薪人员
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam);
// 获取薪资核算结果
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList());
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
List<SalaryAcctEmployeePO> employeePOS = salaryAcctEmployeePageInfo.getList();
Map<String, Object> sumResultMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(records)) {
List<SalaryItemPO> salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList();
for (SalaryItemPO item : salaryItems) {
BigDecimal sumBigDecimal = new BigDecimal(SalaryStatisticsReportBO.ZERO);
String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX;
for (Map<String, Object> record : records) {
if (record.containsKey(itemKey)) {
if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) {
sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString()));
List<List<SalaryAcctEmployeePO>> empParts = Lists.partition(employeePOS, 500);
for (int i = 0; i < empParts.size(); i++) {
// 获取薪资核算结果
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(empParts.get(i));
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
if (CollectionUtils.isNotEmpty(records)) {
List<SalaryItemPO> salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList();
for (SalaryItemPO item : salaryItems) {
BigDecimal sumBigDecimal = new BigDecimal(SalaryStatisticsReportBO.ZERO);
String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX;
for (Map<String, Object> record : records) {
if (record.containsKey(itemKey)) {
if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) {
sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString()));
}
}
}
Object o = sumResultMap.get(itemKey + "_n");
if (o != null) {
sumBigDecimal = sumBigDecimal.add((BigDecimal) o);
}
sumResultMap.put(itemKey + "_n", sumBigDecimal);
// 薪资项目合计
sumResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString()));
}
// 薪资项目合计
sumResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString()));
}
}
resultMap.put("sumRow", sumResultMap);
@ -263,12 +278,12 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
// 合计
List<Object> sumRow = new ArrayList<>();
sumRow.add("总计");
for (int i=1; i<columns.size(); i++) {
for (int i = 1; i < columns.size(); i++) {
sumRow.add(Util.null2String(countResult.get(columns.get(i).getColumn())));
}
rowList.add(sumRow);
return ExcelUtilPlus.genWorkbookV2(rowList,"薪资明细",true);
return ExcelUtilPlus.genWorkbookV2(rowList, "薪资明细", true);
}
// public Map<String, Object> exportDetailList(SalaryStatisticsEmployeeDetailQueryParam queryParam) {

View File

@ -420,10 +420,28 @@ public class SalaryStatisticsReportWrapper extends Service {
}
});
List<Long> itemIds = salaryStatisticsItemList.stream().map(item -> item.getItemValue().split(",")).flatMap(Arrays::stream).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listByIds(itemIds);
List<String> numberItemIds = salaryItemPOList.stream().filter(item -> item.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())).map(salaryItemPO -> salaryItemPO.getId().toString()).collect(Collectors.toList());
Map<String, SalaryStatisticsItemPO> salaryStatisticsItemMap = SalaryEntityUtil.convert2Map(salaryStatisticsItemList, statisticsItemPO -> statisticsItemPO.getId().toString());
for (Map<String, String> map : records) {
List<Object> row = Lists.newArrayListWithExpectedSize(records.size());
head.forEach(k -> {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
// 获取是数值还是文本
if (k.contains(SalaryStatisticsReportBO.UD)) {
String[] split = k.split(SalaryStatisticsReportBO.UD);
String salaryItemId = split[0];
SalaryStatisticsItemPO salaryStatisticsItemPO = salaryStatisticsItemMap.get(salaryItemId);
if (salaryStatisticsItemPO != null) {
Optional<String> textItemOptional = Arrays.stream(salaryStatisticsItemPO.getItemValue().split(",")).filter(id -> !numberItemIds.contains(id)).findFirst();
row.add( (!textItemOptional.isPresent() && NumberUtils.isCreatable(map.getOrDefault(k, StringUtils.EMPTY).replace(",", ""))) ? new BigDecimal(map.get(k).replace(",", "")) : map.getOrDefault(k, StringUtils.EMPTY));
} else {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
}
} else {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
}
});
rows.add(row);
}

View File

@ -1,7 +1,10 @@
package com.engine.salary.service;
import com.engine.salary.entity.salaryBill.dto.SalaryBillSendDTO;
import com.engine.salary.entity.salaryBill.param.SalaryExportPdfParam;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import com.engine.salary.entity.salaryBill.po.SalarySendPO;
import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO;
import java.util.List;
import java.util.Map;
@ -52,6 +55,15 @@ public interface SalaryBillService {
String genPdfBeforeExport(SalaryExportPdfParam salaryExportPdfParam);
/**
* 构建发放参数
* @param salarySend
* @param taxAgentName
* @param salaryTemplate
* @return
*/
SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, String taxAgentName, SalaryTemplatePO salaryTemplate);
/**
* 工资单撤回
*

View File

@ -218,4 +218,11 @@ public interface SalarySendService {
List<SalarySendPO> getByIds(List<Long> salarySendId);
List<SalarySendPO> listSome(SalarySendPO param);
/**
* 工资单预览
* @param param
* @return
*/
Map<String, Object> preview(SalaryPreviewParam param);
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
@ -10,10 +11,10 @@ import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.AddUpDeductionBiz;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.constant.SzyhApiConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
@ -66,6 +67,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.*;
import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelComment;
import com.engine.salary.util.excel.ExcelParseHelper;
@ -75,7 +77,6 @@ import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.engine.salary.util.db.IdGenerator;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -89,6 +90,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.*;
@ -1118,11 +1120,11 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(isChief, queryParam);
List<List<Object>> rowList = getExcelRowDetailList(isChief, queryParam);
//获取excel
return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "累计专项附加扣除明细", 2);
}
@ -1132,32 +1134,33 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(boolean isChief, AddUpDeductionQueryParam param) {
private List<List<Object>> getExcelRowDetailList(boolean isChief, AddUpDeductionQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护");
List<Object> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<AddUpDeductionRecordDTO> list = new AddUpDeductionBiz().recordList(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getAddUpChildEducation()));
cellList.add(Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(Util.null2String(dto.getAddUpHousingRent()));
cellList.add(Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(Util.null2String(dto.getAddUpInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) :Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) :Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) :Util.null2String(dto.getAddUpHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) :Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) :Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) :Util.null2String(dto.getAddUpInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
@ -1177,7 +1180,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
@ -1265,7 +1268,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
SalaryElogConfig.addUpDeductionLoggerTemplate.write(loggerContext);
//获取excel
return ExcelUtil.genWorkbookV2(rowList, "累计专项附加扣除");
return ExcelUtil.genWorkbookV2WithDefaultPattern(rowList, "累计专项附加扣除", 2);
}
private List<List<Object>> getLists(AddUpDeductionQueryParam param) {
@ -1300,13 +1303,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getAddUpChildEducation()));
cellList.add(Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(Util.null2String(dto.getAddUpHousingRent()));
cellList.add(Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(Util.null2String(dto.getAddUpInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) :Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) :Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) :Util.null2String(dto.getAddUpHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) :Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) :Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) :Util.null2String(dto.getAddUpInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
@ -12,7 +13,6 @@ import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.AddUpSituationBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SzyhApiConstant;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -66,6 +66,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
@ -302,7 +303,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
SalaryElogConfig.addUpSituationLoggerTemplate.write(loggerContext);
// 获取excel
return ExcelUtil.genWorkbookV2(rowList, "累计情况");
return ExcelUtil.genWorkbookV2WithDefaultPattern(rowList, "累计情况", 2);
}
@ -346,19 +347,19 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getAddUpIncome()));
cellList.add(Util.null2String(dto.getAddUpSubtraction()));
cellList.add(Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(Util.null2String(dto.getActualAddUpAdvanceTax()));
cellList.add(Util.null2String(dto.getTaxAdjustment()));
cellList.add(Util.null2String(dto.getAddUpTaxableIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIncome()) ? new BigDecimal(dto.getAddUpIncome()) : Util.null2String(dto.getAddUpIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSubtraction()) ? new BigDecimal(dto.getAddUpSubtraction()) : Util.null2String(dto.getAddUpSubtraction()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSocialSecurityTotal()) ? new BigDecimal(dto.getAddUpSocialSecurityTotal()) : Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAccumulationFundTotal()) ? new BigDecimal(dto.getAddUpAccumulationFundTotal()) : Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(NumberUtil.isNumber(dto.getAddUpEnterpriseAndOther()) ? new BigDecimal(dto.getAddUpEnterpriseAndOther()) : Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(NumberUtil.isNumber(dto.getAddUpOtherDeduction()) ? new BigDecimal(dto.getAddUpOtherDeduction()) : Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxExemptIncome()) ? new BigDecimal(dto.getAddUpTaxExemptIncome()) : Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAllowedDonation()) ? new BigDecimal(dto.getAddUpAllowedDonation()) : Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxSavings()) ? new BigDecimal(dto.getAddUpTaxSavings()) : Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAdvanceTax()) ? new BigDecimal(dto.getAddUpAdvanceTax()) : Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(NumberUtil.isNumber(dto.getActualAddUpAdvanceTax()) ? new BigDecimal(dto.getActualAddUpAdvanceTax()) : Util.null2String(dto.getActualAddUpAdvanceTax()));
cellList.add(NumberUtil.isNumber(dto.getTaxAdjustment()) ? new BigDecimal(dto.getTaxAdjustment()) : Util.null2String(dto.getTaxAdjustment()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxableIncome()) ? new BigDecimal(dto.getAddUpTaxableIncome()) : Util.null2String(dto.getAddUpTaxableIncome()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
@ -376,10 +377,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(AddUpSituationQueryParam param) {
private List<List<Object>> getExcelRowDetailList(AddUpSituationQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用",
List<Object> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用",
"累计社保个人合计", "累计公积金个人合计", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额",
"累计已预扣预缴税额", "实际累计已预扣预缴税额", "个税调差", "累计应纳税所得额");
@ -395,34 +396,34 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
}
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxYearMonth() == null ? "" : formatter.format(dto.getTaxYearMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getAddUpIncome()));
cellList.add(Util.null2String(dto.getAddUpSubtraction()));
cellList.add(Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(Util.null2String(dto.getActualAddUpAdvanceTax()));
cellList.add(Util.null2String(dto.getTaxAdjustment()));
cellList.add(Util.null2String(dto.getAddUpTaxableIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIncome()) ? new BigDecimal(dto.getAddUpIncome()) : Util.null2String(dto.getAddUpIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSubtraction()) ? new BigDecimal(dto.getAddUpSubtraction()) : Util.null2String(dto.getAddUpSubtraction()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSocialSecurityTotal()) ? new BigDecimal(dto.getAddUpSocialSecurityTotal()) : Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAccumulationFundTotal()) ? new BigDecimal(dto.getAddUpAccumulationFundTotal()) : Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(NumberUtil.isNumber(dto.getAddUpEnterpriseAndOther()) ? new BigDecimal(dto.getAddUpEnterpriseAndOther()) : Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(NumberUtil.isNumber(dto.getAddUpOtherDeduction()) ? new BigDecimal(dto.getAddUpOtherDeduction()) : Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxExemptIncome()) ? new BigDecimal(dto.getAddUpTaxExemptIncome()) : Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAllowedDonation()) ? new BigDecimal(dto.getAddUpAllowedDonation()) : Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxSavings()) ? new BigDecimal(dto.getAddUpTaxSavings()) : Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAdvanceTax()) ? new BigDecimal(dto.getAddUpAdvanceTax()) : Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(NumberUtil.isNumber(dto.getActualAddUpAdvanceTax()) ? new BigDecimal(dto.getActualAddUpAdvanceTax()) : Util.null2String(dto.getActualAddUpAdvanceTax()));
cellList.add(NumberUtil.isNumber(dto.getTaxAdjustment()) ? new BigDecimal(dto.getTaxAdjustment()) : Util.null2String(dto.getTaxAdjustment()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxableIncome()) ? new BigDecimal(dto.getAddUpTaxableIncome()) : Util.null2String(dto.getAddUpTaxableIncome()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
@ -458,10 +459,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
}
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(queryParam);
List<List<Object>> rowList = getExcelRowDetailList(queryParam);
//获取excel
return ExcelUtil.genWorkbook(rowList, "累计情况明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "累计情况明细", 2);
}
@ -621,7 +622,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
String idNo = dto.getIdNo();
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo,null);
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo, null);
//当人员信息导入筛选的全局配置为"0"姓名才是必填项
if (StringUtils.isBlank(userName) && "0".equals(confValue)) {
@ -1285,7 +1286,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
continue;
}
List<AddUpSituation> poList = getAddUpSituationMapper().listSome((AddUpSituation.builder().taxYearMonth(param.getDeclareMonth()).taxAgentId(returnPO.getTaxAgentId()).build()));
encryptUtil.decryptList(poList,AddUpSituation.class);
encryptUtil.decryptList(poList, AddUpSituation.class);
Map<String, AddUpSituation> poMap = SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId());
// 内部员工身份证信息

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSONObject;
import com.api.formmode.mybatis.util.SqlProxyHandle;
@ -270,7 +271,16 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
// 动态列
for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) {
row.add(dto.get(attendQuoteField.getId().toString() + "_attendQuoteData"));
Object o = dto.get(attendQuoteField.getId().toString() + "_attendQuoteData");
try {
if (o != null && NumberUtil.isNumber(o.toString())) {
row.add(new BigDecimal(o.toString()));
} else {
row.add(o);
}
} catch (Exception e) {
row.add(o);
}
}
rows.add(row);
}

View File

@ -477,8 +477,7 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
List<EmployeeDeclarePO> preTaxCycleEmployeeDeclares = listByTaxCycleAndTaxAgentId(SalaryDateUtil.plusMonths(refreshParam.getTaxCycle(), -1), refreshParam.getTaxAgentId())
//只需要正常的
.stream()
.filter(e -> Objects.equals(e.getEmploymentStatus(), EmploymentStatusEnum.NORMAL.getValue())
&& Objects.equals(e.getDeclareStatus(), DeclareStatusEnum.DECLARE_SUCCESS.getValue()))
.filter(e ->Objects.equals(e.getDeclareStatus(), DeclareStatusEnum.DECLARE_SUCCESS.getValue()))
.collect(Collectors.toList());
// 查询个税扣缴义务人
TaxAgentPO taxAgent = getTaxAgentService(user).getById(refreshParam.getTaxAgentId());

View File

@ -1,13 +1,14 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -54,6 +55,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.YearMonth;
@ -490,7 +492,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
SalaryElogConfig.otherDeductionLoggerTemplate.write(loggerContext);
//获取excel
return ExcelUtil.genWorkbookV2(rowList, "其他免税扣除");
return ExcelUtil.genWorkbookV2WithDefaultPattern(rowList, "其他免税扣除", 2);
}
@ -534,11 +536,11 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(Util.null2String(dto.getOtherDeduction()));
cellList.add(Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(Util.null2String(dto.getPrivatePension()));
cellList.add(NumberUtil.isNumber(dto.getBusinessHealthyInsurance()) ? new BigDecimal(dto.getBusinessHealthyInsurance()) : Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(NumberUtil.isNumber(dto.getTaxDelayEndowmentInsurance()) ? new BigDecimal(dto.getTaxDelayEndowmentInsurance()) : Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(NumberUtil.isNumber(dto.getOtherDeduction()) ? new BigDecimal(dto.getOtherDeduction()) : Util.null2String(dto.getOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getDeductionAllowedDonation()) ? new BigDecimal(dto.getDeductionAllowedDonation()) : Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getPrivatePension()) ? new BigDecimal(dto.getPrivatePension()) : Util.null2String(dto.getPrivatePension()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
@ -586,10 +588,10 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(param);
List<List<Object>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList, "其他免税扣除明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "其他免税扣除明细", 2);
}
@ -599,34 +601,34 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(OtherDeductionQueryParam param) {
private List<List<Object>> getExcelRowDetailList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额", "个人养老金");
List<Object> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额", "个人养老金");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(param);
encryptUtil.decryptList(list, OtherDeductionRecordDTO.class);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(Util.null2String(dto.getOtherDeduction()));
cellList.add(Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(Util.null2String(dto.getPrivatePension()));
cellList.add(NumberUtil.isNumber(dto.getBusinessHealthyInsurance()) ? new BigDecimal(dto.getBusinessHealthyInsurance()) : Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(NumberUtil.isNumber(dto.getTaxDelayEndowmentInsurance()) ? new BigDecimal(dto.getTaxDelayEndowmentInsurance()) : Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(NumberUtil.isNumber(dto.getOtherDeduction()) ? new BigDecimal(dto.getOtherDeduction()) : Util.null2String(dto.getOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getDeductionAllowedDonation()) ? new BigDecimal(dto.getDeductionAllowedDonation()) : Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getPrivatePension()) ? new BigDecimal(dto.getPrivatePension()) : Util.null2String(dto.getPrivatePension()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;

View File

@ -3502,11 +3502,56 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String, Object> resultMap = new HashMap<>();
// resultMap.put("data", dataMap);
// resultMap.put("items", addGroups);
// 获取当前放方案信息
InsuranceArchivesSocialSchemePO socialSchemePO = new InsuranceArchivesSocialSchemePO();
InsuranceArchivesFundSchemePO fundSchemePO = new InsuranceArchivesFundSchemePO();
InsuranceArchivesOtherSchemePO otherSchemePO = new InsuranceArchivesOtherSchemePO();
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = new ArrayList<>();
List<Long> schemeIdList = new ArrayList<>();
schemeIdList.add(insuranceAccountDetailPO.getSocialSchemeId());
schemeIdList.add(insuranceAccountDetailPO.getFundSchemeId());
schemeIdList.add(insuranceAccountDetailPO.getOtherSchemeId());
if (insuranceAccountDetailPO.getSocialSchemeId() == null) {
List<InsuranceArchivesSocialSchemePO> socialSchemePOList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(insuranceAccountDetailPO.getEmployeeId())
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
.build());
if (socialSchemePOList.size() > 0) {
encryptUtil.decryptList(socialSchemePOList, InsuranceArchivesSocialSchemePO.class);
socialSchemePO = socialSchemePOList.get(0);
}
schemeIdList.add(socialSchemePO.getSocialSchemeId());
} else {
schemeIdList.add(insuranceAccountDetailPO.getSocialSchemeId());
}
if (insuranceAccountDetailPO.getFundSchemeId() == null) {
List<InsuranceArchivesFundSchemePO> fundSchemePOList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(insuranceAccountDetailPO.getEmployeeId())
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
.build());
if (fundSchemePOList.size() > 0) {
encryptUtil.decryptList(fundSchemePOList, InsuranceArchivesFundSchemePO.class);
fundSchemePO = fundSchemePOList.get(0);
}
schemeIdList.add(fundSchemePO.getFundSchemeId());
} else {
schemeIdList.add(insuranceAccountDetailPO.getFundSchemeId());
}
if (insuranceAccountDetailPO.getOtherSchemeId() == null) {
List<InsuranceArchivesOtherSchemePO> otherSchemePOList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(insuranceAccountDetailPO.getEmployeeId())
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
.build());
if (otherSchemePOList.size() > 0) {
encryptUtil.decryptList(otherSchemePOList, InsuranceArchivesOtherSchemePO.class);
otherSchemePO = otherSchemePOList.get(0);
}
schemeIdList.add(otherSchemePO.getOtherSchemeId());
} else {
schemeIdList.add(insuranceAccountDetailPO.getOtherSchemeId());
}
schemeIdList = schemeIdList.stream().filter(schemeId -> schemeId != null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(schemeIdList)) {
insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(schemeIdList);

View File

@ -207,7 +207,7 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
Map<String, String> fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(fundSchemePO.getFundSchemeId()));
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
fundMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
@ -243,7 +243,7 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
Map<String, String> otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(otherSchemePO.getOtherSchemeId()));
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
otherMap.forEach((k, v) -> {

View File

@ -47,6 +47,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -251,7 +252,15 @@ public class SIExportServiceImpl extends Service implements SIExportService {
for (Map<String, Object> recordData : records) {
List<Object> row = new LinkedList<>();
for (WeaTableColumn column : columns) {
row.add(recordData.get(column.getColumn()));
try {
if (column.getText().contains("个人") || column.getText().contains("单位") || column.getText().contains("合计")) {
row.add(new BigDecimal(recordData.get(column.getColumn()).toString()));
} else {
row.add(recordData.get(column.getColumn()));
}
} catch (Exception e) {
row.add(recordData.get(column.getColumn()));
}
}
rows.add(row);
}

View File

@ -624,7 +624,11 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
for (WeaTableColumn column : columns) {
try {
Object o = recordData.get(column.getColumn());
row.add(o.toString());
if (column.getText().contains("申报基数") && StringUtils.isNotBlank(o.toString())) {
row.add(new BigDecimal(o.toString()));
} else {
row.add(o.toString());
}
} catch (Exception e) {
row.add("");
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
@ -35,6 +36,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.util.StopWatch;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
@ -111,7 +113,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
@Override
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
StopWatch sw = new StopWatch("核算耗时明细id"+salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+"");
StopWatch sw = new StopWatch("核算耗时明细id" + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId() + "");
Date now = new Date();
try {
// 数据库字段加密用
@ -212,16 +214,20 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
String resultValue;
SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId);
ExpressFormula expressFormula;
String defaultValue;
if (salarySobBackItemMap.containsKey(salaryItemId)) {
// 如果薪资账套的回算项目中重新定义了回算项目公式则使用薪资账套下的公式
SalarySobBackItemPO salarySobBackItemPO = salarySobBackItemMap.get(salaryItemId);
expressFormula = expressFormulaMap.get(salarySobBackItemPO.getFormulaId());
defaultValue = salarySobBackItemPO.getDefaultValue();
} else if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId)) {
// 如果薪资账套下重新定义了薪资项目的公式则使用薪资账套下的公式否则使用薪资项目本身的公式
SalarySobItemPO salarySobItemPO = salaryItemIdKeySalarySobItemPOMap.get(salaryItemId);
expressFormula = expressFormulaMap.get(salarySobItemPO.getFormulaId());
defaultValue = salarySobItemPO.getDefaultValue();
} else {
expressFormula = expressFormulaMap.get(salaryItemPO.getFormulaId());
defaultValue = salaryItemPO.getDefaultValue();
}
if (Objects.nonNull(expressFormula)) {
// 运行公式
@ -243,6 +249,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
// 处理取值类型为输入/导入的薪资项目
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY);
if (StrUtil.isBlank(resultValue)) {
resultValue = Util.null2String(defaultValue);
}
}
// 处理薪资档案
if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {

View File

@ -228,10 +228,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<List<Long>> partition = Lists.partition((List<Long>) salaryAcctEmployeeIds, 500);
List<SalaryAcctResultPO> salaryAcctResultPOS = new ArrayList<>();
partition.forEach(empIds -> {
salaryAcctResultPOS.addAll(getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctEmpIds(empIds).build()));
List<SalaryAcctResultPO> resultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctEmpIds(empIds).build());
encryptUtil.decryptList(resultPOS, SalaryAcctResultPO.class);
salaryAcctResultPOS.addAll(resultPOS);
});
// 解密
encryptUtil.decryptList(salaryAcctResultPOS, SalaryAcctResultPO.class);
return salaryAcctResultPOS;
}
@ -809,7 +810,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
acctResults = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId())).collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
}
List<Long> lockEmpIds = salaryAcctEmployeePOS.stream().filter(po -> LockStatusEnum.LOCK.getValue().equals(po.getLockStatus())).map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
if(CollUtil.isNotEmpty(lockEmpIds)){
if (CollUtil.isNotEmpty(lockEmpIds)) {
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctEmployeeIds(lockEmpIds);
Map<String, SalaryAcctResultPO> acctResultMaps = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
acctResults.putAll(acctResultMaps);

View File

@ -3,12 +3,13 @@ package com.engine.salary.service.impl;
import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.*;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.bo.SalaryArchiveBO;
@ -28,6 +29,7 @@ import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryarchive.*;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
@ -68,6 +70,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
@ -520,19 +523,21 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "薪资档案");
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItems = salaryItemMapper.getCanAdjustSalaryItems();
String[] header = {SalaryI18nUtil.getI18nLabel(85429, "姓名"),
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
SalaryI18nUtil.getI18nLabel(86185, "部门"),
SalaryI18nUtil.getI18nLabel(86176, "工号"),
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86186, "证件号码"),
SalaryI18nUtil.getI18nLabel(15890, "员工状态"),
SalaryI18nUtil.getI18nLabel(91075, "起始发薪日期"),
SalaryI18nUtil.getI18nLabel(91075, "最后发薪日期")};
Object[] header = {
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86176, "工号"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86186, "证件号码"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(15890, "员工状态"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(91075, "起始发薪日期"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(91075, "最后发薪日期"), "", "", 0)
};
// 2.表头
List<Object> headerList = new ArrayList<>(Arrays.asList(header));
for (SalaryItemPO salaryItem : salaryItems) {
headerList.add(salaryItem.getName());
headerList.add(new WeaTableColumnGroup("150px", salaryItem.getName(), "", "", salaryItem.getPattern()));
}
// 获取所有个税扣缴义务人
@ -587,7 +592,15 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
row.add(Util.null2String(e.get("payEndDate")));
// 薪资项目数据
for (SalaryItemPO salaryItem : salaryItems) {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
try {
if (salaryItem.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) {
row.add(new BigDecimal(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : ""));
} else {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
}
} catch (Exception ex) {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
}
}
rows.add(row);
});
@ -605,7 +618,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "薪资档案") + "-" + name);
loggerContext.setUser(user);
SalaryElogConfig.salaryArchiveLoggerTemplate.write(loggerContext);
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
return ExcelUtilPlus.genWorkbookV2WithPattern(rows, sheetName);
}

View File

@ -337,7 +337,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
* @param salaryTemplate
* @return
*/
private SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, String taxAgentName, SalaryTemplatePO salaryTemplate) {
public SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, String taxAgentName, SalaryTemplatePO salaryTemplate) {
// 发送通道
Set<MessageChannelEnum> sendChannels = SalaryBillBO.buildSendChannels(salaryTemplate);
if (CollectionUtils.isEmpty(sendChannels)) {

View File

@ -249,6 +249,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
newSalaryItemPO.setTaxAgentIds(saveParam.getTaxAgentIds());
newSalaryItemPO.setSortedIndex(saveParam.getSortedIndex());
newSalaryItemPO.setWidth(saveParam.getWidth());
newSalaryItemPO.setDefaultValue(saveParam.getDefaultValue());
salaryItemBiz.updateById(newSalaryItemPO);
//改名后更新公式
@ -459,6 +460,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
sobItem.setValueType(salaryItemPO.getValueType());
sobItem.setDescription(salaryItemPO.getDescription());
sobItem.setUpdateTime(now);
sobItem.setDefaultValue(salaryItemPO.getDefaultValue() == null ? "" : salaryItemPO.getDefaultValue());
getSalarySobItemService(user).update(sobItem);
}
}

View File

@ -469,26 +469,24 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
@Override
public Map<String, Object> mySalaryBill(Long salaryInfoId, Long currentEmployeeId) {
// List<SalarySendInfoPO> salarySendInfos = new LambdaQueryChainWrapper<>(salarySendInfoMapper)
// .eq(SalarySendInfoPO::getDeleteType, 0)
// .eq(SalarySendInfoPO::getTenantKey, currentTenantKey)
// .eq(SalarySendInfoPO::getId, salaryInfoId).list();
if (salaryInfoId == null) {
throw new SalaryRunTimeException("工资单记录不存在");
throw new SalaryRunTimeException("工资单id为空");
}
SalarySendInfoPO po = new SalarySendInfoPO();
po.setDeleteType(0);
po.setId(salaryInfoId);
List<SalarySendInfoPO> salarySendInfos = salarySendInfoMapper.listSome(po);
if (CollectionUtils.isEmpty(salarySendInfos)) {
SalarySendInfoPO salarySendInfo = getSalarySendInfoMapper().getById(salaryInfoId);
if (salarySendInfo == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
}
if (currentEmployeeId.compareTo(salarySendInfos.get(0).getEmployeeId()) != 0) {
if (currentEmployeeId.compareTo(salarySendInfo.getEmployeeId()) != 0) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单"));
}
SalarySendInfoPO salarySendInfo = salarySendInfos.get(0);
// 获取默认模板信息
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
if (salarySendPO == null) {
throw new SalaryRunTimeException("工资单记录不存在");
}
//工资单查看时效性
Date limitMonth = getLimitMonth();
@ -497,11 +495,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "仅能查看" + salaryBillViewingLimitSetting.getLimitMonth() + "月内的工资单"));
}
// 获取默认模板信息
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
if (salarySendPO == null) {
throw new SalaryRunTimeException("工资单不存在");
}
// 获取记录首次查看时间
Date firstReadingTime = new Date();
if (salarySendInfo.getFirstReadingTime() == null) {
@ -534,10 +527,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
// .eq(SalarySendPO::getTenantKey, currentTenantKey)
// .eq(SalarySendPO::getId, salarySendInfo.getSalarySendId()).list();
SalarySendPO sendPo = new SalarySendPO();
sendPo.setDeleteType(0);
sendPo.setId(salarySendInfo.getSalarySendId());
List<SalarySendPO> salarySends = mapper.listSome(sendPo);
List<SalarySendPO> salarySends = mapper.listSome(SalarySendPO.builder().id(salarySendInfo.getSalarySendId()).build());
if (CollectionUtils.isEmpty(salarySends)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100512, "工资单发放不存在"));
}
@ -565,15 +555,11 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
// 获取薪资项目数据
SalaryAcctResultPO acctPo = new SalaryAcctResultPO();
acctPo.setDeleteType(0);
acctPo.setSalaryAcctRecordId(salarySendInfo.getSalaryAcctRecordId());
acctPo.setEmployeeId(currentEmployeeId);
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(acctPo);
Long salaryAcctRecordId = salarySendInfo.getSalaryAcctRecordId();
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).employeeId(currentEmployeeId).build());
encryptUtil.decryptList(salaryAcctResultPOS, SalaryAcctResultPO.class);
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salarySendInfo.getSalaryAcctRecordId());
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
if (salaryAcctRecordPO == null) {
throw new SalaryRunTimeException("薪资核算记录不存在!");
}
@ -1834,4 +1820,173 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
public List<SalarySendPO> listSome(SalarySendPO param) {
return getSalarySendMapper().listSome(param);
}
@Override
public Map<String, Object> preview(SalaryPreviewParam param) {
Long salaryInfoId = param.getSalaryInfoId();
Long recipient = param.getRecipient();
if (salaryInfoId == null) {
throw new SalaryRunTimeException("工资单id为空");
}
SalarySendInfoPO salarySendInfo = getSalarySendInfoMapper().getById(salaryInfoId);
if (salarySendInfo == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
}
// 获取默认模板信息
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
if (salarySendPO == null) {
throw new SalaryRunTimeException("工资单记录不存在");
}
// 获取模板
SalarySobPO salarySob = getSalarySobService(user).getById(salarySendPO.getSalarySobId());
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId());
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Arrays.asList(salarySendPO.getSalarySobId(), salarySob.getId()));
if (CollectionUtils.isEmpty(salaryTemplates)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100518, "没有默认模板,无法发送"));
}
SalaryBillSendDTO salaryBillSendDTO = getSalaryBillService(user).buildSendParams(salarySendPO, taxAgentPO.getName(), salaryTemplates.get(0));
SalaryTemplatePO salaryTemplate = salaryBillSendDTO.getSalaryTemplate();
if (salaryTemplate == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100513, "没有默认模板,无法查看"));
}
// 判断是否是补发
boolean isReplenish = NumberUtils.INTEGER_ONE.equals(salarySendInfo.getSalaryAcctType());
SalaryAcctResultPO acctPo = new SalaryAcctResultPO();
acctPo.setDeleteType(0);
acctPo.setSalaryAcctRecordId(salarySendInfo.getSalaryAcctRecordId());
acctPo.setEmployeeId(recipient);
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(acctPo);
encryptUtil.decryptList(salaryAcctResultPOS, SalaryAcctResultPO.class);
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salarySendInfo.getSalaryAcctRecordId());
if (salaryAcctRecordPO == null) {
throw new SalaryRunTimeException("薪资核算记录不存在!");
}
List<Map<String, Object>> salaryAcctResultS = null;
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE) && !isReplenish) {
// 该记录回算过,并且获取的不是回算后的工资单
salaryAcctResultS = salaryAcctResultPOS.stream().map(m -> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("salaryItemId", m.getSalaryItemId());
map.put("resultValue", m.getOriginResultValue());
return map;
}).collect(Collectors.toList());
} else {
salaryAcctResultS = salaryAcctResultPOS.stream().map(m -> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("salaryItemId", m.getSalaryItemId());
map.put("resultValue", m.getResultValue());
return map;
}).collect(Collectors.toList());
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("tenantName", "");
map.put("sendTime", SalaryDateUtil.getFormatLocalDateTime(salarySendInfo.getSendTime()));
List<SalaryTemplateSalaryItemSetListDTO> listDTOS = JSONArray.parseArray(isReplenish ? salaryTemplate.getReplenishSalaryItemSetting() : salaryTemplate.getSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class);
Optional<SalaryTemplateSalaryItemSetListDTO> optionalEmployeeInformation = listDTOS.stream().filter(e -> SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID.equals(e.getGroupId())).findFirst();
SalaryTemplateSalaryItemSetListDTO employeeInformation = optionalEmployeeInformation.orElse(null);
List<SalaryTemplateSalaryItemSetListDTO> itemSetListDTOS = listDTOS.stream().filter(e -> !SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID.equals(e.getGroupId())).collect(Collectors.toList());
List<Map<String, Object>> finalSalaryAcctResultS = salaryAcctResultS;
itemSetListDTOS.stream().forEach(item -> {
item.getItems()
.forEach(e -> {
if (CollectionUtils.isEmpty(finalSalaryAcctResultS)) {
e.setSalaryItemValue("");
} else {
Object o = finalSalaryAcctResultS.stream()
.filter(f -> f.get("salaryItemId") != null && String.valueOf(f.get("salaryItemId")).equals(e.getSalaryItemId())).findFirst()
.orElse(new HashMap<>())
.get("resultValue");
e.setSalaryItemValue(o == null ? "" : (String) o);
}
});
});
/**
* 过滤空
*/
if (Objects.equals(1, salaryTemplate.getSalaryItemNullStatus())) {
for (SalaryTemplateSalaryItemSetListDTO itemSetListDTO : itemSetListDTOS) {
List<SalaryTemplateSalaryItemListDTO> items = itemSetListDTO.getItems();
List<SalaryTemplateSalaryItemListDTO> collect = items.stream().filter(item -> StringUtils.isNotBlank(item.getSalaryItemValue())).collect(Collectors.toList());
itemSetListDTO.setItems(collect);
}
}
/**
* 过滤0
*/
if (Objects.equals(1, salaryTemplate.getSalaryItemZeroStatus())) {
for (SalaryTemplateSalaryItemSetListDTO itemSetListDTO : itemSetListDTOS) {
List<SalaryTemplateSalaryItemListDTO> items = itemSetListDTO.getItems();
List<SalaryTemplateSalaryItemListDTO> collect = items.stream()
.filter(item -> SalaryEntityUtil.string2BigDecimal(item.getSalaryItemValue()) == null
|| BigDecimal.ZERO.compareTo(SalaryEntityUtil.string2BigDecimal(item.getSalaryItemValue())) != 0)
.collect(Collectors.toList());
itemSetListDTO.setItems(collect);
}
}
DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salarySendInfo.getEmployeeId());
buildEmployeeInfo(employeeInformation, simpleEmployee, taxAgentPO.getName(), SalaryAcctResultBO.buildEmployeeFieldName());
map.put("employeeInformation", employeeInformation);
map.put("salaryGroups", itemSetListDTOS);
salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salarySendPO.getSalaryMonth(), recipient));
// 工资单水印文本型动态变量 == 处理
handleSalaryWatermark(salaryTemplate, salarySendInfo, recipient);
map.put("salaryTemplate", salaryTemplate);
map.put("salaryAcctResult", salaryAcctResultS);
// 工资单确认按钮
if (NumberUtils.compare(salaryTemplate.getAckFeedbackStatus(), 1) == 0) {
// 开启了工资单确认
Integer ackStatus = salarySendInfo.getBillConfirmStatus();
if (ackStatus == null || ackStatus != BillConfimStatusEnum.CONFIRMED.getValue()) {
map.put("showAck", "1");
} else {
map.put("showAck", "0");
}
map.put("sendEmployeeId", salarySendInfo.getSendEmployeeId());
} else {
map.put("showAck", "0");
}
// 工资单反馈
if (NumberUtils.compare(salaryTemplate.getFeedbackStatus(), 1) == 0) {
// 开启了工资单反馈按钮
Integer confirmStatus = salarySendInfo.getBillConfirmStatus();
map.put("showFeedback", "1");
// 除非确认状态为已确认否则可以一直反馈
if (NumberUtils.compare(salaryTemplate.getAckFeedbackStatus(), 1) == 0 && confirmStatus != null && confirmStatus == BillConfimStatusEnum.CONFIRMED.getValue()) {
map.put("showFeedback", "0");
}
map.put("sendEmployeeId", salarySendInfo.getSendEmployeeId());
} else {
map.put("showFeedback", "0");
}
// 记录查看日志
String targetName = taxAgentPO.getName() + "-" + SalaryDateUtil.getFormatYearMonth(salarySendInfo.getSalaryMonth());
LoggerContext<SalaryItemPO> loggerContext = new LoggerContext<>();
loggerContext.setUser(user);
loggerContext.setTargetId(String.valueOf(salarySendInfo.getId()));
loggerContext.setTargetName(targetName);
loggerContext.setOperateType(OperateTypeEnum.READ.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "预览工资单") + ": " + targetName + " " + salaryInfoId);
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "预览工资单") + ": " + targetName);
SalaryElogConfig.mySalaryBillLoggerTemplate.write(loggerContext);
return map;
}
}

View File

@ -424,6 +424,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.defaultValue(itemParam.getDefaultValue())
.build();
salarySobItems.add(salarySobItemPO);
}
@ -467,6 +468,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.defaultValue(itemParam.getDefaultValue())
.build();
salarySobItems.add(salarySobItemPO);
}
@ -488,6 +490,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.defaultValue(itemParam.getDefaultValue())
.build();
getSalarySobItemMapper().updateIgnoreNull(salarySobItemPO);
@ -515,13 +518,13 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needAddItems) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).incomeCategory(incomeCategory).salaryItemId(itemParam.getSalaryItemId()).salaryItemCode(salaryItemPO.getCode()).salarySobItemGroupId(NumberUtils.LONG_ZERO).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).incomeCategory(incomeCategory).salaryItemId(itemParam.getSalaryItemId()).salaryItemCode(salaryItemPO.getCode()).salarySobItemGroupId(NumberUtils.LONG_ZERO).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
salarySobItems.add(salarySobItemPO);
}
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needUpdateItems) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().id(itemParam.getId()).incomeCategory(incomeCategory).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).updateTime(now).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().id(itemParam.getId()).incomeCategory(incomeCategory).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).updateTime(now).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
getSalarySobItemMapper().updateIgnoreNull(salarySobItemPO);
}
@ -647,7 +650,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.setOriginSqlContent(valueType.equals(SalaryValueTypeEnum.SQL.getValue()) ? formulaContent : "")
.setUseInEmployeeSalary(salaryItemPO.getUseInEmployeeSalary())
.setDescription(salarySobItemPO.getDescription())
.setCanEdit((openFormulaForcedEditing || salaryItemPO.getCanEdit().equals(1)) ? 1 : 0);
.setCanEdit((openFormulaForcedEditing || salaryItemPO.getCanEdit().equals(1)) ? 1 : 0)
.setDefaultValue(salarySobItemPO.getDefaultValue());
}
return salarySobItemFormDTO;
}

View File

@ -293,7 +293,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
List<SalarySobRangeImportListDTO> salarySobRangeImportLists = ExcelParseHelper.parse2Map(fileInputStream, SalarySobRangeImportListDTO.class, 0, 1, 5, "SpecialAddDeductionTemplate.xlsx");
List<SalarySobRangeImportListDTO> salarySobRangeImportLists = ExcelParseHelper.parse2Map(fileInputStream, SalarySobRangeImportListDTO.class, 0, 1, 6, "SpecialAddDeductionTemplate.xlsx");
int total = salarySobRangeImportLists.size();
int index = 0;

View File

@ -317,7 +317,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
SalarySobEmpFieldPO empFieldPO = getSalarySobEmpFieldMapper().getById(Long.valueOf(templateItem.getSalaryItemId()));
if (empFieldCodeList.contains(empFieldPO.getFieldCode()) && empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()) != null) {
if (empFieldPO != null && empFieldCodeList.contains(empFieldPO.getFieldCode()) && empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()) != null) {
templateItem.setId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
templateItem.setSalaryItemId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
newItems.add(templateItem);
@ -341,7 +341,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
SalarySobEmpFieldPO empFieldPO = getSalarySobEmpFieldMapper().getById(Long.valueOf(templateItem.getSalaryItemId()));
if (empFieldCodeList.contains(empFieldPO.getFieldCode()) && empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()) != null) {
if (empFieldPO != null && empFieldCodeList.contains(empFieldPO.getFieldCode()) && empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()) != null) {
templateItem.setId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
templateItem.setSalaryItemId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
newItems.add(templateItem);

View File

@ -1,12 +1,13 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.SpecialAddDeductionBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -53,6 +54,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.YearMonth;
import java.util.*;
@ -371,7 +373,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
public XSSFWorkbook export(SpecialAddDeductionQueryParam param, boolean isTemplate) {
//获取操作按钮资源
List<List<String>> rowList = getExcelRowList(param, isTemplate);
List<List<Object>> rowList = getExcelRowList(param, isTemplate);
// 记录操作日志
String name = SalaryI18nUtil.getI18nLabel(0, "导出");
@ -384,7 +386,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
SalaryElogConfig.specialAddDeductionLoggerTemplate.write(loggerContext);
//获取excel
return ExcelUtil.genWorkbook(rowList, "专项附加免税扣除");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "专项附加免税扣除", 2);
}
@ -393,16 +395,16 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
*
* @return 导出数据行集合
*/
private List<List<String>> getExcelRowList(SpecialAddDeductionQueryParam param, boolean isTemplate) {
private List<List<Object>> getExcelRowList(SpecialAddDeductionQueryParam param, boolean isTemplate) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
List<Object> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
if (!isTemplate || param.isHasData()) {
// 非下载导入模版查询数据填充
List<List<String>> dataRowList = queryInfoForExcel(param, rowList);
List<List<Object>> dataRowList = queryInfoForExcel(param, rowList);
rowList.addAll(dataRowList);
}
return rowList;
@ -439,10 +441,10 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(param);
List<List<Object>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList, "专项附加扣除明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "专项附加扣除明细", 2);
}
@ -452,35 +454,35 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(SpecialAddDeductionQueryParam param) {
private List<List<Object>> getExcelRowDetailList(SpecialAddDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
List<Object> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionBiz().listDTOByParam(param);
encryptUtil.decryptList(list, SpecialAddDeductionRecordDTO.class);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getChildrenEducation()));
cellList.add(Util.null2String(dto.getContinuingEducation()));
cellList.add(Util.null2String(dto.getHousingLoanInterest()));
cellList.add(Util.null2String(dto.getHousingRent()));
cellList.add(Util.null2String(dto.getSupportingElder()));
cellList.add(Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(Util.null2String(dto.getInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getChildrenEducation()) ? new BigDecimal(dto.getChildrenEducation()) : Util.null2String(dto.getChildrenEducation()));
cellList.add(NumberUtil.isNumber(dto.getContinuingEducation()) ? new BigDecimal(dto.getContinuingEducation()) : Util.null2String(dto.getContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getHousingLoanInterest()) ? new BigDecimal(dto.getHousingLoanInterest()) : Util.null2String(dto.getHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getHousingRent()) ? new BigDecimal(dto.getHousingRent()) : Util.null2String(dto.getHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getSupportingElder()) ? new BigDecimal(dto.getSupportingElder()) : Util.null2String(dto.getSupportingElder()));
cellList.add(NumberUtil.isNumber(dto.getSeriousIllnessTreatment()) ? new BigDecimal(dto.getSeriousIllnessTreatment()) : Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(NumberUtil.isNumber(dto.getInfantCare()) ? new BigDecimal(dto.getInfantCare()) : Util.null2String(dto.getInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
@ -703,7 +705,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
return null;
}
private List<List<String>> queryInfoForExcel(SpecialAddDeductionQueryParam param, List<List<String>> rowList) {
private List<List<Object>> queryInfoForExcel(SpecialAddDeductionQueryParam param, List<List<Object>> rowList) {
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
param.setOrderRule(orderRule);
@ -712,10 +714,10 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
putQueryRange(param);
}
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionBiz().listByParam(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
@ -723,13 +725,13 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getChildrenEducation()));
cellList.add(Util.null2String(dto.getContinuingEducation()));
cellList.add(Util.null2String(dto.getHousingLoanInterest()));
cellList.add(Util.null2String(dto.getHousingRent()));
cellList.add(Util.null2String(dto.getSupportingElder()));
cellList.add(Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(Util.null2String(dto.getInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getChildrenEducation()) ? new BigDecimal(dto.getChildrenEducation()) : Util.null2String(dto.getChildrenEducation()));
cellList.add(NumberUtil.isNumber(dto.getContinuingEducation()) ? new BigDecimal(dto.getContinuingEducation()) : Util.null2String(dto.getContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getHousingLoanInterest()) ? new BigDecimal(dto.getHousingLoanInterest()) : Util.null2String(dto.getHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getHousingRent()) ? new BigDecimal(dto.getHousingRent()) : Util.null2String(dto.getHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getSupportingElder()) ? new BigDecimal(dto.getSupportingElder()) : Util.null2String(dto.getSupportingElder()));
cellList.add(NumberUtil.isNumber(dto.getSeriousIllnessTreatment()) ? new BigDecimal(dto.getSeriousIllnessTreatment()) : Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(NumberUtil.isNumber(dto.getInfantCare()) ? new BigDecimal(dto.getInfantCare()) : Util.null2String(dto.getInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());

View File

@ -1,7 +1,7 @@
package com.engine.salary.util.excel;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
@ -11,6 +11,7 @@ import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.BeanUtils;
import java.awt.*;
import java.beans.BeanInfo;
@ -18,12 +19,14 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ExcelUtil {
/**
* 生成excel
*
@ -78,6 +81,82 @@ public class ExcelUtil {
return workbook;
}
// 设置默认舍入位数可设为null
public static XSSFWorkbook genWorkbookWithDefaultPattern(List<List<Object>> rowList, String sheetName, Integer defaultPattern) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
XSSFCellStyle numberCellStyle = null;
if (defaultPattern != null) {
XSSFDataFormat df = workbook.createDataFormat();
String start = "0.";
if (defaultPattern.equals(0)) {
start = "0";
}
short format = df.getFormat(start + Stream.generate(() -> "0").limit(defaultPattern).collect(Collectors.joining()) + "_ ");
numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
cell.setCellType(CellType.STRING);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
if (defaultPattern != null) {
cell.setCellStyle(numberCellStyle);
}
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
// sheet.setColumnWidth(cellIndex, 35 * 256);
}
}
return workbook;
}
public static <T> XSSFWorkbook genWorkbook(String sheetName, List<T> rowList) {
List<Object> headerList = Lists.newArrayList();
List<String> dataIndexList = Lists.newArrayList();
@ -158,6 +237,88 @@ public class ExcelUtil {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
}
}
return workbook;
}
// 设置默认舍入位数,可传null
public static XSSFWorkbook genWorkbookV2WithDefaultPattern(List<List<Object>> rowList, String sheetName, Integer defaultPattern) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
XSSFCellStyle numberCellStyle = null;
if (defaultPattern != null) {
XSSFDataFormat df = workbook.createDataFormat();
String start = "0.";
if (defaultPattern.equals(0)) {
start = "0";
}
short format = df.getFormat(start + Stream.generate(() -> "0").limit(defaultPattern).collect(Collectors.joining()) + "_ ");
numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
if (defaultPattern != null) {
cell.setCellStyle(numberCellStyle);
}
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));

View File

@ -74,6 +74,114 @@ public class ExcelUtilPlus {
}
public static XSSFWorkbook genWorkbookV2WithPattern(List<List<Object>> rowList, String sheetName) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setBold(true);
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
titleCellStyle.setBorderLeft(BorderStyle.THIN);
titleCellStyle.setBorderRight(BorderStyle.THIN);
titleCellStyle.setBorderTop(BorderStyle.THIN);
titleCellStyle.setBorderBottom(BorderStyle.THIN);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
//遍历设置列宽
List<Object> header = rowList.get(0);
List<Integer> patternList = new ArrayList<>();
XSSFRow row0 = sheet.createRow(0);
for (int i = 0; i < header.size(); i++) {
WeaTableColumnGroup columnGroupItem = (WeaTableColumnGroup) header.get(i);
XSSFCell rowZeroCell = row0.createCell(i, CellType.STRING);
rowZeroCell.setCellValue(columnGroupItem.getText().toString());
rowZeroCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(i, Math.max(12, columnGroupItem.getText().length() * 4) * 256);
patternList.add(columnGroupItem.getPattern());
}
HashMap<Integer, XSSFCellStyle> numberCellStyleMap = new HashMap<Integer, XSSFCellStyle>();
XSSFDataFormat df = workbook.createDataFormat();
patternList.stream().distinct().filter(a -> a != null).forEach(p -> {
String start = "0.";
if (p == 0) {
start = "0";
}
short format = df.getFormat(start + Stream.generate(() -> "0").limit(p).collect(Collectors.joining()) + "_ ");
XSSFCellStyle numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
numberCellStyleMap.put(p, numberCellStyle);
});
for (int rowIndex = 1; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
float height = 18;
float finalHeight = 18;
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
cell.setCellStyle(numberCellStyleMap.get(patternList.get(cellIndex)));
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
//判断是否要调整高度
int width = sheet.getColumnWidth(cellIndex) / 256;
finalHeight = getFinalHeight(o, width, finalHeight, height);
}
row.setHeightInPoints(finalHeight);
}
return workbook;
}
public static XSSFWorkbook genWorkbookV2(List<List<Object>> rowList, String sheetName) {
XSSFWorkbook workbook = new XSSFWorkbook();
@ -136,6 +244,9 @@ public class ExcelUtilPlus {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -329,6 +440,9 @@ public class ExcelUtilPlus {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -674,6 +788,9 @@ public class ExcelUtilPlus {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));

View File

@ -323,6 +323,20 @@ public class SalaryBillController {
return new ResponseResult<Long, SalarySendBaseInfoDTO>(user).run(getSalarySendWrapper(user)::getBaseInfo, id);
}
/**
* 预览工资单
*
* @param param
* @return
*/
@POST
@Path("/preview")
@Produces(MediaType.APPLICATION_JSON)
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryPreviewParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryPreviewParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::preview, param);
}
/**
* 工资单发放信息列表的高级搜索
*
@ -563,6 +577,7 @@ public class SalaryBillController {
/**
* 下载pdf前先进行校验 生成
*
* @param request
* @param response
* @return

View File

@ -219,6 +219,10 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
return getSalarySendService(user).getBaseInfo(id);
}
public Map<String, Object> preview(SalaryPreviewParam param) {
return getSalarySendService(user).preview(param);
}
/**
* 工资单发放信息列表的高级搜索
*