|
|
|
@ -2,6 +2,7 @@ package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysBarcodeRuleService;
|
|
|
|
|
import cn.estsh.i3plus.core.apiservice.util.BarcodeParseUtil;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
@ -12,6 +13,7 @@ import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
@ -21,6 +23,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -40,6 +43,9 @@ public class SysBarcodeRuleController extends CoreBaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysBarcodeRuleService sysBarcodeRuleService;
|
|
|
|
|
|
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增条码规则
|
|
|
|
|
* @param sysBarcodeRule 条码规则
|
|
|
|
@ -55,7 +61,10 @@ public class SysBarcodeRuleController extends CoreBaseController {
|
|
|
|
|
.notNull("barcodeRuleCode",sysBarcodeRule.getBarcodeRuleCode())
|
|
|
|
|
.notNull("barcodeRule",sysBarcodeRule.getBarcodeRule());
|
|
|
|
|
|
|
|
|
|
sysBarcodeRuleService.insertSysBarcodeRule(sysBarcodeRule);
|
|
|
|
|
sysBarcodeRule = sysBarcodeRuleService.insertSysBarcodeRule(sysBarcodeRule);
|
|
|
|
|
|
|
|
|
|
saveRedis(sysBarcodeRule);
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
@ -80,6 +89,9 @@ public class SysBarcodeRuleController extends CoreBaseController {
|
|
|
|
|
.notNull("barcodeRule",sysBarcodeRule.getBarcodeRule());
|
|
|
|
|
|
|
|
|
|
sysBarcodeRuleService.updateSysBarcodeRule(sysBarcodeRule);
|
|
|
|
|
|
|
|
|
|
saveRedis(sysBarcodeRule);
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
@ -112,6 +124,9 @@ public class SysBarcodeRuleController extends CoreBaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sysBarcodeRuleService.deleteSysBarcodeRuleById(Long.parseLong(idStr));
|
|
|
|
|
|
|
|
|
|
removeRedis(sysBarcodeRule);
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
@ -171,4 +186,14 @@ public class SysBarcodeRuleController extends CoreBaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveRedis(SysBarcodeRule barcodeRule){
|
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_BARCODE_RULE + ":" + barcodeRule.getBarcodeRuleCode();
|
|
|
|
|
redisRes.putObject(redisKey, barcodeRule, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void removeRedis(SysBarcodeRule barcodeRule){
|
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_BARCODE_RULE + ":" + barcodeRule.getBarcodeRuleCode();
|
|
|
|
|
redisRes.deleteKey(redisKey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|