|
@@ -22,7 +22,9 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
+import static cn.hutool.extra.pinyin.PinyinUtil.isChinese;
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
|
+import static cn.iocoder.yudao.module.pms.service.qhse.ChineseLetterUtil.getFirstLetterPinyin;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* QHSE_JSA工作安全分析 Service 实现类
|
|
* QHSE_JSA工作安全分析 Service 实现类
|
|
@@ -58,8 +60,20 @@ public class QhseJsaServiceImpl implements QhseJsaService {
|
|
|
String company = deptUtil.getCompanyCode(loginUserDeptId).toUpperCase();
|
|
String company = deptUtil.getCompanyCode(loginUserDeptId).toUpperCase();
|
|
|
//获取项目部代码大写
|
|
//获取项目部代码大写
|
|
|
String jsaNo = getJSANo(loginUserDeptId);
|
|
String jsaNo = getJSANo(loginUserDeptId);
|
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
|
+ if (jsaNo != null && !jsaNo.trim().isEmpty()) {
|
|
|
|
|
+ for (char c : jsaNo.toCharArray()) {
|
|
|
|
|
+ if (isChinese(c)) {
|
|
|
|
|
+ // 中文转拼音首字母(大写)
|
|
|
|
|
+ sb.append(getFirstLetterPinyin(c));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 非中文直接保留
|
|
|
|
|
+ sb.append(c);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (StringUtils.isBlank(jsaNo)){throw new ServiceException(new ErrorCode(2,"获取项目部编号失败"));}
|
|
if (StringUtils.isBlank(jsaNo)){throw new ServiceException(new ErrorCode(2,"获取项目部编号失败"));}
|
|
|
- qhseJsa.setJsaNo(company+"-"+jsaNo+"-"+convert);
|
|
|
|
|
|
|
+ qhseJsa.setJsaNo(company+"-"+sb.toString()+"-"+convert);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
qhseJsaMapper.insert(qhseJsa);
|
|
qhseJsaMapper.insert(qhseJsa);
|