Commit 2d320dc2 authored by lanbaoming's avatar lanbaoming

2024-04-25

parent 7712ef74
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;
......@@ -20,6 +21,7 @@ import javax.validation.*;
import io.swagger.v3.oas.annotations.Operation;
import java.util.ArrayList;
import java.util.List;
......@@ -38,6 +40,9 @@ public class EcwReportPermissionController {
@Resource
private EcwReportPermissionService ecwReportPermissionService;
@Resource
private RedisHelper redisHelper;
private ErrorCode eCode;
/*
......@@ -111,10 +116,11 @@ public class EcwReportPermissionController {
*/
@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);
}
......@@ -170,6 +176,7 @@ public class EcwReportPermissionController {
*/
@GetMapping
public CommonResult queryAll() {
return success(this.ecwReportPermissionService.list());
}
......@@ -184,6 +191,12 @@ public class EcwReportPermissionController {
//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));
}
......
......@@ -4,9 +4,11 @@ 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.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;
......@@ -50,6 +52,8 @@ public class SalesAnalysisControl {
@GetMapping("/getListPage")
public CommonResult<PageResult<SalesAnalysisResp>> getListPage(@Valid SalesAnalysisReq query) {
System.out.println("订单分析查询条件:" + query);
/*
SalesAnalysisReq query = JSON.parseObject(JSON.toJSONString(map),
SalesAnalysisReq.class);
......@@ -77,9 +81,9 @@ public class SalesAnalysisControl {
//订单状态
r.setStatusName(map_order_status.get(r.getStatus()));
if(r.getTransportId()=="1")
if (r.getTransportId() == "1")
r.setTransportIdName("海运拼柜");
else if(r.getTransportId()=="3")
else if (r.getTransportId() == "3")
r.setTransportIdName("专线空运");
......@@ -88,13 +92,19 @@ public class SalesAnalysisControl {
return success(pageResult);
}
/*
lanbm 2024-04-24 add
*/
@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);
public void export(HttpServletResponse response,
@Valid SalesAnalysisReq Req)
throws IOException {
System.out.println("订单分析查询数据导出查询条件:" + Req);
List<SalesAnalysisExcelResp> list = salesAnalysisService.getList(Req);
ExcelUtils.write(response, "销售分析数据.xls", "销售分析数据",
SalesAnalysisExcelResp.class, 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;
private String id;
/*
客户姓名
*/
@ExcelProperty("客户姓名")
private String name;
/*
客户经理姓名
*/
@ExcelProperty("客户经理姓名")
private String salesman;
/*
客户经理所在的部门
*/
private String deptid;
/*
部门名称
*/
@ExcelProperty("客户经理部门")
private String deptname;
/*
客户经理ID
customer_service 客户表中的跟进客服
*/
private String salesmanid;
/*
总值,海运拼柜,专线空运
*/
@ExcelProperty("总V值")
private BigDecimal allsumvolume;
/*
总值同比
*/
private BigDecimal allsumvolumeTb;
/*
总V值同比显示信息
*/
@ExcelProperty("总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是老客户
*/
@ExcelProperty("客户业绩类型")
private String cusYjType;
/*
客户来源
*/
private String source;
/*
客户来源名称
*/
@ExcelProperty("客户来源")
private String sourcename;
/*
客户国家
*/
@ExcelProperty("客户国家")
private String country;
/*
客户角色
*/
private String customerrole;
/*
对应数据字典中的客户类别 type
*/
@ExcelProperty("客户角色")
private String type;
/*
客户创建日期
*/
@ExcelProperty("客户创建日期")
private String createtime;
}
......@@ -84,6 +84,14 @@ public class CustomerAnalysisReq extends PageParam {
private String searchDataType2;
private String searchDataType3;
/*
客户时间筛选条件
*/
private String searchDataType4;
private String sdate4;
private String edate4;
/*
时间筛选类型
首次成交日期,客户创建日期
......
......@@ -20,8 +20,6 @@ import java.math.BigDecimal;
@AllArgsConstructor
public class CustomerAnalysisResp {
/*
排名编号
*/
......@@ -211,6 +209,7 @@ public class CustomerAnalysisResp {
客户国家
*/
private String country;
private String countryID;
/*
......
......@@ -40,6 +40,11 @@ public class EcwReportPermission extends BaseDO {
*/
private String deptId;
/*
是否有数据导出权
*/
private int exportdataq;
......
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;
}
......@@ -17,10 +17,21 @@ 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 orderNo;
/*
提单编号
......
......@@ -74,6 +74,7 @@ public class SalesAnalysisResp {
/*
始发仓
*/
private String startwarehousename;
/*
目的国
......@@ -86,7 +87,7 @@ public class SalesAnalysisResp {
/*
目的仓
*/
private String dstwarehousename;
/*
渠道
......
......@@ -17,12 +17,6 @@ import lombok.ToString;
@ToString(callSuper = true)
public class SalesReportReq {
/*
运输方式
1 海运柜拼柜 2海运整柜 3专线空运 4海空联运
*/
//private int transportid;
/*
销售经理
*/
......@@ -36,5 +30,5 @@ public class SalesReportReq {
/*
对比年份
*/
private String duibiYear;
private String duibiYear;
}
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;
}
......@@ -3,6 +3,7 @@ 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;
......@@ -27,4 +28,6 @@ public interface CustomerAnalysisMapper {
*/
Long GetCount(CustomerAnalysisReq req);
List<CustomerAnalysisExcelResp>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.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
import cn.iocoder.yudao.module.delivery.entity.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -24,4 +22,9 @@ public interface SalesAnalysisMapper {
*/
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.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();
}
......@@ -4,12 +4,15 @@ 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);
PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req) throws JsonProcessingException;
List<CustomerAnalysisExcelResp>getList(CustomerAnalysisReq req);
}
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);
}
......@@ -5,18 +5,25 @@ 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.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp;
import cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp;
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.alibaba.fastjson.JSON;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/*
lanbm 2024-04-01 add
......@@ -28,8 +35,17 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
@Autowired
private CustomerAnalysisMapper customerAnalysisMapper;
@Resource
private RedisHelper redisHelper;
public PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req) {
public List<CustomerAnalysisExcelResp>getList(CustomerAnalysisReq req)
{
return customerAnalysisMapper.getList(req);
}
public PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req)
throws JsonProcessingException {
IPage<CustomerAnalysisResp> mpPage = MyBatisUtils.buildPage(req);
long total = customerAnalysisMapper.GetCount(req);
......@@ -40,11 +56,47 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
req.setSize(size);
req.setStart(start);
List<CustomerAnalysisResp> list = customerAnalysisMapper.getListPage(req);
List<CustomerAnalysisResp> list=null;
String sList= redisHelper.get("CustomerAnalysisRespList");
if(sList==null||sList.length()==0) {
list = customerAnalysisMapper.getListPage(req);
ObjectMapper objectMapper = new ObjectMapper();
// 将List转换为JSON字符串
String json = objectMapper.writeValueAsString(list);
redisHelper.set("CustomerAnalysisRespList", json);
}
else {
list= JSON.parseArray(sList,CustomerAnalysisResp.class);
}
list=GetPageResult(list,req.getPageNo(),req.getPageSize());
return new PageResult<>(list, total, mpPage.getSize(),
req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
private List<CustomerAnalysisResp> GetPageResult(
List<CustomerAnalysisResp> list,int pageNum,int pageSize)
{
/*
// 正序
Collections.sort(list, (a, b) -> {
return a.排序字段 - b.排序字段;
});
// 倒序
Collections.sort(list, (a, b) -> {
return b.排序字段 - a.排序字段;
});*/
// 总数
int total = list.size();
// 分页数据
List<CustomerAnalysisResp> subList =
list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
return subList;
}
}
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);
}
}
......@@ -2,9 +2,7 @@ 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.SalesAnalysisReq;
import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.mapper.SalesAnalysisMapper;
import cn.iocoder.yudao.module.delivery.service.SalesAnalysisService;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -22,6 +20,12 @@ public class SalesAnalysisImpl implements SalesAnalysisService {
@Autowired
private SalesAnalysisMapper salesAnalysisMapper;
public List<SalesAnalysisExcelResp> getList(SalesAnalysisReq req)
{
return salesAnalysisMapper.getList(req);
}
public PageResult<SalesAnalysisResp> getListPage(SalesAnalysisReq req) {
IPage<SalesAnalysisResp> mpPage = MyBatisUtils.buildPage(req);
......
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();
}
}
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;
import cn.iocoder.yudao.module.delivery.entity.*;
import java.util.List;
public interface SalesAnalysisService {
PageResult<SalesAnalysisResp> getListPage(SalesAnalysisReq page);
List<SalesAnalysisExcelResp> getList(SalesAnalysisReq req);
}
package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.module.delivery.entity.orderdata.view_order_businesstime;
import java.util.List;
/*
订单业务数据 lanbm 2024-04-25 add
*/
public interface view_order_businesstimeService {
List<view_order_businesstime> getOrderBusinessData();
}
......@@ -42,9 +42,9 @@
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(if(c.is_new = 1,c.update_time,''))as firstDate,
<!--提货率 已提货箱数除总入库总箱数-->
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and is_cargo_control=1 and
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as chargequantity,
(select sum(pick_num) from view_order_businesstime where customer_id = c.id and is_cargo_control=1 and
(select sum(pick_num) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as pickquantity,
(CASE WHEN c.is_new = 1 THEN '新客户' ELSE '旧客户' END ) as cusYjType,
(SELECT name_zh from ecw_country where deleted=0 and id=c.country) as country,
......@@ -55,7 +55,7 @@
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
<include refid="WherePage"/>
ORDER BY allsumvolume desc limit #{start}, #{size}
<!-- ORDER BY allsumvolume desc limit #{start}, #{size}-->
</select>
<sql id="WherePage">
<where>
......@@ -101,6 +101,20 @@
<if test="deptid!=null and deptid!=''">
and u_d.dept_id= #{deptid}
</if>
<if test="searchDataType4!=null and searchDataType4!=''">
<if test="sdate4!=null and sdate4!=''
and edate4!=null and edate4!=''">
<choose>
<when test="searchDataType4 =='1'">
and firstDate BETWEEN #{sdate4} AND #{edate4}
</when>
<when test="searchDataType4 =='0'">
and c.create_time BETWEEN #{sdate4} AND #{edate4}
</when>
</choose>
</if>
</if>
<!--2024-04-22
<if test="searchDataType1!=null and searchDataType1!=''
and searchDataType2!=null and searchDataType2!=''
......@@ -125,6 +139,61 @@
<include refid="WherePage"/>
</select>
<select id="getList"
parameterType="cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
resultType="cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp">
SELECT number,name,c.id,(
SELECT nickname from system_user where id=c.customer_service
) as salesman,c.customer_service as salesmanid,
(SELECT label from system_dict_data
where dict_type='customer_source' and value=c.source) as sourcename,
c.source,(u_d.dept_id) as deptid,(u_d.deptName) as deptname,
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
'${sdate}' AND '${edate}') AS allsumvolume,
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
'${sduibidate}' AND '${eduibidate}') as allsumvolumeTb,
<!--海运-->
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and transport_id=1 and
business_time BETWEEN '${sdate}' AND '${edate}') AS sumvolume1,
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and transport_id=1 and
business_time BETWEEN '${sduibidate}' AND '${eduibidate}') as sumvolumeTb1,
<!--空运-->
(select round(sum(charge_weight),2) from view_order_businesstime where customer_id = c.id and transport_id=3 and
business_time BETWEEN '${sdate}' AND '${edate}') AS sumweight3,
(select round(sum(charge_weight),2) from view_order_businesstime where customer_id = c.id and transport_id=3 and
business_time BETWEEN '${sduibidate}' AND '${eduibidate}') as sumweightTb3,
'4' as monthAvg,
'5' as monthAvgTb,
'6' as seaMonthAvg,
'7' as seaMonthAvgTb,
'8' as airMothAvg,
'9' as airMothAvgTb,
<!--重货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and order_type=2 and
business_time BETWEEN '${sdate}' AND '${edate}') as weightSumV,
<!--泡货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and order_type=3 and
business_time BETWEEN '${sdate}' AND '${edate}') as phSumV,
<!--控货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and is_cargo_control=1 and
business_time BETWEEN '${sdate}' AND '${edate}') as khSumV,
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(if(c.is_new = 1,c.update_time,''))as firstDate,
<!--提货率 已提货箱数除总入库总箱数-->
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as chargequantity,
(select sum(pick_num) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as pickquantity,
(CASE WHEN c.is_new = 1 THEN '新客户' ELSE '旧客户' END ) as cusYjType,
(SELECT name_zh from ecw_country where deleted=0 and id=c.country) as country,
c.type,
c.create_time as createtime
from ecw_customer c left join (
SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
<include refid="WherePage"/>
</select>
</mapper>
<?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.CustomerAnalysisMapper2">
<select id="getListPage"
parameterType="cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
resultType="cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp">
SELECT number,name,c.id,(
SELECT nickname from system_user where id=c.customer_service
) as salesman,c.customer_service as salesmanid,
(SELECT label from system_dict_data
where dict_type='customer_source' and value=c.source) as sourcename,
c.source,(u_d.dept_id) as deptid,(u_d.deptName) as deptname,
1 AS allsumvolume,
2 as allsumvolumeTb,
3 AS sumvolume1,
4 as sumvolumeTb1,
5 AS sumweight3,
6 as sumweightTb3,
7 as monthAvg,
8 as monthAvgTb,
9 as seaMonthAvg,
10 as seaMonthAvgTb,
11 as airMothAvg,
12 as airMothAvgTb,
13 as weightSumV,
14 as phSumV,
15 as khSumV,
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(if(c.is_new = 1,c.update_time,''))as firstDate,
16 as chargequantity,
17 as pickquantity,
(CASE WHEN c.is_new = 1 THEN '新客户' ELSE '旧客户' END ) as cusYjType,
(SELECT name_zh from ecw_country where deleted=0 and id=c.country) as country,
c.country as countryID, c.type,
c.create_time as createtime
from ecw_customer c left join (
SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
<include refid="WherePage"/>
</select>
<sql id="WherePage">
<where>
and c.deleted = 0
<if test="name!=null and name!=''">
<choose>
<when test="searchtype =='in'.toString()">
and (name like concat('%',#{name},'%') or
number like concat('%',#{name},'%'))
</when>
<when test="searchtype =='notin'.toString()">
and (name not like concat('%',#{name},'%') or
number not like concat('%',#{name},'%'))
</when>
<when test="searchtype =='eq'.toString()">
and (name= #{name} or number=#{name})
</when>
<when test="searchtype =='noeq'.toString()">
and (name != #{name} or number != #{name})
</when>
<otherwise>
and (name= #{name} or number=#{name})
</otherwise>
</choose>
</if>
<if test="isnew!=null and isnew!=''">
and is_new= #{isnew}
</if>
<if test="source!=null and source!=''">
and source= #{source}
</if>
<if test="customerrole!=null and customerrole!=''">
and type= #{customerrole}
</if>
<if test="country!=null and country!=''">
and c.country= #{country}
</if>
<if test="salesmanid!=null and salesmanid!=''">
<!--有具体的客户经理,就不算掉入公海池客户-->
and c.is_in_open_sea=0
and c.customer_service= #{salesmanid}
</if>
<if test="deptid!=null and deptid!=''">
and u_d.dept_id= #{deptid}
</if>
<if test="searchDataType4!=null and searchDataType4!=''">
<if test="sdate4!=null and sdate4!=''
and edate4!=null and edate4!=''">
<choose>
<when test="searchDataType4 =='1'">
and firstDate BETWEEN #{sdate4} AND #{edate4}
</when>
<when test="searchDataType4 =='0'">
and c.create_time BETWEEN #{sdate4} AND #{edate4}
</when>
</choose>
</if>
</if>
</where>
</sql>
<select id="GetCount" resultType="java.lang.Long">
SELECT count(1)
from ecw_customer
<include refid="WherePage"/>
</select>
</mapper>
......@@ -5,39 +5,44 @@
parameterType="cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq"
resultType="cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp">
select order_no as orderNo, tidan_no as tidanNo,
status,salesman_id as salesmanid,transport_id,marks,
channel_id as channelid,channel.name_zh as channelidName,
create_time as createtime,sum_quantity as sumquantity,
c.status,salesman_id as salesmanid,transport_id,marks,
w.start_warehouse_name as startwarehousename,
w.dst_warehouse_name as dstwarehousename,w.muDiGuo,w.muDiShi,
c.channel_id as channelid,channel.name_zh as channelidName,
c.create_time as createtime,sum_quantity as sumquantity,
sum_volume as sumvolume,sum_weight as sumweight,
is_cargo_control as iscargocontrol
from ecw_order c
left join (SELECT ewl.id AS line_id,ew_start.id AS start_warehouse_id,
left join (SELECT ewl.id AS line_id,
ew_start.id AS start_warehouse_id,
ew_dest.id AS dst_warehouse_id,ew_start.title_zh AS start_title_zh,
ew_dest.title_zh AS dst_warehouse_name,
r_dest.title_zh as muDiGuo,r_sdest.title_zh as muDiShi,
ew_start.title_zh AS start_warehouse_name FROM ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_start ON
ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
left join ecw_region r_dest on ew_dest.guojia=r_dest.id
LEFT JOIN ecw_region r_sdest on ew_dest.shi=r_sdest.id
) w ON w.line_id = c.line_id
<!--始发仓 2024-04-22-->
left join ecw_order_departure de on de.order_id = c.order_id
<!--目的仓-->
left join ecw_order_objective ob on ob.order_id = c.order_id
<!--订单关联渠道信息-->
left join ecw_channel channel on channel.channel_id =c.channel_id
<!--订单发货人信息-->
left join ecw_order_consignor nor on nor.order_id = c.order_id
<!--订单收货人信息-->
left join ecw_order_consignee nee on nee.order_id = c.order_id
<include refid="WherePage"/>
limit 1,10
ORDER BY c.create_time desc limit #{start}, #{size}
</select>
<sql id="WherePage">
<where>
and c.deleted = 0
<if test="transportId!=null and transportId!=''">
<!--运输方式查询条件-->
and c.transport_id= #{transportId}
</if>
<if test="orderNo!=null and orderNo!=''">
<!--订单编号-->
and c.order_no= #{orderNo}
</if>
</where>
</sql>
......@@ -48,6 +53,34 @@
<include refid="WherePage"/>
</select>
<select id="getList"
parameterType="cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq"
resultType="cn.iocoder.yudao.module.delivery.entity.SalesAnalysisExcelResp">
select order_no as orderNo, tidan_no as tidanNo,
c.status,salesman_id as salesmanid,transport_id,marks,
w.start_warehouse_name as startwarehousename,
w.dst_warehouse_name as dstwarehousename,w.muDiGuo,w.muDiShi,
c.channel_id as channelid,channel.name_zh as channelidName,
c.create_time as createtime,sum_quantity as sumquantity,
sum_volume as sumvolume,sum_weight as sumweight,
is_cargo_control as iscargocontrol
from ecw_order c
left join (SELECT ewl.id AS line_id,
ew_start.id AS start_warehouse_id,
ew_dest.id AS dst_warehouse_id,ew_start.title_zh AS start_title_zh,
ew_dest.title_zh AS dst_warehouse_name,
r_dest.title_zh as muDiGuo,r_sdest.title_zh as muDiShi,
ew_start.title_zh AS start_warehouse_name FROM ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON
ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
left join ecw_region r_dest on ew_dest.guojia=r_dest.id
LEFT JOIN ecw_region r_sdest on ew_dest.shi=r_sdest.id
) w ON w.line_id = c.line_id
left join ecw_channel channel on channel.channel_id =c.channel_id
<include refid="WherePage"/>
</select>
</mapper>
......
<?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.view_order_businesstimeMapper">
<select id="getOrderBusinessData"
resultType="cn.iocoder.yudao.module.delivery.entity.orderdata.view_order_businesstime">
select o.order_id AS orderid,
o.order_no AS orderno,
o.tidan_no AS tidanno,
o.transport_id AS transportid,
o.customer_id AS customerid,
o.is_cargo_control AS iscargocontrol,
o.order_type AS ordertype,
if((o.transport_id = 1), o.load_time, o.rucang_time) AS businesstime,
o.sum_num AS chargequantity,
(select sum(ecw_order_pickup.pick_num)
from ecw_order_pickup
where (ecw_order_pickup.order_id = o.order_no)) AS picknum,
o.sum_volume AS chargevolume,
o.sum_weight AS chargeweight,
if((o.transport_id = 1),
o.sum_volume, (o.sum_weight * 100)) AS vz
from ecw_order o
where o.deleted = 0
</select>
</mapper>
......@@ -444,7 +444,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
// }
paramMap.put("seaFreight", item.getOneSeaFreight() + currencyMap.get(item.getSeaFreightCurrency()) + "/m³");
if (item.getOneClearanceFreight().compareTo(BigDecimal.ZERO) == 0) {
paramMap.put("clearanceFreight", "");
//paramMap.put("clearanceFreight", "");
paramMap.put("clearanceFreight", "0" + currencyMap.get(item.getClearanceFreightCurrency()) + "/m³");
} else {
paramMap.put("clearanceFreight", item.getOneClearanceFreight() + currencyMap.get(item.getClearanceFreightCurrency()) + "/m³");
}
......
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