Commit facc1a6f by 284718418@qq.com

导入/导出假期余额

parent dcff51c4
...@@ -9,13 +9,30 @@ import java.util.Date; ...@@ -9,13 +9,30 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.timer.api.aspect.lang.annotation.Log; import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType; import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.dzht.DzhtAssoMbzj; import cn.timer.api.bean.dzht.DzhtAssoMbzj;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.config.exception.Regular;
import cn.timer.api.config.validation.ValidList;
import cn.timer.api.dto.kqmk.*;
import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.utils.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -23,6 +40,7 @@ import org.springframework.http.HttpHeaders; ...@@ -23,6 +40,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
...@@ -96,52 +114,10 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper; ...@@ -96,52 +114,10 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper;
import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper; import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper;
import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper; import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttMemberSettings;
import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.AttendanceMachineStatus;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.AttstateDate;
import cn.timer.api.dto.kqmk.BalanceSheetDataDto;
import cn.timer.api.dto.kqmk.CalendarDetailsDto;
import cn.timer.api.dto.kqmk.CalendarPunchDetailsDto;
import cn.timer.api.dto.kqmk.CalendarTableDataDto;
import cn.timer.api.dto.kqmk.ChangePunchResultsDto;
import cn.timer.api.dto.kqmk.CompensateDto;
import cn.timer.api.dto.kqmk.DailyDetailsDto;
import cn.timer.api.dto.kqmk.DetailsofbusinessDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto;
import cn.timer.api.dto.kqmk.JiaqibalanceDto;
import cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoMonthPunchSummaryDto;
import cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglAssoRulesViceDto;
import cn.timer.api.dto.kqmk.KqglMainKqzDto;
import cn.timer.api.dto.kqmk.KqzAttendanceGroupSearchDto;
import cn.timer.api.dto.kqmk.LeaveTypeDto;
import cn.timer.api.dto.kqmk.MachinememberDto;
import cn.timer.api.dto.kqmk.ModifyEmployeeBalanceDto;
import cn.timer.api.dto.kqmk.OriginalRecordDto;
import cn.timer.api.dto.kqmk.ResttryfixdayDto;
import cn.timer.api.dto.kqmk.SetConditionsDto;
import cn.timer.api.dto.kqmk.StartTimeRestDto;
import cn.timer.api.dto.kqmk.UserAttendanceRelDto;
import cn.timer.api.dto.kqmk.VacationInformationDto;
import cn.timer.api.dto.kqmk.WorkbenchCalendarDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Slf4j
@Api(tags = "3.0[1]考勤模块") @Api(tags = "3.0[1]考勤模块")
@RestController @RestController
@Transactional @Transactional
...@@ -1781,6 +1757,83 @@ public class TimeCardController { ...@@ -1781,6 +1757,83 @@ public class TimeCardController {
return ResultUtil.data(pageAs, sumlist, "操作成功!"); return ResultUtil.data(pageAs, sumlist, "操作成功!");
} }
@PostMapping(value = "/export_leave_balance")
@ApiOperation(value = "导出假期余额列表数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> ExportLeaveBalance(@CurrentUser UserBean userBean, @Validated @RequestBody AttqueryCriteriaDto attquerycriteriadto) {
attquerycriteriadto.setOrgCode(userBean.getOrgCode());
attquerycriteriadto.setEmpNum(userBean.getEmpNum());
List<ExportEmployeeLeaveBalanceDto> list = kqglassoleavebalancemapper.selectLeaveBalance(attquerycriteriadto);
for(ExportEmployeeLeaveBalanceDto endo : list) {
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getEmpnum())
.eq(KqglAssoLeaveEmployeeBalance::getOrgCode, endo.getOrgcode()));
List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
for(KqglAssoLeaveEmployeeBalance empyes : empye) {
BalanceSheetDataDto bal = BalanceSheetDataDto.builder().build();
bal.setBalancedays(empyes.getBalanceDays());
bal.setLeaverulesid(empyes.getLeaveRulesId());
balanceTo.add(bal);
}
endo.setBalanceTo(balanceTo);
}
return ResultUtil.data(list, "操作成功!");
}
/**
* 导入假期余额数据
*/
@PostMapping(value = "/import_leave_balance")
@ApiOperation(value = "导入假期余额数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> importLeaveBalance(@CurrentUser UserBean userBean,
@RequestBody Object o) throws Exception {
Integer orgCode = userBean.getOrgCode();
JSONArray jsonArray = (JSONArray)o;
for (Object object :jsonArray) {
JSONObject jsonObject = (JSONObject)object;
String empnum = jsonObject.get("empnum").toString();
for (Map.Entry<String, Object> entity:jsonObject.entrySet()) {
log.info("entity key:{},vlue{}",entity.getKey(),entity.getValue());
if("empnum".equals(entity.getKey())){
}else if("department".equals(entity.getKey())){
}else{
Integer leaveRulesId = Integer.parseInt(entity.getKey());
double balanceDays = 0;
if(StringUtils.isEmpty(entity.getValue())){
continue;
}else {
if("不限制余额".equals(entity.getValue().toString())){
balanceDays = -1;
}else {
balanceDays = Double.parseDouble(entity.getValue().toString());
}
}
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, leaveRulesId)
.eq(KqglAssoLeaveEmployeeBalance::getUserid, empnum).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
if(emba != null && balanceDays > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balanceDays).build().updateById();
}
}else{
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(0).build().updateById();
}
}
}
}
}
return ResultUtil.success("导入假期余额成功!");
}
/** /**
* 移除考勤机管理员 * 移除考勤机管理员
......
...@@ -2,6 +2,7 @@ package cn.timer.api.dao.kqmk; ...@@ -2,6 +2,7 @@ package cn.timer.api.dao.kqmk;
import java.util.List; import java.util.List;
import cn.timer.api.dto.kqmk.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -9,10 +10,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -9,10 +10,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance; import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.JiaqibalanceDto;
/** /**
* 员工假期余额 * 员工假期余额
...@@ -35,4 +32,6 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala ...@@ -35,4 +32,6 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala
List<AdditionalDto> RealTimeUpdate(int orgcode,int kqzid); List<AdditionalDto> RealTimeUpdate(int orgcode,int kqzid);
List<AdditionalDto> selectAdditionalByempnum(int orgcode,int empnum); List<AdditionalDto> selectAdditionalByempnum(int orgcode,int empnum);
List<ExportEmployeeLeaveBalanceDto> selectLeaveBalance(@Param("param") AttqueryCriteriaDto attquerycriteriadto);
} }
...@@ -29,6 +29,9 @@ public class BalanceSheetDataDto implements Serializable{ ...@@ -29,6 +29,9 @@ public class BalanceSheetDataDto implements Serializable{
@ApiModelProperty(value = "假期规则id", example = "字段说明") @ApiModelProperty(value = "假期规则id", example = "字段说明")
private Integer leaverulesid; private Integer leaverulesid;
@ApiModelProperty(value = "假期name", example = "字段说明")
private String name;
@ApiModelProperty(value = "余额天数 ", example = "字段说明") @ApiModelProperty(value = "余额天数 ", example = "字段说明")
private double balancedays; private double balancedays;
} }
package cn.timer.api.dto.kqmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExportEmployeeLeaveBalanceDto {
@ApiModelProperty(value = "员工工号 ", example = "字段说明")
private Integer empnum;
@ApiModelProperty(value = "员工名称 ", example = "字段说明")
private String empname;
@ApiModelProperty(value = "部门 ", example = "字段说明")
private String department;
@ApiModelProperty(value = "入职日期 ", example = "字段说明")
private String rztime;
@ApiModelProperty(value = "企业组织代码 ", example = "字段说明")
private Integer orgcode;
private Integer turnover_status;
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
}
...@@ -123,6 +123,30 @@ ...@@ -123,6 +123,30 @@
yz.balance_days as balancedays--> yz.balance_days as balancedays-->
</select> </select>
<select id="selectLeaveBalance" resultType="cn.timer.api.dto.kqmk.ExportEmployeeLeaveBalanceDto">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.org_code as orgcode,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
IFNULL((select em.job_status from yggl_main_lzb em where em.emp_num = emp.emp_num and em.org_code = emp.org_code),0) as turnover_status
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
<if test="param.deptid != null and param.deptid != ''">
and c.id in (select m.id from zzgl_bmgw_m m where m.up_id = #{param.deptid}) or (c.id =#{param.deptid})
</if>
<if test="param.turnover_status == 0">
and emp.emp_num not in (select em.emp_num from yggl_main_lzb em where em.org_code = #{param.orgCode} and em.job_status = 3)
</if>
</select>
<select id="selectAdditional" resultMap="AdditionalMap"> <select id="selectAdditional" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum, SELECT emp.emp_num as empnum,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment