Commit 679f1dc4 authored by lanbaoming's avatar lanbaoming

Merge branch 'dev'

# Conflicts:
#	yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
parents 100c0bb6 6fc4a7ce
package cn.iocoder.yudao.framework.apollo.core.event.export;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/*
lanbm 2024-05-01 add
销售分析报表导出excel
*/
@Data
public class ReportCustomerAnalysisExcelExportEvent {
/**
* 操作用户
*/
private Long userId;
/**
* 端口
*/
private Integer userType;
/**
* 请求参数
*/
private String requestParams;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private Integer lang = 0;
/**
* 文件名称
*/
private String fileName;
/**
* 文件路径
*/
private String path;
/**
* 下载地址
*/
private String url;
/**
* 执行结果
*/
private String result;
@ApiModelProperty(value = "文件ID")
private Long fileId;
}
package cn.iocoder.yudao.framework.apollo.core.event.export;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/*
客户分析报表导出 lanbm 2024-05-01 add
*/
@Data
public class ReportSalesAnalysisExcelExportEvent {
/**
* 操作用户
*/
private Long userId;
/**
* 端口
*/
private Integer userType;
/**
* 请求参数
*/
private String requestParams;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private Integer lang = 0;
/**
* 文件名称
*/
private String fileName;
/**
* 文件路径
*/
private String path;
/**
* 下载地址
*/
private String url;
/**
* 执行结果
*/
private String result;
@ApiModelProperty(value = "文件ID")
private Long fileId;
}
......@@ -381,12 +381,24 @@ public class CustomerDO extends BaseDO {
private String creditLevelNameEn;
/**
* 主联系人id
*/
@TableField(exist = false)
private String defaultContactId;
/**
* 主联系人
*/
@TableField(exist = false)
private String defaultContactName;
/**
* 主联系电话
* 不加区号
*/
@TableField(exist = false)
private String contactPhone ;
/**
* 主联系电话
*/
......
......@@ -69,6 +69,8 @@ public class CustomerRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "公海池捞取时间")
private Date catchTime;
@ApiModelProperty(value = "主联系人Id")
private Long defaultContactId ;
@ApiModelProperty(value = "主联系人")
private String defaultContactName;
......@@ -76,6 +78,9 @@ public class CustomerRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "主联系电话")
private String defaultContactPhone;
@ApiModelProperty(value = "主联系电话(不加区号)")
private String contactPhone ;
@ApiModelProperty(value = "主邮箱")
private String defaultEmail;
......
......@@ -19,6 +19,8 @@
from (select a.*,
c.name as default_contact_name,
concat(c.area_code, c.phone_new, '') as default_contact_phone,
c.phone_new as contactPhone,
c.id as defaultContactId,
c.social as default_social,
c.email as default_email,
c.social_number as default_social_number,
......
......@@ -23,5 +23,22 @@
<artifactId>yudao-module-delivery-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-impl</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-infra-impl</artifactId>
<version>1.6.1-snapshot</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.apollo.core.event.export.ReportCustomerAnalysisExcelExportEvent;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.delivery.convert.CustomerAnalysis;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.entity.orderdata.view_order_businesstime;
import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService;
import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService2;
import cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService;
import cn.iocoder.yudao.module.delivery.service.view_order_businesstimeService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.file.FileMakeApi;
import cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO;
import cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
/**
* (CustomerAnalysis)客户分析报表
*
* @author lanbm
* @since 2024-03-27 21:25:55
*/
@RestController
@RequestMapping("/Report/CustomerAnalysis")
public class CustomerAnalysisControl {
@Autowired
private CustomerAnalysisService customerAnalysisService;
@Resource
private CustomerAnalysisService2 customerAnalysisService2;
//报表权限信息
@Resource
private EcwReportPermissionService ecwReportPermissionService;
@Resource
private RedisHelper redisHelper;
@Resource
private view_order_businesstimeService vieworderbusinesstimeService;
private List<view_order_businesstime> listBData = null;
private List<CustomerAnalysisResp> objListResult = null;
/*
数据字典项
*/
@Autowired
private DictDataApi dictDataApi;
@Resource
private FileMakeApi fileMakeApi;
@Resource
private ApplicationContext applicationContext;
/*
客户分析列表lanbm 2024-04-02 add
xml动态查询参考网址
https://blog.csdn.net/CYK_byte/article/details/128611104
*/
@PostMapping("/getListPage")
public CommonResult<PageResult<CustomerAnalysisResp>>
getListPage(@RequestBody Map map) throws JsonProcessingException {
//ecw_customer 的部门字段都为空 department 都为空,所以要关联客户经理所在的部门来查询
//ecw_order_item order_item_type 订单类型:1 普货 2 重货 3 泡货
//ecw_order order_type 订单类型:1 普货 2 重货 3 泡货
// is_cargo_control 是否控货 1 控货,0不控货
//同比增长速度=(本期发展水平-同期发展水平)/同期发展水平×100%
//客户角色数据字典
//客户表和数据字典表中的编码方式不一样,做关联查询有异常,为了不改变表的编码方式,在后台做转换
//获取当前用户ID
//先判断用户有什么报表权限
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
LambdaQueryWrapper<EcwReportPermission> lambdaQueryWrapper =
new LambdaQueryWrapper();
lambdaQueryWrapper.eq(EcwReportPermission::getUserId, loginUserId);
List<EcwReportPermission> objList =
ecwReportPermissionService.list(lambdaQueryWrapper);
if (objList == null || objList.size() == 0) {
ErrorCode eCode = new ErrorCode(2024041504,
"当前用户未分配报表权限,请联系系统管理员处理。");
return error(eCode);
}
System.out.println(map);
CustomerAnalysisReq query = JSON.parseObject(JSON.toJSONString(map),
CustomerAnalysisReq.class);
PageResult<CustomerAnalysisResp> pageResult =
customerAnalysisService.GetDataResult(query);
return success(pageResult);
}
@GetMapping("/exportExcel")
@ApiOperation("导出客户分析数据")
@OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Valid CustomerAnalysisReq query) throws IOException {
query = customerAnalysisService.getReq(query);
query = customerAnalysisService.getDataWhere(query);
System.out.println("处理后的查询条件:" + query);
List<CustomerAnalysisResp> list =
customerAnalysisService.GetDataListResult(query);
List<CustomerAnalysisExcelResp> listExel =
CustomerAnalysis.INSTANCE.convertList(list);
// 导出 Excel
ExcelUtils.write(response, "客户分析报表.xls", "客户分析报表",
CustomerAnalysisExcelResp.class, listExel);
}
@GetMapping("/exportExcel2")
@ApiOperation("导出客户分析数据")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> export2(HttpServletResponse response,
@Valid CustomerAnalysisReq query) throws IOException {
query = customerAnalysisService.getReq(query);
query = customerAnalysisService.getDataWhere(query);
System.out.println("处理后的查询条件:" + query);
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
reqDTO.setType(DownloadTypeEnum.REPORT_CSSTOMER_ANALYSIS.getType());
reqDTO.setName("客户分析报表");
reqDTO.setFileSuffix("xlsx");
reqDTO.setTemporaryFile(true);
reqDTO.setUserType(2);
reqDTO.setLang(I18nMessage.getLang());
reqDTO.setRequestParams(JSONObject.toJSONString(query));
fileMakeApi.sendFileMake(reqDTO);
return CommonResult.success(true);
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermission;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermissionPageReq;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermissionResp;
import cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import javax.validation.*;
import io.swagger.v3.oas.annotations.Operation;
import java.util.ArrayList;
import java.util.List;
/**
* 报表权限(EcwReportPermission)表控制层
*
* @author lanbm
* @since 2024-04-09 23:10:39
*/
@RestController
@RequestMapping("/Report/EcwReportPermission")
public class EcwReportPermissionController {
/**
* 服务对象
*/
@Resource
private EcwReportPermissionService ecwReportPermissionService;
@Resource
private RedisHelper redisHelper;
private ErrorCode eCode;
/*
权限校验函数 lanbm 2024-04-15 add
*/
private boolean isRight(EcwReportPermission ecwReportPermission) {
//单表对象查询
LambdaQueryWrapper<EcwReportPermission> lambdaQueryWrapper =
new LambdaQueryWrapper();
lambdaQueryWrapper.eq(EcwReportPermission::getUserId,
ecwReportPermission.getUserId());
if (ecwReportPermission.getPermissionFw() == 3) {
lambdaQueryWrapper.eq(EcwReportPermission::getPermissionFw,
3);
List<EcwReportPermission> objList = ecwReportPermissionService.list(lambdaQueryWrapper);
if (objList != null && objList.size() > 0) {
eCode = new ErrorCode(2024041501,
"用户的全公司权限已存在,不用再次添加");
return false;
}
} else if (ecwReportPermission.getPermissionFw() == 1) {
//个人
lambdaQueryWrapper.eq(EcwReportPermission::getPermissionFw,
1);
List<EcwReportPermission> objList = ecwReportPermissionService.list(lambdaQueryWrapper);
if (objList != null && objList.size() > 0) {
eCode = new ErrorCode(2024041502,
"用户的个人权限已存在,不用再次添加");
return false;
}
} else if (ecwReportPermission.getPermissionFw() == 2) {
//部门
lambdaQueryWrapper.eq(EcwReportPermission::getPermissionFw,
2);
lambdaQueryWrapper.eq(EcwReportPermission::getDeptId,
ecwReportPermission.getDeptId());
List<EcwReportPermission> objList = ecwReportPermissionService.list(lambdaQueryWrapper);
if (objList != null && objList.size() > 0) {
eCode = new ErrorCode(2024041503,
"用户的部门权限已存在,不用再次添加");
return false;
}
}
return true;
}
/**
* 新增数据
*
* @param ecwReportPermission 实体
* @return 新增结果
*/
@PostMapping("/create")
public CommonResult<Long> create(@Valid @RequestBody EcwReportPermission ecwReportPermission) {
boolean bR = isRight(ecwReportPermission);
if (bR == false) {
return error(eCode);
}
//System.out.println(ecwReportPermission);
return success(ecwReportPermissionService.create(ecwReportPermission));
}
/**
* 编辑数据
*
* @param ecwReportPermission 实体
* @return 编辑结果
*/
@PostMapping("/update")
public CommonResult<Boolean> update(@RequestBody EcwReportPermission ecwReportPermission) {
/*
boolean bR = isRight(ecwReportPermission);
if (bR == false) {
return error(eCode);
}*/
ecwReportPermissionService.update(ecwReportPermission);
return success(true);
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@GetMapping("/delete")
public CommonResult<Boolean> delete(@RequestParam Long id) {
ecwReportPermissionService.delete(id);
return success(true);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("/get")
public CommonResult<EcwReportPermission> getModel(@RequestParam("id") Long id) {
EcwReportPermission ecwReportPermission = ecwReportPermissionService.getModel(id);
return success(ecwReportPermission);
}
/*
获取当前用户的报表权限 lanbm 2024-04-15 add
*/
@GetMapping("/getCurUserPermission")
public CommonResult<EcwReportPermission> getCurUserPermission() {
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
LambdaQueryWrapper<EcwReportPermission> lambdaQueryWrapper =
new LambdaQueryWrapper();
lambdaQueryWrapper.eq(EcwReportPermission::getUserId, loginUserId);
List<EcwReportPermission> objList = ecwReportPermissionService.list(lambdaQueryWrapper);
if (objList == null || objList.size() == 0) {
ErrorCode eCode = new ErrorCode(2024041504,
"当前用户未分配报表权限,请联系系统管理员处理。");
return error(eCode);
}
return success(objList.get(0));
}
/**
* 查询所有数据
*
* @return 实例对象集合
*/
@GetMapping
public CommonResult queryAll() {
return success(this.ecwReportPermissionService.list());
}
/**
* 分页查询
*
* @return 分页对象集合
*/
@GetMapping("/page")
@Operation(summary = "获取分页查询列表")
public CommonResult<PageResult<EcwReportPermissionResp>> getListPage(@Valid EcwReportPermissionPageReq PageReq) {
//myBatisPlus分页
//return success(this.ecwReportPermissionService.getListPage(PageReq));
//通过自定义SQL语句分页 lanbm 2024-04-15 add
redisHelper.set("123","测试");
List<String>l=new ArrayList<>();
l.add("112");
l.add("12444");
redisHelper.set("myTest",l.toString());
return success(this.ecwReportPermissionService.getListPageCustom(PageReq));
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import javax.validation.*;
import io.swagger.v3.oas.annotations.Operation;
/**
* V值转换配置参数(EcwVz)表控制层
*
* @author lanbm
* @since 2024-04-02
*/
@RestController
@RequestMapping("/ecwVz/vz")
public class EcwVzController {
/**
* 服务对象
*/
@Resource
private EcwVzService ecwVzService;
private final String HYPG = "海运拼柜";
private final String ZXKY = "专线空运";
/**
* 新增数据
*
* @param ecwVz 实体
* @return 新增结果
*/
@PostMapping("/create")
public CommonResult<Long> create(@Valid @RequestBody EcwVz ecwVz) {
System.out.println(ecwVz);
EcwVz temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>()
.eqIfPresent(EcwVz::getTitleZh, ecwVz.getTitleZh()));
if (temp == null) {
return success(ecwVzService.create(ecwVz));
} else {
ecwVz.setId(temp.getId());
ecwVzService.update(ecwVz);
return success(ecwVz.getId());
}
}
/**
* 编辑数据
*
* @param ecwVz 实体
* @return 编辑结果
*/
@PostMapping("/update")
public CommonResult<Boolean> update(@RequestBody EcwVz ecwVz) {
//System.out.println(ecwVz);
ecwVzService.update(ecwVz);
return success(true);
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@GetMapping("/delete")
public CommonResult<Boolean> delete(@RequestParam Long id) {
//自定义物理删除方法
ecwVzService.delete(id);
return success(true);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("/get")
public CommonResult<EcwVz> getModel(@RequestParam("id") Long id) {
EcwVz ecwVz = ecwVzService.getModel(id);
return success(ecwVz);
}
/**
* 查询所有数据
*
* @return 实例对象集合
*/
@GetMapping
public CommonResult queryAll() {
return success(this.ecwVzService.list());
}
/**
* 分页查询
*
* @return 分页对象集合
*/
@GetMapping("/page")
@Operation(summary = "获取分页查询列表")
public CommonResult<PageResult<EcwVz>> selectPage(@Valid EcwVzPageReq PageReq) {
return success(this.ecwVzService.selectPage(PageReq));
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.module.delivery.entity.Employee;
import cn.iocoder.yudao.module.delivery.entity.EmployeePageReq;
import cn.iocoder.yudao.module.delivery.service.EmployeeService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import javax.validation.*;
import io.swagger.v3.oas.annotations.Operation;
/**
* (Employee)表控制层
*
* @author lanbm
* @since 2024-03-27 21:25:55
*/
@RestController
@RequestMapping("employee")
public class EmployeeController {
/**
* 服务对象
*/
@Resource
private EmployeeService employeeService;
/**
* 新增数据
*
* @param employee 实体
* @return 新增结果
*/
@PostMapping("/create")
public CommonResult<Long> create(@Valid @RequestBody Employee employee) {
return success(employeeService.create(employee));
}
/**
* 编辑数据
*
* @param employee 实体
* @return 编辑结果
*/
@PostMapping("/update")
public CommonResult<Boolean> update(@RequestBody Employee employee) {
employeeService.update(employee);
return success(true);
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@GetMapping("/delete")
public CommonResult<Boolean> delete(@RequestParam Long id) {
employeeService.delete(id);
return success(true);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("/get")
public CommonResult<Employee> getModel(@RequestParam("id") Long id) {
Employee employee = employeeService.getModel(id);
return success(employee);
}
/**
* 查询所有数据
*
* @return 实例对象集合
*/
@GetMapping
public CommonResult queryAll() {
return success(this.employeeService.list());
}
/**
* 分页查询
*
* @return 分页对象集合
*/
@GetMapping("/page")
@Operation(summary = "获取分页查询列表")
public CommonResult<PageResult<Employee>> getListPage(@Valid EmployeePageReq PageReq) {
return success(this.employeeService.getListPage(PageReq));
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
import cn.iocoder.yudao.module.delivery.service.SalesAnalysisService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.file.FileMakeApi;
import cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO;
import cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
/**
* (SalesAnalysis)销售分析报表
*
* @author lanbm add
* @since 2024-03-31
*/
@RestController
@RequestMapping("/Report/SalesAnalysis")
public class SalesAnalysisControl {
@Autowired
private SalesAnalysisService salesAnalysisService;
/*
数据字典项
*/
@Autowired
private DictDataApi dictDataApi;
@Resource
private FileMakeApi fileMakeApi;
/*
根据原始信息计算逻辑展示信息 lanbm 2024-04-29 add
*/
private SalesAnalysisResp calBis(SalesAnalysisResp r) {
String sTemp = "";
//付款方
if (r.getDrawee().equals("1")) {
if (r.getCfResourceType().equals("1")) {
r.setShowResourceType("开发客户");
} else if (r.getCfResourceType().equals("2")) {
r.setShowResourceType("公司客户");
}
if (r.getCfYeJiType().equals("0")) {
r.setShowYeJiType("老客户");
} else if (r.getCfYeJiType().equals("1")) {
r.setShowYeJiType("新客户");
}
sTemp = "发货方";
} else if (r.getDrawee().equals("2")) {
if (r.getShResourceType().equals("1")) {
r.setShowResourceType("开发客户");
} else if (r.getShResourceType().equals("2")) {
r.setShowResourceType("公司客户");
}
if (r.getShYeJitype().equals("0")) {
r.setShowYeJiType("老客户");
} else if (r.getShYeJitype().equals("1")) {
r.setShowYeJiType("新客户");
}
sTemp = "收货方";
} else if (r.getDrawee().equals("3")) {
if (r.getCfResourceType().equals("1")) {
r.setShowResourceType("开发客户");
} else if (r.getCfResourceType().equals("2")) {
r.setShowResourceType("公司客户");
}
if (r.getCfYeJiType().equals("0")) {
r.setShowYeJiType("老客户");
} else if (r.getCfYeJiType().equals("1")) {
r.setShowYeJiType("新客户");
}
sTemp = "自定义";
}
r.setDraweeName(sTemp);
return r;
}
/*
客户分析列表 lanbm 2024-04-02 add
*/
@GetMapping("/getListPage")
public CommonResult<PageResult<SalesAnalysisResp>>
getListPage(@Valid SalesAnalysisReq query) {
System.out.println("订单分析查询条件:" + query);
/*
SalesAnalysisReq query = JSON.parseObject(JSON.toJSONString(map),
SalesAnalysisReq.class);
*/
//订单状态
List<DictDataRespDTO> dic_order_status =
dictDataApi.getDictDatas("order_status");
Map<String, String> map_order_status = new HashMap<>();
for (DictDataRespDTO d : dic_order_status
) {
map_order_status.put(d.getValue(), d.getLabel());
}
PageResult<SalesAnalysisResp> pageResult =
salesAnalysisService.getListPage(query);
int nPm = query.getStart() + 1;
String sTemp = "";
for (SalesAnalysisResp r : pageResult.getList()
) {
r.setPx(nPm);
nPm++;
//订单状态
r.setStatusName(map_order_status.get(r.getStatus()));
String sType = "";
if (r.getOrdertype() == 2) {
//是重货,非泡货
sType = "是/否";
} else if (r.getOrdertype() == 3) {
sType = "否/是";
} else if (r.getOrdertype() == 1) {
sType = "普货";
}
r.setOrdertypeShow(sType);
//业务数据逻辑运算
r = calBis(r);
if (r.getUseweightunit() == null) r.setUseweightunit("无");
if (r.getUsevolumeunit() == null) r.setUsevolumeunit("无");
r.setZpUnitShow(r.getUseweightunit() + "/" + r.getUsevolumeunit());
}
return success(pageResult);
}
/*
lanbm 2024-04-24 add
*/
@GetMapping("/exportExcel")
@ApiOperation("导出销售分析数据")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> export(HttpServletResponse response,
@Valid SalesAnalysisReq Req)
throws IOException {
System.out.println("订单分析查询数据导出查询条件:" + Req);
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
reqDTO.setType(DownloadTypeEnum.REPORT_SALES_ANALYSIS.getType());
reqDTO.setName("销售分析数据");
reqDTO.setFileSuffix("xlsx");
reqDTO.setTemporaryFile(true);
reqDTO.setUserType(2);
reqDTO.setLang(I18nMessage.getLang());
reqDTO.setRequestParams(JSONObject.toJSONString(Req));
fileMakeApi.sendFileMake(reqDTO);
return CommonResult.success(true);
/*
List<SalesAnalysisExcelResp> list = salesAnalysisService.getList(Req);
ExcelUtils.write(response, "销售分析数据.xls", "销售分析数据",
SalesAnalysisExcelResp.class, list);*/
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.entity.bar.CustomerReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.series;
import cn.iocoder.yudao.module.delivery.entity.bar.yAxis;
import cn.iocoder.yudao.module.delivery.service.SalesReportService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* (Employee)表控制层
*
* @author lanbm
* @since 2024-03-27 21:25:55
*/
@RestController
@Api(tags = "管理后台 -统计报表")
@RequestMapping("/Report/SalesReport")
public class SalesReportControl {
//ecw_order_departure 订单始发地
//ecw_order_consignor 订单发货人
//ecw_order_consignee 订单收货人
//订单表 ecw_order
//drawee 付款人 付款人:1 发货人 2 收货人 3 自定义
//status 订单状态 0草稿 2待入仓,3入参中
@Autowired
private SalesReportService salesReportService;
/*
首次成交的客户数统计
lanbm 2024-04-01
*/
@PostMapping("/FirstCustomerCount")
public CommonResult<Integer> FirstCustomerCount(@RequestBody SalesReportReq Req) {
int nR = salesReportService.FirstCustomerCount(Req);
return success(nR);
}
/*
按运输方式统计重量和方数
lanbm 2024-04-01
*/
@PostMapping("/SalesReportCount")
public CommonResult<SalesReportResp> SalesReportCount(@RequestBody SalesReportReq Req) {
String s = "";
SalesReportResp re = salesReportService.SalesReportCount(Req);
return success(re);
}
/*
图表分析统计结果
lanbm 2024-04-01 add
*/
@PostMapping("/SalesReportList")
public CommonResult<Integer> SalesReportList(@RequestBody SalesReportReq Req) {
int nR = salesReportService.FirstCustomerCount(Req);
return success(nR);
}
/*
获取销售分析图表数据
*/
@GetMapping("/getEChartData")
public CommonResult<CustomerReportBar>
getEChartData(@Valid SalesAnalysisReq query) {
CustomerReportBar customerReportBar = new CustomerReportBar();
yAxis y = new yAxis();
y.setType("category");
y.setInverse(true);
List<String> l = new ArrayList<>();
l.add("1");
l.add("2");
l.add("3");
l.add("4");
l.add("5");
y.setData(l);
customerReportBar.setObjyAxis(y);
List<series> sl = new ArrayList<>();
//总V值
series s1 = new series();
s1.setName("2024");
s1.setType("bar");
s1.setBarGap("60%");
s1.setBarCategoryGap("60%");
List<String> s1L = new ArrayList<>();
s1L.add("12");
s1L.add("4");
s1L.add("7");
s1L.add("10");
s1L.add("20");
s1.setData(s1L);
sl.add(s1);
//海运
series s2 = new series();
s2.setName("2023");
s2.setType("bar");
s2.setBarGap("60%");
s2.setBarCategoryGap("60%");
List<String> s2L = new ArrayList<>();
s2L.add("10");
s2L.add("13");
s2L.add("6");
s2L.add("8");
s2L.add("9");
s2.setData(s2L);
sl.add(s2);
//空运
series s3 = new series();
s3.setName("2022");
s3.setType("bar");
s3.setBarGap("60%");
s3.setBarCategoryGap("60%");
List<String> s3L = new ArrayList<>();
s3L.add("10");
s3L.add("13");
s3L.add("19");
s3L.add("8");
s3L.add("19");
s3.setData(s3L);
sl.add(s3);
customerReportBar.setObSseries(sl);
// customerReportBar.setResultList(lis);
return success(customerReportBar);
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
import cn.iocoder.yudao.module.delivery.entity.deptex.DeptEx;
import cn.iocoder.yudao.module.delivery.mapper.DeptExMapper;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSimpleResp2VO;
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController
@Api(tags = "管理后台 -统计报表")
@RequestMapping("/Report/SysDeptEx")
public class SysDeptExtControl {
//lanbm 2024-04-19 添加的系统基础扩展功能
@Resource
private DeptExMapper deptExMapper;
@Resource
private AdminUserService userService;
@Resource
private DeptService deptService;
@GetMapping("/getDeptChild")
@Operation(summary = "根据父机部门获取子部门")
public CommonResult<List<DeptEx>> getDeptChild(@Valid DeptEx Req) {
return success(deptExMapper.getDeptChild(Req));
}
@GetMapping("/listServiceUser")
@ApiOperation(value = "获取客服岗人员列表", notes = "只包含客服用户,主要用于前端的下拉选项")
public CommonResult<List<UserSimpleResp2VO>> listServiceUser(@Valid DeptEx Req) {
List<AdminUserDO> list =
userService.getUsersByPostIds(Arrays.asList(2L, 19L));
List<UserSimpleResp2VO> resultList =
UserConvert.INSTANCE.convertList05(list);
if (CollectionUtil.isNotEmpty(resultList)) {
List<Long> deptIds =
resultList.stream().map(t -> t.getDeptId()).
filter(Objects::nonNull).distinct().
collect(Collectors.toList());
Map<Long, DeptDO> deptMap = deptService.getDeptMap(deptIds);
if (CollectionUtil.isNotEmpty(deptMap)) {
for (UserSimpleResp2VO userSimpleResp2VO : resultList) {
if (userSimpleResp2VO.getDeptId() != null) {
DeptDO deptDO = deptMap.get(userSimpleResp2VO.getDeptId());
if (deptDO != null) {
userSimpleResp2VO.setDeptName(deptDO.getName());
}
}
}
}
}
List<DeptEx> listDept = deptExMapper.getDeptChild(Req);
List<Long> deptQuanX = new ArrayList<>();
for (DeptEx d : listDept
) {
deptQuanX.add(d.getId());
}
List<UserSimpleResp2VO> list2 = new ArrayList<>();
for (UserSimpleResp2VO u : resultList
) {
if (deptQuanX.contains(u.getDeptId())) {
list2.add(u);
}
}
// 排序后,返回给前端
return success(list2);
}
}
package cn.iocoder.yudao.module.delivery.convert;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;
import java.util.List;
/*
model类型转换 lanbm 2024-04-27 add
https://www.cnblogs.com/DDgougou/articles/13365277.html
*/
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface CustomerAnalysis {
/*****转换MapStruct*****/
CustomerAnalysis INSTANCE = Mappers.getMapper(CustomerAnalysis.class);
// @Mapping(target = "salesmanid", ignore = true)
// @Mapping(source = "salesmanid",target ="salesmanid",ignore = true)
CustomerAnalysisExcelResp convert(CustomerAnalysisResp bean);
List<CustomerAnalysisExcelResp> convertList(List<CustomerAnalysisResp> list);
}
package cn.iocoder.yudao.module.delivery.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CustomerAnalysisExcelResp {
/*
排名编号
*/
@ExcelProperty("排名编号")
private int px;
/*
客户编号
*/
@ExcelProperty("客户编号")
private String number;
/*
客户姓名
*/
@ExcelProperty("客户姓名")
private String name;
/*
客户经理姓名
*/
@ExcelProperty("客户经理")
private String salesman;
/*
客户经理部门名称
*/
@ExcelProperty("部门")
private String deptname;
/*
总值,海运拼柜,专线空运
*/
@ExcelProperty("总V值")
private BigDecimal allsumvolume;
/*
总V值同比显示信息
*/
@ExcelProperty("总V值同比")
private String allsumvolumeTbShow;
/*
海运拼柜
*/
@ExcelProperty("海运拼柜")
private BigDecimal sumvolumeV1;
/*
海运占比
*/
@ExcelProperty("海运占比")
private String seaZb;
/*
海运同比显示
*/
@ExcelProperty("海运同比")
private String sumvolumeTbShow1;
/*
专线空运V值
*/
@ExcelProperty("专线空运")
private BigDecimal sumweightV3;
/*
空运占比
*/
@ExcelProperty("空运占比")
private String airZb;
/*
空运同比显示
*/
@ExcelProperty("空运同比")
private String sumweightTbShow3;
/*
月均
*/
@ExcelProperty("月均")
private String monthAvg;
/*
月均同比
*/
@ExcelProperty("月均同比")
private String monthAvgTbShow;
/*
海运月均方数
*/
@ExcelProperty("海运月均方数")
private String seaMonthAvg;
/*
海运月均方数同比
*/
@ExcelProperty("海运月均同比")
private String seaMonthAvgTb;
/*
空运月均重量
*/
@ExcelProperty("空运月均重量")
private String airMothAvg;
/*
空运月均同比
*/
@ExcelProperty("空运月均同比")
private String airMothAvgTb;
/*
重货总V值
*/
@ExcelProperty("重货总V值")
private BigDecimal weightSumV;
/*
重货占比
*/
@ExcelProperty("重货占比")
private String weithtSumZb;
/*
泡货总V值
*/
@ExcelProperty("泡货总V值")
private BigDecimal phSumV;
/*
泡货占比
*/
@ExcelProperty("泡货占比")
private String phSumZb;
/*
控货总V值
*/
@ExcelProperty("控货总V值")
private BigDecimal khSumV;
/*
控货总占比
*/
@ExcelProperty("控货占比")
private String khSumZb;
/*
是否首次成交
*/
@ExcelProperty("是否首次成交")
private String isFirst;
/*
首次成交时间
*/
@ExcelProperty("首次成交时间")
private String firstDate;
/*
提货率
*/
@ExcelProperty("提货率")
private String thL;
/*
客户业绩类型
是否新客户:1是新客户,0是老客户
*/
@ExcelProperty("客户业绩类型")
private String cusYjType;
/*
客户来源名称
*/
@ExcelProperty("客户来源")
private String sourcename;
/*
客户国家
*/
@ExcelProperty("客户国家")
private String country;
/*
客户角色
*/
@ExcelProperty("客户角色")
private String customerrole;
/*
客户创建日期
*/
@ExcelProperty("客户创建日期")
private String createtime;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
/*
客户分析报表
逻辑数据大部分集中在表 ecw_customer
lanbm 2024-03-31 add
*/
@Schema(description = "管理后台 - 客户分析查询参数")
@Data
@ToString(callSuper = true)
public class CustomerAnalysisReq extends PageParam {
private int start;
private int size;
/*
客户编号
*/
//private String number;
/*
客户名称
*/
private String name;
private String searchtype;
/*
客户国家
*/
private String country;
/*
客户来源
*/
private int source;
/*
销售经理
*/
private String salesmanid;
/*
部门ID
*/
private String deptid;
/*
客户姓名
*/
private String cusname;
/*
客户编号
*/
private String cusno;
/*
是否首次成交 0是否,1是
*/
private int first;
/*
业绩类型
*/
private int cusYjType;
/*
客户角色
*/
private String customerrole;
/*
数据筛选类型
*/
private String searchDataType1;
private BigDecimal searchData1;//总V值查询
private String searchDataType2;
private BigDecimal searchData2;//海运拼柜
private String searchDataType3;
private BigDecimal searchData3; //专线空运
/*
客户创建时间
*/
private String searchDataType4;
private String sdate4;
private String edate4;
/*
首次成交时间
*/
private String sdate5;
private String edate5;
/*
时间筛选类型
首次成交日期,客户创建日期
*/
private String SearchDateType;
private String sdate;
//对比开始日期
private String sduibidate;
private String edate;
//对比结束日期
private String eduibidate;
/*
对比年份
*/
private String duibiYear;
private String curYear;//统计年份
/*
统计时间跨度 总月数,用户计算月均
*/
private int nMonth;
}
package cn.iocoder.yudao.module.delivery.entity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/*
客户分析结果
lanbm 2024-04-02 add
字段值名称首字母要小写,字段中不能含有下划线
*/
@ApiModel("管理后台-客户分析报表结果")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerAnalysisResp {
/*
排名编号
*/
private int px;
/*
客户编号
*/
private String number;
private String id;
/*
客户姓名
*/
private String name;
/*
客户经理姓名
*/
private String salesman;
/*
客户经理所在的部门
*/
private String deptid;
/*
部门名称
*/
private String deptname;
/*
客户经理ID
customer_service 客户表中的跟进客服
*/
private String salesmanid;
/*
总值,海运拼柜,专线空运
*/
private BigDecimal allsumvolume;
/*
总值同比
*/
private BigDecimal allsumvolumeTb;
/*
总V值同比显示信息
*/
private String allsumvolumeTbShow;
/*
海运拼柜
*/
private BigDecimal sumvolume1;
private BigDecimal sumvolumeV1;
private BigDecimal sumvolumeTb1;
private BigDecimal sumvolumeTbV1;
/*
海运拼柜占比
*/
private String seaZb;
/*
海运同比显示
*/
private String sumvolumeTbShow1;
/*
专线空运
*/
private BigDecimal sumweight3;
private BigDecimal sumweightV3;
private BigDecimal sumweightTb3;
private BigDecimal sumweightTbV3;
/*
空运占比
*/
private String airZb;
/*
空运同步显示
*/
private String sumweightTbShow3;
/*
月均
*/
private String monthAvg;
private String monthAvgTb;
/*
月均同比
*/
private String monthAvgTbShow;
/*
海运月均方数
*/
private String seaMonthAvg;
private BigDecimal seaMonthAvgZ;
/*
海运月均方数同比
*/
private String seaMonthAvgTb;
private BigDecimal seaMonthAvgTbZ;
/*
空运月均重量
*/
private String airMothAvg;
private BigDecimal airMothAvgZ;//数值
/*
空运月均同比
*/
private String airMothAvgTb;//显示字符串
private BigDecimal airMothAvgTbZ;//数值
/*
重货总V值
*/
private BigDecimal weightSumV;
/*
重货占比
*/
private String weithtSumZb;
/*
泡货总V值
*/
private BigDecimal phSumV;
/*
泡货占比
*/
private String phSumZb;
/*
控货总V值
*/
private BigDecimal khSumV;
/*
控货总占比
*/
private String khSumZb;
/*
是否首次成交
*/
private String isFirst;
/*
首次成交时间
*/
private String firstDate;
/*
入库总箱数
*/
private int chargequantity;
/*
提货数
*/
private int pickquantity;
/*
提货率
*/
private String thL;
/*
客户业绩类型
是否新客户:1是新客户,0是老客户
*/
private String cusYjType;
/*
客户来源
*/
private String source;
/*
客户来源名称
*/
private String sourcename;
/*
客户国家
*/
private String country;
private int countryID;
/*
客户角色
*/
private String customerrole;
/*
对应数据字典中的客户类别 type
*/
private String type;
/*
客户创建日期
*/
private String createtime;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/*
客户看板请求参数
lanbm 2024-03-31 add
*/
@Schema(description = "管理后台 - 客户看板查询参数")
@Data
@ToString(callSuper = true)
public class CustomerReportReq extends PageParam {
private int start;
private int size;
/*
统计开始日期
*/
private String sDate;
private String sDuiBiDate;
private String sHuanhuanBiDate;//环比日期
/*
统计结束日期
*/
private String eDate;
private String eDuiBiDate;
private String eHuanBiDate;//环比日期
/*
对比年份
*/
private String duibiYear;
private String curYear;//统计年份
/*
部门ID
*/
private String deptid;
/*
客户经理
*/
private String salesmanid;
private Integer pageNo ;
private Integer pageSize;
}
package cn.iocoder.yudao.module.delivery.entity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/*
客户看板结果
lanbm 2024-04-02 add
*/
@ApiModel("管理后台-客户看报表结果")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerReportResp {
//同比,和上一年的比较
//环比 和上一个月的比较
/*
客户编号
*/
private String number;
/*
客户姓名
*/
private String name;
/*
客户经理姓名
*/
private String salesman;
/*
客户经理ID
customer_service 客户表中的跟进客服
*/
private String salesmanid;
/*
总值,海运拼柜,专线空运
*/
private BigDecimal allsumvolume;
/*
总值同比
*/
private BigDecimal allsumvolumeTb;
private String allsumvolumeTbMsg;
/*
海运拼柜
*/
private BigDecimal sumvolume1;
private BigDecimal sumvolumeTb1;
/*
海运拼柜占比
*/
private String seaZb;
/*
专线空运
*/
private BigDecimal sumweight3;
private BigDecimal sumweightTb3;
/*
空运占比
*/
private String airZb;
private String deptname;
/*
对比年份
*/
private String duibiYear;
}
package cn.iocoder.yudao.module.delivery.entity;
import java.util.Date;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 报表权限(EcwReportPermission)实体类
*
* @author lanbm
* @since 2024-04-09 23:10:39
*/
@TableName("ecw_report_permission")
@Data
@EqualsAndHashCode(callSuper = true)
public class EcwReportPermission extends BaseDO {
private Long id;
/**
* 用户ID
*/
private String userId;
/**
* 权限范围1是本人,2部门,3是全公司
*/
private Integer permissionFw;
/**
* 部门详情
* 权限类型是本人 此字段为空
* 权限是部门,部门信息用,分开
* 权限是全公司,此字段为空
*/
private String deptId;
/*
是否有数据导出权
*/
private int exportdataq;
}
package cn.iocoder.yudao.module.delivery.entity;
import java.util.Date;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 分页 Request")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EcwReportPermissionPageReq extends PageParam {
private int start;
private int size;
private String userId; //用户ID
private Integer permissionFw;//权限范围
private String deptId; //部门信息
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 报表权限(EcwReportPermission)实体类
*
* @author lanbm
* @since 2024-04-09 23:10:39
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class EcwReportPermissionResp extends BaseDO {
private Long id;
/**
* 用户ID
*/
private String userId;
/**
* 用户名称
*/
private String userName;
/**
* 权限范围1是本人,2部门,3是全公司
*/
private Integer permissionFw;
/**
* 部门详情
* 权限类型是本人 此字段为空
* 权限是部门,部门信息用,分开
* 权限是全公司,此字段为空
*/
private String deptId;
/*
部门名称
*/
private String deptName;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* V值转换配置参数(EcwVz)实体类
*
* @author lanbm
* @since 2024-04-02 22:38:22
*/
@TableName("ecw_vz")
@Data
@EqualsAndHashCode(callSuper = true)
public class EcwVz extends BaseDO {
private Long id;
/**
* 运输方式
*/
private String titleZh;
/**
* 英文名称
*/
private String titleEn;
/**
* 单位符号 KG,M3 立方
*/
private String fuhao;
/*
1KG对应的VZ,1立方对应的V值
*/
private float vz;
/**
* 0显示 1不显示
*/
private Integer status;
/**
* 排序
*/
private Integer aorder;
}
package cn.iocoder.yudao.module.delivery.entity;
import java.util.Date;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 分页 Request")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EcwVzPageReq extends PageParam {
/**
* 运输方式
*/
private String titleZh;
/**
* 单位符号 KG,M3 立方
*/
private String fuhao;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* (Employee)实体类
*
* @author lanbm
* @since 2024-03-27 21:25:55
*/
@TableName("employee")
@Data
@EqualsAndHashCode(callSuper = true)
public class Employee extends BaseDO {
/**
* 员工编号
*/
private Long id;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private String empGender;
/**
* 年龄
*/
private Integer age;
/**
* 电子邮件
*/
private String email;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 分页 Request")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EmployeePageReq extends PageParam {
}
package cn.iocoder.yudao.module.delivery.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class SalesAnalysisExcelResp {
/*
排名编号
*/
private int px;
@ExcelProperty("排名")
/*
订单编号
*/
private String orderNo;
@ExcelProperty("订单编号")
/*
提单号
*/
private String tidanNo;
@ExcelProperty("提单号")
/*
订单发货人编号
*/
private String orderConsignorName;
@ExcelProperty("发货人名称")
/*
订单发货人客户ID,用户链接
*/
private String orderConsignorCusId;
/*
订单收货人名称
*/
@ExcelProperty("订单收货人名称")
private String orderConsigneeName;
/*
订单收货人客户编号,用于链接
*/
private String orderConsigneeCusId;
/*
客户经理
*/
private String salesmanid;
@ExcelProperty("客户经理")
private String salesmanidName;
/*
订单状态
*/
private String status;
@ExcelProperty("订单状态")
private String statusName;
/*
运输方式
*/
private String transportId;
@ExcelProperty("运输方式")
private String transportIdName;
/*
始发仓
*/
@ExcelProperty("始发仓")
private String startwarehousename;
/*
目的国
*/
/*
目的城市
*/
/*
目的仓
*/
@ExcelProperty("目的仓")
private String dstwarehousename;
/*
渠道
*/
private String channelid;
@ExcelProperty("渠道")
private String channelidName;
/*
唛头
*/
@ExcelProperty("唛头")
private String marks;
/*
入仓箱数
*/
@ExcelProperty("入仓箱数")
private String sumquantity;
/*
入仓体积
*/
@ExcelProperty("入仓体积")
private String sumvolume;
/*
入仓重量
*/
@ExcelProperty("入仓重量")
private String sumweight;
/*
是否控货
*/
@ExcelProperty("是否控货")
private String iscargocontrol;
/*
创建时间
*/
@ExcelProperty("创建时间")
private String createtime;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
/*
lanbm 2024-03-31 add
*/
@Schema(description = "管理后台 - 销售分析查询参数")
@Data
@ToString(callSuper = true)
public class SalesAnalysisReq extends PageParam {
private int start;
private int size;
/*
运输方式
1 海运柜拼柜 2海运整柜 3专线空运 4海空联运
*/
private int transportId;
/*
订单编号查询类型
*/
private String SearchType1;
/*
订单编号
*/
private String orderNo;
/*
提单的查询类别
*/
private String SearchType2;
/*
提单编号
*/
private String tidanNo;
/*
发货人编号
*/
private String SearchType3;
private String fhNumber;
/*
收货人编号
*/
private String SearchType4;
private String shNumber;
/*
销售经理
*/
private String salesmanId;
/*
部门ID
*/
private String deptId;
/*
唛头
*/
private String marks;
/*
订单状态
*/
private String status;
/*
始发仓
*/
private String startWarehouseId;
/*
目的国
*/
private String muDiGuo;
/*
目的城市
*/
private String muDiShi;
/*
目的仓
*/
private String dstwarehouseid;
/*
是否控货
*/
private int isCargoControl;
/*
渠道
*/
private String shippingChannelId;
/*
付款方
付款人:1 发货人 2 收货人 3 自定义
*/
private String drawee;
/*
重泡货类型
*/
private String zpType;
/*
资源类型
*/
private String ResourceType;
/*
业绩类型
*/
private String YeJiType;
/*
时间筛选类型
*/
private String dateSearch1;
/*
开始时间
*/
private String sdate1;
/*
结束时间
*/
private String edate2;
/*
数据类型筛选
*/
private String dataSearch1;
/*
比较符号设置
*/
private String dataSearch2;
/*
数据值
*/
private String dataSearch3;
}
package cn.iocoder.yudao.module.delivery.entity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/*
销售分析查询结果 lanbm 2024-04-02
*/
@ApiModel("管理后台-销售分析报表结果")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalesAnalysisResp {
/*
排名编号
*/
private int px;
/*
订单ID
*/
private String orderId;
/*
订单编号
*/
private String orderNo;
/*
提单号
*/
private String tidanNo;
/*
订单发货人编号
*/
private String orderConsignorName;
/*
订单发货人客户ID,用户链接
*/
private String orderConsignorCusId;
/*
订单收货人名称
*/
private String orderConsigneeName;
/*
订单收货人客户编号,用于链接
*/
private String orderConsigneeCusId;
/*
发货人编号
*/
private String fhNumber;
private long cfCustomerId;
/*
收货人编号
*/
private String shNumber;
private long shCustomerId;
/*
资源类型 lanbm 2024-04-29 add
*/
private String cfResourceType;//发货人资源类型
private String shResourceType;//收货人资源类型
private String showResourceType;//显示资源类型,根据付款方来做逻辑判断
/*
业绩类型 新客户,老客户 lanbm 2024-04-29 add
*/
private String cfYeJiType;//收货人业绩类型
private String shYeJitype;//发货人业绩类型
private String showYeJiType;
/*
客户经理
*/
private String salesmanid;
private String salesmanidName;
/*
订单状态
*/
private String status;
private String statusName;
/*
运输方式
*/
private String transportId;
private String transportIdName;
/*
始发仓
*/
private String startwarehousename;
/*
目的国
*/
private String muDiGuo;
/*
目的城市
*/
private String muDiShi;
/*
目的仓
*/
private String dstwarehousename;
/*
渠道
*/
private String channelid;
private String channelidName;
/*
唛头
*/
private String marks;
/*
入仓箱数
*/
private int sumquantity;
/*
提货箱数
*/
private int picknum;
/*
根据入库箱数和提货箱数计算出的提货率
*/
private String showThl;
/*
入仓体积
*/
private String sumvolume;
/*
入仓重量
*/
private String sumweight;
/*
是否控货
*/
private String iscargocontrol;
/*
订单类型:1 普货 2 重货 3 泡货
*/
private int ordertype;
private String ordertypeShow;
/*
创建时间
*/
private String createtime;
/*
业绩产生时间
*/
private String businesstime;
/*
付款方
付款人:1 发货人 2 收货人 3 自定义
*/
private String drawee;
/*
付款方显示字段
*/
private String draweeName;
/*
计算使用的重货标准基数
*/
private String useweightunit;
/*
计算使用的泡货标准基数
*/
private String usevolumeunit;
private String zpUnitShow;
/*
首次入仓时间
*/
private String firstInTime;
}
package cn.iocoder.yudao.module.delivery.entity;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/*
销售看板查询请求参数
逻辑数据大部分集中在表 ecw_order
lanbm 2024-03-31 add
*/
@Schema(description = "管理后台-销售看板查询参数")
@Data
@ToString(callSuper = true)
public class SalesReportReq {
/*
销售经理
*/
private String salesmanid;
/*
部门ID
*/
private String deptid;
/*
对比年份
*/
private String duibiYear;
}
package cn.iocoder.yudao.module.delivery.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
/*
model字段中不能有下划线,否则转对象会失败
*/
@ApiModel("管理后台 -销售看板查询结果")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalesReportResp {
/*
所有运输方式的总体积,换算V值结果
*/
private BigDecimal allsumvolume;
/*
海运体积
*/
private BigDecimal sumvolume1;
/*
专线空运重量
*/
private BigDecimal sumweight3;
}
package cn.iocoder.yudao.module.delivery.entity.bar;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportResp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/*
客户看板返回给图表的Model
lanbm 2024-04-03 add
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerReportBar {
private yAxis objyAxis;
private List<series> obSseries;
private List<CustomerReportResp> resultList;
/*
记录总数 lanbm 2024-04-14 add
*/
private long total;
}
package cn.iocoder.yudao.module.delivery.entity.bar;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class series {
private String name;
private String type;
private List<String> data;
/*
设置不同系列之间的间距
*/
private String barGap;
/*
设置同一系列中不同柱之间的间距
*/
private String barCategoryGap;
/*
自定义提示信息
*/
private String myTip;
}
package cn.iocoder.yudao.module.delivery.entity.bar;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class yAxis {
private String type;
private List<String> data;
/*
是否倒序
*/
private boolean inverse;
}
package cn.iocoder.yudao.module.delivery.entity.deptex;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DeptEx {
//部门扩展功能 model
private Long id;
private String name;
private Long parentId;
}
package cn.iocoder.yudao.module.delivery.entity.orderdata;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 订单业务数据")
@Data
@ToString(callSuper = true)
public class view_order_businesstime {
private int orderid;
private String orderno;
private String tidanno;
private String transportid;
/*
客户id
*/
private String customerid;
/*
是否控货
*/
private String iscargocontrol;
private String ordertype;
private String businesstime;
private int chargequantity;
private int picknum;
private BigDecimal chargevolume;
private BigDecimal chargeweight;
private BigDecimal vz;
}
package cn.iocoder.yudao.module.delivery.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode TEST_NOT_EXISTS = new ErrorCode(2004020001, "单号配置不存在");
}
\ No newline at end of file
package cn.iocoder.yudao.module.delivery.listener;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.export.ReportCustomerAnalysisExcelExportEvent;
import cn.iocoder.yudao.framework.apollo.core.event.export.ReportSalesAnalysisExcelExportEvent;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.module.delivery.convert.CustomerAnalysis;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.system.framework.ue.UeProperties;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import static cn.iocoder.yudao.framework.excel.constant.ExportConstant.DATA_FORMAT;
@Component("CustomerAnalysisExcelExportListener")
@AllArgsConstructor
@Slf4j
public class CustomerAnalysisExcelExportListener {
private UeProperties ueProperties;
private FileService fileService;
@Autowired
private CustomerAnalysisService customerAnalysisService;
/**
* 客户分析导出监听 lanbm 2024-05-01 add
*
* @param event 编号记录
*/
@EventListener(ReportCustomerAnalysisExcelExportEvent.class)
public void CustomerAnalysisExcelExportPushEvent(
ReportCustomerAnalysisExcelExportEvent event) {
if (StringUtils.isNotBlank(event.getRequestParams())) {
try {
System.out.println("开始数据导出");
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern(DATA_FORMAT);
String nowTime = formatter.format(LocalDateTime.now());
String dir = ueProperties.getTempDir().
concat("/CustomerAnalysis/excel/");
File fileDir = new File(dir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
CustomerAnalysisReq query =
JSONObject.parseObject(event.getRequestParams(),
CustomerAnalysisReq.class);
String fileName =
event.getUserId().toString().
concat(StrUtil.DASHED).concat(
event.getUserType().toString()).
concat(StrUtil.DASHED).
concat(nowTime).
concat("客户分析报表.xlsx");
List<CustomerAnalysisResp> list =
customerAnalysisService.getList(query);
List<CustomerAnalysisExcelResp> listExel =
CustomerAnalysis.INSTANCE.convertList(list);
String path = ExcelUtils.write(dir, fileName,
"客户分析报表",
CustomerAnalysisExcelResp.class,
listExel);
// 获取到临时文件
File file = new File(path);
// 创建FileInputStream对象
FileInputStream fileInputStream = new FileInputStream(file);
// 读取文件内容
byte[] fileBytes = new byte[(int) file.length()];
fileInputStream.read(fileBytes);
// 关闭文件流
fileInputStream.close();
// 将文件上传到资源服务器
FileDO fileDO = fileService.createFile(dir, fileName, fileBytes);
event.setPath(fileDO.getPath());
event.setFileName(fileDO.getPath());
event.setUrl(fileDO.getUrl());
event.setFileId(fileDO.getId());
} catch (Exception e) {
e.printStackTrace();
event.setResult(e.getMessage());
}
} else {
event.setResult("param fail");
}
}
}
package cn.iocoder.yudao.module.delivery.listener;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.export.ReportSalesAnalysisExcelExportEvent;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
import cn.iocoder.yudao.module.delivery.service.SalesAnalysisService;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.system.framework.ue.UeProperties;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import static cn.iocoder.yudao.framework.excel.constant.ExportConstant.DATA_FORMAT;
@Component("SalesAnalysisExcelExportListener")
@AllArgsConstructor
@Slf4j
public class SalesAnalysisExcelExportListener {
private UeProperties ueProperties;
private FileService fileService;
@Autowired
private SalesAnalysisService salesAnalysisService;
/**
* 销售分析导出监听 lanbm 2024-05-01 add
* 参考网址
*https://www.cnblogs.com/h-java/p/9951547.html
* @param event 编号记录
*/
@EventListener(ReportSalesAnalysisExcelExportEvent.class)
public void SalesAnalysisExcelExportPushEvent(
ReportSalesAnalysisExcelExportEvent event) {
if (StringUtils.isNotBlank(event.getRequestParams())) {
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT);
String nowTime = formatter.format(LocalDateTime.now());
String dir = ueProperties.getTempDir().concat("/SalesAnalysis/excel/");
File fileDir = new File(dir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
String fileName =
event.getUserId().toString().
concat(StrUtil.DASHED).
concat(event.getUserType().toString()).
concat(StrUtil.DASHED).
concat(nowTime).
concat("销售分析数据.xlsx");
SalesAnalysisReq query =
JSONObject.parseObject(event.getRequestParams(),
SalesAnalysisReq.class);
List<SalesAnalysisExcelResp> list =
salesAnalysisService.getList(query);
String path = ExcelUtils.write(dir, fileName,
"销售分析数据", SalesAnalysisExcelResp.class, list);
// 获取到临时文件
File file = new File(path);
// 创建FileInputStream对象
FileInputStream fileInputStream = new FileInputStream(file);
// 读取文件内容
byte[] fileBytes = new byte[(int) file.length()];
fileInputStream.read(fileBytes);
// 关闭文件流
fileInputStream.close();
// 将文件上传到资源服务器
FileDO fileDO = fileService.createFile(dir, fileName, fileBytes);
event.setPath(fileDO.getPath());
event.setFileName(fileDO.getPath());
event.setUrl(fileDO.getUrl());
event.setFileId(fileDO.getId());
} catch (Exception e) {
e.printStackTrace();
event.setResult(e.getMessage());
}
} else {
event.setResult("param fail");
}
}
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import cn.iocoder.yudao.module.delivery.entity.Employee;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* (CustomerAnalysis)客户分析
*
* @author lanbm
* @since 2024-04-01
*/
@Mapper
public interface CustomerAnalysisMapper {
List<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req);
/*
lanbm 2024-04-26 add
*/
List<CustomerAnalysisResp> getListPage_New(CustomerAnalysisReq req);
/*
获取查询条件的总数
*/
Long GetCount(CustomerAnalysisReq req);
List<CustomerAnalysisResp>getList(CustomerAnalysisReq req);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CustomerAnalysisMapper2 {
List<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportResp;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* (CustomerReport)客户报表
*
* @author lanbm
* @since 2024-04-01
*/
@Mapper
public interface CustomerReportMapper {
List<CustomerReportResp> getListPage(CustomerReportReq req);
/*
获取查询条件的总数
*/
Long GetCount(CustomerReportReq req);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.delivery.entity.deptex.DeptEx;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DeptExMapper extends BaseMapperX<DeptEx> {
List<DeptEx> getDeptChild(DeptEx QueryReq);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.delivery.entity.*;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
/**
* 报表权限(EcwReportPermission)表数据库访问层
*
* @author lanbm
* @since 2024-04-09 23:10:40
*/
@Mapper
public interface EcwReportPermissionMapper extends BaseMapperX<EcwReportPermission> {
/*
简单的单表查询,开发效率高,如果关联多表还是是XML比较好
lanbm 2024-04-15 add
*/
default List<EcwReportPermission> selectList(EcwReportPermission QueryReq) {
return selectList(new LambdaQueryWrapperX<EcwReportPermission>()
.eqIfPresent(EcwReportPermission::getPermissionFw, QueryReq.getPermissionFw())
);
}
default PageResult<EcwReportPermission> selectPage(EcwReportPermissionPageReq PageReq) {
return selectPage(PageReq, new LambdaQueryWrapperX<EcwReportPermission>()
.eqIfPresent(EcwReportPermission::getPermissionFw, PageReq.getPermissionFw())
.orderByDesc(EcwReportPermission::getUpdateTime)
);
}
/*
实现物理删除
lanbm 2024-04-08 add
*/
int deleteById2(Long id);
/*
lanbm 2024-04-15 add
*/
List<EcwReportPermissionResp> getListPageCustom(EcwReportPermissionPageReq PageReq);
/*
获取查询条件的总数
*/
Long GetCount(EcwReportPermissionPageReq req);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
/**
* V值转换配置参数(EcwVz)表数据库访问层
*
* @author lanbm
* @since 2024-04-02 22:38:22
*/
@Mapper
public interface EcwVzMapper extends BaseMapperX<EcwVz> {
default List<EcwVz> selectList(EcwVz QueryReq) {
return selectList(new LambdaQueryWrapperX<EcwVz>());
}
default PageResult<EcwVz> selectPage(EcwVzPageReq PageReq) {
return selectPage(PageReq, new LambdaQueryWrapperX<EcwVz>()
.likeIfPresent(EcwVz::getTitleZh, PageReq.getTitleZh())
.likeIfPresent(EcwVz::getFuhao, PageReq.getFuhao())
);
}
/*
实现物理删除
lanbm 2024-04-08 add
*/
int deleteById2(Long id);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.delivery.entity.Employee;
import cn.iocoder.yudao.module.delivery.entity.EmployeePageReq;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
/**
* (Employee)表数据库访问层
*
* @author lanbm
* @since 2024-03-27 21:25:56
*/
@Mapper
public interface EmployeeMapper extends BaseMapperX<Employee> {
default List<Employee> selectList(Employee QueryReq) {
return selectList(new LambdaQueryWrapperX<Employee>());
}
default PageResult<Employee> selectPage(EmployeePageReq PageReq) {
return selectPage(PageReq, new LambdaQueryWrapperX<Employee>());
}
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* (SalesAnalysis)销售分析
*
* @author lanbm
* @since 2024-04-01
*/
@Mapper
public interface SalesAnalysisMapper {
List<SalesAnalysisResp> getListPage(SalesAnalysisReq req);
/*
获取查询条件的总数
*/
Long GetCount(SalesAnalysisReq req);
/*
导出报表列表 lanbm 2024-04-24 add
*/
List<SalesAnalysisExcelResp>getList(SalesAnalysisReq req);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import org.apache.ibatis.annotations.Mapper;
/**
* (SalesReport)销售报表
*
* @author lanbm
* @since 2024-04-01
*/
@Mapper
public interface SalesReportMapper {
SalesReportResp SalesReportCount(SalesReportReq Req);
int FirstCustomerCount(SalesReportReq Req);
}
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.module.delivery.entity.orderdata.view_order_businesstime;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/*
订单业务数据 lanbm 2024-04-25 add
*/
@Mapper
public interface view_order_businesstimeMapper {
/*
// 升序排序
List<Dictionaries> dictionaries =
list.stream().sorted().collect(Collectors.toList());
// 降序排序
List<Dictionaries> dictionaries =
list.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
// 定制升序排序
List<Dictionaries> dictionaries =
list.stream().sorted(Comparator.comparing(Student::getAge)).collect(Collectors.toList());
// 定制降序排序
List<Dictionaries> dictionaries =
list.stream().sorted(Comparator.comparing(Student::getAge).reverseOrder()).collect(Collectors.toList());
*/
/*
获取订单业务数据 lanbm 2024-04-25
*/
List<view_order_businesstime> getOrderBusinessData();
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.delivery.entity.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.List;
public interface CustomerAnalysisService {
PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req)
throws JsonProcessingException;
PageResult<CustomerAnalysisResp> getListPage_New(CustomerAnalysisReq req)
throws JsonProcessingException;
List<CustomerAnalysisResp> getList(CustomerAnalysisReq req);
PageResult<CustomerAnalysisResp> GetDataResult(CustomerAnalysisReq query)
throws JsonProcessingException;
List<CustomerAnalysisResp> GetDataListResult(CustomerAnalysisReq query)
throws JsonProcessingException;
CustomerAnalysisReq getReq(CustomerAnalysisReq Req);
CustomerAnalysisReq getDataWhere(CustomerAnalysisReq query);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import java.util.List;
public interface CustomerAnalysisService2 {
List<CustomerAnalysisResp> getList(CustomerAnalysisReq req);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportResp;
import java.util.List;
public interface CustomerReportService {
PageResult<CustomerReportResp> getListPage(CustomerReportReq req);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermission;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermissionPageReq;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermissionResp;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.*;
import javax.validation.*;
/**
* 报表权限(EcwReportPermission)表服务接口
*
* @author lanbm
* @since 2024-04-09 23:10:42
*/
public interface EcwReportPermissionService extends IService<EcwReportPermission> {
/**
* 创建测试
*
* @param createReq 创建信息
* @return 编号
*/
Long create(@Valid EcwReportPermission createReq);
/**
* 更新测试
*
* @param updateReq 更新信息
*/
void update(@Valid EcwReportPermission updateReq);
/**
* 删除测试
*
* @param id 编号
*/
void delete(Long id);
/**
* 获得测试
*
* @param id 编号
* @return 测试
*/
EcwReportPermission getModel(Long id);
/**
* 获得测试列表
*
* @param ids 编号
* @return 测试列表
*/
List<EcwReportPermission> getQueryList(Collection<Long> ids);
/**
* 获得测试列表, 用于 Excel 导出
*
* @param query 查询
* @return 测试列表
*/
List<EcwReportPermission> selectList(EcwReportPermission query);
/**
* 获得测试分页
*
* @param page 查询
* @return 测试分页
*/
PageResult<EcwReportPermission> getListPage(EcwReportPermissionPageReq page);
/*
自定义的分页函数 lanbm 2024-04-15 add
*/
PageResult<EcwReportPermissionResp> getListPageCustom (EcwReportPermissionPageReq page);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.*;
import javax.validation.*;
/**
* V值转换配置参数(EcwVz)表服务接口
*
* @author lanbm
* @since 2024-04-02 22:38:22
*/
public interface EcwVzService extends IService< EcwVz > {
/**
* 创建测试
* @param createReq 创建信息
* @return 编号
*/
Long create(@Valid EcwVz createReq);
/**
* 更新测试
* @param updateReq 更新信息
*/
void update(@Valid EcwVz updateReq);
/**
* 删除测试
* @param id 编号
*/
void delete(Long id);
/**
* 获得测试
* @param id 编号
* @return 测试
*/
EcwVz getModel(Long id);
/**
* 获得测试列表
* @param ids 编号
* @return 测试列表
*/
List<EcwVz> getQueryList(Collection<Long> ids);
/**
* 获得测试列表, 用于 Excel 导出
* @param query 查询
* @return 测试列表
*/
List<EcwVz> getQueryList(EcwVz query);
/**
* 获得测试分页
* @param page 查询
* @return 测试分页
*/
PageResult<EcwVz> selectPage(EcwVzPageReq page);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.module.delivery.entity.Employee;
import cn.iocoder.yudao.module.delivery.entity.EmployeePageReq;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.*;
import javax.validation.*;
/**
* (Employee)表服务接口
*
* @author lanbm
* @since 2024-03-27 21:25:56
*/
public interface EmployeeService extends IService<Employee> {
/**
* 创建测试
*
* @param createReq 创建信息
* @return 编号
*/
Long create(@Valid Employee createReq);
/**
* 更新测试
*
* @param updateReq 更新信息
*/
void update(@Valid Employee updateReq);
/**
* 删除测试
*
* @param id 编号
*/
void delete(Long id);
/**
* 获得测试
*
* @param id 编号
* @return 测试
*/
Employee getModel(Long id);
/**
* 获得测试列表
*
* @param ids 编号
* @return 测试列表
*/
List<Employee> getQueryList(Collection<Long> ids);
/**
* 获得测试列表, 用于 Excel 导出
*
* @param query 查询
* @return 测试列表
*/
List<Employee> getQueryList(Employee query);
/**
* 获得测试分页
*
* @param page 查询
* @return 测试分页
*/
PageResult<Employee> getListPage(EmployeePageReq page);
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import cn.iocoder.yudao.module.delivery.mapper.CustomerAnalysisMapper;
import cn.iocoder.yudao.module.delivery.mapper.CustomerAnalysisMapper2;
import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("CustomerAnalysisImpl2")
public class CustomerAnalysisImpl2 implements CustomerAnalysisService2 {
@Autowired
private CustomerAnalysisMapper2 customerAnalysisMapper2;
public List<CustomerAnalysisResp> getList(CustomerAnalysisReq req) {
return customerAnalysisMapper2.getListPage(req);
}
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportResp;
import cn.iocoder.yudao.module.delivery.mapper.CustomerAnalysisMapper;
import cn.iocoder.yudao.module.delivery.mapper.CustomerReportMapper;
import cn.iocoder.yudao.module.delivery.service.CustomerReportService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("CustomerReportService")
public class CustomerReportImpl implements CustomerReportService {
@Autowired
private CustomerReportMapper customerReportMapper;
public PageResult<CustomerReportResp> getListPage(CustomerReportReq req) {
IPage<CustomerReportResp> mpPage = MyBatisUtils.buildPage(req);
long total = customerReportMapper.GetCount(req);
System.out.println("符合条件的客户总数:"+String.valueOf(total));
int start = (req.getPageNo() - 1) * req.getPageSize();
int size = req.getPageSize();
req.setSize(size);
req.setStart(start);
List<CustomerReportResp> list = customerReportMapper.getListPage(req);
return new PageResult<>(list, total, mpPage.getSize(),
req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.module.delivery.entity.orderdata.view_order_businesstime;
import cn.iocoder.yudao.module.delivery.mapper.SalesReportMapper;
import cn.iocoder.yudao.module.delivery.mapper.view_order_businesstimeMapper;
import cn.iocoder.yudao.module.delivery.service.view_order_businesstimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/*
lanbm 2024-04-25 add
*/
@Service("view_order_businesstimeServiceImpl")
public class view_order_businesstimeServiceImpl implements
view_order_businesstimeService {
@Autowired
private view_order_businesstimeMapper vieworderbusinesstimeMapper;
public List<view_order_businesstime> getOrderBusinessData() {
return vieworderbusinesstimeMapper.getOrderBusinessData();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment