日期转换

This commit is contained in:
钱涛 2022-03-08 16:35:05 +08:00
parent 9de0f08415
commit a190dc439d
6 changed files with 61 additions and 58 deletions

View File

@ -122,10 +122,10 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
List<String> declareMonths = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonths)) {
if (declareMonths.size() == 1) {
sqlWhere += " AND t1.declare_month = " + declareMonths.get(0);
sqlWhere += " AND t1.declare_month = '" + declareMonths.get(0)+",";
}
if (declareMonths.size() == 2) {
sqlWhere += " AND (t1.declare_month BETWEEN " + declareMonths.get(0) + " AND " + declareMonths.get(1) + ")";
sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonths.get(0) + "' AND '" + declareMonths.get(1) + "')";
}
}
//姓名

View File

@ -48,7 +48,7 @@ public class AddUpDeductionGetSearchConditionCmd extends AbstractCommonCommand<M
conditionItems.add(username);
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"departmentName","124");
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"departmentName","4");
departmentName.setColSpan(2);
departmentName.setFieldcol(12);
departmentName.setLabelcol(6);

View File

@ -99,10 +99,10 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand<Map<String, Obj
List<String> declareMonths = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonths)) {
if (declareMonths.size() == 1) {
sqlWhere += " AND t1.declare_month = " + declareMonths.get(0);
sqlWhere += " AND t1.declare_month = '" + declareMonths.get(0)+"'";
}
if (declareMonths.size() == 2) {
sqlWhere += " AND (t1.declare_month BETWEEN " + declareMonths.get(0) + " AND " + declareMonths.get(1) + ")";
sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonths.get(0) + "' AND '" + declareMonths.get(1) + "')";
}
}
//姓名
@ -129,7 +129,7 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand<Map<String, Obj
//入职日期
List<Date> hiredate = queryParam.getHiredate();
if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) {
sqlWhere += " AND (e.created BETWEEN "+hiredate.get(0)+" AND "+hiredate.get(1)+")";
sqlWhere += " AND (e.created BETWEEN '"+hiredate.get(0)+"' AND '"+hiredate.get(1)+"')";
}
//手机号
String mobile = queryParam.getMobile();

View File

@ -1,21 +1,20 @@
package com.engine.salary.cmd.datacollection;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.pc.table.WeaTableOperate;
import com.cloudstore.eccom.pc.table.WeaTableOperates;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionListDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.PageIdConst;
import weaver.hrm.User;
import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Object>> {
@ -54,19 +53,7 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
" LEFT JOIN hrmresource e ON t1.employee_id = e.id" +
" LEFT JOIN hrmdepartment d ON e.departmentid = d.id";
Map<String, Object> apidatas = new HashMap<String, Object>(16);
WeaResultMsg result = new WeaResultMsg(false);
String pageID = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8";
String pageUid = pageID + "_" + user.getUID();
String pageSize = PageIdConst.getPageSize(pageID, user.getUID());
WeaTable table = new WeaTable();
table.setPageUID(pageUid);
table.setPageID(pageID);
table.setPagesize(pageSize);
SalaryWeaTable<AddUpDeductionListDTO> table = new SalaryWeaTable<AddUpDeductionListDTO>(user, AddUpDeductionListDTO.class);
table.setBackfields(fileds);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
@ -74,30 +61,10 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
table.getColumns().add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE));
table.getColumns().add(new WeaTableColumn("10%", "姓名", "username", ""));
table.getColumns().add(new WeaTableColumn("10%", "个税扣缴义务人", "taxAgentName", ""));
table.getColumns().add(new WeaTableColumn("10%", "部门", "departmentName", ""));
table.getColumns().add(new WeaTableColumn("10%", "手机号", "mobile", ""));
table.getColumns().add(new WeaTableColumn("10%", "工号", "jobNum", ""));
table.getColumns().add(new WeaTableColumn("10%", "证件号码", "idNo", ""));
table.getColumns().add(new WeaTableColumn("10%", "入职日期", "hiredate", ""));
table.getColumns().add(new WeaTableColumn("20%", "操作", "operate", ""));
List<WeaTableOperate> operateList = new ArrayList<>();
WeaTableOperate delete = new WeaTableOperate("删除", "", "0");
operateList.add(delete);
WeaTableOperates weaTableOperates = new WeaTableOperates();
weaTableOperates.setOperate(operateList);
table.setOperates(weaTableOperates);
//设置check是否可用
table.setCheckboxList(null);
table.setCheckboxpopedom(null);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
apidatas = result.getResultMap();
return apidatas;
return result.getResultMap();
}
@ -132,10 +99,10 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
List<String> declareMonths = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonths)) {
if (declareMonths.size() == 1) {
sqlWhere += " AND t1.declare_month = " + declareMonths.get(0);
sqlWhere += " AND t1.declare_month = '" + declareMonths.get(0)+"'";
}
if (declareMonths.size() == 2) {
sqlWhere += " AND (t1.declare_month BETWEEN " + declareMonths.get(0) + " AND " + declareMonths.get(1) + ")";
sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonths.get(0) + "' AND '" + declareMonths.get(1) + "')";
}
}
//姓名
@ -162,7 +129,7 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
//入职日期
List<Date> hiredate = queryParam.getHiredate();
if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) {
sqlWhere += " AND (e.created BETWEEN "+hiredate.get(0)+" AND "+hiredate.get(1)+")";
sqlWhere += " AND (e.created BETWEEN '"+hiredate.get(0)+"' AND '"+hiredate.get(1)+"')";
}
//手机号
String mobile = queryParam.getMobile();
@ -172,6 +139,4 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
return sqlWhere;
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.util.excel.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -28,6 +29,7 @@ public class AddUpDeductionRecordDTO {
//申报月份
@JsonFormat(pattern = "yyyy-MM")
@SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate",transmethod="com.engine.salary.transmethod.TransMethod.timeToMoth")
private Date declareMonth;
//个税扣缴义务人
@ -49,18 +51,41 @@ public class AddUpDeductionRecordDTO {
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
private String jobNum;
//累计子女教育
/**
* 累计子女教育
*/
@ExcelProperty(index = 7)
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
private BigDecimal addUpChildEducation;
//累计继续教育
/**
* 累计继续教育
*/
@ExcelProperty(index = 8)
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
private BigDecimal addUpContinuingEducation;
//累计住房贷款利息
/**
* 累计住房贷款利息
*/
@ExcelProperty(index = 9)
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
private BigDecimal addUpHousingLoanInterest;
//累计住房租金
/**
* 累计住房租金
*/
@ExcelProperty(index = 10)
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
private BigDecimal addUpHousingRent;
//累计赡养老人
/**
* 累计赡养老人
*/
@ExcelProperty(index = 11)
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
private BigDecimal addUpSupportElderly;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;
}

View File

@ -18,4 +18,17 @@ public class TransMethod {
}
return format;
}
public static String timeToMoth(String time) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = "";
try {
Date parse = timeFormat.parse(time);
format = dateFormat.format(parse);
} catch (ParseException e) {
e.printStackTrace();
}
return format;
}
}