|
@@ -44,6 +44,7 @@ import com.jeeplus.sys.service.dto.RoleDTO;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -95,6 +96,12 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
@Resource
|
|
@Resource
|
|
|
private CwWorkClientService cwWorkClientService;
|
|
private CwWorkClientService cwWorkClientService;
|
|
|
|
|
|
|
|
|
|
+ @Value("${oms.omsEnabled}")
|
|
|
|
|
+ private Boolean omsEnabled;
|
|
|
|
|
+
|
|
|
|
|
+ private static final String unitName = "兴光会计";
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Pattern mobilePattern = Pattern.compile("^1[3-9]\\d{9}$");
|
|
Pattern mobilePattern = Pattern.compile("^1[3-9]\\d{9}$");
|
|
|
|
|
|
|
|
public List<String> getSearchList(ArrayList<String> searchIdList, List<String> ids) {
|
|
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());
|
|
List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
|
|
|
//发票管理员
|
|
//发票管理员
|
|
|
notifiedPartyUsers.add(user);
|
|
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) {
|
|
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)
|
|
@Transactional(readOnly = false)
|
|
|
public Boolean updateOmsByIdOnDown(CwFinanceInvoiceDTO workInvoice, OMSInvoiceDetailInfo invoiceInfo, String informType) {
|
|
public Boolean updateOmsByIdOnDown(CwFinanceInvoiceDTO workInvoice, OMSInvoiceDetailInfo invoiceInfo, String informType) {
|
|
|
|
|
+ String uploadPrefix = "cw";
|
|
|
Boolean isSuccess = false;
|
|
Boolean isSuccess = false;
|
|
|
workInvoice.setOmsEinVno(invoiceInfo.getAllEinVno());
|
|
workInvoice.setOmsEinVno(invoiceInfo.getAllEinVno());
|
|
|
if(StringUtils.isNotBlank(invoiceInfo.getOfdUrl())){
|
|
if(StringUtils.isNotBlank(invoiceInfo.getOfdUrl())){
|
|
@@ -2183,7 +2187,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
//如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
|
|
//如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
|
|
|
if(StringUtils.isNotBlank(ofdLocalFilePath)){
|
|
if(StringUtils.isNotBlank(ofdLocalFilePath)){
|
|
|
// 调用上传方法,接收Map类型返回值(替换原String类型接收)
|
|
// 调用上传方法,接收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");
|
|
fileUploadOnAttachment(uploadResult,workInvoice, "ofd", "1");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2195,7 +2199,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
//如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
|
|
//如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
|
|
|
if(StringUtils.isNotBlank(ofdLocalFilePath)){
|
|
if(StringUtils.isNotBlank(ofdLocalFilePath)){
|
|
|
// 调用上传方法,接收Map类型返回值(替换原String类型接收)
|
|
// 调用上传方法,接收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");
|
|
fileUploadOnAttachment(uploadResult,workInvoice, "pdf", "2");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2206,7 +2210,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
//如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
|
|
//如果文件下载下来了,并且返回值正常,则此处需要对文件进行上传到阿里云操作
|
|
|
if(StringUtils.isNotBlank(ofdLocalFilePath)){
|
|
if(StringUtils.isNotBlank(ofdLocalFilePath)){
|
|
|
// 调用上传方法,接收Map类型返回值(替换原String类型接收)
|
|
// 调用上传方法,接收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");
|
|
fileUploadOnAttachment(uploadResult,workInvoice, "xml", "3");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2244,47 +2248,40 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
|
|
|
|
|
String title = str;
|
|
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")){
|
|
if (StringUtils.isNotBlank(workInvoice.getStatus()) && !workInvoice.getStatus().equals("3")){
|
|
|
workInvoice.setStatus("5");
|
|
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 {
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|