You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
7.3 KiB
Java
158 lines
7.3 KiB
Java
2 weeks ago
|
package com.engine.qdhx.cmd;
|
||
|
|
||
|
import com.cloudstore.dev.api.util.Util_DataCache;
|
||
|
import com.engine.common.biz.AbstractCommonCommand;
|
||
|
import com.engine.common.entity.BizLogContext;
|
||
|
import com.engine.core.interceptor.CommandContext;
|
||
|
import com.engine.qdhx.entity.HrmSalaryEntity;
|
||
|
import com.weaver.general.TimeUtil;
|
||
|
import weaver.conn.RecordSet;
|
||
|
import weaver.conn.RecordSetTrans;
|
||
|
import weaver.general.Util;
|
||
|
import weaver.hrm.User;
|
||
|
|
||
|
import java.time.LocalDate;
|
||
|
import java.time.format.DateTimeFormatter;
|
||
|
import java.util.*;
|
||
|
|
||
|
/**
|
||
|
* @Author weaver_cl
|
||
|
* @Description: TODO
|
||
|
* @Date 2022/2/22
|
||
|
* @Version V1.0
|
||
|
**/
|
||
|
public class HrmSalarySaveReportCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||
|
|
||
|
private static final int FORMMODEID = 6;
|
||
|
|
||
|
public HrmSalarySaveReportCmd(User user, Map<String,Object> params) {
|
||
|
this.user = user;
|
||
|
this.params = params;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public BizLogContext getLogContext() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||
|
Map<String, Object> apidatas = new HashMap<>();
|
||
|
RecordSet rs = new RecordSet();
|
||
|
RecordSetTrans rst = new RecordSetTrans();
|
||
|
try {
|
||
|
rst.setAutoCommit(false);
|
||
|
int userid = user.getUID();
|
||
|
//查看范围(总部 分部 部门只做插入 人员可更新数据)
|
||
|
String viewscope = Util.null2String(params.get("viewscope"));
|
||
|
String fromDate = Util.null2String(params.get("fromDate"));
|
||
|
LocalDate start = LocalDate.parse(fromDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||
|
int year = start.getYear();
|
||
|
int month = start.getMonthValue();
|
||
|
|
||
|
rs.executeQuery("select count(1) as count from uf_xztz where year = ? and month = ?",year,month);
|
||
|
rs.next();
|
||
|
int count = Util.getIntValue(rs.getString("count"));
|
||
|
|
||
|
if (count >= 1 ){
|
||
|
if ("0".equals(viewscope)) {
|
||
|
//保存总部数据时先删除台账数据
|
||
|
rs.executeUpdate("delete from uf_xztz where year = ? and month = ?",year,month);
|
||
|
}else {
|
||
|
apidatas.put("message", "台账数据已存在");
|
||
|
return apidatas;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
List scheduleList = null;
|
||
|
Util_DataCache dataCache = new Util_DataCache();
|
||
|
|
||
|
String currentDateString = TimeUtil.getCurrentDateString();
|
||
|
String currentTimeString = TimeUtil.getOnlyCurrentTimeString();
|
||
|
|
||
|
List<List<Object>> list = new LinkedList<>();
|
||
|
|
||
|
scheduleList = (List) dataCache.getObjValWithEh("salaryScheduleList");
|
||
|
scheduleList.forEach(value -> {
|
||
|
HrmSalaryEntity hrmSalaryEntity = (HrmSalaryEntity)value;
|
||
|
List<Object> hrmSalaryEntityList = Arrays.asList(hrmSalaryEntity.getPlace(),
|
||
|
hrmSalaryEntity.getDeptId(),
|
||
|
hrmSalaryEntity.getCostcode(),
|
||
|
hrmSalaryEntity.getWorkcode(),
|
||
|
hrmSalaryEntity.getUserid(),
|
||
|
hrmSalaryEntity.getCompanystartdate(),
|
||
|
hrmSalaryEntity.getDismissdate(),
|
||
|
hrmSalaryEntity.getBankAccount(),
|
||
|
hrmSalaryEntity.getTaxId(),
|
||
|
hrmSalaryEntity.getRealBasicSalary(),
|
||
|
hrmSalaryEntity.getRealOvertimePay(),
|
||
|
hrmSalaryEntity.getOvertimePayG1(),
|
||
|
hrmSalaryEntity.getOvertimePayG2(),
|
||
|
hrmSalaryEntity.getOvertimePayG3(),
|
||
|
hrmSalaryEntity.getBirthdayCashgift(),
|
||
|
hrmSalaryEntity.getMerryCashgift(),
|
||
|
hrmSalaryEntity.getFuneralCashgift(),
|
||
|
hrmSalaryEntity.getFestivalCashgift(),
|
||
|
hrmSalaryEntity.getPreventHeatAllowance(),
|
||
|
hrmSalaryEntity.getHighTemperatureSubsidy(),
|
||
|
hrmSalaryEntity.getCommunicatySubsidy(),
|
||
|
hrmSalaryEntity.getShiftAllowance(),
|
||
|
hrmSalaryEntity.getStandAllowance(),
|
||
|
hrmSalaryEntity.getAchievementonus(),
|
||
|
hrmSalaryEntity.getAbroadInsuranceSubsidy(),
|
||
|
hrmSalaryEntity.getOtherItem1(),
|
||
|
hrmSalaryEntity.getOtherItem2(),
|
||
|
hrmSalaryEntity.getHouseSubsidy(),
|
||
|
hrmSalaryEntity.getSpecialAward(),
|
||
|
hrmSalaryEntity.getSignMoney(),
|
||
|
hrmSalaryEntity.getMeritsPay(),
|
||
|
hrmSalaryEntity.getAnnualBonus(),
|
||
|
hrmSalaryEntity.getOmpensation(),
|
||
|
hrmSalaryEntity.getAttendanceDeduction(),
|
||
|
hrmSalaryEntity.getOtherDeduction(),
|
||
|
hrmSalaryEntity.getTaxable(),
|
||
|
hrmSalaryEntity.getShouldSendTotal(),
|
||
|
hrmSalaryEntity.getCostWithhold(),
|
||
|
hrmSalaryEntity.getMealWithhold(),
|
||
|
hrmSalaryEntity.getEndowmentInsurance(),
|
||
|
hrmSalaryEntity.getMedicalInsurance(),
|
||
|
hrmSalaryEntity.getUnemploymentInsurance(),
|
||
|
hrmSalaryEntity.getHouseProvident(),
|
||
|
hrmSalaryEntity.getIndividualIncomeTax(),
|
||
|
hrmSalaryEntity.getActuallySendTotal(),
|
||
|
year,
|
||
|
month,
|
||
|
userid,
|
||
|
currentDateString,
|
||
|
currentTimeString,
|
||
|
FORMMODEID);
|
||
|
list.add(hrmSalaryEntityList);
|
||
|
});
|
||
|
|
||
|
if (count == 1 && "3".equals(viewscope)){ //人员数据更新
|
||
|
apidatas.put("message","台账数据更新成功");
|
||
|
|
||
|
}else {
|
||
|
rst.executeBatchSql("insert into uf_xztz(place,deptId,costcode,workcode," +
|
||
|
"lastname,companystartdate,dismissdate,bankAccount,taxId,realBasicSalary,realOvertimePay,overtimePayG1," +
|
||
|
"overtimePayG2,overtimePayG3,birthdayCashgift,merryCashgift," +
|
||
|
"funeralCashgift,festivalCashgift,preventHeatAllowance,highTemperatureSubsidy," +
|
||
|
"communicatySubsidy,shiftAllowance,StandAllowance,achievementonus,abroadInsuranceSubsidy," +
|
||
|
"otherItem1,otherItem2,houseSubsidy,specialAward,signMoney,meritsPay,annualBonus," +
|
||
|
"ompensation,attendanceDeduction,otherDeduction,taxable,shouldSendTotal,costWithhold,mealWithhold," +
|
||
|
"endowmentInsurance,medicalInsurance,unemploymentInsurance,houseProvident,individualIncomeTax," +
|
||
|
"actuallySendTotal,year,month,modedatacreater,modedatacreatedate,modedatacreatetime,formmodeid) values(?,?,?,?,?,?," +
|
||
|
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
|
||
|
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",list);
|
||
|
apidatas.put("message","台账数据插入成功");
|
||
|
}
|
||
|
|
||
|
rst.commit();
|
||
|
}catch (Exception e){
|
||
|
rst.rollback();
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
return apidatas;
|
||
|
}
|
||
|
}
|