Commit bfe834b85aa02e1341c9142c6342b9d61b5fd3f4

Authored by xumiao
2 parents 932b2b74 4138aa95

Merge remote-tracking branch 'origin/develop4' into develop4

Showing 63 changed files with 2083 additions and 1336 deletions
ant-design-vue-jeecg/src/assets/css/huahengUI.css
... ... @@ -1019,6 +1019,255 @@ label {
1019 1019 font-size: 13px;
1020 1020 max-width: unset;
1021 1021 }
  1022 +.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
  1023 + position: relative;
  1024 + min-height: 1px;
  1025 + padding-right: 15px;
  1026 + padding-left: 15px
  1027 +}
  1028 +@media (min-width: 768px) {
  1029 + .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9 {
  1030 + float: left
  1031 + }
  1032 +
  1033 + .col-sm-12 {
  1034 + width: 100%
  1035 + }
  1036 +
  1037 + .col-sm-11 {
  1038 + width: 91.66666667%
  1039 + }
  1040 +
  1041 + .col-sm-10 {
  1042 + width: 83.33333333%
  1043 + }
  1044 +
  1045 + .col-sm-9 {
  1046 + width: 75%
  1047 + }
  1048 +
  1049 + .col-sm-8 {
  1050 + width: 66.66666667%
  1051 + }
  1052 +
  1053 + .col-sm-7 {
  1054 + width: 58.33333333%
  1055 + }
  1056 +
  1057 + .col-sm-6 {
  1058 + width: 50%
  1059 + }
  1060 +
  1061 + .col-sm-5 {
  1062 + width: 41.66666667%
  1063 + }
  1064 +
  1065 + .col-sm-4 {
  1066 + width: 33.33333333%
  1067 + }
  1068 +
  1069 + .col-sm-3 {
  1070 + width: 25%
  1071 + }
  1072 +
  1073 + .col-sm-2 {
  1074 + width: 16.66666667%
  1075 + }
  1076 +
  1077 + .col-sm-1 {
  1078 + width: 8.33333333%
  1079 + }
  1080 +
  1081 + .col-sm-pull-12 {
  1082 + right: 100%
  1083 + }
  1084 +
  1085 + .col-sm-pull-11 {
  1086 + right: 91.66666667%
  1087 + }
  1088 +
  1089 + .col-sm-pull-10 {
  1090 + right: 83.33333333%
  1091 + }
  1092 +
  1093 + .col-sm-pull-9 {
  1094 + right: 75%
  1095 + }
  1096 +
  1097 + .col-sm-pull-8 {
  1098 + right: 66.66666667%
  1099 + }
  1100 +
  1101 + .col-sm-pull-7 {
  1102 + right: 58.33333333%
  1103 + }
  1104 +
  1105 + .col-sm-pull-6 {
  1106 + right: 50%
  1107 + }
  1108 +
  1109 + .col-sm-pull-5 {
  1110 + right: 41.66666667%
  1111 + }
  1112 +
  1113 + .col-sm-pull-4 {
  1114 + right: 33.33333333%
  1115 + }
  1116 +
  1117 + .col-sm-pull-3 {
  1118 + right: 25%
  1119 + }
  1120 +
  1121 + .col-sm-pull-2 {
  1122 + right: 16.66666667%
  1123 + }
  1124 +
  1125 + .col-sm-pull-1 {
  1126 + right: 8.33333333%
  1127 + }
  1128 +
  1129 + .col-sm-pull-0 {
  1130 + right: auto
  1131 + }
  1132 +
  1133 + .col-sm-push-12 {
  1134 + left: 100%
  1135 + }
  1136 +
  1137 + .col-sm-push-11 {
  1138 + left: 91.66666667%
  1139 + }
  1140 +
  1141 + .col-sm-push-10 {
  1142 + left: 83.33333333%
  1143 + }
  1144 +
  1145 + .col-sm-push-9 {
  1146 + left: 75%
  1147 + }
  1148 +
  1149 + .col-sm-push-8 {
  1150 + left: 66.66666667%
  1151 + }
  1152 +
  1153 + .col-sm-push-7 {
  1154 + left: 58.33333333%
  1155 + }
  1156 +
  1157 + .col-sm-push-6 {
  1158 + left: 50%
  1159 + }
  1160 +
  1161 + .col-sm-push-5 {
  1162 + left: 41.66666667%
  1163 + }
  1164 +
  1165 + .col-sm-push-4 {
  1166 + left: 33.33333333%
  1167 + }
  1168 +
  1169 + .col-sm-push-3 {
  1170 + left: 25%
  1171 + }
  1172 +
  1173 + .col-sm-push-2 {
  1174 + left: 16.66666667%
  1175 + }
  1176 +
  1177 + .col-sm-push-1 {
  1178 + left: 8.33333333%
  1179 + }
  1180 +
  1181 + .col-sm-push-0 {
  1182 + left: auto
  1183 + }
  1184 +
  1185 + .col-sm-offset-12 {
  1186 + margin-left: 100%
  1187 + }
  1188 +
  1189 + .col-sm-offset-11 {
  1190 + margin-left: 91.66666667%
  1191 + }
  1192 +
  1193 + .col-sm-offset-10 {
  1194 + margin-left: 83.33333333%
  1195 + }
  1196 +
  1197 + .col-sm-offset-9 {
  1198 + margin-left: 75%
  1199 + }
  1200 +
  1201 + .col-sm-offset-8 {
  1202 + margin-left: 66.66666667%
  1203 + }
  1204 +
  1205 + .col-sm-offset-7 {
  1206 + margin-left: 58.33333333%
  1207 + }
  1208 +
  1209 + .col-sm-offset-6 {
  1210 + margin-left: 50%
  1211 + }
  1212 +
  1213 + .col-sm-offset-5 {
  1214 + margin-left: 41.66666667%
  1215 + }
  1216 +
  1217 + .col-sm-offset-4 {
  1218 + margin-left: 33.33333333%
  1219 + }
  1220 +
  1221 + .col-sm-offset-3 {
  1222 + margin-left: 25%
  1223 + }
  1224 +
  1225 + .col-sm-offset-2 {
  1226 + margin-left: 16.66666667%
  1227 + }
  1228 +
  1229 + .col-sm-offset-1 {
  1230 + margin-left: 8.33333333%
  1231 + }
  1232 +
  1233 + .col-sm-offset-0 {
  1234 + margin-left: 0
  1235 + }
  1236 +}
  1237 +#img_list li{
  1238 + font-size: 10px;
  1239 + /*width: 50px;*/
  1240 + text-align: left;
  1241 + margin: 5px 20px 5px 5px;
  1242 +}
  1243 +#img_list li img{
  1244 + height: 35px;
  1245 + width: 35px;
  1246 +}
  1247 +#info_list{
  1248 + width: 100%;
  1249 + display:inline-block;
  1250 +}
  1251 +#info_list li{
  1252 + margin:8px 3px 0 5px;
  1253 +}
  1254 +#info_list li span{
  1255 + font-size: 12px;
  1256 + display: inline-block;
  1257 + /*width: 65px;*/
  1258 + text-align: center;
  1259 +}
  1260 +.grid{
  1261 + display: inline-block;
  1262 + width: 50px;
  1263 + height: 50px;
  1264 + /*margin: 12px 6px;*/
  1265 + margin-bottom: 6px;
  1266 + background-size:cover;
  1267 + background-image: url("~@/assets/icon/空盘空闲.png");
  1268 +}
  1269 +
  1270 +
1022 1271  
1023 1272 .popover-title {
1024 1273 padding: 8px 14px;
... ...
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue
... ... @@ -49,6 +49,8 @@
49 49 <a-card :title="'已选' + name" :bordered="false" :head-style="{padding:0}" :body-style="{padding:0}">
50 50  
51 51 <a-table size="middle" :rowKey="rowKey" bordered v-bind="selectedTable">
  52 +
  53 +
52 54 <span slot="action" slot-scope="text, record, index">
53 55 <a @click="handleDeleteSelected(record, index)">删除</a>
54 56 </span>
... ... @@ -57,6 +59,7 @@
57 59 </a-card>
58 60 </a-col>
59 61 </a-row>
  62 + <InventoryDetailList></InventoryDetailList>
60 63 </j-modal>
61 64 </template>
62 65  
... ... @@ -69,11 +72,12 @@ import JSelectBizQueryItem from &#39;./JSelectBizQueryItem&#39;
69 72 import {cloneDeep} from 'lodash'
70 73 import {stockTakeTask} from "../../../api/api";
71 74 import Utils from './util.js';
  75 +import InventoryDetailList from "../../../views/system/inventory/InventoryDetailList";
72 76  
73 77 export default {
74 78 name: 'JSelectBizComponentModal',
75 79 mixins: [JeecgListMixin],
76   - components: {Ellipsis, JSelectBizQueryItem},
  80 + components: {Ellipsis, JSelectBizQueryItem,InventoryDetailList},
77 81 props: {
78 82 value: {
79 83 type: Array,
... ... @@ -155,7 +159,7 @@ export default {
155 159 scroll: {y: 240},
156 160 columns: [
157 161 {
158   - ...this.columns[0],
  162 + ...this.columns[3],
159 163 width: this.columns[0].widthRight || this.columns[0].width,
160 164 },
161 165 {title: '操作', dataIndex: 'action', align: 'center', width: 60, scopedSlots: {customRender: 'action'},}
... ... @@ -185,6 +189,7 @@ export default {
185 189 // 表头
186 190 innerColumns() {
187 191 let columns = cloneDeep(this.columns)
  192 + debugger
188 193 columns.forEach(column => {
189 194 // 给所有的列加上过长裁剪
190 195 if (this.ellipsisLength !== -1) {
... ... @@ -331,7 +336,7 @@ export default {
331 336 this.$message.success(res.message)
332 337 this.$emit('ok')
333 338 this.close()
334   - Utils.$emit('methodB',"123");
  339 + Utils.$emit('methodB',res.result);
335 340 } else {
336 341 this.$message.warning(res.message);
337 342 }
... ... @@ -343,7 +348,6 @@ export default {
343 348 {
344 349 alert("至少选择一项")
345 350 }
346   - Utils.$emit('methodB',"123");
347 351 },
348 352 /** 删除已选择的 */
349 353 handleDeleteSelected(record, index) {
... ...
ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue
... ... @@ -31,13 +31,13 @@ export default {
31 31 return {
32 32 url: {list: '/inventory/inventoryHeader/list'},
33 33 columns: [
34   - {title: '容器号', align: 'center', width: '25%',widthRight: '70%', dataIndex: 'containerCode'},
  34 + {title: 'ID', align: 'center', width: '20%',widthRight: '70%', dataIndex: 'id'},
  35 + {title: '容器号', align: 'center', width: '25%', dataIndex: 'containerCode'},
35 36 {title: '容器状态', align: 'center', width: '20%', dataIndex: 'containerStatus'},
36 37 {title: '库位号', align: 'center', width: '20%', dataIndex: 'locationCode'},
37 38 {title: '总数量', align: 'center', width: '20%', dataIndex: 'totalQty'},
38 39 {title: '库区', align: 'center', width: '20%', widthRight: '70%', dataIndex: 'zoneCode'},
39 40 {title: '状态', align: 'center', width: '20%', dataIndex: 'enable'},
40   - {title: 'ID', align: 'center', width: '20%', dataIndex: 'id'},
41 41 ],
42 42 // 定义在这里的参数都是可以在外部传递覆盖的,可以更灵活的定制化使用的组件
43 43 default: {
... ...
ant-design-vue-jeecg/src/components/layouts/UserLayout.vue
... ... @@ -16,7 +16,7 @@
16 16  
17 17 <div class="footer">
18 18 <div class="copyright">
19   - Copyright &copy; 2022 华恒焊接股份有限公司
  19 + Copyright &copy; 2023 华恒焊接股份有限公司
20 20 </div>
21 21 </div>
22 22 </div>
... ...
ant-design-vue-jeecg/src/views/dashboard/Analysis.vue
... ... @@ -57,7 +57,7 @@
57 57  
58 58 <a-row :gutter="24">
59 59 <a-col :span="12">
60   - <a-card :loading="loading" :bordered="false" title="历史每日收发货量" :style="{ marginTop: '24px' }">
  60 + <a-card :bordered="false" title="历史每日收发货量" :style="{ marginTop: '24px' }">
61 61 <a-row>
62 62 <a-col :span="19">
63 63 <div id="chart1" class="flot-chart1">
... ... @@ -65,11 +65,10 @@
65 65 </div>
66 66 </a-col>
67 67 </a-row>
68   - <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
69 68 </a-card>
70 69 </a-col>
71 70 <a-col :span="12">
72   - <a-card :loading="loading" :bordered="false" title="库位利用率" :style="{ marginTop: '24px' }">
  71 + <a-card :bordered="false" title="库位利用率" :style="{ marginTop: '24px' }">
73 72 <a-row>
74 73 <a-col :span="19">
75 74 <div id="chart2" class="flot-chart1">
... ... @@ -77,7 +76,6 @@
77 76 </div>
78 77 </a-col>
79 78 </a-row>
80   - <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
81 79 </a-card>
82 80 </a-col>
83 81 </a-row>
... ... @@ -85,7 +83,7 @@
85 83  
86 84 <a-row :gutter="24">
87 85 <a-col :span="12">
88   - <a-card :loading="loading" :bordered="false" title="在线库存状态" :style="{ marginTop: '24px' }">
  86 + <a-card :bordered="false" title="在线库存状态" :style="{ marginTop: '24px' }">
89 87 <a-row>
90 88 <a-col :span="19">
91 89 <div id="chart3" class="flot-chart1">
... ... @@ -93,11 +91,10 @@
93 91 </div>
94 92 </a-col>
95 93 </a-row>
96   - <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
97 94 </a-card>
98 95 </a-col>
99 96 <a-col :span="12">
100   - <a-card :loading="loading" :bordered="false" title="库存概况" :style="{ marginTop: '24px' }">
  97 + <a-card :bordered="false" title="库存概况" :style="{ marginTop: '24px' }">
101 98 <a-row>
102 99 <a-col :span="19">
103 100 <div id="chart4" class="flot-chart1">
... ... @@ -105,7 +102,6 @@
105 102 </div>
106 103 </a-col>
107 104 </a-row>
108   - <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
109 105 </a-card>
110 106 </a-col>
111 107 </a-row>
... ...
ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue
... ... @@ -5,10 +5,20 @@
5 5 <form id="container-form">
6 6 <div class="select-list">
7 7 <ul id="select_info">
  8 +
8 9 <li>
9   - <select id="zoneCode" name="zoneCode" style="width: 100px">
10   - <option selected>A</option>
11   - </select>
  10 + 货主
  11 + <a-select
  12 + show-search
  13 + placeholder="请选择库位类型"
  14 + option-filter-prop="children"
  15 + v-model="zoneCode"
  16 + style="width: 200px">
  17 + <a-select-option selected="0" id="zoneCode" v-for="item in locationTypeList" :key="item.name" :value="item.code">{{
  18 + item.name
  19 + }}
  20 + </a-select-option>
  21 + </a-select>
12 22 </li>
13 23 <li>
14 24
... ... @@ -23,7 +33,7 @@
23 33 </select>
24 34 </li>
25 35 <li>
26   - <a-button type="primary" @click="Search()" icon="search">查询</a-button>
  36 + <a-button type="primary" @click="Search()" icon="search">查询</a-button>
27 37 </li>
28 38 </ul>
29 39 </div>
... ... @@ -81,15 +91,22 @@
81 91 </div>
82 92 </form>
83 93 </div>
  94 +
84 95 <div class="col-sm-12 select-info">
85   - <div id="borderCol" style="overflow-y: scroll;white-space:nowrap">
  96 + <div id="borderCol" style="overflow-y: scroll;white-space:nowrap" v-show="showPrise">
86 97 <div class="location" id="location">
87 98 </div>
88 99 </div>
  100 + <a-spin tip="库位视图生成中..." :spinning="spinning">
  101 + <a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/>
  102 + </a-spin>
89 103 </div>
  104 +
  105 +
90 106 </div>
91 107 </div>
92 108 </template>
  109 +
93 110  <script>
94 111 var prefix = "/location/locationMonitor";
95 112 var grid_row;
... ... @@ -114,10 +131,7 @@
114 131 var currentMaterialCode=0;
115 132  
116 133 import huahengUI from '../../../assets/css/huahengUI.css'
117   -
118 134 import $ from '../../../assets/js/jquery-1.11.1.min'
119   -
120   -
121 135 import grid_rest from '@/assets/icon/空柜空闲.png'
122 136 import grid_empty from '@/assets/icon/空盘空闲.png'
123 137 import grid_half from '@/assets/icon/半盘空闲.png'
... ... @@ -131,23 +145,51 @@
131 145 import grid_half_lock from '@/assets/icon/半盘锁定.png'
132 146 import grid_all_lock from '@/assets/icon/整盘锁定.png'
133 147 import rel_empty from '@/assets/icon/空.png'
  148 + import Vue from 'vue'
  149 + import {ACCESS_TOKEN} from "@/store/mutation-types"
  150 + import {getLocationTypeList} from '@/api/api'
  151 +
  152 +
  153 +
134 154  
135 155  
136 156  
137 157 export default {
138 158 name: "locationStatus",
139   -
  159 + zoneCode:"",
140 160 data() {
141   - return {}
  161 + return {
  162 + spinning:true,
  163 + loading:true,
  164 + showPrise:false,
  165 + // loading:true,
  166 + zoneCode:'',
  167 + locationTypeList: [],
  168 + model:{},
  169 + locationContent:''
  170 + }
142 171 },
143   - mounted() {
144   - let _this=this;
145   - this.resetAjax("L");
146 172  
147   - //
148   - // this.initEvent();
149   - //
150   - // //监听浏览器宽度的改变
  173 + // setup() {
  174 + // const spinning = ref<boolean>(false);
  175 + //
  176 + // const changeSpinning = () => {
  177 + // spinning.value = !spinning.value;
  178 + // };
  179 +
  180 +
  181 + created() {
  182 + let _this=this
  183 + _this.loadFrom()
  184 + window.gridMsg=_this.gridMsg
  185 + window.Mclose=_this.Mclose
  186 + window.lays=_this.lays
  187 + },
  188 +
  189 +
  190 +
  191 + mounted() {
  192 + //监听浏览器宽度的改变
151 193 // window.onresize = function(){
152 194 // _this.changeMargin();
153 195 // _this.border()
... ... @@ -158,6 +200,17 @@
158 200 // this.border()
159 201 },
160 202 methods: {
  203 + loadFrom() {
  204 + getLocationTypeList().then((res) => {
  205 + if (res.success) {
  206 + this.locationTypeList = res.result
  207 + this.zoneCode = this.locationTypeList[0].code;
  208 + let _this=this;
  209 + this.resetAjax("L");
  210 + }
  211 + })
  212 + },
  213 +
161 214  
162 215  
163 216 initEvent(){
... ... @@ -218,11 +271,11 @@
218 271  
219 272 //tips信息
220 273 lays(x){
221   - alert(2)
222 274 let $j=$(x);
223 275 let row=$j.attr("data-i");
224 276 let line=$j.attr("data-j");
225 277 let layers=$j.attr("data-k");
  278 +
226 279 row=parseInt(row);
227 280 line=parseInt(line);
228 281 layers=parseInt(layers);
... ... @@ -233,13 +286,13 @@
233 286 let container_code='';
234 287 let list_qty=0;
235 288 if (list_info[i].containerCode) {
236   - container_code="<br>容器编码:"+ list_info[i].containerCode+"";
  289 + container_code="\n容器编码:"+ list_info[i].containerCode+"";
237 290 if (list_info[i].materialName) {
238 291 for (let j = 0; j < list_info[i].materialName.length; j++) {
239 292 let list_batch=list_info[i].batch[j]===null?"无":list_info[i].batch[j]===""?"无":list_info[i].batch[j];
240 293 list_qty +=list_info[i].qty[j];
241 294 if(j==list_info[i].materialName.length-1){
242   - str_info=str_info + "<br>批次:"+ list_batch +",物料名称:"+ list_info[i].materialName[j] +",物料编码:"+ list_info[i].materialCode[j] +
  295 + str_info=str_info + "\n批次:"+ list_batch +",物料名称:"+ list_info[i].materialName[j] +",物料编码:"+ list_info[i].materialCode[j] +
243 296 ",数量:"+ list_qty +""
244 297 }
245 298  
... ... @@ -248,8 +301,9 @@
248 301 }
249 302 }
250 303 let code=list_info[i].code===null?"无":list_info[i].code;
251   - layer.tips("第"+row+"行,第"+line+"列,第"+ layers +"层<br>库位:"+ code + container_code + str_info + ""
252   - ,$j,{tips:[1,"rgb(28,132,198)"],time:0,area:'auto',maxWidth: '1000'});
  304 + $("[data-i='"+row+"']"+"[data-j='"+line+"']"+"[data-k='"+layers+"']").attr({ "title":"第"+row+"行,第"+line+"列,第"+ layers +"层\n库位:"+ code + container_code + str_info});
  305 + // Vue.prototype.$Jnotification.success({message: '系统提示', description: "第"+row+"行,第"+line+"列,第"+ layers +"层<br>库位:"+ code + container_code + str_info, duration: 4})
  306 +
253 307 }
254 308 }
255 309 }else {return ""}
... ... @@ -258,8 +312,8 @@
258 312  
259 313 //关闭tips
260 314 Mclose(x){
261   - alert(1)
262 315 //关闭
  316 + // Vue.prototype.$Jnotification.error({message: '系统提示', description: "鼠标拿走了", duration: 4})
263 317 },
264 318  
265 319 //库位信息请求和状态显示
... ... @@ -267,10 +321,10 @@
267 321 let _this=this
268 322 // let load=layer.msg('加载中', {icon: 16,shade: 0.4,time: false});
269 323 $.ajax({
270   - url:"http://127.0.0.1:8080/wms"+prefix+"/getLocationInfo",
  324 + url:window._CONFIG['domianURL']+prefix+"/getLocationInfo",
271 325 type:"post",
272 326 headers:{
273   - "X-Access-Token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzU4MjQ4NDgsIndhcmVob3VzZUNvZGUiOiJDUzAwMDEiLCJ1c2VybmFtZSI6InlvdWppZSJ9.iiwKWoVA9AOA_fITphsG-rJibOlUD8EgtN-tthRt_Lg"
  327 + "X-Access-Token":Vue.ls.get(ACCESS_TOKEN)
274 328 },
275 329 data:info,
276 330 success:function (res) {
... ... @@ -388,15 +442,18 @@
388 442 $(".grid").eq(j).attr({"src": rel_empty,"onmouseover": "","onclick": ""});
389 443 }
390 444 }
  445 + this.spinning=false;
  446 + this.showPrise=true;
  447 + this.loading=false;
391 448 },
392 449  
393 450 //点击显示当前库位信息
394 451 gridMsg(msg) {
395   - debugger
396 452 let $j=$(msg);
397 453 let row=$j.attr("data-i");
398 454 let line=$j.attr("data-j");
399 455 let layers=$j.attr("data-k");
  456 +
400 457 row=parseInt(row);
401 458 line=parseInt(line);
402 459 layers=parseInt(layers);
... ... @@ -435,13 +492,13 @@
435 492 resetAjax(type){
436 493 var _this=this;
437 494 $.ajax({
438   - url:"http://127.0.0.1:8080/wms"+prefix+"/getAllLocation",
  495 + url:window._CONFIG['domianURL']+prefix+"/getAllLocation",
439 496 type:"post",
440 497 data:{
441 498 type:type
442 499 },
443 500 headers:{
444   - "X-Access-Token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzU4MjQ4NDgsIndhcmVob3VzZUNvZGUiOiJDUzAwMDEiLCJ1c2VybmFtZSI6InlvdWppZSJ9.iiwKWoVA9AOA_fITphsG-rJibOlUD8EgtN-tthRt_Lg"
  501 + "X-Access-Token":Vue.ls.get(ACCESS_TOKEN)
445 502 },
446 503 success:function (res) {
447 504 grid_row=res.result.maxRow;
... ... @@ -455,7 +512,7 @@
455 512 $(".location").append("<br>");
456 513 for (let j = 1; j <= grid_line; j++) {
457 514 // $(".location").append("<img data-i='1' data-j="+j+" data-k="+ i +" class='grid'>");
458   - $(".location").append("<img data-i='1' data-j="+j+" data-k="+ i +" class='grid' @mouseove='lays(this)' @mouseout='Mclose(this)' @click='gridMsg(this)'>");
  515 + $(".location").append("<img v-html data-i='1' data-j="+j+" data-k="+ i +" class='grid' onmouseove='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
459 516 }
460 517 }
461 518 let num=$("#editable-select").val();
... ... @@ -477,7 +534,7 @@
477 534 }
478 535  
479 536 _this.changeMargin();
480   - _this.Search();
  537 + _this.Search();
481 538 }
482 539 });
483 540 },
... ... @@ -485,9 +542,23 @@
485 542  
486 543 //搜索平面库位
487 544 Search(){
  545 + this.spinning=true;
  546 + this.showPrise=false;
  547 + this.loading=true;
488 548 let index=$("#editable-select").val();
489 549 let num=$("#editable-num").val();
490   - let zoneCode=$("#zoneCode").val();
  550 +
  551 + let zoneCode="";
  552 +
  553 + if ($("#zoneCode").val()==null)
  554 + {
  555 + zoneCode=this.locationTypeList[0].zoneCode;
  556 + }else
  557 + {
  558 + zoneCode=this.locationTypeList[$("#zoneCode").val()].zoneCode;
  559 + }
  560 +
  561 +
491 562 $("#code").val("");
492 563 $("#containerCode").val("");
493 564 $("#material").children().remove();
... ... @@ -498,20 +569,21 @@
498 569 data={type:zoneCode, row:num};
499 570 $("#location").children().remove();
500 571 for (let i = grid_layer; i > 0; i--) {
501   - $(".location").append("<br><span>第"+ i+"层</span>");
  572 + $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第"+ i+"层</span>");
502 573 for (let j = 1; j <= grid_line; j++) {
503   - $(".location").append("<img data-i="+num+" data-j="+j+" data-k="+i+" class='grid' @mouseover='lays(this)' @mouseout='Mclose(this)' @click='gridMsg(this)'>");
  574 + $(".location").append("<img data-i="+num+" data-j="+j+" data-k="+i+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
504 575 }
505 576 }
  577 +
  578 +
506 579 this.changeMargin();
507 580 this.ajaxGrid(index,data);
508 581 }
509 582 else if (index === "line") {
510   - debugger
511 583 data={type:zoneCode, line:num};
512 584 $("#location").children().remove();
513 585 for (let k = grid_layer; k > 0; k--) {
514   - $(".location").append("<br><span>第"+ k+"层</span>");
  586 + $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第"+ k+"层</span>");
515 587 for (let l = 1; l <= grid_row; l++) {
516 588 $(".location").append("<img data-i="+l+" data-j="+num+" data-k="+k+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
517 589 }
... ... @@ -523,7 +595,7 @@
523 595 data={type:zoneCode, layer:num};
524 596 $("#location").children().remove();
525 597 for (let m = 1; m <= grid_row; m++) {
526   - $(".location").append("<br><span>第"+ m+"行</span>");
  598 + $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第"+ m+"行</span>");
527 599 for (let n = 1; n <= grid_line; n++) {
528 600 $(".location").append("<img data-i="+m+" data-j="+n+" data-k="+num+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
529 601 }
... ... @@ -531,38 +603,28 @@
531 603 this.changeMargin();
532 604 this.ajaxGrid(index,data);
533 605 }
  606 + },
534 607  
535 608  
536   - },
537   -
538   -
539   - searchLocation(){
540   - if(!currentLocationCode){
541   - $.modal.alertError("请选择库位")
542   - }else {
543   - localStorage.setItem("locationCode",currentLocationCode)
544   - createMenuItem("路径" +"config/location","库位管理")
545   - }
546   - },
547   -
548 609  
549   - searchInventory() {
550   - if(!currentLocationCode){
551   - $.modal.alertError("请选择库位")
552   - return
553   - }
554   - localStorage.setItem("locationCode",currentLocationCode)
555   - createMenuItem("路径" +"inventory/inventoryHeader","库存查看")
556   - },
557 610  
558 611 seachZone(){
  612 + let _this=this
  613 + let zoneCode="";
  614 + if ($("#zoneCode").val()==null)
  615 + {
  616 + zoneCode=this.locationTypeList[0].zoneCode;
  617 + }else
  618 + {
  619 + zoneCode=this.locationTypeList[$("#zoneCode").val()].zoneCode;
  620 + }
559 621 $.ajax({
560   - url:"http://127.0.0.1:8080/wms"+prefix+"/getStatus",
  622 + url:window._CONFIG['domianURL']+prefix+"/getStatus",
561 623 data:{
562   - zoneCode:$("#zoneCode").val()
  624 + zoneCode:zoneCode
563 625 },
564 626 headers:{
565   - "X-Access-Token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzU4MjQ4NDgsIndhcmVob3VzZUNvZGUiOiJDUzAwMDEiLCJ1c2VybmFtZSI6InlvdWppZSJ9.iiwKWoVA9AOA_fITphsG-rJibOlUD8EgtN-tthRt_Lg"
  627 + "X-Access-Token":Vue.ls.get(ACCESS_TOKEN)
566 628 },
567 629 success:function (response) {
568 630 if (response.code==200){
... ... @@ -582,257 +644,4 @@
582 644 </script>
583 645  
584 646 <style scoped>
585   - .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
586   - position: relative;
587   - min-height: 1px;
588   - padding-right: 15px;
589   - padding-left: 15px
590   - }
591   - @media (min-width: 768px) {
592   - .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9 {
593   - float: left
594   - }
595   -
596   - .col-sm-12 {
597   - width: 100%
598   - }
599   -
600   - .col-sm-11 {
601   - width: 91.66666667%
602   - }
603   -
604   - .col-sm-10 {
605   - width: 83.33333333%
606   - }
607   -
608   - .col-sm-9 {
609   - width: 75%
610   - }
611   -
612   - .col-sm-8 {
613   - width: 66.66666667%
614   - }
615   -
616   - .col-sm-7 {
617   - width: 58.33333333%
618   - }
619   -
620   - .col-sm-6 {
621   - width: 50%
622   - }
623   -
624   - .col-sm-5 {
625   - width: 41.66666667%
626   - }
627   -
628   - .col-sm-4 {
629   - width: 33.33333333%
630   - }
631   -
632   - .col-sm-3 {
633   - width: 25%
634   - }
635   -
636   - .col-sm-2 {
637   - width: 16.66666667%
638   - }
639   -
640   - .col-sm-1 {
641   - width: 8.33333333%
642   - }
643   -
644   - .col-sm-pull-12 {
645   - right: 100%
646   - }
647   -
648   - .col-sm-pull-11 {
649   - right: 91.66666667%
650   - }
651   -
652   - .col-sm-pull-10 {
653   - right: 83.33333333%
654   - }
655   -
656   - .col-sm-pull-9 {
657   - right: 75%
658   - }
659   -
660   - .col-sm-pull-8 {
661   - right: 66.66666667%
662   - }
663   -
664   - .col-sm-pull-7 {
665   - right: 58.33333333%
666   - }
667   -
668   - .col-sm-pull-6 {
669   - right: 50%
670   - }
671   -
672   - .col-sm-pull-5 {
673   - right: 41.66666667%
674   - }
675   -
676   - .col-sm-pull-4 {
677   - right: 33.33333333%
678   - }
679   -
680   - .col-sm-pull-3 {
681   - right: 25%
682   - }
683   -
684   - .col-sm-pull-2 {
685   - right: 16.66666667%
686   - }
687   -
688   - .col-sm-pull-1 {
689   - right: 8.33333333%
690   - }
691   -
692   - .col-sm-pull-0 {
693   - right: auto
694   - }
695   -
696   - .col-sm-push-12 {
697   - left: 100%
698   - }
699   -
700   - .col-sm-push-11 {
701   - left: 91.66666667%
702   - }
703   -
704   - .col-sm-push-10 {
705   - left: 83.33333333%
706   - }
707   -
708   - .col-sm-push-9 {
709   - left: 75%
710   - }
711   -
712   - .col-sm-push-8 {
713   - left: 66.66666667%
714   - }
715   -
716   - .col-sm-push-7 {
717   - left: 58.33333333%
718   - }
719   -
720   - .col-sm-push-6 {
721   - left: 50%
722   - }
723   -
724   - .col-sm-push-5 {
725   - left: 41.66666667%
726   - }
727   -
728   - .col-sm-push-4 {
729   - left: 33.33333333%
730   - }
731   -
732   - .col-sm-push-3 {
733   - left: 25%
734   - }
735   -
736   - .col-sm-push-2 {
737   - left: 16.66666667%
738   - }
739   -
740   - .col-sm-push-1 {
741   - left: 8.33333333%
742   - }
743   -
744   - .col-sm-push-0 {
745   - left: auto
746   - }
747   -
748   - .col-sm-offset-12 {
749   - margin-left: 100%
750   - }
751   -
752   - .col-sm-offset-11 {
753   - margin-left: 91.66666667%
754   - }
755   -
756   - .col-sm-offset-10 {
757   - margin-left: 83.33333333%
758   - }
759   -
760   - .col-sm-offset-9 {
761   - margin-left: 75%
762   - }
763   -
764   - .col-sm-offset-8 {
765   - margin-left: 66.66666667%
766   - }
767   -
768   - .col-sm-offset-7 {
769   - margin-left: 58.33333333%
770   - }
771   -
772   - .col-sm-offset-6 {
773   - margin-left: 50%
774   - }
775   -
776   - .col-sm-offset-5 {
777   - margin-left: 41.66666667%
778   - }
779   -
780   - .col-sm-offset-4 {
781   - margin-left: 33.33333333%
782   - }
783   -
784   - .col-sm-offset-3 {
785   - margin-left: 25%
786   - }
787   -
788   - .col-sm-offset-2 {
789   - margin-left: 16.66666667%
790   - }
791   -
792   - .col-sm-offset-1 {
793   - margin-left: 8.33333333%
794   - }
795   -
796   - .col-sm-offset-0 {
797   - margin-left: 0
798   - }
799   - }
800   - #img_list li{
801   - font-size: 10px;
802   - /*width: 50px;*/
803   - text-align: left;
804   - margin: 5px 20px 5px 5px;
805   - }
806   - #img_list li img{
807   - height: 35px;
808   - width: 35px;
809   - }
810   - #info_list{
811   - width: 100%;
812   - display:inline-block;
813   - }
814   - #info_list li{
815   - margin:8px 3px 0 5px;
816   - }
817   - #info_list li span{
818   - font-size: 12px;
819   - display: inline-block;
820   - /*width: 65px;*/
821   - text-align: center;
822   - }
823   - .grid{
824   - display: inline-block;
825   - width: 50px;
826   - height: 50px;
827   - /*margin: 12px 6px;*/
828   - margin-bottom: 6px;
829   - background-size:cover;
830   - background-image: url("~@/assets/icon/空盘空闲.png");
831   - }
832   - #location span{
833   - display: inline-block;
834   - text-align: right;
835   - width: 50px;
836   - margin-right: 10px;
837   - }
838 647 </style>
839 648 \ No newline at end of file
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue
... ... @@ -77,12 +77,7 @@
77 77 <template slot="action" slot-scope="text, record">
78 78 <a v-if="record.enableStatus === 1" @click="generateCount(record.id)">生成盘点任务</a>
79 79 <a-divider v-if="record.enableStatus === 1" type="vertical"/>
80   - <a @click="loadData()"><a-icon type="sync"/>刷新</a>
81   - <a-divider type="vertical"/>
82   - <a-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)">
83   - <a>删除</a>
84   - </a-popconfirm>
85   -
  80 + <a @click="loadDatas(record.cycleCountHeadId)"><a-icon type="sync"/>刷新</a>
86 81 </template>
87 82  
88 83 </a-table>
... ... @@ -98,6 +93,7 @@
98 93 <script>
99 94  
100 95 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  96 + import { getAction } from '@api/manage'
101 97 import CycleCountDetailModal from './modules/CycleCountDetailModal'
102 98 import CycleCountDetailChildSubTable from './subTables/CycleCountDetailChildSubTable'
103 99 import '@/assets/less/TableExpand.less'
... ... @@ -113,6 +109,10 @@
113 109 CycleCountDetailChildSubTable,
114 110 },
115 111 props: {
  112 + record: {
  113 + type: Object,
  114 + default: null,
  115 + },
116 116 isLoad: {
117 117 type: Boolean,
118 118 default: false,
... ... @@ -259,7 +259,46 @@
259 259 return window._CONFIG['domianURL'] + this.url.importExcelUrl
260 260 }
261 261 },
  262 +
  263 + watch: {
  264 + record: {
  265 + immediate: true,
  266 + handler() {
  267 + if (this.record != null) {
  268 + this.loadData(this.record)
  269 + }
  270 + }
  271 + }
  272 + },
262 273 methods: {
  274 + loadData(record) {
  275 + this.loading = true
  276 + this.dataSource = []
  277 + getAction(this.url.list, {
  278 + cycleCountHeadId: record.id
  279 + }).then((res) => {
  280 + if (res.success) {
  281 + this.dataSource = res.result.records
  282 + }
  283 + }).finally(() => {
  284 + this.loading = false
  285 + })
  286 + },
  287 +
  288 + loadDatas(record) {
  289 + this.loading = true
  290 + this.dataSource = []
  291 + getAction(this.url.list, {
  292 + cycleCountHeadId: record
  293 + }).then((res) => {
  294 + if (res.success) {
  295 + this.dataSource = res.result.records
  296 + }
  297 + }).finally(() => {
  298 + this.loading = false
  299 + })
  300 + },
  301 +
263 302 // testaa(){
264 303 // alert("刷新了")
265 304 // var _this = this;
... ... @@ -267,7 +306,7 @@
267 306 // },
268 307 methodB(data) {
269 308 var _this = this;
270   - _this.loadDataList();
  309 + _this.loadDatas(data);
271 310 },
272 311 initDictConfig() {
273 312 },
... ... @@ -278,7 +317,7 @@
278 317 this.$message.success(res.message)
279 318 this.$emit('ok')
280 319 var _this = this;
281   - _this.loadData();
  320 + _this.loadDatas(res.result);
282 321 } else {
283 322 this.$message.warning(res.message);
284 323 }
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue
... ... @@ -92,15 +92,12 @@
92 92 </a-button>
93 93 </template>
94 94 <span slot="action" slot-scope="text, record">
95   - <j-select-multi-cycle-count :query-config="selectUserQueryConfig" :test-config="record.id" :header-code="record.code"/>
96   - <a-divider type="vertical" />
  95 + <j-select-multi-cycle-count v-if="record.statusCyc!=100" :query-config="selectUserQueryConfig" :test-config="record.id" :header-code="record.code"/>
  96 + <a-divider type="vertical" v-if="record.statusCyc!=100" />
97 97 <a-dropdown>
98 98 <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
99 99 <a-menu slot="overlay">
100 100 <a-menu-item>
101   - <a @click="loadDataaa()"><a-icon type="sync"/>刷新</a>
102   - </a-menu-item>
103   - <a-menu-item>
104 101 <a @click="handleEdit(record)">编辑</a>
105 102 </a-menu-item>
106 103 <a-menu-item>
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue
... ... @@ -23,7 +23,7 @@
23 23  
24 24 <template slot="action" slot-scope="text, record">
25 25 <adjustment-doc-modal ref="adjustmentModal" @ok="modalFormOk" :id="record.id"/>
26   - <a @click="createMany(record)"><a-icon />实盘登记</a>
  26 + <a v-if="record.childStatus != 1" @click="createMany(record)"><a-icon />实盘登记</a>
27 27 </template>
28 28  
29 29 <template slot="fileSlot" slot-scope="text">
... ...
huaheng-wms-core/src/main/java/org/jeecg/JeecgSystemApplication.java
... ... @@ -18,6 +18,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
18 18 import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
19 19 import org.springframework.boot.builder.SpringApplicationBuilder;
20 20 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  21 +import org.springframework.cache.annotation.EnableCaching;
21 22 import org.springframework.context.ConfigurableApplicationContext;
22 23 import org.springframework.core.env.Environment;
23 24  
... ... @@ -28,6 +29,7 @@ import net.bytebuddy.asm.Advice.This;
28 29 * 单体启动类(采用此类启动为单体模式)
29 30 */
30 31 @Slf4j
  32 +@EnableCaching
31 33 @SpringBootApplication
32 34 @EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})
33 35 public class JeecgSystemApplication extends SpringBootServletInitializer {
... ...
huaheng-wms-core/src/main/java/org/jeecg/config/init/CodeGenerateDbConfig.java
... ... @@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
12 12 * @Description: 代码生成器,自定义DB配置
13 13 * 【加了此类,则online模式DB连接,使用平台的配置,jeecg_database.properties配置无效;
14 14 * 但是使用GUI模式代码生成,还是走jeecg_database.properties配置】
15   - * 提醒: 达梦数据库需要修改下面的参数${spring.datasource.dynamic.datasource.master.url:}配置
  15 + * 提醒:达梦数据库需要修改下面的参数 ${spring.datasource.dynamic.datasource.master.url} 配置
16 16 * @author: scott
17 17 * @date: 2021年02月18日 16:30
18 18 */
... ... @@ -38,11 +38,11 @@ public class CodeGenerateDbConfig {
38 38 password = ConfigTools.decrypt(publicKey, password);
39 39 } catch (Exception e) {
40 40 e.printStackTrace();
41   - log.error(" 代码生成器数据库连接,数据库密码解密失败!");
  41 + log.error("代码生成器数据库连接,数据库密码解密失败!");
42 42 }
43 43 }
44 44 CodegenDatasourceConfig.initDbConfig(driverClassName, url, username, password);
45   - log.info(" 代码生成器数据库连接,使用application.yml的DB配置 ###################");
  45 + log.info("###代码生成器数据库连接,使用application.yml的DB配置 ###");
46 46 }
47 47 return null;
48 48 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/cas/controller/CasClientController.java
... ... @@ -81,7 +81,7 @@ public class CasClientController {
81 81 String token = HuahengJwtUtil.sign(sysUser.getUsername(), sysUser.getPassword());
82 82 // 设置超时时间
83 83 redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
84   - redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, HuahengJwtUtil.EXPIRE_TIME * 2 / 1000);
  84 + redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, HuahengJwtUtil.EXPIRE_TIME / 1000);
85 85  
86 86 // 获取用户部门信息
87 87 JSONObject obj = new JSONObject();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java
... ... @@ -125,7 +125,7 @@ public class LoginController {
125 125 LoginUser loginUser = new LoginUser();
126 126 BeanUtils.copyProperties(sysUser, loginUser);
127 127 loginUser.setId(sysUser.getId() + "");
128   - baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null, loginUser);
  128 + baseCommonService.addLog("用户名:" + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null, loginUser);
129 129 // update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员
130 130 return result;
131 131 }
... ... @@ -172,9 +172,9 @@ public class LoginController {
172 172 LoginUser sysUser = sysBaseAPI.getUserByName(username);
173 173 if (sysUser != null) {
174 174 // update-begin--Author:wangshuai Date:20200714 for:登出日志没有记录人员
175   - baseCommonService.addLog("用户名: " + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null, sysUser);
  175 + baseCommonService.addLog("用户名:" + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null, sysUser);
176 176 // update-end--Author:wangshuai Date:20200714 for:登出日志没有记录人员
177   - log.info(" 用户名: " + sysUser.getRealname() + ",退出成功! ");
  177 + log.info("用户名:" + sysUser.getRealname() + ",退出成功!");
178 178 // 清空用户登录Token缓存
179 179 redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
180 180 // 清空用户登录Shiro权限缓存
... ... @@ -378,7 +378,7 @@ public class LoginController {
378 378 // 用户信息
379 379 userInfo(sysUser, result, warehouseCode);
380 380 // 添加日志
381   - baseCommonService.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
  381 + baseCommonService.addLog("用户名:" + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
382 382  
383 383 return result;
384 384 }
... ... @@ -429,34 +429,34 @@ public class LoginController {
429 429 }
430 430 }
431 431  
  432 + // 暂时移除唯一登录功能
432 433 // 删除相同用户名称对应的key
433   - Collection<String> keys = redisTemplate.keys(CommonConstant.PREFIX_USER_TOKEN + "*");
434   - for (String key : keys) {
435   - String token = (String)redisUtil.get(key);
436   - LoginUser loginUser = sysBaseAPI.getUserByName(JwtUtil.getUsername(token));
437   - if (loginUser != null) {
438   - if (oConvertUtils.isNotEmpty(username) && loginUser.getUsername().contains(username)) {
439   - log.info(" 强制 " + sysUser.getRealname() + "退出成功! ");
440   - // 清空用户登录Token缓存
441   - redisUtil.del(token);
442   - redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
443   - // 清空用户登录Shiro权限缓存
444   - redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());
445   - // 清空用户的缓存信息(包括部门信息),例如sys:cache:user::<username>
446   - redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
447   - // 调用shiro的logout
448   - SecurityUtils.getSubject().logout();
449   - //
450   - redisUtil.del(key);
451   - }
452   - }
453   - }
  434 +// Collection<String> keys = redisTemplate.keys(CommonConstant.PREFIX_USER_TOKEN + "*");
  435 +// for (String key : keys) {
  436 +// String token = (String)redisUtil.get(key);
  437 +// LoginUser loginUser = sysBaseAPI.getUserByName(JwtUtil.getUsername(token));
  438 +// if (loginUser != null) {
  439 +// if (oConvertUtils.isNotEmpty(username) && loginUser.getUsername().contains(username)) {
  440 +// log.info("强制 " + sysUser.getRealname() + " 退出成功! ");
  441 +// // 清空用户登录Token缓存
  442 +// redisUtil.del(token);
  443 +// // 清空用户登录Token缓存
  444 +// redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
  445 +// // 清空用户登录Shiro权限缓存
  446 +// redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());
  447 +// // 清空用户的缓存信息(包括部门信息),例如sys:cache:user::<username>
  448 +// redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
  449 +// // 调用shiro的logout
  450 +// SecurityUtils.getSubject().logout();
  451 +// }
  452 +// }
  453 +// }
454 454 // update-end--Author:sunjianlei Date:20210802 for:获取用户租户信息
455 455 // 生成token
456 456 String token = HuahengJwtUtil.sign(username, syspassword, warehouseCode);
457 457 // 设置token缓存有效时间
458 458 redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
459   - redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
  459 + redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, HuahengJwtUtil.EXPIRE_TIME / 1000);
460 460 obj.put("token", token);
461 461 obj.put("userInfo", sysUser);
462 462 obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
... ... @@ -562,14 +562,14 @@ public class LoginController {
562 562 String token = JwtUtil.sign(username, syspassword);
563 563 // 设置超时时间
564 564 redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
565   - redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
  565 + redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, HuahengJwtUtil.EXPIRE_TIME / 1000);
566 566  
567 567 // token 信息
568 568 obj.put("token", token);
569 569 result.setResult(obj);
570 570 result.setSuccess(true);
571 571 result.setCode(200);
572   - baseCommonService.addLog("用户名: " + username + ",登录成功[移动端]!", CommonConstant.LOG_TYPE_1, null);
  572 + baseCommonService.addLog("用户名:" + username + ",登录成功[移动端]!", CommonConstant.LOG_TYPE_1, null);
573 573 return result;
574 574 }
575 575  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
... ... @@ -217,7 +217,7 @@ public class SysUserController {
217 217 Result<SysUser> result = new Result<SysUser>();
218 218 try {
219 219 SysUser sysUser = sysUserService.getById(jsonObject.getString("id"));
220   - baseCommonService.addLog("编辑用户,id: " + jsonObject.getString("id"), CommonConstant.LOG_TYPE_2, 2);
  220 + baseCommonService.addLog("编辑用户,id:" + jsonObject.getString("id"), CommonConstant.LOG_TYPE_2, 2);
221 221 if (sysUser == null) {
222 222 result.error500("未找到对应实体");
223 223 } else {
... ... @@ -249,7 +249,7 @@ public class SysUserController {
249 249 // @RequiresRoles({"admin"})
250 250 @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
251 251 public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
252   - baseCommonService.addLog("删除用户,id: " + id, CommonConstant.LOG_TYPE_2, 3);
  252 + baseCommonService.addLog("删除用户,id:" + id, CommonConstant.LOG_TYPE_2, 3);
253 253 this.sysUserService.deleteUser(id);
254 254 return Result.ok("删除用户成功");
255 255 }
... ... @@ -260,7 +260,7 @@ public class SysUserController {
260 260 // @RequiresRoles({"admin"})
261 261 @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
262 262 public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
263   - baseCommonService.addLog("批量删除用户, ids: " + ids, CommonConstant.LOG_TYPE_2, 3);
  263 + baseCommonService.addLog("批量删除用户,ids:" + ids, CommonConstant.LOG_TYPE_2, 3);
264 264 this.sysUserService.deleteBatchUsers(ids);
265 265 return Result.ok("批量删除用户成功");
266 266 }
... ... @@ -1228,7 +1228,7 @@ public class SysUserController {
1228 1228 try {
1229 1229 String username = JwtUtil.getUserNameByToken(request);
1230 1230 SysUser sysUser = sysUserService.getUserByName(username);
1231   - baseCommonService.addLog("移动端编辑用户,id: " + jsonObject.getString("id"), CommonConstant.LOG_TYPE_2, 2);
  1231 + baseCommonService.addLog("移动端编辑用户,id:" + jsonObject.getString("id"), CommonConstant.LOG_TYPE_2, 2);
1232 1232 String realname = jsonObject.getString("realname");
1233 1233 String avatar = jsonObject.getString("avatar");
1234 1234 String sex = jsonObject.getString("sex");
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysUserOnlineController.java
... ... @@ -120,7 +120,6 @@ public class SysUserOnlineController {
120 120 return Result.error("退出登录失败!");
121 121 }
122 122 Collection<String> keys = redisTemplate.keys(CommonConstant.PREFIX_USER_TOKEN + "*");
123   - List<SysUserOnlineVO> onlineList = new ArrayList<SysUserOnlineVO>();
124 123 for (String key : keys) {
125 124 if (key.equals(online.getToken())) {
126 125 String tokenValue = (String)redisUtil.get(online.getToken());
... ... @@ -128,18 +127,13 @@ public class SysUserOnlineController {
128 127 LoginUser sysUser = sysBaseAPI.getUserByName(username);
129 128 if (sysUser != null) {
130 129 // update-begin--Author:wangshuai Date:20200714 for:登出日志没有记录人员
131   - baseCommonService.addLog("用户名: " + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null, sysUser);
  130 + baseCommonService.addLog("用户名:" + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null, sysUser);
132 131 // update-end--Author:wangshuai Date:20200714 for:登出日志没有记录人员
133   - log.info(" 用户名: " + sysUser.getRealname() + ",退出成功! ");
134   -
135   - // 以下两个清空测试无效 保留在这吧
136   - // 清空用户登录Token缓存/用户登录Shiro权限缓存
  132 + log.info("用户 " + sysUser.getRealname() + ",退出成功!");
  133 + // 清空用户登录Token缓存
137 134 redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + tokenValue);
  135 + // 用户登录Shiro权限缓存
138 136 redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());
139   -
140   - // 真*清空Token
141   - redisUtil.del(key);
142   -
143 137 // 清空用户的缓存信息
144 138 redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
145 139 // 调用shiro的logout
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/ThirdLoginController.java
... ... @@ -202,7 +202,6 @@ public class ThirdLoginController {
202 202 return token;
203 203 }
204 204  
205   - @SuppressWarnings("unchecked")
206 205 @RequestMapping(value = "/getLoginUser/{token}/{thirdType}", method = RequestMethod.GET)
207 206 @ResponseBody
208 207 public Result<JSONObject> getThirdLoginUser(@PathVariable("token") String token, @PathVariable("thirdType") String thirdType) throws Exception {
... ... @@ -235,7 +234,7 @@ public class ThirdLoginController {
235 234 result.setResult(obj);
236 235 result.setSuccess(true);
237 236 result.setCode(200);
238   - baseCommonService.addLog("用户名: " + username + ",登录成功[第三方用户]!", CommonConstant.LOG_TYPE_1, null);
  237 + baseCommonService.addLog("用户名:" + username + ",登录成功[第三方用户]!", CommonConstant.LOG_TYPE_1, null);
239 238 return result;
240 239 }
241 240  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
... ... @@ -392,13 +392,13 @@ public class SysUserServiceImpl extends ServiceImpl&lt;SysUserMapper, SysUser&gt; impl
392 392 // update-begin---author:王帅 Date:20200601 for:if条件永远为falsebug------------
393 393 if (CommonConstant.DEL_FLAG_1.equals(sysUser.getDelFlag())) {
394 394 // update-end---author:王帅 Date:20200601 for:if条件永远为falsebug------------
395   - baseCommonService.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已注销!", CommonConstant.LOG_TYPE_1, null);
  395 + baseCommonService.addLog("用户登录失败,用户名" + sysUser.getUsername() + "已注销!", CommonConstant.LOG_TYPE_1, null);
396 396 result.error500("该用户已注销");
397 397 return result;
398 398 }
399 399 // 情况3:根据用户信息查询,该用户已冻结
400 400 if (CommonConstant.USER_FREEZE.equals(sysUser.getStatus())) {
401   - baseCommonService.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已冻结!", CommonConstant.LOG_TYPE_1, null);
  401 + baseCommonService.addLog("用户登录失败,用户名" + sysUser.getUsername() + "已冻结!", CommonConstant.LOG_TYPE_1, null);
402 402 result.error500("该用户已冻结");
403 403 return result;
404 404 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/controller/AcsController.java
1 1 package org.jeecg.modules.wms.api.acs.controller;
2 2  
  3 +import java.util.Map;
  4 +
3 5 import javax.annotation.Resource;
  6 +import javax.servlet.http.HttpServletRequest;
4 7  
5 8 import org.jeecg.common.api.vo.Result;
6 9 import org.jeecg.modules.wms.api.acs.entity.AcsStatus;
7 10 import org.jeecg.modules.wms.api.acs.service.IAcsService;
  11 +import org.jeecg.modules.wms.config.address.service.IAddressService;
8 12 import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
9 13 import org.jeecg.modules.wms.framework.controller.HuahengBaseController;
10 14 import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService;
  15 +import org.jeecg.utils.OkHttpUtils;
11 16 import org.jeecg.utils.StringUtils;
12 17 import org.jeecg.utils.constant.QuantityConstant;
13 18 import org.springframework.transaction.annotation.Transactional;
14   -import org.springframework.web.bind.annotation.*;
  19 +import org.springframework.web.bind.annotation.PostMapping;
  20 +import org.springframework.web.bind.annotation.RequestBody;
  21 +import org.springframework.web.bind.annotation.RequestMapping;
  22 +import org.springframework.web.bind.annotation.ResponseBody;
  23 +import org.springframework.web.bind.annotation.RestController;
  24 +
  25 +import com.alibaba.fastjson.JSON;
15 26  
16 27 import io.swagger.annotations.ApiOperation;
17 28  
18 29 @RestController
19   -@RequestMapping("/API/WMS/acs")
  30 +@RequestMapping("/api/wms/acs")
20 31 public class AcsController extends HuahengBaseController {
21 32  
22 33 @Resource
23 34 private IAcsService acsService;
  35 +
24 36 @Resource
25 37 private IAgvTaskService agvTaskService;
  38 +
  39 + @Resource
  40 + private IAddressService addressService;
  41 +
  42 +// @PassApiAuthentication
  43 +// @ApiLogger(apiName = "API接口第三方Token校验测试", from = "TEST")
  44 + @ResponseBody
  45 + @PostMapping(value = "/testTokenCheck")
  46 + public Result<?> testTokenCheck(@RequestBody Map<String, String> paramMap, HttpServletRequest request) {
  47 + String url = "http://127.0.0.1:8080/wms/api/wms/acs/testTokenCheck";
  48 + String body = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(paramMap));
  49 +// String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_AGV_TASK_ASSIGN);
  50 + return Result.ok(body);
  51 + }
  52 +
26 53  
27 54 @PostMapping("/notifyAGVTask")
28 55 @ApiOperation("更新AGV状态")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java
... ... @@ -10,9 +10,9 @@ import org.jeecg.modules.wms.config.location.entity.Location;
10 10 import org.jeecg.modules.wms.config.location.service.ILocationService;
11 11 import org.jeecg.modules.wms.task.agvTask.entity.AgvTask;
12 12 import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService;
  13 +import org.jeecg.utils.OkHttpUtils;
13 14 import org.jeecg.utils.StringUtils;
14 15 import org.jeecg.utils.constant.QuantityConstant;
15   -import org.jeecg.utils.http.OkHttpUtils;
16 16 import org.springframework.stereotype.Service;
17 17  
18 18 import com.alibaba.fastjson.JSON;
... ... @@ -57,7 +57,7 @@ public class AcsServiceImpl implements IAcsService {
57 57 }
58 58 }
59 59 }
60   - Location toLocation = locationService.getLocationByCode(toPort, warehouseCode);
  60 +// Location toLocation = locationService.getLocationByCode(toPort, warehouseCode);
61 61 agvTask.setPreTaskNo(preTaskNo);
62 62 boolean success = agvTaskService.updateById(agvTask);
63 63 if (!success) {
... ... @@ -75,7 +75,7 @@ public class AcsServiceImpl implements IAcsService {
75 75 String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_AGV_TASK_ASSIGN);
76 76 String jsonParam = JSON.toJSONString(agvEntity);
77 77 System.out.println(jsonParam);
78   - String body = OkHttpUtils.bodypost(url, jsonParam);
  78 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
79 79 if (StringUtils.isEmpty(body)) {
80 80 throw new ServiceException("接口地址错误或返回为空");
81 81 }
... ... @@ -92,7 +92,7 @@ public class AcsServiceImpl implements IAcsService {
92 92 agvEntity.setTaskNo(agvTask.getId());
93 93 String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_AGV_TASK_CANCEL);
94 94 String jsonParam = JSON.toJSONString(agvEntity);
95   - String body = OkHttpUtils.bodypost(url, jsonParam);
  95 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
96 96 if (StringUtils.isEmpty(body)) {
97 97 throw new ServiceException("接口地址错误或返回为空");
98 98 }
... ... @@ -110,7 +110,7 @@ public class AcsServiceImpl implements IAcsService {
110 110 agvEntity.setPriority(agvTask.getPriority());
111 111 String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_AGV_TASK_UPDATE);
112 112 String jsonParam = JSON.toJSONString(agvEntity);
113   - String body = OkHttpUtils.bodypost(url, jsonParam);
  113 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
114 114 if (StringUtils.isEmpty(body)) {
115 115 throw new ServiceException("接口地址错误或返回为空");
116 116 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java
... ... @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
24 24 * @author 游杰
25 25 */
26 26 @RestController
27   -@RequestMapping("/API/WMS/erp")
  27 +@RequestMapping("/api/wms/erp")
28 28 public class ErpController extends HuahengBaseController {
29 29  
30 30 @Resource
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/service/impl/ErpServiceImpl.java
... ... @@ -39,9 +39,9 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
39 39 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
40 40 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService;
41 41 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService;
  42 +import org.jeecg.utils.OkHttpUtils;
42 43 import org.jeecg.utils.StringUtils;
43 44 import org.jeecg.utils.constant.QuantityConstant;
44   -import org.jeecg.utils.http.OkHttpUtils;
45 45 import org.springframework.stereotype.Service;
46 46 import org.springframework.transaction.annotation.Transactional;
47 47  
... ... @@ -430,7 +430,7 @@ public class ErpServiceImpl implements IErpService {
430 430 erpBackReceipt.setReceiptDetailList(receiptDetailList);
431 431 String jsonParam = JSON.toJSONString(erpBackReceipt);
432 432 System.out.println(jsonParam);
433   - String body = OkHttpUtils.bodypost(url, jsonParam);
  433 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
434 434 if (StringUtils.isEmpty(body)) {
435 435 throw new ServiceException("接口地址错误或返回为空");
436 436 }
... ... @@ -463,7 +463,7 @@ public class ErpServiceImpl implements IErpService {
463 463 erpBackShipment.setShipmentDetailList(shipmentDetailList);
464 464 String jsonParam = JSON.toJSONString(erpBackShipment);
465 465 System.out.println(jsonParam);
466   - String body = OkHttpUtils.bodypost(url, jsonParam);
  466 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
467 467 if (StringUtils.isEmpty(body)) {
468 468 throw new ServiceException("接口地址错误或返回为空");
469 469 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java
... ... @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
26 26 * @author 游杰
27 27 */
28 28 @RestController
29   -@RequestMapping("/API/WMS/mes")
  29 +@RequestMapping("/api/wms/mes")
30 30 public class MesController extends HuahengBaseController {
31 31  
32 32 @Resource
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java
... ... @@ -33,9 +33,9 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail;
33 33 import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
34 34 import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService;
35 35 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
  36 +import org.jeecg.utils.OkHttpUtils;
36 37 import org.jeecg.utils.StringUtils;
37 38 import org.jeecg.utils.constant.QuantityConstant;
38   -import org.jeecg.utils.http.OkHttpUtils;
39 39 import org.springframework.stereotype.Service;
40 40 import org.springframework.transaction.annotation.Transactional;
41 41  
... ... @@ -258,7 +258,7 @@ public class MesServiceImpl implements IMesService {
258 258 String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_MES_BACK_RECEIPT);
259 259 String jsonParam = JSON.toJSONString(mesBackReceiptList);
260 260 System.out.println(jsonParam);
261   - String body = OkHttpUtils.bodypost(url, jsonParam);
  261 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
262 262 if (StringUtils.isEmpty(body)) {
263 263 throw new ServiceException("接口地址错误或返回为空");
264 264 }
... ... @@ -327,7 +327,7 @@ public class MesServiceImpl implements IMesService {
327 327 String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_MES_BACK_SHIPMENT);
328 328 String jsonParam = JSON.toJSONString(mesBackShipmentList);
329 329 System.out.println(jsonParam);
330   - String body = OkHttpUtils.bodypost(url, jsonParam);
  330 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
331 331 if (StringUtils.isEmpty(body)) {
332 332 throw new ServiceException("接口地址错误或返回为空");
333 333 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java
... ... @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
24 24 import io.swagger.annotations.ApiOperation;
25 25  
26 26 @RestController
27   -@RequestMapping("/API/WMS/v2")
  27 +@RequestMapping("/api/wms/v2")
28 28 public class WcsController extends HuahengBaseController {
29 29  
30 30 @Resource
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -35,9 +35,9 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail;
35 35 import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
36 36 import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService;
37 37 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
  38 +import org.jeecg.utils.OkHttpUtils;
38 39 import org.jeecg.utils.StringUtils;
39 40 import org.jeecg.utils.constant.QuantityConstant;
40   -import org.jeecg.utils.http.OkHttpUtils;
41 41 import org.springframework.stereotype.Service;
42 42 import org.springframework.transaction.annotation.Transactional;
43 43  
... ... @@ -256,7 +256,7 @@ public class WcsServiceImpl implements WcsService {
256 256 String fromLocationCode = taskHeader.getFromLocationCode();
257 257 String toLocationCode = taskHeader.getToLocationCode();
258 258 Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
259   - Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
  259 +// Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
260 260 boolean direction = true; // true 执行时是入库动作, false 执行时是出库动作
261 261 switch (taskType) {
262 262 case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT:
... ... @@ -378,7 +378,7 @@ public class WcsServiceImpl implements WcsService {
378 378 wcsTask = switchTaskTypeToWcs(wcsTask);
379 379 String jsonParam = JSON.toJSONString(wcsTask);
380 380 System.out.println(jsonParam);
381   - String body = OkHttpUtils.bodypost(url, jsonParam);
  381 + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam);
382 382 if (StringUtils.isEmpty(body)) {
383 383 throw new ServiceException("接口地址错误或返回为空");
384 384 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java
... ... @@ -6,6 +6,7 @@ import org.apache.commons.math3.analysis.function.Add;
6 6 import org.jeecg.modules.wms.config.address.entity.Address;
7 7 import org.jeecg.modules.wms.config.address.mapper.AddressMapper;
8 8 import org.jeecg.modules.wms.config.address.service.IAddressService;
  9 +import org.springframework.cache.annotation.Cacheable;
9 10 import org.springframework.stereotype.Service;
10 11  
11 12 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
... ... @@ -20,6 +21,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
20 21 public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {
21 22  
22 23 @Override
  24 + @Cacheable(cacheNames = "getAddressByUrl#300", key = "#root.methodName + '_' + #url + '_' + #warehouseCode")
23 25 public Address getAddressByUrl(String url, String warehouseCode) {
24 26 LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
25 27 addressLambdaQueryWrapper.eq(Address::getUrl, url).eq(Address::getWarehouseCode, warehouseCode).last(" limit 1");
... ... @@ -28,6 +30,7 @@ public class AddressServiceImpl extends ServiceImpl&lt;AddressMapper, Address&gt; impl
28 30 }
29 31  
30 32 @Override
  33 + @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param + '_' + #warehouseCode + '_' + #zoneCode")
31 34 public String getUrlByParam(String param, String warehouseCode, String zoneCode) {
32 35 LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
33 36 addressLambdaQueryWrapper.eq(Address::getParam, param).eq(Address::getWarehouseCode, warehouseCode).eq(Address::getZoneCode, zoneCode);
... ... @@ -39,7 +42,9 @@ public class AddressServiceImpl extends ServiceImpl&lt;AddressMapper, Address&gt; impl
39 42 return url;
40 43 }
41 44  
  45 + /** #300 缓存300秒 */
42 46 @Override
  47 + @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param")
43 48 public String getUrlByParam(String param) {
44 49 LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
45 50 addressLambdaQueryWrapper.eq(Address::getParam, param);
... ... @@ -47,8 +52,6 @@ public class AddressServiceImpl extends ServiceImpl&lt;AddressMapper, Address&gt; impl
47 52 if (address == null) {
48 53 return null;
49 54 }
50   - String url = address.getUrl();
51   - return url;
  55 + return address.getUrl();
52 56 }
53   -
54 57 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... ... @@ -93,10 +93,13 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
93 93 if (location == null) {
94 94 return false;
95 95 }
  96 + boolean success = false;
96 97 // 如果这个托盘号已经在库位表里,那么不能再写入
97   - boolean success = havaContainerCodeInLocation(containerCode, warehouseCode);
98   - if (success) {
99   - throw new ServiceException("库位表已经存在这个容器号,不能再写入");
  98 + if (StringUtils.isNotEmpty(containerCode)) {
  99 + success = havaContainerCodeInLocation(containerCode, warehouseCode);
  100 + if (success) {
  101 + throw new ServiceException("库位表已经存在这个容器号,不能再写入");
  102 + }
100 103 }
101 104 location.setContainerCode(containerCode);
102 105 location.setStatus(status);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiAuthenticationAspect.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj;
  2 +
  3 +import java.lang.reflect.Method;
  4 +import java.util.Arrays;
  5 +
  6 +import javax.servlet.http.HttpServletRequest;
  7 +
  8 +import org.aspectj.lang.JoinPoint;
  9 +import org.aspectj.lang.annotation.Aspect;
  10 +import org.aspectj.lang.annotation.Before;
  11 +import org.aspectj.lang.annotation.Pointcut;
  12 +import org.aspectj.lang.reflect.MethodSignature;
  13 +import org.bouncycastle.crypto.RuntimeCryptoException;
  14 +import org.jeecg.modules.wms.framework.aspectj.dto.RSA256Key;
  15 +import org.jeecg.utils.HuahengJwtUtil;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.scheduling.annotation.EnableAsync;
  18 +import org.springframework.stereotype.Component;
  19 +import org.springframework.web.context.request.RequestContextHolder;
  20 +import org.springframework.web.context.request.ServletRequestAttributes;
  21 +
  22 +import com.auth0.jwt.JWT;
  23 +import com.auth0.jwt.JWTVerifier;
  24 +import com.auth0.jwt.algorithms.Algorithm;
  25 +import com.auth0.jwt.exceptions.JWTVerificationException;
  26 +import com.auth0.jwt.interfaces.DecodedJWT;
  27 +import com.baomidou.mybatisplus.extension.service.IService;
  28 +
  29 +import cn.hutool.core.date.DatePattern;
  30 +import cn.hutool.core.date.DateUtil;
  31 +import cn.hutool.core.util.StrUtil;
  32 +import lombok.extern.slf4j.Slf4j;
  33 +
  34 +/**
  35 + * 第三方系统调用接口身份认证Aspect
  36 + * @author TanYibin
  37 + * @createDate 2023年2月14日
  38 + */
  39 +@Slf4j
  40 +@Aspect
  41 +@Component
  42 +@EnableAsync
  43 +public class ApiAuthenticationAspect {
  44 +
  45 + @Autowired
  46 + private RSA256Key rsa256Key;
  47 +
  48 + @Pointcut("execution(* org.jeecg.modules.wms.api..*.*(..)) " + "&& (@annotation(org.springframework.web.bind.annotation.RequestMapping) "
  49 + + "|| @annotation(org.springframework.web.bind.annotation.GetMapping) " + "|| @annotation(org.springframework.web.bind.annotation.PostMapping))")
  50 + public void executeController() {}
  51 +
  52 + /**
  53 + * API Token 验证
  54 + * @author TanYibin
  55 + * @createDate 2023年2月14日
  56 + * @param joinPoint
  57 + * @throws NoSuchMethodException
  58 + * @throws Throwable
  59 + */
  60 + @Before("executeController()")
  61 + public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException, Throwable {
  62 + Method method = this.getTargetMethod(joinPoint);
  63 + // 检查是否有passtoken注释,有则跳过认证
  64 + if (method.isAnnotationPresent(PassApiAuthentication.class)) {
  65 + PassApiAuthentication passApiAuthentication = method.getAnnotation(PassApiAuthentication.class);
  66 + if (passApiAuthentication.required()) {
  67 + return;
  68 + }
  69 + }
  70 + // 获取request对象
  71 + ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
  72 + HttpServletRequest request = attributes.getRequest();
  73 + String token = request.getHeader("token");
  74 + if (token == null) {
  75 + log.error("Authentication token is null");
  76 + throw new RuntimeException("Authentication token is null");
  77 + }
  78 + try {
  79 + Algorithm algorithm = Algorithm.RSA256(rsa256Key.getPublicKey(), rsa256Key.getPrivateKey());
  80 + JWTVerifier verifier = JWT.require(algorithm).withIssuer(HuahengJwtUtil.HUAHENG_SYSTEM_ID).build();
  81 + verifier.verify(token);
  82 + } catch (JWTVerificationException e) {
  83 + log.error(e.getMessage());
  84 + throw e;
  85 + }
  86 + }
  87 +
  88 + /**
  89 + * 基于连接点信息获取目标方法对象
  90 + * @author TanYibin
  91 + * @createDate 2023年2月14日
  92 + * @param joinPoint
  93 + * @return
  94 + * @throws NoSuchMethodException
  95 + */
  96 + private Method getTargetMethod(JoinPoint joinPoint) throws NoSuchMethodException {
  97 + // 获取目标类对象
  98 + Class<?> clazz = joinPoint.getTarget().getClass();
  99 + // 获取方法签名信息,方法名和参数列表
  100 + MethodSignature signature = (MethodSignature)joinPoint.getSignature();
  101 + // 获取目标方法对象
  102 + return clazz.getDeclaredMethod(signature.getName(), signature.getParameterTypes());
  103 + }
  104 +
  105 + /**
  106 + * 获取方法类全名+方法名
  107 + * @author TanYibin
  108 + * @createDate 2023年2月14日
  109 + * @param method
  110 + * @return
  111 + */
  112 + private String getClassAndMethodName(Method method) {
  113 + // 获取类全名
  114 + String className = method.getDeclaringClass().getName();
  115 + // 获取方法名
  116 + String methodName = method.getName();
  117 + return new StringBuffer(className).append(".").append(methodName).toString();
  118 + }
  119 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java
1 1 package org.jeecg.modules.wms.framework.aspectj;
2 2  
3   -import com.alibaba.fastjson.JSON;
4   -import com.alibaba.fastjson.JSONObject;
5   -import okhttp3.Request;
6   -import okhttp3.Response;
  3 +import java.net.InetAddress;
  4 +import java.net.URL;
  5 +import java.net.UnknownHostException;
  6 +import java.util.ArrayList;
  7 +import java.util.Collection;
  8 +import java.util.Date;
  9 +import java.util.Enumeration;
  10 +import java.util.HashMap;
  11 +import java.util.Iterator;
  12 +import java.util.Set;
  13 +
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import javax.servlet.http.HttpServletResponse;
  16 +
7 17 import org.apache.commons.lang.exception.ExceptionUtils;
8 18 import org.aspectj.lang.ProceedingJoinPoint;
9 19 import org.aspectj.lang.annotation.Around;
10 20 import org.aspectj.lang.annotation.Aspect;
11 21 import org.aspectj.lang.annotation.Pointcut;
12 22 import org.aspectj.lang.reflect.MethodSignature;
  23 +import org.jeecg.JeecgSystemApplication;
13 24 import org.jeecg.common.api.vo.Result;
14 25 import org.jeecg.modules.wms.config.address.entity.Address;
15 26 import org.jeecg.modules.wms.config.address.service.IAddressService;
16 27 import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
17 28 import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog;
18 29 import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService;
  30 +import org.jeecg.utils.HuahengJwtUtil;
19 31 import org.jeecg.utils.ServletUtils;
20 32 import org.jeecg.utils.SpringUtils;
21 33 import org.jeecg.utils.StringUtils;
... ... @@ -23,21 +35,18 @@ import org.jeecg.utils.constant.QuantityConstant;
23 35 import org.slf4j.Logger;
24 36 import org.slf4j.LoggerFactory;
25 37 import org.springframework.beans.factory.annotation.Autowired;
26   -import org.springframework.http.HttpHeaders;
27 38 import org.springframework.scheduling.annotation.Async;
28 39 import org.springframework.scheduling.annotation.EnableAsync;
29 40 import org.springframework.stereotype.Component;
30   -import org.springframework.web.context.request.RequestContextHolder;
31   -import org.springframework.web.context.request.ServletRequestAttributes;
32 41  
33   -import javax.servlet.http.HttpServletRequest;
34   -import javax.servlet.http.HttpServletResponse;
35   -import java.net.HttpURLConnection;
36   -import java.net.URL;
37   -import java.util.*;
  42 +import com.alibaba.fastjson.JSON;
  43 +import com.alibaba.fastjson.JSONObject;
  44 +
  45 +import okhttp3.Request;
  46 +import okhttp3.Response;
38 47  
39 48 /**
40   - * Api调用日志记录处理
  49 + * API调用日志记录处理
41 50 * @author huaheng
42 51 */
43 52 @Aspect
... ... @@ -64,280 +73,272 @@ public class ApiLogAspect {
64 73 @Pointcut("@annotation(org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger)")
65 74 public void logPointCut() {}
66 75  
67   - @Around("logPointCut() && @annotation(apiLogger)")
  76 + @Around("logPointCut() && @annotation(apiLogger)")
68 77 public Object around(ProceedingJoinPoint point, ApiLogger apiLogger) throws Throwable {
69   - // 实际上静态方法上的Aop注解无法拦截到
70   - if ("WMS".equalsIgnoreCase(apiLogger.from())) {
71   - return aroundWms2XXX(point, apiLogger);
72   - } else {
73   - return aroundXXX2Wms(point, apiLogger);
74   - }
  78 + return aroundXXX2Wms(point, apiLogger);
75 79 }
76 80  
77   - /** 处理xxx调用wms接口的日志 **/
  81 + /** 记录第三方系统调用WMS接口的日志 **/
78 82 private Object aroundXXX2Wms(ProceedingJoinPoint point, ApiLogger apiLogger) {
79 83 Object ret = null;
80   - ApiLog log = initApiLog(apiLogger, point);
  84 + ApiLog apiLog = initApiLog(apiLogger, point);
81 85 try {
82 86 ret = point.proceed();
83 87 } catch (Throwable e) {
84   - setApiLogThrowable(log, e);
  88 + setApiLogThrowable(apiLog, e);
85 89 ret = Result.error(e.getMessage());
86 90 return ret;
87 91 } finally {
88 92 if (ret != null) {
89   - finishApiLog(log, ret);
  93 + finishApiLog(apiLog, ret);
90 94 }
91 95 }
92 96 return ret;
93 97 }
94 98  
95   - /** 处理WMS调用xxx接口的日志 **/
96   - private Object aroundWms2XXX(ProceedingJoinPoint point, ApiLogger apiLogger) {
97   - Object ret = null;
98   - ApiLog log = new ApiLog();
99   -
100   - HttpURLConnection connection = null;
101   - String body = null;
102   -
103   - try {
104   - HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
105   - connection = (HttpURLConnection)point.getArgs()[0];
106   - body = (String)point.getArgs()[1];
107   - initApiLog(connection, body);
108   - ret = point.proceed();
109   - } catch (Throwable e) {
110   - setApiLogThrowable(log, e);
111   - ret = Result.error(e.getMessage());
112   - } finally {
113   - if (ret != null) {
114   - finishApiLog(log, connection, ret.toString());
115   - }
116   - }
117   - return ret;
118   - }
119   -
120   - /**
121   - * 记录响应头信息
122   - **/
123   - public static void finishApiLog(ApiLog log, HttpURLConnection connection, String body) {
124   - try {
125   - log.setResponseBody(body);
126   - log.setResponseTime(new Date());
127   - Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
128   - log.setDuration(duration.intValue());
129   - log.setHttpCode(connection.getResponseCode());
130   -
131   - // 响应头
132   - Set<String> keyset = connection.getHeaderFields().keySet();
133   - ArrayList<String> headerList = new ArrayList<>();
134   - Iterator<String> it = keyset.iterator();
135   - while (it.hasNext()) {
136   - String name = it.next();
137   - String header = connection.getHeaderField(name);
138   - if (name == null || "".equals(name)) {
139   - // 第一行没有name
140   - // HTTP/1.1 200 OK
141   - headerList.add(header);
142   - } else {
143   - headerList.add(name + ": " + header);
144   - }
145   - }
146   - log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
147   - Result json = JSON.parseObject(body, Result.class);
148   - log.setRetCode(json.getCode());
149   - } catch (Exception e) {
150   - e.printStackTrace();
151   - } finally {
152   - SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
153   - }
154   - }
  99 +// /** 记录WMS调用第三方接口的日志 **/
  100 +// private Object aroundWms2XXX(ProceedingJoinPoint point, ApiLogger apiLogger) {
  101 +// Object ret = null;
  102 +// ApiLog log = new ApiLog();
  103 +//
  104 +// HttpURLConnection connection = null;
  105 +// String body = null;
  106 +//
  107 +// try {
  108 +// connection = (HttpURLConnection)point.getArgs()[0];
  109 +// body = (String)point.getArgs()[1];
  110 +// initApiLog(connection, body);
  111 +// ret = point.proceed();
  112 +// } catch (Throwable e) {
  113 +// setApiLogThrowable(log, e);
  114 +// ret = Result.error(e.getMessage());
  115 +// } finally {
  116 +// if (ret != null) {
  117 +// finishApiLog(log, connection, ret.toString());
  118 +// }
  119 +// }
  120 +// return ret;
  121 +// }
  122 +
  123 +// /**
  124 +// * 记录响应头信息,保存日志到数据库
  125 +// */
  126 +// public static void finishApiLog(ApiLog log, HttpURLConnection connection, String body) {
  127 +// try {
  128 +// log.setResponseBody(body);
  129 +// log.setResponseTime(new Date());
  130 +// Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
  131 +// log.setDuration(duration.intValue());
  132 +// log.setHttpCode(connection.getResponseCode());
  133 +//
  134 +// // 响应头
  135 +// Set<String> keyset = connection.getHeaderFields().keySet();
  136 +// ArrayList<String> headerList = new ArrayList<>();
  137 +// Iterator<String> it = keyset.iterator();
  138 +// while (it.hasNext()) {
  139 +// String name = it.next();
  140 +// String header = connection.getHeaderField(name);
  141 +// if (name == null || "".equals(name)) {
  142 +// // 第一行没有name
  143 +// // HTTP/1.1 200 OK
  144 +// headerList.add(header);
  145 +// } else {
  146 +// headerList.add(name + ": " + header);
  147 +// }
  148 +// }
  149 +// log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  150 +// Result json = JSON.parseObject(body, Result.class);
  151 +// log.setRetCode(json.getCode());
  152 +// } catch (Exception e) {
  153 +// e.printStackTrace();
  154 +// } finally {
  155 +// SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
  156 +// }
  157 +// }
  158 +
  159 +// /**
  160 +// * 根据url,从address表中判断调用的去向
  161 +// */
  162 +// public static void parseUrl(ApiLog log, URL url, String warehouseCode) {
  163 +// try {
  164 +// String[] spList = url.toString().split("/");
  165 +// String apiName = spList[spList.length - 1];
  166 +// String ip = JeecgSystemApplication.getLocalHostExactAddress().getHostAddress();
  167 +// Address address = addressService.getAddressByUrl(url.toString(), warehouseCode);
  168 +// log.setApiName(apiName);
  169 +// log.setRequestFrom("WMS");
  170 +// log.setIp(ip);
  171 +// log.setResponseBy(address.getParam().toUpperCase());
  172 +// } catch (Exception e) {
  173 +// e.printStackTrace();
  174 +// }
  175 +// }
  176 +
  177 +// /**
  178 +// * 记录WMS调用第三方系统接口的请求信息
  179 +// * 在HttpUtils.body POST方法中直接调用本类static方法
  180 +// **/
  181 +// public static ApiLog initApiLog(String Method, String urlStr, String body, HttpHeaders headers, String warehouseCode) {
  182 +// ApiLog log = new ApiLog();
  183 +// try {
  184 +// URL url = new URL(urlStr);
  185 +// log.setApiMethod(Method);
  186 +// log.setUrl(urlStr);
  187 +// log.setRequestTime(new Date());
  188 +// parseUrl(log, url, warehouseCode);
  189 +//
  190 +// // 请求头
  191 +// Set<String> keySet = headers.keySet();
  192 +// ArrayList<String> headerList = new ArrayList<>();
  193 +// Iterator<String> it = keySet.iterator();
  194 +// while (it.hasNext()) {
  195 +// String name = it.next();
  196 +// String header = String.valueOf(headers.getContentType());
  197 +// headerList.add(name + ": " + header);
  198 +// }
  199 +//
  200 +// log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  201 +// log.setRequestBody(body);
  202 +// } catch (Exception e) {
  203 +// e.printStackTrace();
  204 +// }
  205 +//
  206 +// return log;
  207 +// }
  208 +
  209 +// /**
  210 +// * 记录WMS调用第三方系统接口的请求信息
  211 +// * 在HttpUtils.body POST方法中直接调用本类static方法
  212 +// **/
  213 +// public static ApiLog initApiLog(HttpURLConnection connection, String body) {
  214 +// ApiLog log = new ApiLog();
  215 +// try {
  216 +// log.setApiMethod(connection.getRequestMethod());
  217 +// log.setUrl(connection.getURL().toString());
  218 +// log.setRequestTime(new Date());
  219 +// parseUrl(log, connection.getURL());
  220 +//
  221 +// // 请求头
  222 +// Set<String> keySet = connection.getRequestProperties().keySet();
  223 +// ArrayList<String> headerList = new ArrayList<>();
  224 +// Iterator<String> it = keySet.iterator();
  225 +// while (it.hasNext()) {
  226 +// String name = it.next();
  227 +// String header = connection.getRequestProperty(name);
  228 +// headerList.add(name + ":" + header);
  229 +// }
  230 +//
  231 +// log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  232 +// log.setRequestBody(body);
  233 +// } catch (Exception e) {
  234 +// e.printStackTrace();
  235 +// }
  236 +//
  237 +// return log;
  238 +// }
155 239  
156 240 /**
157   - * 根据url,从address表中判断调用的去向
  241 + * 记录WMS调用第三方系统接口的请求信息
  242 + * 在OKHttpUtils.bodypost方法中直接调用本类static方法
  243 + * @param apiLog
158 244 **/
159   - public static void parseUrl(ApiLog log, URL url, String warehouseCode) {
  245 + public static void initApiLog(ApiLog apiLog, Request request, String body) {
160 246 try {
161   - String[] spList = url.toString().split("/");
162   - String apiName = spList[spList.length - 1];
163   - int index = url.toString().lastIndexOf(apiName);
164   - String addUrl = url.toString().substring(0, index);
165   -
166   - Address address = addressService.getAddressByUrl(url.toString(), warehouseCode);
167   - log.setApiName(apiName);
168   - log.setRequestFrom("WMS");
169   - log.setResponseBy(address.getParam().toUpperCase());
  247 + apiLog.setApiMethod(request.method());
  248 + apiLog.setUrl(request.url().toString());
  249 + apiLog.setRequestTime(new Date());
  250 + parseUrl(apiLog, request.url().url());
  251 + apiLog.setRequestHeader(request.headers().toString());
  252 + apiLog.setRequestBody(body);
170 253 } catch (Exception e) {
171 254 e.printStackTrace();
172 255 }
173 256 }
174 257  
175   - /**
176   - * 记录WMS调用外接口的请求信息
177   - * 在HttpUtils.bodypost方法中直接调用本类static方法
178   - **/
179   - public static ApiLog initApiLog(String Method, String url, String body, HttpHeaders headers, String warehouseCode) {
180   - ApiLog log = new ApiLog();
181   - try {
182   - URL url1 = new URL(url);
183   - log.setApiMethod(Method);
184   - log.setUrl(url);
185   - log.setRequestTime(new Date());
186   - parseUrl(log, url1, warehouseCode);
187   -
188   - // 请求头
189   - Set<String> keySet = headers.keySet();
190   - ArrayList<String> headerList = new ArrayList<>();
191   - Iterator<String> it = keySet.iterator();
192   - while (it.hasNext()) {
193   - String name = it.next();
194   - String header = String.valueOf(headers.getContentType());
195   - headerList.add(name + ": " + header);
196   - }
197   -
198   - log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
199   - log.setRequestBody(body);
200   - } catch (Exception e) {
201   - e.printStackTrace();
202   - }
203   -
204   - return log;
205   - }
206   -
207   - /**
208   - * 记录WMS调用外接口的请求信息
209   - * 在HttpUtils.bodypost方法中直接调用本类static方法
210   - **/
211   - public static ApiLog initApiLog(HttpURLConnection connection, String body) {
212   - ApiLog log = new ApiLog();
213   - try {
214   - log.setApiMethod(connection.getRequestMethod());
215   - log.setUrl(connection.getURL().toString());
216   - log.setRequestTime(new Date());
217   - parseUrl(log, connection.getURL());
218   -
219   - // 请求头
220   - Set<String> keySet = connection.getRequestProperties().keySet();
221   - ArrayList<String> headerList = new ArrayList<>();
222   - Iterator<String> it = keySet.iterator();
223   - while (it.hasNext()) {
224   - String name = it.next();
225   - String header = connection.getRequestProperty(name);
226   - headerList.add(name + ": " + header);
227   - }
228   -
229   - log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
230   - log.setRequestBody(body);
231   - } catch (Exception e) {
232   - e.printStackTrace();
233   - }
234   -
235   - return log;
236   - }
237   -
238   - /**
239   - * 记录WMS调用外接口的请求信息
240   - * 在HttpUtils.bodypost方法中直接调用本类static方法
241   - **/
242   - public static ApiLog initApiLog(Request request, String body) {
243   - ApiLog log = new ApiLog();
244   - try {
245   - log.setApiMethod(request.method());
246   - log.setUrl(request.url().toString());
247   - log.setRequestTime(new Date());
248   - parseUrl(log, request.url().url());
249   - log.setRequestHeader(request.headers().toString());
250   - log.setRequestBody(body);
251   - } catch (Exception e) {
252   - e.printStackTrace();
253   - }
254   - return log;
255   - }
256   -
257 258 /** 记录响应头信息 **/
258   - public static void finishApiLog(ApiLog log, Response response, String body) {
  259 + public static void finishApiLog(ApiLog log, Response response, String responseBody) {
259 260 try {
260   - log.setResponseBody(body);
261 261 log.setResponseTime(new Date());
262 262 Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
263 263 log.setDuration(duration.intValue());
  264 + if (response == null) {
  265 + return;
  266 + }
264 267 log.setHttpCode(response.code());
265   -
266   - // 响应头
267 268 log.setResponseHeader(response.headers().toString());
268   - Result ajaxResult = null;
  269 + log.setResponseBody(responseBody);
  270 + Result result = null;
269 271 try {
270   - ajaxResult = JSON.parseObject(body, Result.class);
  272 + result = JSON.parseObject(responseBody, Result.class);
271 273 } catch (Exception ex) {
272   - body = JSON.parse(body).toString();
273   - ajaxResult = JSON.parseObject(body, Result.class);
  274 + responseBody = JSON.parse(responseBody).toString();
  275 + result = JSON.parseObject(responseBody, Result.class);
274 276 }
275   - log.setRetCode(ajaxResult.getCode());
  277 + log.setRetCode(result.getCode());
276 278 } catch (Exception e) {
277 279 e.printStackTrace();
278 280 } finally {
279 281 try {
280 282 if (StringUtils.isNotEmpty(log.getResponseBody()) && log.getResponseBody().length() > 2001) {
281   - log.setResponseBody(log.getResponseBody().substring(0, 2000) + "\n太长了...后面省略。\n" + log.getResponseBody().length());
  283 + log.setResponseBody(log.getResponseBody().substring(0, 2000) + "...\n");
282 284 }
283 285 } catch (Exception e) {
284   -
  286 + e.printStackTrace();
285 287 }
286 288 SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
287 289 }
288 290 }
289 291  
290 292 /** 根据url,从address表中判断调用的去向 **/
291   - public static void parseUrl(ApiLog log, URL url) {
  293 + public static void parseUrl(ApiLog apiLog, URL url) {
292 294 try {
293 295 String[] spList = url.toString().split("/");
294 296 String apiName = spList[spList.length - 1];
295   - int index = url.toString().lastIndexOf(apiName);
296   - String addUrl = url.toString().substring(0, index);
297   -
298   - Address address = addressService.getAddressByUrl(url.toString(), QuantityConstant.DEFAULT_WAREHOUSE);
299   - log.setApiName(apiName);
300   - log.setRequestFrom("WMS");
301   - log.setResponseBy(address.getParam().toUpperCase());
  297 + String ip = JeecgSystemApplication.getLocalHostExactAddress().getHostAddress();
  298 + apiLog.setApiName(apiName);
  299 + apiLog.setRequestFrom(HuahengJwtUtil.HUAHENG_SYSTEM_ID);
  300 + apiLog.setIp(ip);
  301 +// Address address = addressService.getAddressByUrl(url.toString(), QuantityConstant.DEFAULT_WAREHOUSE);
  302 +// apiLog.setResponseBy(address.getParam().toUpperCase());
302 303 } catch (Exception e) {
303 304 e.printStackTrace();
304 305 }
305 306 }
306 307  
307   - /**
308   - * 记录响应头信息
309   - **/
310   - public static void finishApiLog(ApiLog log, HttpHeaders headers, String body) {
311   - try {
312   - log.setResponseBody(body);
313   - log.setResponseTime(new Date());
314   - Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
315   - log.setDuration(duration.intValue());
316   - log.setHttpCode(200);
317   -
318   - // 响应头
319   - Set<String> keyset = headers.keySet();
320   - ArrayList<String> headerList = new ArrayList<>();
321   - Iterator<String> it = keyset.iterator();
322   - while (it.hasNext()) {
323   - String name = it.next();
324   - String header = String.valueOf(headers.getContentType());
325   - if (name == null || "".equals(name))
326   - // 第一行没有name
327   - // HTTP/1.1 200 OK
328   - headerList.add(header);
329   - else
330   - headerList.add(name + ": " + header);
331   - }
332   - log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
333   - Result json = JSON.parseObject(body, Result.class);
334   - log.setRetCode(json.getCode());
335   - } catch (Exception e) {
336   - e.printStackTrace();
337   - } finally {
338   - SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
339   - }
340   - }
  308 +// /**
  309 +// * 记录响应头信息
  310 +// **/
  311 +// public static void finishApiLog(ApiLog log, HttpHeaders headers, String body) {
  312 +// try {
  313 +// log.setResponseBody(body);
  314 +// log.setResponseTime(new Date());
  315 +// Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
  316 +// log.setDuration(duration.intValue());
  317 +// log.setHttpCode(200);
  318 +//
  319 +// // 响应头
  320 +// Set<String> keyset = headers.keySet();
  321 +// ArrayList<String> headerList = new ArrayList<>();
  322 +// Iterator<String> it = keyset.iterator();
  323 +// while (it.hasNext()) {
  324 +// String name = it.next();
  325 +// String header = String.valueOf(headers.getContentType());
  326 +// if (name == null || "".equals(name))
  327 +// // 第一行没有name
  328 +// // HTTP/1.1 200 OK
  329 +// headerList.add(header);
  330 +// else
  331 +// headerList.add(name + ": " + header);
  332 +// }
  333 +// log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  334 +// Result json = JSON.parseObject(body, Result.class);
  335 +// log.setRetCode(json.getCode());
  336 +// } catch (Exception e) {
  337 +// e.printStackTrace();
  338 +// } finally {
  339 +// SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
  340 +// }
  341 +// }
341 342  
342 343 private ApiLog initApiLog(ApiLogger apiLogger, ProceedingJoinPoint point) {
343 344 ApiLog log = new ApiLog();
... ... @@ -348,19 +349,16 @@ public class ApiLogAspect {
348 349 log.setApiName(apiLogger.apiName());
349 350  
350 351 HttpServletRequest request = ServletUtils.getRequest();
351   -
352 352 String qryStr = request.getQueryString();
353 353 String url = request.getRequestURL().toString();
354 354 if (StringUtils.isNotEmpty(qryStr)) {
355 355 url = url + "?" + qryStr;
356 356 }
357 357 log.setUrl(url);
358   -
359 358 log.setApiMethod(request.getMethod());
360   - log.setIp(request.getRemoteAddr());
  359 + log.setIp(this.getIpAddr(request));
361 360  
362 361 rebuildRequestHeader(log);
363   -
364 362 rebuildRequestBody(log, request);
365 363  
366 364 // 如果reqeust中取不到post参数,就从接口方法参数中取json对象
... ... @@ -401,17 +399,17 @@ public class ApiLogAspect {
401 399 public static void setApiLogException(ApiLog log, Exception e) {
402 400 try {
403 401 String exception = ExceptionUtils.getFullStackTrace(e);
404   - String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000);
  402 + String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000) + "...";
405 403 log.setException(shortExpInfo);
406 404 } catch (Exception ex) {
407 405 ex.printStackTrace();
408 406 }
409 407 }
410   -
  408 +
411 409 public static void setApiLogThrowable(ApiLog log, Throwable e) {
412 410 try {
413 411 String exception = ExceptionUtils.getFullStackTrace(e);
414   - String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000);
  412 + String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000) + "...";
415 413 log.setException(shortExpInfo);
416 414 } catch (Exception ex) {
417 415 ex.printStackTrace();
... ... @@ -426,7 +424,7 @@ public class ApiLogAspect {
426 424 while (names.hasMoreElements()) {
427 425 String name = (String)names.nextElement();
428 426 String header = req.getHeader(name);
429   - headerList.add(name + ": " + header);
  427 + headerList.add(name + ":" + header);
430 428 }
431 429 String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n");
432 430 log.setRequestHeader(headers);
... ... @@ -524,4 +522,35 @@ public class ApiLogAspect {
524 522 e.printStackTrace();
525 523 }
526 524 }
  525 +
  526 + public String getIpAddr(HttpServletRequest request) {
  527 + String ipAddress = request.getHeader("x-forwarded-for");
  528 + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
  529 + ipAddress = request.getHeader("Proxy-Client-IP");
  530 + }
  531 + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
  532 + ipAddress = request.getHeader("WL-Proxy-Client-IP");
  533 + }
  534 + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
  535 + ipAddress = request.getRemoteAddr();
  536 + if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) {
  537 + // 根据网卡取本机配置的IP
  538 + InetAddress inet = null;
  539 + try {
  540 + inet = InetAddress.getLocalHost();
  541 + } catch (UnknownHostException e) {
  542 + e.printStackTrace();
  543 + }
  544 + ipAddress = inet.getHostAddress();
  545 + }
  546 + }
  547 + // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
  548 + // "***.***.***.***".length() = 15
  549 + if (ipAddress != null && ipAddress.length() > 15) {
  550 + if (ipAddress.indexOf(",") > 0) {
  551 + ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
  552 + }
  553 + }
  554 + return ipAddress;
  555 + }
527 556 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/PassApiAuthentication.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj;
  2 +
  3 +import java.lang.annotation.ElementType;
  4 +import java.lang.annotation.Retention;
  5 +import java.lang.annotation.RetentionPolicy;
  6 +import java.lang.annotation.Target;
  7 +
  8 +/**
  9 + * 跳过API身份验证注解
  10 + * @author TanYibin
  11 + * @createDate 2023年2月13日
  12 + */
  13 +@Target({ElementType.METHOD, ElementType.TYPE})
  14 +@Retention(RetentionPolicy.RUNTIME)
  15 +public @interface PassApiAuthentication {
  16 + boolean required() default true;
  17 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/dto/ApiAuthentication.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import org.jeecg.utils.HuahengJwtUtil;
  6 +
  7 +import cn.hutool.core.date.DatePattern;
  8 +import cn.hutool.core.date.DateUtil;
  9 +import lombok.Data;
  10 +
  11 +/**
  12 + * 接口认证Token生成对象
  13 + * @author TanYibin
  14 + * @createDate 2023年2月14日
  15 + */
  16 +@Data
  17 +public class ApiAuthentication {
  18 +
  19 + /** Token提供方 */
  20 + private String operator;
  21 +
  22 + /** Token使用方 */
  23 + private String audience; // 观众,相当于接受者
  24 +
  25 + /** Token签发方(WMS) */
  26 + private String issuer = HuahengJwtUtil.HUAHENG_SYSTEM_ID;
  27 +
  28 + /** 失效时间 */
  29 + private Date expireDateTime;
  30 +
  31 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/dto/RSA256Key.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.dto;
  2 +
  3 +import java.security.interfaces.RSAPrivateKey;
  4 +import java.security.interfaces.RSAPublicKey;
  5 +
  6 +import org.jeecg.utils.SecretKeyUtils;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +import lombok.Data;
  10 +
  11 +@Data
  12 +@Component
  13 +public class RSA256Key {
  14 +
  15 + /** 第三方HTTP访问 公钥 */
  16 + private RSAPublicKey publicKey =
  17 + (RSAPublicKey)SecretKeyUtils.getPublicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmYcmhWzpgLgWVD0j+uTyFvQW0BBktYVJmTRQvLlrKt4CHnkfQ4Dn"
  18 + + "SLaRXCcJK/TGgAY0BtnaKUgFBqqmTI9l82tpxEWqYRzp4KGRLnVA6/igidYib0JeBWroI6Bs0wR43fkSXA8XG+n32bVbmMTKNa9IFUJCzICVTEjQzMQrSAwIDAQAB");
  19 +
  20 + /** 第三方HTTP访问 私钥 */
  21 + private RSAPrivateKey privateKey =
  22 + (RSAPrivateKey)SecretKeyUtils.getPrivateKey("MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKZhyaFbOmAuBZUPSP65PIW9BbQEGS1hUmZNFC8uWsq"
  23 + + "3gIeeR9DgOdItpFcJwkr9MaABjQG2dopSAUGqqZMj2Xza2nERaphHOngoZEudUDr+KCJ1iJvQl4FaugjoGzTBHjd+RJcDxcb6ffZtVuYxMo1r0gVQkLMgJVMSNDMxCtID"
  24 + + "AgMBAAECgYBhxluIMCVI+iKbqyTZVB/l8+PTGwl0qpmStr8iztnaASZODEzlya8Q/XNzFrAQA2TTQ7YKiKB2vqQwY8tNRab7jpR4t5WPApDVrMvjPfvqVvBsPzTYr2c08"
  25 + + "xMfqcj5HNzPLisb7Wvi7URSL4jIY/106lXN+9cJuMV0oDZzcAhaYQJBANdNMlSnzTDF8VQ7ETpzZQrF0UzlqKeKG0Pz/YeTXT4IjyBhzvaSOF3+hi1cWucrSU0xMUAR9F"
  26 + + "av+K1BlPTYW/MCQQDF1UqEAY7YGzpUZK311ECO12ysb0oMt2jTYMwmgPnfPZfctD6SlV3u/JtsgE+bN5dXwV0ktyfP/3vl395zGoWxAkEAt/bQMKGIpEoeILivyd/b0E6"
  27 + + "ivi/l4fIRxghu8y8plt29Xg/0xZ6+5yGaCJxHWAsWgQytZm9w9bk6pN/KpUNRnQJAbQS72oDNSdO/UhBlOOntZYnbTi7J3LYZoxpdhf5fNCFKFYqSTM7ZA8DamXEf7UY2"
  28 + + "NVrOTFROMTX1/dhfSojcEQJBALNxIrEP97uszxIc8oH2r7DfXzmhRMKuIvnBfmNe1TR" + "VLvh1G1SKIyCYUTStaQCFN0FcH//Fab+zPiAgDmXApWs=");
  29 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/HuahengBaseController.java
... ... @@ -5,7 +5,7 @@ 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.utils.RedissonDistributedLocker;
  8 +import org.jeecg.utils.support.RedissonDistributedLocker;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10  
11 11 import cn.hutool.core.date.SystemClock;
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/TestController.java
... ... @@ -11,6 +11,7 @@ import org.jeecg.common.api.vo.Result;
11 11 import org.jeecg.common.aspect.annotation.AutoLog;
12 12 import org.jeecg.modules.system.entity.SysDataLog;
13 13 import org.jeecg.modules.system.service.ISysDataLogService;
  14 +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
14 15 import org.jeecg.utils.HuahengRedisUtil;
15 16 import org.springframework.beans.factory.annotation.Autowired;
16 17 import org.springframework.transaction.annotation.Transactional;
... ... @@ -33,7 +34,6 @@ import lombok.extern.slf4j.Slf4j;
33 34 */
34 35 @Slf4j
35 36 @RestController
36   -@RequestMapping("/test")
37 37 public class TestController extends HuahengBaseController {
38 38  
39 39 @Autowired
... ... @@ -41,10 +41,21 @@ public class TestController extends HuahengBaseController {
41 41  
42 42 @Autowired
43 43 private ISysDataLogService sysDataLogService;
  44 +
  45 +
  46 +// @ApiLogger(apiName = "API接口第三方Token校验测试", from = "TEST")
  47 +// @ResponseBody
  48 +// @PostMapping(value = "/api/wms/testTokenCheck")
  49 +// public Result<?> testTokenCheck(@RequestBody Map<String, String> paramMap, HttpServletRequest request) {
  50 +//
  51 +//
  52 +// return new Result<>();
  53 +// }
  54 +
44 55  
45 56 @AutoLog(value = "TestController-testRedis")
46 57 @ResponseBody
47   - @PostMapping(value = "/testRedis")
  58 + @PostMapping(value = "/test/testRedis")
48 59 public Result<?> testRedis(@RequestBody Map<String, String> paramMap, HttpServletRequest request) {
49 60  
50 61 // log.info("testRedis in paramMap:{}", JSON.toJSONString(paramMap));
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/home/service/impl/HomePageViewServiceImpl.java
... ... @@ -26,6 +26,8 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail;
26 26 import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader;
27 27 import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryDetailServiceImpl;
28 28 import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryHeaderServiceImpl;
  29 +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction;
  30 +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.impl.InventoryTransactionServiceImpl;
29 31 import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader;
30 32 import org.jeecg.modules.wms.receipt.receiptHeader.service.impl.ReceiptHeaderServiceImpl;
31 33 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
... ... @@ -72,38 +74,71 @@ public class HomePageViewServiceImpl implements HomePageViewService {
72 74 TaskHeaderServiceImpl taskHeaderService;
73 75 @Resource
74 76 HomePageViewService homePageViewService;
  77 + @Resource
  78 + InventoryTransactionServiceImpl inventoryTransactionServiceImpl;
75 79  
76 80 @Override
77 81 public Result<String> deliveringAmount() {
  82 + //通过库存交易记录来查询
  83 + LambdaQueryWrapper<InventoryTransaction> inventoryTransactionLambdaQueryWrapper = Wrappers.lambdaQuery();
  84 + inventoryTransactionLambdaQueryWrapper.select(InventoryTransaction::getCreateTime, InventoryTransaction::getQty,InventoryTransaction::getType);
  85 + List<InventoryTransaction> inventoryTransactions = inventoryTransactionServiceImpl.list(inventoryTransactionLambdaQueryWrapper);
  86 +
  87 +
78 88 // 查询出库单的7天出库量
79   - LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
80   - shipmentHeaderLambdaQueryWrapper.select(ShipmentHeader::getCreateTime, ShipmentHeader::getTotalQty);
81   - List<ShipmentHeader> shipmentHeaders = shipmentHeaderServiceImpl.list(shipmentHeaderLambdaQueryWrapper);
  89 + List<InventoryTransaction> shipmentHeaders=new ArrayList<>();
  90 + shipmentHeaders.addAll(inventoryTransactions);
  91 + shipmentHeaders.removeIf(Inventory->Inventory.getType()!=20);
82 92 LinkedHashMap<String, String> list = new LinkedHashMap<>();
83 93  
84 94 for (int i = 6; i >= 0; i--) {
85   - List<ShipmentHeader> shipmentHeadersCop = shipmentHeaders;
86 95 String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() - (1000 * 60 * 60 * 24) * i).toString();
87   - List<ShipmentHeader> collect = shipmentHeadersCop.stream()
  96 + List<InventoryTransaction> collect = shipmentHeaders.stream()
88 97 .filter(shipmentHeader -> new SimpleDateFormat("yyyy-MM-dd").format(shipmentHeader.getCreateTime()).toString().contains(today))
89 98 .collect(Collectors.toList());
90   - list.put(today, String.valueOf(collect.size()));
  99 + if (collect.size()!=0)
  100 + {
  101 + BigDecimal sum=new BigDecimal(0);
  102 + for (InventoryTransaction item : collect)
  103 + {
  104 + sum=sum.add(item.getQty());
  105 + }
  106 + list.put(today,String.valueOf(sum));
  107 + }else
  108 + {
  109 + list.put(today,"0");
  110 + }
  111 +
91 112 }
92 113  
93 114 // 查询入库单的7天入库量
94   - LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
95   - receiptHeaderLambdaQueryWrapper.select(ReceiptHeader::getCreateTime, ReceiptHeader::getTotalqty);
96   - List<ReceiptHeader> receiptHeaders = receiptHeaderServiceImpl.list(receiptHeaderLambdaQueryWrapper);
  115 +
  116 + List<InventoryTransaction> receiptHeaders = new ArrayList<>();
  117 + receiptHeaders.addAll(inventoryTransactions);
  118 + receiptHeaders.removeIf(Inventory->Inventory.getType()!=10);
97 119 LinkedHashMap<String, String> list2 = new LinkedHashMap<>();
98 120 for (int i = 6; i >= 0; i--) {
99   - List<ReceiptHeader> receiptHeadersCop = receiptHeaders;
  121 + List<InventoryTransaction> receiptHeadersCop = receiptHeaders;
100 122 String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() - (1000 * 60 * 60 * 24) * i).toString();
101   - List<ReceiptHeader> collect = receiptHeadersCop.stream()
  123 + List<InventoryTransaction> collect = receiptHeadersCop.stream()
102 124 .filter(ReceiptHeader -> new SimpleDateFormat("yyyy-MM-dd").format(ReceiptHeader.getCreateTime()).toString().contains(today))
103 125 .collect(Collectors.toList());
104   - list2.put(today, String.valueOf(collect.size()));
  126 + if (collect.size()!=0)
  127 + {
  128 + BigDecimal sum=new BigDecimal(0);
  129 + for (InventoryTransaction item : collect)
  130 + {
  131 + sum=sum.add(item.getQty());
  132 + }
  133 + list2.put(today,String.valueOf(sum));
  134 + }else
  135 + {
  136 + list2.put(today,"0");
  137 + }
105 138 }
106 139  
  140 +
  141 +
107 142 Option option = new Option();
108 143 option.tooltip().trigger(Trigger.axis).axisPointer().type(PointerType.cross);
109 144 option.grid().setLeft("3%");
... ... @@ -148,12 +183,12 @@ public class HomePageViewServiceImpl implements HomePageViewService {
148 183 public Result<String> inventoryUtilization() {
149 184 // 先存储总数
150 185 Integer allStock = locationServiceImpl.count();
151   -
  186 +
152 187 // 有货数量 = 总库位删除为空的数量长度
153 188 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
154 189 locationLambdaQueryWrapper.isNotNull(Location::getContainerCode).ne(Location::getContainerCode, "");
155 190 int locationStock = locationServiceImpl.count(locationLambdaQueryWrapper);
156   -
  191 +
157 192 // 无货数量 = 总数 - 有货数量
158 193 Integer inStock = allStock - locationStock;
159 194 Option option = new Option();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... ... @@ -135,9 +135,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
135 135 }
136 136 }
137 137 if (over) {
138   - return Result.OK("出库单已经配盘");
  138 + return Result.OK("出库单已经配盘", null);
139 139 }
140   - return Result.OK("自动组盘成功");
  140 + return Result.OK("自动组盘成功", null);
141 141 }
142 142  
143 143 @Override
... ... @@ -210,7 +210,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
210 210 throw new ServiceException(result.getMessage());
211 211 }
212 212 }
213   - return Result.OK("自动组盘成功");
  213 + return Result.OK("自动组盘成功", null);
214 214 }
215 215  
216 216 @Override
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java
... ... @@ -14,6 +14,7 @@ import javax.annotation.Resource;
14 14 import javax.servlet.http.HttpServletRequest;
15 15  
16 16 import org.apache.shiro.authz.annotation.RequiresPermissions;
  17 +import org.jeecg.modules.system.entity.SysAnnouncementSend;
17 18 import org.jeecg.modules.wms.framework.controller.HuahengBaseController;
18 19 import javax.servlet.http.HttpServletResponse;
19 20  
... ... @@ -89,7 +90,10 @@ public class CycleCountDetailController extends HuahengBaseController {
89 90 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
90 91 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
91 92 HttpServletRequest req) {
92   - QueryWrapper<CycleCountDetail> queryWrapper = QueryGenerator.initQueryWrapper(cycleCountDetail, req.getParameterMap());
  93 +
  94 +
  95 + LambdaQueryWrapper<CycleCountDetail> queryWrapper = new LambdaQueryWrapper<CycleCountDetail>();
  96 + queryWrapper.eq(CycleCountDetail::getCycleCountHeadId,cycleCountDetail.getCycleCountHeadId());
93 97 Page<CycleCountDetail> page = new Page<CycleCountDetail>(pageNo, pageSize);
94 98 IPage<CycleCountDetail> pageList = cycleCountDetailService.page(page, queryWrapper);
95 99 return Result.OK(pageList);
... ... @@ -216,6 +220,7 @@ public class CycleCountDetailController extends HuahengBaseController {
216 220 }
217 221 });
218 222 }
  223 + result.setResult(headerId);
219 224 return result;
220 225  
221 226 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java
... ... @@ -94,7 +94,7 @@ public class CycleCountDetail implements Serializable {
94 94 /**完成时间*/
95 95 @Excel(name = "完成时间", width = 15)
96 96 @ApiModelProperty(value = "完成时间")
97   - private String completedAt;
  97 + private Date completedAt;
98 98 /**盘点明细状态*/
99 99 @Excel(name = "盘点明细状态", width = 15)
100 100 @ApiModelProperty(value = "盘点明细状态")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java
... ... @@ -8,6 +8,8 @@ import lombok.Data;
8 8 import com.fasterxml.jackson.annotation.JsonFormat;
9 9 import org.springframework.format.annotation.DateTimeFormat;
10 10 import org.jeecgframework.poi.excel.annotation.Excel;
  11 +
  12 +import java.math.BigDecimal;
11 13 import java.util.Date;
12 14 import org.jeecg.common.aspect.annotation.Dict;
13 15 import io.swagger.annotations.ApiModel;
... ... @@ -69,19 +71,31 @@ public class CycleCountDetailChild implements Serializable {
69 71 /**系统数量*/
70 72 @Excel(name = "系统数量", width = 15)
71 73 @ApiModelProperty(value = "系统数量")
72   - private Integer systemQty;
  74 + private BigDecimal systemQty;
73 75 /**实盘数量*/
74 76 @Excel(name = "实盘数量", width = 15)
75 77 @ApiModelProperty(value = "实盘数量")
76   - private Integer countedQty;
  78 + private BigDecimal countedQty;
77 79 /**差异数量*/
78 80 @Excel(name = "差异数量", width = 15)
79 81 @ApiModelProperty(value = "差异数量")
80   - private Integer gapQty;
  82 + private BigDecimal gapQty;
81 83 /**库存明细id*/
82 84 @Excel(name = "库存明细id", width = 15)
83 85 @ApiModelProperty(value = "库存明细id")
84 86 private Integer inventoryDetaiId;
  87 + /**批次*/
  88 + @Excel(name = "批次*/", width = 15)
  89 + @ApiModelProperty(value = "批次*/")
  90 + private String batch;
  91 + /**批号*/
  92 + @Excel(name = "批号", width = 15)
  93 + @ApiModelProperty(value = "批号")
  94 + private String lot;
  95 + /**库存状态*/
  96 + @Excel(name = "库存状态", width = 15)
  97 + @ApiModelProperty(value = "库存状态")
  98 + private String inventoryStatus;
85 99 /**创建人*/
86 100 @ApiModelProperty(value = "创建人")
87 101 private String createBy;
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
... ... @@ -42,8 +42,8 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
42 42 public Result confirmGapQty(String id, String countedQty) {
43 43 //接收子单ID和实盘数量
44 44 //任务未完成可多次登记。
45   - int qty=Integer.valueOf(id);
46   - if(qty < 0){
  45 + BigDecimal qty=new BigDecimal(countedQty);
  46 + if(qty.compareTo(BigDecimal.ZERO) == -1){
47 47 return Result.error("实盘登记数不能小于0");
48 48 }
49 49 //明细子单据
... ... @@ -64,7 +64,7 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
64 64 return Result.error("盘点任务完成后不能再登记数量!");
65 65 }
66 66 //实盘登记后差异数量
67   - int adjQty = qty-countDetailChild.getSystemQty();
  67 + BigDecimal adjQty = qty.subtract(countDetailChild.getSystemQty());
68 68 countDetailChild.setGapQty(adjQty);
69 69 countDetailChild.setCountedQty(qty);
70 70 countDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... ... @@ -119,13 +119,29 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
119 119 inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId,taskId);
120 120 List<InventoryDetail> inventoryDetails = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
121 121  
  122 + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
  123 + locationLambdaQueryWrapper.eq(Location::getCode, inventoryDetails.get(0).getLocationCode())
  124 + .eq(Location::getWarehouseCode, inventoryDetails.get(0).getWarehouseCode())
  125 + .ne(Location::getStatus, QuantityConstant.STATUS_LOCATION_LOCK);
  126 + Location location = locationService.getOne(locationLambdaQueryWrapper);
  127 + if (StringUtils.isNull(location)) {
  128 + return Result.error("库位已锁定!");
  129 + }
  130 +
  131 + LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
  132 +
  133 +
122 134 CycleCountDetail cycleCountDetail = new CycleCountDetail();
123   - cycleCountDetail.setInventoryHeaderId(headerId);
  135 + cycleCountDetail.setCycleCountHeadId(headerId);
  136 + cycleCountDetail.setContainerCode(inventoryDetails.get(0).getContainerCode());
  137 +
  138 +
  139 +
124 140 cycleCountDetail.setCycleCountHeadCode(code);
125 141 cycleCountDetail.setCompanyCode(inventoryDetails.get(0).getCompanyCode());
  142 + cycleCountDetail.setWarehouseCode(inventoryDetails.get(0).getWarehouseCode());
126 143 cycleCountDetail.setInventoryHeaderId(inventoryDetails.get(0).getInventoryHeaderId());
127 144 cycleCountDetail.setLocationCode(inventoryDetails.get(0).getLocationCode());
128   - cycleCountDetail.setContainerCode(inventoryDetails.get(0).getContainerCode());
129 145 cycleCountDetail.setInventorySts(inventoryDetails.get(0).getInventoryStatus());
130 146 cycleCountDetail.setSystemQty(inventoryDetails.size());
131 147 cycleCountDetail.setCountedQty(0);
... ... @@ -146,9 +162,12 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
146 162 cycleCountDetailChild.setMaterialName(inventoryDetail.getMaterialName());
147 163 cycleCountDetailChild.setMaterialSpec(inventoryDetail.getMaterialSpec());
148 164 cycleCountDetailChild.setMaterialUnit(inventoryDetail.getMaterialUnit());
149   - cycleCountDetailChild.setSystemQty(inventoryDetail.getQty().intValue());
150   - cycleCountDetailChild.setCountedQty(0);
151   - cycleCountDetailChild.setGapQty(0);
  165 + cycleCountDetailChild.setInventoryStatus(inventoryDetail.getInventoryStatus());
  166 + cycleCountDetailChild.setBatch(inventoryDetail.getBatch());
  167 + cycleCountDetailChild.setLot(inventoryDetail.getLot());
  168 + cycleCountDetailChild.setSystemQty(inventoryDetail.getQty());
  169 + cycleCountDetailChild.setCountedQty(BigDecimal.ZERO);
  170 + cycleCountDetailChild.setGapQty(BigDecimal.ZERO);
152 171 cycleCountDetailChild.setInventoryDetaiId(inventoryDetail.getId());
153 172 cycleCountDetailChildServiceImpl.save(cycleCountDetailChild);
154 173 }
... ... @@ -205,6 +224,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
205 224 task.setFromLocationCode(cycleCountDetail.getLocationCode());
206 225 task.setToPortCode("P10");
207 226 task.setSequenceNumber(1);
  227 + task.setShipmentContainerHeaderId(cycleCoutDetailId);
208 228 task.setSequence(1);
209 229 task.setShipmentOrder(System.currentTimeMillis());
210 230  
... ... @@ -231,7 +251,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
231 251 taskDetail.setMaterialName(item.getMaterialName());
232 252 taskDetail.setMaterialSpec(item.getMaterialSpec());
233 253 taskDetail.setMaterialUnit(item.getMaterialUnit());
234   - taskDetail.setQty(new BigDecimal(item.getSystemQty()));
  254 + taskDetail.setQty(item.getSystemQty());
235 255 //taskDetail.setBatch(cycleCountDetail.getBatch());
236 256 //taskDetail.setFromInventoryId(cycleCountDetail.getInventoryDetailId());
237 257 //taskDetail.setLot(cycleCountDetail.getLot());
... ... @@ -263,13 +283,17 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
263 283  
264 284  
265 285  
266   - LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
267   - lambdaQueryWrapper.eq(InventoryDetail::getContainerCode,task.getContainerCode());
268   - List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper);
  286 +// LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
  287 +// lambdaQueryWrapper.eq(InventoryDetail::getContainerCode,task.getContainerCode());
  288 +// List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper);
269 289  
270 290  
  291 + Result result = new Result();
  292 + result.setResult(cycleCountHeader.getId());
  293 + result.setCode(200);
  294 + result.setMessage("盘点任务生成成功");
271 295  
272   - return Result.ok("盘点任务生成成功");
  296 + return result;
273 297 }
274 298  
275 299  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/ICycleCountHeaderService.java
... ... @@ -13,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 13 public interface ICycleCountHeaderService extends IService<CycleCountHeader> {
14 14  
15 15 public Result<CycleCountHeader> saveCycleCountHeader(CycleCountHeader cycleCountHeader);
  16 +
  17 + void updataHeaderStatus(String cycleCountHeadCode);
16 18 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/impl/CycleCountHeaderServiceImpl.java
... ... @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6 import org.jeecg.common.api.vo.Result;
7 7 import org.jeecg.modules.wms.config.receiptType.entity.ReceiptType;
8 8 import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader;
  9 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail;
  10 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl.CycleCountDetailServiceImpl;
9 11 import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader;
10 12 import org.jeecg.modules.wms.stocktaking.cycleCountHeader.mapper.CycleCountHeaderMapper;
11 13 import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.ICycleCountHeaderService;
... ... @@ -16,8 +18,12 @@ import org.springframework.stereotype.Service;
16 18 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
17 19 import org.springframework.transaction.annotation.Transactional;
18 20  
  21 +import javax.annotation.Resource;
19 22 import java.text.SimpleDateFormat;
  23 +import java.util.Comparator;
20 24 import java.util.Date;
  25 +import java.util.List;
  26 +import java.util.stream.Collectors;
21 27  
22 28 /**
23 29 * @Description: 盘点主表
... ... @@ -28,6 +34,12 @@ import java.util.Date;
28 34 @Service
29 35 public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMapper, CycleCountHeader> implements ICycleCountHeaderService {
30 36  
  37 +
  38 +
  39 +
  40 + @Resource
  41 + private CycleCountDetailServiceImpl cycleCountDetailService;
  42 +
31 43 @Override
32 44 public Result<CycleCountHeader> saveCycleCountHeader(CycleCountHeader cycleCountHeader) {
33 45 String code = createCode(QuantityConstant.SHIPMENT_BILL_TYPE_PD);
... ... @@ -43,6 +55,55 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
43 55 return Result.OK("添加成功!", cycleCountHeader);
44 56 }
45 57  
  58 + @Override
  59 + public void updataHeaderStatus(String cycleCountHeaderCode) {
  60 + //查询明细单状态,然后更新主单状态
  61 + //执行中时,对比主单状态,比主单数值小的不改变主单,明细单大于主单状态时改变主单状态到和明细单相同
  62 + //完成时在全部单据都完成后才能修改主单状态为完成
  63 + //当其中一条明细有差异时,主单为有差异状态
  64 + CycleCountHeader cyclecountHeader = new CycleCountHeader();
  65 + cyclecountHeader.setCode(cycleCountHeaderCode);
  66 +// cyclecountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());
  67 + LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cyclecountHeader);
  68 + cyclecountHeader = this.getOne(lamb);
  69 + if(StringUtils.isNull(cyclecountHeader)){
  70 + throw new ServiceException("没有找到盘点主单!");
  71 + }
  72 + CycleCountDetail temp = new CycleCountDetail();
  73 + temp.setCycleCountHeadCode(cyclecountHeader.getCode());
  74 + temp.setWarehouseCode(cyclecountHeader.getWarehouseCode());
  75 + //temp.setCompanyCode(cyclecountHeader.getCompanyCode());
  76 + LambdaQueryWrapper<CycleCountDetail> lam = Wrappers.lambdaQuery(temp);
  77 + List<CycleCountDetail> list = cycleCountDetailService.list(lam);
  78 + if(list.size() < 1){
  79 + throw new ServiceException("明细为空!");
  80 + }
  81 + //当有子单的状态为100时触发主单的完成状态
  82 + //100状态只有全部完成才写入主单
  83 + long count100 = list.stream().filter(t-> t.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)).count(); //明细已完成的条数
  84 + if(count100 == list.size() ){
  85 + cyclecountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED);
  86 + this.updateById(cyclecountHeader);
  87 + }
  88 + //有任何子单没有完成则主单不修改为100
  89 + //有到100的子单时,主单的状态一定是100的前一个状态,所以状态不变
  90 + if(count100 == 0){
  91 + //所有子单状态比较主单状态,只有在明细单大于主单状态时才更改主单状态
  92 + int headerStatus = cyclecountHeader.getStatusCyc();
  93 + long count = list.stream().filter(t->t.getEnableStatus() > headerStatus).count();
  94 + if(count > 0 ){
  95 + //stream流取出明细状态中最大的值,赋给主单状态
  96 + List<CycleCountDetail> cycleCountDetailList = list.stream().sorted(
  97 + Comparator.comparing(CycleCountDetail::getEnableStatus).reversed()).collect(Collectors.toList());
  98 + cyclecountHeader.setStatusCyc(cycleCountDetailList.get(0).getEnableStatus());
  99 + this.updateById(cyclecountHeader);
  100 + }
  101 +
  102 + }
  103 +
  104 +
  105 + }
  106 +
46 107  
47 108 @Transactional
48 109 public String createCode(String receiptType) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
... ... @@ -25,6 +25,7 @@ import org.jeecg.modules.wms.config.port.entity.Port;
25 25 import org.jeecg.modules.wms.config.port.service.IPortService;
26 26 import org.jeecg.modules.wms.config.zone.entity.Zone;
27 27 import org.jeecg.modules.wms.config.zone.service.IZoneService;
  28 +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
28 29 import org.jeecg.modules.wms.framework.controller.HuahengBaseController;
29 30 import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail;
30 31 import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
... ... @@ -648,4 +649,46 @@ public class TaskHeaderController extends HuahengBaseController {
648 649 return Result.OK(portList);
649 650 }
650 651  
  652 + /**
  653 + * 修复空出的数据
  654 + * @return
  655 + */
  656 + @AutoLog(value = "修复空出的数据")
  657 + @PostMapping("/handleEmptyOut")
  658 + @ApiOperation("修复空出的数据")
  659 + @ResponseBody
  660 + @ApiLogger(apiName = "修复空出的数据", from = "WMS")
  661 + public Result handleEmptyOut(@RequestBody String taskNo) {
  662 + Result result = taskHeaderService.handleEmptyOut(taskNo);
  663 + return result;
  664 + }
  665 +
  666 + /**
  667 + * 修复重入的数据
  668 + * @return
  669 + */
  670 + @AutoLog(value = "修复重入的数据")
  671 + @PostMapping("/handleDoubleIn")
  672 + @ApiOperation("修复重入的数据")
  673 + @ResponseBody
  674 + @ApiLogger(apiName = "修复重入的数据", from = "WMS")
  675 + public Result handleDoubleIn(@RequestBody String taskNo) {
  676 + Result result = taskHeaderService.handleDoubleIn(taskNo);
  677 + return result;
  678 + }
  679 +
  680 + /**
  681 + * 修复取货错的数据
  682 + * @return
  683 + */
  684 + @AutoLog(value = "修复取货错的数据")
  685 + @PostMapping("handlePickupError")
  686 + @ApiOperation("修复取货错的数据")
  687 + @ResponseBody
  688 + @ApiLogger(apiName = "修复取货错的数据", from = "WMS")
  689 + public Result handlePickupError(@RequestBody String taskNo) {
  690 + Result result = taskHeaderService.handlePickupError(taskNo);
  691 + return result;
  692 + }
  693 +
651 694 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -6,11 +6,15 @@ import java.util.ArrayList;
6 6 import java.util.Collection;
7 7 import java.util.Date;
8 8 import java.util.List;
  9 +import java.util.concurrent.CopyOnWriteArrayList;
9 10 import java.util.stream.Collectors;
10 11  
11 12 import javax.annotation.Resource;
12 13  
  14 +import org.apache.shiro.SecurityUtils;
13 15 import org.jeecg.common.api.vo.Result;
  16 +import org.jeecg.common.system.vo.LoginUser;
  17 +import org.jeecg.modules.system.entity.SysDepartRolePermission;
14 18 import org.jeecg.modules.wms.api.wcs.service.LocationAllocationService;
15 19 import org.jeecg.modules.wms.api.wcs.service.WcsService;
16 20 import org.jeecg.modules.wms.config.container.entity.Container;
... ... @@ -36,6 +40,7 @@ import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTr
36 40 import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader;
37 41 import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService;
38 42 import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail;
  43 +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader;
39 44 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService;
40 45 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService;
41 46 import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail;
... ... @@ -43,14 +48,21 @@ import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentCon
43 48 import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService;
44 49 import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService;
45 50 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
  51 +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
46 52 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService;
47 53 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService;
  54 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail;
  55 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild;
  56 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl.CycleCountDetailChildServiceImpl;
  57 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl.CycleCountDetailServiceImpl;
  58 +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.impl.CycleCountHeaderServiceImpl;
48 59 import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail;
49 60 import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
50 61 import org.jeecg.modules.wms.task.taskHeader.mapper.TaskDetailMapper;
51 62 import org.jeecg.modules.wms.task.taskHeader.mapper.TaskHeaderMapper;
52 63 import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService;
53 64 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
  65 +import org.jeecg.utils.HuahengJwtUtil;
54 66 import org.jeecg.utils.StringUtils;
55 67 import org.jeecg.utils.constant.QuantityConstant;
56 68 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -105,7 +117,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
105 117 @Resource
106 118 private IShipmentDetailService shipmentDetailService;
107 119 @Resource
108   - private IMaterialService materialService;
  120 + private CycleCountDetailServiceImpl cycleCountDetailService;
109 121 @Resource
110 122 private WcsService wcsService;
111 123 @Resource
... ... @@ -120,6 +132,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
120 132 private ILocationHighService locationHighService;
121 133 @Resource
122 134 private LocationAllocationService allocationService;
  135 + @Resource
  136 + private CycleCountDetailChildServiceImpl cycleCountDetailChildService;
  137 + @Resource
  138 + private CycleCountHeaderServiceImpl cycleCountHeaderService;
123 139  
124 140 @Override
125 141 @Transactional
... ... @@ -853,6 +869,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
853 869 case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT:
854 870 result = completeShipmentTask(taskHeader);
855 871 break;
  872 + case QuantityConstant.TASK_TYPE_CYCLECOUNT:
  873 + result = completeCycleCountTask(taskHeader);
  874 + break;
856 875 case QuantityConstant.TASK_TYPE_EMPTYRECEIPT:
857 876 result = completeEmptyInTask(taskHeader);
858 877 break;
... ... @@ -1495,6 +1514,160 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1495 1514 return Result.OK("完成空托盘入库成功");
1496 1515 }
1497 1516  
  1517 +
  1518 +
  1519 +
  1520 + /**
  1521 + * 盘点完成
  1522 + *盘点有差异完成时状态为105
  1523 + * @param taskHeader
  1524 + * @return
  1525 + */
  1526 + @Transactional(rollbackFor = Exception.class)
  1527 + public Result completeCycleCountTask(TaskHeader taskHeader) {
  1528 + /*盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单,
  1529 + 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位*/
  1530 +
  1531 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
  1532 + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
  1533 + //更新用户
  1534 + taskHeader.setUpdateBy(sysUser.getUsername());
  1535 + //更新时间
  1536 + taskHeader.setUpdateTime(new Date());
  1537 +
  1538 +
  1539 + //1.先拿到盘点单主单据
  1540 + CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId());
  1541 +
  1542 + //2.盘点单主单据查明细单据list
  1543 + LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = new LambdaQueryWrapper<CycleCountDetailChild>();
  1544 + childLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid,cycleCountDetail.getId());
  1545 + List<CycleCountDetailChild> children = cycleCountDetailChildService.list(childLambdaQueryWrapper);
  1546 +
  1547 + //3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单
  1548 +
  1549 +
  1550 + int outboundOrderId=0;
  1551 + String outboundOrderCode=null;
  1552 + int warehousingOrderId=0;
  1553 + String warehousingOrderCode=null;
  1554 +
  1555 +
  1556 + for (CycleCountDetailChild child : children)
  1557 + {
  1558 + child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED);
  1559 + if (child.getGapQty().compareTo(BigDecimal.ZERO) == 1)
  1560 + {
  1561 + if (warehousingOrderId==0) {
  1562 + ReceiptHeader receiptHeader = new ReceiptHeader();
  1563 + receiptHeader.setWarehouseCode(taskHeader.getWarehouseCode());
  1564 + receiptHeader.setCompanyCode(taskHeader.getCompanyCode());
  1565 + receiptHeader.setType(QuantityConstant.RECEIPT_BILL_TYPE_OR);
  1566 + receiptHeader.setRemark("盘盈 单号"+cycleCountDetail.getCycleCountHeadCode());
  1567 + Result result = receiptHeaderService.saveReceiptHeader(receiptHeader);
  1568 + if (result.getCode() != 200)
  1569 + {
  1570 + return result;
  1571 + }
  1572 + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
  1573 + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
  1574 + receiptHeaderService.updateById(receiptHeader);
  1575 + //生成入库单并且赋值给warehousingOrderId
  1576 + warehousingOrderId=receiptHeader.getId();
  1577 + warehousingOrderCode=receiptHeader.getCode();
  1578 + }
  1579 +
  1580 + //生成明细
  1581 + ReceiptDetail receiptDetail = new ReceiptDetail();
  1582 + receiptDetail.setReceiptId(warehousingOrderId);
  1583 + receiptDetail.setReceiptCode(warehousingOrderCode);
  1584 + receiptDetail.setWarehouseCode(taskHeader.getWarehouseCode());
  1585 + receiptDetail.setCompanyCode(null);
  1586 + receiptDetail.setMaterialCode(child.getMaterialCode());
  1587 + receiptDetail.setMaterialName(child.getMaterialName());
  1588 + receiptDetail.setMaterialSpec(child.getMaterialSpec());
  1589 + receiptDetail.setMaterialUnit(child.getMaterialUnit());
  1590 + receiptDetail.setQty(child.getGapQty().abs());
  1591 + receiptDetail.setTaskQty(child.getGapQty().abs());
  1592 + receiptDetail.setInventoryStatus(child.getInventoryStatus());
  1593 + receiptDetail.setBatch(child.getBatch());
  1594 + receiptDetail.setLot(child.getLot());
  1595 + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
  1596 + receiptDetailService.save(receiptDetail);
  1597 +
  1598 + }
  1599 +
  1600 + if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1)
  1601 + {
  1602 + if (outboundOrderId==0)
  1603 + {
  1604 + ShipmentHeader shipmentHeader = new ShipmentHeader();
  1605 + shipmentHeader.setWarehouseCode(taskHeader.getWarehouseCode());
  1606 + shipmentHeader.setCompanyCode(taskHeader.getCompanyCode());
  1607 + shipmentHeader.setType(QuantityConstant.SHIPMENT_BILL_TYPE_OS);
  1608 + shipmentHeader.setRemark("盘亏 单号"+cycleCountDetail.getCycleCountHeadCode());
  1609 + Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader);
  1610 + if (result.getCode() != 200)
  1611 + {
  1612 + return result;
  1613 + }
  1614 + shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
  1615 + shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
  1616 + shipmentHeaderService.updateById(shipmentHeader);
  1617 + //生成出库单并且赋值给outboundOrderId
  1618 + outboundOrderId=shipmentHeader.getId();
  1619 + outboundOrderCode=shipmentHeader.getCode();
  1620 +
  1621 + }
  1622 + //生成明细
  1623 + ShipmentDetail shipmentDetail = new ShipmentDetail();
  1624 + shipmentDetail.setShipmentId(outboundOrderId);
  1625 + shipmentDetail.setShipmentCode(outboundOrderCode);
  1626 + shipmentDetail.setWarehouseCode(taskHeader.getWarehouseCode());
  1627 + shipmentDetail.setCompanyCode(null);
  1628 + shipmentDetail.setMaterialCode(child.getMaterialCode());
  1629 + shipmentDetail.setMaterialName(child.getMaterialName());
  1630 + shipmentDetail.setMaterialSpec(child.getMaterialSpec());
  1631 + shipmentDetail.setMaterialUnit(child.getMaterialUnit());
  1632 + shipmentDetail.setQty(child.getGapQty().abs());
  1633 + shipmentDetail.setTaskQty(child.getGapQty().abs());
  1634 + shipmentDetail.setInventoryStatus(child.getInventoryStatus());
  1635 + shipmentDetail.setBatch(child.getBatch());
  1636 + shipmentDetail.setLot(child.getLot());
  1637 + shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
  1638 + shipmentDetailService.save(shipmentDetail);
  1639 + }
  1640 + cycleCountDetailChildService.updateById(child);
  1641 + }
  1642 +
  1643 +
  1644 +
  1645 + //4.完成当前任务
  1646 + if (!taskHeaderService.saveOrUpdate(taskHeader)) {
  1647 + throw new ServiceException("盘点任务单据状态更新失败!");
  1648 + }
  1649 + //盘点明细状态
  1650 + cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED);
  1651 + cycleCountDetail.setCompletedBy(sysUser.getUsername());
  1652 + cycleCountDetail.setCompletedAt(new Date());
  1653 + cycleCountDetailService.updateById(cycleCountDetail);
  1654 + //更新主单状态
  1655 + cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode());
  1656 +
  1657 +
  1658 + //释放库位
  1659 + locationService.updateStatus(cycleCountDetail.getLocationCode(),
  1660 + QuantityConstant.STATUS_LOCATION_EMPTY, taskHeader.getWarehouseCode());
  1661 + return Result.OK("完成盘点任务成功");
  1662 + }
  1663 +
  1664 +
  1665 +
  1666 +
  1667 +
  1668 +
  1669 +
  1670 +
1498 1671 /**
1499 1672 * 完成空托盘出库任务
1500 1673 * @param taskHeader 任务
... ... @@ -1953,14 +2126,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1953 2126 if (StringUtils.isNotEmpty(lastStatus)) {
1954 2127 container.setStatus(lastStatus); // 解决空托盘组移库问题
1955 2128 }
1956   - if (StringUtils.isNotEmpty(fromLocationCode)) {
1957   - success = containerService.havaLocationCodeByContainer(fromLocationCode, warehouseCode);
1958   - if (success) {
1959   - throw new ServiceException("库位表已经存在这个容器号,不能再写入");
1960   - }
1961   - }
  2129 +// if (StringUtils.isNotEmpty(fromLocationCode)) {
  2130 +// success = containerService.havaLocationCodeByContainer(fromLocationCode, warehouseCode);
  2131 +// if (success) {
  2132 +// throw new ServiceException("库位表已经存在这个容器号,不能再写入");
  2133 +// }
  2134 +// }
1962 2135 container.setLastStatus(QuantityConstant.EMPTY_STRING);
1963   - container.setLocationCode(fromLocationCode);
  2136 +// container.setLocationCode(fromLocationCode);
1964 2137 success = containerService.updateById(container);
1965 2138 if (!success) {
1966 2139 throw new ServiceException("取消任务时, 更新容器失败");
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/HuahengJwtUtil.java
1 1 package org.jeecg.utils;
2 2  
  3 +import java.util.Arrays;
3 4 import java.util.Date;
  5 +import java.util.UUID;
4 6  
5 7 import javax.servlet.http.HttpServletRequest;
6 8  
7 9 import org.jeecg.common.exception.JeecgBootException;
8 10 import org.jeecg.common.util.oConvertUtils;
  11 +import org.jeecg.modules.wms.framework.aspectj.dto.ApiAuthentication;
  12 +import org.jeecg.modules.wms.framework.aspectj.dto.RSA256Key;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.core.env.Environment;
9 15  
10 16 import com.auth0.jwt.JWT;
  17 +import com.auth0.jwt.JWTVerifier;
11 18 import com.auth0.jwt.algorithms.Algorithm;
12 19 import com.auth0.jwt.exceptions.JWTDecodeException;
13 20 import com.auth0.jwt.interfaces.DecodedJWT;
14 21  
  22 +import cn.hutool.core.date.DatePattern;
  23 +import cn.hutool.core.date.DateUtil;
  24 +import net.bytebuddy.asm.Advice.This;
  25 +
15 26 public class HuahengJwtUtil {
16 27  
17   - public static final long EXPIRE_TIME = -1;
  28 + /** token失效时间 1天 */
  29 + public static final long EXPIRE_TIME = 24 * 60 * 60 * 1000;
  30 +
  31 + public static final String HUAHENG_SYSTEM_ID = "HUAHENG-WMS4";
18 32  
19 33 /**
20 34 * 根据request中的token获取用户账号
... ... @@ -60,7 +74,7 @@ public class HuahengJwtUtil {
60 74 }
61 75  
62 76 /**
63   - * 生成签名,5min后过期
  77 + * 生成签名
64 78 * @param username 用户名
65 79 * @param secret 用户的密码
66 80 * @return 加密的token
... ... @@ -73,7 +87,7 @@ public class HuahengJwtUtil {
73 87 }
74 88  
75 89 /**
76   - * 生成签名,5min后过期
  90 + * 生成签名
77 91 * @param username 用户名
78 92 * @param secret 用户的密码
79 93 * @param warehouseCode 登录仓库
... ... @@ -87,6 +101,41 @@ public class HuahengJwtUtil {
87 101 }
88 102  
89 103 /**
  104 + * 生成第三方系统HTTP访问TOKEN
  105 + * @author TanYibin
  106 + * @createDate 2023年2月15日
  107 + * @param apiAuthentication
  108 + * @param algorithm
  109 + * @return
  110 + */
  111 + public static String sign(ApiAuthentication apiAuthentication, Algorithm algorithm) {
  112 + return JWT.create().withClaim("operator", apiAuthentication.getOperator()) // 创建Token 操作人
  113 + .withAudience(apiAuthentication.getAudience()) // Token 使用方
  114 + .withIssuer(apiAuthentication.getIssuer()) // Token 发布者
  115 + .withIssuedAt(DateUtil.date()) // 生成签名时间
  116 + .withExpiresAt(apiAuthentication.getExpireDateTime()) // 过期时间
  117 + .withJWTId(UUID.randomUUID().toString()).sign(algorithm);
  118 + }
  119 +
  120 + /**
  121 + * 生成第三方系统HTTP访问TOKEN
  122 + * @author TanYibin
  123 + * @createDate 2023年2月15日
  124 + * @param apiAuthentication
  125 + * @return
  126 + */
  127 + public static String sign(ApiAuthentication apiAuthentication) {
  128 + RSA256Key rsa256Key = new RSA256Key(); // 获取公钥/私钥
  129 + Algorithm algorithm = Algorithm.RSA256(rsa256Key.getPublicKey(), rsa256Key.getPrivateKey());
  130 + return JWT.create().withClaim("operator", apiAuthentication.getOperator()) // 创建Token 操作人
  131 + .withAudience(apiAuthentication.getAudience()) // Token 使用方
  132 + .withIssuer(apiAuthentication.getIssuer()) // Token 发布者
  133 + .withIssuedAt(DateUtil.date()) // 生成签名时间
  134 + .withExpiresAt(apiAuthentication.getExpireDateTime()) // 过期时间
  135 + .withJWTId(UUID.randomUUID().toString()).sign(algorithm);
  136 + }
  137 +
  138 + /**
90 139 * 获得token中的信息无需secret解密也能获得
91 140 * @return token中包含的用户名
92 141 */
... ... @@ -99,4 +148,34 @@ public class HuahengJwtUtil {
99 148 }
100 149 }
101 150  
  151 + /**
  152 + * 生成第三方系统HTTP访问TOKEN
  153 + * @author TanYibin
  154 + * @createDate 2023年2月14日
  155 + * @param args
  156 + * @throws Exception
  157 + */
  158 + public static void main(String[] args) throws Exception {
  159 + ApiAuthentication apiAuthentication = new ApiAuthentication();
  160 + // 生成TOKEN必填参数
  161 + apiAuthentication.setOperator("TanYibin"); // Token提供方
  162 + apiAuthentication.setAudience("ACS001"); // Token使用方
  163 + apiAuthentication.setExpireDateTime(DateUtil.parse("2099-12-31 23:59:59", DatePattern.NORM_DATETIME_PATTERN)); // Token失效时间
  164 +
  165 + String tokenString = sign(apiAuthentication);
  166 + System.out.println("HuahengJwtUtil.sign(apiAuthentication) Token:" + tokenString);
  167 +
  168 + RSA256Key rsa256Key = new RSA256Key(); // 获取公钥/私钥
  169 + Algorithm algorithm = Algorithm.RSA256(rsa256Key.getPublicKey(), rsa256Key.getPrivateKey());
  170 + // Reusable verifier instance 可复用的验证实例
  171 + JWTVerifier verifier = JWT.require(algorithm).withIssuer(HuahengJwtUtil.HUAHENG_SYSTEM_ID).build();
  172 + DecodedJWT jwt = verifier.verify(tokenString);
  173 + System.out.println();
  174 + System.out.println("jwt.getId():" + jwt.getId());
  175 + System.out.println("jwt.getClaim(operator):" + jwt.getClaim("operator").asString());
  176 + System.out.println("jwt.getAudience():" + Arrays.toString(jwt.getAudience().toArray()));
  177 + System.out.println("jwt.getIssuer():" + jwt.getIssuer());
  178 + System.out.println("jwt.getIssuedAt():" + DateUtil.format(jwt.getIssuedAt(), DatePattern.NORM_DATETIME_PATTERN));
  179 + System.out.println("jwt.getExpiresAt():" + DateUtil.format(jwt.getExpiresAt(), DatePattern.NORM_DATETIME_PATTERN));
  180 + }
102 181 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/OkHttpUtils.java 0 → 100644
  1 +package org.jeecg.utils;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.TypeReference;
  5 +import com.alibaba.fastjson.parser.Feature;
  6 +import com.aliyun.oss.ServiceException;
  7 +import com.xkcoding.http.util.StringUtil;
  8 +
  9 +import antlr.StringUtils;
  10 +import cn.hutool.core.util.StrUtil;
  11 +import net.bytebuddy.asm.Advice.This;
  12 +import okhttp3.*;
  13 +import org.jeecg.modules.wms.framework.aspectj.ApiLogAspect;
  14 +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog;
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.messaging.support.ErrorMessage;
  18 +
  19 +import java.io.IOException;
  20 +import java.lang.reflect.Type;
  21 +import java.util.HashMap;
  22 +import java.util.Map;
  23 +import java.util.Objects;
  24 +import java.util.concurrent.TimeUnit;
  25 +import java.util.concurrent.TimeoutException;
  26 +
  27 +import javax.validation.constraints.NotNull;
  28 +
  29 +/**
  30 + * OkHttp发送请求
  31 + * @author huaheng
  32 + * @Date 2022-5-30
  33 + */
  34 +public class OkHttpUtils {
  35 +
  36 + private static final Logger log = LoggerFactory.getLogger(OkHttpUtils.class);
  37 +
  38 + /**
  39 + * 最多重试次数
  40 + */
  41 + public final static int MAX_RENTRY_COUNT = 3;
  42 +
  43 + /**
  44 + * 最大连接时间(秒)
  45 + */
  46 + public final static int CONNECTION_TIMEOUT = 1;
  47 +
  48 + /**
  49 + * 最大读取时间(秒)
  50 + */
  51 + public final static int READ_TIMEOUT = 30;
  52 +
  53 + /**
  54 + * 最大写入时间(秒)
  55 + */
  56 + public final static int WRITE_TIMEOUT = 30;
  57 +
  58 + /**
  59 + * JSON格式
  60 + */
  61 + public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
  62 + /**
  63 + * OkHTTP线程池最大空闲线程数
  64 + */
  65 + public final static int MAX_IDLE_CONNECTIONS = 100;
  66 + /**
  67 + * OkHTTP线程池空闲线程存活时间(秒)
  68 + */
  69 + public final static long KEEP_ALIVE_DURATION = 60;
  70 +
  71 + private static final String CONTENT_TYPE = "Content-Type";
  72 +
  73 + /** 访问接口参数配置 */
  74 + private final static OkHttpClient HTTP_CLIENT =
  75 + new OkHttpClient.Builder().connectTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS).readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
  76 + .writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS).addInterceptor(new OkHttpUtils.OkhttpInterceptor(MAX_RENTRY_COUNT)) // 过滤器,设置最大重试次数
  77 + .retryOnConnectionFailure(false).connectionPool(new ConnectionPool(MAX_IDLE_CONNECTIONS, KEEP_ALIVE_DURATION, TimeUnit.SECONDS)).build();
  78 +
  79 + /**
  80 + * 向指定 URL 发送GET方法的请求
  81 + * @param url 发送请求的 URL
  82 + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式
  83 + * @return 所代表远程资源的响应结果
  84 + * @throws Exception
  85 + */
  86 + public static String sendGet(String url, String param) {
  87 + Map<String, String> headers = new HashMap<String, String>();
  88 + return sendGet(url, headers, param);
  89 + }
  90 +
  91 + /**
  92 + * 向指定 URL 发送GET方法的请求
  93 + * @param url 发送请求的 URL
  94 + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式
  95 + * @param headers 请求头
  96 + * @return 所代表远程资源的响应结果
  97 + * @throws Exception
  98 + */
  99 + public static String sendGet(String url, Map<String, String> headers, String param) {
  100 + ApiLog apiLog = new ApiLog();
  101 + Request.Builder builder = new Request.Builder();
  102 + buildHeader(builder, headers);
  103 + Request request = builder.url(url + "?" + param).get().build();
  104 + Response response = null;
  105 + String result = null;
  106 + try {
  107 + ApiLogAspect.initApiLog(apiLog, request, param);
  108 + response = HTTP_CLIENT.newCall(request).execute();
  109 + result = response.body().string();
  110 + } catch (Exception e) {
  111 + String errorString =
  112 + StrUtil.format("执行GET请求异常,url:{},header:{},param:{},errorMessage:{}", url, JSON.toJSONString(headers), param, e.getMessage());
  113 + ApiLogAspect.setApiLogException(apiLog, e);
  114 + throw new RuntimeException(errorString, e);
  115 + } finally {
  116 + ApiLogAspect.finishApiLog(apiLog, response, result);
  117 + }
  118 + if (response.isSuccessful() && Objects.nonNull(response.body())) {// 调用成功
  119 + log.info("执行GET请求成功,url:{},header:{},param:{},result:{}", url, JSON.toJSONString(headers), param, result);
  120 + } else {
  121 + String errorString = StrUtil.format("执行GET请求失败,url:{},header:{},param:{},responseCode:{},responseMessage:{}", url,
  122 + JSON.toJSONString(headers), param, response.code(), response.message());
  123 + throw new ServiceException(errorString);
  124 + }
  125 + return result;
  126 + }
  127 +
  128 + /**
  129 + * 向指定 URL 发送POST方法的请求
  130 + * @param url 发送请求的 URL
  131 + * @param param 请求参数,请求参数是 name1=value1&name2=value2 的形式
  132 + * @return 远程资源的响应结果
  133 + * @throws IOException
  134 + */
  135 + public static String sendPost(String url, String param) throws IOException {
  136 + Map<String, String> headers = new HashMap<String, String>();
  137 + return sendPost(url, headers, param);
  138 + }
  139 +
  140 + /**
  141 + * 向指定 URL 发送POST方法的请求
  142 + * @param url 发送请求的 URL
  143 + * @param param 请求参数,请求参数是 name1=value1&name2=value2 的形式
  144 + * @param headers 请求头
  145 + * @return 远程资源的响应结果
  146 + * @throws IOException
  147 + */
  148 + public static String sendPost(String url, Map<String, String> headers, String param) {
  149 + ApiLog apiLog = new ApiLog();
  150 + Request.Builder builder = new Request.Builder();
  151 + buildHeader(builder, headers);
  152 + FormBody body = new FormBody.Builder().build();
  153 + Request request = builder.url(url + "?" + param).post(body).build();
  154 + Response response = null;
  155 + String result = null;
  156 + try {
  157 + ApiLogAspect.initApiLog(apiLog, request, param);
  158 + response = HTTP_CLIENT.newCall(request).execute();
  159 + result = response.body().string();
  160 + } catch (Exception e) {
  161 + String errorString =
  162 + StrUtil.format("执行POST请求异常,url:{},header:{},param:{},errorMessage:{}", url, JSON.toJSONString(headers), param, e.getMessage());
  163 + ApiLogAspect.setApiLogException(apiLog, e);
  164 + throw new RuntimeException(errorString, e);
  165 + } finally {
  166 + ApiLogAspect.finishApiLog(apiLog, response, result);
  167 + }
  168 + if (response.isSuccessful() && Objects.nonNull(response.body())) {// 调用成功
  169 + log.info("执行POST请求成功,url:{},header:{},param:{},result:{}", url, JSON.toJSONString(headers), param, result);
  170 + } else {
  171 + String errorString = StrUtil.format("执行POST请求失败,url:{},header:{},param:{},responseCode:{},responseMessage:{}", url,
  172 + JSON.toJSONString(headers), param, response.code(), response.message());
  173 + throw new RuntimeException(errorString);
  174 + }
  175 + return result;
  176 + }
  177 +
  178 + public static String sendPostByJsonStr(String url, String jsonString) {
  179 + Map<String, String> headers = new HashMap<String, String>();
  180 + return sendPostByJsonStr(url, headers, jsonString);
  181 + }
  182 +
  183 + /**
  184 + * JSONString形式发送POST请求
  185 + * @throws Exception
  186 + * @throws IOException
  187 + */
  188 + public static String sendPostByJsonStr(String url, Map<String, String> headers, String jsonString) {
  189 + ApiLog apiLog = new ApiLog();
  190 + headers.put("Accept", "application/json");// 设置接收数据的格式
  191 + headers.put("Content-Type", "application/json");// 设置发送数据的格式
  192 + Request.Builder builder = new Request.Builder();
  193 + buildHeader(builder, headers);
  194 + RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, jsonString);
  195 + Request request = builder.url(url).post(body).build();
  196 + Response response = null;
  197 + String result = null;
  198 + try {
  199 + ApiLogAspect.initApiLog(apiLog, request, jsonString);
  200 + response = HTTP_CLIENT.newCall(request).execute();
  201 + result = response.body().string();
  202 + } catch (Exception e) {
  203 + String errorString = StrUtil.format("执行POST请求异常,url:{},header:{},param:{},errorMessage:{}", url, JSON.toJSONString(headers), jsonString, e.getMessage());
  204 + ApiLogAspect.setApiLogException(apiLog, e);
  205 + throw new RuntimeException(errorString);
  206 + } finally {
  207 + ApiLogAspect.finishApiLog(apiLog, response, result);
  208 + }
  209 + if (response.isSuccessful() && Objects.nonNull(response.body())) {// 调用成功
  210 + log.info("执行POST请求成功,url:{},header:{},param:{},result:{}", url, JSON.toJSONString(headers), jsonString, result);
  211 + } else {
  212 + String errorString = StrUtil.format("执行POST请求失败,url:{},header:{},param:{},responseCode:{},responseMessage:{}", url,
  213 + JSON.toJSONString(headers), jsonString, response.code(), response.message());
  214 + throw new RuntimeException(errorString);
  215 + }
  216 + return result;
  217 + }
  218 +
  219 + /**
  220 + * 设置请求头
  221 + * @param builder .
  222 + * @param headers 请求头
  223 + */
  224 + private static void buildHeader(Request.Builder builder, Map<String, String> headers) {
  225 + if (Objects.nonNull(headers) && headers.size() > 0) {
  226 + headers.forEach((k, v) -> {
  227 + if (Objects.nonNull(k) && Objects.nonNull(v)) {
  228 + builder.addHeader(k, v);
  229 + }
  230 + });
  231 + }
  232 + }
  233 +
  234 + /**
  235 + * 支持嵌套泛型的POST请求
  236 + * @param url 链接
  237 + * @param json 请求json
  238 + * @param type 嵌套泛型
  239 + * @return 响应对象, 可进行强转。
  240 + * @throws Exception
  241 + */
  242 + public static <T> T sendPostByJsonStr(String url, String jsonString, TypeReference<T> type) throws Exception {
  243 + String result = sendPostByJsonStr(url, jsonString);
  244 + if (Objects.nonNull(result) && Objects.nonNull(type)) {
  245 + return JSON.parseObject(result, type);
  246 + }
  247 + return null;
  248 + }
  249 +
  250 + public static class OkhttpInterceptor implements Interceptor {
  251 + // 最大重试次数
  252 + private int maxRentry;
  253 +
  254 + public OkhttpInterceptor(int maxRentry) {
  255 + this.maxRentry = maxRentry;
  256 + }
  257 +
  258 + /** 递归 2次下发请求,如果仍然失败 则返回 null 但是 intercept must not return null. 返回 null 会报 IllegalStateException 异常 */
  259 + public Response intercept(@NotNull Chain chain) throws IOException {
  260 + return retry(chain, 0);
  261 + }
  262 +
  263 + private Response retry(Chain chain, int retryCent) throws IOException {
  264 + Request request = chain.request();
  265 + Response response = null;
  266 + try {
  267 + response = chain.proceed(request);
  268 + } catch (Exception e) {
  269 + if (maxRentry > retryCent) {
  270 + return retry(chain, retryCent + 1);
  271 + }
  272 + if (Objects.isNull(response)) {
  273 + throw e;
  274 + }
  275 + }
  276 + return response;
  277 + }
  278 + }
  279 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/SecretKeyUtils.java 0 → 100644
  1 +package org.jeecg.utils;
  2 +
  3 +import java.security.Key;
  4 +import java.security.KeyFactory;
  5 +import java.security.KeyPair;
  6 +import java.security.KeyPairGenerator;
  7 +import java.security.PrivateKey;
  8 +import java.security.PublicKey;
  9 +import java.security.interfaces.RSAPrivateKey;
  10 +import java.security.interfaces.RSAPublicKey;
  11 +import java.security.spec.PKCS8EncodedKeySpec;
  12 +import java.security.spec.X509EncodedKeySpec;
  13 +import java.util.Base64;
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +import org.jeecg.modules.wms.framework.aspectj.dto.RSA256Key;
  18 +
  19 +/**
  20 + * KeyPairGenerator https://www.jianshu.com/p/4de1ee0e7206 key的生成使用方法
  21 + */
  22 +public class SecretKeyUtils {
  23 +
  24 + public static final String KEY_ALGORITHM = "RSA";
  25 + private static final String PUBLIC_KEY = "RSAPublicKey";
  26 + private static final String PRIVATE_KEY = "RSAPrivateKey";
  27 +
  28 + private static RSA256Key rsa256Key;
  29 +
  30 + // 获得公钥
  31 + public static String getPublicKey(Map<String, Object> keyMap) throws Exception {
  32 + // 获得map中的公钥对象 转为key对象
  33 + Key key = (Key)keyMap.get(PUBLIC_KEY);
  34 + // byte[] publicKey = key.getEncoded();
  35 + // 编码返回字符串
  36 + return encryptBASE64(key.getEncoded());
  37 + }
  38 +
  39 + public static String getPublicKey(RSA256Key rsa256Key) throws Exception {
  40 + // 获得map中的公钥对象 转为key对象
  41 + Key key = rsa256Key.getPublicKey();
  42 + // byte[] publicKey = key.getEncoded();
  43 + // 编码返回字符串
  44 + return encryptBASE64(key.getEncoded());
  45 + }
  46 +
  47 + // 获得私钥
  48 + public static String getPrivateKey(Map<String, Object> keyMap) throws Exception {
  49 + // 获得map中的私钥对象 转为key对象
  50 + Key key = (Key)keyMap.get(PRIVATE_KEY);
  51 + // byte[] privateKey = key.getEncoded();
  52 + // 编码返回字符串
  53 + return encryptBASE64(key.getEncoded());
  54 + }
  55 +
  56 + // 获得私钥
  57 + public static String getPrivateKey(RSA256Key rsa256Key) throws Exception {
  58 + // 获得map中的私钥对象 转为key对象
  59 + Key key = rsa256Key.getPrivateKey();
  60 + // byte[] privateKey = key.getEncoded();
  61 + // 编码返回字符串
  62 + return encryptBASE64(key.getEncoded());
  63 + }
  64 +
  65 + // 解码返回byte
  66 + public static byte[] decryptBASE64(String key) throws Exception {
  67 + return Base64.getDecoder().decode(key);
  68 + }
  69 +
  70 + // 编码返回字符串
  71 + public static String encryptBASE64(byte[] key) throws Exception {
  72 + return Base64.getEncoder().encodeToString(key);
  73 + }
  74 +
  75 + // 使用KeyPairGenerator 生成公私钥,存放于map对象中
  76 + public static Map<String, Object> initKey() throws Exception {
  77 + /* RSA算法要求有一个可信任的随机数源 */
  78 + // 获得对象 KeyPairGenerator 参数 RSA 1024个字节
  79 + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM);
  80 + keyPairGen.initialize(1024);
  81 +
  82 + // 通过对象 KeyPairGenerator 生成密匙对 KeyPair
  83 + KeyPair keyPair = keyPairGen.generateKeyPair();
  84 +
  85 + // 通过对象 KeyPair 获取RSA公私钥对象RSAPublicKey RSAPrivateKey
  86 + RSAPublicKey publicKey = (RSAPublicKey)keyPair.getPublic();
  87 + RSAPrivateKey privateKey = (RSAPrivateKey)keyPair.getPrivate();
  88 +
  89 + // 公私钥对象存入map中
  90 + Map<String, Object> keyMap = new HashMap<String, Object>(2);
  91 + keyMap.put(PUBLIC_KEY, publicKey);
  92 + keyMap.put(PRIVATE_KEY, privateKey);
  93 + return keyMap;
  94 + }
  95 +
  96 + /**
  97 + * 获取公私钥
  98 + * @return
  99 + * @throws Exception
  100 + */
  101 + public static synchronized RSA256Key getRSA256Key() throws Exception {
  102 + if (rsa256Key == null) {
  103 + synchronized (RSA256Key.class) {
  104 + if (rsa256Key == null) {
  105 + rsa256Key = new RSA256Key();
  106 + Map<String, Object> map = initKey();
  107 + rsa256Key.setPrivateKey((RSAPrivateKey)map.get(SecretKeyUtils.PRIVATE_KEY));
  108 + rsa256Key.setPublicKey((RSAPublicKey)map.get(SecretKeyUtils.PUBLIC_KEY));
  109 + }
  110 + }
  111 + }
  112 + return rsa256Key;
  113 + }
  114 +
  115 + /**
  116 + * 解码 PublicKey
  117 + * @param key
  118 + * @return
  119 + */
  120 + public static PublicKey getPublicKey(String key) {
  121 + try {
  122 + byte[] byteKey = Base64.getDecoder().decode(key);
  123 + X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(byteKey);
  124 + KeyFactory keyFactory = KeyFactory.getInstance("RSA");
  125 + return keyFactory.generatePublic(x509EncodedKeySpec);
  126 +
  127 + } catch (Exception e) {
  128 + e.printStackTrace();
  129 + }
  130 + return null;
  131 + }
  132 +
  133 + /**
  134 + * 解码 PrivateKey
  135 + * @param key
  136 + * @return
  137 + */
  138 + public static PrivateKey getPrivateKey(String key) {
  139 + try {
  140 + byte[] byteKey = Base64.getDecoder().decode(key);
  141 + PKCS8EncodedKeySpec x509EncodedKeySpec = new PKCS8EncodedKeySpec(byteKey);
  142 + KeyFactory keyFactory = KeyFactory.getInstance("RSA");
  143 + return keyFactory.generatePrivate(x509EncodedKeySpec);
  144 +
  145 + } catch (Exception e) {
  146 + e.printStackTrace();
  147 + }
  148 + return null;
  149 + }
  150 +
  151 + public static void main(String[] args) {
  152 + Map<String, Object> keyMap;
  153 + try {
  154 + keyMap = initKey(); // 使用 java.security.KeyPairGenerator 生成 公/私钥
  155 + String publicKey = getPublicKey(keyMap);
  156 + System.out.println("公钥:\n" + publicKey);
  157 + String privateKey = getPrivateKey(keyMap);
  158 + System.out.println("私钥:\n" + privateKey);
  159 + } catch (Exception e) {
  160 + e.printStackTrace();
  161 + }
  162 + }
  163 +}
0 164 \ No newline at end of file
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/StringUtils.java
1 1 package org.jeecg.utils;
2 2  
3   -import org.apache.commons.lang.text.StrBuilder;
4   -import org.jeecg.utils.support.StrFormatter;
5   -
6 3 import java.lang.reflect.Field;
7 4 import java.util.Collection;
8 5 import java.util.Map;
9 6  
  7 +import org.apache.commons.lang.text.StrBuilder;
  8 +
10 9 /**
11 10 * 字符串工具类
12 11 * @author huaheng
... ... @@ -238,25 +237,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
238 237 }
239 238  
240 239 /**
241   - * 格式化文本, {} 表示占位符<br>
242   - * 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
243   - * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
244   - * 例:<br>
245   - * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
246   - * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
247   - * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
248   - * @param template 文本模板,被替换的部分用 {} 表示
249   - * @param params 参数值
250   - * @return 格式化后的文本
251   - */
252   - public static String format(String template, Object... params) {
253   - if (isEmpty(params) || isEmpty(template)) {
254   - return template;
255   - }
256   - return StrFormatter.format(template, params);
257   - }
258   -
259   - /**
260 240 * 驼峰首字符小写
261 241 */
262 242 public static String uncapitalize(String str) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/config/HuahengRedisConfig.java 0 → 100644
  1 +package org.jeecg.utils.config;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonAutoDetect;
  4 +import com.fasterxml.jackson.annotation.PropertyAccessor;
  5 +import com.fasterxml.jackson.databind.ObjectMapper;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +
  8 +import org.jeecg.utils.manager.RedisConfigCacheManager;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.context.annotation.Bean;
  11 +import org.springframework.context.annotation.Configuration;
  12 +import org.springframework.context.annotation.Primary;
  13 +import org.springframework.data.redis.cache.RedisCacheConfiguration;
  14 +import org.springframework.data.redis.cache.RedisCacheManager;
  15 +import org.springframework.data.redis.cache.RedisCacheWriter;
  16 +import org.springframework.data.redis.connection.RedisConnectionFactory;
  17 +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
  18 +import org.springframework.data.redis.serializer.RedisSerializationContext;
  19 +import org.springframework.data.redis.serializer.RedisSerializer;
  20 +import org.springframework.data.redis.serializer.StringRedisSerializer;
  21 +
  22 +import java.time.Duration;
  23 +
  24 +@Slf4j
  25 +@Configuration
  26 +public class HuahengRedisConfig {
  27 +
  28 + @Bean
  29 + @Primary
  30 + public RedisCacheManager redisCacheManager(RedisConnectionFactory factory) {
  31 + ObjectMapper om = new ObjectMapper();
  32 + RedisSerializer<String> redisSerializer = new StringRedisSerializer();
  33 + Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
  34 + // 解决查询缓存转换异常的问题
  35 + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
  36 + om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
  37 + jackson2JsonRedisSerializer.setObjectMapper(om);
  38 + // 配置序列化(解决乱码的问题)
  39 + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMillis(-1))
  40 + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer))
  41 + .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer)).disableCachingNullValues();
  42 + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(factory);
  43 +
  44 + /*
  45 + * return RedisConfigCacheManager.builder(factory).withInitialCacheConfigurations().transactionAware().build();
  46 + */
  47 + return new RedisConfigCacheManager(cacheWriter, config);
  48 + }
  49 +}
0 50 \ No newline at end of file
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/HuahengShiroConfig.java renamed to huaheng-wms-core/src/main/java/org/jeecg/utils/config/HuahengShiroConfig.java
1   -package org.jeecg.utils;
  1 +package org.jeecg.utils.config;
2 2  
3 3 import java.util.LinkedHashMap;
4 4 import java.util.Map;
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/http/HttpUtils.java deleted
1   -package org.jeecg.utils.http;
2   -
3   -import org.apache.commons.io.IOUtils;
4   -import org.apache.http.HttpResponse;
5   -import org.apache.http.HttpStatus;
6   -import org.apache.http.client.methods.HttpPost;
7   -import org.apache.http.entity.StringEntity;
8   -import org.apache.http.impl.client.CloseableHttpClient;
9   -import org.apache.http.impl.client.HttpClients;
10   -import org.jeecg.modules.wms.framework.aspectj.ApiLogAspect;
11   -import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog;
12   -import org.slf4j.Logger;
13   -import org.slf4j.LoggerFactory;
14   -
15   -import javax.net.ssl.*;
16   -import java.io.*;
17   -import java.net.*;
18   -import java.security.cert.X509Certificate;
19   -
20   -/**
21   - * 通用http发送方法
22   - * @author huaheng
23   - */
24   -public class HttpUtils {
25   -
26   - private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
27   -
28   - /**
29   - * 向指定 URL 发送GET方法的请求
30   - * @param url 发送请求的 URL
31   - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
32   - * @return 所代表远程资源的响应结果
33   - */
34   - public static String sendGet(String url, String param) {
35   - StringBuilder result = new StringBuilder();
36   - BufferedReader in = null;
37   - try {
38   - String urlNameString = url + "?" + param;
39   - log.info("sendGet - {}", urlNameString);
40   - URL realUrl = new URL(urlNameString);
41   - URLConnection connection = realUrl.openConnection();
42   - connection.setRequestProperty("accept", "*/*");
43   - connection.setRequestProperty("connection", "Keep-Alive");
44   - connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
45   - connection.connect();
46   - in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
47   - String line;
48   - while ((line = in.readLine()) != null) {
49   - result.append(line);
50   - }
51   - log.info("recv - {}", result);
52   - } catch (ConnectException e) {
53   - log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e.getMessage());
54   - } catch (SocketTimeoutException e) {
55   - log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e.getMessage());
56   - } catch (IOException e) {
57   - log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e.getMessage());
58   - } catch (Exception e) {
59   - log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e.getMessage());
60   - } finally {
61   - try {
62   - if (in != null) {
63   - in.close();
64   - }
65   - } catch (Exception ex) {
66   - log.error("调用in.close Exception, url=" + url + ",param=" + param, ex.getMessage());
67   - }
68   - }
69   - return result.toString();
70   - }
71   -
72   - // post请求 为erp回传定制
73   - public static String erppost(String strURL, String params, String key) {
74   - HttpURLConnection connection = null;
75   - InputStream is = null;
76   - OutputStreamWriter out = null;
77   - String result = null;
78   - ApiLog log = null;
79   -
80   - try {
81   - URL url = new URL(strURL);// 创建连接
82   -// String ur = "" + url;
83   - connection = (HttpURLConnection)url.openConnection();
84   - connection.setDoOutput(true);
85   - connection.setDoInput(true);
86   - connection.setUseCaches(false);
87   - connection.setInstanceFollowRedirects(true);
88   - connection.setRequestMethod("POST");// 设置请求方式
89   - connection.setRequestProperty("Accept", "application/json");// 设置接收数据的格式
90   - connection.setRequestProperty("Content-Type", "application/json");// 设置发送数据的格式
91   - connection.setRequestProperty("apiKey", key);// 测试环境key
92   - log = ApiLogAspect.initApiLog(connection, params);
93   - connection.connect();
94   - out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");// utf-8编码
95   - out.append(params);
96   - out.flush();
97   - out.close(); // 读取响应
98   - int length = (int)connection.getContentLength();// 获取长度
99   - is = connection.getInputStream();
100   -// BufferedReader br = new BufferedReader(new InputStreamReader(is));
101   - length = 10000;
102   - if (length > 0) {
103   - byte[] data = new byte[length];
104   - byte[] temp = new byte[512];
105   - int readLen = 0;
106   - int destPos = 0;
107   - while ((readLen = is.read(temp)) > 0) {
108   - System.arraycopy(temp, 0, data, destPos, readLen);
109   - destPos += readLen;
110   - }
111   - result = new String(data, "UTF-8");
112   - System.out.println(result);
113   - }
114   - } catch (Exception e) {
115   - ApiLogAspect.setApiLogException(log, e);
116   - e.printStackTrace();
117   - } finally {
118   - ApiLogAspect.finishApiLog(log, connection, result);
119   - if (connection != null)
120   - connection.disconnect();
121   - IOUtils.closeQuietly(out, is);
122   - }
123   - return result;
124   - }
125   -
126   - /**
127   - * 向指定 URL 发送POST方法的请求
128   - * @param url 发送请求的 URL
129   - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
130   - * @return 所代表远程资源的响应结果
131   - */
132   - public static String sendPost(String url, String param) {
133   - PrintWriter out = null;
134   - BufferedReader in = null;
135   - StringBuilder result = new StringBuilder();
136   - try {
137   - String urlNameString = url + "?" + param;
138   - log.info("sendPost - {}", urlNameString);
139   - URL realUrl = new URL(urlNameString);
140   - URLConnection conn = realUrl.openConnection();
141   - conn.setRequestProperty("accept", "*/*");
142   - conn.setRequestProperty("connection", "Keep-Alive");
143   - conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
144   - conn.setRequestProperty("Accept-Charset", "utf-8");
145   - conn.setRequestProperty("contentType", "utf-8");
146   - conn.setDoOutput(true);
147   - conn.setDoInput(true);
148   - out = new PrintWriter(conn.getOutputStream());
149   - out.print(param);
150   - out.flush();
151   - if (((HttpURLConnection)conn).getResponseCode() >= 390) {
152   - in = new BufferedReader(new InputStreamReader(((HttpURLConnection)conn).getErrorStream()));
153   - } else {
154   - in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
155   - }
156   -// in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
157   - String line;
158   - while ((line = in.readLine()) != null) {
159   - result.append(line);
160   - }
161   - log.info("recv - {}", result);
162   - } catch (ConnectException e) {
163   - log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e.getMessage());
164   - } catch (SocketTimeoutException e) {
165   - log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e.getMessage());
166   - } catch (IOException e) {
167   - log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e.getMessage());
168   - } catch (Exception e) {
169   - log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e.getMessage());
170   - } finally {
171   - try {
172   - if (out != null) {
173   - out.close();
174   - }
175   - if (in != null) {
176   - in.close();
177   - }
178   - } catch (IOException ex) {
179   - log.error("调用in.close Exception, url=" + url + ",param=" + param, ex.getMessage());
180   - }
181   - }
182   - return result.toString();
183   - }
184   -
185   - public static String sendSSLPost(String url, String param) {
186   - StringBuilder result = new StringBuilder();
187   - String urlNameString = url + "?" + param;
188   - try {
189   - log.info("sendSSLPost - {}", urlNameString);
190   - SSLContext sc = SSLContext.getInstance("SSL");
191   - sc.init(null, new TrustManager[] {new TrustAnyTrustManager()}, new java.security.SecureRandom());
192   - URL console = new URL(urlNameString);
193   - HttpsURLConnection conn = (HttpsURLConnection)console.openConnection();
194   - conn.setRequestProperty("accept", "*/*");
195   - conn.setRequestProperty("connection", "Keep-Alive");
196   - conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
197   - conn.setRequestProperty("Accept-Charset", "utf-8");
198   - conn.setRequestProperty("contentType", "utf-8");
199   - conn.setDoOutput(true);
200   - conn.setDoInput(true);
201   -
202   - conn.setSSLSocketFactory(sc.getSocketFactory());
203   - conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
204   - conn.connect();
205   - InputStream is = conn.getInputStream();
206   - BufferedReader br = new BufferedReader(new InputStreamReader(is));
207   - String ret = "";
208   - while ((ret = br.readLine()) != null) {
209   - if (ret != null && !"".equals(ret.trim())) {
210   - result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
211   - }
212   - }
213   - log.info("recv - {}", result);
214   - conn.disconnect();
215   - br.close();
216   - } catch (ConnectException e) {
217   - log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e.getMessage());
218   - } catch (SocketTimeoutException e) {
219   - log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e.getMessage());
220   - } catch (IOException e) {
221   - log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e.getMessage());
222   - } catch (Exception e) {
223   - log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e.getMessage());
224   - }
225   - return result.toString();
226   - }
227   -
228   - // 此方法是将参数以body形式发送post请求
229   - public static String bodypost(String strURL, String params) {
230   - System.out.println(strURL);
231   - System.out.println(params);
232   - HttpURLConnection connection = null;
233   - InputStream is = null;
234   - OutputStreamWriter out = null;
235   - String result = null;
236   - ApiLog log = null;
237   -
238   - try {
239   - URL url = new URL(strURL);// 创建连接
240   - String stringUrl = "" + url;
241   - connection = (HttpURLConnection)url.openConnection();
242   - connection.setDoOutput(true);
243   - connection.setDoInput(true);
244   - connection.setUseCaches(false);
245   - connection.setInstanceFollowRedirects(true);
246   - connection.setRequestMethod("POST");// 设置请求方式
247   - connection.setRequestProperty("Accept", "application/json");// 设置接收数据的格式
248   - connection.setRequestProperty("Content-Type", "application/json");// 设置发送数据的格式
249   - if ((stringUrl.contains("10.0.15.19"))) {
250   - connection.setRequestProperty("apiKey", "c687ef505557428595e6a596fba5de6c");// 测试环境key
251   - }
252   - log = ApiLogAspect.initApiLog(connection, params);
253   - connection.connect();
254   - out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");// utf-8编码
255   - out.append(params);
256   - out.flush();
257   - out.close(); // 读取响应
258   - int length = (int)connection.getContentLength();// 获取长度
259   - is = connection.getInputStream();
260   -// BufferedReader br = new BufferedReader(new InputStreamReader(is));
261   - length = 10000;
262   - if (length > 0) {
263   - byte[] data = new byte[length];
264   - byte[] temp = new byte[512];
265   - int readLen = 0;
266   - int destPos = 0;
267   - while ((readLen = is.read(temp)) > 0) {
268   - System.arraycopy(temp, 0, data, destPos, readLen);
269   - destPos += readLen;
270   - }
271   - result = new String(data, "UTF-8");
272   - System.out.println(result);
273   - }
274   - } catch (Exception e) {
275   - ApiLogAspect.setApiLogException(log, e);
276   - e.printStackTrace();
277   - } finally {
278   - ApiLogAspect.finishApiLog(log, connection, result);
279   - if (connection != null)
280   - connection.disconnect();
281   - IOUtils.closeQuietly(out, is);
282   - }
283   - return result;
284   - }
285   -
286   - /**
287   - * 发送以json为参数的POST请求
288   - * @param json
289   - * @param url
290   - * @return
291   - */
292   - public static String sendJsonPostToken(String json, String url) {
293   - String result = "";
294   - HttpPost post = new HttpPost(url);
295   - try {
296   - CloseableHttpClient httpClient = HttpClients.createDefault();
297   -
298   - post.setHeader("Content-Type", "application/json;charset=utf-8");
299   - post.addHeader("Authorization", "Basic YWRtaW46");
300   - StringEntity postingString = new StringEntity(json, "utf-8");
301   - post.setEntity(postingString);
302   - HttpResponse response = httpClient.execute(post);
303   -
304   - InputStream in = response.getEntity().getContent();
305   - BufferedReader br = new BufferedReader(new InputStreamReader(in, "utf-8"));
306   - StringBuilder strber = new StringBuilder();
307   - String line = null;
308   - while ((line = br.readLine()) != null) {
309   - strber.append(line + '\n');
310   - }
311   - br.close();
312   - in.close();
313   - result = strber.toString();
314   - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
315   - result = "服务器异常";
316   - }
317   - } catch (Exception e) {
318   - System.out.println("请求异常");
319   - throw new RuntimeException(e);
320   - } finally {
321   - post.abort();
322   - }
323   - return result;
324   - }
325   -
326   - private static class TrustAnyTrustManager implements X509TrustManager {
327   - @Override
328   - public void checkClientTrusted(X509Certificate[] chain, String authType) {}
329   -
330   - @Override
331   - public void checkServerTrusted(X509Certificate[] chain, String authType) {}
332   -
333   - @Override
334   - public X509Certificate[] getAcceptedIssuers() {
335   - return new X509Certificate[] {};
336   - }
337   - }
338   -
339   - private static class TrustAnyHostnameVerifier implements HostnameVerifier {
340   - @Override
341   - public boolean verify(String hostname, SSLSession session) {
342   - return true;
343   - }
344   - }
345   -
346   -}
huaheng-wms-core/src/main/java/org/jeecg/utils/http/OkHttpUtils.java deleted
1   -package org.jeecg.utils.http;
2   -
3   -import com.alibaba.fastjson.parser.Feature;
4   -import com.google.gson.Gson;
5   -import okhttp3.*;
6   -import org.jeecg.modules.wms.framework.aspectj.ApiLogAspect;
7   -import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog;
8   -import org.slf4j.Logger;
9   -import org.slf4j.LoggerFactory;
10   -
11   -import java.io.IOException;
12   -import java.lang.reflect.Type;
13   -import java.util.HashMap;
14   -import java.util.Map;
15   -import java.util.Objects;
16   -import java.util.concurrent.TimeUnit;
17   -
18   -/**
19   - * OkHttp发送请求
20   - * @author huaheng
21   - * @Date 2022-5-30
22   - */
23   -public class OkHttpUtils {
24   -
25   - private static final Logger log = LoggerFactory.getLogger(OkHttpUtils.class);
26   -
27   - /**
28   - * 最大连接时间
29   - */
30   - public final static int CONNECTION_TIMEOUT = 30;
31   - /**
32   - * JSON格式
33   - */
34   - public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
35   - /**
36   - * OkHTTP线程池最大空闲线程数
37   - */
38   - public final static int MAX_IDLE_CONNECTIONS = 100;
39   - /**
40   - * OkHTTP线程池空闲线程存活时间
41   - */
42   - public final static long KEEP_ALIVE_DURATION = 30L;
43   -
44   - private static final String CONTENT_TYPE = "Content-Type";
45   -
46   - /**
47   - * client
48   - * 配置重试
49   - */
50   - private final static OkHttpClient HTTP_CLIENT = new OkHttpClient.Builder().readTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS)
51   - .writeTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS).connectTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS)
52   - .connectionPool(new ConnectionPool(MAX_IDLE_CONNECTIONS, KEEP_ALIVE_DURATION, TimeUnit.MINUTES)).build();
53   - private static final Gson GSON = new Gson();
54   -
55   - /**
56   - * 向指定 URL 发送GET方法的请求
57   - * @param url 发送请求的 URL
58   - * //* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
59   - * @return 所代表远程资源的响应结果
60   - */
61   - public static String sendGet(String url, String param) {
62   - // headers 请求头
63   - Map<String, String> headers = new HashMap<>();
64   - // 请求URI
65   - String urlNameString = url + "?" + param;
66   -
67   - Request.Builder builder = new Request.Builder();
68   - buildHeader(builder, headers);
69   -
70   - Request request = builder.url(urlNameString).get().build();
71   - Response response = null;
72   - try {
73   - response = HTTP_CLIENT.newCall(request).execute();
74   - if (response.isSuccessful() && Objects.nonNull(response.body())) {
75   - String result = response.body().string();
76   - log.info("执行get请求, url: {} 成功,返回数据: {}", url, result);
77   - return result;
78   - }
79   - } catch (IOException e) {
80   - log.error("执行get请求,url: {} 失败!", url, e);
81   - }
82   - return "";
83   - }
84   -
85   - /**
86   - * 向指定 URL 发送POST方法的请求
87   - * @param url 发送请求的 URL
88   - * // * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
89   - * @return 所代表远程资源的响应结果
90   - */
91   - public static String sendPost(String url, String param) {
92   - FormBody.Builder builder = new FormBody.Builder();
93   - String urlNameString = url + "?" + param;
94   - FormBody body = builder.build();
95   - Request request = new Request.Builder().url(urlNameString).post(body).build();
96   - Response response = null;
97   - try {
98   - response = HTTP_CLIENT.newCall(request).execute();
99   - // 调用成功
100   - if (response.isSuccessful() && response.body() != null) {
101   - return response.body().string();
102   - }
103   - } catch (IOException e) {
104   - e.printStackTrace();
105   - }
106   - return "";
107   - }
108   -
109   - // 此方法是将参数以body形式发送post请求
110   - public static String bodypost(String strURL, String json) {
111   - ApiLog apiLog = null;
112   - // using above json body as a input to post API call
113   - RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, json);
114   - // headers 请求头
115   - Map<String, String> headers = new HashMap<>();
116   - headers.put("Accept", "application/json");// 设置接收数据的格式
117   - headers.put("Content-Type", "application/json");// 设置发送数据的格式
118   - Request.Builder builder = new Request.Builder();
119   - buildHeader(builder, headers);
120   - Request request = builder.url(strURL).post(body).build();
121   - Response response = null;
122   - String result = null;
123   - try {
124   - apiLog = ApiLogAspect.initApiLog(request, json);
125   - response = HTTP_CLIENT.newCall(request).execute();
126   - if (response.isSuccessful() && Objects.nonNull(response.body())) {
127   - result = response.body().string();
128   - log.info("执行post请求,url: {}, header: {} ,参数: {} 成功,返回结果: {}", strURL, headers, json, result);
129   - }
130   - } catch (IOException e) {
131   - ApiLogAspect.setApiLogException(apiLog, e);
132   - log.error("执行post请求,url: {},参数: {} 失败!", strURL, json, e);
133   - } finally {
134   - ApiLogAspect.finishApiLog(apiLog, response, result);
135   - }
136   - return result;
137   - }
138   -
139   - /**
140   - * 设置请求头
141   - * @param builder .
142   - * @param headers 请求头
143   - */
144   - private static void buildHeader(Request.Builder builder, Map<String, String> headers) {
145   - if (Objects.nonNull(headers) && headers.size() > 0) {
146   - headers.forEach((k, v) -> {
147   - if (Objects.nonNull(k) && Objects.nonNull(v)) {
148   - builder.addHeader(k, v);
149   - }
150   - });
151   - }
152   - }
153   -
154   - /**
155   - * 支持嵌套泛型的post请求。
156   - *
157   - * <pre>
158   - * Type type = new TypeToken<Results<User>>() {}.getType();
159   - *
160   - * <pre/>
161   - * @param url 链接
162   - * @param json 请求json
163   - * @param type 嵌套泛型
164   - * @return 响应对象, 可进行强转。
165   - */
166   - public static <T> T post(String url, String json, Type type) {
167   - String result = bodypost(url, json);
168   - if (Objects.nonNull(result) && Objects.nonNull(type)) {
169   - return GSON.fromJson(result, type);
170   - }
171   - return null;
172   - }
173   -
174   -}
huaheng-wms-core/src/main/java/org/jeecg/utils/CustomLogContextListener.java renamed to huaheng-wms-core/src/main/java/org/jeecg/utils/listener/CustomLogContextListener.java
1   -package org.jeecg.utils;
  1 +package org.jeecg.utils.listener;
