Commit a5c5cfda authored by lanbaoming's avatar lanbaoming

2024-04-19报表

parent b327aba2
package cn.iocoder.yudao.module.delivery.controller.admin;
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.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService;
import cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService;
import cn.iocoder.yudao.module.delivery.service.SalesReportService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.bouncycastle.ocsp.Req;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
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 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 EcwReportPermissionService ecwReportPermissionService;
/*
数据字典项
*/
@Autowired
private DictDataApi dictDataApi;
/*
计算百分比
lanbm 2024-04-10 add
*/
private String getPercentage(BigDecimal part, BigDecimal total) {
BigDecimal percentage = part.divide(total, 5,
BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
// 输出百分比
String sR = format(percentage) + "%";
return sR;
}
/*
格式化BigDecimal为字符串,保留两位小数
lanbm 2024-04-10 add
*/
private String format(BigDecimal value) {
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(2);
numberFormat.setMaximumFractionDigits(2);
return numberFormat.format(value.doubleValue());
}
private String getCurDate() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currentDate = sdf.format(date);
return currentDate;
}
private int getCurYear() {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
return year;
}
/*
获取数据查询条件
*/
private CustomerAnalysisReq getDataWhere(CustomerAnalysisReq query) {
if (query.getSearchDataType1() != null &&
query.getSearchDataType2() != null &&
query.getSearchDataType3() != null) {
}
return query;
}
/*
对查询逻辑做处理 lanbm 2024-04-16 add
*/
private CustomerAnalysisReq getReq(CustomerAnalysisReq Req) {
//计算月份差
long lc = monthDiff(Req.getSdate(), Req.getEdate());
if (lc == 0) {
lc = 1;
}
Req.setNMonth(Integer.parseInt(String.valueOf(lc)));
int y = getCurYear();
if (Req.getSdate() == null) {
Req.setCurYear(String.valueOf(y));
Req.setSdate(String.valueOf(y) + "-01-01");
if (Req.getDuibiYear() == null) {
Req.setDuibiYear(String.valueOf(y - 1));
} else {
Req.setSduibidate(Req.getDuibiYear() + "-01-01");
}
} else {
//2024-03-01
String sT = Req.getSdate();
String s = sT.substring(4, 10);
if (Req.getDuibiYear() == null) {
int nTemp = Integer.parseInt(sT.substring(0, 4)) - 1;
Req.setSduibidate(String.valueOf(nTemp) + s);
} else {
Req.setSduibidate(Req.getDuibiYear() + s);
}
Req.setCurYear(sT.substring(0, 4));
}
if (Req.getEdate() == null) {
Req.setEdate(getCurDate());
String s = Req.getEdate().substring(5, 7);
int ld = getLastDay(Integer.parseInt(Req.getDuibiYear()), Integer.parseInt(s));
Req.setEduibidate(Req.getDuibiYear() + "-" + s + "-" + String.valueOf(ld));
} else {
String sE = Req.getEdate();
String sY = sE.substring(0, 4);
//int ld = getLastDay(Integer.parseInt(sY), Integer.parseInt(s));
//2024-03-01
String s1 = sE.substring(4, 10);
if (Req.getDuibiYear() == null) {
int nTemp = Integer.parseInt(sY) - 1;
Req.setEduibidate(String.valueOf(nTemp) + s1);
} else {
Req.setEduibidate(Req.getDuibiYear() + s1);
}
}
return Req;
}
/*
获取某年某月的最后一天 lanbm 2024-04-16 add
*/
private int getLastDay(int year, int month) {
YearMonth yearMonth = YearMonth.of(year, month);
int lastDay = yearMonth.lengthOfMonth();
return lastDay;
}
/*
客户分析列表 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) {
//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);
query = getReq(query);
query = getDataWhere(query);
System.out.println("处理后的查询条件:" + query);
//把model转 JSON字符串 lanbm
//String jsonStr = JsonUtils.toJsonString(query);
//JsonUtils.SaveLog(jsonStr);
System.out.println("客户分析查询条件为:" + query);
List<DictDataRespDTO> dicCustomer_type =
dictDataApi.getDictDatas("customer_type");
Map<String, String> mapDic = new HashMap<>();
for (DictDataRespDTO d : dicCustomer_type
) {
mapDic.put(d.getValue(), d.getLabel());
}
PageResult<CustomerAnalysisResp> pageResult =
customerAnalysisService.getListPage(query);
String sTemp = "";
int nPm = query.getStart() + 1;
for (CustomerAnalysisResp r : pageResult.getList()) {
r.setPx(nPm);
nPm++;
//客户类型转换
String sType = r.getType();
if (sType == null) {
r.setCustomerrole("");
} else {
r.setCustomerrole(mapDic.get(sType));
}
if (r.getAllsumvolume() == null ||
r.getAllsumvolume().compareTo(BigDecimal.ZERO) == 0) {
r.setAllsumvolume(new BigDecimal(0));
//计算月均
r = calMonthAvg(query, r, true);
//计算总值
r = calAll(r, true);
//计算海运数据
r = cal1(query, r, true);
//计算空运数据
r = cal3(query, r, true);
//计算重货数据
r = calZH(r, true);
//计算泡货数据
r = calPH(r, true);
//计算控货数据
r = calKH(r, true);
} else {
//计算月均
r = calMonthAvg(query, r, false);
//计算总值
r = calAll(r, false);
//计算海运数据
r = cal1(query, r, false);
//计算空运数据
r = cal3(query, r, false);
//重货
r = calZH(r, false);
//计算泡货占比
r = calPH(r, false);
//计算控货占比
r = calKH(r, false);
}
r = calPick(r, false);
}
return success(pageResult);
/*
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
System.out.println("当前用户ID:" + loginUserId.toString());
System.out.println(map);
CustomerAnalysisReq Req = JSON.parseObject(JSON.toJSONString(map),
CustomerAnalysisReq.class);
System.out.println(Req);
*/
//客户来源
/*
List<DictDataRespDTO> dicCustomer_source =
dictDataApi.getDictDatas("customer_source");
*/
}
private CustomerAnalysisResp calMonthAvg(CustomerAnalysisReq query,
CustomerAnalysisResp r, boolean bZzNull) {
String sTemp = "";
if (bZzNull == true) {
r.setAllsumvolume(new BigDecimal(0));
r.setMonthAvg("0");
} else {
r.setMonthAvg(r.getAllsumvolume().divide(
new BigDecimal(query.getNMonth()), 2,
BigDecimal.ROUND_HALF_UP).toString());
}
//计算同比
if (r.getAllsumvolumeTb() == null ||
r.getAllsumvolumeTb().compareTo(BigDecimal.ZERO) == 0) {
r.setMonthAvgTbShow("同期值为0");
} else {
sTemp = getPercentage(
(r.getAllsumvolume().subtract(r.getAllsumvolumeTb())),
r.getAllsumvolumeTb());
r.setMonthAvgTbShow(sTemp);
}
return r;
}
/*
总值计算
*/
private CustomerAnalysisResp calAll(CustomerAnalysisResp r, boolean bZzNull) {
String sTemp = "";
if (bZzNull == true) {
r.setAllsumvolume(new BigDecimal(0));
}
if (r.getAllsumvolumeTb() == null ||
r.getAllsumvolumeTb().compareTo(BigDecimal.ZERO) == 0) {
r.setAllsumvolumeTbShow("同期V值为0");
} else {
//(本期-同期)/同期
sTemp = getPercentage(
(r.getAllsumvolume().subtract(r.getAllsumvolumeTb())),
r.getAllsumvolumeTb());
r.setAllsumvolumeTbShow(sTemp);
}
return r;
}
/*
计算提货数据
*/
private CustomerAnalysisResp calPick(CustomerAnalysisResp r, boolean bZzNull) {
if (r.getChargequantity() == 0) {
r.setThL("总箱数为0");
} else {
r.setThL(getIntPercentage(r.getPickquantity(), r.getChargequantity()));
}
return r;
}
/*
处理海运数据
*/
private CustomerAnalysisResp cal1(CustomerAnalysisReq query,
CustomerAnalysisResp r, boolean bZzNull) {
String sTemp = "";
if (bZzNull == true) {
r.setAllsumvolume(new BigDecimal(0));
}
if (r.getSumvolume1() == null ||
r.getSumvolume1().compareTo(BigDecimal.ZERO) == 0) {
//海运V值
r.setSumvolumeV1(new BigDecimal(0));
//海运体积数
r.setSumvolume1(new BigDecimal(0));
if (bZzNull == true) {
r.setSeaZb("总值为0");
//海运月均
r.setSeaMonthAvg("总值为0");
} else {
//海运占比
r.setSeaZb("0");
//海运月均
r.setSeaMonthAvg("0");
}
} else {
//设置海运V值
r.setSumvolumeV1(r.getSumvolume1());
if (bZzNull == true) {
r.setSeaZb("总值为0");
} else {
r.setSeaZb(getPercentage(r.getSumvolumeV1(), r.getAllsumvolume()));
}
//月均V值 是体积
r.setSeaMonthAvg(r.getSumvolume1().divide(new BigDecimal(query.getNMonth()), 2,
BigDecimal.ROUND_HALF_UP).toString());
}
if (r.getSumvolumeTb1() == null ||
r.getSumvolumeTb1().compareTo(BigDecimal.ZERO) == 0) {
r.setSumvolumeTbV1(new BigDecimal(0));
r.setSumvolumeTbShow1("同期为0");
} else {
r.setSumvolumeTbV1(new BigDecimal(100).multiply(r.getSumvolumeTb1()));
sTemp = getPercentage(
(r.getSumvolumeV1().subtract(r.getSumvolumeTbV1())),
r.getSumvolumeTbV1());
r.setSumvolumeTbShow1(sTemp);
}
return r;
}
/*
处理空运数据
*/
private CustomerAnalysisResp cal3(CustomerAnalysisReq query, CustomerAnalysisResp r, boolean bZzNull) {
String sTemp = "";
if (bZzNull == true) {
r.setAllsumvolume(new BigDecimal(0));
}
//当期值
if (r.getSumweight3() == null ||
r.getSumweight3().compareTo(BigDecimal.ZERO) == 0) {
r.setSumweightV3(new BigDecimal(0));
r.setSumweight3(new BigDecimal(0));
if (bZzNull == true) {
r.setAirZb("总值为0");
r.setAirMothAvg("总值为0");
} else {
r.setAirZb("0");
r.setAirMothAvg("0");
}
} else {
r.setSumweightV3(r.getSumweight3().multiply(new BigDecimal(100)));
if (bZzNull == true) {
r.setAirZb("总值为0");
} else {
r.setAirZb(getPercentage(r.getSumweightV3(), r.getAllsumvolume()));
}
//月均是 重量
r.setAirMothAvg(r.getSumweight3().divide(new BigDecimal(query.getNMonth()), 2,
BigDecimal.ROUND_HALF_UP).toString());
}
//同期值
if (r.getSumweightTb3() == null ||
r.getSumweightTb3().compareTo(BigDecimal.ZERO) == 0) {
r.setSumweightTb3(new BigDecimal(0));
r.setSumweightTbV3(new BigDecimal(0));
r.setSumweightTbShow3("同期值为0");
} else {
r.setSumweightTbV3(r.getSumweightTb3().multiply(new BigDecimal(100)));
sTemp = getPercentage(
(r.getSumweightV3().subtract(r.getSumweightTbV3())),
r.getSumweightTbV3());
r.setSumweightTbShow3(sTemp);
}
return r;
}
/*
计算重货数据
*/
private CustomerAnalysisResp calZH(CustomerAnalysisResp r, boolean bZzNull) {
if (bZzNull == true) {
//总值为0的情况
r.setAllsumvolume(new BigDecimal(0));
}
//重货 占比
if (r.getWeightSumV() == null ||
r.getWeightSumV().compareTo(BigDecimal.ZERO) == 0) {
r.setWeightSumV(new BigDecimal(0));
if (bZzNull == true) {
r.setWeithtSumZb("总值为0");
} else {
r.setWeithtSumZb("0");
}
} else {
r.setWeithtSumZb(getPercentage(r.getWeightSumV(), r.getAllsumvolume()));
}
return r;
}
/*
计算泡货数据
*/
private CustomerAnalysisResp calPH(CustomerAnalysisResp r, boolean bZzNull) {
if (bZzNull == true) {
//泡货 占比
r.setAllsumvolume(new BigDecimal(0));
}
if (r.getPhSumV() == null ||
r.getPhSumV().compareTo(BigDecimal.ZERO) == 0) {
r.setPhSumV(new BigDecimal(0));
if (bZzNull == true) {
r.setPhSumZb("总值为0");
} else {
r.setPhSumZb("0");
}
} else {
r.setPhSumZb(getPercentage(r.getPhSumV(), r.getAllsumvolume()));
}
return r;
}
/*
计算控货数据
*/
private CustomerAnalysisResp calKH(CustomerAnalysisResp r, boolean bZzNull) {
if (bZzNull == true) {
//控货 占比
r.setAllsumvolume(new BigDecimal(0));
}
if (r.getKhSumV() == null ||
r.getKhSumV().compareTo(BigDecimal.ZERO) == 0) {
r.setKhSumV(new BigDecimal(0));
if (bZzNull == true) {
r.setKhSumZb("总值为0");
} else {
r.setKhSumZb("0");
}
} else {
r.setKhSumZb(getPercentage(r.getKhSumV(),
r.getAllsumvolume()));
}
return r;
}
private String getIntPercentage(int number, int divisor) {
// 计算百分比
double percentage = number / (double) divisor;
// 格式化输出百分比
String formatted = String.format("%.2f%%", percentage);
return formatted;
}
private int monthDiff(String dateString1, String dateString2) {
// 将字符串转换为 LocalDate 对象
LocalDate date1 = LocalDate.parse(dateString1);
LocalDate date2 = LocalDate.parse(dateString2);
// 获软时间1的年份和月份
int year1 = date1.getYear();
int month1 = date1.getMonthValue();
// 获取时间2的年份和月份
int year2 = date2.getYear();
int month2 = date2.getMonthValue();
// 计算时间1的总月数
int totalMonths1 = year1 * 12 + month1;
// 计算时间2的总月数
int totalMonths2 = year2 * 12 + month2;
// 计算总月数差
int monthsDiff = totalMonths2 - totalMonths1;
return monthsDiff;
}
@PostMapping("/exportExcel")
@ApiOperation("导出客户分析数据")
@OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Valid CustomerAnalysisReq Req) throws IOException {
// List<DictDataDO> list = dictDataService.getDictDatas(reqVO);
//List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
// 输出
//ExcelUtils.write(response, "客户分析数据.xls", "客户分析数据列表", DictDataExcelVO.class, data);
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
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.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
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.CustomerAnalysisService;
import cn.iocoder.yudao.module.delivery.service.CustomerReportService;
import cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.YearMonth;
import java.util.*;
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;
/**
* (CustomerReport)客户看板报表
*
* @author lanbm
* @since 2024-03-27
*/
@RestController
@RequestMapping("/Report/CustomerReport")
public class CustomerReportControl {
@Autowired
private CustomerReportService customerReportService;
//报表权限信息
@Resource
private EcwReportPermissionService ecwReportPermissionService;
private String getCurDate() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currentDate = sdf.format(date);
return currentDate;
}
private int getCurYear() {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
return year;
}
/*
获取某年某月的最后一天 lanbm 2024-04-16 add
*/
private int getLastDay(int year, int month) {
YearMonth yearMonth = YearMonth.of(year, month);
int lastDay = yearMonth.lengthOfMonth();
return lastDay;
}
private CustomerReportReq getReq(CustomerReportReq Req) {
int y = getCurYear();
if (Req.getDuibiYear() == null) {
Req.setDuibiYear(String.valueOf(y - 1));
}
if (Req.getSDate() == null) {
Req.setCurYear(String.valueOf(y));
Req.setSDate(String.valueOf(y) + "-01-01");
Req.setSDuiBiDate(Req.getDuibiYear() + "-01-01");
} else {
//2024-03
String sT = Req.getSDate();
Req.setSDate(sT + "-01");
String s = sT.substring(5, 7);
Req.setSDuiBiDate(Req.getDuibiYear() + "-" + s + "-01");
Req.setCurYear(sT.substring(0, 4));
}
if (Req.getEDate() == null) {
Req.setEDate(getCurDate());
String s = Req.getEDate().substring(5, 7);
int lastDay = getLastDay(Integer.parseInt(Req.getDuibiYear()), Integer.parseInt(s));
Req.setEDuiBiDate(Req.getDuibiYear() + "-" + s + "-" + String.valueOf(lastDay));
} else {
String sE = Req.getEDate();
String sY = sE.substring(0, 4);
String s = sE.substring(5, 7);
int lastDay = getLastDay(Integer.parseInt(sY), Integer.parseInt(s));
Req.setEDate(sE + "-" + String.valueOf(lastDay));
lastDay = getLastDay(Integer.parseInt(Req.getDuibiYear()), Integer.parseInt(s));
Req.setEDuiBiDate(Req.getDuibiYear() + "-" + s + "-" + String.valueOf(lastDay));
}
return Req;
}
/*
计算百分比
lanbm 2024-04-10 add
*/
private String getPercentage(BigDecimal part, BigDecimal total) {
BigDecimal percentage = part.divide(total, 2,
BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
// 输出百分比
String sR = format(percentage) + "%";
return sR;
}
/*
格式化BigDecimal为字符串,保留两位小数
lanbm 2024-04-10 add
*/
private String format(BigDecimal value) {
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(2);
numberFormat.setMaximumFractionDigits(2);
return numberFormat.format(value.doubleValue());
}
/*
客户分析列表 lanbm 2024-04-02 add
xml动态查询参考网址
https://blog.csdn.net/CYK_byte/article/details/128611104
*/
@PostMapping("/getPageList")
public CommonResult<CustomerReportBar> getListPage(@Valid @RequestBody Map map) {
//department 部门查询条件是客户经理所在的部门,
//客户信息中有个 department 字段,但这个值都是空的
System.out.println(map);
//map转model对象
CustomerReportReq Req = JSON.parseObject(JSON.toJSONString(map), CustomerReportReq.class);
Req = getReq(Req);
System.out.println("查询参数为:" + Req);
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(2024041506,
"当前用户未分配报表权限,请联系系统管理员处理。");
return error(eCode);
}
//把model转 JSON字符串 lanbm
//String jsonStr = JsonUtils.toJsonString(Req);
//JsonUtils.SaveLog(jsonStr);
CustomerReportBar customerReportBar = new CustomerReportBar();
PageResult<CustomerReportResp> pageResult =
customerReportService.getListPage(Req);
customerReportBar.setTotal(pageResult.getTotal());
List<CustomerReportResp> lis = pageResult.getList();
yAxis y = new yAxis();
y.setType("category");
y.setInverse(true);
List<String> l = new ArrayList<>();
for (CustomerReportResp cr : lis) {
l.add(cr.getName());
cr.setDuibiYear(Req.getDuibiYear());
}
y.setData(l);
customerReportBar.setObjyAxis(y);
List<series> sl = new ArrayList<>();
series s1 = new series();
s1.setName(Req.getCurYear());
s1.setType("bar");
s1.setBarGap("60%");
s1.setBarCategoryGap("60%");
s1.setMyTip("12");
List<String> s1L = new ArrayList<>();
for (CustomerReportResp cr : lis) {
if (cr.getSumvolume1() == null) cr.setSumvolume1(BigDecimal.valueOf(0));
if (cr.getSumweight3() == null) cr.setSumweight3(BigDecimal.valueOf(0));
cr.setAllsumvolume(cr.getSumvolume1().add(cr.getSumweight3()));
if (cr.getAllsumvolume() == null) {
s1L.add("0");
} else {
s1L.add(cr.getAllsumvolume().toString());
}
if (cr.getAllsumvolumeTb() == null || cr.getAllsumvolumeTb().compareTo(BigDecimal.ZERO) == 0) {
cr.setAllsumvolumeTbMsg("同期值为0");
}
else
{
//本期减同期 除 同期
String sS=getPercentage((cr.getAllsumvolume().subtract(cr.getAllsumvolumeTb())),
cr.getAllsumvolumeTb());
cr.setAllsumvolumeTbMsg(sS);
}
}
s1.setData(s1L);
sl.add(s1);
//对比数据
/*
series s2 = new series();
s2.setName(Req.getDuibiYear());
s2.setType("bar");
s2.setBarGap("60%");
s2.setBarCategoryGap("60%");
List<String> s2L = new ArrayList<>();
for (CustomerReportResp cr : lis) {
if (cr.getAllsumvolumeTb() == null) {
s2L.add("0");
} else {
s2L.add(cr.getAllsumvolumeTb().toString());
}
}
s2.setData(s2L);
sl.add(s2);*/
customerReportBar.setObSseries(sl);
customerReportBar.setResultList(lis);
return success(customerReportBar);
}
@PostMapping("/getBarData")
public CommonResult<CustomerReportBar>
getBarData(@RequestBody CustomerReportReq Req) {
CustomerReportBar customerReportBar = new CustomerReportBar();
yAxis y = new yAxis();
y.setType("category");
List<String> l = new ArrayList<>();
l.add("湖北");
l.add("湖南");
l.add("广东");
y.setData(l);
customerReportBar.setObjyAxis(y);
List<series> sl = new ArrayList<>();
series s1 = new series();
s1.setName("2024");
s1.setType("bar");
List<String> s1L = new ArrayList<>();
s1L.add("12");
s1L.add("15");
s1L.add("20");
s1.setData(s1L);
sl.add(s1);
series s2 = new series();
s2.setName("2023");
s2.setType("bar");
List<String> s2L = new ArrayList<>();
s2L.add("40");
s2L.add("50");
s2L.add("60");
s2.setData(s2L);
sl.add(s2);
customerReportBar.setObSseries(sl);
return success(customerReportBar);
}
@PostMapping("/exportExcel")
@ApiOperation("导出客户看板数据")
@OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Valid CustomerReportReq Req) throws IOException {
// List<DictDataDO> list = dictDataService.getDictDatas(reqVO);
//List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
// 输出
//ExcelUtils.write(response, "客户分析数据.xls", "客户分析数据列表", DictDataExcelVO.class, data);
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
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.List;
/**
* 报表权限(EcwReportPermission)表控制层
*
* @author lanbm
* @since 2024-04-09 23:10:39
*/
@RestController
@RequestMapping("/Report/EcwReportPermission")
public class EcwReportPermissionController {
/**
* 服务对象
*/
@Resource
private EcwReportPermissionService ecwReportPermissionService;
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
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.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
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 io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
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;
/*
客户分析列表 lanbm 2024-04-02 add
*/
@PostMapping("/getListPage")
public CommonResult<PageResult<SalesAnalysisResp>> getListPage(@RequestBody SalesAnalysisReq Req) {
PageResult<SalesAnalysisResp> pageResult=
salesAnalysisService.getListPage(Req);
return success(pageResult);
}
@GetMapping("/exportExcel")
@ApiOperation("导出销售分析数据")
@OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Valid CustomerAnalysisReq Req) throws IOException {
// List<DictDataDO> list = dictDataService.getDictDatas(reqVO);
//List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
// 输出
//ExcelUtils.write(response, "客户分析数据.xls", "客户分析数据列表", DictDataExcelVO.class, data);
}
}
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
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);
}
}
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.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 io.swagger.annotations.Api;
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.List;
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;
@GetMapping("/getDeptChild")
@Operation(summary = "根据父机部门获取子部门")
public CommonResult<List<DeptEx>> getDeptChild(@Valid DeptEx Req) {
return success(deptExMapper.getDeptChild(Req));
}
}
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.bouncycastle.crypto.tls.SRTPProtectionProfile;
/*
客户分析报表
逻辑数据大部分集中在表 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 int isnew;
/*
客户国家
*/
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 String customerrole;
/*
数据筛选类型
*/
private String searchDataType1;
private String searchDataType2;
private String searchDataType3;
/*
时间筛选类型
首次成交日期,客户创建日期
*/
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 String seaMonthAvgTb;
/*
空运月均重量
*/
private String airMothAvg;
/*
空运月均同比
*/
private String airMothAvgTb;
/*
重货总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 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;
}
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;
/*
lanbm 2024-03-31 add
*/
public class SalesAnalysisReq {
/*
订单编号
*/
private String orderNo;
/*
提单编号
*/
private String tidanNo;
/*
销售经理
*/
private String salesmanId;
/*
部门ID
*/
private String deptId;
/*
唛头
*/
private String marks;
/*
是否控货
*/
private int isCargoControl;
}
package cn.iocoder.yudao.module.delivery.entity;
/*
销售分析查询结果 lanbm 2024-04-02
*/
public class SalesAnalysisResp {
/*
订单编号
*/
private String orderNo;
/*
提单号
*/
private String tidanNo;
/*
订单发货人编号
*/
private String orderConsignorName;
/*
订单发货人客户ID,用户链接
*/
private String orderConsignorCusId;
/*
订单收货人名称
*/
private String orderConsigneeName;
/*
订单收货人客户编号,用于链接
*/
private String orderConsigneeCusId;
/*
客户经理
*/
/*
订单状态
*/
private String status;
/*
运输方式
*/
private String transportId;
/*
始发仓
*/
/*
目的国
*/
/*
目的城市
*/
/*
目的仓
*/
/*
渠道
*/
/*
唛头
*/
private String marks;
/*
是否控货
*/
private String isCargoControl;
/*
创建时间
*/
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.EqualsAndHashCode;
import lombok.ToString;
/*
销售看板查询请求参数
逻辑数据大部分集中在表 ecw_order
lanbm 2024-03-31 add
*/
@Schema(description = "管理后台-销售看板查询参数")
@Data
@ToString(callSuper = true)
public class SalesReportReq {
/*
运输方式
1 海运柜拼柜 2海运整柜 3专线空运 4海空联运
*/
//private int transportid;
/*
销售经理
*/
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;
}
\ No newline at end of file
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 String id;
private String name;
private String parentId;
}
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.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.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);
/*
获取查询条件的总数
*/
Long GetCount(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.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
import org.apache.ibatis.annotations.Mapper;
/**
* (SalesAnalysis)销售分析
*
* @author lanbm
* @since 2024-04-01
*/
@Mapper
public interface SalesAnalysisMapper {
PageResult<SalesAnalysisResp> getListPage(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.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 java.util.List;
public interface CustomerAnalysisService {
PageResult<CustomerAnalysisResp> getListPage(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.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportReq;
import cn.iocoder.yudao.module.delivery.mapper.CustomerAnalysisMapper;
import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService;
import cn.iocoder.yudao.module.delivery.service.CustomerReportService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/*
lanbm 2024-04-01 add
客户分析列表
*/
@Service("CustomerAnalysisService")
public class CustomerAnalysisImpl implements CustomerAnalysisService {
@Autowired
private CustomerAnalysisMapper customerAnalysisMapper;
public PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req) {
IPage<CustomerAnalysisResp> mpPage = MyBatisUtils.buildPage(req);
long total = customerAnalysisMapper.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<CustomerAnalysisResp> list = customerAnalysisMapper.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.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.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermissionResp;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermission;
import cn.iocoder.yudao.module.delivery.entity.EcwReportPermissionPageReq;
import cn.iocoder.yudao.module.delivery.mapper.EcwReportPermissionMapper;
import cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import javax.validation.Valid;
/**
* 报表权限(EcwReportPermission)表服务实现类
*
* @author lanbm
* @since 2024-04-09 23:10:41
*/
@Service("ecwReportPermissionService")
public class EcwReportPermissionServiceImpl extends ServiceImpl<EcwReportPermissionMapper, EcwReportPermission> implements EcwReportPermissionService {
@Autowired
private EcwReportPermissionMapper ecwReportPermissionMapper;
/**
* 创建测试
*
* @param createReq 创建信息
* @return 编号
*/
public Long create(@Valid EcwReportPermission createReq) {
ecwReportPermissionMapper.insert(createReq);
return createReq.getId();
}
/**
* 更新测试
*
* @param updateReq 更新信息
*/
public void update(@Valid EcwReportPermission updateReq) {
ecwReportPermissionMapper.updateById(updateReq);
}
/**
* 物理删除记录,避免表存在无用的记录,影响查询效率
*
* @param id 编号
*/
public void delete(Long id) {
ecwReportPermissionMapper.deleteById2(id);
}
/**
* 获得测试
*
* @param id 编号
* @return 测试
*/
public EcwReportPermission getModel(Long id) {
return ecwReportPermissionMapper.selectById(id);
}
/**
* 获得测试列表
*
* @param ids 编号
* @return 测试列表
*/
public List<EcwReportPermission> getQueryList(Collection<Long> ids) {
return ecwReportPermissionMapper.selectBatchIds(ids);
}
/**
* 获得测试列表, 用于 Excel 导出
*
* @param query 查询
* @return 列表
*/
public List<EcwReportPermission> selectList(EcwReportPermission query) {
return ecwReportPermissionMapper.selectList(query);
}
/**
* 获得测试分页
*
* @param page 分页查询
* @param page 查询
* @return 分页列表
*/
public PageResult<EcwReportPermission> getListPage(EcwReportPermissionPageReq page) {
return ecwReportPermissionMapper.selectPage(page);
}
/*
自定义的分页函数 lanbm 2024-04-15 add
*/
public PageResult<EcwReportPermissionResp> getListPageCustom(EcwReportPermissionPageReq page) {
IPage<EcwReportPermission> mpPage = MyBatisUtils.buildPage(page);
long total = ecwReportPermissionMapper.GetCount(page);
int start = (page.getPageNo() - 1) * page.getPageSize();
int size = page.getPageSize();
page.setSize(size);
page.setStart(start);
List<EcwReportPermissionResp> list =
ecwReportPermissionMapper.getListPageCustom(page);
return new PageResult<>(list, total, mpPage.getSize(),
page.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.mapper.EcwVzMapper;
import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import javax.validation.Valid;
/**
* V值转换配置参数(EcwVz)表服务实现类
*
* @author lanbm
* @since 2024-04-02 22:38:22
*/
@Service("ecwVzService")
public class EcwVzServiceImpl extends ServiceImpl<EcwVzMapper,EcwVz> implements EcwVzService {
@Autowired
private EcwVzMapper ecwVzMapper;
/**
* 创建测试
* @param createReq 创建信息
* @return 编号
*/
public Long create(@Valid EcwVz createReq)
{
ecwVzMapper.insert(createReq);
return createReq.getId();
}
/**
* 更新测试
* @param updateReq 更新信息
*/
public void update(@Valid EcwVz updateReq)
{
ecwVzMapper.updateById(updateReq);
}
/**
* 删除测试
* @param id 编号
*/
public void delete(Long id)
{
ecwVzMapper.deleteById2(id);
}
/**
* 获得测试
* @param id 编号
* @return 测试
*/
public EcwVz getModel(Long id)
{
return ecwVzMapper.selectById(id);
}
/**
* 获得测试列表
* @param ids 编号
* @return 测试列表
*/
public List<EcwVz> getQueryList(Collection<Long> ids)
{
return ecwVzMapper. selectBatchIds(ids);
}
/**
* 获得测试列表, 用于 Excel 导出
* @param query 查询
* @return 列表
*/
public List<EcwVz> getQueryList(EcwVz query)
{
return ecwVzMapper. selectList(query);
}
/**
* 获得测试分页
* @param page 分页查询
* @param page 查询
* @return 分页列表
*/
public PageResult<EcwVz> selectPage(EcwVzPageReq page)
{
return ecwVzMapper.selectPage(page);
}
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.Employee;
import cn.iocoder.yudao.module.delivery.entity.EmployeePageReq;
import cn.iocoder.yudao.module.delivery.mapper.EmployeeMapper;
import cn.iocoder.yudao.module.delivery.service.EmployeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import javax.validation.Valid;
/**
* (Employee)表服务实现类
*
* @author lanbm
* @since 2024-03-27 21:25:56
*/
@Service("employeeService")
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {
@Autowired
private EmployeeMapper employeeMapper;
/**
* 创建测试
*
* @param createReq 创建信息
* @return 编号
*/
public Long create(@Valid Employee createReq) {
employeeMapper.insert(createReq);
return createReq.getId();
}
/**
* 更新测试
*
* @param updateReq 更新信息
*/
public void update(@Valid Employee updateReq) {
employeeMapper.updateById(updateReq);
}
/**
* 删除测试
*
* @param id 编号
*/
public void delete(Long id) {
employeeMapper.deleteById(id);
}
/**
* 获得测试
*
* @param id 编号
* @return 测试
*/
public Employee getModel(Long id) {
return employeeMapper.selectById(id);
}
/**
* 获得测试列表
*
* @param ids 编号
* @return 测试列表
*/
public List<Employee> getQueryList(Collection<Long> ids) {
return employeeMapper.selectBatchIds(ids);
}
/**
* 获得测试列表, 用于 Excel 导出
*
* @param query 查询
* @return 列表
*/
public List<Employee> getQueryList(Employee query) {
return employeeMapper.selectList(query);
}
/**
* 获得测试分页
*
* @param page 分页查询
* @param page 查询
* @return 分页列表
*/
public PageResult<Employee> getListPage(EmployeePageReq page) {
return employeeMapper.selectPage(page);
}
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
import cn.iocoder.yudao.module.delivery.mapper.SalesAnalysisMapper;
import cn.iocoder.yudao.module.delivery.service.SalesAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/*
lanbm 2024-04-01
*/
@Service("SalesAnalysisService")
public class SalesAnalysisImpl implements SalesAnalysisService {
@Autowired
private SalesAnalysisMapper salesAnalysisMapper;
public PageResult<SalesAnalysisResp> getListPage(SalesAnalysisReq page) {
return null;
}
}
package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import cn.iocoder.yudao.module.delivery.mapper.EmployeeMapper;
import cn.iocoder.yudao.module.delivery.mapper.SalesReportMapper;
import cn.iocoder.yudao.module.delivery.service.SalesReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/*
销售看板统计报表
lanbm 2024-04-01 add
*/
@Service("SalesReportService")
public class SalesReportImpl implements SalesReportService {
@Autowired
private SalesReportMapper salesReportMapper;
public SalesReportResp SalesReportCount(SalesReportReq Req) {
return salesReportMapper.SalesReportCount(Req);
}
public int FirstCustomerCount(SalesReportReq Req) {
return salesReportMapper.FirstCustomerCount(Req);
}
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
public interface SalesAnalysisService {
PageResult<SalesAnalysisResp> getListPage(SalesAnalysisReq page);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
public interface SalesReportService {
SalesReportResp SalesReportCount(SalesReportReq Req);
int FirstCustomerCount(SalesReportReq Req);
}
<?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="cn.iocoder.yudao.module.delivery.mapper.DeptExMapper">
<select id="getDeptChild"
resultType="cn.iocoder.yudao.module.delivery.entity.deptex.DeptEx">
WITH RECURSIVE recursion (id, name, parent_id, sort) AS (
SELECT T1.id,
T1.name,
T1.parent_id,
T1.sort
FROM system_dept T1
WHERE T1.id = 123
UNION ALL
SELECT T2.id,
T2.name,
T2.parent_id,
T2.sort
FROM system_dept T2,
recursion T3
WHERE T2.parent_id = T3.id
)
SELECT T.id,
T.name,
T.parent_id
FROM system_dept T
ORDER BY sort asc;
</select>
</mapper>
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