2022-03-11 11:08:50 +08:00
|
|
|
package com.engine.salary.web;
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ParamUtil;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-03-15 09:55:58 +08:00
|
|
|
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldSettingListDTO;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.*;
|
|
|
|
|
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
|
|
|
|
|
import com.engine.salary.service.AttendQuoteFieldService;
|
|
|
|
|
import com.engine.salary.service.AttendQuoteFieldSettingService;
|
2022-03-11 11:08:50 +08:00
|
|
|
import com.engine.salary.service.AttendQuoteService;
|
2022-03-15 09:55:58 +08:00
|
|
|
import com.engine.salary.service.impl.AttendQuoteFieldServiceImpl;
|
|
|
|
|
import com.engine.salary.service.impl.AttendQuoteFieldSettingServiceImpl;
|
2022-03-11 11:08:50 +08:00
|
|
|
import com.engine.salary.service.impl.AttendQuoteServiceImpl;
|
|
|
|
|
import com.engine.salary.util.ResponseResult;
|
|
|
|
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
2022-03-15 09:55:58 +08:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-03-11 11:08:50 +08:00
|
|
|
import weaver.hrm.HrmUserVarify;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.ws.rs.GET;
|
2022-03-15 09:55:58 +08:00
|
|
|
import javax.ws.rs.POST;
|
2022-03-11 11:08:50 +08:00
|
|
|
import javax.ws.rs.Path;
|
|
|
|
|
import javax.ws.rs.Produces;
|
|
|
|
|
import javax.ws.rs.core.Context;
|
|
|
|
|
import javax.ws.rs.core.MediaType;
|
2022-03-15 09:55:58 +08:00
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.List;
|
2022-03-11 11:08:50 +08:00
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class AttendQuoteController {
|
|
|
|
|
|
|
|
|
|
private AttendQuoteService getService(User user) {
|
|
|
|
|
return (AttendQuoteService) ServiceUtil.getService(AttendQuoteServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
private AttendQuoteFieldService getFieldService(User user) {
|
|
|
|
|
return (AttendQuoteFieldService) ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private AttendQuoteFieldSettingService getFieldSettingService(User user) {
|
|
|
|
|
return (AttendQuoteFieldSettingService) ServiceUtil.getService(AttendQuoteFieldSettingServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-11 11:08:50 +08:00
|
|
|
/**
|
|
|
|
|
* 考勤数据列表
|
|
|
|
|
*/
|
2022-03-15 09:55:58 +08:00
|
|
|
@POST
|
2022-03-11 11:08:50 +08:00
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-11 15:47:08 +08:00
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// * 获取引用考勤表单
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @GetMapping("/getSyncForm")
|
|
|
|
|
// @ApiOperation("获取引用考勤表单")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<WeaForm> getSyncForm() {
|
|
|
|
|
// return WeaResult.success(service.getSyncForm(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 获取薪资周期和考勤周期
|
|
|
|
|
// * @param salaryYearMonth 薪资所属月
|
|
|
|
|
// * @param salarySobId 薪资账套id
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @PostMapping("/getSalaryCycleAndAttendCycle")
|
|
|
|
|
// @ApiOperation("获取薪资周期和考勤周期")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<Map<String, Object>> getSalaryCycleAndAttendCycle(@RequestParam(value = "salaryYearMonth") YearMonth salaryYearMonth, @RequestParam(value = "salarySobId") Long salarySobId) {
|
|
|
|
|
// return WeaResult.success(service.getSalaryCycleAndAttendCycle(salaryYearMonth, salarySobId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 同步引用考勤数据
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @PostMapping("/syncAttendQuoteData")
|
|
|
|
|
// @ApiOperation("同步引用考勤数据")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<String> syncAttendQuoteData(@RequestBody AttendQuoteDataSyncParam syncParam) {
|
|
|
|
|
// return attendQuoteDataService.syncAttendQuoteData(syncParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 获取薪资账套下拉列表
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @GetMapping("/selectSalarySobList")
|
|
|
|
|
// @ApiOperation("获取薪资账套下拉列表")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<List<Map<String, Object>>> selectSalarySobList() {
|
|
|
|
|
// return WeaResult.success(service.selectSalarySobList(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 下载导入模板
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @PostMapping("/downloadTemplate")
|
|
|
|
|
// @ApiOperation("下载导入模板")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<Map<String, Object>> downloadTemplate(@RequestBody AttendQuoteDataExportTemplateParam exportParam) {
|
|
|
|
|
// String currentTenantKey = TenantContext.getCurrentTenantKey();
|
|
|
|
|
// Long currentEmployeeId = UserContext.getCurrentEmployeeId();
|
|
|
|
|
// if (exportParam.getSalaryYearMonth()==null || exportParam.getSalarySobId()==null) {
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100250, "薪资所属月和薪资账套id不能为空"));
|
|
|
|
|
// }
|
|
|
|
|
// return WeaResult.success(attendQuoteDataService.downloadTemplate(exportParam, currentEmployeeId, currentTenantKey));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 获取导入参数
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @GetMapping("/getImportParams")
|
|
|
|
|
// @ApiOperation("获取导入参数")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<ExcelImportParam> getImportParams() {
|
|
|
|
|
// return WeaResult.success(salaryBatchService.buildImportParam("importAttendQuoteData",
|
|
|
|
|
// "importAttendQuoteData",
|
|
|
|
|
// SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 85367, "考勤引用"),
|
|
|
|
|
// null,
|
|
|
|
|
// null));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 查看考勤数据
|
|
|
|
|
// * @param queryParam
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @PostMapping("/view")
|
|
|
|
|
// @ApiOperation("查看")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<WeaTable<LinkedHashMap>> view(@RequestBody AttendQuoteDataQueryParam queryParam) {
|
|
|
|
|
// String currentTenantKey = TenantContext.getCurrentTenantKey();
|
|
|
|
|
// Long currentEmployeeId = UserContext.getCurrentEmployeeId();
|
|
|
|
|
// if (queryParam.getAttendQuoteId() == null) {
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 100253, "考勤引用id不能为空"));
|
|
|
|
|
// }
|
|
|
|
|
// return WeaResult.success(attendQuoteDataService.view(queryParam, currentEmployeeId, currentTenantKey));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 删除考勤数据
|
|
|
|
|
// * @param ids
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @PostMapping("/delete")
|
|
|
|
|
// @ApiOperation("删除")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<String> delete(@RequestBody Collection<Long> ids) {
|
|
|
|
|
// String currentTenantKey = TenantContext.getCurrentTenantKey();
|
|
|
|
|
// Long currentEmployeeId = UserContext.getCurrentEmployeeId();
|
|
|
|
|
// if (CollectionUtils.isEmpty(ids)) {
|
|
|
|
|
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 84026, "参数错误"));
|
|
|
|
|
// }
|
|
|
|
|
// return service.delete(ids, currentEmployeeId, currentTenantKey);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 导出考勤数据
|
|
|
|
|
// * @param queryParam
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @PostMapping("/export")
|
|
|
|
|
// @ApiOperation("导出考勤数据")
|
|
|
|
|
// @WeaPermission
|
|
|
|
|
// public WeaResult<Map<String, Object>> export(@RequestBody AttendQuoteDataQueryParam queryParam) {
|
|
|
|
|
// String currentTenantKey = TenantContext.getCurrentTenantKey();
|
|
|
|
|
// Long currentEmployeeId = UserContext.getCurrentEmployeeId();
|
|
|
|
|
// if (queryParam.getAttendQuoteId() == null) {
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 100253, "考勤引用id不能为空"));
|
|
|
|
|
// }
|
|
|
|
|
// return WeaResult.success(attendQuoteDataService.export(queryParam, currentEmployeeId, currentTenantKey));
|
|
|
|
|
// }
|
|
|
|
|
//
|
2022-03-15 09:55:58 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 考勤字段管理列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/fieldList")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String fieldList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldQueryParam queryParam) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
Map<String, Object> map = ParamUtil.request2Map(request);
|
|
|
|
|
map.put("queryParam", queryParam);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldQueryParam, Map<String, Object>>().run(getFieldService(user)::list, queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 同步考勤模块字段
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/syncAttendFields")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String syncAttendFields(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<Long, String>().run(getFieldService(user)::syncAttendFields, (long) user.getUID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取考勤字段表单
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/getFieldForm")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String getFieldForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
String idStr = request.getParameter("id");
|
|
|
|
|
Long id = null;
|
|
|
|
|
if (StringUtils.isNotBlank(idStr)) {
|
|
|
|
|
id = Long.parseLong(request.getParameter("id"));
|
|
|
|
|
}
|
|
|
|
|
return new ResponseResult<Long, AttendQuoteFieldPO>().run(getFieldService(user)::getFrom, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新建考勤字段
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/saveField")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String saveField(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSaveParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSaveParam, String>().run(getFieldService(user)::save, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改考勤字段
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/updateField")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String updateField(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSaveParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSaveParam, String>().run(getFieldService(user)::update, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除考勤字段
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/deleteField")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String deleteField(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<Collection<Long>, String>().run(getFieldService(user)::delete, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 启用/停用自定义字段
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/updateEnableStatus")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String updateEnableStatus(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSaveParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSaveParam, String>().run(getFieldService(user)::updateEnableStatus, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据采集-考勤引用字段设置列表
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/fieldSetting/list")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String fieldSettingList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSettingQueryParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSettingQueryParam, List<AttendQuoteFieldSettingListDTO>>().run(getFieldSettingService(user)::list, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据采集-考勤引用字段设置保存
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/fieldSetting/save")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String fieldSettingSave(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSettingSaveParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSettingSaveParam, String>().run(getFieldSettingService(user)::save, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据采集-考勤引用字段设置-恢复默认设置
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/fieldSetting/recoverAsDefault")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String fieldSettingRecoverAsDefault(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSettingRecoverParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSettingRecoverParam, List<AttendQuoteFieldSettingListDTO>>().run(getFieldSettingService(user)::recoverAsDefault, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据采集-考勤引用字段设置-设为默认设置
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@POST
|
|
|
|
|
@Path("/fieldSetting/saveAsDefault")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String fieldSettingSaveAsDefault(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteFieldSettingSaveParam param) {
|
|
|
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
|
|
|
return new ResponseResult<AttendQuoteFieldSettingSaveParam, String>().run(getFieldSettingService(user)::saveAsDefault, param);
|
|
|
|
|
}
|
2022-03-11 15:47:08 +08:00
|
|
|
|
2022-03-11 11:08:50 +08:00
|
|
|
}
|