|
@@ -71,6 +71,9 @@ public class CanteenDiningRecordController {
|
|
|
@Autowired
|
|
|
private UserCompanyService userCompanyService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonDeviceLogService personDeviceLogService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
public MessageResult<CanteenDiningRecord> create(){
|
|
@@ -1025,4 +1028,63 @@ public class CanteenDiningRecordController {
|
|
|
|
|
|
return messageResult;
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("batchUpdate")
|
|
|
+ @ApiOperation(value="更新食堂就餐记录")
|
|
|
+ public MessageResult<Integer> batchUpdate(Long personId,String deviceNo,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") Date startTime,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") Date endTime){
|
|
|
+ MessageResult<Integer> messageResult = new MessageResult<>();
|
|
|
+ int affectCount = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ if(personId!=null){
|
|
|
+ searchParams.put("personId",personId);
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("deviceNo",deviceNo);
|
|
|
+ searchParams.put("beginTime", startTime);
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time","asc"));
|
|
|
+
|
|
|
+ Page<PersonDeviceLog> page = personDeviceLogService.pageSearch(searchParams,1,100,true,sortList);
|
|
|
+ int pages = page.getPages();
|
|
|
+
|
|
|
+ for (int i=1;i<=pages;i++){
|
|
|
+ List<PersonDeviceLog> list;
|
|
|
+
|
|
|
+ if(i==1) {
|
|
|
+ list = page.getResult();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ page = personDeviceLogService.pageSearch(searchParams,i,100,true,sortList);
|
|
|
+ list = page.getResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (PersonDeviceLog personDeviceLog : list) {
|
|
|
+ boolean result = canteenDiningRecordService.punchIn(personDeviceLog.getDeviceNo(),personDeviceLog.getPersonId(),personDeviceLog.getRecordTime());
|
|
|
+
|
|
|
+ if (result){
|
|
|
+ affectCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 填写具体代码
|
|
|
+ messageResult.setData(affectCount);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
}
|