|
|
@@ -526,13 +526,17 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
* @Author: chenwei
|
|
|
* @Date: 2018/10/26
|
|
|
*/
|
|
|
- private synchronized String pushMaxnubmer(String code, Long id) {
|
|
|
+ private String pushMaxnubmer(String code, Long id) {
|
|
|
if (null == code) {
|
|
|
throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
}
|
|
|
Long companyId = BaseContextHolder.getCompanyId();
|
|
|
- Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
|
|
|
- getMapper().validateCodeWhenUpdate(code, id, companyId);
|
|
|
- return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PRODUCT.getCaller()).getData();
|
|
|
+ String billCode = null;
|
|
|
+ synchronized (ProductServiceImpl.class) {
|
|
|
+ Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
|
|
|
+ getMapper().validateCodeWhenUpdate(code, id, companyId);
|
|
|
+ billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PRODUCT.getCaller()).getData();
|
|
|
+ }
|
|
|
+ return billCode;
|
|
|
}
|
|
|
}
|