2 2  
3 3 import ch.qos.logback.classic.Level;
4 4 import ch.qos.logback.classic.Logger;
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/manager/RedisConfigCacheManager.java 0 → 100644
  1 +package org.jeecg.utils.manager;
  2 +
  3 +import java.time.Duration;
  4 +import java.util.Map;
  5 +
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.springframework.data.redis.cache.CacheKeyPrefix;
  8 +import org.springframework.data.redis.cache.RedisCache;
  9 +import org.springframework.data.redis.cache.RedisCacheConfiguration;
  10 +import org.springframework.data.redis.cache.RedisCacheManager;
  11 +import org.springframework.data.redis.cache.RedisCacheWriter;
  12 +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
  13 +import org.springframework.data.redis.serializer.RedisSerializationContext;
  14 +
  15 +import lombok.extern.slf4j.Slf4j;
  16 +
  17 +/**
  18 + * redis 配置类
  19 + */
  20 +@Slf4j
  21 +public class RedisConfigCacheManager extends RedisCacheManager {
  22 +
  23 + public RedisConfigCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) {
  24 + super(cacheWriter, defaultCacheConfiguration);
  25 + }
  26 +
  27 + public RedisConfigCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, String... initialCacheNames) {
  28 + super(cacheWriter, defaultCacheConfiguration, initialCacheNames);
  29 + }
  30 +
  31 + public RedisConfigCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, boolean allowInFlightCacheCreation,
  32 + String... initialCacheNames) {
  33 + super(cacheWriter, defaultCacheConfiguration, allowInFlightCacheCreation, initialCacheNames);
  34 + }
  35 +
  36 + public RedisConfigCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration,
  37 + Map<String, RedisCacheConfiguration> initialCacheConfigurations) {
  38 + super(cacheWriter, defaultCacheConfiguration, initialCacheConfigurations);
  39 + }
  40 +
  41 + public RedisConfigCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration,
  42 + Map<String, RedisCacheConfiguration> initialCacheConfigurations, boolean allowInFlightCacheCreation) {
  43 + super(cacheWriter, defaultCacheConfiguration, initialCacheConfigurations, allowInFlightCacheCreation);
  44 + }
  45 +
  46 + private static final RedisSerializationContext.SerializationPair<Object> DEFAULT_PAIR =
  47 + RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer());
  48 +
  49 + private static final CacheKeyPrefix DEFAULT_CACHE_KEY_PREFIX = cacheName -> cacheName + ":";
  50 +
  51 + @Override
  52 + protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) {
  53 + final int lastIndexOf = StringUtils.lastIndexOf(name, '#');
  54 + if (lastIndexOf > -1) {
  55 + final String ttl = StringUtils.substring(name, lastIndexOf + 1);
  56 + final Duration duration = Duration.ofSeconds(Long.parseLong(ttl));
  57 + cacheConfig = cacheConfig.entryTtl(duration);
  58 + // 修改缓存key和value值的序列化方式
  59 + cacheConfig = cacheConfig.computePrefixWith(DEFAULT_CACHE_KEY_PREFIX).serializeValuesWith(DEFAULT_PAIR);
  60 + final String cacheName = StringUtils.substring(name, 0, lastIndexOf);
  61 + return super.createRedisCache(cacheName, cacheConfig);
  62 + } else {
  63 + // 修改缓存key和value值的序列化方式
  64 + cacheConfig = cacheConfig.computePrefixWith(DEFAULT_CACHE_KEY_PREFIX).serializeValuesWith(DEFAULT_PAIR);
  65 + return super.createRedisCache(name, cacheConfig);
  66 + }
  67 + // throw new RuntimeException("字符串中必须包含#号,#号后为过期时间, -1为永不过期");
  68 + }
  69 +}
