|
@@ -5,6 +5,7 @@ import com.jjt.biz.vo.KnittingEmpVO;
|
|
|
import com.jjt.biz.vo.SalaryVO;
|
|
|
import com.jjt.common.core.controller.BaseController;
|
|
|
import com.jjt.common.core.domain.AjaxResult;
|
|
|
+import com.jjt.common.utils.StringUtils;
|
|
|
import com.jjt.emp.domain.TwinEmpCalc;
|
|
|
import com.jjt.emp.service.ITwinEmpCalcService;
|
|
|
import com.jjt.wkEmp.domain.TwinWkEmpSync;
|
|
@@ -41,6 +42,32 @@ public class ApiThirdController extends BaseController {
|
|
|
@PostMapping("/api/knitting/emp/schedule")
|
|
|
@CrossOrigin(origins = "*")
|
|
|
public AjaxResult empSchedule(@RequestBody KnittingEmpVO vo) {
|
|
|
+ // 校验参数不能为空或空字符串,并返回具体错误信息
|
|
|
+ if (vo == null) {
|
|
|
+ return AjaxResult.error("请求参数不能为空");
|
|
|
+ }
|
|
|
+ if (vo.getDate() == null) {
|
|
|
+ return AjaxResult.error("日期不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(vo.getId())) {
|
|
|
+ return AjaxResult.error("员工号不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(vo.getName())) {
|
|
|
+ return AjaxResult.error("员工姓名不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(vo.getTeam())) {
|
|
|
+ return AjaxResult.error("班组不能为空");
|
|
|
+ }
|
|
|
+ if (vo.getIn() == null) {
|
|
|
+ return AjaxResult.error("上班时间不能为空");
|
|
|
+ }
|
|
|
+ if (vo.getOut() == null) {
|
|
|
+ return AjaxResult.error("下班时间不能为空");
|
|
|
+ }
|
|
|
+ if (vo.getDevices() == null || vo.getDevices().isEmpty()) {
|
|
|
+ return AjaxResult.error("机台号不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
TwinWkEmpSync sync = new TwinWkEmpSync();
|
|
|
Date s = new Date();
|
|
|
sync.setRecordTime(s);
|
|
@@ -57,8 +84,8 @@ public class ApiThirdController extends BaseController {
|
|
|
sync.setStatus("Y");
|
|
|
syncService.updateTwinWkEmpSync(sync);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- AjaxResult.error(e.getMessage());
|
|
|
+ log.error("员工排班同步失败", e);
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|