|
@@ -125,8 +125,10 @@ public class CodingRuleServiceImpl extends ServiceImpl<CodingRuleMapper, CodingR
|
|
|
StringBuilder codeBuilder = new StringBuilder();
|
|
|
|
|
|
CustomerCodeAndCountryId customerCodeAndCountryId = null;
|
|
|
-
|
|
|
Integer autoNum = null;
|
|
|
+ String countryCode = null;
|
|
|
+ String userCode = null;
|
|
|
+ Date data = null;
|
|
|
|
|
|
List<RuleVo> ruleVoList = getRuleVoList(key);
|
|
|
for (RuleVo ruleVo : ruleVoList) {
|
|
@@ -141,10 +143,16 @@ public class CodingRuleServiceImpl extends ServiceImpl<CodingRuleMapper, CodingR
|
|
|
if (customerCodeAndCountryId == null) {
|
|
|
customerCodeAndCountryId = codingRuleCustomerService.getCustomerCodeAndCountryId(customerId);
|
|
|
}
|
|
|
- codeBuilder.append(getCountryCode(customerCodeAndCountryId.getCountryId()));
|
|
|
+ if (countryCode == null) {
|
|
|
+ countryCode = getCountryCode(customerCodeAndCountryId.getCountryId());
|
|
|
+ }
|
|
|
+ codeBuilder.append(countryCode);
|
|
|
break;
|
|
|
case SALESMAN_CODE:
|
|
|
- codeBuilder.append(getUserCode());
|
|
|
+ if (userCode == null) {
|
|
|
+ userCode = getUserCode();
|
|
|
+ }
|
|
|
+ codeBuilder.append(userCode);
|
|
|
break;
|
|
|
case CUSTOMER_CODE:
|
|
|
if (customerCodeAndCountryId == null) {
|
|
@@ -162,7 +170,10 @@ public class CodingRuleServiceImpl extends ServiceImpl<CodingRuleMapper, CodingR
|
|
|
case DATE_FORMAT:
|
|
|
String dataFormat = ruleVo.getValue();
|
|
|
try {
|
|
|
- String format = DateUtil.format(new Date(), dataFormat);
|
|
|
+ if (data == null) {
|
|
|
+ data = new Date();
|
|
|
+ }
|
|
|
+ String format = DateUtil.format(data, dataFormat);
|
|
|
codeBuilder.append(format);
|
|
|
} catch (Exception e) {
|
|
|
throw new ServiceException("生成编码配置日期生成格式错误");
|
|
@@ -233,6 +244,9 @@ public class CodingRuleServiceImpl extends ServiceImpl<CodingRuleMapper, CodingR
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取业务员编码
|
|
|
+ */
|
|
|
private String getUserCode() {
|
|
|
SysUser sysUser = sysUserService.getById(SecurityUtils.getUserId());
|
|
|
String userCode = sysUser.getUserCode();
|