0 70 \ No newline at end of file
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/RedissonDistributedLocker.java renamed to huaheng-wms-core/src/main/java/org/jeecg/utils/support/RedissonDistributedLocker.java
1   -package org.jeecg.utils;
  1 +package org.jeecg.utils.support;
2 2  
3 3 import java.util.concurrent.TimeUnit;
4 4  
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/support/StrFormatter.java deleted
1   -package org.jeecg.utils.support;
2   -
3   -import org.jeecg.utils.StringUtils;
4   -
5   -/**
6   - * 字符串格式化
7   - * @author huaheng
8   - */
9   -public class StrFormatter {
10   -
11   - public static final String EMPTY_JSON = "{}";
12   - public static final char C_BACKSLASH = '\\';
13   - public static final char C_DELIM_START = '{';
14   - public static final char C_DELIM_END = '}';
15   -
16   - /**
17   - * 格式化字符串<br>
18   - * 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
19   - * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
20   - * 例:<br>
21   - * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
22   - * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
23   - * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
24   - * @param strPattern 字符串模板
25   - * @param argArray 参数列表
26   - * @return 结果
27   - */
28   - public static String format(final String strPattern, final Object... argArray) {
29   - if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
30   - return strPattern;
31   - }
32   - final int strPatternLength = strPattern.length();
33   -
34   - // 初始化定义好的长度以获得更好的性能
35   - StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
36   -
37   - int handledPosition = 0;
38   - int delimIndex;// 占位符所在位置
39   - for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
40   - delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
41   - if (delimIndex == -1) {
42   - if (handledPosition == 0) {
43   - return strPattern;
44   - } else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
45   - sbuf.append(strPattern, handledPosition, strPatternLength);
46   - return sbuf.toString();
47   - }
48   - } else {
49   - if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) {
50   - if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
51   - // 转义符之前还有一个转义符,占位符依旧有效
52   - sbuf.append(strPattern, handledPosition, delimIndex - 1);
53   - sbuf.append(Convert.utf8Str(argArray[argIndex]));
54   - handledPosition = delimIndex + 2;
55   - } else {
56   - // 占位符被转义
57   - argIndex--;
58   - sbuf.append(strPattern, handledPosition, delimIndex - 1);
59   - sbuf.append(C_DELIM_START);
60   - handledPosition = delimIndex + 1;
61   - }
62   - } else {
63   - // 正常占位符
64   - sbuf.append(strPattern, handledPosition, delimIndex);
65   - sbuf.append(Convert.utf8Str(argArray[argIndex]));
66   - handledPosition = delimIndex + 2;
67   - }
68   - }
69   - }
70   - // append the characters following the last {} pair.
71   - // 加入最后一个占位符后所有的字符
72   - sbuf.append(strPattern, handledPosition, strPattern.length());
73   -
74   - return sbuf.toString();
75   - }
76   -
77   -}
huaheng-wms-core/src/main/resources/application-dev.yml
... ... @@ -191,7 +191,7 @@ jeecg:
191 191 #webapp文件路径
192 192 webapp: /opt/webapp
193 193 shiro:
194   - excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/test/test**
  194 + excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/test/test**,/api/wms/**
195 195 #阿里云oss存储和大鱼短信秘钥配置
196 196 oss:
197 197 accessKey: ??
... ... @@ -273,8 +273,10 @@ cas:
273 273 #Mybatis输出sql日志
274 274 logging:
275 275 level:
276   - org.jeecg.modules.wms: debug
277   - org.springframework: info
  276 + org.jeecg.common: WARN
  277 + org.jeecg.modules: WARN
  278 + org.jeecg.modules.wms: DEBUG
  279 + org.jeecg.config.shiro: INFO
278 280 #swagger
279 281 knife4j:
280 282 #开启增强配置
... ...
huaheng-wms-core/src/main/resources/application-prod.yml
... ... @@ -189,7 +189,7 @@ jeecg:
189 189 #webapp文件路径
190 190 webapp: /opt/jeecg-boot/webapp
191 191 shiro:
192   - excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
  192 + excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/test/test**,/api/wms/**
193 193 #阿里云oss存储和大鱼短信秘钥配置
194 194 oss:
195 195 accessKey: ??
... ... @@ -262,8 +262,10 @@ cas:
262 262 #Mybatis输出sql日志
263 263 logging:
264 264 level:
265   - org.jeecg.modules.wms: info
266   - org.springframework: info
  265 + org.jeecg.common: WARN
  266 + org.jeecg.modules: WARN
  267 + org.jeecg.modules.wms: DEBUG
  268 + org.jeecg.config.shiro: INFO
267 269 #swagger
268 270 knife4j:
269 271 #开启增强配置
... ...
huaheng-wms-core/src/main/resources/application-test.yml
... ... @@ -191,7 +191,7 @@ jeecg:
191 191 #webapp文件路径
192 192 webapp: /opt/webapp
193 193 shiro:
194   - excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/test/test**
  194 + excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/test/test**,/api/wms/**
195 195 #阿里云oss存储和大鱼短信秘钥配置
196 196 oss:
197 197 accessKey: ??
... ... @@ -274,8 +274,10 @@ cas:
274 274 #Mybatis输出sql日志
275 275 logging:
276 276 level:
277   - org.jeecg.modules.wms: debug
278   - org.springframework: info
  277 + org.jeecg.common: WARN
  278 + org.jeecg.modules: WARN
  279 + org.jeecg.modules.wms: DEBUG
  280 + org.jeecg.config.shiro: DEBUG
279 281 #swagger
280 282 knife4j:
281 283 #开启增强配置
... ...
huaheng-wms-core/src/main/resources/application.yml
... ... @@ -3,3 +3,7 @@ spring:
3 3 name: huaheng-wms-core
4 4 profiles:
5 5 active: test
  6 +
  7 +huaheng:
  8 + system:
  9 + Id: HUAHENG-WMS4
... ...
huaheng-wms-core/src/main/resources/banner.txt
... ... @@ -9,4 +9,4 @@
9 9 888 888 "Y88888P" d88P 888 888 888 8888888888 888 Y888 "Y8888P88 888P Y888 888 888 "Y8888P" 888
10 10  
11 11 Jeecg Boot Version: 3.1.0
12   -Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
13 12 \ No newline at end of file
  13 +Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
... ...
huaheng-wms-core/src/main/resources/logback-spring.xml
... ... @@ -2,7 +2,7 @@
2 2 <configuration debug="false">
3 3  
4 4 <!-- 监听器,指定日志文件存放目录 -->
5   - <contextListener class="org.jeecg.utils.CustomLogContextListener" />
  5 + <contextListener class="org.jeecg.utils.listener.CustomLogContextListener" />
6 6  
7 7 <!--定义日志文件的存储地址 -->
8 8 <property name="LOG_HOME" value="${LOG_PATH}/logs" />
... ...