价格先进先出,耗材字典问题,确认单据人问题
parent
9e1acf487f
commit
43e1d463b8
@ -0,0 +1,94 @@
|
||||
package com.glxp.api.aspect;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.glxp.api.annotation.CusRedissonAnnotation;
|
||||
import com.glxp.api.exception.JsonException;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.After;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class RedissonAspect {
|
||||
|
||||
private final ExpressionParser expressionParser = new SpelExpressionParser();
|
||||
|
||||
private final DefaultParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Before("@annotation(annotation)")
|
||||
public void before(JoinPoint joinPoint, CusRedissonAnnotation annotation) throws InterruptedException {
|
||||
if (StrUtil.isBlank(parseKey(joinPoint, annotation))) {
|
||||
throw new RuntimeException("redisson使用的key不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(annotation.timeOutMsg())) {
|
||||
throw new RuntimeException("redisson的超时信息不能为空");
|
||||
}
|
||||
|
||||
RLock lock = redissonClient.getLock(parseKey(joinPoint, annotation));
|
||||
int waitTime = annotation.waitTime();
|
||||
boolean tryLock = lock.tryLock(waitTime, TimeUnit.SECONDS);
|
||||
if (!tryLock) {
|
||||
throw new JsonException(500, annotation.timeOutMsg());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@After("@annotation(cusRedissonAnnotation)")
|
||||
public void after(JoinPoint joinPoint, CusRedissonAnnotation cusRedissonAnnotation) {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
CusRedissonAnnotation annotation = signature.getMethod().getAnnotation(CusRedissonAnnotation.class);
|
||||
RLock lock = redissonClient.getLock(parseKey(joinPoint, annotation));
|
||||
try {
|
||||
lock.unlock();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String parseKey(JoinPoint joinPoint, CusRedissonAnnotation annotation) {
|
||||
|
||||
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = methodSignature.getMethod();
|
||||
String[] paramNames = nameDiscoverer.getParameterNames(method);
|
||||
List<String> keyValue = new ArrayList<>(annotation.key().length);
|
||||
for (String s : annotation.key()) {
|
||||
Expression expression = expressionParser.parseExpression(s);
|
||||
EvaluationContext context = new StandardEvaluationContext();
|
||||
Object[] args = joinPoint.getArgs();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
context.setVariable(paramNames[i], args[i]);
|
||||
}
|
||||
if (s.contains("#")) {
|
||||
keyValue.add(expression.getValue(context, String.class));
|
||||
} else {
|
||||
keyValue.add(s);
|
||||
}
|
||||
}
|
||||
return String.format("%s:%s", annotation.cacheName(), ArrayUtil.join(keyValue.toArray(), "_"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.glxp.api.constant;
|
||||
|
||||
//redisson缓存key
|
||||
public interface RedissonCacheKey {
|
||||
|
||||
/**
|
||||
* 注册审核
|
||||
*/
|
||||
String REGISTER_AUDIT = "register_audit";
|
||||
|
||||
/**
|
||||
* web添加单据
|
||||
*/
|
||||
String WEB_ADD_ORDER = "web_add_order";
|
||||
|
||||
/**
|
||||
* 升级
|
||||
*/
|
||||
String UPGRADE = "upgrade";
|
||||
|
||||
/**
|
||||
* 提交单据
|
||||
*/
|
||||
String SUBMIT_ORDER = "submit_order";
|
||||
|
||||
/**
|
||||
* app提交单据
|
||||
*/
|
||||
String APP_SUBMIT_ORDER = "app_submit_order";
|
||||
|
||||
/**
|
||||
* 删除临时码表
|
||||
*/
|
||||
String DELETE_CODE_TEMP = "delete_code_temp";
|
||||
|
||||
|
||||
/**
|
||||
* web添加单据
|
||||
*/
|
||||
String WEB_ADD_CODE = "web_add_code";
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package com.glxp.api.service.inout;
|
||||
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.entity.inout.IoCodeEntity;
|
||||
import com.glxp.api.req.inout.FilterCodeRequest;
|
||||
import com.glxp.api.res.inout.IoCodeResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IoCodeService {
|
||||
|
||||
int insert(IoCodeEntity codeEnttity);
|
||||
|
||||
boolean insertBatch(List<IoCodeEntity> codeEnttities);
|
||||
|
||||
List<IoCodeEntity> findByOrderId(String billNo);
|
||||
|
||||
int updateById(IoCodeEntity codeEnttity);
|
||||
|
||||
int deleteById(Integer id);
|
||||
|
||||
public IoCodeEntity findByUnique(String orderId, String code);
|
||||
|
||||
List<IoCodeEntity> findByOrderIds(List<String> orderIds, String code);
|
||||
|
||||
int findByOrderIdsCount(List<String> orderIds, String code);
|
||||
|
||||
|
||||
boolean isExitByRelId(String relId);
|
||||
|
||||
/**
|
||||
* 查询正式码表实体数据
|
||||
*
|
||||
* @param filterCodeRequest
|
||||
* @return
|
||||
*/
|
||||
List<IoCodeEntity> filterCodeList(FilterCodeRequest filterCodeRequest);
|
||||
|
||||
/**
|
||||
* 查询正式码表VO数据
|
||||
*/
|
||||
List<IoCodeResponse> filterList(FilterCodeRequest filterCodeRequest);
|
||||
|
||||
/**
|
||||
* 根据单号删除正式码表数据
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
BaseResponse deleteCodeByOrderId(String orderId);
|
||||
|
||||
/**
|
||||
* 查询单据编辑条码列表
|
||||
*
|
||||
* @param filterCodeRequest
|
||||
* @return
|
||||
*/
|
||||
List<IoCodeResponse> getCodeListForEdit(FilterCodeRequest filterCodeRequest);
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.glxp.api.service.inv;
|
||||
|
||||
import com.glxp.api.entity.inv.InvPreinDetailEntity;
|
||||
import com.glxp.api.entity.inv.InvProductDetailEntity;
|
||||
import com.glxp.api.req.inv.FilterInvProductDetailRequest;
|
||||
import com.glxp.api.res.inv.InvProductDetailResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface InvProductDetailService {
|
||||
|
||||
int insert(InvProductDetailEntity invProductDetailEntity);
|
||||
|
||||
|
||||
List<InvProductDetailEntity> selectByOrderIdFk(String billNo);
|
||||
|
||||
|
||||
InvProductDetailEntity selectByCode(String billNo, String code);
|
||||
|
||||
int deleteByOrderId(String billNo);
|
||||
|
||||
int deleteById(Integer id);
|
||||
|
||||
int update(InvProductDetailEntity invProductDetailEntity);
|
||||
|
||||
List<InvProductDetailEntity> selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode);
|
||||
|
||||
InvProductDetailEntity sortFindByCode(String code);
|
||||
|
||||
boolean insertList(List<InvProductDetailEntity> invProductDetailEntities);
|
||||
|
||||
/**
|
||||
* 查询库存详情列表
|
||||
*
|
||||
* @param filterInvProductDetailRequest
|
||||
* @return
|
||||
*/
|
||||
List<InvProductDetailEntity> filterInvProductDetailList(FilterInvProductDetailRequest filterInvProductDetailRequest);
|
||||
|
||||
boolean deleteInvProductDetail(FilterInvProductDetailRequest detailRequest);
|
||||
|
||||
/**
|
||||
* 库存详情封装单据相关信息
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
void setOrderInfo(InvProductDetailResponse response);
|
||||
|
||||
|
||||
int vailStockCount(Long relId, String batchNo, String supId, String deptCode, String invCode, String invSpaceCode);
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue