|
@@ -2,6 +2,7 @@ package com.kxs.product.biz.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -20,9 +21,13 @@ import com.kxs.product.biz.constant.enums.ProductErrorTypeEnum;
|
|
|
import com.kxs.product.biz.mapper.*;
|
|
import com.kxs.product.biz.mapper.*;
|
|
|
import com.kxs.product.biz.service.KxsMachineService;
|
|
import com.kxs.product.biz.service.KxsMachineService;
|
|
|
import com.kxs.store.api.feign.RemoteKxsStoreService;
|
|
import com.kxs.store.api.feign.RemoteKxsStoreService;
|
|
|
|
|
+import com.kxs.system.api.feign.RemoteOldService;
|
|
|
import com.kxs.user.api.feign.RemoteKxsUserService;
|
|
import com.kxs.user.api.feign.RemoteKxsUserService;
|
|
|
import com.kxs.user.api.model.KxsUser;
|
|
import com.kxs.user.api.model.KxsUser;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+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;
|
|
|
|
|
|
|
@@ -31,6 +36,7 @@ import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
@@ -44,6 +50,8 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
*/
|
|
|
@Service("kxsMachineService")
|
|
@Service("kxsMachineService")
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@EnableAsync
|
|
|
public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMachine> implements KxsMachineService {
|
|
public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMachine> implements KxsMachineService {
|
|
|
|
|
|
|
|
private final KxsBrandMapper kxsBrandMapper;
|
|
private final KxsBrandMapper kxsBrandMapper;
|
|
@@ -58,6 +66,8 @@ public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMach
|
|
|
|
|
|
|
|
private final RemoteKxsStoreService remoteKxsStoreService;
|
|
private final RemoteKxsStoreService remoteKxsStoreService;
|
|
|
|
|
|
|
|
|
|
+ private final RemoteOldService remoteOldService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public IPage<MachineStoreListVO> machineStoreList(Page<MachineStoreListVO> page, MachineStoreListDTO param) {
|
|
public IPage<MachineStoreListVO> machineStoreList(Page<MachineStoreListVO> page, MachineStoreListDTO param) {
|
|
|
|
|
|
|
@@ -297,6 +307,30 @@ public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMach
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Async("getAsyncExecutor")
|
|
|
|
|
+ public void recycleMachineSchedule(String para) {
|
|
|
|
|
+ LocalDateTime endDay = LocalDate.now().minusDays(30).atStartOfDay();
|
|
|
|
|
+ List<KxsMachine> machines = baseMapper.selectExpireDeductList(endDay);
|
|
|
|
|
+
|
|
|
|
|
+ for (KxsMachine machine : machines) {
|
|
|
|
|
+ HashMap<String, Object> param = new HashMap<>();
|
|
|
|
|
+ HashMap<String, Object> data = new HashMap<>();
|
|
|
|
|
+ data.put("PosSn", machine.getPosSn());
|
|
|
|
|
+// String body = cryptoOldAes.encryptHex(JSON.toJSONString(data));
|
|
|
|
|
+ param.put("value", JSON.toJSONString(data));
|
|
|
|
|
+ R result = remoteOldService.savePosAdvance(param);
|
|
|
|
|
+ if(result.getStatus() == 1){
|
|
|
|
|
+ log.info("已添加机具到预扣款:{}", machine.getPosSn());
|
|
|
|
|
+
|
|
|
|
|
+ KxsMachineDeduct machineDeduct = new KxsMachineDeduct();
|
|
|
|
|
+ machineDeduct.setPosSn(machine.getPosSn());
|
|
|
|
|
+ machineDeduct.setRemark("已添加预扣款");
|
|
|
|
|
+ kxsMachineDeductMapper.insert(machineDeduct);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|