Merge branch 'feature/qt' into develop

This commit is contained in:
钱涛 2022-03-11 11:09:16 +08:00
commit d601f2fd59
12 changed files with 552 additions and 5 deletions

View File

@ -0,0 +1,8 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/attendQuote")
public class AttendQuoteController extends com.engine.salary.web.AddUpDeductionController{
}

View File

@ -5,8 +5,10 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.AddUpDeductionBiz;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
@ -32,6 +34,7 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
@Override
public Map<String, Object> execute(CommandContext commandContext) {
EmployBiz employBiz = new EmployBiz();
AddUpDeductionBiz biz = new AddUpDeductionBiz();
AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("queryParam");
@ -49,10 +52,10 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
throw new SalaryRunTimeException(String.format("累计专项附加扣除不存在[id:%s]", id));
}
// List<SimpleEmployee> employeeList = employeeService.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()), tenantKey);
// if (CollectionUtils.isEmpty(employeeList)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100340, "员工信息不存在"));
// }
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
queryParam.setEmployeeId(po.getEmployeeId());

View File

@ -4,9 +4,14 @@ 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.biz.AddUpSituationBiz;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
@ -29,6 +34,30 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand<Map<St
@Override
public Map<String, Object> execute(CommandContext commandContext) {
EmployBiz employBiz = new EmployBiz();
AddUpSituationBiz biz = new AddUpSituationBiz();
AddUpSituationQueryParam queryParam = (AddUpSituationQueryParam) params.get("queryParam");
if (queryParam == null) {
throw new SalaryRunTimeException("参数异常");
}
Long id = queryParam.getAccumulatedSituationId();
if (id == null) {
throw new SalaryRunTimeException("累计情况id不能为空");
}
AddUpSituation po = biz.getById(id);
if (po == null) {
throw new SalaryRunTimeException(String.format("累计情况不存在[id:%s]", id));
}
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
String fields = " t1.id," +
" t1.tax_year_month," +
" t1.employee_id as employeeId," +

View File

@ -0,0 +1,152 @@
package com.engine.salary.cmd.datacollection;
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.AddUpDeductionDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class AttendQuoteListCmd extends AbstractCommonCommand<Map<String, Object>> {
public AttendQuoteListCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
AttendQuoteQueryParam queryParam = (AttendQuoteQueryParam) params.get("queryParam");
List<String> declareMonth = queryParam.getSalaryYearMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String fields = " t1.id," +
" t1.declare_month as declareMonth," +
" t1.employee_id as employeeId," +
" e.lastname as username," +
" d.departmentname AS departmentName," +
" e.mobile," +
" e.workcode as jobNum," +
" e.companystartdate as hiredate," +
" t2.name AS taxAgentName," +
" t1.add_up_child_education as addUpChildEducation," +
" t1.add_up_continuing_education as addUpContinuingEducation," +
" t1.add_up_housing_loan_interest as addUpHousingLoanInterest," +
" t1.add_up_housing_rent as addUpHousingRent," +
" t1.add_up_support_elderly as addUpSupportElderly";
String fromSql = " FROM" +
" hrsa_add_up_deduction t1" +
" LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id" +
" LEFT JOIN hrmresource e ON t1.employee_id = e.id" +
" LEFT JOIN hrmdepartment d ON e.departmentid = d.id";
SalaryWeaTable<AddUpDeductionDTO> table = new SalaryWeaTable<AddUpDeductionDTO>(user, AddUpDeductionDTO.class);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
table.setSqlorderby("t1.id DESC");
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
}
private String makeSqlWhere() {
AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("queryParam");
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0";
Collection<Long> ids = queryParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {
String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(","));
sqlWhere += " AND t1.id IN (" + idsStr + ")";
}
Long employeeId = queryParam.getEmployeeId();
if (employeeId != null) {
sqlWhere += " AND t1.employee_id =" + employeeId;
}
String keyword = queryParam.getKeyword();
if (StringUtils.isNotBlank(keyword)) {
sqlWhere += " AND (" +
" e.lastname like '%" + keyword + "%'" +
" OR d.departmentname like '%" + keyword + "%'" +
" OR e.workcode like ''%" + keyword + "%'" +
" )";
}
// 申报月份
List<String> declareMonths = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonths)) {
if (declareMonths.size() == 1) {
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) + "')";
}
}
//姓名
String username = queryParam.getUsername();
if (StringUtils.isNotBlank(username)) {
sqlWhere += " AND e.lastname like '%" + username + "%'";
}
//个税扣缴义务人
Long taxAgentId = queryParam.getTaxAgentId();
if (taxAgentId != null) {
sqlWhere += " AND t1.tax_agent_id = " + taxAgentId;
}
//部门
List<Long> departmentIds = queryParam.getDepartmentIds();
if (CollectionUtils.isNotEmpty(departmentIds)) {
String departmentStrIds = departmentIds.stream().map(String::valueOf).collect(Collectors.joining(","));
sqlWhere += " AND d.id IN (" + departmentStrIds + ")";
}
//工号
String jobNum = queryParam.getJobNum();
if (StringUtils.isNotBlank(jobNum)) {
sqlWhere += " AND e.workcode like '%" + jobNum + "%'";
}
//入职日期
List<Date> hiredate = queryParam.getHiredate();
if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) {
sqlWhere += " AND (e.companystartdate BETWEEN '" + hiredate.get(0) + "' AND '" + hiredate.get(1) + "')";
}
//手机号
String mobile = queryParam.getMobile();
if (StringUtils.isNotBlank(mobile)) {
sqlWhere += " AND e.mobile like '%" + mobile + "%'";
}
return sqlWhere;
}
}

View File

@ -0,0 +1,64 @@
package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 数据采集-考勤引用列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "a4f852o1-e3f9-7841-adn9-7d06e54y6rj8", operates = {
@SalaryTableOperate(text = "查看", index = "0"),
@SalaryTableOperate(text = "删除", index = "1")
})
public class AttendQuoteListDTO {
@SalaryTableColumn(column = "id", display = false)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@SalaryTableColumn(text = "薪资所属月", width = "10%", column = "salaryYearMonth", transmethod = "com.engine.salary.transmethod.TransMethod.timeToMoth")
@JsonFormat(pattern = "yyyy-MM")
private Date salaryYearMonth;
@SalaryTableColumn(text = "关联账套", width = "10%", column = "salarySobName")
private String salarySobName;
@SalaryTableColumn(text = "考勤周期", width = "10%", column = "attendCycle")
private String attendCycle;
@SalaryTableColumn(text = "来源", width = "10%", column = "sourceType")
private String sourceType;
@SalaryTableColumn(text = "薪资周期", width = "10%", column = "salaryCycle")
private String salaryCycle;
@SalaryTableColumn(text = "操作人", width = "10%", column = "creator")
private String creator;
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
private String description;
/**
* 薪资核算状态0未核算1已核算
*/
private Integer salaryAccountingStatus;
}

View File

@ -0,0 +1,29 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.List;
/**
* 数据采集-考勤引用查询参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuoteQueryParam {
private Collection<Long> ids;
//薪资所属月
private List<String> salaryYearMonth;
}

View File

@ -0,0 +1,79 @@
package com.engine.salary.entity.datacollection.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 考勤引用表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuote {
/**
* 主键
*/
private Long id;
/**
* 税款所属期
*/
private Date salaryYearMonth;
/**
* 年份
*/
private Integer year;
/**
* 月份
*/
private Integer month;
/**
* 薪资账套表的主键id
*/
private Long salarySobId;
/**
* 来源1引用2导入
*/
private Integer sourceType;
/**
* 薪资核算状态0未核算1已核算
*/
private Integer salaryAccountingStatus;
/**
* 考勤周期
*/
private String attendCycle;
/**
* 薪资周期
*/
private String salaryCycle;
/**
* 备注
*/
private String description;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private Long creator;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
/**
* 租户ID
*/
private String tenantKey;
}

View File

@ -0,0 +1,83 @@
package com.engine.salary.entity.datacollection.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 薪资帐套表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySob {
/**
* 主键id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 应税项目1:正常工资薪金所得
*/
private Byte incomeCategory;
/**
* 薪资周期1:上上月2:上月3:本月4:下月
*/
private Byte salaryCycleType;
/**
* 薪资周期的起始日期
*/
private Byte salaryCycleFromDay;
/**
* 税款所属期1:上上月2:上月3:本月4:下月
*/
private Byte taxCycleType;
/**
* 考勤周期1:上上月2:上月3:本月4:下月
*/
private Byte attendCycleType;
/**
* 考勤周期的起始日期
*/
private Byte attendCycleFromDay;
/**
* 社保福利所属期1:上上月2:上月3:本月4:下月
*/
private Byte socialSecurityCycleType;
/**
* 是否禁用0正常使用1禁用
*/
private Byte disable;
/**
* 描述
*/
private String description;
/**
* 创建人
*/
private Long creator;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
/**
* 租户ID
*/
private String tenantKey;
}

View File

@ -0,0 +1,44 @@
package com.engine.salary.service;
import java.util.Map;
public interface AttendQuoteService {
/**
* 数据采集-考勤引用列表
*/
Map<String, Object> list(Map<String, Object> params);
// /**
// * 删除数据采集-考勤引用
// * @param ids
// * @param employeeId
// * @param tenantKey
// * @return
// */
// WeaResult<String> delete(Collection<Long> ids, Long employeeId, String tenantKey);
//
// /**
// * 获取引用考勤表单
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// WeaForm getSyncForm(Long currentEmployeeId, String currentTenantKey);
//
// /**
// * 获取薪资周期和考勤周期
// * @param salaryYearMonth
// * @param salarySobId
// * @param currentTenantKey
// * @return
// */
// Map<String, Object> getSalaryCycleAndAttendCycle(YearMonth salaryYearMonth, Long salarySobId, Long currentEmployeeId, String currentTenantKey);
//
// /**
// * 获取薪资账套下拉列表
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// List<Map<String, Object>> selectSalarySobList(Long currentEmployeeId, String currentTenantKey);
}

View File

@ -0,0 +1,15 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.cmd.datacollection.AttendQuoteListCmd;
import com.engine.salary.service.AttendQuoteService;
import java.util.Map;
public class AttendQuoteServiceImpl extends Service implements AttendQuoteService {
@Override
public Map<String, Object> list(Map<String, Object> params) {
return commandExecutor.execute(new AttendQuoteListCmd(params, user));
}
}

View File

@ -63,7 +63,7 @@ public class AddUpSituationController {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", queryParam);
return ResponseResult.run(getService(user)::list, ParamUtil.request2Map(request));
return ResponseResult.run(getService(user)::list, map);
}

View File

@ -0,0 +1,41 @@
package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
import com.engine.salary.service.AttendQuoteService;
import com.engine.salary.service.impl.AttendQuoteServiceImpl;
import com.engine.salary.util.ResponseResult;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
public class AttendQuoteController {
private AttendQuoteService getService(User user) {
return (AttendQuoteService) ServiceUtil.getService(AttendQuoteServiceImpl.class, user);
}
/**
* 考勤数据列表
*/
@GET
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", queryParam);
return ResponseResult.run(getService(user)::list, map);
}
}