WcsscanbarcodeService.java
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.huaheng.pc.config.wcsscanbarcode.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.common.utils.DataUtils;
import com.huaheng.common.utils.DateUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.pc.config.wcsscanbarcode.domain.Wcsscanbarcode;
import com.huaheng.pc.config.wcsscanbarcode.mapper.WcsscanbarcodeMapper;
/**
*
* @author Enzo Cotter
* @date 2019/12/26
*/
@Service
public class WcsscanbarcodeService extends ServiceImpl<WcsscanbarcodeMapper, Wcsscanbarcode> {
public AjaxResult refresh(){
LambdaQueryWrapper<Wcsscanbarcode> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Wcsscanbarcode::getFlag, 0);
List<Wcsscanbarcode> wcsscanbarcodeList = list(queryWrapper);
for ( Wcsscanbarcode barcode: wcsscanbarcodeList) {
if (DateUtils.difference(new Date(), barcode.getCreated()) > 119){
barcode.setFlag(1);
barcode.setContent("扫描容器记录超时");
if (!updateById(barcode)){
return AjaxResult.error("更新"+barcode.getBarcode()+"id:"+barcode.getId()+"失败");
}
}
}
return AjaxResult.success("更新成功");
}
}