|
@@ -34,13 +34,16 @@ public class WxCheckOptionService extends BaseService {
|
|
|
List<CheckinDate> checkinDate = option.getGroup().getCheckinDate();
|
|
|
if (option.getGroup() != null && !checkinDate.isEmpty()
|
|
|
&& checkinDate.get(0).getCheckinTime().length > 0) {
|
|
|
- SapCheckOption check = new SapCheckOption();
|
|
|
- CheckinTime checkinTime = checkinDate.get(0).getCheckinTime()[0];
|
|
|
- check.setUserId(option.getUserId());
|
|
|
- check.setWorkSec(checkinTime.getWorkSec());
|
|
|
- check.setOffWorkSec(checkinTime.getOffWorkSec());
|
|
|
- check.setNoNeedOffwork(checkinDate.get(0).getNoNeedOffwork());
|
|
|
- save(check);
|
|
|
+ SapCheckOption check = selectByUserId(option.getUserId());
|
|
|
+ if(check == null) {
|
|
|
+ check = new SapCheckOption();
|
|
|
+ CheckinTime checkinTime = checkinDate.get(0).getCheckinTime()[0];
|
|
|
+ check.setUserId(option.getUserId());
|
|
|
+ check.setWorkSec(checkinTime.getWorkSec());
|
|
|
+ check.setOffWorkSec(checkinTime.getOffWorkSec());
|
|
|
+ check.setNoNeedOffwork(checkinDate.get(0).getNoNeedOffwork());
|
|
|
+ save(check);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -49,4 +52,8 @@ public class WxCheckOptionService extends BaseService {
|
|
|
public void save(SapCheckOption check) throws Exception {
|
|
|
save("SapCheckOptionMapper.save", check);
|
|
|
}
|
|
|
+
|
|
|
+ public SapCheckOption selectByUserId(String userId) throws Exception {
|
|
|
+ return (SapCheckOption) findObject("SapCheckOptionMapper.selectByUserId", userId);
|
|
|
+ }
|
|
|
}
|