业务线/仓库

ccongli-dev-0920
杨世强 1 year ago
parent 0a118be1b9
commit 12e26128c4

@ -0,0 +1,110 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.common.pojo.CommonResult;
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
import com.yunxi.scm.framework.excel.core.util.ExcelUtils;
import com.yunxi.scm.framework.operatelog.core.annotations.OperateLog;
import static com.yunxi.scm.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
import com.yunxi.scm.module.xxjj.convert.businessline.BusinessLineConvert;
import com.yunxi.scm.module.xxjj.service.businessline.BusinessLineService;
@Tag(name = "管理后台 - 业务线")
@RestController
@RequestMapping("/xxjj/business-line")
@Validated
public class BusinessLineController {
@Resource
private BusinessLineService businessLineService;
@GetMapping("/tree")
@Operation(summary = "获得业务线/仓库")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:tree')")
public CommonResult<List<BusinessLineRespVO>> getBusinessLineTree(@Valid BusinessLinePageReqVO pageVO) {
List<BusinessLineDO> pageResult = businessLineService.getBusinessLineTree();
return success(BusinessLineConvert.INSTANCE.convertList(pageResult));
}
@PostMapping("/create")
@Operation(summary = "创建业务线")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:create')")
public CommonResult<Long> createBusinessLine(@Valid @RequestBody BusinessLineCreateReqVO createReqVO) {
return success(businessLineService.createBusinessLine(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新业务线")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:update')")
public CommonResult<Boolean> updateBusinessLine(@Valid @RequestBody BusinessLineUpdateReqVO updateReqVO) {
businessLineService.updateBusinessLine(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除业务线")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('xxjj:business-line:delete')")
public CommonResult<Boolean> deleteBusinessLine(@RequestParam("id") Long id) {
businessLineService.deleteBusinessLine(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得业务线")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:query')")
public CommonResult<BusinessLineRespVO> getBusinessLine(@RequestParam("id") Long id) {
BusinessLineDO businessLine = businessLineService.getBusinessLine(id);
return success(BusinessLineConvert.INSTANCE.convert(businessLine));
}
@GetMapping("/list")
@Operation(summary = "获得业务线列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:query')")
public CommonResult<List<BusinessLineRespVO>> getBusinessLineList(@RequestParam("ids") Collection<Long> ids) {
List<BusinessLineDO> list = businessLineService.getBusinessLineList(ids);
return success(BusinessLineConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得业务线分页")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:query')")
public CommonResult<PageResult<BusinessLineRespVO>> getBusinessLinePage(@Valid BusinessLinePageReqVO pageVO) {
PageResult<BusinessLineDO> pageResult = businessLineService.getBusinessLinePage(pageVO);
return success(BusinessLineConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出业务线 Excel")
@PreAuthorize("@ss.hasPermission('xxjj:business-line:export')")
@OperateLog(type = EXPORT)
public void exportBusinessLineExcel(@Valid BusinessLineExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<BusinessLineDO> list = businessLineService.getBusinessLineList(exportReqVO);
// 导出 Excel
List<BusinessLineExcelVO> datas = BusinessLineConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "业务线.xls", "数据", BusinessLineExcelVO.class, datas);
}
}

@ -0,0 +1,86 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 线 Base VO VO 使
* VO Swagger
*/
@Data
public class BusinessLineBaseVO {
@Schema(description = "业务线编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "业务线编号不能为空")
private String businessCode;
@Schema(description = "业务线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotNull(message = "业务线名称不能为空")
private String businessName;
@Schema(description = "业务线简称")
private String businessSimple;
@Schema(description = "业务线LOGO", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "业务线LOGO不能为空")
private String businessLogo;
@Schema(description = "隶属企业", requiredMode = Schema.RequiredMode.REQUIRED, example = "16269")
@NotNull(message = "隶属企业不能为空")
private Long affiliatCompanyId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "类型不能为空")
private String type;
@Schema(description = "所属行业", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "所属行业不能为空")
private String industry;
@Schema(description = "所在城市", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "所在城市不能为空")
private String city;
@Schema(description = "成立时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "成立时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime establishDate;
@Schema(description = "归属人员", requiredMode = Schema.RequiredMode.REQUIRED, example = "12837")
@NotNull(message = "归属人员不能为空")
private Long belongUserId;
@Schema(description = "品牌/业务线/事业群名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotNull(message = "品牌/业务线/事业群名称不能为空")
private String brandName;
@Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "电话不能为空")
private Integer phone;
@Schema(description = "传真")
private String fax;
@Schema(description = "网址", example = "https://www.iocoder.cn")
private String url;
@Schema(description = "介绍")
private String description;
@TableField(exist = false)
private List<WarehouseDO> children;
@TableField(exist = false)
private String name;
}

@ -0,0 +1,14 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 业务线创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BusinessLineCreateReqVO extends BusinessLineBaseVO {
}

@ -0,0 +1,71 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 线 Excel VO
*
* @author
*/
@Data
public class BusinessLineExcelVO {
@ExcelProperty("业务id")
private Long id;
@ExcelProperty("业务线编号")
private String businessCode;
@ExcelProperty("业务线名称")
private String businessName;
@ExcelProperty("业务线简称")
private String businessSimple;
@ExcelProperty("业务线LOGO")
private String businessLogo;
@ExcelProperty("隶属企业")
private Long affiliatCompanyId;
@ExcelProperty("类型")
private String type;
@ExcelProperty("所属行业")
private String industry;
@ExcelProperty("所在城市")
private String city;
@ExcelProperty("成立时间")
private LocalDateTime establishDate;
@ExcelProperty("归属人员")
private Long belongUserId;
@ExcelProperty("品牌/业务线/事业群名称")
private String brandName;
@ExcelProperty("电话")
private Integer phone;
@ExcelProperty("传真")
private String fax;
@ExcelProperty("网址")
private String url;
@ExcelProperty("介绍")
private String description;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,48 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunxi.scm.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 业务线 Excel 导出 Request VO参数和 BusinessLinePageReqVO 是一致的")
@Data
public class BusinessLineExportReqVO {
@Schema(description = "业务线编号")
private String businessCode;
@Schema(description = "业务线名称", example = "赵六")
private String businessName;
@Schema(description = "隶属企业", example = "16269")
private Long affiliatCompanyId;
@Schema(description = "类型", example = "1")
private String type;
@Schema(description = "所属行业")
private String industry;
@Schema(description = "所在城市")
private String city;
@Schema(description = "成立时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] establishDate;
@Schema(description = "品牌/业务线/事业群名称", example = "张三")
private String brandName;
@Schema(description = "电话")
private Integer phone;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,50 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunxi.scm.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 业务线分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BusinessLinePageReqVO extends PageParam {
@Schema(description = "业务线编号")
private String businessCode;
@Schema(description = "业务线名称", example = "赵六")
private String businessName;
@Schema(description = "隶属企业", example = "16269")
private Long affiliatCompanyId;
@Schema(description = "类型", example = "1")
private String type;
@Schema(description = "所属行业")
private String industry;
@Schema(description = "所在城市")
private String city;
@Schema(description = "成立时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] establishDate;
@Schema(description = "品牌/业务线/事业群名称", example = "张三")
private String brandName;
@Schema(description = "电话")
private Integer phone;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,19 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 业务线 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BusinessLineRespVO extends BusinessLineBaseVO {
@Schema(description = "业务id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12404")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 业务线更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BusinessLineUpdateReqVO extends BusinessLineBaseVO {
@Schema(description = "业务id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12404")
@NotNull(message = "业务id不能为空")
private Long id;
}

@ -76,7 +76,7 @@ public class MaterialBaseVO {
private String materialAddress;
@Schema(description = "物料产品区分")
private String distinct;
private String diff;
@TableField(exist = false)
private String materialCategoryName;

@ -0,0 +1,102 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.common.pojo.CommonResult;
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
import com.yunxi.scm.framework.excel.core.util.ExcelUtils;
import com.yunxi.scm.framework.operatelog.core.annotations.OperateLog;
import static com.yunxi.scm.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import com.yunxi.scm.module.xxjj.convert.warehouse.WarehouseConvert;
import com.yunxi.scm.module.xxjj.service.warehouse.WarehouseService;
@Tag(name = "管理后台 - 仓库")
@RestController
@RequestMapping("/xxjj/warehouse")
@Validated
public class WarehouseController {
@Resource
private WarehouseService warehouseService;
@PostMapping("/create")
@Operation(summary = "创建仓库")
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:create')")
public CommonResult<Long> createWarehouse(@Valid @RequestBody WarehouseCreateReqVO createReqVO) {
return success(warehouseService.createWarehouse(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新仓库")
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:update')")
public CommonResult<Boolean> updateWarehouse(@Valid @RequestBody WarehouseUpdateReqVO updateReqVO) {
warehouseService.updateWarehouse(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除仓库")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:delete')")
public CommonResult<Boolean> deleteWarehouse(@RequestParam("id") Long id) {
warehouseService.deleteWarehouse(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得仓库")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:query')")
public CommonResult<WarehouseRespVO> getWarehouse(@RequestParam("id") Long id) {
WarehouseDO warehouse = warehouseService.getWarehouse(id);
return success(WarehouseConvert.INSTANCE.convert(warehouse));
}
@GetMapping("/list")
@Operation(summary = "获得仓库列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:query')")
public CommonResult<List<WarehouseRespVO>> getWarehouseList(@RequestParam("ids") Collection<Long> ids) {
List<WarehouseDO> list = warehouseService.getWarehouseList(ids);
return success(WarehouseConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得仓库分页")
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:query')")
public CommonResult<PageResult<WarehouseRespVO>> getWarehousePage(@Valid WarehousePageReqVO pageVO) {
PageResult<WarehouseDO> pageResult = warehouseService.getWarehousePage(pageVO);
return success(WarehouseConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出仓库 Excel")
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:export')")
@OperateLog(type = EXPORT)
public void exportWarehouseExcel(@Valid WarehouseExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<WarehouseDO> list = warehouseService.getWarehouseList(exportReqVO);
// 导出 Excel
List<WarehouseExcelVO> datas = WarehouseConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "仓库.xls", "数据", WarehouseExcelVO.class, datas);
}
}

@ -0,0 +1,63 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class WarehouseBaseVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "仓库编号不能为空")
private String warehouseCode;
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotNull(message = "仓库名称不能为空")
private String warehouseName;
@Schema(description = "仓库简称")
private String warehouseSimple;
@Schema(description = "隶属业务线", requiredMode = Schema.RequiredMode.REQUIRED, example = "28362")
@NotNull(message = "隶属业务线不能为空")
private Long affiliatLineId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "类型不能为空")
private String type;
@Schema(description = "所在城市", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "所在城市不能为空")
private String city;
@Schema(description = "成立时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "成立时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime establishDate;
@Schema(description = "归属人员", requiredMode = Schema.RequiredMode.REQUIRED, example = "21767")
@NotNull(message = "归属人员不能为空")
private Long belongUserId;
@Schema(description = "介绍")
private String description;
@TableField(exist = false)
private String name;
@TableField(exist = false)
private List<CustomerDO> children;
}

@ -0,0 +1,14 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 仓库创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehouseCreateReqVO extends WarehouseBaseVO {
}

@ -0,0 +1,53 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class WarehouseExcelVO {
@ExcelProperty("仓库id")
private Long id;
@ExcelProperty("仓库编号")
private String warehouseCode;
@ExcelProperty("仓库名称")
private String warehouseName;
@ExcelProperty("仓库简称")
private String warehouseSimple;
@ExcelProperty("隶属业务线")
private Long affiliatLineId;
@ExcelProperty("类型")
private String type;
@ExcelProperty("所在城市")
private String city;
@ExcelProperty("成立时间")
private LocalDateTime establishDate;
@ExcelProperty("归属人员")
private Long belongUserId;
@ExcelProperty("介绍")
private String description;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,39 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunxi.scm.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 仓库 Excel 导出 Request VO参数和 WarehousePageReqVO 是一致的")
@Data
public class WarehouseExportReqVO {
@Schema(description = "仓库编号")
private String warehouseCode;
@Schema(description = "仓库名称", example = "芋艿")
private String warehouseName;
@Schema(description = "隶属业务线", example = "28362")
private Long affiliatLineId;
@Schema(description = "类型", example = "1")
private String type;
@Schema(description = "所在城市")
private String city;
@Schema(description = "成立时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] establishDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,41 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunxi.scm.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 仓库分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehousePageReqVO extends PageParam {
@Schema(description = "仓库编号")
private String warehouseCode;
@Schema(description = "仓库名称", example = "芋艿")
private String warehouseName;
@Schema(description = "隶属业务线", example = "28362")
private Long affiliatLineId;
@Schema(description = "类型", example = "1")
private String type;
@Schema(description = "所在城市")
private String city;
@Schema(description = "成立时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] establishDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,19 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 仓库 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehouseRespVO extends WarehouseBaseVO {
@Schema(description = "仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6005")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 仓库更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehouseUpdateReqVO extends WarehouseBaseVO {
@Schema(description = "仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6005")
@NotNull(message = "仓库id不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package com.yunxi.scm.module.xxjj.convert.businessline;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
/**
* 线 Convert
*
* @author
*/
@Mapper
public interface BusinessLineConvert {
BusinessLineConvert INSTANCE = Mappers.getMapper(BusinessLineConvert.class);
BusinessLineDO convert(BusinessLineCreateReqVO bean);
BusinessLineDO convert(BusinessLineUpdateReqVO bean);
BusinessLineRespVO convert(BusinessLineDO bean);
List<BusinessLineRespVO> convertList(List<BusinessLineDO> list);
PageResult<BusinessLineRespVO> convertPage(PageResult<BusinessLineDO> page);
List<BusinessLineExcelVO> convertList02(List<BusinessLineDO> list);
}

@ -0,0 +1,34 @@
package com.yunxi.scm.module.xxjj.convert.warehouse;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface WarehouseConvert {
WarehouseConvert INSTANCE = Mappers.getMapper(WarehouseConvert.class);
WarehouseDO convert(WarehouseCreateReqVO bean);
WarehouseDO convert(WarehouseUpdateReqVO bean);
WarehouseRespVO convert(WarehouseDO bean);
List<WarehouseRespVO> convertList(List<WarehouseDO> list);
PageResult<WarehouseRespVO> convertPage(PageResult<WarehouseDO> page);
List<WarehouseExcelVO> convertList02(List<WarehouseDO> list);
}

@ -0,0 +1,99 @@
package com.yunxi.scm.module.xxjj.dal.dataobject.businessline;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
/**
* 线 DO
*
* @author
*/
@TableName("xxjj_business_line")
@KeySequence("xxjj_business_line_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BusinessLineDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 线
*/
private String businessCode;
/**
* 线
*/
private String businessName;
/**
* 线
*/
private String businessSimple;
/**
* 线LOGO
*/
private String businessLogo;
/**
*
*/
private Long affiliatCompanyId;
/**
*
*/
private String type;
/**
*
*/
private String industry;
/**
*
*/
private String city;
/**
*
*/
private LocalDateTime establishDate;
/**
*
*/
private Long belongUserId;
/**
* /线/
*/
private String brandName;
/**
*
*/
private Integer phone;
/**
*
*/
private String fax;
/**
*
*/
private String url;
/**
*
*/
private String description;
@TableField(exist = false)
private List<WarehouseDO> children;
@TableField(exist = false)
private String name;
}

@ -97,7 +97,7 @@ public class MaterialDO extends BaseDO {
/**
*
*/
private String distinct;
private String diff;

@ -0,0 +1,75 @@
package com.yunxi.scm.module.xxjj.dal.dataobject.warehouse;
import com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("xxjj_warehouse")
@KeySequence("xxjj_warehouse_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WarehouseDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
*
*/
private String warehouseCode;
/**
*
*/
private String warehouseName;
/**
*
*/
private String warehouseSimple;
/**
* 线
*/
private Long affiliatLineId;
/**
*
*/
private String type;
/**
*
*/
private String city;
/**
*
*/
private LocalDateTime establishDate;
/**
*
*/
private Long belongUserId;
/**
*
*/
private String description;
@TableField(exist = false)
private String name;
@TableField(exist = false)
private List<CustomerDO> children;
}

@ -0,0 +1,52 @@
package com.yunxi.scm.module.xxjj.dal.mysql.businessline;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
import org.apache.ibatis.annotations.Mapper;
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
/**
* 线 Mapper
*
* @author
*/
@Mapper
public interface BusinessLineMapper extends BaseMapperX<BusinessLineDO> {
default PageResult<BusinessLineDO> selectPage(BusinessLinePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<BusinessLineDO>()
.eqIfPresent(BusinessLineDO::getBusinessCode, reqVO.getBusinessCode())
.likeIfPresent(BusinessLineDO::getBusinessName, reqVO.getBusinessName())
.eqIfPresent(BusinessLineDO::getAffiliatCompanyId, reqVO.getAffiliatCompanyId())
.eqIfPresent(BusinessLineDO::getType, reqVO.getType())
.eqIfPresent(BusinessLineDO::getIndustry, reqVO.getIndustry())
.eqIfPresent(BusinessLineDO::getCity, reqVO.getCity())
.betweenIfPresent(BusinessLineDO::getEstablishDate, reqVO.getEstablishDate())
.likeIfPresent(BusinessLineDO::getBrandName, reqVO.getBrandName())
.eqIfPresent(BusinessLineDO::getPhone, reqVO.getPhone())
.betweenIfPresent(BusinessLineDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BusinessLineDO::getId));
}
default List<BusinessLineDO> selectList(BusinessLineExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<BusinessLineDO>()
.eqIfPresent(BusinessLineDO::getBusinessCode, reqVO.getBusinessCode())
.likeIfPresent(BusinessLineDO::getBusinessName, reqVO.getBusinessName())
.eqIfPresent(BusinessLineDO::getAffiliatCompanyId, reqVO.getAffiliatCompanyId())
.eqIfPresent(BusinessLineDO::getType, reqVO.getType())
.eqIfPresent(BusinessLineDO::getIndustry, reqVO.getIndustry())
.eqIfPresent(BusinessLineDO::getCity, reqVO.getCity())
.betweenIfPresent(BusinessLineDO::getEstablishDate, reqVO.getEstablishDate())
.likeIfPresent(BusinessLineDO::getBrandName, reqVO.getBrandName())
.eqIfPresent(BusinessLineDO::getPhone, reqVO.getPhone())
.betweenIfPresent(BusinessLineDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BusinessLineDO::getId));
}
List<BusinessLineDO> queryBusinessLineTree();
}

@ -8,6 +8,8 @@ import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO;
import org.apache.ibatis.annotations.Mapper;
import com.yunxi.scm.module.xxjj.controller.admin.customer.vo.*;
import org.apache.ibatis.annotations.Param;
import org.checkerframework.checker.units.qual.C;
/**
* Mapper
@ -47,4 +49,6 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
.orderByDesc(CustomerDO::getId));
}
List<CustomerDO> queryCustomerTree(@Param("id") Long id);
}

@ -0,0 +1,47 @@
package com.yunxi.scm.module.xxjj.dal.mysql.warehouse;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import org.apache.ibatis.annotations.Mapper;
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author
*/
@Mapper
public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
default PageResult<WarehouseDO> selectPage(WarehousePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<WarehouseDO>()
.eqIfPresent(WarehouseDO::getWarehouseCode, reqVO.getWarehouseCode())
.likeIfPresent(WarehouseDO::getWarehouseName, reqVO.getWarehouseName())
.eqIfPresent(WarehouseDO::getAffiliatLineId, reqVO.getAffiliatLineId())
.eqIfPresent(WarehouseDO::getType, reqVO.getType())
.eqIfPresent(WarehouseDO::getCity, reqVO.getCity())
.betweenIfPresent(WarehouseDO::getEstablishDate, reqVO.getEstablishDate())
.betweenIfPresent(WarehouseDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(WarehouseDO::getId));
}
default List<WarehouseDO> selectList(WarehouseExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<WarehouseDO>()
.eqIfPresent(WarehouseDO::getWarehouseCode, reqVO.getWarehouseCode())
.likeIfPresent(WarehouseDO::getWarehouseName, reqVO.getWarehouseName())
.eqIfPresent(WarehouseDO::getAffiliatLineId, reqVO.getAffiliatLineId())
.eqIfPresent(WarehouseDO::getType, reqVO.getType())
.eqIfPresent(WarehouseDO::getCity, reqVO.getCity())
.betweenIfPresent(WarehouseDO::getEstablishDate, reqVO.getEstablishDate())
.betweenIfPresent(WarehouseDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(WarehouseDO::getId));
}
List<WarehouseDO> queryWarehouseTree(@Param("id") Long id);
}

@ -26,4 +26,8 @@ public interface ErrorCodeConstants {
ErrorCode MaterialCategory_EXISTS_USER = new ErrorCode(1002004005, "部门中存在员工,无法删除");
ErrorCode MaterialCategory_NOT_ENABLE = new ErrorCode(1002004006, "部门({})不处于开启状态,不允许选择");
ErrorCode MaterialCategory_PARENT_IS_CHILD = new ErrorCode(1002004007, "不能设置自己的子部门为父部门");
// ========== 业务线 TODO 补充编号 ==========
ErrorCode BUSINESS_LINE_NOT_EXISTS = new ErrorCode(1002025007, "业务线不存在");
// ========== 仓库 TODO 补充编号 ==========
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1002025008, "仓库不存在");
}

@ -0,0 +1,78 @@
package com.yunxi.scm.module.xxjj.service.businessline;
import java.util.*;
import javax.validation.*;
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
/**
* 线 Service
*
* @author
*/
public interface BusinessLineService {
/**
* 线
*
* @param createReqVO
* @return
*/
Long createBusinessLine(@Valid BusinessLineCreateReqVO createReqVO);
/**
* 线
*
* @param updateReqVO
*/
void updateBusinessLine(@Valid BusinessLineUpdateReqVO updateReqVO);
/**
* 线
*
* @param id
*/
void deleteBusinessLine(Long id);
/**
* 线
*
* @param id
* @return 线
*/
BusinessLineDO getBusinessLine(Long id);
/**
* 线
*
* @param ids
* @return 线
*/
List<BusinessLineDO> getBusinessLineList(Collection<Long> ids);
/**
* 线
*
* @param pageReqVO
* @return 线
*/
PageResult<BusinessLineDO> getBusinessLinePage(BusinessLinePageReqVO pageReqVO);
/**
* 线, Excel
*
* @param exportReqVO
* @return 线
*/
List<BusinessLineDO> getBusinessLineList(BusinessLineExportReqVO exportReqVO);
/**
* 线
*
* @param
* @return 线
*/
List<BusinessLineDO> getBusinessLineTree();
}

@ -0,0 +1,106 @@
package com.yunxi.scm.module.xxjj.service.businessline;
import com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import com.yunxi.scm.module.xxjj.dal.mysql.customer.CustomerMapper;
import com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.xxjj.convert.businessline.BusinessLineConvert;
import com.yunxi.scm.module.xxjj.dal.mysql.businessline.BusinessLineMapper;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
/**
* 线 Service
*
* @author
*/
@Service
@Validated
public class BusinessLineServiceImpl implements BusinessLineService {
@Resource
private BusinessLineMapper businessLineMapper;
@Resource
private WarehouseMapper warehouseMapper;
@Resource
private CustomerMapper customerMapper;
@Override
public Long createBusinessLine(BusinessLineCreateReqVO createReqVO) {
// 插入
BusinessLineDO businessLine = BusinessLineConvert.INSTANCE.convert(createReqVO);
businessLineMapper.insert(businessLine);
// 返回
return businessLine.getId();
}
@Override
public void updateBusinessLine(BusinessLineUpdateReqVO updateReqVO) {
// 校验存在
validateBusinessLineExists(updateReqVO.getId());
// 更新
BusinessLineDO updateObj = BusinessLineConvert.INSTANCE.convert(updateReqVO);
businessLineMapper.updateById(updateObj);
}
@Override
public void deleteBusinessLine(Long id) {
// 校验存在
validateBusinessLineExists(id);
// 删除
businessLineMapper.deleteById(id);
}
private void validateBusinessLineExists(Long id) {
if (businessLineMapper.selectById(id) == null) {
throw exception(BUSINESS_LINE_NOT_EXISTS);
}
}
@Override
public BusinessLineDO getBusinessLine(Long id) {
return businessLineMapper.selectById(id);
}
@Override
public List<BusinessLineDO> getBusinessLineList(Collection<Long> ids) {
return businessLineMapper.selectBatchIds(ids);
}
@Override
public PageResult<BusinessLineDO> getBusinessLinePage(BusinessLinePageReqVO pageReqVO) {
return businessLineMapper.selectPage(pageReqVO);
}
@Override
public List<BusinessLineDO> getBusinessLineList(BusinessLineExportReqVO exportReqVO) {
return businessLineMapper.selectList(exportReqVO);
}
@Override
public List<BusinessLineDO> getBusinessLineTree() {
List<BusinessLineDO> businessLineDOList = businessLineMapper.queryBusinessLineTree();
if (businessLineDOList != null && businessLineDOList.size() > 0){
for (BusinessLineDO entity : businessLineDOList) {
List<WarehouseDO> warehouseDOList = warehouseMapper.queryWarehouseTree(entity.getId());
entity.setChildren(warehouseDOList);
// for (WarehouseDO warehouseEntity : warehouseDOList){
// List<CustomerDO> customerDOList = customerMapper.queryCustomerTree(warehouseEntity.getId());
// warehouseEntity.setChildren(customerDOList);
// }
}
}
return businessLineDOList;
}
}

@ -0,0 +1,70 @@
package com.yunxi.scm.module.xxjj.service.warehouse;
import java.util.*;
import javax.validation.*;
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface WarehouseService {
/**
*
*
* @param createReqVO
* @return
*/
Long createWarehouse(@Valid WarehouseCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateWarehouse(@Valid WarehouseUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteWarehouse(Long id);
/**
*
*
* @param id
* @return
*/
WarehouseDO getWarehouse(Long id);
/**
*
*
* @param ids
* @return
*/
List<WarehouseDO> getWarehouseList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<WarehouseDO> getWarehousePage(WarehousePageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<WarehouseDO> getWarehouseList(WarehouseExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package com.yunxi.scm.module.xxjj.service.warehouse;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.xxjj.convert.warehouse.WarehouseConvert;
import com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class WarehouseServiceImpl implements WarehouseService {
@Resource
private WarehouseMapper warehouseMapper;
@Override
public Long createWarehouse(WarehouseCreateReqVO createReqVO) {
// 插入
WarehouseDO warehouse = WarehouseConvert.INSTANCE.convert(createReqVO);
warehouseMapper.insert(warehouse);
// 返回
return warehouse.getId();
}
@Override
public void updateWarehouse(WarehouseUpdateReqVO updateReqVO) {
// 校验存在
validateWarehouseExists(updateReqVO.getId());
// 更新
WarehouseDO updateObj = WarehouseConvert.INSTANCE.convert(updateReqVO);
warehouseMapper.updateById(updateObj);
}
@Override
public void deleteWarehouse(Long id) {
// 校验存在
validateWarehouseExists(id);
// 删除
warehouseMapper.deleteById(id);
}
private void validateWarehouseExists(Long id) {
if (warehouseMapper.selectById(id) == null) {
throw exception(WAREHOUSE_NOT_EXISTS);
}
}
@Override
public WarehouseDO getWarehouse(Long id) {
return warehouseMapper.selectById(id);
}
@Override
public List<WarehouseDO> getWarehouseList(Collection<Long> ids) {
return warehouseMapper.selectBatchIds(ids);
}
@Override
public PageResult<WarehouseDO> getWarehousePage(WarehousePageReqVO pageReqVO) {
return warehouseMapper.selectPage(pageReqVO);
}
@Override
public List<WarehouseDO> getWarehouseList(WarehouseExportReqVO exportReqVO) {
return warehouseMapper.selectList(exportReqVO);
}
}

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yunxi.scm.module.xxjj.dal.mysql.businessline.BusinessLineMapper">
<select id="queryBusinessLineTree" resultType="com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO">
select id,business_name as name ,affiliat_company_id from xxjj_business_line
</select>
</mapper>

@ -2,11 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yunxi.scm.module.xxjj.dal.mysql.customer.CustomerMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryCustomerTree" resultType="com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO">
select id,customer_name as name from xxjj_customer
where linebusiness_id = #{id}
</select>
</mapper>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper">
<select id="queryWarehouseTree" resultType="com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO">
select id,warehouse_name as name,affiliat_line_id from xxjj_warehouse
where affiliat_line_id = #{id}
</select>
</mapper>

@ -0,0 +1,223 @@
package com.yunxi.scm.module.xxjj.service.businessline;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
import com.yunxi.scm.module.xxjj.dal.mysql.businessline.BusinessLineMapper;
import com.yunxi.scm.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
import static com.yunxi.scm.framework.test.core.util.AssertUtils.*;
import static com.yunxi.scm.framework.test.core.util.RandomUtils.*;
import static com.yunxi.scm.framework.common.util.date.LocalDateTimeUtils.*;
import static com.yunxi.scm.framework.common.util.object.ObjectUtils.*;
import static com.yunxi.scm.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link BusinessLineServiceImpl}
*
* @author
*/
@Import(BusinessLineServiceImpl.class)
public class BusinessLineServiceImplTest extends BaseDbUnitTest {
@Resource
private BusinessLineServiceImpl businessLineService;
@Resource
private BusinessLineMapper businessLineMapper;
@Test
public void testCreateBusinessLine_success() {
// 准备参数
BusinessLineCreateReqVO reqVO = randomPojo(BusinessLineCreateReqVO.class);
// 调用
Long businessLineId = businessLineService.createBusinessLine(reqVO);
// 断言
assertNotNull(businessLineId);
// 校验记录的属性是否正确
BusinessLineDO businessLine = businessLineMapper.selectById(businessLineId);
assertPojoEquals(reqVO, businessLine);
}
@Test
public void testUpdateBusinessLine_success() {
// mock 数据
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class);
businessLineMapper.insert(dbBusinessLine);// @Sql: 先插入出一条存在的数据
// 准备参数
BusinessLineUpdateReqVO reqVO = randomPojo(BusinessLineUpdateReqVO.class, o -> {
o.setId(dbBusinessLine.getId()); // 设置更新的 ID
});
// 调用
businessLineService.updateBusinessLine(reqVO);
// 校验是否更新正确
BusinessLineDO businessLine = businessLineMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, businessLine);
}
@Test
public void testUpdateBusinessLine_notExists() {
// 准备参数
BusinessLineUpdateReqVO reqVO = randomPojo(BusinessLineUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> businessLineService.updateBusinessLine(reqVO), BUSINESS_LINE_NOT_EXISTS);
}
@Test
public void testDeleteBusinessLine_success() {
// mock 数据
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class);
businessLineMapper.insert(dbBusinessLine);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbBusinessLine.getId();
// 调用
businessLineService.deleteBusinessLine(id);
// 校验数据不存在了
assertNull(businessLineMapper.selectById(id));
}
@Test
public void testDeleteBusinessLine_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> businessLineService.deleteBusinessLine(id), BUSINESS_LINE_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetBusinessLinePage() {
// mock 数据
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class, o -> { // 等会查询到
o.setBusinessCode(null);
o.setBusinessName(null);
o.setAffiliatCompanyId(null);
o.setType(null);
o.setIndustry(null);
o.setCity(null);
o.setEstablishDate(null);
o.setBrandName(null);
o.setPhone(null);
o.setCreateTime(null);
});
businessLineMapper.insert(dbBusinessLine);
// 测试 businessCode 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessCode(null)));
// 测试 businessName 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessName(null)));
// 测试 affiliatCompanyId 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setAffiliatCompanyId(null)));
// 测试 type 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setType(null)));
// 测试 industry 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setIndustry(null)));
// 测试 city 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCity(null)));
// 测试 establishDate 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setEstablishDate(null)));
// 测试 brandName 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBrandName(null)));
// 测试 phone 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setPhone(null)));
// 测试 createTime 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCreateTime(null)));
// 准备参数
BusinessLinePageReqVO reqVO = new BusinessLinePageReqVO();
reqVO.setBusinessCode(null);
reqVO.setBusinessName(null);
reqVO.setAffiliatCompanyId(null);
reqVO.setType(null);
reqVO.setIndustry(null);
reqVO.setCity(null);
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setBrandName(null);
reqVO.setPhone(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<BusinessLineDO> pageResult = businessLineService.getBusinessLinePage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbBusinessLine, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetBusinessLineList() {
// mock 数据
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class, o -> { // 等会查询到
o.setBusinessCode(null);
o.setBusinessName(null);
o.setAffiliatCompanyId(null);
o.setType(null);
o.setIndustry(null);
o.setCity(null);
o.setEstablishDate(null);
o.setBrandName(null);
o.setPhone(null);
o.setCreateTime(null);
});
businessLineMapper.insert(dbBusinessLine);
// 测试 businessCode 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessCode(null)));
// 测试 businessName 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessName(null)));
// 测试 affiliatCompanyId 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setAffiliatCompanyId(null)));
// 测试 type 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setType(null)));
// 测试 industry 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setIndustry(null)));
// 测试 city 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCity(null)));
// 测试 establishDate 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setEstablishDate(null)));
// 测试 brandName 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBrandName(null)));
// 测试 phone 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setPhone(null)));
// 测试 createTime 不匹配
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCreateTime(null)));
// 准备参数
BusinessLineExportReqVO reqVO = new BusinessLineExportReqVO();
reqVO.setBusinessCode(null);
reqVO.setBusinessName(null);
reqVO.setAffiliatCompanyId(null);
reqVO.setType(null);
reqVO.setIndustry(null);
reqVO.setCity(null);
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setBrandName(null);
reqVO.setPhone(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
List<BusinessLineDO> list = businessLineService.getBusinessLineList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbBusinessLine, list.get(0));
}
}

@ -0,0 +1,199 @@
package com.yunxi.scm.module.xxjj.service.warehouse;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
import com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper;
import com.yunxi.scm.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
import static com.yunxi.scm.framework.test.core.util.AssertUtils.*;
import static com.yunxi.scm.framework.test.core.util.RandomUtils.*;
import static com.yunxi.scm.framework.common.util.date.LocalDateTimeUtils.*;
import static com.yunxi.scm.framework.common.util.object.ObjectUtils.*;
import static com.yunxi.scm.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link WarehouseServiceImpl}
*
* @author
*/
@Import(WarehouseServiceImpl.class)
public class WarehouseServiceImplTest extends BaseDbUnitTest {
@Resource
private WarehouseServiceImpl warehouseService;
@Resource
private WarehouseMapper warehouseMapper;
@Test
public void testCreateWarehouse_success() {
// 准备参数
WarehouseCreateReqVO reqVO = randomPojo(WarehouseCreateReqVO.class);
// 调用
Long warehouseId = warehouseService.createWarehouse(reqVO);
// 断言
assertNotNull(warehouseId);
// 校验记录的属性是否正确
WarehouseDO warehouse = warehouseMapper.selectById(warehouseId);
assertPojoEquals(reqVO, warehouse);
}
@Test
public void testUpdateWarehouse_success() {
// mock 数据
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class);
warehouseMapper.insert(dbWarehouse);// @Sql: 先插入出一条存在的数据
// 准备参数
WarehouseUpdateReqVO reqVO = randomPojo(WarehouseUpdateReqVO.class, o -> {
o.setId(dbWarehouse.getId()); // 设置更新的 ID
});
// 调用
warehouseService.updateWarehouse(reqVO);
// 校验是否更新正确
WarehouseDO warehouse = warehouseMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, warehouse);
}
@Test
public void testUpdateWarehouse_notExists() {
// 准备参数
WarehouseUpdateReqVO reqVO = randomPojo(WarehouseUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> warehouseService.updateWarehouse(reqVO), WAREHOUSE_NOT_EXISTS);
}
@Test
public void testDeleteWarehouse_success() {
// mock 数据
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class);
warehouseMapper.insert(dbWarehouse);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbWarehouse.getId();
// 调用
warehouseService.deleteWarehouse(id);
// 校验数据不存在了
assertNull(warehouseMapper.selectById(id));
}
@Test
public void testDeleteWarehouse_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> warehouseService.deleteWarehouse(id), WAREHOUSE_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetWarehousePage() {
// mock 数据
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class, o -> { // 等会查询到
o.setWarehouseCode(null);
o.setWarehouseName(null);
o.setAffiliatLineId(null);
o.setType(null);
o.setCity(null);
o.setEstablishDate(null);
o.setCreateTime(null);
});
warehouseMapper.insert(dbWarehouse);
// 测试 warehouseCode 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseCode(null)));
// 测试 warehouseName 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseName(null)));
// 测试 affiliatLineId 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setAffiliatLineId(null)));
// 测试 type 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setType(null)));
// 测试 city 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCity(null)));
// 测试 establishDate 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setEstablishDate(null)));
// 测试 createTime 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCreateTime(null)));
// 准备参数
WarehousePageReqVO reqVO = new WarehousePageReqVO();
reqVO.setWarehouseCode(null);
reqVO.setWarehouseName(null);
reqVO.setAffiliatLineId(null);
reqVO.setType(null);
reqVO.setCity(null);
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<WarehouseDO> pageResult = warehouseService.getWarehousePage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbWarehouse, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetWarehouseList() {
// mock 数据
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class, o -> { // 等会查询到
o.setWarehouseCode(null);
o.setWarehouseName(null);
o.setAffiliatLineId(null);
o.setType(null);
o.setCity(null);
o.setEstablishDate(null);
o.setCreateTime(null);
});
warehouseMapper.insert(dbWarehouse);
// 测试 warehouseCode 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseCode(null)));
// 测试 warehouseName 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseName(null)));
// 测试 affiliatLineId 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setAffiliatLineId(null)));
// 测试 type 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setType(null)));
// 测试 city 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCity(null)));
// 测试 establishDate 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setEstablishDate(null)));
// 测试 createTime 不匹配
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCreateTime(null)));
// 准备参数
WarehouseExportReqVO reqVO = new WarehouseExportReqVO();
reqVO.setWarehouseCode(null);
reqVO.setWarehouseName(null);
reqVO.setAffiliatLineId(null);
reqVO.setType(null);
reqVO.setCity(null);
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
List<WarehouseDO> list = warehouseService.getWarehouseList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbWarehouse, list.get(0));
}
}

@ -0,0 +1,62 @@
import request from '@/utils/request'
// 创建业务线
export function createBusinessLine(data) {
return request({
url: '/xxjj/business-line/create',
method: 'post',
data: data
})
}
// 更新业务线
export function updateBusinessLine(data) {
return request({
url: '/xxjj/business-line/update',
method: 'put',
data: data
})
}
// 删除业务线
export function deleteBusinessLine(id) {
return request({
url: '/xxjj/business-line/delete?id=' + id,
method: 'delete'
})
}
// 获得业务线
export function getBusinessLine(id) {
return request({
url: '/xxjj/business-line/get?id=' + id,
method: 'get'
})
}
// 获得业务线分页
export function getBusinessLinePage(query) {
return request({
url: '/xxjj/business-line/page',
method: 'get',
params: query
})
}
// 导出业务线 Excel
export function exportBusinessLineExcel(query) {
return request({
url: '/xxjj/business-line/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
export function getBusinessLintTree(query) {
return request({
url: '/xxjj/business-line/tree',
method: 'get',
params: query
})
}

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建仓库
export function createWarehouse(data) {
return request({
url: '/xxjj/warehouse/create',
method: 'post',
data: data
})
}
// 更新仓库
export function updateWarehouse(data) {
return request({
url: '/xxjj/warehouse/update',
method: 'put',
data: data
})
}
// 删除仓库
export function deleteWarehouse(id) {
return request({
url: '/xxjj/warehouse/delete?id=' + id,
method: 'delete'
})
}
// 获得仓库
export function getWarehouse(id) {
return request({
url: '/xxjj/warehouse/get?id=' + id,
method: 'get'
})
}
// 获得仓库分页
export function getWarehousePage(query) {
return request({
url: '/xxjj/warehouse/page',
method: 'get',
params: query
})
}
// 导出仓库 Excel
export function exportWarehouseExcel(query) {
return request({
url: '/xxjj/warehouse/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

@ -102,6 +102,12 @@ export const DICT_TYPE = {
CUSTOMER_NATUER: 'customer_nature', //客户性质
COOPERATION_MODE: 'cooperation_mode', //客户合作模式
// ============= BUSINESSLINE 模块=================
BUSINESS_TYPE: 'business_type', //业务线类型
// ============= WAREHOUSE 模块=================
WAREHOUSE_TYPE: 'warehouse_type', //仓库类型
}
/**

File diff suppressed because it is too large Load Diff

@ -0,0 +1,336 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="业务线编号" prop="businessCode">
<el-input v-model="queryParams.businessCode" placeholder="请输入业务线编号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="业务线名称" prop="businessName">
<el-input v-model="queryParams.businessName" placeholder="请输入业务线名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="隶属企业" prop="affiliatCompanyId">
<el-input v-model="queryParams.affiliatCompanyId" placeholder="请输入隶属企业" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BUSINESS_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="所属行业" prop="industry">
<el-input v-model="queryParams.industry" placeholder="请输入所属行业" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="所在城市" prop="city">
<el-input v-model="queryParams.city" placeholder="请输入所在城市" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="成立时间" prop="establishDate">
<el-date-picker v-model="queryParams.establishDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item label="品牌/业务线/事业群名称" prop="brandName">
<el-input v-model="queryParams.brandName" placeholder="请输入品牌/业务线/事业群名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="queryParams.phone" placeholder="请输入电话" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['xxjj:business-line:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['xxjj:business-line:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="业务id" align="center" prop="id" />
<el-table-column label="业务线编号" align="center" prop="businessCode" />
<el-table-column label="业务线名称" align="center" prop="businessName" />
<el-table-column label="业务线简称" align="center" prop="businessSimple" />
<el-table-column label="业务线LOGO" align="center" prop="businessLogo" />
<el-table-column label="隶属企业" align="center" prop="affiliatCompanyId" />
<el-table-column label="类型" align="center" prop="type" >
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.BUSINESS_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="所属行业" align="center" prop="industry" />
<el-table-column label="所在城市" align="center" prop="city" />
<el-table-column label="成立时间" align="center" prop="establishDate" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.establishDate) }}</span>
</template>
</el-table-column>
<el-table-column label="归属人员" align="center" prop="belongUserId" />
<el-table-column label="品牌/业务线/事业群名称" align="center" prop="brandName" />
<el-table-column label="电话" align="center" prop="phone" />
<el-table-column label="传真" align="center" prop="fax" />
<el-table-column label="网址" align="center" prop="url" />
<el-table-column label="介绍" align="center" prop="desc" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['xxjj:business-line:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['xxjj:business-line:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="业务线编号" prop="businessCode">
<el-input v-model="form.businessCode" placeholder="请输入业务线编号" />
</el-form-item>
<el-form-item label="业务线名称" prop="businessName">
<el-input v-model="form.businessName" placeholder="请输入业务线名称" />
</el-form-item>
<el-form-item label="业务线简称" prop="businessSimple">
<el-input v-model="form.businessSimple" placeholder="请输入业务线简称" />
</el-form-item>
<el-form-item label="业务线LOGO" prop="businessLogo">
<el-input v-model="form.businessLogo" placeholder="请输入业务线LOGO" />
</el-form-item>
<el-form-item label="隶属企业" prop="affiliatCompanyId">
<el-input v-model="form.affiliatCompanyId" placeholder="请输入隶属企业" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BUSINESS_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="所属行业" prop="industry">
<el-input v-model="form.industry" placeholder="请输入所属行业" />
</el-form-item>
<el-form-item label="所在城市" prop="city">
<el-input v-model="form.city" placeholder="请输入所在城市" />
</el-form-item>
<el-form-item label="成立时间" prop="establishDate">
<el-date-picker clearable v-model="form.establishDate" type="date" value-format="timestamp" placeholder="选择成立时间" />
</el-form-item>
<el-form-item label="归属人员" prop="belongUserId">
<el-input v-model="form.belongUserId" placeholder="请输入归属人员" />
</el-form-item>
<el-form-item label="品牌/业务线/事业群名称" prop="brandName">
<el-input v-model="form.brandName" placeholder="请输入品牌/业务线/事业群名称" />
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
<el-form-item label="传真" prop="fax">
<el-input v-model="form.fax" placeholder="请输入传真" />
</el-form-item>
<el-form-item label="网址" prop="url">
<el-input v-model="form.url" placeholder="请输入网址" />
</el-form-item>
<el-form-item label="介绍" prop="desc">
<el-input v-model="form.desc" placeholder="请输入介绍" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createBusinessLine, updateBusinessLine, deleteBusinessLine, getBusinessLine, getBusinessLinePage, exportBusinessLineExcel } from "@/api/xxjj/businessLine";
export default {
name: "BusinessLine",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// 线
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
businessCode: null,
businessName: null,
affiliatCompanyId: null,
type: null,
industry: null,
city: null,
establishDate: [],
brandName: null,
phone: null,
createTime: [],
},
//
form: {},
//
rules: {
businessCode: [{ required: true, message: "业务线编号不能为空", trigger: "blur" }],
businessName: [{ required: true, message: "业务线名称不能为空", trigger: "blur" }],
businessLogo: [{ required: true, message: "业务线LOGO不能为空", trigger: "blur" }],
affiliatCompanyId: [{ required: true, message: "隶属企业不能为空", trigger: "blur" }],
type: [{ required: true, message: "类型不能为空", trigger: "change" }],
industry: [{ required: true, message: "所属行业不能为空", trigger: "blur" }],
city: [{ required: true, message: "所在城市不能为空", trigger: "blur" }],
establishDate: [{ required: true, message: "成立时间不能为空", trigger: "blur" }],
belongUserId: [{ required: true, message: "归属人员不能为空", trigger: "blur" }],
brandName: [{ required: true, message: "品牌/业务线/事业群名称不能为空", trigger: "blur" }],
phone: [{ required: true, message: "电话不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getBusinessLinePage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
businessCode: undefined,
businessName: undefined,
businessSimple: undefined,
businessLogo: undefined,
affiliatCompanyId: undefined,
type: undefined,
industry: undefined,
city: undefined,
establishDate: undefined,
belongUserId: undefined,
brandName: undefined,
phone: undefined,
fax: undefined,
url: undefined,
desc: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加业务线";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getBusinessLine(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改业务线";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateBusinessLine(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createBusinessLine(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除业务线编号为"' + id + '"的数据项?').then(function() {
return deleteBusinessLine(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有业务线数据项?').then(() => {
this.exportLoading = true;
return exportBusinessLineExcel(params);
}).then(response => {
this.$download.excel(response, '业务线.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,290 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="仓库编号" prop="warehouseCode">
<el-input v-model="queryParams.warehouseCode" placeholder="请输入仓库编号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="仓库名称" prop="warehouseName">
<el-input v-model="queryParams.warehouseName" placeholder="请输入仓库名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="隶属业务线" prop="affiliatLineId">
<el-input v-model="queryParams.affiliatLineId" placeholder="请输入隶属业务线" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.WAREHOUSE_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="所在城市" prop="city">
<el-input v-model="queryParams.city" placeholder="请输入所在城市" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="成立时间" prop="establishDate">
<el-date-picker v-model="queryParams.establishDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['xxjj:warehouse:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['xxjj:warehouse:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="仓库id" align="center" prop="id" />
<el-table-column label="仓库编号" align="center" prop="warehouseCode" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="仓库简称" align="center" prop="warehouseSimple" />
<el-table-column label="隶属业务线" align="center" prop="affiliatLineId" />
<el-table-column label="类型" align="center" prop="type" >
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.WAREHOUSE_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="所在城市" align="center" prop="city" />
<el-table-column label="成立时间" align="center" prop="establishDate" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.establishDate) }}</span>
</template>
</el-table-column>
<el-table-column label="归属人员" align="center" prop="belongUserId" />
<el-table-column label="介绍" align="center" prop="desc" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['xxjj:warehouse:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['xxjj:warehouse:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="仓库编号" prop="warehouseCode">
<el-input v-model="form.warehouseCode" placeholder="请输入仓库编号" />
</el-form-item>
<el-form-item label="仓库名称" prop="warehouseName">
<el-input v-model="form.warehouseName" placeholder="请输入仓库名称" />
</el-form-item>
<el-form-item label="仓库简称" prop="warehouseSimple">
<el-input v-model="form.warehouseSimple" placeholder="请输入仓库简称" />
</el-form-item>
<el-form-item label="隶属业务线" prop="affiliatLineId">
<el-input v-model="form.affiliatLineId" placeholder="请输入隶属业务线" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.WAREHOUSE_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="所在城市" prop="city">
<el-input v-model="form.city" placeholder="请输入所在城市" />
</el-form-item>
<el-form-item label="成立时间" prop="establishDate">
<el-date-picker clearable v-model="form.establishDate" type="date" value-format="timestamp" placeholder="选择成立时间" />
</el-form-item>
<el-form-item label="归属人员" prop="belongUserId">
<el-input v-model="form.belongUserId" placeholder="请输入归属人员" />
</el-form-item>
<el-form-item label="介绍" prop="desc">
<el-input v-model="form.desc" placeholder="请输入介绍" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createWarehouse, updateWarehouse, deleteWarehouse, getWarehouse, getWarehousePage, exportWarehouseExcel } from "@/api/xxjj/warehouse";
export default {
name: "Warehouse",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
warehouseCode: null,
warehouseName: null,
affiliatLineId: null,
type: null,
city: null,
establishDate: [],
createTime: [],
},
//
form: {},
//
rules: {
warehouseCode: [{ required: true, message: "仓库编号不能为空", trigger: "blur" }],
warehouseName: [{ required: true, message: "仓库名称不能为空", trigger: "blur" }],
affiliatLineId: [{ required: true, message: "隶属业务线不能为空", trigger: "blur" }],
type: [{ required: true, message: "类型不能为空", trigger: "change" }],
city: [{ required: true, message: "所在城市不能为空", trigger: "blur" }],
establishDate: [{ required: true, message: "成立时间不能为空", trigger: "blur" }],
belongUserId: [{ required: true, message: "归属人员不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getWarehousePage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
warehouseCode: undefined,
warehouseName: undefined,
warehouseSimple: undefined,
affiliatLineId: undefined,
type: undefined,
city: undefined,
establishDate: undefined,
belongUserId: undefined,
desc: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加仓库";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWarehouse(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改仓库";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWarehouse(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWarehouse(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除仓库编号为"' + id + '"的数据项?').then(function() {
return deleteWarehouse(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有仓库数据项?').then(() => {
this.exportLoading = true;
return exportWarehouseExcel(params);
}).then(response => {
this.$download.excel(response, '仓库.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
Loading…
Cancel
Save