Commit b1546998 by Administrator

Merge branch 'develop' into 'master'

Develop

See merge request 8timerv2/8timerapiv200!472
parents 479f66b1 6d04d320
...@@ -401,15 +401,15 @@ public class CrmController { ...@@ -401,15 +401,15 @@ public class CrmController {
Integer clientSource = crmClientData.getClientSource(); Integer clientSource = crmClientData.getClientSource();
Integer clientType = crmClientData.getClientType(); Integer clientType = crmClientData.getClientType();
Integer industry = crmClientData.getIndustry(); Integer industry = crmClientData.getIndustry();
if (clientSource != null) { if (clientSource != null && clientSource > 0) {
String clientSourceName = ClientSourceClass.builder().id(clientSource).build().selectById().getName(); // 客户来源 String clientSourceName = ClientSourceClass.builder().id(clientSource).build().selectById().getName(); // 客户来源
crmClientData.setClientSourceName(clientSourceName); crmClientData.setClientSourceName(clientSourceName);
} }
if (clientType != null) { if (clientType != null && clientType > 0) {
String clientTypeName = ClientTypeClass.builder().id(clientType).build().selectById().getName(); // 客户类型 String clientTypeName = ClientTypeClass.builder().id(clientType).build().selectById().getName(); // 客户类型
crmClientData.setClientTypeName(clientTypeName); crmClientData.setClientTypeName(clientTypeName);
} }
if (industry != null) { if (industry != null && industry > 0) {
String industryName = IndustryClass.builder().id(industry).build().selectById().getName();// 行业名 String industryName = IndustryClass.builder().id(industry).build().selectById().getName();// 行业名
crmClientData.setIndustryName(industryName); crmClientData.setIndustryName(industryName);
} }
...@@ -417,16 +417,20 @@ public class CrmController { ...@@ -417,16 +417,20 @@ public class CrmController {
return ResultUtil.error("新增失败"); return ResultUtil.error("新增失败");
Integer crmDataId = crmClientData.getId(); Integer crmDataId = crmClientData.getId();
Integer[] ids = crmClientData.getIds(); Integer[] ids = crmClientData.getIds();
for (Integer id : ids) { if(ids != null) {
CrmClientAssociate.builder().cid(crmDataId).associateId(id).orgCode(getOrgCode(userBean)).build().insert(); for (Integer id : ids) {
CrmClientAssociate.builder().cid(crmDataId).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
}
} }
List<CrmClientContacts> crmClientContacts = crmClientData.getCrmClientContacts(); List<CrmClientContacts> crmClientContacts = crmClientData.getCrmClientContacts();
int contactsnum = 0; int contactsnum = 0;
for (CrmClientContacts crmClientContact : crmClientContacts) { if(crmClientContacts != null) {
if(crmClientContact.getName() != null) { for (CrmClientContacts crmClientContact : crmClientContacts) {
crmClientContact.setCid(crmDataId); if(crmClientContact.getName() != null) {
crmClientContact.insert(); crmClientContact.setCid(crmDataId);
contactsnum++; crmClientContact.insert();
contactsnum++;
}
} }
} }
crmClientData.setContactsNum(contactsnum); crmClientData.setContactsNum(contactsnum);
...@@ -474,6 +478,7 @@ public class CrmController { ...@@ -474,6 +478,7 @@ public class CrmController {
CrmClientAssociate.builder().cid(cid).associateId(id).orgCode(getOrgCode(userBean)).build().insert(); CrmClientAssociate.builder().cid(cid).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
} }
crmClientData.setModifyUser(getEmpNum(userBean)); crmClientData.setModifyUser(getEmpNum(userBean));
crmClientData.setOrgCode(userBean.getOrgCode());
if (crmClientData.updateById()) if (crmClientData.updateById())
return ResultUtil.success("编辑成功"); return ResultUtil.success("编辑成功");
return ResultUtil.error("编辑失败"); return ResultUtil.error("编辑失败");
...@@ -503,16 +508,16 @@ public class CrmController { ...@@ -503,16 +508,16 @@ public class CrmController {
// 归属我的客户 // 归属我的客户
private List<CrmClientData> getMyCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status, private List<CrmClientData> getMyCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like,String startCreateTime, String endCreateTime, String startFollowTime, String endFollowTime) { String like,String startCreateTime, String endCreateTime, String startFollowTime, String endFollowTime,Integer typei) {
return CrmClientData.builder().build() return CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) .selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getBelongUser, empNum) .eq(CrmClientData::getBelongUser, empNum)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId) .eq(groupId != null && groupId > 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status) .eq(status != null && status > 0, CrmClientData::getClientStatus, status).eq(typei != null && typei > 0, CrmClientData::getClientType, typei)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime) .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime) .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime) .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime) .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime).like(!StrUtil.isBlank(like), CrmClientData::getBelongUserName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or() .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like) .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
.orderByDesc(CrmClientData::getCreateTime)); .orderByDesc(CrmClientData::getCreateTime));
...@@ -541,21 +546,21 @@ public class CrmController { ...@@ -541,21 +546,21 @@ public class CrmController {
// 我的全部客户 // 我的全部客户
private List<CrmClientData> getMyTotalCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status, private List<CrmClientData> getMyTotalCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like) { String like,Integer type) {
return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like,null,null,null,null), return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like,null,null,null,null,null),
getMyAssociateCilent(empNum, orgCode, groupId, status, like), true); getMyAssociateCilent(empNum, orgCode, groupId, status, like), true);
} }
// 我关注的客户 // 我关注的客户
private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status) { private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,Integer type) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null).stream() return getMyTotalCilent(empNum, orgCode, groupId, status, null,null).stream()
.filter(item -> item.getStar().equals(1)).collect(Collectors.toList()); .filter(item -> item.getStar().equals(1)).collect(Collectors.toList());
} }
// 七天未跟进的客户 // 七天未跟进的客户
private List<CrmClientData> getCilentFollowOvertime(Integer empNum, Integer orgCode, Integer groupId, private List<CrmClientData> getCilentFollowOvertime(Integer empNum, Integer orgCode, Integer groupId,
Integer status) { Integer status,Integer type) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null).stream() return getMyTotalCilent(empNum, orgCode, groupId, status, null,null).stream()
.filter(item -> item.getLastFollowTime() != null .filter(item -> item.getLastFollowTime() != null
&& item.getLastFollowTime().before(DateUtil.offsetDay(new Date(), -7))) && item.getLastFollowTime().before(DateUtil.offsetDay(new Date(), -7)))
.collect(Collectors.toList()); .collect(Collectors.toList());
...@@ -570,7 +575,7 @@ public class CrmController { ...@@ -570,7 +575,7 @@ public class CrmController {
@GetMapping("getMyCilentTotal") @GetMapping("getMyCilentTotal")
@ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean, public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false, defaultValue = "0") Integer type, @RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status, @RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status,
@RequestParam(required = false) String like, @RequestParam(required = false) String like,
@RequestParam(required = false, defaultValue = "1") int pageNumber, @RequestParam(required = false, defaultValue = "1") int pageNumber,
...@@ -578,12 +583,13 @@ public class CrmController { ...@@ -578,12 +583,13 @@ public class CrmController {
@RequestParam(required = false) String startCreateTime, @RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime, @RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime, @RequestParam(required = false) String startFollowTime,
@RequestParam(required = false) String endFollowTime) { @RequestParam(required = false) String endFollowTime,
@RequestParam(required = false) Integer typei) {
if(endCreateTime != null) { if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59"; endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
} }
if(endFollowTime != null) { if(endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10)+" 23:59:59"; endFollowTime = endFollowTime.substring(0, 10)+" 23:59:59";
} }
...@@ -591,18 +597,18 @@ public class CrmController { ...@@ -591,18 +597,18 @@ public class CrmController {
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
List<CrmClientData> crmClientDatas = null; List<CrmClientData> crmClientDatas = null;
if (type == null || type == 0) { // 全部客户(去重) if (type == null || type == 0) { // 全部客户(去重)
List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime); List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,typei);
List<CrmClientData> myAsso = getMyAssociateCilent(empNum, orgCode, groupId, status, like); List<CrmClientData> myAsso = getMyAssociateCilent(empNum, orgCode, groupId, status, like);
crmClientDatas = CheckUtil.distinct(myClient, myAsso, true).stream() crmClientDatas = CheckUtil.distinct(myClient, myAsso, true).stream()
.filter(CheckUtil.distinctByKey(CrmClientData::getId)).collect(Collectors.toList()); .filter(CheckUtil.distinctByKey(CrmClientData::getId)).collect(Collectors.toList());
} else if (type == 1) // 我负责的客户 } else if (type == 1) // 我负责的客户
crmClientDatas = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime); crmClientDatas = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,type);
else if (type == 2) // 我协作的客户 else if (type == 2) // 我协作的客户
crmClientDatas = getMyAssociateCilent(empNum, orgCode, groupId, status, like); crmClientDatas = getMyAssociateCilent(empNum, orgCode, groupId, status, like);
else if (type == 3) // 我关注的客户 else if (type == 3) // 我关注的客户
crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status); crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status,type);
else if (type == 4) // 七天未跟进的客户 else if (type == 4) // 七天未跟进的客户
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status); crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status,type);
else else
return ResultUtil.error("查询失败"); return ResultUtil.error("查询失败");
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序 // Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
...@@ -703,7 +709,7 @@ public class CrmController { ...@@ -703,7 +709,7 @@ public class CrmController {
@ApiOperation(value = "获取所有客户列表(全)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取所有客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getAllCilentTotal(@CurrentUser UserBean userBean, public Result<Object> getAllCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId,
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like, @RequestParam(required = false) Integer status, @RequestParam(required = false) String like,@RequestParam(required = false) String customerowner,
@RequestParam(required = false) String startCreateTime, @RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime, @RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime, @RequestParam(required = false) String startFollowTime,
...@@ -714,6 +720,13 @@ public class CrmController { ...@@ -714,6 +720,13 @@ public class CrmController {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
}
if(endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10)+" 23:59:59";
}
// YgglMainEmp yg = YgglMainEmp.builder().build() // YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode) // .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager)); // .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
...@@ -746,7 +759,7 @@ public class CrmController { ...@@ -746,7 +759,7 @@ public class CrmController {
new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId) .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type) .eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status) .eq(status != null && status >= 0, CrmClientData::getClientStatus, status).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime) .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime) .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime) .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
...@@ -766,7 +779,7 @@ public class CrmController { ...@@ -766,7 +779,7 @@ public class CrmController {
datas = CrmClientData.builder().build().selectPage(page, datas = CrmClientData.builder().build().selectPage(page,
new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId) .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type) .eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status).in(CrmClientData::getBelongGroup, keywordStr) .eq(status != null && status >= 0, CrmClientData::getClientStatus, status).in(CrmClientData::getBelongGroup, keywordStr)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime) .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime) .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
...@@ -1455,7 +1468,7 @@ public class CrmController { ...@@ -1455,7 +1468,7 @@ public class CrmController {
} }
crmClientData.setClientStatus(1); crmClientData.setClientStatus(1);
if(linkname != null) { if(!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
crmClientData.setContactsNum(1); crmClientData.setContactsNum(1);
} }
crmClientData.setBelongUser(empNum); crmClientData.setBelongUser(empNum);
...@@ -1480,7 +1493,7 @@ public class CrmController { ...@@ -1480,7 +1493,7 @@ public class CrmController {
Integer cid = crmClientData.getId(); Integer cid = crmClientData.getId();
if(linkname != null) { if(!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
CrmClientContacts contacts = new CrmClientContacts(); CrmClientContacts contacts = new CrmClientContacts();
contacts.setName(linkname); contacts.setName(linkname);
contacts.setCellphone(linkcellphone); contacts.setCellphone(linkcellphone);
......
...@@ -95,9 +95,11 @@ import cn.timer.api.dao.kqgl.ShiftManagementMapper; ...@@ -95,9 +95,11 @@ import cn.timer.api.dao.kqgl.ShiftManagementMapper;
import cn.timer.api.dao.kqgl.SpecialDateMapper; import cn.timer.api.dao.kqgl.SpecialDateMapper;
import cn.timer.api.dao.kqgl.UserAttendanceRelMapper; import cn.timer.api.dao.kqgl.UserAttendanceRelMapper;
import cn.timer.api.dao.kqgl.UserEquiRelationMapper; import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto; import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglMainKqzDto; import cn.timer.api.dto.kqmk.KqglMainKqzDto;
import cn.timer.api.utils.DateUtil; import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -314,6 +316,10 @@ public class AttController { ...@@ -314,6 +316,10 @@ public class AttController {
return ResultUtil.data(shifs); return ResultUtil.data(shifs);
} }
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
/** /**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改) * 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
*/ */
...@@ -327,120 +333,270 @@ public class AttController { ...@@ -327,120 +333,270 @@ public class AttController {
int qyid = userBean.getOrgCode();//坏小孩【企业id】 int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id int userid = userBean.getEmpNum();//用户id
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid())); String dastr = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid()));
boolean xiugai = true;
//记录排班(排班制) //记录排班(排班制)
List<Schedule> schlist=new ArrayList<Schedule>(); List<Schedule> schlist=new ArrayList<Schedule>();
Schedule[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期 Schedule[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
if(schedules.length>0 && attass.getAtttype() == 2){ if(schedules.length>0 && attass.getAtttype() == 2){
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule(); String date = String.valueOf(schedules[0].getData());
sch.setUserid(schedules[p].getUserid());//用户id Date dt=new Date(date);
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
sch.setBcid(schedules[p].getBcid());//班次id 0为休息 System.out.println(famt.format(dt));
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch); if(!(famt.format(dt)).equals(dastr)) {
xiugai = false;
/*****************************/ for(int p=0;p<schedules.length;p++){
//转换日期 Schedule sch = new Schedule();
String data = mat.format(new Date(schedules[p].getData().toString())); sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
Long startDate = 0l; sch.setBcid(schedules[p].getBcid());//班次id 0为休息
Long endDate = 0l; sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
try { schlist.add(sch);
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();
} }
if(schlist.size()>0){
//当天修改后的班次 scheduleservice.insertKqglAssoPbmxList(schlist);
ShiftManagement banci = shiftmanagementservice.selectByPrimaryKey(schedules[p].getBcid()); }
Long sbdk1 = 0l; }else {
Long xbdk1 = 0l; xiugai = true;
Long sbdk2 = 0l; for(int p=0;p<schedules.length;p++){
Long xbdk2 = 0l; Schedule sch = new Schedule();
Long sbdk3 = 0l; sch.setUserid(schedules[p].getUserid());//用户id
Long xbdk3 = 0l; sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
if(banci != null){ sch.setBcid(schedules[p].getBcid());//班次id 0为休息
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){ sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
sbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk1()+":00")); schlist.add(sch);
xbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk1()+":00"));
/*****************************/
//转换日期
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();
} }
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")); 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"));
}
} }
if(banci.getSxbcs()== 3){ //之前打卡的班次
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk3()+":00")); PunchRecord mapuca = punchrecordservice.MaintenancePunchCard(startDate,endDate,schedules[p].getUserid());
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk3()+":00"));
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
List<PunchRecord> initial = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
if(initial.size() > 0){
RestMethod(initial,initial.get(0).getDkmxid());
}
} }
}
//之前打卡的班次
PunchRecord mapuca = punchrecordservice.MaintenancePunchCard(startDate,endDate,schedules[p].getUserid()); //当天的所有打卡记录
List<PunchRecord> mapucalist = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
PunchRecord minAttid = null;
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){ PunchRecord maxAttid = null;
List<PunchRecord> initial = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid()); int dkmxid = 0;
if(initial.size() > 0){ if(mapucalist.size() > 0){
RestMethod(initial,initial.get(0).getDkmxid()); //最小值
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();
} }
}
//当天的所有打卡记录
List<PunchRecord> mapucalist = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
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){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){ for(PunchRecord pre : mapucalist){/********/
if(banci != null){//修改后有班次打卡 if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
if(banci.getSxbcs() == 1){//修改后一天打两次 PunchRecord record = new PunchRecord();
if(mapucalist.size() > 2){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤 record.setId(pre.getId());
for(PunchRecord pre : mapucalist){/********/ record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新” record.setSort(0);//序号(0:打卡无效:此记录已被更新)
PunchRecord record = new PunchRecord(); if((pre.getSort())%2 > 0){//上班
record.setId(pre.getId()); Long time = (pre.getDktime() - sbdk1)/1000/60;
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休) if(time > 0){
record.setSort(0);//序号(0:打卡无效:此记录已被更新) record.setResults(Integer.valueOf(time.toString()));// 打卡结果
if((pre.getSort())%2 > 0){//上班 }else{
Long time = (pre.getDktime() - sbdk1)/1000/60; record.setResults(0);// 打卡结果
if(time > 0){ }
record.setResults(Integer.valueOf(time.toString()));// 打卡结果 record.setAttime(sbdk1);//上班应打卡时间
}else{ }else{//下班
record.setResults(0);// 打卡结果 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.setAttime(sbdk1);//上班应打卡时间 record.setBcid(banci.getId());//班次id
}else{//下班 punchrecordservice.updateByPrimaryKeySelective(record);
Long time = (pre.getDktime() - xbdk1)/1000/60; }else{
if(time > 0){ if(pre.getId() == minAttid.getId()){//上班
record.setResults(0);// 打卡结果 PunchRecord record = new PunchRecord();
}else{ record.setId(pre.getId());
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果 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
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);
punchrecordservice.updateByPrimaryKeySelective(record);
} }
record.setAttime(xbdk1);//下班应打卡时间
} }
}
//修改打卡明细
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));
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 record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
}else{ //
if(pre.getId() == minAttid.getId()){//上班 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"));
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);
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));
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(); PunchRecord record = new PunchRecord();
record.setId(pre.getId()); record.setId(mapucalist.get(y).getId());
record.setType(1);//上班 // record.setType(1);//上班
Long time = (pre.getDktime() - sbdk1)/1000/60; Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){ if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休) record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果 record.setResults(Integer.valueOf(time.toString()));// 打卡结果
...@@ -451,11 +607,49 @@ public class AttController { ...@@ -451,11 +607,49 @@ public class AttController {
record.setAttime(sbdk1); record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
}else if(pre.getId() == maxAttid.getId()){//下班 }
if(y == 1 || y == 2){
PunchRecord record = new PunchRecord(); PunchRecord record = new PunchRecord();
record.setId(pre.getId()); 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
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);//下班 record.setType(2);//下班
Long time = (pre.getDktime() - xbdk1)/1000/60; Long time = (maxdata.getDktime() - xbdk2)/1000/60;
if(time > 0){ if(time > 0){
record.setStatus(1); record.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
...@@ -463,111 +657,123 @@ public class AttController { ...@@ -463,111 +657,123 @@ public class AttController {
record.setStatus(4); record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果 record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
} }
record.setAttime(xbdk1); record.setSort(4);
record.setAttime(xbdk2);
record.setBcid(banci.getId());//班次id
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 record.setBcid(banci.getId());//班次id
record.setSort(2);
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
} }
} }
}
//修改打卡明细 //修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班 PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails(); PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime()); record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果 record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null); record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果 record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null); record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果 record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null); record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果 record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null); record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果 record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null); record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果 record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数 record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0")); record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record); punchcarddetailsservice.ModifyPunchDetails(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//上班 for(int t=0;t<str.length;t++){
PunchCardDetails max = new PunchCardDetails(); PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime()); PunchCardDetails dkmx = new PunchCardDetails();
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果 dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
Long woktimes = (maxdata.getDktime() - mindata.getDktime())/1000/60; dkmx.setXbdk1(dtdkmx.getDktime());
max.setGzsc(Double.valueOf(woktimes)); dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
punchcarddetailsservice.updateByPrimaryKeySelective(max); dkmx.setSbdk2(dtdkmx.getDktime());
}else{//// dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
PunchRecord mindataone = null; }else{
//当天打卡记录为1条 dkmx.setXbdk2(dtdkmx.getDktime());
if(minAttid != null || maxAttid != null){ dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
PunchRecord record = new PunchRecord(); }
record.setId(mapucalist.get(0).getId());//当天一条记录的id Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
record.setType(1);//上班 dkmx.setGzsc(Double.valueOf(woktimes));
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){ punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
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 }else{//打卡小于4次
punchrecordservice.updateByPrimaryKeySelective(record); PunchRecord mindataone = null;
// if(minAttid != null || maxAttid != null){
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班 PunchRecord record = new PunchRecord();
PunchCardDetails dan = new PunchCardDetails(); record.setId(mapucalist.get(0).getId());//当天一条记录的id
dan.setId(dkmxid);//需修改的明细id record.setType(1);//上班
dan.setSbdk1(mindataone.getDktime()); Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果 if(time > 0){
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数 record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
dan.setGzsc(Double.valueOf("0")); record.setResults(Integer.valueOf(time.toString()));// 打卡结果
punchcarddetailsservice.updateByPrimaryKeySelective(dan); }else{
} record.setStatus(1);
//当天打卡记录为2条 record.setResults(0);// 打卡结果
if(maxAttid != null && minAttid.getId() != maxAttid.getId()){ }
PunchRecord record = new PunchRecord(); record.setAttime(sbdk1);//当天应打卡时间
record.setId(mapucalist.get(1).getId()); record.setBcid(banci.getId());//班次id
record.setType(2);//下班 punchrecordservice.updateByPrimaryKeySelective(record);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60; //
if(time > 0){ mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
record.setStatus(1); PunchCardDetails dan = new PunchCardDetails();
record.setResults(0);// 打卡结果 dan.setId(dkmxid);//需修改的明细id
}else{ dan.setSbdk1(mindataone.getDktime());
record.setStatus(4); dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果 dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
} }
record.setAttime(xbdk1);
record.setBcid(banci.getId());//班次id
record.setSort(2);
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));
punchcarddetailsservice.updateByPrimaryKeySelective(max); PunchCardDetails pcd = new PunchCardDetails();
} if(mapucalist.size() >= 2){
} /***/
}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(); PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId()); record.setId(mapucalist.get(1).getId());//当天一条记录的id
// record.setType(1);//上班 record.setType(2);
Long time = (mindata.getDktime() - sbdk1)/1000/60; 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
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){ if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休) record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果 record.setResults(Integer.valueOf(time.toString()));// 打卡结果
...@@ -575,52 +781,238 @@ public class AttController { ...@@ -575,52 +781,238 @@ public class AttController {
record.setStatus(1); record.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
} }
record.setAttime(sbdk1); record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
} }
if(y == 1 || y == 2){ if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord(); PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId()); record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
if((mapucalist.get(y).getSort())%2 == 0){//下班 Long time = (maxAttid.getDktime() - xbdk2)/1000/60;
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(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
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){ 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.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
} }
record.setAttime(xbdk1);//下班应打卡时间 record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2 || y == 3 || y == 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
str[0] = String.valueOf(mapucalist.get(y).getId()); if((mapucalist.get(y).getSort())%2 == 0){//下班
}else{//上班 if(y == 1){
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60; 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
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){ if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1); record.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
} }
record.setAttime(sbdk2);//上班应打卡时间 record.setSort(6);
record.setAttime(xbdk3);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[1] = String.valueOf(mapucalist.get(y).getId()); 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
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));
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 record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(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"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
} }
PunchCardDetails pcd = new PunchCardDetails();
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班 if(mapucalist.size() >= 2){
if(mapucalist.get(y).getId() == maxdata.getId()){//下班 /***/
PunchRecord record = new PunchRecord(); PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setId(maxdata.getId()); record.setType(2);
record.setType(2);//下班 Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
Long time = (maxdata.getDktime() - xbdk2)/1000/60;
if(time > 0){ if(time > 0){
record.setStatus(1); record.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
...@@ -628,172 +1020,43 @@ public class AttController { ...@@ -628,172 +1020,43 @@ public class AttController {
record.setStatus(4); record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果 record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
} }
record.setSort(4); record.setAttime(xbdk1);//当天应打卡时间
record.setAttime(xbdk2);
record.setBcid(banci.getId());//班次id record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
/***/
str[2] = String.valueOf(maxdata.getId()); PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
} }
if(mapucalist.size() >= 3){
if(y == 3 || y > 3 && mapucalist.get(y).getId() != maxdata.getId()){ /***/
PunchRecord record = new PunchRecord(); PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId()); record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休) record.setType(1);
record.setSort(0);//序号(0:打卡无效:此记录已被更新) Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
record.setResults(0);// 打卡结果 if(time > 0){
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间 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 record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
} }
}
//修改打卡明细
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));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx); if(mapucalist.size() >= 4){
} /***/
}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
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"));
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
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
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
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
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(); PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId()); record.setId(mapucalist.get(3).getId());//当天一条记录的id
Long time = (mindata.getDktime() - sbdk1)/1000/60; record.setType(1);
Long time = (mapucalist.get(3).getDktime() - xbdk2)/1000/60;
if(time > 0){ if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休) record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果 record.setResults(Integer.valueOf(time.toString()));// 打卡结果
...@@ -801,80 +1064,45 @@ public class AttController { ...@@ -801,80 +1064,45 @@ public class AttController {
record.setStatus(1); record.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
} }
record.setAttime(sbdk1); record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(3).getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
} }
if(y == 1 || y == 2 || y == 3 || y == 4){ if(mapucalist.size() >= 5){
/***/
PunchRecord record = new PunchRecord(); PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId()); record.setId(mapucalist.get(4).getId());//当天一条记录的id
record.setType(1);
if((mapucalist.get(y).getSort())%2 == 0){//下班 Long time = (mapucalist.get(4).getDktime() - sbdk3)/1000/60;
if(y == 1){ if(time > 0){
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60; record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){ record.setResults(Integer.valueOf(time.toString()));// 打卡结果
record.setStatus(1); }else{
record.setResults(0);// 打卡结果 record.setStatus(1);
}else{ record.setResults(0);// 打卡结果
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.setAttime(sbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(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 maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班 /***/
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord(); PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setId(maxdata.getId()); record.setType(2);
record.setType(2);//下班 Long time = (maxAttid.getDktime() - xbdk3)/1000/60;
Long time = (maxdata.getDktime() - xbdk3)/1000/60;
if(time > 0){ if(time > 0){
record.setStatus(1); record.setStatus(1);
record.setResults(0);// 打卡结果 record.setResults(0);// 打卡结果
...@@ -882,235 +1110,38 @@ public class AttController { ...@@ -882,235 +1110,38 @@ public class AttController {
record.setStatus(4); record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果 record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
} }
record.setSort(6); record.setAttime(xbdk3);//当天应打卡时间
record.setAttime(xbdk3);
record.setBcid(banci.getId());//班次id record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record); punchrecordservice.updateByPrimaryKeySelective(record);
/***/
str[4] = String.valueOf(maxdata.getId()); PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
} }
if(y == 5 || y > 5 && mapucalist.get(y).getId() != maxdata.getId()){ pcd.setId(dkmxid);
PunchRecord record = new PunchRecord(); punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
record.setId(mapucalist.get(y).getId()); /**bbb***/
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
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));
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
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"));
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
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
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
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
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
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
/**bbb***/
} }
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
} }
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
} }
/***********************/
} }
}//判断新增或修改
/***********************/
}
} }
if(schlist.size()>0){ if(schlist.size()>0 && xiugai){
//删除排班明细表(自由排班) //删除排班明细表(自由排班)
scheduleservice.deleteByPrimaryBykqzid(id); scheduleservice.deleteByPrimaryBykqzid(id);
scheduleservice.insertKqglAssoPbmxList(schlist); scheduleservice.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功"); return ResultUtil.data(schlist,"修改考勤组排班成功");
} }
return ResultUtil.error("修改考勤组排班失败"); return ResultUtil.data(schlist,"修改考勤组排班成功");
// return ResultUtil.error("修改考勤组排班失败");
} }
/** /**
......
...@@ -3927,27 +3927,29 @@ public class ClockInController { ...@@ -3927,27 +3927,29 @@ public class ClockInController {
} }
} }
if(!(nextrange[0]).equals("")) {
for(String nus : nextrange) { for(String nus : nextrange) {
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build(); WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
wocal.setDate(nus); wocal.setDate(nus);
if(pbfs == 3) { if(pbfs == 3) {
wocal.setCalendar_status(0);// wocal.setCalendar_status(0);//
wocal.setCalendar_status_type(0);
}else {
if(ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),nus)) {
wocal.setCalendar_status(1);//
wocal.setCalendar_status_type(0);
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),nus)) {
wocal.setCalendar_status(4);//
wocal.setCalendar_status_type(0); wocal.setCalendar_status_type(0);
}else {
if(ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),nus)) {
wocal.setCalendar_status(1);//
wocal.setCalendar_status_type(0);
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),nus)) {
wocal.setCalendar_status(4);//
wocal.setCalendar_status_type(0);
}
} }
}
workcal.add(wocal);
workcal.add(wocal); }
} }
} }
}else { }else {
String time = date+"-01"; String time = date+"-01";
......
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