|
|
@ -2,7 +2,6 @@ package cn.estsh.i3plus.core.apiservice.controller.base;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISynchronizedService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISynchronizedService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.*;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.*;
|
|
|
|
import cn.estsh.i3plus.core.apiservice.util.SysUserPasswordUtil;
|
|
|
|
import cn.estsh.i3plus.core.apiservice.util.SysUserPasswordUtil;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
@ -32,19 +31,15 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.shiro.authc.*;
|
|
|
|
import org.apache.shiro.authc.*;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.estsh.i3plus.platform.common.util.CommonConstWords.REDIS_PREFIX_LOCK_BATCH_GET_ORDER_NO;
|
|
|
|
|
|
|
|
import static cn.estsh.i3plus.platform.common.util.CommonConstWords.REDIS_PREFIX_LOCK_GET_ORDER_NO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @Description :
|
|
|
|
* @Description :
|
|
|
|
* @Reference :
|
|
|
|
* @Reference :
|
|
|
@ -66,12 +61,6 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
private ISysLocaleResourceService sysLocaleResourceService;
|
|
|
|
private ISysLocaleResourceService sysLocaleResourceService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ISystemLoginService systemLoginService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysOrderNoRuleService sysOrderNoRuleService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysUserService userService;
|
|
|
|
private ISysUserService userService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
@ -110,6 +99,9 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_SESSION)
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_SESSION)
|
|
|
|
private ImppRedis redisSession;
|
|
|
|
private ImppRedis redisSession;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RabbitTemplate rabbitTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/sys-locale-language/list")
|
|
|
|
@GetMapping(value = "/sys-locale-language/list")
|
|
|
|
@ApiOperation(value = "查询可用语言",notes = "查询可用语言")
|
|
|
|
@ApiOperation(value = "查询可用语言",notes = "查询可用语言")
|
|
|
@ -407,21 +399,15 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
@GetMapping(value = "/sys-order-no-rule/get-order-no/{code}")
|
|
|
|
@GetMapping(value = "/sys-order-no-rule/get-order-no/{code}")
|
|
|
|
@ApiOperation(value = "根据单号规则代码,生成单号")
|
|
|
|
@ApiOperation(value = "根据单号规则代码,生成单号")
|
|
|
|
public ResultBean getOrderNo(@PathVariable("code") String code) {
|
|
|
|
public ResultBean getOrderNo(@PathVariable("code") String code) {
|
|
|
|
Lock lock = redisCore.getFairLock(REDIS_PREFIX_LOCK_GET_ORDER_NO);
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ValidatorBean.checkNotNull(code, "code不能为空");
|
|
|
|
ValidatorBean.checkNotNull(code, "code不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
// 获取锁
|
|
|
|
|
|
|
|
lock.lock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysOrderNoRule sysOrderNoRule = synchronizedService.nextOrderNo(code);
|
|
|
|
SysOrderNoRule sysOrderNoRule = synchronizedService.nextOrderNo(code);
|
|
|
|
return ResultBean.success("操作成功").setResultObject(sysOrderNoRule).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
return ResultBean.success("操作成功").setResultObject(sysOrderNoRule).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
lock.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -435,22 +421,16 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
@GetMapping(value = "/sys-order-no-rule/get-order-no/{code}/{num}")
|
|
|
|
@GetMapping(value = "/sys-order-no-rule/get-order-no/{code}/{num}")
|
|
|
|
@ApiOperation(value = "根据单号规则代码,生成单号")
|
|
|
|
@ApiOperation(value = "根据单号规则代码,生成单号")
|
|
|
|
public ResultBean<String> getOrderNo(@PathVariable("code") String code, @PathVariable("num") Integer num) {
|
|
|
|
public ResultBean<String> getOrderNo(@PathVariable("code") String code, @PathVariable("num") Integer num) {
|
|
|
|
Lock lock = redisCore.getFairLock(REDIS_PREFIX_LOCK_BATCH_GET_ORDER_NO);
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ValidatorBean.checkNotNull(code, "code不能为空");
|
|
|
|
ValidatorBean.checkNotNull(code, "code不能为空");
|
|
|
|
ValidatorBean.checkNotZero(num, "次数不能为零");
|
|
|
|
ValidatorBean.checkNotZero(num, "次数不能为零");
|
|
|
|
|
|
|
|
|
|
|
|
// 获取锁
|
|
|
|
|
|
|
|
lock.tryLock(15, TimeUnit.SECONDS);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> orderNoList = synchronizedService.nextOrderNo(code, num).stream().map(SysOrderNoRule::getOrderNo).collect(Collectors.toList());
|
|
|
|
List<String> orderNoList = synchronizedService.nextOrderNo(code, num).stream().map(SysOrderNoRule::getOrderNo).collect(Collectors.toList());
|
|
|
|
return ResultBean.success("操作成功").setResultList(orderNoList).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
return ResultBean.success("操作成功").setResultList(orderNoList).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
lock.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -652,4 +632,9 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/send-test-mq")
|
|
|
|
|
|
|
|
@ApiOperation(value = "测试发送mq", notes = "测试发送mq")
|
|
|
|
|
|
|
|
public void sendTestMq(String paramStr) {
|
|
|
|
|
|
|
|
rabbitTemplate.convertAndSend(PlatformConstWords.QUEUE_IMPP_DEMO, paramStr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|