Commit 3a32869507886437d0d3f13313c6c544cacc72b5
1 parent
d73f6519
单位换算 单位字段规范化,统一切面异常捕捉逻辑
Signed-off-by: TanYibin <5491541@qq.com>
Showing
10 changed files
with
140 additions
and
112 deletions
ant-design-vue-jeecg/src/views/system/config/MaterialMultipleList.vue
... | ... | @@ -3,8 +3,7 @@ |
3 | 3 | <!-- 查询区域 --> |
4 | 4 | <div class="table-page-search-wrapper"> |
5 | 5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
6 | - <a-row :gutter="24"> | |
7 | - </a-row> | |
6 | + <a-row :gutter="24"></a-row> | |
8 | 7 | </a-form> |
9 | 8 | </div> |
10 | 9 | <!-- 查询区域-END --> |
... | ... | @@ -12,69 +11,75 @@ |
12 | 11 | <!-- 操作按钮区域 --> |
13 | 12 | <div class="table-operator"> |
14 | 13 | <a-button v-has="'materialMultiple:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> |
15 | - <a-button v-has="'materialMultiple:export'" type="primary" icon="download" | |
16 | - @click="handleExportXls('物料单位换算')">导出 | |
14 | + <a-button | |
15 | + v-has="'materialMultiple:export'" | |
16 | + type="primary" | |
17 | + icon="download" | |
18 | + @click="handleExportXls('物料单位换算')" | |
19 | + >导出 | |
17 | 20 | </a-button> |
18 | - <a-upload v-has="'materialMultiple:import'" name="file" :showUploadList="false" :multiple="false" | |
19 | - :headers="tokenHeader" :action="importExcelUrl" | |
20 | - @change="handleImportExcel"> | |
21 | + <a-upload | |
22 | + v-has="'materialMultiple:import'" | |
23 | + name="file" | |
24 | + :showUploadList="false" | |
25 | + :multiple="false" | |
26 | + :headers="tokenHeader" | |
27 | + :action="importExcelUrl" | |
28 | + @change="handleImportExcel" | |
29 | + > | |
21 | 30 | <a-button type="primary" icon="import">导入</a-button> |
22 | 31 | </a-upload> |
23 | 32 | <a-dropdown v-if="selectedRowKeys.length > 0"> |
24 | 33 | <a-menu slot="overlay" v-has="'materialMultiple:deleteBatch'"> |
25 | - <a-menu-item key="1" @click="batchDel"> | |
26 | - <a-icon type="delete"/> | |
27 | - 删除 | |
28 | - </a-menu-item> | |
34 | + <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item> | |
29 | 35 | </a-menu> |
30 | - <a-button style="margin-left: 8px"> 批量操作 | |
31 | - <a-icon type="down"/> | |
32 | - </a-button> | |
36 | + <a-button style="margin-left: 8px">批量操作<a-icon type="down"/></a-button> | |
33 | 37 | </a-dropdown> |
34 | - | |
35 | - <j-super-query :fieldList="superFieldList" v-has="'materialMultiple:superQuery'" | |
36 | - @handleSuperQuery="handleSuperQuery"/> | |
38 | + <j-super-query | |
39 | + :fieldList="superFieldList" | |
40 | + v-has="'materialMultiple:superQuery'" | |
41 | + @handleSuperQuery="handleSuperQuery" | |
42 | + /> | |
37 | 43 | </div> |
38 | 44 | |
39 | 45 | <!-- table区域-begin --> |
40 | 46 | <div> |
41 | 47 | <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
42 | - <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a | |
43 | - style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项 | |
48 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 | |
49 | + <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项 | |
44 | 50 | <a style="margin-left: 24px" @click="onClearSelected">清空</a> |
45 | 51 | </div> |
46 | 52 | |
47 | 53 | <a-table |
48 | 54 | ref="table" |
49 | 55 | size="middle" |
50 | - :scroll="{x:true}" | |
56 | + :scroll="{ x: true }" | |
51 | 57 | bordered |
52 | 58 | rowKey="id" |
53 | 59 | :columns="columns" |
54 | 60 | :dataSource="dataSource" |
55 | 61 | :pagination="ipagination" |
56 | 62 | :loading="loading" |
57 | - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
63 | + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" | |
58 | 64 | class="j-table-force-nowrap" |
59 | - @change="handleTableChange"> | |
60 | - | |
65 | + @change="handleTableChange" | |
66 | + > | |
61 | 67 | <template slot="htmlSlot" slot-scope="text"> |
62 | 68 | <div v-html="text"></div> |
63 | 69 | </template> |
64 | 70 | <template slot="imgSlot" slot-scope="text"> |
65 | 71 | <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
66 | - <img v-else :src="getImgView(text)" height="25px" alt="" | |
67 | - style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
72 | + <img | |
73 | + v-else | |
74 | + :src="getImgView(text)" | |
75 | + height="25px" | |
76 | + alt="" | |
77 | + style="max-width:80px;font-size: 12px;font-style: italic;" | |
78 | + /> | |
68 | 79 | </template> |
69 | 80 | <template slot="fileSlot" slot-scope="text"> |
70 | 81 | <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
71 | - <a-button | |
72 | - v-else | |
73 | - :ghost="true" | |
74 | - type="primary" | |
75 | - icon="download" | |
76 | - size="small" | |
77 | - @click="downloadFile(text)"> | |
82 | + <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)"> | |
78 | 83 | 下载 |
79 | 84 | </a-button> |
80 | 85 | </template> |
... | ... | @@ -82,7 +87,7 @@ |
82 | 87 | <span slot="action" slot-scope="text, record"> |
83 | 88 | <a v-has="'materialMultiple:edit'" @click="handleEdit(record)">编辑</a> |
84 | 89 | |
85 | - <a-divider type="vertical"/> | |
90 | + <a-divider type="vertical" /> | |
86 | 91 | <a-dropdown> |
87 | 92 | <a class="ant-dropdown-link">更多 <a-icon type="down"/></a> |
88 | 93 | <a-menu slot="overlay"> |
... | ... | @@ -97,7 +102,6 @@ |
97 | 102 | </a-menu> |
98 | 103 | </a-dropdown> |
99 | 104 | </span> |
100 | - | |
101 | 105 | </a-table> |
102 | 106 | </div> |
103 | 107 | |
... | ... | @@ -106,10 +110,9 @@ |
106 | 110 | </template> |
107 | 111 | |
108 | 112 | <script> |
109 | - | |
110 | 113 | import '@/assets/less/TableExpand.less' |
111 | -import {mixinDevice} from '@/utils/mixin' | |
112 | -import {JeecgListMixin} from '@/mixins/JeecgListMixin' | |
114 | +import { mixinDevice } from '@/utils/mixin' | |
115 | +import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
113 | 116 | import MaterialMultipleModal from './modules/MaterialMultipleModal' |
114 | 117 | |
115 | 118 | export default { |
... | ... | @@ -128,107 +131,105 @@ export default { |
128 | 131 | dataIndex: '', |
129 | 132 | key: 'rowIndex', |
130 | 133 | width: 60, |
131 | - align: "center", | |
132 | - customRender: function (t, r, index) { | |
133 | - return parseInt(index) + 1; | |
134 | + align: 'center', | |
135 | + customRender: function(t, r, index) { | |
136 | + return parseInt(index) + 1 | |
134 | 137 | } |
135 | 138 | }, |
136 | 139 | { |
137 | 140 | title: '物料编码', |
138 | - align: "center", | |
141 | + align: 'center', | |
139 | 142 | dataIndex: 'materialCode' |
140 | 143 | }, |
141 | 144 | { |
142 | 145 | title: '物料名称', |
143 | - align: "center", | |
146 | + align: 'center', | |
144 | 147 | dataIndex: 'materialName' |
145 | 148 | }, |
146 | 149 | { |
147 | 150 | title: '物料规格', |
148 | - align: "center", | |
151 | + align: 'center', | |
149 | 152 | dataIndex: 'materialSpec' |
150 | 153 | }, |
151 | 154 | { |
152 | 155 | title: '货主编码', |
153 | - align: "center", | |
156 | + align: 'center', | |
154 | 157 | dataIndex: 'companyCode' |
155 | 158 | }, |
156 | 159 | { |
157 | - title: '单位1', | |
158 | - align: "center", | |
160 | + title: '基准单位', | |
161 | + align: 'center', | |
159 | 162 | dataIndex: 'unit1' |
160 | 163 | }, |
161 | 164 | { |
162 | - title: '单位2', | |
163 | - align: "center", | |
165 | + title: '转换单位', | |
166 | + align: 'center', | |
164 | 167 | dataIndex: 'unit2' |
165 | 168 | }, |
166 | 169 | { |
167 | - title: '单位1转单位2换算倍数', | |
168 | - align: "center", | |
170 | + title: '转换比率', | |
171 | + align: 'center', | |
169 | 172 | dataIndex: 'multiple' |
170 | 173 | }, |
171 | 174 | { |
172 | 175 | title: '创建人', |
173 | - align: "center", | |
176 | + align: 'center', | |
174 | 177 | dataIndex: 'createBy' |
175 | 178 | }, |
176 | 179 | { |
177 | 180 | title: '创建日期', |
178 | - align: "center", | |
181 | + align: 'center', | |
179 | 182 | dataIndex: 'createTime' |
180 | 183 | }, |
181 | 184 | { |
182 | 185 | title: '更新人', |
183 | - align: "center", | |
186 | + align: 'center', | |
184 | 187 | dataIndex: 'updateBy' |
185 | 188 | }, |
186 | 189 | { |
187 | 190 | title: '更新日期', |
188 | - align: "center", | |
191 | + align: 'center', | |
189 | 192 | dataIndex: 'updateTime' |
190 | 193 | }, |
191 | 194 | { |
192 | 195 | title: '操作', |
193 | 196 | dataIndex: 'action', |
194 | - align: "center", | |
195 | - fixed: "right", | |
197 | + align: 'center', | |
198 | + fixed: 'right', | |
196 | 199 | width: 147, |
197 | - scopedSlots: {customRender: 'action'} | |
200 | + scopedSlots: { customRender: 'action' } | |
198 | 201 | } |
199 | 202 | ], |
200 | 203 | url: { |
201 | - list: "/config/materialMultiple/list", | |
202 | - delete: "/config/materialMultiple/delete", | |
203 | - deleteBatch: "/config/materialMultiple/deleteBatch", | |
204 | - exportXlsUrl: "/config/materialMultiple/exportXls", | |
205 | - importExcelUrl: "config/materialMultiple/importExcel", | |
206 | - | |
204 | + list: '/config/materialMultiple/list', | |
205 | + delete: '/config/materialMultiple/delete', | |
206 | + deleteBatch: '/config/materialMultiple/deleteBatch', | |
207 | + exportXlsUrl: '/config/materialMultiple/exportXls', | |
208 | + importExcelUrl: 'config/materialMultiple/importExcel' | |
207 | 209 | }, |
208 | 210 | dictOptions: {}, |
209 | - superFieldList: [], | |
211 | + superFieldList: [] | |
210 | 212 | } |
211 | 213 | }, |
212 | 214 | created() { |
213 | - this.getSuperFieldList(); | |
215 | + this.getSuperFieldList() | |
214 | 216 | }, |
215 | 217 | computed: { |
216 | - importExcelUrl: function () { | |
217 | - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
218 | - }, | |
218 | + importExcelUrl: function() { | |
219 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` | |
220 | + } | |
219 | 221 | }, |
220 | 222 | methods: { |
221 | - initDictConfig() { | |
222 | - }, | |
223 | + initDictConfig() {}, | |
223 | 224 | getSuperFieldList() { |
224 | - let fieldList = []; | |
225 | - fieldList.push({type: 'string', value: 'materialCode', text: '物料编码', dictCode: ''}) | |
226 | - fieldList.push({type: 'string', value: 'materialName', text: '物料名称', dictCode: ''}) | |
227 | - fieldList.push({type: 'string', value: 'materialSpec', text: '物料规格', dictCode: ''}) | |
228 | - fieldList.push({type: 'string', value: 'companyCode', text: '货主编码', dictCode: ''}) | |
229 | - fieldList.push({type: 'string', value: 'unit1', text: '单位1', dictCode: ''}) | |
230 | - fieldList.push({type: 'string', value: 'unit2', text: '单位2', dictCode: ''}) | |
231 | - fieldList.push({type: 'double', value: 'multiple', text: '单位1转单位2换算倍数', dictCode: ''}) | |
225 | + let fieldList = [] | |
226 | + fieldList.push({ type: 'string', value: 'materialCode', text: '物料编码', dictCode: '' }) | |
227 | + fieldList.push({ type: 'string', value: 'materialName', text: '物料名称', dictCode: '' }) | |
228 | + fieldList.push({ type: 'string', value: 'materialSpec', text: '物料规格', dictCode: '' }) | |
229 | + fieldList.push({ type: 'string', value: 'companyCode', text: '货主编码', dictCode: '' }) | |
230 | + fieldList.push({ type: 'string', value: 'unit1', text: '基准单位', dictCode: '' }) | |
231 | + fieldList.push({ type: 'string', value: 'unit2', text: '转换单位', dictCode: '' }) | |
232 | + fieldList.push({ type: 'double', value: 'multiple', text: '转换比率', dictCode: '' }) | |
232 | 233 | this.superFieldList = fieldList |
233 | 234 | } |
234 | 235 | } |
... | ... |
ant-design-vue-jeecg/src/views/system/config/modules/MaterialMultipleForm.vue
... | ... | @@ -24,17 +24,17 @@ |
24 | 24 | </a-form-model-item> |
25 | 25 | </a-col> |
26 | 26 | <a-col :span="24"> |
27 | - <a-form-model-item label="单位1" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit1"> | |
27 | + <a-form-model-item label="基准单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit1"> | |
28 | 28 | <a-input v-model="model.unit1" placeholder="请输入单位1"></a-input> |
29 | 29 | </a-form-model-item> |
30 | 30 | </a-col> |
31 | 31 | <a-col :span="24"> |
32 | - <a-form-model-item label="单位2" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit2"> | |
32 | + <a-form-model-item label="转换单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit2"> | |
33 | 33 | <a-input v-model="model.unit2" placeholder="请输入单位2"></a-input> |
34 | 34 | </a-form-model-item> |
35 | 35 | </a-col> |
36 | 36 | <a-col :span="24"> |
37 | - <a-form-model-item label="单位1转单位2换算倍数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="multiple"> | |
37 | + <a-form-model-item label="转换比率" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="multiple"> | |
38 | 38 | <a-input-number v-model="model.multiple" placeholder="请输入单位1转单位2换算倍数" style="width: 100%"/> |
39 | 39 | </a-form-model-item> |
40 | 40 | </a-col> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/materialMultiple/entity/MaterialMultiple.java
... | ... | @@ -55,17 +55,17 @@ public class MaterialMultiple implements Serializable { |
55 | 55 | @Excel(name = "货主编码", width = 15) |
56 | 56 | @ApiModelProperty(value = "货主编码") |
57 | 57 | private String companyCode; |
58 | - /** 单位1 */ | |
59 | - @Excel(name = "单位1", width = 15) | |
60 | - @ApiModelProperty(value = "单位1") | |
58 | + /** 基准单位 */ | |
59 | + @Excel(name = "基准单位", width = 15) | |
60 | + @ApiModelProperty(value = "基准单位") | |
61 | 61 | private String unit1; |
62 | - /** 单位2 */ | |
63 | - @Excel(name = "单位2", width = 15) | |
64 | - @ApiModelProperty(value = "单位2") | |
62 | + /** 转换单位 */ | |
63 | + @Excel(name = "转换单位", width = 15) | |
64 | + @ApiModelProperty(value = "转换单位") | |
65 | 65 | private String unit2; |
66 | - /** 单位1转单位2换算倍数 */ | |
67 | - @Excel(name = "单位1转单位2换算倍数", width = 15) | |
68 | - @ApiModelProperty(value = "单位1转单位2换算倍数") | |
66 | + /** 转换比率 */ | |
67 | + @Excel(name = "转换比率", width = 15) | |
68 | + @ApiModelProperty(value = "转换比率") | |
69 | 69 | private Double multiple; |
70 | 70 | /** 备用字段1 */ |
71 | 71 | @Excel(name = "备用字段1", width = 15) |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/HuahengBaseController.java
... | ... | @@ -5,8 +5,6 @@ import java.util.concurrent.TimeUnit; |
5 | 5 | import javax.annotation.Nonnull; |
6 | 6 | |
7 | 7 | import org.jeecg.common.api.vo.Result; |
8 | -import org.jeecg.common.exception.JeecgBootException; | |
9 | -import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | |
10 | 8 | import org.jeecg.utils.support.RedissonDistributedLocker; |
11 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 10 | |
... | ... | @@ -88,9 +86,12 @@ public class HuahengBaseController { |
88 | 86 | try { |
89 | 87 | log.info("[{}] 开始分布式事务 lockKey = {},获取锁耗时: {}ms", taskName, fullLockKey, endTime - startTime); |
90 | 88 | result = multiProcessListener.doProcess(); |
91 | - } catch (Throwable e) { | |
92 | - log.error("[{}] 执行分布式事务失败 lockKey = {},errorMessage = {}", taskName, fullLockKey, ExceptionUtil.getMessage(e), e); | |
89 | + } catch (Exception e) { | |
90 | + log.error("[{}] 执行分布式事务异常 lockKey = {},errorMessage = {}", taskName, fullLockKey, ExceptionUtil.getMessage(e), e); | |
93 | 91 | return Result.error(ExceptionUtil.getSimpleMessage(e)); |
92 | + } catch (Throwable e) { | |
93 | + log.error("[{}] 执行分布式事务异常 lockKey = {},errorMessage = {}", taskName, fullLockKey, ExceptionUtil.getMessage(e), e); | |
94 | + throw e; | |
94 | 95 | } finally { |
95 | 96 | redissonDistributedLocker.unlock(fullLockKey); |
96 | 97 | final long finishTime = SystemClock.now(); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/OkHttpUtils.java
... | ... | @@ -183,7 +183,7 @@ public class OkHttpUtils { |
183 | 183 | private static void sendAnnouncement(ApiLog apiLog, String title, String errorString) { |
184 | 184 | String userOrRoleString = SpringUtil.getBean(IParameterConfigurationService.class).getValueByCode(QuantityConstant.RULE_API_EXCEPTION_NOTICE_ROLE_OR_NAME); |
185 | 185 | List<String> userOrRoleList = StrSpliter.split(userOrRoleString, ",", true, true); |
186 | - SpringUtil.getBean(SystemSync.class).sumCountAnnouncementToUserOrRole(userOrRoleList, title, errorString, DateUtil.offsetDay(new Date(), 1), "H", 5); | |
186 | + SpringUtil.getBean(SystemSync.class).sumCountAnnouncementToUserOrRole(userOrRoleList, title, errorString, DateUtil.offsetDay(new Date(), 1), "H", 2); | |
187 | 187 | } |
188 | 188 | |
189 | 189 | public static String sendPostByJsonStr(String url, String jsonString) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiAuthenticationAspect.java
... | ... | @@ -62,7 +62,7 @@ public class ApiAuthenticationAspect { |
62 | 62 | * @throws Throwable |
63 | 63 | */ |
64 | 64 | @Before("executeController()") |
65 | - public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException, Throwable { | |
65 | + public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException { | |
66 | 66 | Method method = this.getTargetMethod(joinPoint); |
67 | 67 | // 检查是否有passtoken注释,有则跳过认证 |
68 | 68 | if (method.isAnnotationPresent(PassApiAuthentication.class)) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiLoggerAspect.java
... | ... | @@ -61,16 +61,22 @@ public class ApiLoggerAspect { |
61 | 61 | return aroundXXX2Wms(point, apiLogger); |
62 | 62 | } |
63 | 63 | |
64 | - /** 记录第三方系统调用WMS接口的日志 **/ | |
65 | - private Object aroundXXX2Wms(ProceedingJoinPoint point, ApiLogger apiLogger) { | |
64 | + /** | |
65 | + * 记录第三方系统调用WMS接口的日志 | |
66 | + * @throws Throwable | |
67 | + **/ | |
68 | + private Object aroundXXX2Wms(ProceedingJoinPoint point, ApiLogger apiLogger) throws Throwable { | |
66 | 69 | Object ret = null; |
67 | 70 | ApiLog apiLog = initApiLog(apiLogger, point); |
68 | 71 | try { |
69 | 72 | ret = point.proceed(); |
70 | - } catch (Throwable e) { | |
71 | - setApiLogThrowable(apiLog, e); | |
73 | + } catch (Exception e) { | |
74 | + setApiLogException(apiLog, e); | |
72 | 75 | ret = Result.error(e.getMessage()); |
73 | 76 | return ret; |
77 | + } catch (Throwable e) { | |
78 | + setApiLogThrowable(apiLog, e); | |
79 | + throw e; | |
74 | 80 | } finally { |
75 | 81 | if (ret != null) { |
76 | 82 | finishApiLog(apiLog, ret); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/LogRecordAspect.java
... | ... | @@ -35,9 +35,16 @@ public class LogRecordAspect { |
35 | 35 | String methodName = point.getSignature().getName(); |
36 | 36 | log.info(">>>[{}] {} [{}.{}][{}]>>>", request.getMethod(), url, className, methodName, ApiLoggerAspect.getIpAddr(request)); |
37 | 37 | // result的值就是被拦截方法的返回值 |
38 | - Object result = point.proceed(); | |
39 | - long callTime = System.currentTimeMillis() - startTime; | |
40 | - log.info("<<<[{}] {} [cost:{}ms]<<<", request.getMethod(), url, callTime); | |
41 | - return result; | |
38 | + try { | |
39 | + Object result = point.proceed(); | |
40 | + long callTime = System.currentTimeMillis() - startTime; | |
41 | + log.info("<<<[{}] {} [cost:{}ms]<<<", request.getMethod(), url, callTime); | |
42 | + return result; | |
43 | + } catch (Throwable e) { | |
44 | + long callTime = System.currentTimeMillis() - startTime; | |
45 | + log.info("<<<[{}] {} 执行异常 [cost:{}ms]<<<", request.getMethod(), url, callTime); | |
46 | + throw e; | |
47 | + } | |
48 | + | |
42 | 49 | } |
43 | 50 | } |
44 | 51 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/TaskBuildAudienceAspect.java
... | ... | @@ -48,7 +48,7 @@ public class TaskBuildAudienceAspect { |
48 | 48 | |
49 | 49 | @Resource |
50 | 50 | ISysAnnouncementService sysAnnouncementService; |
51 | - | |
51 | + | |
52 | 52 | @Resource |
53 | 53 | SystemSync systemSync; |
54 | 54 | |
... | ... | @@ -56,12 +56,12 @@ public class TaskBuildAudienceAspect { |
56 | 56 | public void executeTask() {} |
57 | 57 | |
58 | 58 | @Before("executeTask()") |
59 | - public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException, Throwable { | |
59 | + public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException { | |
60 | 60 | new ApiAuthentication.ApiAuthenticationBuild().audience(HuahengJwtUtil.TASK_AUDIENCE_NAME).bulid(); |
61 | 61 | } |
62 | 62 | |
63 | 63 | @Around("executeTask()") |
64 | - public Object doAround(ProceedingJoinPoint joinPoint) throws NoSuchMethodException { | |
64 | + public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable { | |
65 | 65 | String className = getClassAndMethodName(joinPoint); |
66 | 66 | long t1 = System.currentTimeMillis(); |
67 | 67 | try { |
... | ... | @@ -85,14 +85,23 @@ public class TaskBuildAudienceAspect { |
85 | 85 | } |
86 | 86 | log.info(noticeName + " " + costTimeString); |
87 | 87 | return object; |
88 | + } catch (Exception e) { | |
89 | + long t2 = System.currentTimeMillis(); | |
90 | + String userOrRoleString = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_JOB_EXCEPTION_NOTICE_ROLE_OR_NAME); | |
91 | + List<String> userOrRoleList = StrSpliter.split(userOrRoleString, ",", true, true); | |
92 | + String noticeName = className + " 定时任务执行异常"; | |
93 | + String errorString = "异常信息:" + ExceptionUtil.getMessage(e) + " 耗时:" + (t2 - t1) + "ms"; | |
94 | + systemSync.sumCountAnnouncementToUserOrRole(userOrRoleList, noticeName, errorString, DateUtil.offsetDay(new Date(), 1), "H", 2); | |
95 | + log.error(noticeName, e); | |
88 | 96 | } catch (Throwable e) { |
89 | 97 | long t2 = System.currentTimeMillis(); |
90 | 98 | String userOrRoleString = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_JOB_EXCEPTION_NOTICE_ROLE_OR_NAME); |
91 | 99 | List<String> userOrRoleList = StrSpliter.split(userOrRoleString, ",", true, true); |
92 | 100 | String noticeName = className + " 定时任务执行异常"; |
93 | 101 | String errorString = "异常信息:" + ExceptionUtil.getMessage(e) + " 耗时:" + (t2 - t1) + "ms"; |
94 | - systemSync.sumCountAnnouncementToUserOrRole(userOrRoleList, noticeName, errorString, DateUtil.offsetDay(new Date(), 1), "H", 10); | |
102 | + systemSync.sumCountAnnouncementToUserOrRole(userOrRoleList, noticeName, errorString, DateUtil.offsetDay(new Date(), 1), "H", 2); | |
95 | 103 | log.error(noticeName, e); |
104 | + throw e; | |
96 | 105 | } |
97 | 106 | return null; |
98 | 107 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/interceptor/HuahengBatisInterceptor.java
1 | 1 | package org.jeecg.utils.interceptor; |
2 | 2 | |
3 | 3 | import java.lang.reflect.Field; |
4 | +import java.lang.reflect.InvocationTargetException; | |
4 | 5 | import java.util.Date; |
5 | 6 | import java.util.Properties; |
6 | 7 | |
... | ... | @@ -8,7 +9,11 @@ import org.apache.ibatis.binding.MapperMethod; |
8 | 9 | import org.apache.ibatis.executor.Executor; |
9 | 10 | import org.apache.ibatis.mapping.MappedStatement; |
10 | 11 | import org.apache.ibatis.mapping.SqlCommandType; |
11 | -import org.apache.ibatis.plugin.*; | |
12 | +import org.apache.ibatis.plugin.Interceptor; | |
13 | +import org.apache.ibatis.plugin.Intercepts; | |
14 | +import org.apache.ibatis.plugin.Invocation; | |
15 | +import org.apache.ibatis.plugin.Plugin; | |
16 | +import org.apache.ibatis.plugin.Signature; | |
12 | 17 | import org.apache.shiro.SecurityUtils; |
13 | 18 | import org.jeecg.common.system.vo.LoginUser; |
14 | 19 | import org.jeecg.common.util.oConvertUtils; |
... | ... | @@ -23,7 +28,7 @@ import lombok.extern.slf4j.Slf4j; |
23 | 28 | public class HuahengBatisInterceptor implements Interceptor { |
24 | 29 | |
25 | 30 | @Override |
26 | - public Object intercept(Invocation invocation) throws Throwable { | |
31 | + public Object intercept(Invocation invocation) throws InvocationTargetException, IllegalAccessException { | |
27 | 32 | MappedStatement mappedStatement = (MappedStatement)invocation.getArgs()[0]; |
28 | 33 | // String sqlId = mappedStatement.getId(); |
29 | 34 | // log.debug("------sqlId------" + sqlId); |
... | ... | @@ -81,7 +86,7 @@ public class HuahengBatisInterceptor implements Interceptor { |
81 | 86 | } |
82 | 87 | } |
83 | 88 | if (SqlCommandType.UPDATE == sqlCommandType) { |
84 | - LoginUser sysUser = this.getLoginUser(); | |
89 | +// LoginUser sysUser = this.getLoginUser(); | |
85 | 90 | Field[] fields = null; |
86 | 91 | if (parameter instanceof MapperMethod.ParamMap) { |
87 | 92 | MapperMethod.ParamMap<?> p = (MapperMethod.ParamMap<?>)parameter; |
... | ... | @@ -122,7 +127,6 @@ public class HuahengBatisInterceptor implements Interceptor { |
122 | 127 | field.setAccessible(false); |
123 | 128 | } |
124 | 129 | } catch (Exception e) { |
125 | - e.printStackTrace(); | |
126 | 130 | } |
127 | 131 | } |
128 | 132 | } |
... | ... |