Commit feffc7d9e34bdb1518ac32263aaa3d41d52bf06b
1 parent
cdd83c0a
增加用户库区
Showing
10 changed files
with
184 additions
and
51 deletions
ant-design-vue-jeecg/src/views/system/UserList.vue
@@ -119,6 +119,12 @@ | @@ -119,6 +119,12 @@ | ||
119 | </a-tag> | 119 | </a-tag> |
120 | </span> | 120 | </span> |
121 | 121 | ||
122 | + <span slot="zoneCodes" slot-scope="zoneCodes" > | ||
123 | + <a-tag v-for="zoneCode in zoneCodes" :key="zoneCode" color=pink> | ||
124 | + {{ solutionZoneCode(zoneCode) }} | ||
125 | + </a-tag> | ||
126 | + </span> | ||
127 | + | ||
122 | <template slot="avatarslot" slot-scope="text, record"> | 128 | <template slot="avatarslot" slot-scope="text, record"> |
123 | <div class="anty-img-wrap"> | 129 | <div class="anty-img-wrap"> |
124 | <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/> | 130 | <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/> |
@@ -190,7 +196,7 @@ | @@ -190,7 +196,7 @@ | ||
190 | import UserModal from './modules/UserModal' | 196 | import UserModal from './modules/UserModal' |
191 | import PasswordModal from './modules/PasswordModal' | 197 | import PasswordModal from './modules/PasswordModal' |
192 | import {putAction, getFileAccessHttpUrl} from '@/api/manage'; | 198 | import {putAction, getFileAccessHttpUrl} from '@/api/manage'; |
193 | -import {frozenBatch, getAllWarehouseList, queryall} from '@/api/api' | 199 | +import {frozenBatch, getAllWarehouseList, queryall, getZoneList} from '@/api/api' |
194 | import {JeecgListMixin} from '@/mixins/JeecgListMixin' | 200 | import {JeecgListMixin} from '@/mixins/JeecgListMixin' |
195 | import SysUserAgentModal from "./modules/SysUserAgentModal"; | 201 | import SysUserAgentModal from "./modules/SysUserAgentModal"; |
196 | import JInput from '@/components/jeecg/JInput' | 202 | import JInput from '@/components/jeecg/JInput' |
@@ -216,6 +222,7 @@ export default { | @@ -216,6 +222,7 @@ export default { | ||
216 | queryParam: {}, | 222 | queryParam: {}, |
217 | recycleBinVisible: false, | 223 | recycleBinVisible: false, |
218 | allWarehouseList: [], | 224 | allWarehouseList: [], |
225 | + zoneList: [], | ||
219 | rolesOptions: [], | 226 | rolesOptions: [], |
220 | columns: [ | 227 | columns: [ |
221 | /*{ | 228 | /*{ |
@@ -287,6 +294,13 @@ export default { | @@ -287,6 +294,13 @@ export default { | ||
287 | key: 'selectedWarehouses', | 294 | key: 'selectedWarehouses', |
288 | scopedSlots: {customRender: 'selectedWarehouses'} | 295 | scopedSlots: {customRender: 'selectedWarehouses'} |
289 | }, | 296 | }, |
297 | + { | ||
298 | + title: '所属库区', | ||
299 | + align: "center", | ||
300 | + dataIndex: 'zoneCodes', | ||
301 | + key: 'zoneCodes', | ||
302 | + scopedSlots: {customRender: 'zoneCodes'} | ||
303 | + }, | ||
290 | // { | 304 | // { |
291 | // title: '部门', | 305 | // title: '部门', |
292 | // align: "center", | 306 | // align: "center", |
@@ -338,6 +352,11 @@ export default { | @@ -338,6 +352,11 @@ export default { | ||
338 | }, | 352 | }, |
339 | methods: { | 353 | methods: { |
340 | loadFrom() { | 354 | loadFrom() { |
355 | + getZoneList().then((res) => { | ||
356 | + if (res.success) { | ||
357 | + this.zoneList = res.result | ||
358 | + } | ||
359 | + }); | ||
341 | getAllWarehouseList().then((res) => { | 360 | getAllWarehouseList().then((res) => { |
342 | if (res.success) { | 361 | if (res.success) { |
343 | this.allWarehouseList = res.result | 362 | this.allWarehouseList = res.result |
@@ -363,6 +382,16 @@ export default { | @@ -363,6 +382,16 @@ export default { | ||
363 | }) | 382 | }) |
364 | return actions.join('') | 383 | return actions.join('') |
365 | }, | 384 | }, |
385 | + solutionZoneCode(value) { | ||
386 | + var actions = [] | ||
387 | + Object.keys(this.zoneList).some((key) => { | ||
388 | + if (this.zoneList[key].code == ('' + value)) { | ||
389 | + actions.push(this.zoneList[key].name) | ||
390 | + return true | ||
391 | + } | ||
392 | + }) | ||
393 | + return actions.join('') | ||
394 | + }, | ||
366 | solutionRole(value) { | 395 | solutionRole(value) { |
367 | var actions = [] | 396 | var actions = [] |
368 | Object.keys(this.rolesOptions).some((key) => { | 397 | Object.keys(this.rolesOptions).some((key) => { |
ant-design-vue-jeecg/src/views/system/modules/UserModal.vue
@@ -70,6 +70,15 @@ | @@ -70,6 +70,15 @@ | ||
70 | </j-multi-select-tag> | 70 | </j-multi-select-tag> |
71 | </a-form-model-item> | 71 | </a-form-model-item> |
72 | 72 | ||
73 | + <a-form-model-item label="库区分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!warehouseDisable" prop="selectedZoneCode"> | ||
74 | + <j-multi-select-tag | ||
75 | + :disabled="disableSubmit" | ||
76 | + v-model="model.selectedZoneCode" | ||
77 | + :options="zoneOptions" | ||
78 | + placeholder="请选择仓库"> | ||
79 | + </j-multi-select-tag> | ||
80 | + </a-form-model-item> | ||
81 | + | ||
73 | <!--部门分配--> | 82 | <!--部门分配--> |
74 | <!-- <a-form-model-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled"> | 83 | <!-- <a-form-model-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled"> |
75 | <j-select-depart v-model="model.selecteddeparts" :multi="true" @back="backDepartInfo" :backDepart="true" :treeOpera="true"> | 84 | <j-select-depart v-model="model.selecteddeparts" :multi="true" @back="backDepartInfo" :backDepart="true" :treeOpera="true"> |
@@ -153,7 +162,7 @@ import moment from 'moment' | @@ -153,7 +162,7 @@ import moment from 'moment' | ||
153 | import Vue from 'vue' | 162 | import Vue from 'vue' |
154 | import {ACCESS_TOKEN} from "@/store/mutation-types" | 163 | import {ACCESS_TOKEN} from "@/store/mutation-types" |
155 | import {getAction} from '@/api/manage' | 164 | import {getAction} from '@/api/manage' |
156 | -import {addUser, editUser, queryUserRole, queryall, queryWarehouse, getAllWarehouseList} from '@/api/api' | 165 | +import {addUser, editUser, queryUserRole, queryall, queryWarehouse, getAllWarehouseList, getAllZoneList} from '@/api/api' |
157 | import {disabledAuthFilter} from "@/utils/authFilter" | 166 | import {disabledAuthFilter} from "@/utils/authFilter" |
158 | import {duplicateCheck} from '@/api/api' | 167 | import {duplicateCheck} from '@/api/api' |
159 | 168 | ||
@@ -216,6 +225,7 @@ export default { | @@ -216,6 +225,7 @@ export default { | ||
216 | queryTenantList: '/sys/tenant/queryList' | 225 | queryTenantList: '/sys/tenant/queryList' |
217 | }, | 226 | }, |
218 | tenantsOptions: [], | 227 | tenantsOptions: [], |
228 | + zoneOptions:[], | ||
219 | warehouseOptions: [], | 229 | warehouseOptions: [], |
220 | rolesOptions: [], | 230 | rolesOptions: [], |
221 | nextDepartOptions: [], | 231 | nextDepartOptions: [], |
@@ -227,6 +237,7 @@ export default { | @@ -227,6 +237,7 @@ export default { | ||
227 | this.initRoleList() | 237 | this.initRoleList() |
228 | this.initWarehouseList() | 238 | this.initWarehouseList() |
229 | this.initTenantList() | 239 | this.initTenantList() |
240 | + this.initZoneList() | ||
230 | }, | 241 | }, |
231 | computed: { | 242 | computed: { |
232 | uploadAction: function () { | 243 | uploadAction: function () { |
@@ -244,7 +255,7 @@ export default { | @@ -244,7 +255,7 @@ export default { | ||
244 | //根据屏幕宽度自适应抽屉宽度 | 255 | //根据屏幕宽度自适应抽屉宽度 |
245 | this.resetScreenSize(); | 256 | this.resetScreenSize(); |
246 | that.userId = record.id; | 257 | that.userId = record.id; |
247 | - that.model = Object.assign({}, {selectedRoles: '', selectedWarehouse: '',selecteddeparts: ''}, record); | 258 | + that.model = Object.assign({}, {selectedRoles: '', selectedWarehouse: '',selecteddeparts: '', selectedZoneCode: ''}, record); |
248 | //身份为上级显示负责部门,否则不显示 | 259 | //身份为上级显示负责部门,否则不显示 |
249 | if (this.model.userIdentity == 2) { | 260 | if (this.model.userIdentity == 2) { |
250 | this.departIdShow = true; | 261 | this.departIdShow = true; |
@@ -315,6 +326,17 @@ export default { | @@ -315,6 +326,17 @@ export default { | ||
315 | } | 326 | } |
316 | }); | 327 | }); |
317 | }, | 328 | }, |
329 | + initZoneList() { | ||
330 | + getAllZoneList().then((res) => { | ||
331 | + if (res.success) { | ||
332 | + this.zoneOptions = res.result.map((item, index, arr) => { | ||
333 | + let c = {label: item.name, value: item.code} | ||
334 | + return c; | ||
335 | + }) | ||
336 | + console.log('this.zoneOptions: ', this.zoneOptions) | ||
337 | + } | ||
338 | + }); | ||
339 | + }, | ||
318 | getWarehouse(userid) { | 340 | getWarehouse(userid) { |
319 | queryWarehouse({userid: userid}).then((res) => { | 341 | queryWarehouse({userid: userid}).then((res) => { |
320 | if (res.success) { | 342 | if (res.success) { |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
@@ -172,6 +172,7 @@ public class SysUserController { | @@ -172,6 +172,7 @@ public class SysUserController { | ||
172 | Result<SysUser> result = new Result<SysUser>(); | 172 | Result<SysUser> result = new Result<SysUser>(); |
173 | String selectedRoles = jsonObject.getString("selectedRoles"); | 173 | String selectedRoles = jsonObject.getString("selectedRoles"); |
174 | String selectedWarehouse = jsonObject.getString("selectedWarehouse"); | 174 | String selectedWarehouse = jsonObject.getString("selectedWarehouse"); |
175 | + String selectedZoneCode = jsonObject.getString("selectedZoneCode"); | ||
175 | String selectedDeparts = jsonObject.getString("selecteddeparts"); | 176 | String selectedDeparts = jsonObject.getString("selecteddeparts"); |
176 | try { | 177 | try { |
177 | SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); | 178 | SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); |
@@ -186,7 +187,7 @@ public class SysUserController { | @@ -186,7 +187,7 @@ public class SysUserController { | ||
186 | throw new ServiceException("仓库不能为空"); | 187 | throw new ServiceException("仓库不能为空"); |
187 | } | 188 | } |
188 | // 保存用户走一个service 保证事务 | 189 | // 保存用户走一个service 保证事务 |
189 | - sysUserService.saveUser(user, selectedRoles, selectedDeparts, selectedWarehouse); | 190 | + sysUserService.saveUser(user, selectedRoles, selectedDeparts, selectedWarehouse, selectedZoneCode); |
190 | result.success("添加成功!"); | 191 | result.success("添加成功!"); |
191 | } catch (Exception e) { | 192 | } catch (Exception e) { |
192 | log.error(e.getMessage(), e); | 193 | log.error(e.getMessage(), e); |
@@ -213,6 +214,7 @@ public class SysUserController { | @@ -213,6 +214,7 @@ public class SysUserController { | ||
213 | user.setPassword(sysUser.getPassword()); | 214 | user.setPassword(sysUser.getPassword()); |
214 | String roles = jsonObject.getString("selectedRoles"); | 215 | String roles = jsonObject.getString("selectedRoles"); |
215 | String selectedWarehouse = jsonObject.getString("selectedWarehouse"); | 216 | String selectedWarehouse = jsonObject.getString("selectedWarehouse"); |
217 | + String selectedZoneCode = jsonObject.getString("selectedZoneCode"); | ||
216 | String departs = jsonObject.getString("selecteddeparts"); | 218 | String departs = jsonObject.getString("selecteddeparts"); |
217 | if (oConvertUtils.isEmpty(departs)) { | 219 | if (oConvertUtils.isEmpty(departs)) { |
218 | // vue3.0前端只传递了departIds | 220 | // vue3.0前端只传递了departIds |
@@ -222,7 +224,7 @@ public class SysUserController { | @@ -222,7 +224,7 @@ public class SysUserController { | ||
222 | throw new ServiceException("仓库不能为空"); | 224 | throw new ServiceException("仓库不能为空"); |
223 | } | 225 | } |
224 | // 修改用户走一个service 保证事务 | 226 | // 修改用户走一个service 保证事务 |
225 | - sysUserService.editUser(user, roles, departs, selectedWarehouse); | 227 | + sysUserService.editUser(user, roles, departs, selectedWarehouse, selectedZoneCode); |
226 | result.success("修改成功!"); | 228 | result.success("修改成功!"); |
227 | } | 229 | } |
228 | } catch (Exception e) { | 230 | } catch (Exception e) { |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/entity/SysUser.java
@@ -193,14 +193,30 @@ public class SysUser implements Serializable { | @@ -193,14 +193,30 @@ public class SysUser implements Serializable { | ||
193 | 193 | ||
194 | /** 设备id uniapp推送用 */ | 194 | /** 设备id uniapp推送用 */ |
195 | private String clientId; | 195 | private String clientId; |
196 | - | 196 | + |
197 | + /** 所属库区 **/ | ||
198 | + private String zoneCode; | ||
199 | + | ||
197 | @TableField(exist = false) | 200 | @TableField(exist = false) |
198 | private List<String> selectedWarehouses; | 201 | private List<String> selectedWarehouses; |
199 | - | 202 | + |
200 | public void setSelectedWarehouse(String selectedWarehouse) { | 203 | public void setSelectedWarehouse(String selectedWarehouse) { |
201 | if (!StringUtils.isEmpty(selectedWarehouse)) { | 204 | if (!StringUtils.isEmpty(selectedWarehouse)) { |
202 | this.selectedWarehouse = selectedWarehouse; | 205 | this.selectedWarehouse = selectedWarehouse; |
203 | this.selectedWarehouses = Arrays.asList(selectedWarehouse.split(",")); | 206 | this.selectedWarehouses = Arrays.asList(selectedWarehouse.split(",")); |
204 | } | 207 | } |
205 | } | 208 | } |
209 | + | ||
210 | + @TableField(exist = false) | ||
211 | + private List<String> zoneCodes; | ||
212 | + | ||
213 | + public void setZoneCode(String zoneCode) { | ||
214 | + if (!StringUtils.isEmpty(zoneCode)) { | ||
215 | + this.zoneCode = zoneCode; | ||
216 | + this.zoneCodes = Arrays.asList(zoneCode.split(",")); | ||
217 | + } else { | ||
218 | + this.zoneCode = zoneCode; | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
206 | } | 222 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
@@ -231,7 +231,7 @@ public interface ISysUserService extends IService<SysUser> { | @@ -231,7 +231,7 @@ public interface ISysUserService extends IService<SysUser> { | ||
231 | * @param selectedRoles 选择的角色id,多个以逗号隔开 | 231 | * @param selectedRoles 选择的角色id,多个以逗号隔开 |
232 | * @param selectedDeparts 选择的部门id,多个以逗号隔开 | 232 | * @param selectedDeparts 选择的部门id,多个以逗号隔开 |
233 | */ | 233 | */ |
234 | - void saveUser(SysUser user, String selectedRoles, String selectedDeparts, String selectedWarehouse); | 234 | + void saveUser(SysUser user, String selectedRoles, String selectedDeparts, String selectedWarehouse, String selectedZoneCode); |
235 | 235 | ||
236 | /** | 236 | /** |
237 | * 编辑用户 | 237 | * 编辑用户 |
@@ -239,7 +239,7 @@ public interface ISysUserService extends IService<SysUser> { | @@ -239,7 +239,7 @@ public interface ISysUserService extends IService<SysUser> { | ||
239 | * @param roles 选择的角色id,多个以逗号隔开 | 239 | * @param roles 选择的角色id,多个以逗号隔开 |
240 | * @param departs 选择的部门id,多个以逗号隔开 | 240 | * @param departs 选择的部门id,多个以逗号隔开 |
241 | */ | 241 | */ |
242 | - void editUser(SysUser user, String roles, String departs, String selectedWarehouse); | 242 | + void editUser(SysUser user, String roles, String departs, String selectedWarehouse, String selectedZoneCode); |
243 | 243 | ||
244 | /** userId转为username */ | 244 | /** userId转为username */ |
245 | List<String> userIdToUsername(Collection<String> userIdList); | 245 | List<String> userIdToUsername(Collection<String> userIdList); |
@@ -251,4 +251,5 @@ public interface ISysUserService extends IService<SysUser> { | @@ -251,4 +251,5 @@ public interface ISysUserService extends IService<SysUser> { | ||
251 | */ | 251 | */ |
252 | public List<Map<String, Object>> getWarehouseByUserCode(String userCode); | 252 | public List<Map<String, Object>> getWarehouseByUserCode(String userCode); |
253 | 253 | ||
254 | + public SysUser getUserByRealName(String realName); | ||
254 | } | 255 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
@@ -23,10 +23,10 @@ import org.jeecg.modules.system.service.ISysUserService; | @@ -23,10 +23,10 @@ import org.jeecg.modules.system.service.ISysUserService; | ||
23 | import org.jeecg.modules.system.vo.SysUserDepVo; | 23 | import org.jeecg.modules.system.vo.SysUserDepVo; |
24 | import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; | 24 | import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; |
25 | import org.jeecg.modules.wms.config.sysUserWarehouse.service.ISysUserWarehouseService; | 25 | import org.jeecg.modules.wms.config.sysUserWarehouse.service.ISysUserWarehouseService; |
26 | -import org.jeecg.modules.wms.config.warehouse.entity.Warehouse; | ||
27 | import org.jeecg.modules.wms.config.warehouse.service.IWarehouseService; | 26 | import org.jeecg.modules.wms.config.warehouse.service.IWarehouseService; |
28 | import org.jeecg.utils.HuahengJwtUtil; | 27 | import org.jeecg.utils.HuahengJwtUtil; |
29 | import org.jeecg.utils.StringUtils; | 28 | import org.jeecg.utils.StringUtils; |
29 | +import org.jeecg.utils.constant.QuantityConstant; | ||
30 | import org.springframework.beans.factory.annotation.Autowired; | 30 | import org.springframework.beans.factory.annotation.Autowired; |
31 | import org.springframework.cache.annotation.CacheEvict; | 31 | import org.springframework.cache.annotation.CacheEvict; |
32 | import org.springframework.stereotype.Service; | 32 | import org.springframework.stereotype.Service; |
@@ -489,7 +489,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | @@ -489,7 +489,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ||
489 | 489 | ||
490 | @Override | 490 | @Override |
491 | @Transactional(rollbackFor = Exception.class) | 491 | @Transactional(rollbackFor = Exception.class) |
492 | - public void saveUser(SysUser user, String selectedRoles, String selectedDeparts, String selectedWarehouse) { | 492 | + public void saveUser(SysUser user, String selectedRoles, String selectedDeparts, String selectedWarehouse, String selectedZoneCode) { |
493 | // step.1 保存用户 | 493 | // step.1 保存用户 |
494 | this.save(user); | 494 | this.save(user); |
495 | // step.2 保存角色 | 495 | // step.2 保存角色 |
@@ -520,12 +520,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | @@ -520,12 +520,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ||
520 | } | 520 | } |
521 | } | 521 | } |
522 | } | 522 | } |
523 | + | ||
524 | + SysUser sysUser = new SysUser(); | ||
525 | + sysUser.setId(user.getId()); | ||
526 | + sysUser.setZoneCode(selectedZoneCode); | ||
527 | + if (!sysUserService.updateById(sysUser)) { | ||
528 | + throw new JeecgBootException("更新用户库区失败"); | ||
529 | + } | ||
530 | + | ||
523 | } | 531 | } |
524 | 532 | ||
525 | @Override | 533 | @Override |
526 | @Transactional(rollbackFor = Exception.class) | 534 | @Transactional(rollbackFor = Exception.class) |
527 | @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) | 535 | @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) |
528 | - public void editUser(SysUser user, String roles, String departs, String selectedWarehouse) { | 536 | + public void editUser(SysUser user, String roles, String departs, String selectedWarehouse, String selectedZoneCode) { |
529 | // step.1 修改用户基础信息 | 537 | // step.1 修改用户基础信息 |
530 | this.updateById(user); | 538 | this.updateById(user); |
531 | // step.2 修改角色 | 539 | // step.2 修改角色 |
@@ -593,6 +601,17 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | @@ -593,6 +601,17 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ||
593 | } | 601 | } |
594 | } | 602 | } |
595 | } | 603 | } |
604 | + | ||
605 | + SysUser sysUser = new SysUser(); | ||
606 | + sysUser.setId(user.getId()); | ||
607 | + if (StringUtils.isEmpty(selectedZoneCode)) { | ||
608 | + sysUser.setZoneCode(QuantityConstant.EMPTY_STRING); | ||
609 | + } else { | ||
610 | + sysUser.setZoneCode(selectedZoneCode); | ||
611 | + } | ||
612 | + if (!sysUserService.updateById(sysUser)) { | ||
613 | + throw new JeecgBootException("更新用户库区失败"); | ||
614 | + } | ||
596 | } | 615 | } |
597 | 616 | ||
598 | @Override | 617 | @Override |
@@ -617,4 +636,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | @@ -617,4 +636,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ||
617 | return userMapper.getWarehouseByUserName(username); | 636 | return userMapper.getWarehouseByUserName(username); |
618 | } | 637 | } |
619 | 638 | ||
639 | + @Override | ||
640 | + public SysUser getUserByRealName(String realName) { | ||
641 | + LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
642 | + sysUserLambdaQueryWrapper.eq(SysUser::getRealname, realName); | ||
643 | + SysUser sysUser = getOne(sysUserLambdaQueryWrapper); | ||
644 | + return sysUser; | ||
645 | + } | ||
646 | + | ||
620 | } | 647 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/controller/ZoneController.java
@@ -2,45 +2,36 @@ package org.jeecg.modules.wms.config.zone.controller; | @@ -2,45 +2,36 @@ package org.jeecg.modules.wms.config.zone.controller; | ||
2 | 2 | ||
3 | import java.util.Arrays; | 3 | import java.util.Arrays; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | -import java.util.Map; | ||
6 | -import java.util.stream.Collectors; | ||
7 | -import java.io.IOException; | ||
8 | -import java.io.UnsupportedEncodingException; | ||
9 | -import java.net.URLDecoder; | 5 | + |
6 | +import javax.annotation.Resource; | ||
10 | import javax.servlet.http.HttpServletRequest; | 7 | import javax.servlet.http.HttpServletRequest; |
11 | import javax.servlet.http.HttpServletResponse; | 8 | import javax.servlet.http.HttpServletResponse; |
12 | 9 | ||
13 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
14 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
15 | import org.apache.shiro.authz.annotation.RequiresPermissions; | 10 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
16 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
12 | +import org.jeecg.common.aspect.annotation.AutoLog; | ||
13 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
17 | import org.jeecg.common.system.query.QueryGenerator; | 14 | import org.jeecg.common.system.query.QueryGenerator; |
18 | -import org.jeecg.utils.HuahengJwtUtil; | ||
19 | -import org.jeecg.common.util.oConvertUtils; | ||
20 | - | ||
21 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
22 | -import com.baomidou.mybatisplus.core.metadata.IPage; | ||
23 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
24 | -import lombok.extern.slf4j.Slf4j; | ||
25 | - | 15 | +import org.jeecg.modules.system.entity.SysUser; |
16 | +import org.jeecg.modules.system.service.ISysUserService; | ||
26 | import org.jeecg.modules.wms.config.zone.entity.Zone; | 17 | import org.jeecg.modules.wms.config.zone.entity.Zone; |
27 | import org.jeecg.modules.wms.config.zone.service.IZoneService; | 18 | import org.jeecg.modules.wms.config.zone.service.IZoneService; |
19 | +import org.jeecg.utils.HuahengJwtUtil; | ||
28 | import org.jeecg.utils.StringUtils; | 20 | import org.jeecg.utils.StringUtils; |
29 | -import org.jeecgframework.poi.excel.ExcelImportUtil; | ||
30 | -import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
31 | -import org.jeecgframework.poi.excel.entity.ExportParams; | ||
32 | -import org.jeecgframework.poi.excel.entity.ImportParams; | ||
33 | -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
34 | -import org.jeecg.common.system.base.controller.JeecgController; | ||
35 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
36 | import org.springframework.web.bind.annotation.*; | 22 | import org.springframework.web.bind.annotation.*; |
37 | -import org.springframework.web.multipart.MultipartFile; | ||
38 | -import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
39 | import org.springframework.web.servlet.ModelAndView; | 23 | import org.springframework.web.servlet.ModelAndView; |
40 | -import com.alibaba.fastjson.JSON; | 24 | + |
25 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
26 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
27 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
28 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
29 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
30 | + | ||
31 | +import cn.hutool.core.util.StrUtil; | ||
41 | import io.swagger.annotations.Api; | 32 | import io.swagger.annotations.Api; |
42 | import io.swagger.annotations.ApiOperation; | 33 | import io.swagger.annotations.ApiOperation; |
43 | -import org.jeecg.common.aspect.annotation.AutoLog; | 34 | +import lombok.extern.slf4j.Slf4j; |
44 | 35 | ||
45 | /** | 36 | /** |
46 | * @Description: 库区管理 | 37 | * @Description: 库区管理 |
@@ -56,6 +47,9 @@ public class ZoneController extends JeecgController<Zone, IZoneService> { | @@ -56,6 +47,9 @@ public class ZoneController extends JeecgController<Zone, IZoneService> { | ||
56 | @Autowired | 47 | @Autowired |
57 | private IZoneService zoneService; | 48 | private IZoneService zoneService; |
58 | 49 | ||
50 | + @Resource | ||
51 | + private ISysUserService sysUserService; | ||
52 | + | ||
59 | /** | 53 | /** |
60 | * 分页列表查询 | 54 | * 分页列表查询 |
61 | * @param zone | 55 | * @param zone |
@@ -180,7 +174,23 @@ public class ZoneController extends JeecgController<Zone, IZoneService> { | @@ -180,7 +174,23 @@ public class ZoneController extends JeecgController<Zone, IZoneService> { | ||
180 | public Result<?> getZoneList(HttpServletRequest req) { | 174 | public Result<?> getZoneList(HttpServletRequest req) { |
181 | LambdaQueryWrapper<Zone> zoneLambdaQueryWrapper = Wrappers.lambdaQuery(); | 175 | LambdaQueryWrapper<Zone> zoneLambdaQueryWrapper = Wrappers.lambdaQuery(); |
182 | HuahengJwtUtil.setWarehouseCode(zoneLambdaQueryWrapper, Zone.class, req); | 176 | HuahengJwtUtil.setWarehouseCode(zoneLambdaQueryWrapper, Zone.class, req); |
177 | + String realName = HuahengJwtUtil.getCurrentOperator(); | ||
178 | + if (StringUtils.isNotEmpty(realName)) { | ||
179 | + SysUser sysUser = sysUserService.getUserByRealName(realName); | ||
180 | + if (StringUtils.isNotEmpty(sysUser.getZoneCode())) { | ||
181 | + zoneLambdaQueryWrapper.in(Zone::getCode, Arrays.asList(sysUser.getZoneCode().split(StrUtil.COMMA))); | ||
182 | + } | ||
183 | + } | ||
183 | List<Zone> zoneList = zoneService.list(zoneLambdaQueryWrapper); | 184 | List<Zone> zoneList = zoneService.list(zoneLambdaQueryWrapper); |
184 | return Result.OK(zoneList); | 185 | return Result.OK(zoneList); |
185 | } | 186 | } |
187 | + | ||
188 | + @RequestMapping(value = "/getAllZoneList", method = RequestMethod.GET) | ||
189 | + public Result<List<Zone>> getAllZoneList() { | ||
190 | + Result<List<Zone>> result = new Result<>(); | ||
191 | + List<Zone> list = zoneService.getAllZoneList(); | ||
192 | + result.setResult(list); | ||
193 | + result.setSuccess(true); | ||
194 | + return result; | ||
195 | + } | ||
186 | } | 196 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/service/IZoneService.java
1 | package org.jeecg.modules.wms.config.zone.service; | 1 | package org.jeecg.modules.wms.config.zone.service; |
2 | 2 | ||
3 | -import com.baomidou.mybatisplus.extension.service.IService; | ||
4 | -import org.jeecg.modules.wms.config.location.entity.Location; | 3 | +import java.util.List; |
4 | + | ||
5 | import org.jeecg.modules.wms.config.zone.entity.Zone; | 5 | import org.jeecg.modules.wms.config.zone.entity.Zone; |
6 | 6 | ||
7 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
8 | + | ||
7 | /** | 9 | /** |
8 | * @Description: 库区管理 | 10 | * @Description: 库区管理 |
9 | * @Author: jeecg-boot | 11 | * @Author: jeecg-boot |
@@ -13,4 +15,6 @@ import org.jeecg.modules.wms.config.zone.entity.Zone; | @@ -13,4 +15,6 @@ import org.jeecg.modules.wms.config.zone.entity.Zone; | ||
13 | public interface IZoneService extends IService<Zone> { | 15 | public interface IZoneService extends IService<Zone> { |
14 | 16 | ||
15 | Zone getZoneByCode(String zoneCode, String wareohuseCode); | 17 | Zone getZoneByCode(String zoneCode, String wareohuseCode); |
18 | + | ||
19 | + public List<Zone> getAllZoneList(); | ||
16 | } | 20 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/service/impl/ZoneServiceImpl.java
1 | package org.jeecg.modules.wms.config.zone.service.impl; | 1 | package org.jeecg.modules.wms.config.zone.service.impl; |
2 | 2 | ||
3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 3 | +import java.util.List; |
4 | + | ||
5 | import org.jeecg.modules.wms.config.zone.entity.Zone; | 5 | import org.jeecg.modules.wms.config.zone.entity.Zone; |
6 | import org.jeecg.modules.wms.config.zone.mapper.ZoneMapper; | 6 | import org.jeecg.modules.wms.config.zone.mapper.ZoneMapper; |
7 | import org.jeecg.modules.wms.config.zone.service.IZoneService; | 7 | import org.jeecg.modules.wms.config.zone.service.IZoneService; |
8 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
9 | 9 | ||
10 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
11 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
11 | 13 | ||
12 | /** | 14 | /** |
@@ -25,4 +27,9 @@ public class ZoneServiceImpl extends ServiceImpl<ZoneMapper, Zone> implements IZ | @@ -25,4 +27,9 @@ public class ZoneServiceImpl extends ServiceImpl<ZoneMapper, Zone> implements IZ | ||
25 | Zone zone = getOne(zoneLambdaQueryWrapper); | 27 | Zone zone = getOne(zoneLambdaQueryWrapper); |
26 | return zone; | 28 | return zone; |
27 | } | 29 | } |
30 | + | ||
31 | + @Override | ||
32 | + public List<Zone> getAllZoneList() { | ||
33 | + return list(); | ||
34 | + } | ||
28 | } | 35 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java
@@ -6,6 +6,7 @@ import java.util.List; | @@ -6,6 +6,7 @@ import java.util.List; | ||
6 | import java.util.Map; | 6 | import java.util.Map; |
7 | import java.util.stream.Collectors; | 7 | import java.util.stream.Collectors; |
8 | 8 | ||
9 | +import javax.annotation.Resource; | ||
9 | import javax.servlet.http.HttpServletRequest; | 10 | import javax.servlet.http.HttpServletRequest; |
10 | import javax.servlet.http.HttpServletResponse; | 11 | import javax.servlet.http.HttpServletResponse; |
11 | 12 | ||
@@ -17,11 +18,14 @@ import org.jeecg.common.system.base.controller.JeecgController; | @@ -17,11 +18,14 @@ import org.jeecg.common.system.base.controller.JeecgController; | ||
17 | import org.jeecg.common.system.query.QueryGenerator; | 18 | import org.jeecg.common.system.query.QueryGenerator; |
18 | import org.jeecg.common.system.vo.LoginUser; | 19 | import org.jeecg.common.system.vo.LoginUser; |
19 | import org.jeecg.common.util.oConvertUtils; | 20 | import org.jeecg.common.util.oConvertUtils; |
21 | +import org.jeecg.modules.system.entity.SysUser; | ||
22 | +import org.jeecg.modules.system.service.ISysUserService; | ||
20 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 23 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
21 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | 24 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; |
22 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | 25 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
23 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | 26 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
24 | import org.jeecg.utils.HuahengJwtUtil; | 27 | import org.jeecg.utils.HuahengJwtUtil; |
28 | +import org.jeecg.utils.StringUtils; | ||
25 | import org.jeecg.utils.constant.QuantityConstant; | 29 | import org.jeecg.utils.constant.QuantityConstant; |
26 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 30 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
27 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 31 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
@@ -29,21 +33,15 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | @@ -29,21 +33,15 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | ||
29 | import org.jeecgframework.poi.excel.entity.ImportParams; | 33 | import org.jeecgframework.poi.excel.entity.ImportParams; |
30 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 34 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
31 | import org.springframework.beans.factory.annotation.Autowired; | 35 | import org.springframework.beans.factory.annotation.Autowired; |
32 | -import org.springframework.web.bind.annotation.DeleteMapping; | ||
33 | -import org.springframework.web.bind.annotation.GetMapping; | ||
34 | -import org.springframework.web.bind.annotation.PathVariable; | ||
35 | -import org.springframework.web.bind.annotation.PostMapping; | ||
36 | -import org.springframework.web.bind.annotation.RequestBody; | ||
37 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
38 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
39 | -import org.springframework.web.bind.annotation.RequestParam; | ||
40 | -import org.springframework.web.bind.annotation.RestController; | 36 | +import org.springframework.web.bind.annotation.*; |
41 | import org.springframework.web.multipart.MultipartFile; | 37 | import org.springframework.web.multipart.MultipartFile; |
42 | import org.springframework.web.multipart.MultipartHttpServletRequest; | 38 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
43 | import org.springframework.web.servlet.ModelAndView; | 39 | import org.springframework.web.servlet.ModelAndView; |
44 | 40 | ||
41 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
45 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 42 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
46 | import com.baomidou.mybatisplus.core.metadata.IPage; | 43 | import com.baomidou.mybatisplus.core.metadata.IPage; |
44 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
47 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 45 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
48 | 46 | ||
49 | import io.swagger.annotations.Api; | 47 | import io.swagger.annotations.Api; |
@@ -68,6 +66,8 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, | @@ -68,6 +66,8 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, | ||
68 | @Autowired | 66 | @Autowired |
69 | private IInventoryDetailService inventoryDetailService; | 67 | private IInventoryDetailService inventoryDetailService; |
70 | 68 | ||
69 | + @Resource | ||
70 | + private ISysUserService sysUserService; | ||
71 | /*---------------------------------主表处理-begin-------------------------------------*/ | 71 | /*---------------------------------主表处理-begin-------------------------------------*/ |
72 | 72 | ||
73 | /** | 73 | /** |
@@ -84,9 +84,24 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, | @@ -84,9 +84,24 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, | ||
84 | public Result<IPage<InventoryHeader>> queryPageList(InventoryHeader inventoryHeader, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | 84 | public Result<IPage<InventoryHeader>> queryPageList(InventoryHeader inventoryHeader, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
85 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | 85 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
86 | HuahengJwtUtil.setWarehouseCode(req, inventoryHeader); | 86 | HuahengJwtUtil.setWarehouseCode(req, inventoryHeader); |
87 | + String realName = HuahengJwtUtil.getCurrentOperator(); | ||
88 | + String inventoryHeaderZoneCode = inventoryHeader.getZoneCode(); | ||
89 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
87 | QueryWrapper<InventoryHeader> queryWrapper = QueryGenerator.initQueryWrapper(inventoryHeader, req.getParameterMap()); | 90 | QueryWrapper<InventoryHeader> queryWrapper = QueryGenerator.initQueryWrapper(inventoryHeader, req.getParameterMap()); |
88 | Page<InventoryHeader> page = new Page<InventoryHeader>(pageNo, pageSize); | 91 | Page<InventoryHeader> page = new Page<InventoryHeader>(pageNo, pageSize); |
89 | IPage<InventoryHeader> pageList = inventoryHeaderService.page(page, queryWrapper); | 92 | IPage<InventoryHeader> pageList = inventoryHeaderService.page(page, queryWrapper); |
93 | + if (StringUtils.isEmpty(inventoryHeaderZoneCode)) { | ||
94 | + if (StringUtils.isNotEmpty(realName)) { | ||
95 | + SysUser sysUser = sysUserService.getUserByRealName(realName); | ||
96 | + if (sysUser != null) { | ||
97 | + String zoneCode = sysUser.getZoneCode(); | ||
98 | + if (StringUtils.isNotEmpty(zoneCode)) { | ||
99 | + String[] zoneCodes = zoneCode.split(","); | ||
100 | + inventoryHeaderLambdaQueryWrapper.in(InventoryHeader::getZoneCode, Arrays.asList(zoneCodes)); | ||
101 | + } | ||
102 | + } | ||
103 | + } | ||
104 | + } | ||
90 | return Result.OK(pageList); | 105 | return Result.OK(pageList); |
91 | } | 106 | } |
92 | 107 | ||
@@ -235,7 +250,7 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, | @@ -235,7 +250,7 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, | ||
235 | this.inventoryDetailService.removeByIds(Arrays.asList(ids.split(","))); | 250 | this.inventoryDetailService.removeByIds(Arrays.asList(ids.split(","))); |
236 | return Result.OK("批量删除成功!"); | 251 | return Result.OK("批量删除成功!"); |
237 | } | 252 | } |
238 | - | 253 | + |
239 | /** | 254 | /** |
240 | * 导出 | 255 | * 导出 |
241 | * @return | 256 | * @return |