no message
							parent
							
								
									b05414c6d9
								
							
						
					
					
						commit
						8fb698fce0
					
				| 
						 | 
					@ -67,13 +67,11 @@ public interface LogService {
 | 
				
			||||||
     * @param joinPoint /
 | 
					     * @param joinPoint /
 | 
				
			||||||
     * @param log       日志实体
 | 
					     * @param log       日志实体
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Async
 | 
					
 | 
				
			||||||
    void save(String url, String returnValue, String username, String browser, String ip, JoinPoint joinPoint, Log log);
 | 
					    void save(String url, String returnValue, String username, String browser, String ip, JoinPoint joinPoint, Log log);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Async
 | 
					 | 
				
			||||||
    void saveLog(Log log);
 | 
					    void saveLog(Log log);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Async
 | 
					 | 
				
			||||||
    void saveLogInfo(Object object, String url, String resultJson, String description, long time);
 | 
					    void saveLogInfo(Object object, String url, String resultJson, String description, long time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,8 @@ import org.aspectj.lang.ProceedingJoinPoint;
 | 
				
			||||||
import org.aspectj.lang.reflect.MethodSignature;
 | 
					import org.aspectj.lang.reflect.MethodSignature;
 | 
				
			||||||
import org.springframework.data.domain.Page;
 | 
					import org.springframework.data.domain.Page;
 | 
				
			||||||
import org.springframework.data.domain.Pageable;
 | 
					import org.springframework.data.domain.Pageable;
 | 
				
			||||||
 | 
					import org.springframework.scheduling.annotation.Async;
 | 
				
			||||||
 | 
					import org.springframework.scheduling.annotation.EnableAsync;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
					import org.springframework.web.bind.annotation.RequestBody;
 | 
				
			||||||
| 
						 | 
					@ -80,8 +82,10 @@ public class LogServiceImpl implements LogService {
 | 
				
			||||||
        return PageUtil.toPage(page.map(logSmallMapper::toDto));
 | 
					        return PageUtil.toPage(page.map(logSmallMapper::toDto));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @Async
 | 
				
			||||||
    public void save(String url,String  returnValue,String username, String browser, String ip, JoinPoint joinPoint, Log log_data) {
 | 
					    public void save(String url,String  returnValue,String username, String browser, String ip, JoinPoint joinPoint, Log log_data) {
 | 
				
			||||||
        if (log_data == null) {
 | 
					        if (log_data == null) {
 | 
				
			||||||
            throw new IllegalArgumentException("Log 不能为 null!");
 | 
					            throw new IllegalArgumentException("Log 不能为 null!");
 | 
				
			||||||
| 
						 | 
					@ -115,6 +119,7 @@ public class LogServiceImpl implements LogService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @Async
 | 
				
			||||||
    public void saveLog(Log log_data) {
 | 
					    public void saveLog(Log log_data) {
 | 
				
			||||||
        if (log_data == null) {
 | 
					        if (log_data == null) {
 | 
				
			||||||
            throw new IllegalArgumentException("Log 不能为 null!");
 | 
					            throw new IllegalArgumentException("Log 不能为 null!");
 | 
				
			||||||
| 
						 | 
					@ -124,6 +129,7 @@ public class LogServiceImpl implements LogService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @Async
 | 
				
			||||||
    public void saveLogInfo(Object object,String url, String resultJson, String description, long time) {
 | 
					    public void saveLogInfo(Object object,String url, String resultJson, String description, long time) {
 | 
				
			||||||
        // 设置日志信息
 | 
					        // 设置日志信息
 | 
				
			||||||
        Log log_data = new Log();
 | 
					        Log log_data = new Log();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Generated(
 | 
					@Generated(
 | 
				
			||||||
    value = "org.mapstruct.ap.MappingProcessor",
 | 
					    value = "org.mapstruct.ap.MappingProcessor",
 | 
				
			||||||
    date = "2024-04-28T13:35:56+0800",
 | 
					    date = "2024-05-07T17:40:17+0800",
 | 
				
			||||||
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
					    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Generated(
 | 
					@Generated(
 | 
				
			||||||
    value = "org.mapstruct.ap.MappingProcessor",
 | 
					    value = "org.mapstruct.ap.MappingProcessor",
 | 
				
			||||||
    date = "2024-04-28T13:35:56+0800",
 | 
					    date = "2024-05-07T17:40:17+0800",
 | 
				
			||||||
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
					    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,6 @@ import static org.springframework.http.HttpStatus.OK;
 | 
				
			||||||
@Api(tags = "KMReS")
 | 
					@Api(tags = "KMReS")
 | 
				
			||||||
@RequestMapping("/interfaces/api/amr")
 | 
					@RequestMapping("/interfaces/api/amr")
 | 
				
			||||||
@Slf4j
 | 
					@Slf4j
 | 
				
			||||||
@EnableAsync
 | 
					 | 
				
			||||||
public class KMReSController {
 | 
					public class KMReSController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final AgvTaskService agvTaskService;
 | 
					    private final AgvTaskService agvTaskService;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
    private final MoService moService;
 | 
					    private final MoService moService;
 | 
				
			||||||
    private final PointService pointService;
 | 
					    private final PointService pointService;
 | 
				
			||||||
    private final InventoryService inventoryService;
 | 
					    private final InventoryService inventoryService;
 | 
				
			||||||
    private final RedisUtils redisUtils;
 | 
					    private final RedisObjectUtils redisObjectUtils;
 | 
				
			||||||
    private final BatchCreateOrUpdate batchCreateOrUpdate;
 | 
					    private final BatchCreateOrUpdate batchCreateOrUpdate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,6 +99,10 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
					        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
				
			||||||
 | 
					        if (resulObject == null) {
 | 
				
			||||||
 | 
					            throw new IllegalArgumentException("获取送货单接口返回数据为空!");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
					        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
				
			||||||
        String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
 | 
					        String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
 | 
				
			||||||
        //判断接口是否成功
 | 
					        //判断接口是否成功
 | 
				
			||||||
| 
						 | 
					@ -106,11 +110,12 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
            throw new IllegalArgumentException("获取送货单接口异常信息:" + msg);
 | 
					            throw new IllegalArgumentException("获取送货单接口异常信息:" + msg);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
 | 
					        JSONObject dataObject = resulObject.getJSONObject("data");
 | 
				
			||||||
        if (StringUtils.isEmpty(data)) {
 | 
					        if (dataObject == null) {
 | 
				
			||||||
            throw new IllegalArgumentException("获取送货单接口返回数据为空!");
 | 
					            throw new IllegalArgumentException("获取送货单接口返回数据为空!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        JSONObject dataObject = JSON.parseObject(data);
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JSONArray details = dataObject.getJSONArray("list");
 | 
					        JSONArray details = dataObject.getJSONArray("list");
 | 
				
			||||||
        //判断是否有送货单数据
 | 
					        //判断是否有送货单数据
 | 
				
			||||||
        if (details == null || details.isEmpty()) {
 | 
					        if (details == null || details.isEmpty()) {
 | 
				
			||||||
| 
						 | 
					@ -236,6 +241,9 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
					        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
				
			||||||
 | 
					        if (resulObject == null) {
 | 
				
			||||||
 | 
					            throw new IllegalArgumentException("MO票接口返回数据为空!");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
					        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
				
			||||||
        String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
 | 
					        String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -243,12 +251,11 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
            throw new IllegalArgumentException("MO票接口异常: " + msg);
 | 
					            throw new IllegalArgumentException("MO票接口异常: " + msg);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
 | 
					        JSONObject dataObject = resulObject.getJSONObject("data");
 | 
				
			||||||
        if (StringUtils.isEmpty(data)) {
 | 
					        if (dataObject == null) {
 | 
				
			||||||
            throw new IllegalArgumentException("获取MO票接口返回数据为空!");
 | 
					            throw new IllegalArgumentException("MO票接口返回数据为空!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        JSONObject dataObject = JSON.parseObject(data);
 | 
					 | 
				
			||||||
        JSONArray details = dataObject.getJSONArray("list");
 | 
					        JSONArray details = dataObject.getJSONArray("list");
 | 
				
			||||||
        //判断是否有MO票数据
 | 
					        //判断是否有MO票数据
 | 
				
			||||||
        if (details == null || details.isEmpty()) {
 | 
					        if (details == null || details.isEmpty()) {
 | 
				
			||||||
| 
						 | 
					@ -273,7 +280,7 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
        Map<String, Mo> existingMos = moService.findBylabelNos(labelNos);
 | 
					        Map<String, Mo> existingMos = moService.findBylabelNos(labelNos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //获取仓库
 | 
					        //获取仓库
 | 
				
			||||||
        Dept dept = getDeptFromCache();
 | 
					        Dept dept = redisObjectUtils.getObjectFromCache("dept", () -> deptService.toEntity(deptService.findById(7L)), "系统无此仓库!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //循环处理每个MO票
 | 
					        //循环处理每个MO票
 | 
				
			||||||
        for (int i = 0; i < details.size(); i++) {
 | 
					        for (int i = 0; i < details.size(); i++) {
 | 
				
			||||||
| 
						 | 
					@ -313,22 +320,6 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Dept getDeptFromCache() {
 | 
					 | 
				
			||||||
        // 从缓存中获取部门信息
 | 
					 | 
				
			||||||
        Dept dept = (Dept) redisUtils.get("dept");
 | 
					 | 
				
			||||||
        if (dept == null) {
 | 
					 | 
				
			||||||
            try {
 | 
					 | 
				
			||||||
                // 缓存中不存在,从数据库中获取
 | 
					 | 
				
			||||||
                DeptDto deptDto = deptService.findById(7L);
 | 
					 | 
				
			||||||
                dept = deptService.toEntity(deptDto);
 | 
					 | 
				
			||||||
                redisUtils.set("dept", dept); // 存储到缓存,可考虑设置适当的过期时间或不设
 | 
					 | 
				
			||||||
            } catch (Exception e) {
 | 
					 | 
				
			||||||
                e.printStackTrace();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return dept;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 创建订单
 | 
					     * 创建订单
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
| 
						 | 
					@ -412,14 +403,9 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //目标点
 | 
					        //目标点
 | 
				
			||||||
        Point endPoint = null;
 | 
					        Point endPoint = redisObjectUtils.getObjectFromCache("ckjbk", () -> pointService.findByCode(null, null, null, "出库接驳口", null),
 | 
				
			||||||
        boolean flag = redisUtils.hasKey("ckjbk");
 | 
					        "系统无此点位!");
 | 
				
			||||||
        if (flag) {
 | 
					
 | 
				
			||||||
            endPoint = (Point) redisUtils.get("ckjbk");
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            endPoint = pointService.findByCode(null, null, null, "出库接驳口", null);
 | 
					 | 
				
			||||||
            redisUtils.set("ckjbk", endPoint);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        List<Inventory> inventoryToUpdate = new ArrayList<>();
 | 
					        List<Inventory> inventoryToUpdate = new ArrayList<>();
 | 
				
			||||||
        List<PickDetail> pickDetailToCreate = new ArrayList<>();
 | 
					        List<PickDetail> pickDetailToCreate = new ArrayList<>();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,7 +64,7 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
    private final TaskService taskService;
 | 
					    private final TaskService taskService;
 | 
				
			||||||
    private final AsnDetailService asnDetailService;
 | 
					    private final AsnDetailService asnDetailService;
 | 
				
			||||||
    private final ItemKeyService itemKeyService;
 | 
					    private final ItemKeyService itemKeyService;
 | 
				
			||||||
    private final RedisUtils redisUtils;
 | 
					    private final RedisObjectUtils redisObjectUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Map<String, Object> queryAll(MoQueryCriteria criteria, Pageable pageable) {
 | 
					    public Map<String, Object> queryAll(MoQueryCriteria criteria, Pageable pageable) {
 | 
				
			||||||
| 
						 | 
					@ -164,41 +164,23 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
        String labelNo = arr[2];//标签号
 | 
					        String labelNo = arr[2];//标签号
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证物料是否存在
 | 
					        // 验证物料是否存在
 | 
				
			||||||
        Item item = null;
 | 
					        Item item = redisObjectUtils.getObjectFromCache(itemCode, () -> itemService.existItem(itemCode), itemCode + " 系统无此物料!");
 | 
				
			||||||
        boolean flagItem = redisUtils.hasKey(itemCode);
 | 
					
 | 
				
			||||||
        if (flagItem) {
 | 
					 | 
				
			||||||
            item = (Item) redisUtils.get(itemCode);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            item = getOrThrow(Optional.ofNullable(itemService.existItem(itemCode)), itemCode + " 系统无此物料!");
 | 
					 | 
				
			||||||
            redisUtils.set(itemCode,item);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证容器是否存在
 | 
					        // 验证容器是否存在
 | 
				
			||||||
        Stock stock=null;
 | 
					        Stock stock = redisObjectUtils.getObjectFromCache(stockCode, () -> stockService.findByCode(stockCode, null), stockCode + " 系统无此容器!");
 | 
				
			||||||
        boolean flagStock = redisUtils.hasKey(stockCode);
 | 
					
 | 
				
			||||||
        if (flagStock) {
 | 
					 | 
				
			||||||
            stock = (Stock) redisUtils.get(stockCode);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            stock = getOrThrow(Optional.ofNullable(stockService.findByCode(stockCode, null)), stockCode + " 系统无此容器!");
 | 
					 | 
				
			||||||
            redisUtils.set(stockCode,stock);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证容器状态
 | 
					        // 验证容器状态
 | 
				
			||||||
        validateStockStatus(stock);
 | 
					        validateStockStatus(stock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //验证入库接驳口是否存在
 | 
					        //验证入库接驳口是否存在
 | 
				
			||||||
        Point srcPoint = null;
 | 
					        Point srcPoint = redisObjectUtils.getObjectFromCache("rkjbk", () -> pointService.findByCode(null, null, null, "入库接驳口", null),  "系统无入库接驳口!");
 | 
				
			||||||
        boolean flagSrcPoint = redisUtils.hasKey("rkjbk");
 | 
					 | 
				
			||||||
        if (flagSrcPoint) {
 | 
					 | 
				
			||||||
            srcPoint = (Point) redisUtils.get("rkjbk");
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            srcPoint = getOrThrow(Optional.ofNullable(pointService.findByCode(null, null, null, "入库接驳口", null)), "系统无入库接驳口!");
 | 
					 | 
				
			||||||
            redisUtils.set("rkjbk", srcPoint, 0);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Point endPoint = getOrThrow(Optional.ofNullable(pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, "存储区", null)), "存储区没有空闲点位!");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        MoDto moDto = getOrThrow(Optional.ofNullable(findByLabelNo(labelNo)), labelNo + " 系统无此标签!");
 | 
					        Point endPoint = redisObjectUtils.getOrThrow(Optional.ofNullable(pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, "存储区", null)), "存储区没有空闲点位!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        MoDto moDto = redisObjectUtils.getOrThrow(Optional.ofNullable(findByLabelNo(labelNo)), labelNo + " 系统无此标签!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证标签状态
 | 
					        // 验证标签状态
 | 
				
			||||||
        validateLabelState(moDto);
 | 
					        validateLabelState(moDto);
 | 
				
			||||||
| 
						 | 
					@ -207,7 +189,7 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
        validateTask(moDto);
 | 
					        validateTask(moDto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证送货单是否存在
 | 
					        // 验证送货单是否存在
 | 
				
			||||||
        OrderDto orderDto = getOrThrow(Optional.ofNullable(orderService.findByDeliveryHeaderId(moDto.getDeliveryHeaderId())), moDto.getDeliveryHeaderId() + " 系统无此送货单!");
 | 
					        OrderDto orderDto = redisObjectUtils.getOrThrow(Optional.ofNullable(orderService.findByDeliveryHeaderId(moDto.getDeliveryHeaderId())), moDto.getDeliveryHeaderId() + " 系统无此送货单!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 验证送货单状态
 | 
					        // 验证送货单状态
 | 
				
			||||||
        validateOrder(orderDto, moDto);
 | 
					        validateOrder(orderDto, moDto);
 | 
				
			||||||
| 
						 | 
					@ -227,9 +209,7 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private <T> T getOrThrow(Optional<T> optional, String errorMessage) {
 | 
					
 | 
				
			||||||
        return optional.orElseThrow(() -> new RuntimeException(errorMessage));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void validateStockStatus(Stock stock) {
 | 
					    private void validateStockStatus(Stock stock) {
 | 
				
			||||||
        if (stock.getStatus().equals(BaseStatus.USED)) {
 | 
					        if (stock.getStatus().equals(BaseStatus.USED)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,8 @@ public class BatchCreateOrUpdate {
 | 
				
			||||||
     * @param entities 要插入的实体列表
 | 
					     * @param entities 要插入的实体列表
 | 
				
			||||||
     * @param <T>      实体类型
 | 
					     * @param <T>      实体类型
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Async
 | 
					 | 
				
			||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
 | 
					    @Async
 | 
				
			||||||
    public <T> void batchCreate(List<T> entities) {
 | 
					    public <T> void batchCreate(List<T> entities) {
 | 
				
			||||||
        int batchSize = 100;
 | 
					        int batchSize = 100;
 | 
				
			||||||
        if (entities == null || entities.isEmpty()) {
 | 
					        if (entities == null || entities.isEmpty()) {
 | 
				
			||||||
| 
						 | 
					@ -52,8 +52,8 @@ public class BatchCreateOrUpdate {
 | 
				
			||||||
     * @param entities 要更新的实体列表
 | 
					     * @param entities 要更新的实体列表
 | 
				
			||||||
     * @param <T>      实体类型
 | 
					     * @param <T>      实体类型
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Async
 | 
					 | 
				
			||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
 | 
					    @Async
 | 
				
			||||||
    public <T> void batchUpdate(List<T> entities) {
 | 
					    public <T> void batchUpdate(List<T> entities) {
 | 
				
			||||||
        int batchSize = 100;
 | 
					        int batchSize = 100;
 | 
				
			||||||
        if (entities == null || entities.isEmpty()) {
 | 
					        if (entities == null || entities.isEmpty()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,40 @@
 | 
				
			||||||
 | 
					package com.youchain.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					import java.util.function.Supplier;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 缓存对象通用工具类
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Component
 | 
				
			||||||
 | 
					public class RedisObjectUtils {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final RedisUtils redisUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    public RedisObjectUtils(RedisUtils redisUtils) {
 | 
				
			||||||
 | 
					        this.redisUtils = redisUtils;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public <T> T getObjectFromCache(String cacheKey, Supplier<T> serviceSupplier, String errorMessage) {
 | 
				
			||||||
 | 
					        T object = null;
 | 
				
			||||||
 | 
					        boolean flag = redisUtils.hasKey(cacheKey);
 | 
				
			||||||
 | 
					        if (flag) {
 | 
				
			||||||
 | 
					            object = (T) redisUtils.get(cacheKey);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            object = getOrThrow(Optional.ofNullable(serviceSupplier.get()), errorMessage);
 | 
				
			||||||
 | 
					            redisUtils.set(cacheKey, object);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return object;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static <T> T getOrThrow(Optional<T> optional, String errorMessage) {
 | 
				
			||||||
 | 
					        return optional.orElseThrow(() -> new IllegalArgumentException(errorMessage));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -94,11 +94,11 @@ jwt:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#是否允许生成代码,生产环境设置为false
 | 
					#是否允许生成代码,生产环境设置为false
 | 
				
			||||||
generator:
 | 
					generator:
 | 
				
			||||||
  enabled: true
 | 
					  enabled: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#是否开启 swagger-ui
 | 
					#是否开启 swagger-ui
 | 
				
			||||||
swagger:
 | 
					swagger:
 | 
				
			||||||
  enabled: true
 | 
					  enabled: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# IP 本地解析
 | 
					# IP 本地解析
 | 
				
			||||||
ip:
 | 
					ip:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@ spring:
 | 
				
			||||||
    druid:
 | 
					    druid:
 | 
				
			||||||
      db-type: com.alibaba.druid.pool.DruidDataSource
 | 
					      db-type: com.alibaba.druid.pool.DruidDataSource
 | 
				
			||||||
      driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
 | 
					      driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
 | 
				
			||||||
      url: jdbc:log4jdbc:mysql://${DB_HOST:47.100.54.81}:${DB_PORT:53306}/${DB_NAME:jingzhou_xks}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
 | 
					      url: jdbc:log4jdbc:mysql://${DB_HOST:115.159.67.99}:${DB_PORT:3306}/${DB_NAME:hefeihvac_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
 | 
				
			||||||
      username: ${DB_USER:root}
 | 
					      username: ${DB_USER:root}
 | 
				
			||||||
      password: ${DB_PWD:Youchain@56}
 | 
					      password: ${DB_PWD:Youchain@56}
 | 
				
			||||||
      # 初始连接数
 | 
					      # 初始连接数
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ generator:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#是否开启 swagger-ui
 | 
					#是否开启 swagger-ui
 | 
				
			||||||
swagger:
 | 
					swagger:
 | 
				
			||||||
  enabled: false
 | 
					  enabled: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 文件存储路径
 | 
					# 文件存储路径
 | 
				
			||||||
file:
 | 
					file:
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ file:
 | 
				
			||||||
    path: C:\eladmin\file\
 | 
					    path: C:\eladmin\file\
 | 
				
			||||||
    avatar: C:\eladmin\avatar\
 | 
					    avatar: C:\eladmin\avatar\
 | 
				
			||||||
  # 文件大小 /M
 | 
					  # 文件大小 /M
 | 
				
			||||||
  maxSize: 100
 | 
					  maxSize: 200
 | 
				
			||||||
  avatarMaxSize: 5
 | 
					  avatarMaxSize: 5
 | 
				
			||||||
minidao:
 | 
					minidao:
 | 
				
			||||||
  base-package: org.jeecg.modules.jmreport.desreport.dao*
 | 
					  base-package: org.jeecg.modules.jmreport.desreport.dao*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,11 +29,11 @@ spring:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  redis:
 | 
					  redis:
 | 
				
			||||||
    #数据库索引
 | 
					    #数据库索引
 | 
				
			||||||
    database: ${REDIS_DB:9}
 | 
					    database: ${REDIS_DB:0}
 | 
				
			||||||
    host: ${REDIS_HOST:127.0.0.1}
 | 
					    host: ${REDIS_HOST:115.159.67.99}
 | 
				
			||||||
    port: ${REDIS_PORT:6379}
 | 
					    port: ${REDIS_PORT:6379}
 | 
				
			||||||
    password: ${REDIS_PWD:}
 | 
					    #password: ${REDIS_PWD:}
 | 
				
			||||||
    #password: ${REDIS_PWD:123abc}
 | 
					    password: ${REDIS_PWD:123456}
 | 
				
			||||||
    #连接超时时间
 | 
					    #连接超时时间
 | 
				
			||||||
    timeout: 5000
 | 
					    timeout: 5000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,24 @@ public class EladminSystemApplicationTests {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void main(String[] args) {
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
 | 
					        System.out.println("---"+aa());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static int aa(){
 | 
				
			||||||
 | 
					        int a=1;
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            a=2;
 | 
				
			||||||
 | 
					            System.out.println(a);
 | 
				
			||||||
 | 
					            return a;
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            a=3;
 | 
				
			||||||
 | 
					        } finally {
 | 
				
			||||||
 | 
					            a=4;
 | 
				
			||||||
 | 
					            System.out.println("TT:"+a);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        System.out.println(a);
 | 
				
			||||||
 | 
					       return a;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final int MAX_TASK_COUNT = 4;
 | 
					    private static final int MAX_TASK_COUNT = 4;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue