Showing
28 changed files
with
333 additions
and
67 deletions
| ... | ... | @@ -293,6 +293,8 @@ CREATE TABLE IF NOT EXISTS `purchase_order_info` |
| 293 | 293 | `element` varchar(500) DEFAULT NULL COMMENT '元素', |
| 294 | 294 | `production_process` text COMMENT '生产工艺', |
| 295 | 295 | `dept_id` varchar(50) DEFAULT NULL COMMENT '办事处', |
| 296 | + `region` varchar(32) DEFAULT NULL COMMENT '区域', | |
| 297 | + `stock_up_company_id` varchar(32) DEFAULT NULL COMMENT '备货单位', | |
| 296 | 298 | `workshop_id` varchar(50) DEFAULT NULL COMMENT '生产厂', |
| 297 | 299 | `customer_credit_id` varchar(50) DEFAULT NULL COMMENT '客户资信主键', |
| 298 | 300 | `examine_status` varchar(50) DEFAULT NULL COMMENT '审核状态', |
| ... | ... | @@ -663,6 +665,7 @@ CREATE TABLE IF NOT EXISTS `shipments_order_info` ( |
| 663 | 665 | `workshop_id` varchar(32) NOT NULL COMMENT '厂房ID', |
| 664 | 666 | `shipments_date` date NOT NULL COMMENT '发货日期', |
| 665 | 667 | `dept_id` varchar(500) NOT NULL COMMENT '办事处ID', |
| 668 | + `region` varchar(500) DEFAULT NULL COMMENT '区域', | |
| 666 | 669 | `delivery_type` varchar(500) DEFAULT NULL COMMENT '交货方式', |
| 667 | 670 | `destination` varchar(500) DEFAULT NULL COMMENT '目的地', |
| 668 | 671 | `payment_type` varchar(500) DEFAULT NULL COMMENT '付款方式', |
| ... | ... | @@ -702,7 +705,7 @@ create table if not exists `tbl_contract_distributor_standard` |
| 702 | 705 | `code` varchar(20) not null comment '编号', |
| 703 | 706 | `supplier` varchar(50) not null comment '供方', |
| 704 | 707 | `buyer` varchar(200) not null comment '需方', |
| 705 | - `stock_up_company` varchar(32) not null comment '备货单位', | |
| 708 | + `stock_up_company_id` varchar(32) not null comment '备货单位', | |
| 706 | 709 | `dept_id` varchar(32) not null comment '办事处', |
| 707 | 710 | `region` varchar(32) comment '区域', |
| 708 | 711 | `order_date` date NOT NULL COMMENT '订货日期', |
| ... | ... | @@ -881,6 +884,7 @@ create table `tbl_replenishment_order` |
| 881 | 884 | `code` varchar(50) NOT NULL COMMENT '编号', |
| 882 | 885 | `workshop_id` varchar(32) comment '分厂', |
| 883 | 886 | `dept_id` varchar(32) comment '办事处', |
| 887 | + `region` varchar(32) comment '区域', | |
| 884 | 888 | `customer_id` varchar(32) comment '购货单位', |
| 885 | 889 | `origin_plan_ship_date` DATE COMMENT '原计划发货日期', |
| 886 | 890 | `purchase_order_id` varchar(32) COMMENT '订货单', |
| ... | ... | @@ -947,4 +951,4 @@ create table if not exists customer_visit_record( |
| 947 | 951 | update_by_id varchar(32) not null comment '更新人ID', |
| 948 | 952 | create_time datetime default now() comment '创建时间', |
| 949 | 953 | update_time datetime default now() comment '更新时间' |
| 950 | -); | |
| \ No newline at end of file | ||
| 954 | +); | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/contract/GetContractDistributorStandardBo.java
| ... | ... | @@ -83,6 +83,18 @@ public class GetContractDistributorStandardBo extends BaseBo<ContractDistributor |
| 83 | 83 | private String regionName; |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | + * 备货单位ID | |
| 87 | + */ | |
| 88 | + @ApiModelProperty("备货单位ID") | |
| 89 | + private String stockUpCompanyId; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 备货单位名称 | |
| 93 | + */ | |
| 94 | + @ApiModelProperty("备货单位名称") | |
| 95 | + private String stockUpCompanyName; | |
| 96 | + | |
| 97 | + /** | |
| 86 | 98 | * 订货日期 |
| 87 | 99 | */ |
| 88 | 100 | @ApiModelProperty("订货日期") | ... | ... |
| ... | ... | @@ -67,6 +67,18 @@ public class QueryContractDistributorStandardBo extends BaseBo<ContractDistribut |
| 67 | 67 | private String regionName; |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | + * 备货单位ID | |
| 71 | + */ | |
| 72 | + @ApiModelProperty("备货单位ID") | |
| 73 | + private String stockUpCompanyId; | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 备货单位名称 | |
| 77 | + */ | |
| 78 | + @ApiModelProperty("备货单位名称") | |
| 79 | + private String stockUpCompanyName; | |
| 80 | + | |
| 81 | + /** | |
| 70 | 82 | * 创建人 |
| 71 | 83 | */ |
| 72 | 84 | @ApiModelProperty("创建人") | ... | ... |
| ... | ... | @@ -195,6 +195,30 @@ public class GetPurchaseOrderInfoBo extends BaseBo<PurchaseOrderInfo> { |
| 195 | 195 | private String deptName; |
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | + * 区域 | |
| 199 | + */ | |
| 200 | + @ApiModelProperty("区域") | |
| 201 | + private String region; | |
| 202 | + | |
| 203 | + /** | |
| 204 | + * 区域名称(非持久化字段) | |
| 205 | + */ | |
| 206 | + @ApiModelProperty("区域名称") | |
| 207 | + private String regionName; | |
| 208 | + | |
| 209 | + /** | |
| 210 | + * 备货单位ID | |
| 211 | + */ | |
| 212 | + @ApiModelProperty("备货单位ID") | |
| 213 | + private String stockUpCompanyId; | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * 备货单位名称(非持久化字段) | |
| 217 | + */ | |
| 218 | + @ApiModelProperty("备货单位名称") | |
| 219 | + private String stockUpCompanyName; | |
| 220 | + | |
| 221 | + /** | |
| 198 | 222 | * 生产厂 |
| 199 | 223 | */ |
| 200 | 224 | @ApiModelProperty("生产厂") | ... | ... |
| ... | ... | @@ -55,6 +55,19 @@ public class GetReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> { |
| 55 | 55 | @ApiModelProperty("办事处名称") |
| 56 | 56 | private String deptName; |
| 57 | 57 | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 区域 | |
| 61 | + */ | |
| 62 | + @ApiModelProperty("区域") | |
| 63 | + private String region; | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * 区域名称 | |
| 67 | + */ | |
| 68 | + @ApiModelProperty("区域名称") | |
| 69 | + private String regionName; | |
| 70 | + | |
| 58 | 71 | /** |
| 59 | 72 | * 购货单位 |
| 60 | 73 | */ | ... | ... |
| ... | ... | @@ -56,6 +56,18 @@ public class QueryReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> { |
| 56 | 56 | private String deptName; |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | + * 区域 | |
| 60 | + */ | |
| 61 | + @ApiModelProperty("办事处") | |
| 62 | + private String region; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 区域名称 | |
| 66 | + */ | |
| 67 | + @ApiModelProperty("区域名称") | |
| 68 | + private String regionName; | |
| 69 | + | |
| 70 | + /** | |
| 59 | 71 | * 购货单位 |
| 60 | 72 | */ |
| 61 | 73 | @ApiModelProperty("购货单位") | ... | ... |
| ... | ... | @@ -193,7 +193,13 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 193 | 193 | .stream() |
| 194 | 194 | .collect(Collectors.toMap(SysDept::getId, Function.identity())); |
| 195 | 195 | List<String> buyerIdList = boList.stream().map(QueryContractDistributorStandardBo::getBuyer).collect(Collectors.toList()); |
| 196 | - Map<String, Customer> customerMap = CollectionUtils.emptyIfNull(customerService.listByIds(buyerIdList)) | |
| 196 | + List<String> stockUpCompanyIdList = boList.stream().map(QueryContractDistributorStandardBo::getStockUpCompanyId).collect(Collectors.toList()); | |
| 197 | + buyerIdList.addAll(stockUpCompanyIdList); | |
| 198 | + //去重 | |
| 199 | + List<String> distinctList = buyerIdList.stream() | |
| 200 | + .distinct() | |
| 201 | + .collect(Collectors.toList()); | |
| 202 | + Map<String, Customer> customerMap = CollectionUtils.emptyIfNull(customerService.listByIds(distinctList)) | |
| 197 | 203 | .stream() |
| 198 | 204 | .collect(Collectors.toMap(Customer::getId, Function.identity())); |
| 199 | 205 | List<SysDataDicItem> sysDataDicItemList = sysDataDicItemService.findByDicCode(AUDIT_STATUS_DIC_CODE); |
| ... | ... | @@ -245,6 +251,10 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 245 | 251 | if (StringUtils.isNotBlank(bo.getRegion())) { |
| 246 | 252 | bo.setRegionName(finalRegionMap.get(bo.getRegion())); |
| 247 | 253 | } |
| 254 | + if (StringUtils.isNotBlank(bo.getStockUpCompanyId())) { | |
| 255 | + Customer customer = customerMap.get(bo.getStockUpCompanyId()); | |
| 256 | + bo.setStockUpCompanyName(customer == null ? "" : customer.getName()); | |
| 257 | + } | |
| 248 | 258 | }); |
| 249 | 259 | |
| 250 | 260 | boPageResult.setDatas(boList); |
| ... | ... | @@ -350,6 +360,10 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 350 | 360 | SysDept dept = sysDeptService.findById(result.getRegion()); |
| 351 | 361 | result.setRegionName(dept == null ? null : dept.getName()); |
| 352 | 362 | } |
| 363 | + if (StringUtils.isNotBlank(result.getStockUpCompanyId())) { | |
| 364 | + Customer customer1 = customerService.findById(result.getStockUpCompanyId()); | |
| 365 | + result.setStockUpCompanyName(customer1 == null ? null : customer1.getName()); | |
| 366 | + } | |
| 353 | 367 | |
| 354 | 368 | return InvokeResultBuilder.success(result); |
| 355 | 369 | } |
| ... | ... | @@ -384,24 +398,6 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 384 | 398 | throw new DefaultClientException("编号重复,请重新输入!"); |
| 385 | 399 | } |
| 386 | 400 | |
| 387 | - //获取当前人员ID | |
| 388 | - String currentUserId = SecurityUtil.getCurrentUser().getId(); | |
| 389 | - SysUser sysUser = sysUserService.findById(currentUserId); | |
| 390 | - if (sysUser != null) { | |
| 391 | - GetSysUserBo getSysUserBo = new GetSysUserBo(sysUser); | |
| 392 | - //部门 | |
| 393 | - List<String> depts = getSysUserBo.getDepts(); | |
| 394 | - if (org.apache.commons.collections.CollectionUtils.isNotEmpty(depts)) { | |
| 395 | - SysDept sysDept = sysDeptService.findById(depts.get(0)); | |
| 396 | - vo.setDeptId(sysDept.getId()); | |
| 397 | - if (sysDept.getName().endsWith("区域") && StringUtils.isNotBlank(sysDept.getParentId())) { // 如果是**区域,则查询上一层次是否为**办事处,获取办事处code | |
| 398 | - SysDept parentSysDept = sysDeptService.findById(sysDept.getParentId()); | |
| 399 | - if (parentSysDept != null && parentSysDept.getName().endsWith("办事处")) { | |
| 400 | - vo.setDeptId(sysDept.getParentId()); | |
| 401 | - } | |
| 402 | - } | |
| 403 | - } | |
| 404 | - } | |
| 405 | 401 | |
| 406 | 402 | if ("PROCESS_STD_AGMT".equals(vo.getType())) { |
| 407 | 403 | contractDistributorStandardService.createStdContract(vo); | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/order/PurchaseOrderInfoController.java
| ... | ... | @@ -409,20 +409,11 @@ public class PurchaseOrderInfoController extends DefaultBaseController { |
| 409 | 409 | "DEALER".equals(et) ? "经销商" : |
| 410 | 410 | "TERMINAL".equals(et) ? "终端" : ""); |
| 411 | 411 | //办事处 |
| 412 | - String deptCode = transactorHandler.returnDeptCode(data.getContractCreateById()); | |
| 413 | - dataMap.put("officeName", returnDeptName(deptCode)); | |
| 414 | - //区域=创建人部门名称 | |
| 415 | - List<SysUserDept> sysUserDeptList = sysUserDeptService.getByUserId(data.getContractCreateById()); | |
| 416 | - String deptName = ""; | |
| 417 | - if (CollectionUtils.isNotEmpty(sysUserDeptList)) { | |
| 418 | - deptName = sysUserDeptList.stream() | |
| 419 | - .map(sysUserDept -> sysDeptService.findById(sysUserDept.getDeptId())) | |
| 420 | - .filter(Objects::nonNull) // 防止 findById 返回 null | |
| 421 | - .map(SysDept::getName) | |
| 422 | - .collect(Collectors.joining(",")); | |
| 423 | - } | |
| 424 | - dataMap.put("deptName", deptName); | |
| 425 | - | |
| 412 | + dataMap.put("deptName", data.getDeptName() == null ? "" : data.getDeptName()); | |
| 413 | + //区域 | |
| 414 | + dataMap.put("regionName", data.getRegionName() == null ? "" : data.getRegionName()); | |
| 415 | + //备货单位名称 | |
| 416 | + dataMap.put("stockUpCompanyName", data.getStockUpCompanyName() == null ? "" : data.getStockUpCompanyName()); | |
| 426 | 417 | |
| 427 | 418 | processTemplate(workbook, dataMap); |
| 428 | 419 | ... | ... |
| ... | ... | @@ -110,6 +110,9 @@ public class ReplenishmentOrderController extends DefaultBaseController { |
| 110 | 110 | |
| 111 | 111 | List<QueryReplenishmentOrderBo> boList = boPageResult.getDatas(); |
| 112 | 112 | List<String> deptIdList = boList.stream().map(QueryReplenishmentOrderBo::getDeptId).collect(Collectors.toList()); |
| 113 | + List<String> regionList = boList.stream().map(QueryReplenishmentOrderBo::getRegion).collect(Collectors.toList()); | |
| 114 | + deptIdList.addAll(regionList); | |
| 115 | + deptIdList = deptIdList.stream().distinct().collect(Collectors.toList()); | |
| 113 | 116 | Map<String, SysDept> sysDeptMap = CollectionUtils.emptyIfNull(sysDeptService.listByIds(deptIdList)) |
| 114 | 117 | .stream() |
| 115 | 118 | .collect(Collectors.toMap(SysDept::getId, Function.identity())); |
| ... | ... | @@ -135,6 +138,11 @@ public class ReplenishmentOrderController extends DefaultBaseController { |
| 135 | 138 | queryReplenishmentOrderBo.setDeptName(sysDept == null ? "" : sysDept.getName()); |
| 136 | 139 | } |
| 137 | 140 | |
| 141 | + if (StringUtils.isNotBlank(queryReplenishmentOrderBo.getRegion())) { | |
| 142 | + SysDept sysDept = sysDeptMap.get(queryReplenishmentOrderBo.getRegion()); | |
| 143 | + queryReplenishmentOrderBo.setRegionName(sysDept == null ? "" : sysDept.getName()); | |
| 144 | + } | |
| 145 | + | |
| 138 | 146 | if (StringUtils.isNotBlank(queryReplenishmentOrderBo.getCustomerId())) { |
| 139 | 147 | Customer customer = customerMap.get(queryReplenishmentOrderBo.getCustomerId()); |
| 140 | 148 | queryReplenishmentOrderBo.setCustomerName(customer == null ? "" : customer.getName()); |
| ... | ... | @@ -171,6 +179,8 @@ public class ReplenishmentOrderController extends DefaultBaseController { |
| 171 | 179 | GetReplenishmentOrderBo result = new GetReplenishmentOrderBo(data); |
| 172 | 180 | SysDept sysDept = sysDeptService.findById(data.getDeptId()); |
| 173 | 181 | result.setDeptName(sysDept == null ? "" : sysDept.getName()); |
| 182 | + SysDept sysDept1 = sysDeptService.findById(data.getRegion()); | |
| 183 | + result.setRegionName(sysDept1 == null ? "" : sysDept1.getName()); | |
| 174 | 184 | Workshop workshop = workshopService.findById(data.getWorkshopId()); |
| 175 | 185 | result.setWorkshopName(workshop == null ? "" : workshop.getName()); |
| 176 | 186 | Customer customer = customerService.findById(data.getCustomerId()); | ... | ... |
| ... | ... | @@ -2,7 +2,9 @@ package com.lframework.xingyun.sc.controller.shipments; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.resource.ClassPathResource; |
| 4 | 4 | import com.lframework.starter.web.core.utils.JsonUtil; |
| 5 | +import com.lframework.starter.web.inner.entity.SysDept; | |
| 5 | 6 | import com.lframework.starter.web.inner.entity.SysUser; |
| 7 | +import com.lframework.starter.web.inner.service.system.SysDeptService; | |
| 6 | 8 | import com.lframework.starter.web.inner.service.system.SysUserService; |
| 7 | 9 | import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo; |
| 8 | 10 | import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo; |
| ... | ... | @@ -52,10 +54,7 @@ import java.time.Duration; |
| 52 | 54 | import java.time.LocalDate; |
| 53 | 55 | import java.time.LocalDateTime; |
| 54 | 56 | import java.time.format.DateTimeFormatter; |
| 55 | -import java.util.ArrayList; | |
| 56 | -import java.util.Comparator; | |
| 57 | -import java.util.List; | |
| 58 | -import java.util.Map; | |
| 57 | +import java.util.*; | |
| 59 | 58 | import java.util.concurrent.TimeUnit; |
| 60 | 59 | import java.util.stream.Collectors; |
| 61 | 60 | import java.util.zip.ZipEntry; |
| ... | ... | @@ -81,6 +80,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
| 81 | 80 | private SysUserService sysUserService; |
| 82 | 81 | @Resource |
| 83 | 82 | private RedisTemplate redisTemplate; |
| 83 | + @Resource | |
| 84 | + private SysDeptService sysDeptService; | |
| 84 | 85 | |
| 85 | 86 | |
| 86 | 87 | /** |
| ... | ... | @@ -401,6 +402,38 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
| 401 | 402 | // 流水号 |
| 402 | 403 | String serialNumber = createSerialNumber(null, "SHIPMENT_ORDER_SERIAL_NUMBER"); |
| 403 | 404 | dataMap.put("serialNumber", serialNumber); |
| 405 | + // 办事处 | |
| 406 | + String deptId = orderInfo.getDeptId(); | |
| 407 | + if (StringUtils.isNotBlank(deptId)) { | |
| 408 | + String[] split = deptId.split(","); | |
| 409 | + List<SysDept> deptList = sysDeptService.listByIds(Arrays.asList(split)); | |
| 410 | + StringBuilder builder = new StringBuilder(); | |
| 411 | + for (SysDept dept : deptList) { | |
| 412 | + builder.append(dept.getName()).append(","); | |
| 413 | + } | |
| 414 | + if (builder.length() > 0) { | |
| 415 | + builder.deleteCharAt(builder.length() - 1); | |
| 416 | + } | |
| 417 | + dataMap.put("deptName", builder.toString()); | |
| 418 | + } else { | |
| 419 | + dataMap.put("deptName", ""); | |
| 420 | + } | |
| 421 | + //区域 | |
| 422 | + String region = orderInfo.getRegion(); | |
| 423 | + if (StringUtils.isNotBlank(region)) { | |
| 424 | + String[] split = region.split(","); | |
| 425 | + List<SysDept> deptList = sysDeptService.listByIds(Arrays.asList(split)); | |
| 426 | + StringBuilder builder = new StringBuilder(); | |
| 427 | + for (SysDept dept : deptList) { | |
| 428 | + builder.append(dept.getName()).append(","); | |
| 429 | + } | |
| 430 | + if (builder.length() > 0) { | |
| 431 | + builder.deleteCharAt(builder.length() - 1); | |
| 432 | + } | |
| 433 | + dataMap.put("regionName", builder.toString()); | |
| 434 | + } else { | |
| 435 | + dataMap.put("regionName", ""); | |
| 436 | + } | |
| 404 | 437 | // 处理模板中的占位符 |
| 405 | 438 | ExcelUtil.processTemplate(workbook, dataMap); |
| 406 | 439 | // 生成文件名 | ... | ... |
| ... | ... | @@ -182,6 +182,28 @@ public class PurchaseOrderInfo extends BaseEntity implements BaseDto { |
| 182 | 182 | private String deptName; |
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | + * 区域 | |
| 186 | + */ | |
| 187 | + private String region; | |
| 188 | + | |
| 189 | + /** | |
| 190 | + * 区域名称(非持久化字段) | |
| 191 | + */ | |
| 192 | + @TableField(exist = false) | |
| 193 | + private String regionName; | |
| 194 | + | |
| 195 | + /** | |
| 196 | + * 备货单位ID | |
| 197 | + */ | |
| 198 | + private String stockUpCompanyId; | |
| 199 | + | |
| 200 | + /** | |
| 201 | + * 备货单位名称(非持久化字段) | |
| 202 | + */ | |
| 203 | + @TableField(exist = false) | |
| 204 | + private String stockUpCompanyName; | |
| 205 | + | |
| 206 | + /** | |
| 185 | 207 | * 生产厂 |
| 186 | 208 | */ |
| 187 | 209 | private String workshopId; | ... | ... |
| ... | ... | @@ -45,6 +45,11 @@ public class ReplenishmentOrder extends BaseEntity implements BaseDto { |
| 45 | 45 | private String deptId; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | + * 区域 | |
| 49 | + */ | |
| 50 | + private String region; | |
| 51 | + | |
| 52 | + /** | |
| 48 | 53 | * 购货单位 |
| 49 | 54 | */ |
| 50 | 55 | private String customerId; |
| ... | ... | @@ -137,4 +142,4 @@ public class ReplenishmentOrder extends BaseEntity implements BaseDto { |
| 137 | 142 | */ |
| 138 | 143 | @TableField(exist = false) |
| 139 | 144 | private Boolean isOwner; |
| 140 | -} | |
| \ No newline at end of file | ||
| 145 | +} | ... | ... |
| ... | ... | @@ -74,6 +74,17 @@ public class ShipmentsOrderInfo extends BaseEntity implements BaseDto { |
| 74 | 74 | private String deptName; |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | + * 区域 | |
| 78 | + */ | |
| 79 | + private String region; | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 区域名称 | |
| 83 | + */ | |
| 84 | + @TableField(exist = false) | |
| 85 | + private String regionName; | |
| 86 | + | |
| 87 | + /** | |
| 77 | 88 | * 交货/运输方式 |
| 78 | 89 | */ |
| 79 | 90 | private String deliveryType; | ... | ... |
| ... | ... | @@ -266,6 +266,7 @@ public class ContractDistributorStandardServiceImpl extends |
| 266 | 266 | data.setBuyer(vo.getBuyer()); |
| 267 | 267 | data.setDeptId(vo.getDeptId()); |
| 268 | 268 | data.setRegion(vo.getRegion()); |
| 269 | + data.setStockUpCompanyId(vo.getStockUpCompanyId()); | |
| 269 | 270 | data.setOrderDate(vo.getOrderDate()); |
| 270 | 271 | data.setUnit(vo.getUnit()); |
| 271 | 272 | data.setWorkshopId(vo.getWorkshopId()); |
| ... | ... | @@ -340,7 +341,9 @@ public class ContractDistributorStandardServiceImpl extends |
| 340 | 341 | .set(ContractDistributorStandard::getCode, vo.getCode()) |
| 341 | 342 | .set(ContractDistributorStandard::getSupplier, vo.getSupplier()) |
| 342 | 343 | .set(ContractDistributorStandard::getBuyer, vo.getBuyer()) |
| 344 | + .set(vo.getDeptId() != null, ContractDistributorStandard::getDeptId, vo.getDeptId()) | |
| 343 | 345 | .set(vo.getRegion() != null, ContractDistributorStandard::getRegion, vo.getRegion()) |
| 346 | + .set(vo.getStockUpCompanyId() != null, ContractDistributorStandard::getStockUpCompanyId, vo.getStockUpCompanyId()) | |
| 344 | 347 | .set(ContractDistributorStandard::getOrderDate, vo.getOrderDate()) |
| 345 | 348 | .set(ContractDistributorStandard::getUnit, vo.getUnit()) |
| 346 | 349 | .set(ContractDistributorStandard::getWorkshopId, vo.getWorkshopId()) |
| ... | ... | @@ -633,6 +636,8 @@ public class ContractDistributorStandardServiceImpl extends |
| 633 | 636 | createPurchaseOrderInfoVo.setTotalQuantity(contractDistributorStandard.getTotalQuantity()); |
| 634 | 637 | createPurchaseOrderInfoVo.setContractCreateById(contractDistributorStandard.getCreateById()); |
| 635 | 638 | createPurchaseOrderInfoVo.setDeptId(contractDistributorStandard.getDeptId()); |
| 639 | + createPurchaseOrderInfoVo.setRegion(contractDistributorStandard.getRegion()); | |
| 640 | + createPurchaseOrderInfoVo.setStockUpCompanyId(contractDistributorStandard.getStockUpCompanyId()); | |
| 636 | 641 | createPurchaseOrderInfoVo.setWorkshopId(contractDistributorStandard.getWorkshopId()); |
| 637 | 642 | createPurchaseOrderInfoVo.setExecutionStandard(contractDistributorStandard.getExecutionStandard()); |
| 638 | 643 | createPurchaseOrderInfoVo.setExecutionStandardRemarks(contractDistributorStandard.getExecutionStandardRemarks()); | ... | ... |
| ... | ... | @@ -218,6 +218,12 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 218 | 218 | if (!StringUtil.isBlank(vo.getDeptId())) { |
| 219 | 219 | data.setDeptId(vo.getDeptId()); |
| 220 | 220 | } |
| 221 | + if (!StringUtil.isBlank(vo.getRegion())) { | |
| 222 | + data.setRegion(vo.getRegion()); | |
| 223 | + } | |
| 224 | + if (!StringUtil.isBlank(vo.getStockUpCompanyId())) { | |
| 225 | + data.setStockUpCompanyId(vo.getStockUpCompanyId()); | |
| 226 | + } | |
| 221 | 227 | if (!StringUtil.isBlank(vo.getWorkshopId())) { |
| 222 | 228 | data.setWorkshopId(vo.getWorkshopId()); |
| 223 | 229 | } |
| ... | ... | @@ -293,7 +299,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 293 | 299 | .set(PurchaseOrderInfo::getStatus, StringUtil.isBlank(vo.getStatus()) ? null : vo.getStatus()) |
| 294 | 300 | .set(PurchaseOrderInfo::getExamineStatus, "AUDIT")//审核中 |
| 295 | 301 | .set(vo.getProductionProcess() != null, PurchaseOrderInfo::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess()) |
| 296 | - .set(PurchaseOrderInfo::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) | |
| 302 | + .set(vo.getDeptId() != null, PurchaseOrderInfo::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) | |
| 297 | 303 | .set(PurchaseOrderInfo::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId()) |
| 298 | 304 | .set(PurchaseOrderInfo::getCustomerCreditId, StringUtil.isBlank(vo.getCustomerCreditId()) ? null : vo.getCustomerCreditId()) |
| 299 | 305 | .set(PurchaseOrderInfo::getTotalQuantity, vo.getTotalQuantity() == null ? null : vo.getTotalQuantity()) | ... | ... |
| ... | ... | @@ -109,6 +109,7 @@ public class ReplenishmentOrderServiceImpl extends BaseMpServiceImpl<Replenishme |
| 109 | 109 | data.setCode(vo.getCode()); |
| 110 | 110 | data.setWorkshopId(vo.getWorkshopId()); |
| 111 | 111 | data.setDeptId(vo.getDeptId()); |
| 112 | + data.setRegion(vo.getRegion()); | |
| 112 | 113 | data.setCustomerId(vo.getCustomerId()); |
| 113 | 114 | data.setOriginPlanShipDate(vo.getOriginPlanShipDate()); |
| 114 | 115 | data.setPurchaseOrderId(vo.getPurchaseOrderId()); |
| ... | ... | @@ -297,6 +298,8 @@ public class ReplenishmentOrderServiceImpl extends BaseMpServiceImpl<Replenishme |
| 297 | 298 | vo.setDeliveryMethod(purchaseOrderInfo.getDeliveryMethod()); |
| 298 | 299 | vo.setContractCreateById(purchaseOrderInfo.getContractCreateById()); |
| 299 | 300 | vo.setDeptId(purchaseOrderInfo.getDeptId()); |
| 301 | + vo.setRegion(purchaseOrderInfo.getRegion()); | |
| 302 | + vo.setStockUpCompanyId(purchaseOrderInfo.getStockUpCompanyId()); | |
| 300 | 303 | vo.setWorkshopId(purchaseOrderInfo.getWorkshopId()); |
| 301 | 304 | vo.setExecutionStandard(purchaseOrderInfo.getExecutionStandard()); |
| 302 | 305 | vo.setExecutionStandardRemarks(purchaseOrderInfo.getExecutionStandardRemarks()); | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| ... | ... | @@ -121,36 +121,65 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 121 | 121 | List<String> deptIds = new ArrayList<>(); |
| 122 | 122 | for (ShipmentsOrderInfo orderInfo : shipmentsOrderList) { |
| 123 | 123 | String deptId = orderInfo.getDeptId(); |
| 124 | - if (StringUtils.isBlank(deptId)) { | |
| 125 | - continue; | |
| 124 | + String region = orderInfo.getRegion(); | |
| 125 | + if (!StringUtils.isBlank(deptId)) { | |
| 126 | + String[] split = deptId.split(","); | |
| 127 | + Collections.addAll(deptIds, split); | |
| 128 | + } | |
| 129 | + if (!StringUtils.isBlank(region)) { | |
| 130 | + String[] split = region.split(","); | |
| 131 | + Collections.addAll(deptIds, split); | |
| 126 | 132 | } |
| 127 | - String[] split = deptId.split(","); | |
| 128 | - Collections.addAll(deptIds, split); | |
| 129 | 133 | } |
| 130 | 134 | Map<String, SysDept> deptMap = new HashMap<>(); |
| 131 | 135 | if (CollectionUtils.isNotEmpty(deptIds)) { |
| 136 | + deptIds = deptIds.stream().distinct().collect(Collectors.toList()); | |
| 132 | 137 | List<SysDept> deptList = sysDeptService.listByIds(deptIds); |
| 133 | 138 | deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getId, Function.identity())); |
| 134 | 139 | } |
| 135 | 140 | for (ShipmentsOrderInfo orderInfo : shipmentsOrderList) { |
| 136 | 141 | String deptId = orderInfo.getDeptId(); |
| 137 | - if (StringUtils.isBlank(deptId)) { | |
| 138 | - continue; | |
| 139 | - } | |
| 140 | - String[] split = deptId.split(","); | |
| 141 | - if (split.length > 1) { | |
| 142 | - StringBuilder builder = new StringBuilder(); | |
| 143 | - for (int i = 0; i < split.length; i++) { | |
| 144 | - builder.append(split[i]); | |
| 145 | - builder.append(","); | |
| 142 | + String region = orderInfo.getRegion(); | |
| 143 | + if (!StringUtils.isBlank(deptId)) { | |
| 144 | + String[] split = deptId.split(","); | |
| 145 | + if (split.length > 1) { | |
| 146 | + StringBuilder builder = new StringBuilder(); | |
| 147 | + for (int i = 0; i < split.length; i++) { | |
| 148 | + SysDept sysDept = deptMap.get(split[i]); | |
| 149 | + if (sysDept != null) { | |
| 150 | + builder.append(sysDept.getName()); | |
| 151 | + builder.append(","); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + builder.deleteCharAt(builder.length() - 1); | |
| 155 | + | |
| 156 | + orderInfo.setDeptName(builder.toString()); | |
| 157 | + } else { | |
| 158 | + SysDept sysDept = deptMap.get(split[0]); | |
| 159 | + if (sysDept != null) { | |
| 160 | + orderInfo.setDeptName(sysDept.getName()); | |
| 161 | + } | |
| 146 | 162 | } |
| 147 | - builder.deleteCharAt(builder.length() - 1); | |
| 163 | + } | |
| 164 | + if (!StringUtils.isBlank(region)) { | |
| 165 | + String[] split = region.split(","); | |
| 166 | + if (split.length > 1) { | |
| 167 | + StringBuilder builder = new StringBuilder(); | |
| 168 | + for (int i = 0; i < split.length; i++) { | |
| 169 | + SysDept sysDept = deptMap.get(split[i]); | |
| 170 | + if (sysDept != null) { | |
| 171 | + builder.append(sysDept.getName()); | |
| 172 | + builder.append(","); | |
| 173 | + } | |
| 174 | + } | |
| 175 | + builder.deleteCharAt(builder.length() - 1); | |
| 148 | 176 | |
| 149 | - orderInfo.setDeptName(builder.toString()); | |
| 150 | - } else { | |
| 151 | - SysDept sysDept = deptMap.get(split[0]); | |
| 152 | - if (sysDept != null) { | |
| 153 | - orderInfo.setDeptName(sysDept.getName()); | |
| 177 | + orderInfo.setRegionName(builder.toString()); | |
| 178 | + } else { | |
| 179 | + SysDept sysDept = deptMap.get(split[0]); | |
| 180 | + if (sysDept != null) { | |
| 181 | + orderInfo.setRegionName(sysDept.getName()); | |
| 182 | + } | |
| 154 | 183 | } |
| 155 | 184 | } |
| 156 | 185 | } |
| ... | ... | @@ -189,6 +218,20 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 189 | 218 | } |
| 190 | 219 | orderInfo.setDeptName(builder.toString()); |
| 191 | 220 | } |
| 221 | + //区域 | |
| 222 | + String region = orderInfo.getRegion(); | |
| 223 | + if (StringUtils.isNotBlank(region)) { | |
| 224 | + String[] split = region.split(","); | |
| 225 | + List<SysDept> deptList = sysDeptService.listByIds(Arrays.asList(split)); | |
| 226 | + StringBuilder builder = new StringBuilder(); | |
| 227 | + for (SysDept dept : deptList) { | |
| 228 | + builder.append(dept.getName()).append(","); | |
| 229 | + } | |
| 230 | + if (builder.length() > 0) { | |
| 231 | + builder.deleteCharAt(builder.length() - 1); | |
| 232 | + } | |
| 233 | + orderInfo.setRegionName(builder.toString()); | |
| 234 | + } | |
| 192 | 235 | // 获取发货单明细数据 |
| 193 | 236 | List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByShipmentOrderId(id); |
| 194 | 237 | orderInfo.setDetailList(detailList); |
| ... | ... | @@ -207,6 +250,7 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 207 | 250 | data.setWorkshopId(vo.getWorkshopId()); |
| 208 | 251 | data.setShipmentsDate(vo.getShipmentsDate()); |
| 209 | 252 | data.setDeptId(vo.getDeptId()); |
| 253 | + data.setRegion(vo.getRegion()); | |
| 210 | 254 | data.setDeliveryType(vo.getDeliveryType()); |
| 211 | 255 | data.setDestination(vo.getDestination()); |
| 212 | 256 | |
| ... | ... | @@ -466,6 +510,7 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 466 | 510 | Map<String, BigDecimal> quantityMap = new HashMap<>(); |
| 467 | 511 | Map<String, String> shipmentsOrderIdMap = new HashMap<>(); |
| 468 | 512 | Map<String, List<String>> deptIdMap = new HashMap<>(); |
| 513 | + Map<String, List<String>> regionMap = new HashMap<>(); | |
| 469 | 514 | List<String> detailIds = new ArrayList<>(); |
| 470 | 515 | List<ShipmentsOrderInfo> shipmentsOrderInfoList = new ArrayList<>(); |
| 471 | 516 | for (List<ShipmentsPlanDetail> details : batchList) { |
| ... | ... | @@ -493,6 +538,11 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 493 | 538 | if (!list.contains(orderInfo.getDeptId())) { |
| 494 | 539 | list.add(orderInfo.getDeptId()); |
| 495 | 540 | } |
| 541 | + //区域 | |
| 542 | + List<String> regionList = regionMap.computeIfAbsent(id, k -> new ArrayList<>()); | |
| 543 | + if (!regionList.contains(orderInfo.getRegion())) { | |
| 544 | + regionList.add(orderInfo.getRegion()); | |
| 545 | + } | |
| 496 | 546 | // 交货方式 |
| 497 | 547 | String deliveryMethod = orderInfo.getDeliveryMethod(); |
| 498 | 548 | if (StringUtils.isNotBlank(deliveryMethod) && !deliveryTypeSet.contains(deliveryMethod)) { |
| ... | ... | @@ -556,13 +606,18 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 556 | 606 | shipmentsPlanDetailService.setShipmentsOrderId(detailIds, id); |
| 557 | 607 | } |
| 558 | 608 | // 获取所有部门数据 |
| 559 | - for ( ShipmentsOrderInfo orderInfo : shipmentsOrderInfoList) { | |
| 609 | + for (ShipmentsOrderInfo orderInfo : shipmentsOrderInfoList) { | |
| 560 | 610 | String id = orderInfo.getId(); |
| 561 | 611 | List<String> deptIds = deptIdMap.get(id); |
| 562 | 612 | if (CollectionUtils.isNotEmpty(deptIds)) { |
| 563 | 613 | String deptIdStr = String.join(",", deptIds); |
| 564 | 614 | orderInfo.setDeptId(deptIdStr); |
| 565 | 615 | } |
| 616 | + List<String> regionList = regionMap.get(id); | |
| 617 | + if (CollectionUtils.isNotEmpty(regionList)) { | |
| 618 | + String regionStr = String.join(",", regionList); | |
| 619 | + orderInfo.setRegion(regionStr); | |
| 620 | + } | |
| 566 | 621 | } |
| 567 | 622 | // 批量新增发货单 |
| 568 | 623 | batchAdd(shipmentsOrderInfoList); | ... | ... |
| ... | ... | @@ -47,14 +47,15 @@ public class CreateContractDistributorStandardVo implements BaseVo, Serializable |
| 47 | 47 | private String buyer; |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * 备货单位 | |
| 50 | + * 备货单位ID | |
| 51 | 51 | */ |
| 52 | - @ApiModelProperty(value = "备货单位") | |
| 53 | - private String stockUpCompany; | |
| 52 | + @ApiModelProperty(value = "备货单位", required = true) | |
| 53 | + private String stockUpCompanyId; | |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * 办事处 |
| 57 | 57 | */ |
| 58 | + @ApiModelProperty(value = "办事处", required = true) | |
| 58 | 59 | private String deptId; |
| 59 | 60 | |
| 60 | 61 | /** | ... | ... |
| ... | ... | @@ -49,10 +49,16 @@ public class UpdateContractDistributorStandardVo implements BaseVo, Serializable |
| 49 | 49 | private String buyer; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * 备货单位 | |
| 52 | + * 备货单位ID | |
| 53 | 53 | */ |
| 54 | - @ApiModelProperty(value = "备货单位") | |
| 55 | - private String stockUpCompany; | |
| 54 | + @ApiModelProperty("备货单位") | |
| 55 | + private String stockUpCompanyId; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 办事处ID | |
| 59 | + */ | |
| 60 | + @ApiModelProperty("办事处") | |
| 61 | + private String deptId; | |
| 56 | 62 | |
| 57 | 63 | /** |
| 58 | 64 | * 区域 | ... | ... |
| ... | ... | @@ -184,6 +184,18 @@ public class CreatePurchaseOrderInfoVo implements BaseVo, Serializable { |
| 184 | 184 | private String deptId; |
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | + * 区域 | |
| 188 | + */ | |
| 189 | + @ApiModelProperty("区域") | |
| 190 | + private String region; | |
| 191 | + | |
| 192 | + /** | |
| 193 | + * 备货单位ID | |
| 194 | + */ | |
| 195 | + @ApiModelProperty("备货单位ID") | |
| 196 | + private String stockUpCompanyId; | |
| 197 | + | |
| 198 | + /** | |
| 187 | 199 | * 生产厂 |
| 188 | 200 | */ |
| 189 | 201 | @ApiModelProperty("生产厂") | ... | ... |
| ... | ... | @@ -40,6 +40,13 @@ public class CreateReplenishmentOrderVo implements BaseVo, Serializable { |
| 40 | 40 | private String deptId; |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | + * 区域 | |
| 44 | + */ | |
| 45 | + @ApiModelProperty(value = "区域") | |
| 46 | + @Length(message = "区域最多允许32个字符!") | |
| 47 | + private String region; | |
| 48 | + | |
| 49 | + /** | |
| 43 | 50 | * 购货单位 |
| 44 | 51 | */ |
| 45 | 52 | @ApiModelProperty(value = "购货单位") | ... | ... |
| ... | ... | @@ -56,6 +56,14 @@ public class CreateShipmentsOrderInfoVo implements BaseVo, Serializable { |
| 56 | 56 | private String deptId; |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | + * 区域ID | |
| 60 | + */ | |
| 61 | + @ApiModelProperty(value = "区域ID", required = true) | |
| 62 | + @NotBlank(message = "请输入区域ID!") | |
| 63 | + @Length(message = "区域ID最多允许500个字符!") | |
| 64 | + private String region; | |
| 65 | + | |
| 66 | + /** | |
| 59 | 67 | * 交货方式 |
| 60 | 68 | */ |
| 61 | 69 | @ApiModelProperty(value = "交货方式", required = true) | ... | ... |
| ... | ... | @@ -8,6 +8,8 @@ |
| 8 | 8 | <result column="supplier" property="supplier"/> |
| 9 | 9 | <result column="buyer" property="buyer"/> |
| 10 | 10 | <result column="dept_id" property="deptId"/> |
| 11 | + <result column="region" property="region"/> | |
| 12 | + <result column="stock_up_company_id" property="stockUpCompanyId"/> | |
| 11 | 13 | <result column="order_date" property="orderDate"/> |
| 12 | 14 | <result column="unit" property="unit"/> |
| 13 | 15 | <result column="workshop_id" property="workshopId"/> |
| ... | ... | @@ -70,6 +72,7 @@ |
| 70 | 72 | tb.buyer, |
| 71 | 73 | tb.dept_id, |
| 72 | 74 | tb.region, |
| 75 | + tb.stock_up_company_id, | |
| 73 | 76 | tb.order_date, |
| 74 | 77 | tb.unit, |
| 75 | 78 | tb.workshop_id, | ... | ... |
| ... | ... | @@ -32,6 +32,10 @@ |
| 32 | 32 | <result column="production_process" property="productionProcess"/> |
| 33 | 33 | <result column="dept_id" property="deptId"/> |
| 34 | 34 | <result column="dept_name" property="deptName"/> |
| 35 | + <result column="region" property="region"/> | |
| 36 | + <result column="region_name" property="regionName"/> | |
| 37 | + <result column="stock_up_company_id" property="stockUpCompanyId"/> | |
| 38 | + <result column="stock_up_company_name" property="stockUpCompanyName"/> | |
| 35 | 39 | <result column="workshop_id" property="workshopId"/> |
| 36 | 40 | <result column="workshop_name" property="workshopName"/> |
| 37 | 41 | <result column="customer_credit_id" property="customerCreditId"/> |
| ... | ... | @@ -81,6 +85,10 @@ |
| 81 | 85 | tb.production_process, |
| 82 | 86 | tb.dept_id, |
| 83 | 87 | sd.name AS dept_name, |
| 88 | + tb.region, | |
| 89 | + sd1.name AS region_name, | |
| 90 | + tb.stock_up_company_id, | |
| 91 | + cu1.name AS stock_up_company_name, | |
| 84 | 92 | tb.workshop_id, |
| 85 | 93 | ws.name AS workshop_name, |
| 86 | 94 | tb.customer_credit_id, |
| ... | ... | @@ -103,6 +111,8 @@ |
| 103 | 111 | left join base_data_workshop as ws on ws.id = tb.workshop_id |
| 104 | 112 | left join customer_credit as cc on cc.id = tb.customer_credit_id |
| 105 | 113 | left join sys_user as su on su.id = tb.contract_create_by_id |
| 114 | + left join sys_dept as sd1 on sd1.id = tb.region | |
| 115 | + left join base_data_customer as cu1 on cu1.id = tb.stock_up_company_id | |
| 106 | 116 | </sql> |
| 107 | 117 | |
| 108 | 118 | <select id="query" resultMap="PurchaseOrderInfo"> | ... | ... |
No preview for this file type
No preview for this file type
No preview for this file type