diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/http/HttpRequestHelper.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/http/HttpRequestHelper.java new file mode 100644 index 00000000..a5dbf972 --- /dev/null +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/http/HttpRequestHelper.java @@ -0,0 +1,340 @@ +package com.bonus.sgzb.common.core.utils.http; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Map; +import java.util.StringJoiner; + +/** + * @Author ma_sh + * @create 2025/4/22 16:30 + */ +public class HttpRequestHelper { + + // 连接超时设置:5秒 + private static final int CONNECT_TIMEOUT = 5000; + // 读取超时设置:5秒 + private static final int READ_TIMEOUT = 5000; + + /** + * 发送HTTP请求的通用方法 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param method 请求方法 (GET, POST, PUT, DELETE, PATCH) + * @param body 请求体(适用于POST、PUT、PATCH) + * @param headers 请求头 + * @return String 响应内容 + */ + private static String sendRequest(String baseUrl, String endpoint, String method, String body, Map headers) { + HttpURLConnection connection = null; + try { + // 创建URL对象并打开连接 + URL url = new URL(baseUrl + endpoint); + connection = (HttpURLConnection) url.openConnection(); + + // 设置请求方法 + connection.setRequestMethod(method); + + // 设置连接超时和读取超时时间 + connection.setConnectTimeout(CONNECT_TIMEOUT); + connection.setReadTimeout(READ_TIMEOUT); + + // 设置请求头 + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + connection.setRequestProperty(entry.getKey(), entry.getValue()); + } + } + + // 如果请求体不为空,且方法是POST、PUT或PATCH,则写入请求体 + if (body != null && !body.isEmpty() && (method.equals("POST") || method.equals("PUT") || method.equals("PATCH"))) { + connection.setDoOutput(true); + try (OutputStream os = connection.getOutputStream()) { + os.write(body.getBytes()); + os.flush(); + } + } + + // 连接服务器并检查响应代码 + int responseCode = connection.getResponseCode(); + if (responseCode != HttpURLConnection.HTTP_OK) { + throw new RuntimeException("Request failed with response code: " + responseCode); + } + + // 获取输入流并读取响应内容 + StringBuilder response = new StringBuilder(); + try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + } + + return response.toString(); + + } catch (Exception e) { + e.printStackTrace(); + return null; + + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } + + /** + * 将表单数据转换为application/x-www-form-urlencoded格式的方法 + * + * @param formData 表单数据 + * @return String 表单数据的URL编码格式 + */ + private static String getFormBody(Map formData) { + try { + StringJoiner sj = new StringJoiner("&"); + for (Map.Entry entry : formData.entrySet()) { + sj.add(URLEncoder.encode(entry.getKey(), "UTF-8") + "=" + URLEncoder.encode(entry.getValue(), "UTF-8")); + } + return sj.toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 发送GET请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String get(String baseUrl, String endpoint, Map headers) { + return sendRequest(baseUrl, endpoint, "GET", null, headers); + } + + /** + * 发送POST请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param body 请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String post(String baseUrl, String endpoint, String body, Map headers) { + return sendRequest(baseUrl, endpoint, "POST", body, headers); + } + + /** + * 发送POST表单请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param formData 表单数据 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String postForm(String baseUrl, String endpoint, Map formData, Map headers) { + headers.put("Content-Type", "application/x-www-form-urlencoded"); + String formBody = getFormBody(formData); + return sendRequest(baseUrl, endpoint, "POST", formBody, headers); + } + + /** + * 发送POST JSON请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param jsonBody JSON格式的请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String postJson(String baseUrl, String endpoint, String jsonBody, Map headers) { + headers.put("Content-Type", "application/json"); + return sendRequest(baseUrl, endpoint, "POST", jsonBody, headers); + } + + /** + * 发送POST XML请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param xmlBody XML格式的请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String postXml(String baseUrl, String endpoint, String xmlBody, Map headers) { + headers.put("Content-Type", "application/xml"); + return sendRequest(baseUrl, endpoint, "POST", xmlBody, headers); + } + + /** + * 发送POST原始数据请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param rawBody 原始请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String postRaw(String baseUrl, String endpoint, String rawBody, Map headers) { + return sendRequest(baseUrl, endpoint, "POST", rawBody, headers); + } + + /** + * 发送PUT请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param body 请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String put(String baseUrl, String endpoint, String body, Map headers) { + return sendRequest(baseUrl, endpoint, "PUT", body, headers); + } + + /** + * 发送PUT表单请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param formData 表单数据 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String putForm(String baseUrl, String endpoint, Map formData, Map headers) { + headers.put("Content-Type", "application/x-www-form-urlencoded"); + String formBody = getFormBody(formData); + return sendRequest(baseUrl, endpoint, "PUT", formBody, headers); + } + + /** + * 发送PUT JSON请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param jsonBody JSON格式的请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String putJson(String baseUrl, String endpoint, String jsonBody, Map headers) { + headers.put("Content-Type", "application/json"); + return sendRequest(baseUrl, endpoint, "PUT", jsonBody, headers); + } + + /** + * 发送PUT XML请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param xmlBody XML格式的请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String putXml(String baseUrl, String endpoint, String xmlBody, Map headers) { + headers.put("Content-Type", "application/xml"); + return sendRequest(baseUrl, endpoint, "PUT", xmlBody, headers); + } + + /** + * 发送PUT原始数据请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param rawBody 原始请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String putRaw(String baseUrl, String endpoint, String rawBody, Map headers) { + return sendRequest(baseUrl, endpoint, "PUT", rawBody, headers); + } + + /** + * 发送DELETE请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String delete(String baseUrl, String endpoint, Map headers) { + return sendRequest(baseUrl, endpoint, "DELETE", null, headers); + } + + /** + * 发送PATCH请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param body 请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String patch(String baseUrl, String endpoint, String body, Map headers) { + return sendRequest(baseUrl, endpoint, "PATCH", body, headers); + } + + /** + * 发送PATCH表单请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param formData 表单数据 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String patchForm(String baseUrl, String endpoint, Map formData, Map headers) { + headers.put("Content-Type", "application/x-www-form-urlencoded"); + String formBody = getFormBody(formData); + return sendRequest(baseUrl, endpoint, "PATCH", formBody, headers); + } + + /** + * 发送PATCH JSON请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param jsonBody JSON格式的请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String patchJson(String baseUrl, String endpoint, String jsonBody, Map headers) { + headers.put("Content-Type", "application/json"); + return sendRequest(baseUrl, endpoint, "PATCH", jsonBody, headers); + } + + /** + * 发送PATCH XML请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param xmlBody XML格式的请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String patchXml(String baseUrl, String endpoint, String xmlBody, Map headers) { + headers.put("Content-Type", "application/xml"); + return sendRequest(baseUrl, endpoint, "PATCH", xmlBody, headers); + } + + /** + * 发送PATCH原始数据请求 + * + * @param baseUrl 基URL + * @param endpoint 请求的端点 + * @param rawBody 原始请求体 + * @param headers 请求头 + * @return String 响应内容 + */ + public static String patchRaw(String baseUrl, String endpoint, String rawBody, Map headers) { + return sendRequest(baseUrl, endpoint, "PATCH", rawBody, headers); + } +} diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/poi/PoiOutPage.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/poi/PoiOutPage.java index cf834de8..d7fc9d8d 100644 --- a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/poi/PoiOutPage.java +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/poi/PoiOutPage.java @@ -844,6 +844,125 @@ public class PoiOutPage { RegionUtil.setBorderRight(BorderStyle.THIN, cellRange8, sheet); + return rowNum; + } + + /** + * 创建入库单 + * @param result + * @param list + * @param fileName + * @return + */ + public static HSSFWorkbook excelForCheckInput(List> result, List list, String fileName) { + // 创建工作簿和工作表 + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet(); + sheet.setDefaultColumnWidth(16); // 设置列宽 + + // 创建样式 + HSSFCellStyle titleStyle = createTitleStyle(workbook); + HSSFCellStyle headerStyle = createHeaderStyle(workbook); + HSSFCellStyle contentStyle = createCellStyleCost(workbook); + + // 设置工作簿名称 + workbook.setSheetName(0, fileName); + + // 填充标题行 + int rowNum = 0; + rowNum = createTitleRow(sheet, rowNum, fileName, titleStyle, list.size()); + rowNum = createProjectInfoRowInput(sheet, rowNum, titleStyle, list.size()); + + // 填充表头 + rowNum = createHeaderRow(sheet, rowNum, list, headerStyle); + + // 填充数据行 + if (result != null && !result.isEmpty()) { + rowNum = createDataRows(sheet, rowNum, result, contentStyle, list.size()); + } else { + // 如果没有数据,则仅显示表头 +// rowNum++; +// rowNum = createDataRows(sheet, rowNum, result, contentStyle, list.size()); + HSSFRow row = sheet.createRow(rowNum++); + HSSFCell cell = row.createCell(0); + cell.setCellStyle(headerStyle); + cell.setCellValue("暂无数据"); + sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (list.size() - 1))); + CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (list.size() - 1)); + // 设置边框样式 + RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet); + RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet); + RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet); + RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet); + } + rowNum = createTotalRowInput(sheet, rowNum, list, headerStyle); + return workbook; + } + + /** + * 创建入库单 + * @param sheet + * @param rowNum + * @param list + * @param headerStyle + * @return + */ + private static int createTotalRowInput(HSSFSheet sheet, int rowNum, List list, HSSFCellStyle headerStyle) { + HSSFRow row = sheet.createRow(rowNum++); + row.setHeightInPoints(30); + sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (list.size() - 1))); + HSSFCell cell = row.createCell(0); + cell.setCellStyle(headerStyle); + cell.setCellValue("审核: " + " 库管员: " + " 经办人: "); + + // 添加边框 + CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (list.size() - 1)); + // 设置边框样式 + RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet); + RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet); + RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet); + RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet); + + return rowNum; + } + + /** + * 创建入库单 + * @param sheet + * @param rowNum + * @param titleStyle + * @param nColumn + * @return + */ + private static int createProjectInfoRowInput(HSSFSheet sheet, int rowNum, HSSFCellStyle titleStyle, int nColumn) { + // 第一行:领料单位 + HSSFRow row1 = sheet.createRow(rowNum++); + row1.setHeightInPoints(30); + // bug修复:修改合并单元格区域,确保包含两个或以上单元格 + //sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 1)); + HSSFCell cell1 = row1.createCell(0); + cell1.setCellStyle(titleStyle); + cell1.setCellValue("日期:"); + + /*sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 2, (short) (nColumn - 1))); + HSSFCell cell2 = row1.createCell(2); + cell2.setCellStyle(titleStyle); + cell2.setCellValue(unit);*/ + + /*// 添加边框 + CellRangeAddress cellRange1 = new CellRangeAddress(rowNum - 3, rowNum - 3, 0, 1); + CellRangeAddress cellRange2 = new CellRangeAddress(rowNum - 3, rowNum - 3, 2, (short) (nColumn - 1)); + // 设置边框样式 + RegionUtil.setBorderTop(BorderStyle.THIN, cellRange1, sheet); + RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange1, sheet); + RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange1, sheet); + RegionUtil.setBorderRight(BorderStyle.THIN, cellRange1, sheet); + RegionUtil.setBorderTop(BorderStyle.THIN, cellRange2, sheet); + RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange2, sheet); + RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange2, sheet); + RegionUtil.setBorderRight(BorderStyle.THIN, cellRange2, sheet);*/ + + return rowNum; } } diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/sms/SmsConfig.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/sms/SmsConfig.java new file mode 100644 index 00000000..5ce02a75 --- /dev/null +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/sms/SmsConfig.java @@ -0,0 +1,16 @@ +package com.bonus.sgzb.common.core.utils.sms; + +public class SmsConfig { + + public static final String DOMAIN = "http://api.ktsms.cn/"; + + public static final String DDT_KEY = "bonusyn"; + + public static final String SECRET_KEY = "IU0ypHbH"; + + public static final String SMS_SIGNATURE = "【博诺思】"; + + public static final String SMS_TOKEN = "sms_token"; + + +} diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/sms/SmsUtils.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/sms/SmsUtils.java new file mode 100644 index 00000000..e3d9280a --- /dev/null +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/sms/SmsUtils.java @@ -0,0 +1,53 @@ +package com.bonus.sgzb.common.core.utils.sms; + +import com.alibaba.fastjson2.JSON; +import com.bonus.sgzb.common.core.utils.http.HttpRequestHelper; + +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; + +/** + * @Author ma_sh + * @create 2025/4/22 16:27 + */ +public class SmsUtils { + + /** + * 发送短信验证码 + * + * @param mobile 发信发送的目的号码.多个号码之间用半角逗号隔开 + * @param content 短信的内容,内容需要UTF-8编码 + * @param sendTime 为空表示立即发送,定时发送格式:20101024090810 + * @return 是否发送成功 + */ + public static String smsToken(String mobile, String content, String sendTime) { + Map headers = new HashMap<>(); + Map mapJson = new HashMap<>(6); + mapJson.put("ddtkey", SmsConfig.DDT_KEY); + mapJson.put("secretkey", SmsConfig.SECRET_KEY); + mapJson.put("mobile", mobile); + mapJson.put("content", SmsConfig.SMS_SIGNATURE + content); + mapJson.put("sendTime", sendTime); + mapJson.put("extno", ""); + + // 将mapJson转换为URL查询参数格式 + StringBuilder urlBuilder = new StringBuilder(SmsConfig.SMS_TOKEN + "?"); + for (Map.Entry entry : mapJson.entrySet()) { + try { + String encodedKey = URLEncoder.encode(entry.getKey(), "UTF-8"); + String encodedValue = URLEncoder.encode(entry.getValue().toString(), "UTF-8"); + urlBuilder.append(encodedKey).append("=").append(encodedValue).append("&"); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + // 移除最后一个&符号 + urlBuilder.setLength(urlBuilder.length() - 1); + String urlWithParams = urlBuilder.toString(); + + String json = JSON.toJSONString(mapJson); + return HttpRequestHelper.postJson(SmsConfig.DOMAIN, urlWithParams, json, headers); + } +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java index 0687138e..4c52ef6c 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java @@ -434,11 +434,9 @@ public class TmTaskController extends BaseController { leaseAuditList = tmTaskService.getLeaseAuditManageList(task); return AjaxResult.success(leaseAuditList); } -// startPage(); + startPage(); leaseAuditList = tmTaskService.getLeaseAuditManageList(task); - Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); - Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); - return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, leaseAuditList)); + return AjaxResult.success(getDataTable(leaseAuditList)); } /** diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index fc3b9c5c..d499bca8 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -893,157 +893,87 @@ public class TmTaskServiceImpl implements TmTaskService { List tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record); for (TmTask tmTask : tmTaskList) { - int count = 0; - if (tmTask != null) { - // 去查询任务分单表 - List collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); - if (collect.size() > 0) { - int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy()); - if (roles.contains("admin") || deptId == 100) { - // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : collect) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); - } - } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(collect); - tmTask.setDeptId(Long.parseLong(String.valueOf(deptId1))); - tmTask.setRemark(collect.get(0).getRemark()); - } - } - } - } else if (deptId == 101) { //机具经理、书记、副经理查看数据 - List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); - if (deptId1 == 101) { - List applyInfoList = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); - auditListByLeaseInfo.addAll(applyInfoList); - } - - if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) { - // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); - } - } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); - tmTask.setDeptId(Long.parseLong(String.valueOf(deptId1))); - tmTask.setRemark(collect.get(0).getRemark()); - } - } - } - } - } else if (deptId == 102) { // 调试公司可以看到的数据权限 - List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); - if (deptId1 == 102) { - List list2 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); - auditListByLeaseInfo.addAll(list2); - } - - if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) { - // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); - } - } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); - tmTask.setDeptId(Long.parseLong(String.valueOf(deptId1))); - tmTask.setRemark(collect.get(0).getRemark()); - } - } - } - } - } else if (deptId == deptId1) { //其他各分公司可以看到的自己部门的数据 - // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : collect) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); - } - } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(collect); - tmTask.setDeptId(Long.parseLong(String.valueOf(deptId1))); - tmTask.setRemark(collect.get(0).getRemark()); - } - } - } - } else if (roles.contains("sgb")) { - // 对领料任务集合查询具体详情 - List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); - if (deptId1 == 210) { - List list1 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); - auditListByLeaseInfo.addAll(list1); - } - if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) { - // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); - } - } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); - tmTask.setDeptId(Long.parseLong(String.valueOf(deptId1))); - tmTask.setRemark(collect.get(0).getRemark()); - } - } - } - } - } - - } + if (tmTask == null) { + continue; } - tmTask.setPreCountNum(count); + List collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); + if (collect.isEmpty()) { + continue; + } + int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy()); + List filteredList = filterLeaseApplyInfoList(roles, deptId, deptId1, collect); + processLeaseApplyInfoList(tmTaskMapper, tmTask, filteredList, deptId1, collect.get(0).getRemark()); } - List tmTasks = tmTaskList.stream().filter(t -> t.getLeaseApplyInfoList() != null).collect(Collectors.toList()); - return tmTasks; + + return tmTaskList; } + + private static List filterLeaseApplyInfoList(Set roles, Long deptId, int deptId1, List collect) { + if (roles.contains("admin") || deptId == 100) { + return collect; + } else if (deptId == 101) { + List auditListByLeaseInfo = collect.stream() + .filter(t -> t.getCompanyId() != null && t.getCompanyId() == 101) + .collect(Collectors.toList()); + if (deptId1 == 101) { + auditListByLeaseInfo.addAll(collect.stream() + .filter(t -> t.getCompanyId() != null && t.getCompanyId() == 102) + .collect(Collectors.toList())); + } + return auditListByLeaseInfo; + } else if (deptId == 102) { + List auditListByLeaseInfo = collect.stream() + .filter(t -> t.getCompanyId() != null && t.getCompanyId() == 102) + .collect(Collectors.toList()); + if (deptId1 == 102) { + auditListByLeaseInfo.addAll(collect.stream() + .filter(t -> t.getCompanyId() != null && t.getCompanyId() == 101) + .collect(Collectors.toList())); + } + return auditListByLeaseInfo; + } else if (deptId == deptId1) { + return collect; + } else if (roles.contains("sgb")) { + List auditListByLeaseInfo = collect.stream() + .filter(t -> t.getCompanyId() != null && t.getCompanyId() == 101) + .collect(Collectors.toList()); + if (deptId1 == 210) { + auditListByLeaseInfo.addAll(collect.stream() + .filter(t -> t.getCompanyId() != null && t.getCompanyId() == 102) + .collect(Collectors.toList())); + } + return auditListByLeaseInfo; + } + return new ArrayList<>(); + } + + private static void processLeaseApplyInfoList(TmTaskMapper tmTaskMapper, TmTask tmTask, List leaseApplyInfoList, int deptId1, String remark) { + if (leaseApplyInfoList.isEmpty()) { + return; + } + int count = 0; + for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) { + if (leaseApplyInfo == null) { + continue; + } + List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); + if (!leaseApplyDetails.isEmpty()) { + for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { + if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { + count += leaseApplyDetail.getPreNum(); + } + } + leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); + } + } + tmTask.setLeaseApplyInfoList(leaseApplyInfoList); + tmTask.setDeptId((long) deptId1); + tmTask.setRemark(remark); + tmTask.setPreCountNum(count); + } + /** * 获取审核列表 - App端 */ diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml index 8cea69a2..357138e6 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml @@ -496,14 +496,14 @@ bai.agreement_code as agreementCode, tt.create_time as createTimes, tt.update_time as updateTimes FROM - tm_task tt + lease_apply_info lai + LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN sys_user su ON tt.create_by = su.user_id LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id - LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id LEFT JOIN sys_dic d ON d.id = tt.task_status WHERE tt.task_type = '29' and tt.status = '1' @@ -561,14 +561,14 @@ bai.agreement_code as agreementCode, tt.create_time as createTimes, tt.update_time as updateTimes FROM - tm_task tt + lease_apply_info lai + LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN sys_user su ON tt.create_by = su.user_id LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id - LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id LEFT JOIN sys_dic d ON d.id = tt.task_status WHERE tt.task_type = '29' and tt.status = '1' @@ -993,14 +993,14 @@ bai.agreement_code as agreementCode, tt.create_time as createTimes, tt.update_time as updateTimes FROM - tm_task tt + lease_apply_info lai + LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN sys_user su ON tt.create_by = su.user_id LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id - LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id LEFT JOIN sys_dic d ON d.id = tt.task_status WHERE tt.task_type = '29' and tt.status = '1' diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java index 5c6e8199..491fa4bc 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java @@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.*; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; -import com.bonus.sgzb.common.core.web.page.TableDataInfo; import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_NUM; import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE; @@ -103,6 +102,18 @@ public class PurchaseMacodeInfoController extends BaseController { return success(purchaseMacodeInfoService.warehousingEntry(purchaseMacodeInfo)); } + /** + * 新购入库单导出 + * @param purchaseMacodeInfo + * @param response + */ + @Log(title = "新购入库单导出", businessType = BusinessType.EXPORT) + @PostMapping("/exportWareHousingEntry") + public void exportInfo(PurchaseMacodeInfo purchaseMacodeInfo, HttpServletResponse response) { + List details = purchaseMacodeInfoService.warehousingEntry(purchaseMacodeInfo); + purchaseMacodeInfoService.exportWareHousingEntry(details, response); + } + /** * 新增新购验收编号管理 */ diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseMacodeInfoService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseMacodeInfoService.java index 219bbb2f..5f03d657 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseMacodeInfoService.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseMacodeInfoService.java @@ -5,6 +5,7 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.material.domain.PurchaseMacodeInfo; import com.bonus.sgzb.base.api.domain.MaInputVO; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -111,4 +112,11 @@ public interface IPurchaseMacodeInfoService * @return List */ List warehousingEntry(PurchaseMacodeInfo purchaseMacodeInfo); + + /** + * 新购入库单导出 + * @param details + * @param response + */ + void exportWareHousingEntry(List details, HttpServletResponse response); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java index ad54bb02..10f7922f 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java @@ -1,6 +1,8 @@ package com.bonus.sgzb.material.service.impl; +import java.io.OutputStream; import java.math.BigDecimal; +import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -9,6 +11,7 @@ import com.bonus.sgzb.base.api.domain.*; import com.bonus.sgzb.base.api.domain.MachinePart; import com.bonus.sgzb.common.core.utils.StringHelper; import com.bonus.sgzb.common.core.utils.StringUtils; +import com.bonus.sgzb.common.core.utils.poi.PoiOutPage; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.material.domain.*; @@ -19,11 +22,13 @@ import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.material.vo.GlobalContants; import com.bonus.sgzb.base.api.domain.MaInputVO; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; /** * 新购验收编号管理Service业务层处理 @@ -530,4 +535,94 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService return purchaseMacodeInfoMapper.warehousingEntry(purchaseMacodeInfo); } + /** + * 导出入库清单 + * @param list + * @param response + */ + @Override + public void exportWareHousingEntry(List list, HttpServletResponse response) { + try { + String fileName = "入库单"; + expOutExcel(response, list, fileName); + } catch (Exception e) { + log.error(e.toString(), e); + } + } + + /** + * 导出excel + * @param response + * @param list + * @param fileName + */ + private void expOutExcel(HttpServletResponse response, List list, String fileName) + throws Exception { + if (list != null) { + List> results = new ArrayList<>(); + int size = list.size(); + for (int i = 0; i < size; i++) { + PurchaseMacodeInfo bean = list.get(i); + bean.setId((long) (i + 1)); + Map maps = outReceiveDetailsBeanToMap(bean); + results.add(maps); + } + List headers = receiveDetailsHeader(); + HSSFWorkbook workbook = PoiOutPage.excelForCheckInput(results, headers, fileName); + OutputStream out = null; + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + response.addHeader("Content-Disposition", + "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls"); + response.setHeader("Pragma", "No-cache"); + out = response.getOutputStream(); + workbook.write(out); + out.flush(); + out.close(); + }else{ + List> results = new ArrayList<>(); + List headers = receiveDetailsHeader(); + HSSFWorkbook workbook = PoiOutPage.excel(results, headers, fileName); + OutputStream out = null; + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + response.addHeader("Content-Disposition", + "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls"); + response.setHeader("Pragma", "No-cache"); + out = response.getOutputStream(); + workbook.write(out); + out.flush(); + out.close(); + } + } + + /** + * 入库清单导出 + * @param bean + * @return + */ + private Map outReceiveDetailsBeanToMap(PurchaseMacodeInfo bean) { + Map maps = new LinkedHashMap<>(); + maps.put("id", bean.getId()); + maps.put("typeName", bean.getTypeName()); + maps.put("specificationType", bean.getSpecificationType()); + maps.put("unitName", bean.getUnitName()); + maps.put("checkNum", bean.getCheckNum()); + maps.put("remark", bean.getRemark()); + return maps; + } + + /** + * 入库单头信息 + * @return + */ + private List receiveDetailsHeader() { + List list = new ArrayList<>(); + list.add("序号"); + list.add("类型名称"); + list.add("规格型号"); + list.add("计量单位"); + list.add("数量"); + list.add("备注"); + return list; + } + } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysSmsController.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysSmsController.java index fbf4bb9e..0b3194bb 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysSmsController.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysSmsController.java @@ -3,14 +3,13 @@ package com.bonus.sgzb.system.controller; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.system.service.ISysSmsService; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.Date; /** * Description: 短信控制器 @@ -22,6 +21,7 @@ import java.util.Date; @RestController @RequestMapping("/sms") +@Slf4j public class SysSmsController extends BaseController { @Resource @@ -63,11 +63,12 @@ public class SysSmsController extends BaseController { * @return */ @PostMapping("send") - public AjaxResult send(@RequestParam(value = "phone") String phone, @RequestParam(value = "msg",required = false) String msg){ + public Boolean send(@RequestParam(value = "phone") String phone, @RequestParam(value = "msg",required = false) String msg){ try { return smsService.sendSms(phone, msg); } catch (Exception e) { - return error(e.getMessage()); + log.error(e.getMessage()); + return false; } } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/ISysSmsService.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/ISysSmsService.java index 94482777..2c510373 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/ISysSmsService.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/ISysSmsService.java @@ -19,7 +19,7 @@ public interface ISysSmsService { * @param msg 内容 * @return 结果 */ - AjaxResult sendSms(String phone, String msg); + Boolean sendSms(String phone, String msg); /** * 发送短信 diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysSmsServiceImpl.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysSmsServiceImpl.java index 6c15cbab..e8e3c081 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysSmsServiceImpl.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysSmsServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.bonus.sgzb.common.core.constant.UserConstants; import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.utils.GlobalConstants; +import com.bonus.sgzb.common.core.utils.sms.SmsUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.redis.service.RedisService; import com.bonus.sgzb.system.config.TencentSmsConfig; @@ -63,20 +64,13 @@ public class SysSmsServiceImpl implements ISysSmsService { * @return */ @Override - public AjaxResult sendSms(String phone, String msg) { + public Boolean sendSms(String phone, String msg) { if (phone == null || StringUtils.isEmpty(msg)) { - return AjaxResult.error("手机号码或短信内容不能为空"); + throw new RuntimeException("手机号码或短信内容不能为空"); } if (phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) { - return AjaxResult.error("手机号格式不正确"); + throw new RuntimeException("手机号码或短信内容不能为空"); } - /* try { - String[] args = msg.split(","); - String body = sendMessageNew(phone,tencentSmsConfig.getTemplateId().get(0),args); - return success("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body); - } catch (Exception e) { - return AjaxResult.error("发送失败:" + e.getMessage()); - }*/ return sendMsgByPhone( phone, msg); } @@ -108,23 +102,27 @@ public class SysSmsServiceImpl implements ISysSmsService { * @param phone 手机号码 * @return AjaxResult对象 */ - private AjaxResult sendMsgByPhone(String phone, String msg) { + private Boolean sendMsgByPhone(String phone, String msg) { // 校验手机号码 if (phone == null || phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) { - return AjaxResult.error("手机号码不正确"); + throw new ServiceException("手机号码不正确"); } // 发送短信 try { // String URL = "http://106.ihuyi.common/webservice/sms.php?method=Submit"; String content = URL + "&mobile=" + phone + "&content=【智慧仓储】" + msg + "。"; - String body = HttpRequest.post(content).execute(false).body(); + //String body = HttpRequest.post(content).execute(false).body(); // System.out.println("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body); + String body = SmsUtils.smsToken(phone, msg,""); if (body == null || !body.contains(GlobalConstants.STRING_OK)) { - return AjaxResult.error("发送失败"); + log.error("发送失败:" + body); + throw new ServiceException("发送失败"); } - return success("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body); + log.error("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body); + return true; } catch (Exception e) { - return AjaxResult.error("发送失败:" + e.getMessage()); + log.error("发送失败:" + e.getMessage()); + return false; } }