Commit 547dd23f by 龙于生

Merge remote-tracking branch 'origin/develop' into develop

parents fcd2b395 fde44c57
......@@ -218,6 +218,11 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@Transient
@TableField(exist = false)
private String error;//错误信息提示
@Transient
@TableField(exist = false)
@ApiModelProperty(value="员工登陆账号(手机号)",example="员工登陆账号(手机号)")
private String empLoginPhone;
......
......@@ -13,6 +13,8 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import cn.timer.api.service.KqglAssoDkjlService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
......@@ -111,6 +113,7 @@ import io.swagger.annotations.ApiParam;
* @author lalqq
* 考勤
*/
@Slf4j
@Api(tags = "3.0[2]考勤模块")
@RestController
@Transactional
......@@ -334,6 +337,7 @@ public class AttController {
@ApiOperationSupport(order = 31)
@ApiOperation(value = "修改班次信息", httpMethod = "PUT", notes = "接口发布说明")
public Result<List<Schedule>> updateAttscheduling(@CurrentUser UserBean userBean,@RequestBody AttendanceAssistant attass) {
long startTime = System.currentTimeMillis();
int id = Integer.valueOf(attass.getAttgroupid());//修改数据id
int qyid = userBean.getOrgCode();//坏小孩【企业id】
......@@ -346,7 +350,6 @@ public class AttController {
//记录排班(排班制)
List<Schedule> schlist=new ArrayList<Schedule>();
Schedule[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
String date_scmx = null;
if(schedules.length>0 && attass.getAtttype() == 2){
......@@ -1150,6 +1153,8 @@ public class AttController {
}
}//判断新增或修改
}
long endTime = System.currentTimeMillis();
log.info("=======================================执行时长(毫秒):{}",endTime-startTime);
if(schlist.size()>0 && xiugai){
//删除排班明细表(自由排班)
// scheduleservice.deleteByPrimaryBykqzid(id);
......@@ -1159,7 +1164,6 @@ public class AttController {
scheduleservice.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功");
}
return ResultUtil.data(schlist,"修改考勤组排班成功");
// return ResultUtil.error("修改考勤组排班失败");
}
......@@ -5182,4 +5186,886 @@ public class AttController {
return ResultUtil.data(attrep);
}
@Autowired
private KqglAssoDkjlService kqglAssoDkjlService;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
* 接口优化
*/
@SuppressWarnings({ "unused", "deprecation" })
@PutMapping(value = "/v2.0/attscheduling")
@ApiOperationSupport(order = 57)
@ApiOperation(value = "修改班次信息", httpMethod = "PUT", notes = "接口发布说明")
public Result<List<Schedule>> updateAttschedulingv2(@CurrentUser UserBean userBean,@RequestBody AttendanceAssistant attass) {
long startTime = System.currentTimeMillis();
int id = Integer.valueOf(attass.getAttgroupid());//修改数据id
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
String dastr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid()));
boolean xiugai = true;
//记录排班(排班制)
List<Schedule> schlist=new ArrayList<Schedule>();
Schedule[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
String date_scmx = null;
if(schedules.length>0 && attass.getAtttype() == 2){
date_scmx = ClockInTool.SunNovCSTYM(schedules[0].getData());
String date = String.valueOf(schedules[0].getData());
Date dt=new Date(date);
SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM");
System.out.println(famt.format(dt));
if(!(famt.format(dt)).equals(dastr)) {
xiugai = false;
for(int p=0;p<schedules.length;p++){
// scheduleservice.deleteByPrimaryBykqzid(Integer.valueOf(attass.getAttgroupid()),ClockInTool.SunNovCST(String.valueOf(schedules[p].getData())));
KqglAssoPbmx.builder().build().delete(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, schedules[p].getUserid()).eq(KqglAssoPbmx::getData, ClockInTool.SunNovCST(String.valueOf(schedules[p].getData())))
.eq(KqglAssoPbmx::getKqzid, Integer.valueOf(attass.getAttgroupid())));
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
sch.setBcid(schedules[p].getBcid());//班次id 0为休息
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch);
}
if(schlist.size()>0){
scheduleservice.insertKqglAssoPbmxList(schlist);
}
}else {
xiugai = true;
List<PunchRecord> punchRecordList = new ArrayList<>();
List<PunchCardDetails> punchCardDetailsList = new ArrayList<>();
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
sch.setBcid(schedules[p].getBcid());//班次id 0为休息
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch);
/*****************************/
//转换日期
String data = mat.format(new Date(schedules[p].getData().toString()));
Long startDate = 0l;
Long endDate = 0l;
try {
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
//当天修改后的班次
ShiftManagement banci = shiftmanagementservice.selectByPrimaryKey(schedules[p].getBcid());
Long sbdk1 = 0l;
Long xbdk1 = 0l;
Long sbdk2 = 0l;
Long xbdk2 = 0l;
Long sbdk3 = 0l;
Long xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk1()+":00"));
xbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk1()+":00"));
}
if(banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk2()+":00"));
xbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk2()+":00"));
}
if(banci.getSxbcs()== 3){
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk3()+":00"));
}
}
//之前打卡的班次
PunchRecord mapuca = punchrecordservice.MaintenancePunchCard(startDate,endDate,schedules[p].getUserid());
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
List<PunchRecord> initial = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid(),qyid);
if(initial.size() > 0){
RestMethod(initial,initial.get(0).getDkmxid());
}
}
//当天的所有打卡记录
List<PunchRecord> mapucalist = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid(),qyid);
PunchRecord minAttid = null;
PunchRecord maxAttid = null;
int dkmxid = 0;
if(mapucalist.size() > 0){
//最小值
minAttid = mapucalist.stream().min(Comparator.comparing(PunchRecord::getId)).get();
// System.out.println(minAttid.getAttdate() + "---min---" +minAttid.getId());
//最大值
maxAttid = mapucalist.stream().max(Comparator.comparing(PunchRecord::getId)).get();
// System.out.println(maxAttid.getAttdate() + "---max---" + maxAttid.getId());
//对应打卡明细表id
dkmxid = maxAttid.getDkmxid();
}
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
if(banci != null){//修改后有班次打卡
if(banci.getSxbcs() == 1){//修改后一天打两次
if(mapucalist.size() > 2){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for(PunchRecord pre : mapucalist){/********/
if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
if((pre.getSort())%2 > 0){//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//上班应打卡时间
}else{//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setResults(0);// 打卡结果
}else{
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
}
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
}else{
if(pre.getId() == minAttid.getId()){//上班
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setType(1);//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
}else if(pre.getId() == maxAttid.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setType(2);//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);
record.setBcid(banci.getId());//班次id
record.setSort(2);
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//上班
PunchCardDetails max = new PunchCardDetails();
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime());
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果
Long woktimes = (maxdata.getDktime() - mindata.getDktime())/1000/60;
max.setGzsc(Double.valueOf(woktimes));
punchCardDetailsList.add(max);
//punchcarddetailsservice.updateByPrimaryKeySelective(max);
}else{////
PunchRecord mindataone = null;
//当天打卡记录为1条
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchCardDetailsList.add(dan);
// punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
//当天打卡记录为2条
if(maxAttid != null && minAttid.getId() != maxAttid.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());
record.setType(2);//下班
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);
record.setBcid(banci.getId());//班次id
record.setSort(2);
punchRecordList.add(record);
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
PunchCardDetails max = new PunchCardDetails();
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime());
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果
Long woktimes = (maxdata.getDktime() - mindataone.getDktime())/1000/60;
max.setGzsc(Double.valueOf(woktimes));
punchCardDetailsList.add(max);
// punchcarddetailsservice.updateByPrimaryKeySelective(max);
}
}
}else if(banci.getSxbcs() == 2){//修改后一天打四次
if(mapucalist.size() > 4){//当天打卡多次
String[] str= new String[3];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
// record.setType(1);//上班
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}else{//上班
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(4);
record.setAttime(xbdk2);
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
str[2] = String.valueOf(maxdata.getId());
}
if(y == 3 || y > 3 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else{
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchCardDetailsList.add(dkmx);
// punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{//打卡小于4次
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchCardDetailsList.add(dan);
// punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchCardDetailsList.add(pcd);
// punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}else if(banci.getSxbcs() == 3){//修改后一天打六次
if(mapucalist.size() > 6){//当天打卡多次
String[] str= new String[5];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2 || y == 3 || y == 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
if(y == 1){
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 3){
Long time = (mapucalist.get(y).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//下班应打卡时间
str[2] = String.valueOf(mapucalist.get(y).getId());
}
}else{//上班
if(y == 2){
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 4){
Long time = (mapucalist.get(y).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//上班应打卡时间
str[3] = String.valueOf(mapucalist.get(y).getId());
}
}
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(6);
record.setAttime(xbdk3);
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
str[4] = String.valueOf(maxdata.getId());
}
if(y == 5 || y > 5 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else if(t == 2){
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}else if(t == 3){
dkmx.setSbdk3(dtdkmx.getDktime());
dkmx.setSbdk3jg(dtdkmx.getResults());// 上班3打卡结果
}else{
dkmx.setXbdk3(dtdkmx.getDktime());
dkmx.setXbdk3jg(dtdkmx.getResults());// 下班3打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchCardDetailsList.add(dkmx);
// punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{
/**aaa**/
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchCardDetailsList.add(dan);
// punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(3).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(3).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(3).getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 5){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(4).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(4).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(4).getId());//单条打卡明细
pcd.setSbdk3(dtdkmx.getDktime());
pcd.setSbdk3jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 6){
/***/
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchRecordList.add(record);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchCardDetailsList.add(pcd);
// punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
/**bbb***/
}
}
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
}
}
/***********************/
}
// 打卡记录修改批处理
kqglAssoDkjlService.updateKqglAssoDkjlById(punchRecordList);
// 打卡明细修改批处理
kqglAssoDkjlService.updateKqglAssoDkmxById(punchCardDetailsList);
}//判断新增或修改
}
long endTime = System.currentTimeMillis();
log.info("=======================================执行时长(毫秒):{}",endTime-startTime);
if(schlist.size()>0 && xiugai){
//删除排班明细表(自由排班)
// scheduleservice.deleteByPrimaryBykqzid(id);
scheduleservice.deleteByPrimaryBykqzid(id,date_scmx);
scheduleservice.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功");
}
return ResultUtil.data(schlist,"修改考勤组排班成功");
// return ResultUtil.error("修改考勤组排班失败");
}
}
......@@ -208,9 +208,13 @@ public class YgglController {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum));
Date rz = ygglMainEmp.getRzTime();
QyzxEmpLogin login = QyzxEmpLogin.builder().build().selectOne(new QueryWrapper<QyzxEmpLogin>().select("phone").eq("id", empNum));
if (rz != null) {
ygglMainEmp.setWorkTime(DateUtil.formatBetween(ygglMainEmp.getRzTime(), new Date(), Level.DAY));
}
if (!StringUtils.isEmpty(login) && !StringUtils.isEmpty(login.getPhone())) {
ygglMainEmp.setEmpLoginPhone(login.getPhone());
}
return ResultUtil.data(ygglMainEmp);
}
......@@ -424,6 +428,18 @@ public class YgglController {
&& !DateFormatUtils.getCompareDate(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())) {
return ResultUtil.error("入职日期 不可以大于 转正日期");
}
//修改 员工登陆账号 检测账号是否重复
if(!StringUtils.isEmpty(ygglMainEmp.getEmpLoginPhone())){
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(ygglMainEmp.getEmpLoginPhone()), QyzxEmpLogin::getPhone, ygglMainEmp.getEmpLoginPhone()).one();
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getPhone, ygglMainEmp.getEmpLoginPhone())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(StringUtils.isEmpty(login) && StringUtils.isEmpty(emp)){
QyzxEmpLogin.builder().phone(ygglMainEmp.getEmpLoginPhone()).build().update(new QueryWrapper<QyzxEmpLogin>().lambda().eq(QyzxEmpLogin::getId,ygglMainEmp.getEmpNum()));
}else{
return ResultUtil.error("该号码已存在,请更换员工登陆账号");
}
}
if (ygglMainEmp.getEmpNum() != null) {
ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
......
......@@ -16,6 +16,7 @@ public class DailyDetailsDto {
private String name;// 姓名
private Integer num;// 工号
private String customNum;// 工号
private String dept;// 部门
private String post;// 岗位
private Integer orgcode;// 岗位
......
package cn.timer.api.service;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord;
import java.util.List;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/11/12
*/
public interface KqglAssoDkjlService{
/**
* 打卡记录修改批处理
* @param entityList
* @return
*/
void updateKqglAssoDkjlById(List<PunchRecord> entityList);
/**
* 打卡明细修改批处理
* @param entityList
* @return
*/
void updateKqglAssoDkmxById(List<PunchCardDetails> entityList);
}
package cn.timer.api.service.impl;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.service.KqglAssoDkjlService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.List;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/11/12
*/
@Slf4j
@Service
public class KqglAssoDkjlServiceImpl implements KqglAssoDkjlService {
@Autowired
private SqlSessionFactory sqlSessionFactory;
@Transactional
@Override
public void updateKqglAssoDkjlById(List<PunchRecord> entityList) {
SqlSession session = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
PunchRecordMapper mapper = session.getMapper(PunchRecordMapper.class);
for (int i = 0; i < entityList.size(); i++) {
mapper.updateByPrimaryKeySelective(entityList.get(i));
//每100条提交一次
if(i%100==99){
session.commit();
session.clearCache();
}
}
session.commit();
session.clearCache();
}
@Override
public void updateKqglAssoDkmxById(List<PunchCardDetails> entityList) {
SqlSession session = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
PunchCardDetailsMapper mapper = session.getMapper(PunchCardDetailsMapper.class);
for (int i = 0; i < entityList.size(); i++) {
mapper.updateByPrimaryKeySelective(entityList.get(i));
//每100条提交一次
if(i%100==99){
session.commit();
session.clearCache();
}
}
session.commit();
session.clearCache();
}
}
......@@ -410,10 +410,11 @@
where dkjl.attime &gt;= #{start}
and dkjl.attime &lt;= #{end}
and dkjl.user_id = #{userId,jdbcType=INTEGER}
and dkjl.`status` != 0
and dkjl.sort != 0
and dkjl.`status` > 0
and dkjl.sort > 0
and dkjl.qyid = #{qyid}
and dkjl.dkmxid != 0
and dkjl.dkmxid > 0
and dkjl.id > 0
ORDER BY dkjl.id ASC
</select>
......
......@@ -151,7 +151,8 @@
<resultMap id="DailyDetailsMap" type="cn.timer.api.dto.kqmk.DailyDetailsDto" >
<result column="name" property="name" />
<result column="num" property="num" />
<result column="num" property="num" />
<result column="custom_num" property="customNum" />
<result column="dept" property="dept" />
<result column="post" property="post" />
<result column="orgcode" property="orgcode" />
......@@ -314,6 +315,7 @@
<select id="Dailydetails" resultMap="DailyDetailsMap">
select sum.num,
info.custom_num,
sum.`name`,
sum.org_code as orgcode,
sum.dept,sum.post,
......@@ -484,7 +486,7 @@
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`,dkmx.dktj1,dkmx.dktj2,dkmx.dktj3,dkmx.dktj4,dkmx.dktj5,dkmx.dktj6,dkmx.dkst1,dkmx.dkst2,dkmx.dkst3
dkmx.`yzcdcs` ,dkmx.`yzcdsc` ,dkmx.`kgcdfzs`,dkmx.dktj1,dkmx.dktj2,dkmx.dktj3,dkmx.dktj4,dkmx.dktj5,dkmx.dktj6,dkmx.dkst1,dkmx.dkst2,dkmx.dkst3,info.custom_num
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 kqgl_asso_dkjl as dkjl on dkjl.dkmxid = dkmx.id
......@@ -492,13 +494,15 @@
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
) as rtj on rtj.userid = sum.num
LEFT JOIN yggl_main_emp as info on info.emp_num = sum.num and info.org_code = #{param.orgCode}
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month}
<if test="param.query != null and param.query != ''">
and ( sum.`name` like CONCAT('%',#{param.query},'%') or
sum.num like CONCAT('%',#{param.query},'%'))
sum.num like CONCAT('%',#{param.query},'%') or
info.custom_num like CONCAT('%',#{param.query},'%'))
</if>
<if test="param.attid != null and param.attid != ''">
and sum.att_group = #{param.attid}
......
......@@ -100,9 +100,9 @@
<select id="selectPageByQuery" resultMap="BaseResultMap_As" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_name
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) limit 1) as bm_name
FROM spmk_approve_summary a
WHERE a.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
......
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