Переглянути джерело

会计、评估OMS开票功能调整

huangguoce 1 місяць тому
батько
коміт
4f383cdccf
14 змінених файлів з 132 додано та 147 видалено
  1. 1 1
      jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/factory/UserApiFallbackFactory.java
  2. 1 1
      jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/feign/IUserApi.java
  3. 3 7
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/config/FinanceOmsConfig.java
  4. 3 3
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/controller/FinanceInvoiceController.java
  5. 41 42
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/service/FinanceInvoiceService.java
  6. 2 2
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/service/OMS/OMSDisposeService.java
  7. 2 2
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/utils/OMS/FileHandlingUtil.java
  8. 2 7
      jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/config/OmsConfig.java
  9. 3 3
      jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/controller/CwFinanceInvoiceController.java
  10. 66 69
      jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/CwFinanceInvoiceService.java
  11. 2 4
      jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/OMS/OMSDisposeService.java
  12. 2 2
      jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/util/OMS/FileHandlingUtil.java
  13. 2 2
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/feign/UserApiImpl.java
  14. 2 2
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/ALiYunSmsUtil.java

+ 1 - 1
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/factory/UserApiFallbackFactory.java

@@ -59,7 +59,7 @@ public class UserApiFallbackFactory implements FallbackFactory <IUserApi> {
             }
 
             @Override
-            public Map<String, Object> sendEntryRandomCodesByInvoice(String phoneNumbers, String number,String smsCode) throws Exception {
+            public Map<String, Object> sendEntryRandomCodesByInvoice(String mobile, String unitName, String number, String result, String smsCode) throws Exception {
                 return null;
             }
 

+ 1 - 1
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/feign/IUserApi.java

@@ -78,7 +78,7 @@ public interface IUserApi {
      * @return
      */
     @GetMapping(value = BASE_URL + "/sendEntryRandomCodesByInvoice")
-    Map<String ,Object> sendEntryRandomCodesByInvoice(@RequestParam(value = "mobile")String mobile, @RequestParam(value = "number")String number, @RequestParam(value = "smsCode")String smsCode) throws Exception;
+    Map<String ,Object> sendEntryRandomCodesByInvoice(@RequestParam(value = "mobile")String mobile,@RequestParam(value = "unitName")String unitName,@RequestParam(value = "number")String number, @RequestParam(value = "result")String result, @RequestParam(value = "smsCode")String smsCode) throws Exception;
 
 
 

+ 3 - 7
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/config/FinanceOmsConfig.java

@@ -32,14 +32,10 @@ public class FinanceOmsConfig {
     public static  final String omsUrl = "https://oms-sandbox.einvoice.js.cn:7079";
     //public static  final String omsUrl = "https://www.oms.ejinshui-cloud.com:8899";
 
-    /** 用于判定是否开启oms开票流程事件 */
-    public static  final boolean omsEnabled = true;
-
     public static final String directory = "/attachment-file";
 
-    /** 成功短信模板编号 */
-    public static  final String successSmsCode = "SMS_501960223";
-    /** 失败短信模板编号 */
-    public static  final String errorSmsCode = "SMS_501645266";
+    /** 通知短信模板编号 */
+    public static  final String smsCode = "SMS_501985251";
+
 
 }

+ 3 - 3
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/controller/FinanceInvoiceController.java

@@ -574,14 +574,14 @@ public class FinanceInvoiceController {
      * 下载附件(文件没有时间戳前缀)
      */
     @GetMapping("/downLoadOMSInvoiceAttachzip")
-    public void downLoadOMSInvoiceAttachzip(@RequestParam("fileUrl")String fileUrl, HttpServletResponse response) {
+    public void downLoadOMSInvoiceAttachzip(@RequestParam("fileUrl")String fileUrl,@RequestParam("invoiceNo")String invoiceNo, HttpServletResponse response) {
         long timestamp = System.currentTimeMillis();
         UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
         String filePath = null;
         if (System.getProperty("os.name").toLowerCase().contains("win")) {
-            filePath = "D:/attachment-file/" + userDTO.getName() + timestamp;
+            filePath = "D:/attachment-file/" + invoiceNo;
         } else {
-            filePath = "/attachment-file/" + userDTO.getName() + timestamp;
+            filePath = "/attachment-file/" + invoiceNo;
         }
 
         File folder = new File(filePath);

+ 41 - 42
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/service/FinanceInvoiceService.java

@@ -36,6 +36,7 @@ import com.jeeplus.assess.invoice.service.mapstruct.*;
 import com.jeeplus.assess.workContract.mapper.WorkContractInfoMapper;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -75,6 +76,11 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
     @Resource
     private IFlowableApi flowTaskService;
 
+    @Value("${oms.omsEnabled}")
+    private Boolean omsEnabled;
+
+    private static final String unitName = "兴光评估";
+
     Pattern mobilePattern = Pattern.compile("^1[3-9]\\d{9}$");
 
     public List<String> getSearchList(ArrayList<String> searchIdList, List<String> ids) {
@@ -1149,37 +1155,36 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
         List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
         //发票管理员
         notifiedPartyUsers.add(user);
-        if (StringUtils.isNotBlank(workInvoice.getStatus()) && !workInvoice.getStatus().equals("3")){
+        if (StringUtils.isNotBlank(workInvoice.getStatus()) && workInvoice.getStatus().equals("3")){
             for (UserDTO notifiedPartyUser : notifiedPartyUsers) {
-                sendNotify(notifiedPartyUser,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
-            }
-        }
-
-        //发起短信通知,用于通知开票人
-        //查询开票人员的手机号
-        if (StringUtils.isNotBlank(user.getMobile()) && mobilePattern.matcher(user.getMobile().trim()).matches() ) {
-            //验证手机号是否已经注册
-            if(StringUtils.isNotBlank(user.getMobile())){
-                Map<String,Object> result = null;
-                try{
-                    //调用工具类返回结果
-                    result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(user.getMobile(),workInvoice.getNo(),errorSmsCode);
-                    Integer statusCode = (Integer) result.get("statusCode");
-                    if (200 == statusCode) {
-                        System.out.println("短信发送成功!");
-                    } else if (10001 == statusCode) {
-                        String message = (String) result.get("message");
-                        System.out.println(message);
-                    }else if(10002 == statusCode){
-                        System.out.println("账户短信量余额不足,请联系管理员进行充值!");
-                    }else if(10003 == statusCode){
-                        System.out.println("手机号获取验证码次数已达每日上限!");
-                    } else {
-                        System.out.println("短信发送失败,错误代码:101,请联系管理员!");
+                    sendNotify(notifiedPartyUser,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
+                //发起短信通知,用于通知开票人
+                //查询开票人员的手机号
+                if (StringUtils.isNotBlank(user.getMobile()) && mobilePattern.matcher(user.getMobile().trim()).matches() ) {
+                    //验证手机号是否已经注册
+                    if(StringUtils.isNotBlank(user.getMobile())){
+                        Map<String,Object> result = null;
+                        try{
+                            //调用工具类返回结果
+                            result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(notifiedPartyUser.getMobile(),unitName,workInvoice.getNo(),"开票失败",smsCode);
+                            Integer statusCode = (Integer) result.get("statusCode");
+                            if (200 == statusCode) {
+                                System.out.println("短信发送成功!");
+                            } else if (10001 == statusCode) {
+                                String message = (String) result.get("message");
+                                System.out.println(message);
+                            }else if(10002 == statusCode){
+                                System.out.println("账户短信量余额不足,请联系管理员进行充值!");
+                            }else if(10003 == statusCode){
+                                System.out.println("手机号获取验证码次数已达每日上限!");
+                            } else {
+                                System.out.println("短信发送失败,错误代码:101,请联系管理员!");
+                            }
+                        }catch (Exception e){
+                            System.out.println("阿里云发送短信失败。失败原因为:" + e.getMessage());
+                            e.printStackTrace();
+                        }
                     }
-                }catch (Exception e){
-                    System.out.println("阿里云发送短信失败。失败原因为:" + e.getMessage());
-                    e.printStackTrace();
                 }
             }
         }
@@ -1197,6 +1202,7 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
      */
     @Transactional(readOnly = false)
     public  Boolean updateOmsByIdOnDown(FinanceInvoiceDTO workInvoice, OMSInvoiceDetailInfo invoiceInfo, String informType) {
+        String uploadPrefix = "pg";
         Boolean isSuccess = false;
         workInvoice.setOmsEinVno(invoiceInfo.getAllEinVno());
         if(StringUtils.isNotBlank(invoiceInfo.getOfdUrl())){
@@ -1205,7 +1211,7 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
             //如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
             if(StringUtils.isNotBlank(ofdLocalFilePath)){
                 // 调用上传方法,接收Map类型返回值(替换原String类型接收)
-                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo());
+                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo(),uploadPrefix);
                 fileUploadOnAttachment(uploadResult,workInvoice, "ofd", "1");
             }
         }
@@ -1217,7 +1223,7 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
             //如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
             if(StringUtils.isNotBlank(ofdLocalFilePath)){
                 // 调用上传方法,接收Map类型返回值(替换原String类型接收)
-                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo());
+                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo(),uploadPrefix);
                 fileUploadOnAttachment(uploadResult,workInvoice, "pdf", "2");
             }
         }
@@ -1228,7 +1234,7 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
             //如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
             if(StringUtils.isNotBlank(ofdLocalFilePath)){
                 // 调用上传方法,接收Map类型返回值(替换原String类型接收)
-                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo());
+                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo(),uploadPrefix);
                 fileUploadOnAttachment(uploadResult,workInvoice, "xml", "3");
             }
         }
@@ -1266,19 +1272,12 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
 
         String title = str;
 
-        //通知开票发起人和发票管理员
-        RoleDTO roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByName2("发票管理员");
-        List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
-        //发票管理员
-        notifiedPartyUsers.add(userDTO);
+        //通知开票发起人
         if (StringUtils.isNotBlank(workInvoice.getStatus()) && !workInvoice.getStatus().equals("3")){
             workInvoice.setStatus("5");
-            for (UserDTO notifiedPartyUser : notifiedPartyUsers) {
-                sendNotify(notifiedPartyUser,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
-            }
+            sendNotify(userDTO,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
         }
 
-
         //发起短信通知,用于通知开票人
         //查询开票人员的手机号
         if (StringUtils.isNotBlank(userDTO.getMobile()) && mobilePattern.matcher(userDTO.getMobile().trim()).matches() ) {
@@ -1287,7 +1286,7 @@ public class FinanceInvoiceService extends ServiceImpl<FinanceInvoiceMapper, Fin
                 Map<String,Object> result = null;
                 try{
                     //调用工具类返回结果
-                    result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(userDTO.getMobile(),workInvoice.getNo(),successSmsCode);
+                    result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(userDTO.getMobile(),unitName,workInvoice.getNo(),"开票成功",smsCode);
                     Integer statusCode = (Integer) result.get("statusCode");
                     if (200 == statusCode) {
                         System.out.println("短信发送成功!");

+ 2 - 2
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/service/OMS/OMSDisposeService.java

@@ -331,7 +331,7 @@ public class OMSDisposeService {
                 System.err.println("❌ 订单上传返回业务错误码:"+code+",立即执行失败兜底逻辑修改系统信息!");
                 System.err.println("❌ 订单上传返回业务错误原因:"+message);
                 map.put("订单状态", "失败,错误码:"+code);
-                handleInvoiceRetryAllFail(accessToken, workInvoiceId, "订单上传返回业务错误码:"+code+",错误原因:"+message, informType); // 解析失败也执行兜底方法
+                handleInvoiceRetryAllFail(accessToken, workInvoiceId, message, informType); // 解析失败也执行兜底方法
                 remainRetryTimes = 0;
             }
         } catch (Exception e) {
@@ -707,7 +707,7 @@ public class OMSDisposeService {
             } else {
                 String message = resultTokenInfo.getResult().getMessage();
                 System.err.println("❌ 全类型红冲--红字确认单查询接口返回业务错误码:"+code+",错误原因为:"+message);
-                handleInvoiceRetryAllFail(accessToken, workInvoiceId, "全类型红冲--红字确认单查询接口返回业务错误码:"+code+",错误原因为:"+message, informType); // 解析失败也执行兜底方法
+                handleInvoiceRetryAllFail(accessToken, workInvoiceId, message, informType); // 解析失败也执行兜底方法
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 2
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/invoice/utils/OMS/FileHandlingUtil.java

@@ -165,7 +165,7 @@ public class FileHandlingUtil {
      *         - fileSize:Long,成功时为文件大小(字节,通过File.length()获取),失败时为0
      *         - errorMsg:String,失败时为错误信息,成功时为null
      */
-    public static Map<String, Object> fileUpload(String filePath, String fileStorageLocation) {
+    public static Map<String, Object> fileUpload(String filePath, String fileStorageLocation,String uploadPrefix) {
         // 初始化返回Map
         Map<String, Object> resultMap = new HashMap<>(4);
         resultMap.put("success", false); // 默认失败
@@ -221,7 +221,7 @@ public class FileHandlingUtil {
 
             // ========== 3. 拼接OSS存储目录 ==========
             String baseDir = directory.replaceFirst("/", "");
-            String realPath = baseDir + "/OMS_invoice" + datePath() + "/" + fileStorageLocation + "/";
+            String realPath = baseDir + "/OMS_invoice" +"/"+ uploadPrefix + datePath() + "/" + fileStorageLocation + "/";
             if (!realPath.endsWith("/")) {
                 realPath += "/";
             }

+ 2 - 7
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/config/OmsConfig.java

@@ -32,14 +32,9 @@ public class OmsConfig {
     public static  final String omsUrl = "https://oms-sandbox.einvoice.js.cn:7079";
     //public static  final String omsUrl = "https://www.oms.ejinshui-cloud.com:8899";
 
-    /** 用于判定是否开启oms开票流程事件 */
-    public static  final boolean omsEnabled = true;
-
     public static final String directory = "/attachment-file";
 
-    /** 成功短信模板编号 */
-    public static  final String successSmsCode = "SMS_501960223";
-    /** 失败短信模板编号 */
-    public static  final String errorSmsCode = "SMS_501645266";
+    /** 通知短信模板编号 */
+    public static  final String smsCode = "SMS_501985251";
 
 }

+ 3 - 3
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/controller/CwFinanceInvoiceController.java

@@ -894,14 +894,14 @@ public class CwFinanceInvoiceController {
      * 下载附件(文件没有时间戳前缀)
      */
     @GetMapping("/downLoadOMSInvoiceAttachzip")
-    public void downLoadOMSInvoiceAttachzip(@RequestParam("fileUrl")String fileUrl, HttpServletResponse response) {
+    public void downLoadOMSInvoiceAttachzip(@RequestParam("fileUrl")String fileUrl,@RequestParam("invoiceNo")String invoiceNo, HttpServletResponse response) {
         long timestamp = System.currentTimeMillis();
         UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
         String filePath = null;
         if (System.getProperty("os.name").toLowerCase().contains("win")) {
-            filePath = "D:/attachment-file/" + userDTO.getName() + timestamp;
+            filePath = "D:/attachment-file/"+invoiceNo;
         } else {
-            filePath = "/attachment-file/" + userDTO.getName() + timestamp;
+            filePath = "/attachment-file/"+invoiceNo;
         }
 
         File folder = new File(filePath);

+ 66 - 69
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/CwFinanceInvoiceService.java

@@ -44,6 +44,7 @@ import com.jeeplus.sys.service.dto.RoleDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -95,6 +96,12 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
     @Resource
     private CwWorkClientService cwWorkClientService;
 
+    @Value("${oms.omsEnabled}")
+    private Boolean omsEnabled;
+
+    private static final String unitName = "兴光会计";
+
+
     Pattern mobilePattern = Pattern.compile("^1[3-9]\\d{9}$");
 
     public List<String> getSearchList(ArrayList<String> searchIdList, List<String> ids) {
@@ -2127,37 +2134,33 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
         List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
         //发票管理员
         notifiedPartyUsers.add(user);
-        if (StringUtils.isNotBlank(workInvoice.getStatus()) && !workInvoice.getStatus().equals("3")){
+        if (StringUtils.isNotBlank(workInvoice.getStatus()) && workInvoice.getStatus().equals("3")){
             for (UserDTO notifiedPartyUser : notifiedPartyUsers) {
-               sendNotify(notifiedPartyUser,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
-            }
-        }
-
-        //发起短信通知,用于通知开票人
-        //查询开票人员的手机号
-        if (StringUtils.isNotBlank(user.getMobile()) && mobilePattern.matcher(user.getMobile().trim()).matches() ) {
-            //验证手机号是否已经注册
-            if(StringUtils.isNotBlank(user.getMobile())){
-                Map<String,Object> result = null;
-                try{
-                    //调用工具类返回结果
-                    result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(user.getMobile(),workInvoice.getNo(),errorSmsCode);
-                    Integer statusCode = (Integer) result.get("statusCode");
-                    if (200 == statusCode) {
-                        System.out.println("短信发送成功!");
-                    } else if (10001 == statusCode) {
-                        String message = (String) result.get("message");
-                        System.out.println(message);
-                    }else if(10002 == statusCode){
-                        System.out.println("账户短信量余额不足,请联系管理员进行充值!");
-                    }else if(10003 == statusCode){
-                        System.out.println("手机号获取验证码次数已达每日上限!");
-                    } else {
-                        System.out.println("短信发送失败,错误代码:101,请联系管理员!");
+               // 通知
+                sendNotify(notifiedPartyUser,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
+                //短信
+                if (StringUtils.isNotBlank(notifiedPartyUser.getMobile()) && mobilePattern.matcher(notifiedPartyUser.getMobile().trim()).matches() ) {
+                    Map<String,Object> result = null;
+                    try{
+                        //调用工具类返回结果
+                        result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(notifiedPartyUser.getMobile(),unitName,workInvoice.getNo(),"开票失败",smsCode);
+                        Integer statusCode = (Integer) result.get("statusCode");
+                        if (200 == statusCode) {
+                            System.out.println("短信发送成功!");
+                        } else if (10001 == statusCode) {
+                            String message = (String) result.get("message");
+                            System.out.println(message);
+                        }else if(10002 == statusCode){
+                            System.out.println("账户短信量余额不足,请联系管理员进行充值!");
+                        }else if(10003 == statusCode){
+                            System.out.println("手机号获取验证码次数已达每日上限!");
+                        } else {
+                            System.out.println("短信发送失败,错误代码:101,请联系管理员!");
+                        }
+                    }catch (Exception e){
+                        System.out.println("阿里云发送短信失败。失败原因为:" + e.getMessage());
+                        e.printStackTrace();
                     }
-                }catch (Exception e){
-                    System.out.println("阿里云发送短信失败。失败原因为:" + e.getMessage());
-                    e.printStackTrace();
                 }
             }
         }
@@ -2175,6 +2178,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
      */
     @Transactional(readOnly = false)
     public  Boolean updateOmsByIdOnDown(CwFinanceInvoiceDTO workInvoice, OMSInvoiceDetailInfo invoiceInfo, String informType) {
+        String uploadPrefix = "cw";
         Boolean isSuccess = false;
         workInvoice.setOmsEinVno(invoiceInfo.getAllEinVno());
         if(StringUtils.isNotBlank(invoiceInfo.getOfdUrl())){
@@ -2183,7 +2187,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
             //如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
             if(StringUtils.isNotBlank(ofdLocalFilePath)){
                 // 调用上传方法,接收Map类型返回值(替换原String类型接收)
-                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo());
+                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo(),uploadPrefix);
                 fileUploadOnAttachment(uploadResult,workInvoice, "ofd", "1");
             }
         }
@@ -2195,7 +2199,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
             //如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
             if(StringUtils.isNotBlank(ofdLocalFilePath)){
                 // 调用上传方法,接收Map类型返回值(替换原String类型接收)
-                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo());
+                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo(),uploadPrefix);
                 fileUploadOnAttachment(uploadResult,workInvoice, "pdf", "2");
             }
         }
@@ -2206,7 +2210,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
             //如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
             if(StringUtils.isNotBlank(ofdLocalFilePath)){
                 // 调用上传方法,接收Map类型返回值(替换原String类型接收)
-                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo());
+                Map<String, Object> uploadResult = FileHandlingUtil.fileUpload(ofdLocalFilePath, workInvoice.getNo(),uploadPrefix);
                 fileUploadOnAttachment(uploadResult,workInvoice, "xml", "3");
             }
         }
@@ -2244,47 +2248,40 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
 
         String title = str;
 
-        //通知开票发起人和发票管理员
-        RoleDTO roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByName2("发票管理员");
-        List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
-        //发票管理员
-        notifiedPartyUsers.add(userDTO);
+        //成功通知开票发起人
         if (StringUtils.isNotBlank(workInvoice.getStatus()) && !workInvoice.getStatus().equals("3")){
             workInvoice.setStatus("5");
-            for (UserDTO notifiedPartyUser : notifiedPartyUsers) {
-                sendNotify(notifiedPartyUser,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
-            }
-        }
-
-
-        //发起短信通知,用于通知开票人
-        //查询开票人员的手机号
-        if (StringUtils.isNotBlank(userDTO.getMobile()) && mobilePattern.matcher(userDTO.getMobile().trim()).matches() ) {
-            //验证手机号是否已经注册
-            if(StringUtils.isNotBlank(userDTO.getMobile())){
-                Map<String,Object> result = null;
-                try{
-                    //调用工具类返回结果
-                    result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(userDTO.getMobile(),workInvoice.getNo(),successSmsCode);
-                    Integer statusCode = (Integer) result.get("statusCode");
-                    if (200 == statusCode) {
-                        System.out.println("短信发送成功!");
-                    } else if (10001 == statusCode) {
-                        String message = (String) result.get("message");
-                        System.out.println(message);
-                    }else if(10002 == statusCode){
-                        System.out.println("账户短信量余额不足,请联系管理员进行充值!");
-                    }else if(10003 == statusCode){
-                        System.out.println("手机号获取验证码次数已达每日上限!");
-                    } else {
-                        System.out.println("短信发送失败,错误代码:101,请联系管理员!");
+            sendNotify(userDTO,workInvoice.getProcessDefinitionId(),workInvoice.getProcInsId(),title);
+
+            //发起短信通知,用于通知开票人
+            //查询开票人员的手机号
+            if (StringUtils.isNotBlank(userDTO.getMobile()) && mobilePattern.matcher(userDTO.getMobile().trim()).matches() ) {
+                //验证手机号是否已经注册
+                if(StringUtils.isNotBlank(userDTO.getMobile())){
+                    Map<String,Object> result = null;
+                    try{
+                        //调用工具类返回结果
+                        result = SpringUtil.getBean ( IUserApi.class ).sendEntryRandomCodesByInvoice(userDTO.getMobile(),unitName,workInvoice.getNo(),"开票成功",smsCode);
+                        Integer statusCode = (Integer) result.get("statusCode");
+                        if (200 == statusCode) {
+                            System.out.println("短信发送成功!");
+                        } else if (10001 == statusCode) {
+                            String message = (String) result.get("message");
+                            System.out.println(message);
+                        }else if(10002 == statusCode){
+                            System.out.println("账户短信量余额不足,请联系管理员进行充值!");
+                        }else if(10003 == statusCode){
+                            System.out.println("手机号获取验证码次数已达每日上限!");
+                        } else {
+                            System.out.println("短信发送失败,错误代码:101,请联系管理员!");
+                        }
+                    }catch (Exception e){
+                        System.out.println("阿里云发送短信失败。失败原因为:" + e.getMessage());
+                        e.printStackTrace();
                     }
-                }catch (Exception e){
-                    System.out.println("阿里云发送短信失败。失败原因为:" + e.getMessage());
-                    e.printStackTrace();
-                }
-                finally {
+                    finally {
 
+                    }
                 }
             }
         }

+ 2 - 4
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/OMS/OMSDisposeService.java

@@ -344,7 +344,7 @@ public class OMSDisposeService {
                 System.err.println("❌ 订单上传返回业务错误码:"+code+",立即执行失败兜底逻辑修改系统信息!");
                 System.err.println("❌ 订单上传返回业务错误原因:"+message);
                 map.put("订单状态", "失败,错误码:"+code);
-                handleInvoiceRetryAllFail(accessToken, workInvoiceId, "订单上传返回业务错误码:"+code+",错误原因:"+message, informType); // 解析失败也执行兜底方法
+                handleInvoiceRetryAllFail(accessToken, workInvoiceId, message, informType); // 解析失败也执行兜底方法
                 remainRetryTimes = 0;
             }
         } catch (Exception e) {
@@ -496,13 +496,11 @@ public class OMSDisposeService {
                 workInvoice.setStatus("3");
                 //修改结果
                 workInvoiceDao.updateAccessTokenErrorById(workInvoice);
-
                 //通知发起人或者开票管理员
                 workInvoiceService.handleInvoiceRetryAllFail(workInvoice, errorMessage, informType);
 
             }
 
-
             System.err.println("============ 【失败兜底-系统信息修改逻辑】执行完成 ============");
 
         } catch (Exception e) {
@@ -720,7 +718,7 @@ public class OMSDisposeService {
             } else {
                 String message = resultTokenInfo.getResult().getMessage();
                 System.err.println("❌ 全类型红冲--红字确认单查询接口返回业务错误码:"+code+",错误原因为:"+message);
-                handleInvoiceRetryAllFail(accessToken, workInvoiceId, "全类型红冲--红字确认单查询接口返回业务错误码:"+code+",错误原因为:"+message, informType); // 解析失败也执行兜底方法
+                handleInvoiceRetryAllFail(accessToken, workInvoiceId, message, informType); // 解析失败也执行兜底方法
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 2
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/util/OMS/FileHandlingUtil.java

@@ -165,7 +165,7 @@ public class FileHandlingUtil {
      *         - fileSize:Long,成功时为文件大小(字节,通过File.length()获取),失败时为0
      *         - errorMsg:String,失败时为错误信息,成功时为null
      */
-    public static Map<String, Object> fileUpload(String filePath, String fileStorageLocation) {
+    public static Map<String, Object> fileUpload(String filePath, String fileStorageLocation,String uploadPrefix) {
         // 初始化返回Map
         Map<String, Object> resultMap = new HashMap<>(4);
         resultMap.put("success", false); // 默认失败
@@ -221,7 +221,7 @@ public class FileHandlingUtil {
 
             // ========== 3. 拼接OSS存储目录 ==========
             String baseDir = directory.replaceFirst("/", "");
-            String realPath = baseDir + "/OMS_invoice" + datePath() + "/" + fileStorageLocation + "/";
+            String realPath = baseDir + "/OMS_invoice"+"/"+ uploadPrefix + datePath() + "/" + fileStorageLocation + "/";
             if (!realPath.endsWith("/")) {
                 realPath += "/";
             }

+ 2 - 2
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/feign/UserApiImpl.java

@@ -67,8 +67,8 @@ public class UserApiImpl implements IUserApi {
     }
 
     @Override
-    public Map<String, Object> sendEntryRandomCodesByInvoice(String mobile, String number,String smsCode) throws Exception {
-        return ALiYunSmsUtil.sendEntryRandomCodesByInvoice(mobile, number,smsCode);
+    public Map<String, Object> sendEntryRandomCodesByInvoice(String mobile, String unitName, String number, String result, String smsCode) throws Exception {
+        return ALiYunSmsUtil.sendEntryRandomCodesByInvoice(mobile, unitName,number,result, smsCode);
     }
 
 

+ 2 - 2
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/ALiYunSmsUtil.java

@@ -330,7 +330,7 @@ public class ALiYunSmsUtil {
      * @return
      * @throws Exception
      */
-    public static HashMap<String,Object> sendEntryRandomCodesByInvoice(String phoneNumbers, String number,String smsCode) throws Exception {
+    public static HashMap<String,Object> sendEntryRandomCodesByInvoice(String phoneNumbers,String unitName,String number, String result,String smsCode) throws Exception {
         HashMap<String,Object> map = new HashMap<>();
         Config config = new Config()
                 .setAccessKeyId(ACCESS_KEY_ID)
@@ -338,7 +338,7 @@ public class ALiYunSmsUtil {
                 .setEndpoint(ENDPOINT);
 
         // 构造包含多个参数的JSON字符串
-        String templateParams = String.format("{\"number\":\"%s\"}", number);
+        String templateParams = String.format("{\"unitName\":\"%s\",\"number\":\"%s\",\"result\":\"%s\"}", unitName,number,result);
         String templateCode = smsCode;
         Client client = new Client(config);
         SendSmsRequest sendSmsRequest = new SendSmsRequest()