'123'
This commit is contained in:
parent
cc20aa0d3f
commit
a2e44acd72
|
@ -43,6 +43,7 @@ public class CacheController
|
|||
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||
caches.add(new SysCache(CacheConstants.STORAGE_LOCATION, "车间库位"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_JOB_KEY, "定时任务"));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.ruoyi.common.core.redis.RedisLock;
|
|||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.DataSourceType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.storageLocation.domain.Operlog;
|
||||
import com.ruoyi.storageLocation.domain.StorageLocation;
|
||||
import com.ruoyi.storageLocation.domain.StorageSelected;
|
||||
|
@ -19,10 +18,8 @@ import com.ruoyi.storageLocation.service.StorageLocationService;
|
|||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 库位管理Controller
|
||||
|
@ -207,7 +204,10 @@ public class storageLocationController extends BaseController
|
|||
if(StringUtils.isNotNull(kw_user_name)&&!user_name.equals(kw_user_name)){
|
||||
return error("当前库位有人正在操作,请勿操作!");
|
||||
}else{
|
||||
redisLock.getLock(getLocationZyCacheKey(materialBh), Integer.valueOf(storageExpire), user_name);
|
||||
Boolean lock= redisLock.getLock(getLocationZyCacheKey(materialBh), Integer.valueOf(storageExpire), user_name);
|
||||
if(!lock){
|
||||
return error("当前库位有人正在操作,请勿操作!");
|
||||
}
|
||||
//redisCache.setCacheObject(getLocationZyCacheKey(materialBh),user_name,Integer.valueOf(storageExpire), TimeUnit.SECONDS);
|
||||
return success();
|
||||
}
|
||||
|
@ -327,6 +327,8 @@ public class storageLocationController extends BaseController
|
|||
Boolean lock = redisLock.getLock(getLocationLyCacheKey(materialBh), -1, user_name);
|
||||
if(lock){
|
||||
storageLocationService.saveStorageLocation(user_name,materialBh);
|
||||
}else{
|
||||
return error("该库位当前有人正在领用操作,请勿操作!");
|
||||
}
|
||||
}
|
||||
return success();
|
||||
|
|
|
@ -46,4 +46,9 @@ public class CacheConstants
|
|||
* 一车间库位号占用状态 redis key
|
||||
*/
|
||||
public static final String STORAGE_LOCATION = "storage_location:";
|
||||
|
||||
/**
|
||||
* 定时任务 redis key
|
||||
*/
|
||||
public static final String SYS_JOB_KEY = "sys_job:";
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package com.ruoyi.quartz.task;
|
||||
|
||||
import com.ruoyi.common.annotation.DataSource;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.redis.RedisLock;
|
||||
import com.ruoyi.common.enums.DataSourceType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.quartz.domain.c_rb_product_price;
|
||||
import com.ruoyi.quartz.domain.c_rb_productbase_price;
|
||||
import com.ruoyi.quartz.service.SapTjService;
|
||||
import com.ruoyi.quartz.util.JDBCBatchInsert;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -24,6 +29,15 @@ import java.util.List;
|
|||
@Component("rbTask")
|
||||
public class RbTask
|
||||
{
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
@Resource
|
||||
private SapTjService sapTjService;
|
||||
|
||||
|
@ -38,8 +52,12 @@ public class RbTask
|
|||
* 同步红本数据库
|
||||
*/
|
||||
public void tongb() throws Exception {
|
||||
//判断是否已执行调价 (6.3 redbook rb_productVersion 是否有新增uid and sta='1'、sdmdm1 调价日期今日的数据是否存在)
|
||||
|
||||
String jobId = scheduler.getSchedulerInstanceId();
|
||||
String rbVersionUid = testUtils.sapTjService.selRbVersionUid();//红本调价记录uid
|
||||
Boolean lock= redisLock.getLock(getJobKey(jobId), -1, rbVersionUid);
|
||||
if(lock){
|
||||
//判断是否已执行调价 (6.3 redbook rb_productVersion 是否有新增uid and sta='1'、sdmdm1 调价日期今日的数据是否存在)
|
||||
String locVersionUid = testUtils.sapTjService.selLocVersionUid();//本地红本调价记录uid
|
||||
|
||||
String RbProductPriceCount = testUtils.sapTjService.selRbProductPriceVersionUid(rbVersionUid);//RbProductPrice表是否有更新
|
||||
|
@ -57,9 +75,23 @@ public class RbTask
|
|||
JDBCBatchInsert.insertRbProductBasePrice(productBasePriceList);//批量插入
|
||||
|
||||
testUtils.sapTjService.updateLocRbVersion(rbVersionUid);//更新本地c_rb_version表
|
||||
|
||||
redisCache.deleteObject(getJobKey(jobId));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
throw new Exception(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务缓存键名
|
||||
*
|
||||
* @param jobId 任务编号
|
||||
* @return 缓存键key
|
||||
*/
|
||||
private String getJobKey(String jobId)
|
||||
{
|
||||
return CacheConstants.SYS_JOB_KEY + jobId;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue