|
@@ -4,7 +4,9 @@ import com.steerinfo.dil.mapper.RulesMapper;
|
|
|
import com.steerinfo.dil.service.impl.TmstruckSelfMachineService;
|
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.xml.crypto.Data;
|
|
@@ -13,6 +15,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* @author luobang
|
|
@@ -28,6 +31,9 @@ public class TmstruckSelfMachineController extends BaseRESTfulController {
|
|
|
@Autowired
|
|
|
RulesMapper rulesMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisTemplate redisTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 提货单
|
|
|
* @param orderNumber
|
|
@@ -79,6 +85,15 @@ public class TmstruckSelfMachineController extends BaseRESTfulController {
|
|
|
|| (DataChange.dataToBigDecimal(bigDecimal1.get("printnumber")).intValue() > maxPrintNumber)
|
|
|
|| (bigDecimal1.get("printDate")!=null && new Date().getTime() - ((Date)bigDecimal1.get("printDate")).getTime() < maxPrintDurationTime)) {
|
|
|
bigDecimal.put("printnumber",1);
|
|
|
+ } else {
|
|
|
+ String lockStr = "PRINT_LOCK_";
|
|
|
+ if(StringUtils.isNotEmpty(orderNumber)){
|
|
|
+ if("1".equals(redisTemplate.opsForValue().get(lockStr + orderNumber))){
|
|
|
+ bigDecimal.put("printnumber",1);
|
|
|
+ } else {
|
|
|
+ redisTemplate.opsForValue().set(lockStr + orderNumber, "1", 30, TimeUnit.SECONDS);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return bigDecimal;
|
|
|
}
|