Commit 3082346b by lal Committed by chenzg

提交

parent 2e58ce50
package cn.timer.api.bean.kqmk;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @author lal 2020-06-22
*/
@Data
@Builder
@Table(name = "kqgl_asso_leave_employee_balance")
@ApiModel("员工假期余额表")
public class KqglAssoLeaveEmployeeBalance extends Model<KqglAssoLeaveEmployeeBalance> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id id", example = "101")
private Integer id;
@ApiModelProperty(value = "假期规则id 假期规则id", example = "101")
private Integer leaveRulesId;
@ApiModelProperty(value = "员工id 员工id", example = "101")
private Integer userid;
@ApiModelProperty(value = "余额天数 ", example = "余额天数")
private double balanceDays;
@ApiModelProperty(value = "最后修改人 最后修改人", example = "101")
private Integer modifyUserid;
@ApiModelProperty(value = "最后修改时间 ", example = "最后修改时间")
private String modifyTimer;
@ApiModelProperty(value = "企业组织代码 企业组织代码", example = "101")
private Integer orgCode;
}
\ No newline at end of file
......@@ -52,6 +52,7 @@ import cn.timer.api.bean.kqmk.KqglAssoDkwx;
import cn.timer.api.bean.kqmk.KqglAssoKqj;
import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics;
......@@ -82,6 +83,7 @@ import cn.timer.api.dao.kqmk.KqglAssoDkwxMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqjMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveEmployeeBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper;
......@@ -102,6 +104,7 @@ import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
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;
......@@ -468,6 +471,9 @@ public class TimeCardController {
@Autowired
private KqglAssoRulesViceMapper kqglassorulesvicemapper;
@Autowired
private KqglAssoLeaveEmployeeBalanceMapper kqglassoleaveemployeebalancemapper;
/**
* 新增/修改--假期规则
*/
......@@ -475,6 +481,8 @@ public class TimeCardController {
@ApiOperation(value = "12:新增/修改--假期规则", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 12)
public Result<Object> LeaveRules(@CurrentUser UserBean userBean,@RequestBody KqglAssoLeaveRulesDto leaverules) {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
leaverules.setCreateTime(new Date().getTime());
leaverules.setOrgCode(userBean.getOrgCode());
leaverules.setCreateUserid(userBean.getEmpNum());
......@@ -487,21 +495,21 @@ public class TimeCardController {
Integer id = learul.getId();
Console.log("新增/修改--假期规则id: " + id);
KqglAssoLeaveBalance.builder().build().delete(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getLeaveRulesId, id)
.eq(KqglAssoLeaveBalance :: getOrgCode, userBean.getOrgCode()));
KqglAssoLeaveEmployeeBalance.builder().build().delete(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, id)
.eq(KqglAssoLeaveEmployeeBalance :: getOrgCode, userBean.getOrgCode()));
List<YgglMainEmp> yggl = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(leaverules.getLeaveBalance() == 1) {//假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)
//该项公司员工余额为“0”
for(YgglMainEmp ye:yggl) {
KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("+0")
.reason("系统按照规则自动").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).balanceDays(0.0).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}
}else {
for(YgglMainEmp ye:yggl) {
KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("-1")
.reason("不限制余额").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).balanceDays(-1).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}
}
List<KqglAssoRulesVice> vices = new ArrayList<KqglAssoRulesVice>();
String[] rest = leaverules.getRange();
if(rest.length == 0) {
......@@ -858,6 +866,15 @@ public class TimeCardController {
balance.setModifyUserid(userBean.getEmpNum());
balance.setModifyTimer(new Date().getTime());
balance.setOrgCode(userBean.getOrgCode());
String balanceDays = "0";
if(balance.getModifyAction() == 1) {//增加
balanceDays = "+" + balance.getBalanceDays();
}else {
balanceDays = "-" + balance.getBalanceDays();
}
balance.setBalanceDays(balanceDays);
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, balance.getUserid())
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
if(balan != null) {
......@@ -865,16 +882,45 @@ public class TimeCardController {
}else {
balance.setModifyNumber(1);
}
return balance.insert() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
//添加成功
if(balance.insert()) {
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, balance.getLeaveRulesId())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, balance.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(balance.getUserid(), userBean.getOrgCode(),balance.getLeaveRulesId());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
}
return ResultUtil.success("操作成功!") ;
// return balance.insert() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
}
/**
* 根据考勤余额id获取信息
* 根据考勤余额id获取信息 ||大于“0”为有数字限制 ||为“-1”时为无数字限制
*/
@GetMapping(value="/hqleavebalance/{id}")
@ApiOperation(value = "根据考勤余额id获取信息", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> hqleavebalance(@PathVariable("id") Integer id,@CurrentUser UserBean userBean) {
JiaqibalanceDto leanemp = kqglassoleavebalancemapper.selectleavebalanceList(id,userBean.getEmpNum());
// JiaqibalanceDto leanemp = kqglassoleavebalancemapper.selectleavebalanceList(id,userBean.getEmpNum());
JiaqibalanceDto leanemp = JiaqibalanceDto.builder().build();
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, userBean.getEmpNum())
.eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, id).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
if(emba != null) {
leanemp.setBalancedays(String.valueOf(emba.getBalanceDays()));
}
return ResultUtil.data(leanemp, "操作成功!");
}
......@@ -906,11 +952,20 @@ public class TimeCardController {
if(yhd != null) {
//获取假期适用全公司的
String company = "";
List<KqglAssoLeaveRules> whole = kqglassoleaverulesmapper.selCompanywidedata(userBean.getOrgCode(), 2, 1);
for(KqglAssoLeaveRules rul : whole) {
LeaveTypeDto lea = LeaveTypeDto.builder().build();
lea.setId(rul.getId());
lea.setValue(rul.getName());
if(rul.getCompany() == 1) {
company = "天";
}else if(rul.getCompany() == 2) {
company = "半天";
}else {
company = "小时";
}
lea.setCompany(company);
leas.add(lea);
}
......@@ -919,6 +974,14 @@ public class TimeCardController {
LeaveTypeDto lea = LeaveTypeDto.builder().build();
lea.setId(rul1.getId());
lea.setValue(rul1.getName());
if(rul1.getCompany() == 1) {
company = "天";
}else if(rul1.getCompany() == 2) {
company = "半天";
}else {
company = "小时";
}
lea.setCompany(company);
leas.add(lea);
}
}
......@@ -2137,9 +2200,7 @@ public class TimeCardController {
@ApiOperation(value = "获取考勤报表汇总数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> SummarydataList(@CurrentUser UserBean userBean, @Validated @RequestBody AttendanceSummaryQueryDto attesummqueto) throws ParseException {
IPage<KqglAssoMonthPunchSummaryDto> page = new Page<KqglAssoMonthPunchSummaryDto>(
attesummqueto.getCurrentPage() == null ? 1 : attesummqueto.getCurrentPage(),
attesummqueto.getTotalPage() == null ? 10 : attesummqueto.getTotalPage());
IPage<KqglAssoMonthPunchSummaryDto> page = new Page<KqglAssoMonthPunchSummaryDto>( attesummqueto.getCurrentPage(),attesummqueto.getTotalPage());
attesummqueto.setOrgCode(userBean.getOrgCode());
String year = null,month = null;
......@@ -2147,29 +2208,89 @@ public class TimeCardController {
if(attesummqueto.getTimes() != null && !("").equals(attesummqueto.getTimes())) {
year = attesummqueto.getTimes().substring(0, 4);
month = attesummqueto.getTimes().substring(5, 7);
staapptime = ClockInTool.getFirstDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
endapptime = ClockInTool.getLastDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
// staapptime = ClockInTool.getFirstDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
// endapptime = ClockInTool.getLastDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
String time = attesummqueto.getTimes()+"-01";
String sdaet = ClockInTool.getMinMonthDate(time);
staapptime = String.valueOf(ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime());
String edate = ClockInTool.getMaxMonthDate(time);
endapptime = String.valueOf(ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime());
}else {
year = new SimpleDateFormat("yyyy").format(new Date()).toString();
month = new SimpleDateFormat("MM").format(new Date()).toString();
// Calendar c = Calendar.getInstance();
// c.add(Calendar.MONTH, 0);
// c.set(Calendar.DAY_OF_MONTH,1);
// staapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(c.getTime()),"yyyy-MM-dd"));
// Calendar ca = Calendar.getInstance();
// ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
// endapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(ca.getTime()),"yyyy-MM-dd"));
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);
staapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(c.getTime()),"yyyy-MM-dd"));
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
String first = mat.format(c.getTime());
staapptime = String.valueOf(DateUtil.getStartTime(0,DateUtil.getStringTime(first,"yyyy-MM-dd")).getTime());
//获取当前月最后一天
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
endapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(ca.getTime()),"yyyy-MM-dd"));
String last = mat.format(ca.getTime());
endapptime = String.valueOf(DateUtil.getnowEndTime(23,DateUtil.getStringTime(last,"yyyy-MM-dd")).getTime());
}
attesummqueto.setYear(year);
attesummqueto.setMonth(month);
attesummqueto.setStaapptime(staapptime);
attesummqueto.setEndapptime(endapptime);
// 缺-部门id 搜索
IPage<KqglAssoMonthPunchSummaryDto> pageAs = kqglassomonthpunchsummarymapper.AttendanceSummaryData(page, attesummqueto);
// List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
// int num = 0;
// int nums = 0;
//
// List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode()));
// if(rul.size() > 0) {
// num = rul.size();
// }
//
// List<KqglAssoMonthPunchSummary> pusu = KqglAssoMonthPunchSummary.builder().build().selectList(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getOrgCode, userBean.getOrgCode())
// .eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month));
// if(pusu.size() > 0) {
// nums = pusu.size();
// }
List<KqglAssoMonthPunchSummaryDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
List<KqglAssoMonthPunchSummaryDto> sumlist = new ArrayList<KqglAssoMonthPunchSummaryDto>();
for(KqglAssoMonthPunchSummaryDto endo : listAs) {
KqglAssoMonthPunchSummaryDto dets = KqglAssoMonthPunchSummaryDto.builder().build();
BeanUtil.copyProperties(endo, dets , "balanceTo");
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getNum())
.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);
}
dets.setBalanceTo(balanceTo);
sumlist.add(dets);
}
// return ResultUtil.attdata(pageAs, listAs, "操作成功!",num,nums);
return ResultUtil.data(pageAs, sumlist, "操作成功!");
}
@PostMapping(value = "/Daily_details")
......@@ -2198,9 +2319,32 @@ public class TimeCardController {
attesummqueto.setTimes(time);
// 缺-部门id 搜索
IPage<DailyDetailsDto> pageAs = kqglassomonthpunchsummarymapper.Dailydetails(page, attesummqueto);
List<DailyDetailsDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
List<DailyDetailsDto> sumlist = new ArrayList<DailyDetailsDto>();
//多条
for(DailyDetailsDto endo : listAs) {
DailyDetailsDto dets = DailyDetailsDto.builder().build();
BeanUtil.copyProperties(endo, dets , "balanceTo");
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getNum())
.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);
}
dets.setBalanceTo(balanceTo);
sumlist.add(dets);
}
return ResultUtil.data(pageAs, sumlist, "操作成功!");
}
......
......@@ -15,14 +15,17 @@ import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRange;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRules;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.kqgl.ClockInController;
import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.controller.kqgl.EmptyUtil;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
......@@ -62,7 +65,7 @@ public class KqglServiceImpl implements KqglService {
.leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).orgCode(leaveappr.getOrgcode()).build().insert();
}
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()));
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()).eq(YgglMainEmp::getOrgCode, leaveappr.getOrgcode()));
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, leaveappr.getUserid()).eq(KqglAssoLeaveBalance::getOrgCode, leaveappr.getOrgcode())
......@@ -72,6 +75,21 @@ public class KqglServiceImpl implements KqglService {
}
KqglAssoLeaveBalance.builder().leaveRulesId(leaveappr.getLeavetype()).userid(leaveappr.getUserid()).modifyAction(2).balanceDays("-"+leaveappr.getDuration())
.reason("系统按照规则自动").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, leaveappr.getLeavetype())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, leaveappr.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, leaveappr.getOrgcode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(leaveappr.getUserid(), leaveappr.getOrgcode(),leaveappr.getLeavetype());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
return true;
}
......@@ -98,6 +116,8 @@ public class KqglServiceImpl implements KqglService {
if(overappr.getCompensate() == 1) {
double duration = 0l;//
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, overappr.getUserid()).eq(KqglAssoLeaveBalance::getOrgCode, overappr.getOrgcode())
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
......@@ -105,8 +125,59 @@ public class KqglServiceImpl implements KqglService {
modifynumber = balan.getModifyNumber()+1;
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+overappr.getDuration())
.reason("系统按照规则自动(加班)").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode()));
if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
if(timeran != null) {
KqglAssoOvertimeRules rul = KqglAssoOvertimeRules.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRules>().lambda().eq(KqglAssoOvertimeRules::getId, timeran.getOvertimeRulesId()));
if(rul != null) {
//1:工作日加班;2:休息日加班;3:节假日加班
if(overappr.getOvertimetype() == 1) {
if(rul.getIsWorkovertime() == 1) {
if(rul.getWork() == 1) {
duration = Double.valueOf(rul.getWorkOne()) * overappr.getDuration();
}else if(rul.getWork() == 3) {
duration = Double.valueOf(rul.getWorkThree()) * overappr.getDuration();
}
}
}else if(overappr.getOvertimetype() == 2) {
if(rul.getIsRestovertime() == 1) {
if(rul.getRest() == 1) {
duration = Double.valueOf(rul.getRestOne()) * overappr.getDuration();
}else if(rul.getRest() == 3) {
duration = Double.valueOf(rul.getRestThree()) * overappr.getDuration();
}
}
}else {
if(rul.getIsHolidays() == 1) {
if(rul.getHolidays() == 1) {
duration = Double.valueOf(rul.getHolidaysOne()) * overappr.getDuration();
}else if(rul.getHolidays() == 3) {
duration = Double.valueOf(rul.getHolidaysThree()) * overappr.getDuration();
}
}
}
}
}
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+duration)
.reason("系统按照审批自动(加班)").modifyUserid(emp.getEmpNum()).modifyTimer(overappr.getStarttime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, learul.getId())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, overappr.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, overappr.getOrgcode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(overappr.getUserid(), overappr.getOrgcode(),learul.getId());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
}
return true;
......@@ -123,7 +194,7 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(",");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3)
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3).duration(evecappr.getDuration())
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).build().insert();
}
......@@ -133,7 +204,7 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(",");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4)
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4).duration(evecappr.getDuration())
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).build().insert();
}
......
......@@ -6,6 +6,7 @@
package cn.timer.api.controller.yggl;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
......@@ -60,6 +61,7 @@ import cn.hutool.poi.excel.ExcelWriter;
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
......@@ -289,25 +291,19 @@ public class YgglController {
.empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
ygglMainEmp.insert();
//假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode));
for(KqglAssoLeaveRules r : rul) {
if(r.getLeaveBalance() == 0) {
KqglAssoLeaveBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).modifyAction(2).balanceDays("-1")
.reason("不限制余额").modifyUserid(ygglMainEmp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).balanceDays(-1).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}else {
KqglAssoLeaveBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).modifyAction(1).balanceDays("+0")
.reason("系统按照规则自动").modifyUserid(ygglMainEmp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).balanceDays(0.0).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}
}
return ResultUtil.data(ygglMainEmp, "添加员工成功!");
} else {
return ResultUtil.error("该手机号已被使用,请输入正确手机号");
......
......@@ -28,5 +28,7 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala
List<AdditionalDto> selectAdditionalList(int orgcode);
JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
// JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
Double Sumbalancedays(int userid,int orgcode,int leaverulesid);
}
package cn.timer.api.dao.kqmk;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
/**
* 员工假期余额表
*
* @author lal 2020-06-22
*/
@Repository
public interface KqglAssoLeaveEmployeeBalanceMapper extends BaseMapper<KqglAssoLeaveEmployeeBalance> {
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -10,11 +12,23 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BalanceSheetDataDto {
public class BalanceSheetDataDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6994914131126332691L;
/**
*
*/
@ApiModelProperty(value = "id id", example = "101")
private Integer yzid;
@ApiModelProperty(value = "假期规则id", example = "字段说明")
private Integer leaverulesid;
@ApiModelProperty(value = "余额天数 ", example = "字段说明")
private Integer balancedays;
private double balancedays;
}
......@@ -18,6 +18,7 @@ public class DailyDetailsDto {
private Integer num;// 工号
private String dept;// 部门
private String post;// 岗位
private Integer orgcode;// 岗位
private String attname;// 考勤组名称
private Integer attpbfs;// 排班方式(1:固定排班;2:自由排班;3:自由工时)
private String attdate;// 考勤日期
......
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import java.util.List;
import javax.persistence.GeneratedValue;
......@@ -21,7 +22,16 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KqglAssoMonthPunchSummaryDto {
public class KqglAssoMonthPunchSummaryDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6391675154319774211L;
/**
*
*/
@Id
@GeneratedValue
......
......@@ -18,4 +18,7 @@ public class LeaveTypeDto {
@ApiModelProperty(value = "假期名称", example = "事假、调休...")
private String value;
@ApiModelProperty(value = "假期单位", example = "1:按天请假;2:按半天;3:按小时")
private String company;
}
package cn.timer.api.dto.kqmk;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SummaryDisplayDto {
private List<DailyDetailsDto> sumlist;
}
package cn.timer.api.dto.kqmk;
import org.apache.poi.ss.formula.functions.T;
import cn.timer.api.utils.Result;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SuperfluousDto<T> extends Result<T>{
/**
*
*/
private static final long serialVersionUID = -4971179863446442731L;
private int num;
private int nums;
}
......@@ -69,7 +69,7 @@
</sql>
<select id="selectPageByQueryLeaveBalance" resultMap="LeaveBalanceMap">
SELECT emp.emp_num as empnum,
<!-- SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
......@@ -82,6 +82,18 @@
from kqgl_asso_leave_balance bal
where bal.org_code = #{param.orgCode}
GROUP BY bal.userid,bal.leave_rules_id) as yz on yz.userid = emp.emp_num
where emp.org_code = #{param.orgCode} -->
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
yz.leave_rules_id as leaverulesid,
yz.balance_days as balancedays
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
LEFT JOIN kqgl_asso_leave_employee_balance as yz on yz.userid = emp.emp_num
where emp.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
......@@ -120,11 +132,15 @@
</select>
<select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
<!-- <select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
select bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.leave_rules_id = #{leaverulesid} and bal.userid = #{userid}
GROUP BY bal.userid
</select> -->
<select id="Sumbalancedays" resultType="java.lang.Double">
select SUM(ba.balance_days) from kqgl_asso_leave_balance ba where ba.userid = #{userid} and ba.org_code = #{orgcode} and ba.leave_rules_id = #{leaverulesid}
</select>
<!--
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.kqmk.KqglAssoLeaveEmployeeBalanceMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance" >
<id column="id" property="id" />
<result column="leave_rules_id" property="leaveRulesId" />
<result column="userid" property="userid" />
<result column="balance_days" property="balanceDays" />
<result column="modify_userid" property="modifyUserid" />
<result column="modify_timer" property="modifyTimer" />
<result column="org_code" property="orgCode" />
</resultMap>
<sql id="Base_Column_List">
id,
leave_rules_id,
userid,
balance_days,
modify_userid,
modify_timer,
org_code
</sql>
<sql id="Base_Column_List_Alias">
id KqglAssoLeaveEmployeeBalance_id,
leave_rules_id KqglAssoLeaveEmployeeBalance_leave_rules_id,
userid KqglAssoLeaveEmployeeBalance_userid,
balance_days KqglAssoLeaveEmployeeBalance_balance_days,
modify_userid KqglAssoLeaveEmployeeBalance_modify_userid,
modify_timer KqglAssoLeaveEmployeeBalance_modify_timer,
org_code KqglAssoLeaveEmployeeBalance_org_code
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance">
INSERT INTO kqgl_asso_leave_employee_balance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != leaveRulesId'>
leave_rules_id,
</if>
<if test ='null != userid'>
userid,
</if>
<if test ='null != balanceDays'>
balance_days,
</if>
<if test ='null != modifyUserid'>
modify_userid,
</if>
<if test ='null != modifyTimer'>
modify_timer,
</if>
<if test ='null != orgCode'>
org_code
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != leaveRulesId'>
#{leaveRulesId},
</if>
<if test ='null != userid'>
#{userid},
</if>
<if test ='null != balanceDays'>
#{balanceDays},
</if>
<if test ='null != modifyUserid'>
#{modifyUserid},
</if>
<if test ='null != modifyTimer'>
#{modifyTimer},
</if>
<if test ='null != orgCode'>
#{orgCode}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM kqgl_asso_leave_employee_balance
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance">
UPDATE kqgl_asso_leave_employee_balance
<set>
<if test ='null != leaveRulesId'>leave_rules_id = #{leaveRulesId},</if>
<if test ='null != userid'>userid = #{userid},</if>
<if test ='null != balanceDays'>balance_days = #{balanceDays},</if>
<if test ='null != modifyUserid'>modify_userid = #{modifyUserid},</if>
<if test ='null != modifyTimer'>modify_timer = #{modifyTimer},</if>
<if test ='null != orgCode'>org_code = #{orgCode}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_employee_balance
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_employee_balance
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM kqgl_asso_leave_employee_balance
</select>
-->
</mapper>
\ No newline at end of file
......@@ -140,6 +140,7 @@
<result column="last_modified" property="lastModified" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<id column="yzid" property="yzid"/>
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
......@@ -150,6 +151,7 @@
<result column="num" property="num" />
<result column="dept" property="dept" />
<result column="post" property="post" />
<result column="orgcode" property="orgcode" />
<result column="address" property="address" />
<result column="remarks" property="remarks" />
......@@ -212,6 +214,7 @@
<result column="duration" property="duration" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<id column="yzid" property="yzid"/>
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
......@@ -220,28 +223,8 @@
<select id="AttendanceSummaryData" resultMap="SummarydataMap">
select sum.*,
(select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group) as attname,
yz.leaverulesid as leaverulesid,
yz.duration as balancedays
(select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group) as attname
from kqgl_asso_month_punch_summary sum
LEFT JOIN (SELECT les.id as leaverulesid,
hz.user_id,
hz.duration
FROM kqgl_asso_leave_rules les
LEFT JOIN (select ry.user_id,ry.leave_type_id,SUM(ry.duration) as duration
from (
select rel.user_id,rel.leave_type_id,rel.duration
from kqgl_asso_relation_summary rel
where rel.approval_type = 2
and rel.app_time &gt;= #{param.staapptime}
and rel.app_time &lt;= #{param.endapptime}
GROUP BY rel.user_id,rel.leave_type_id,rel.duration
) as ry
GROUP BY ry.user_id,ry.leave_type_id
) as hz on hz.leave_type_id = les.id
WHERE les.org_code = #{param.orgCode}
AND (les.leave_type = 2 OR les.is_open = 1)
) as yz on yz.user_id = sum.num
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month}
......@@ -253,100 +236,17 @@
and sum.att_group = #{param.attid}
</if>
<!-- yz.id as yzid,
yz.leave_rules_id as leaverulesid,
yz.balance_days as balancedays
LEFT JOIN kqgl_asso_leave_employee_balance as yz on yz.userid = sum.num
ORDER BY sum.num DESC -->
</select>
<select id="Dailydetails" resultMap="DailyDetailsMap">
<!-- select sum.`name`,sum.num,sum.dept,sum.post,
IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
'' address,
'' remarks,
'' cardtype,
'' macaddress,
'' macname,
IFNULL(rtj.bcszid, '') bcszid,
IFNULL(rtj.bcname, '') bcname,
IFNULL(rtj.bcsbdk1, '') bcsbdk1,
IFNULL(rtj.bcxbdk1, '') bcxbdk1,
IFNULL(rtj.bcsbdk2, '') bcsbdk2,
IFNULL(rtj.bcxbdk2, '') bcxbdk2,
IFNULL(rtj.bcsbdk3, '') bcsbdk3,
IFNULL(rtj.bcxbdk3, '') bcxbdk3,
IFNULL(rtj.attdate, '') attdate,
IFNULL(rtj.userid,'') userid,
IFNULL(rtj.data,'') data,
IFNULL(rtj.sbdk1,'') sbdk1,
IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,
IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,
IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,
IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,
IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,
IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.ydkcs ,'') ydkcs,
IFNULL(rtj.gzsc ,'') gzsc,
IFNULL(rtj.qyid,'') qyid,
IFNULL(rtj.dksj ,'') dksj,
IFNULL(rtj.yzcdcs ,'') yzcdcs,
IFNULL(rtj.yzcdsc ,'') yzcdsc,
IFNULL(rtj.kgcdfzs,'') kgcdfzs,
sum.days_on_duty as daysonduty,
sum.days_off as daysoff,
sum.length_business_trip as lengthbusinesstrip,
sum.time_out as timeout,
sum.total_overtime_hours as totalovertimehours,
sum.working_turn_compen_leave as workingturncompenleave,
sum.rest_turn_compen_leave as restturncompenleave,
sum.holiday_turn_compen_leave as holidayturncompenleave,
sum.working_transfer_overtime as workingtransferovertime,
sum.rest_transfer_overtime as resttransferovertime,
sum.holiday_transfer_overtime as holidaytransferovertime,
IFNULL(mrtj.leaverulesid,'') as leaverulesid,
IFNULL(mrtj.duration,'') as balancedays
from kqgl_asso_month_punch_summary sum
LEFT JOIN (
select DISTINCT info.`name` as username ,
dkjl.attdate,bcsz.id as bcszid,
bcsz.`name` as bcname,bcsz.sbdk1 as bcsbdk1,bcsz.xbdk1 as bcxbdk1,bcsz.sbdk2 as bcsbdk2,bcsz.xbdk2 as bcxbdk2,bcsz.sbdk3 as bcsbdk3,bcsz.xbdk3 as bcxbdk3,
dkmx.`userid`,dkmx.`data` ,dkmx.`sbdk1`,dkmx.`sbdk1jg`,dkmx.`xbdk1` ,dkmx.`xbdk1jg`,dkmx.`sbdk2` ,dkmx.`sbdk2jg` ,dkmx.`xbdk2` ,
dkmx.`xbdk2jg`,dkmx.`sbdk3` ,dkmx.`sbdk3jg` ,dkmx.`xbdk3`,dkmx.`xbdk3jg` ,dkmx.`ydkcs` ,dkmx.`gzsc` ,dkmx.`qyid`,dkmx.`dksj` ,
dkmx.`yzcdcs` ,dkmx.`yzcdsc` ,dkmx.`kgcdfzs`
from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{param.orgCode}
LEFT JOIN (select * from kqgl_asso_dkjl dkjl
where dkjl.id in (select MAX(dkjl.id) from kqgl_asso_dkjl dkjl
LEFT JOIN kqgl_asso_dkmx as dkmx on dkmx.id = dkjl.dkmxid
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
GROUP BY dkjl.user_id)) as dkjl on dkjl.dkmxid = dkmx.id
LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = dkjl.bcid
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
) as rtj on rtj.userid = sum.num
LEFT JOIN (SELECT les.id as leaverulesid,hz.user_id,hz.duration
FROM kqgl_asso_leave_rules les
LEFT JOIN (select ry.user_id,ry.leave_type_id,SUM(ry.duration) as duration
from (
select rel.user_id,rel.leave_type_id,rel.duration
from kqgl_asso_relation_summary rel
where rel.approval_type = 2
and rel.app_time = #{param.times}
GROUP BY rel.user_id,rel.leave_type_id,rel.duration
) as ry
GROUP BY ry.user_id,ry.leave_type_id) as hz on hz.leave_type_id = les.id
WHERE les.org_code = #{param.orgCode}
AND (les.leave_type = 2 OR les.is_open = 1)
) as mrtj on mrtj.user_id = sum.num
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month} -->
select sum.`name`,
sum.num,
select sum.num,
sum.`name`,
sum.org_code as orgcode,
sum.dept,sum.post,
IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
......@@ -450,34 +350,16 @@
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as ydkcs,
'' address,
'' remarks,
'' cardtype,
'' macaddress,
'' macname,
IFNULL(rtj.attdate, '') attdate,
IFNULL(rtj.userid,'') userid,
'' address,'' remarks,'' cardtype,'' macaddress,'' macname,
IFNULL(rtj.attdate, '') attdate,IFNULL(rtj.userid,'') userid,
#{param.times} data,
IFNULL(rtj.sbdk1,'') sbdk1,
IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,
IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,
IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,
IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,
IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,
IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.dktj1,'') dktj1,
IFNULL(rtj.dktj2,'') dktj2,
IFNULL(rtj.dktj3,'') dktj3,
IFNULL(rtj.dktj4,'') dktj4,
IFNULL(rtj.dktj5,'') dktj5,
IFNULL(rtj.dktj6,'') dktj6,
IFNULL(rtj.sbdk1,'') sbdk1,IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.dktj1,'') dktj1,IFNULL(rtj.dktj2,'') dktj2,IFNULL(rtj.dktj3,'') dktj3,IFNULL(rtj.dktj4,'') dktj4,IFNULL(rtj.dktj5,'') dktj5,IFNULL(rtj.dktj6,'') dktj6,
IFNULL(rtj.gzsc ,'') gzsc,
IFNULL(rtj.qyid,'') qyid,
IFNULL(rtj.dksj ,'') dksj,
......@@ -494,9 +376,7 @@
sum.holiday_turn_compen_leave as holidayturncompenleave,
sum.working_transfer_overtime as workingtransferovertime,
sum.rest_transfer_overtime as resttransferovertime,
sum.holiday_transfer_overtime as holidaytransferovertime,
IFNULL(mrtj.leaverulesid,'') as leaverulesid,
IFNULL(mrtj.duration,'') as balancedays
sum.holiday_transfer_overtime as holidaytransferovertime
from kqgl_asso_month_punch_summary sum
LEFT JOIN (
select DISTINCT info.`name` as username ,
......@@ -512,20 +392,7 @@
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
) as rtj on rtj.userid = sum.num
LEFT JOIN (SELECT les.id as leaverulesid,hz.user_id,hz.duration
FROM kqgl_asso_leave_rules les
LEFT JOIN (select ry.user_id,ry.leave_type_id,SUM(ry.duration) as duration
from (
select rel.user_id,rel.leave_type_id,rel.duration
from kqgl_asso_relation_summary rel
where rel.approval_type = 2
and rel.app_time = #{param.times}
GROUP BY rel.user_id,rel.leave_type_id,rel.duration
) as ry
GROUP BY ry.user_id,ry.leave_type_id) as hz on hz.leave_type_id = les.id
WHERE les.org_code = #{param.orgCode}
AND (les.leave_type = 2 OR les.is_open = 1)
) as mrtj on mrtj.user_id = sum.num
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month}
......@@ -536,6 +403,10 @@
<if test="param.attid != null and param.attid != ''">
and sum.att_group = #{param.attid}
</if>
<!-- LEFT JOIN kqgl_asso_leave_employee_balance as mrtj on mrtj.userid = sum.num
IFNULL(mrtj.leave_rules_id,'') as leaverulesid,
IFNULL(mrtj.balance_days,'') as balancedays-->
</select>
......
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