Commit 4cb06535 authored by honghy's avatar honghy Committed by wux

需求95 报价单页面和列表调整

parent 7173ecb6
ALTER TABLE ecw_offer
ADD sale_stage tinyint comment '销售阶段',
ADD customer_status tinyint comment '客户状态',
ADD cargo_status tinyint comment '货物状态',
ADD inquiry_source tinyint comment '询盘来源',
ADD manufacturer VARCHAR(255) comment '厂家',
ADD manufacturer_phone VARCHAR(255) comment '厂家电话',
ADD reason_dict tinyint comment '原因数据字典',
ADD estimated_shipping_time datetime comment '预计发货时间';
INSERT INTO `jiedao`.`system_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('客户状态', 'ecw_offer_customer_status', 0, NULL, '1', '2025-02-11 10:08:50', '1', '2025-02-11 10:08:50', b'0');
INSERT INTO `jiedao`.`system_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('货物状态', 'ecw_offer_cargo_status', 0, NULL, '1', '2025-02-11 10:08:50', '1', '2025-02-11 10:08:50', b'0');
INSERT INTO `jiedao`.`system_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('询盘来源', 'ecw_offer_inquiry_source', 0, NULL, '1', '2025-02-11 10:08:50', '1', '2025-02-11 10:08:50', b'0');
INSERT INTO `jiedao`.`system_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('输单原因', 'ecw_offer_reason_dict', 0, NULL, '1', '2025-02-11 10:08:50', '1', '2025-02-11 10:08:50', b'0');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (3, '关系(指定)', '3', 'ecw_offer_reason_dict', 0, 'default', '', NULL, '2741', '2025-02-11 16:31:08', '2741', '2025-02-11 16:31:08', b'0', 'Specified Relationship', 'Relation Spécifiée');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (2, '服务', '2', 'ecw_offer_reason_dict', 0, 'default', '', NULL, '2741', '2025-02-11 16:30:46', '2741', '2025-02-11 16:30:46', b'0', 'Service', 'Service');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (1, '价格', '1', 'ecw_offer_reason_dict', 0, 'default', '', NULL, '2741', '2025-02-11 16:30:12', '2741', '2025-02-11 16:30:12', b'0', 'Price', 'Prix');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (6, '目的港线索', '6', 'ecw_offer_inquiry_source', 0, 'default', '', NULL, '2741', '2025-02-11 16:12:52', '2741', '2025-02-11 16:12:52', b'0', 'Destination Port Leads', 'Pistes du Port de Destination');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (5, '公海(注意下掉时间)', '5', 'ecw_offer_inquiry_source', 0, 'default', '', NULL, '2741', '2025-02-11 16:12:27', '2741', '2025-02-11 16:12:27', b'0', 'Open Sea (Note the Drop Time)', 'Mer Ouverte (Notez le Temps de Chute)');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (4, '市场部', '4', 'ecw_offer_inquiry_source', 0, 'default', '', NULL, '2741', '2025-02-11 16:12:00', '2741', '2025-02-11 16:12:00', b'0', 'Marketing Department', 'Département Marketing');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (3, '收货人推荐', '3', 'ecw_offer_inquiry_source', 0, 'default', '', NULL, '2741', '2025-02-11 16:11:25', '2741', '2025-02-11 16:11:25', b'0', 'Consignee Recommendation', 'Recommandation de Destinataire');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (2, '发货人推荐', '2', 'ecw_offer_inquiry_source', 0, 'default', '', NULL, '2741', '2025-02-11 16:10:58', '2741', '2025-02-11 16:10:58', b'0', 'Shipper Recommendation', 'Recommandation d\'Expéditeur');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (1, '成交客户复购', '1', 'ecw_offer_inquiry_source', 0, 'default', '', NULL, '2741', '2025-02-11 16:07:14', '2741', '2025-02-11 16:07:14', b'0', 'Repeat Purchase by Closed Customers', 'Achat Répété par Clients Fermés');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (4, '货好,尾款已付', '4', 'ecw_offer_cargo_status', 0, 'default', '', NULL, '2741', '2025-02-11 16:01:33', '2741', '2025-02-11 16:01:33', b'0', 'Goods ready, final payment made', 'Marchandises prêtes, paiement final effectué');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (3, '货好,未付尾款', '3', 'ecw_offer_cargo_status', 0, 'default', '', NULL, '2741', '2025-02-11 16:01:06', '2741', '2025-02-11 16:01:06', b'0', 'Goods ready, final payment not made', 'Marchandises prêtes, paiement final non effectué');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (2, '已下订金,货物生产中', '2', 'ecw_offer_cargo_status', 0, 'default', '', NULL, '2741', '2025-02-11 16:00:43', '2741', '2025-02-11 16:00:43', b'0', 'Deposit paid, goods in production', 'Acompte versé, production en cours');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (1, '未向工厂下单', '1', 'ecw_offer_cargo_status', 0, 'default', '', NULL, '2741', '2025-02-11 16:00:19', '2741', '2025-02-11 16:00:19', b'0', 'Order not placed with the factory', 'Commande non passée à l\'usine');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (6, '回访', '6', 'ecw_offer_customer_status', 0, 'default', '', NULL, '2741', '2025-02-11 15:57:13', '2741', '2025-02-11 15:57:13', b'0', 'Follow-up Visit', 'Visite de Suivi');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (5, '增量', '5', 'ecw_offer_customer_status', 0, 'default', '', NULL, '2741', '2025-02-11 15:56:52', '2741', '2025-02-11 15:56:52', b'0', 'Increment', 'Incrément');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (4, '流失', '4', 'ecw_offer_customer_status', 0, 'default', '', NULL, '2741', '2025-02-11 15:54:07', '2741', '2025-02-11 15:54:07', b'0', 'Loss', 'Perte');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (3, '轻货', '3', 'ecw_offer_customer_status', 0, 'default', '', NULL, '2741', '2025-02-11 15:52:32', '2741', '2025-02-11 15:52:32', b'0', 'Light Cargo', 'Marchandises Légères');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (2, '重货', '2', 'ecw_offer_customer_status', 0, 'default', '', NULL, '2741', '2025-02-11 15:52:10', '2741', '2025-02-11 15:52:10', b'0', 'Heavy Cargo', 'Marchandises Lourdes');
INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`, `label_fr`) VALUES (1, '线索', '1', 'ecw_offer_customer_status', 0, 'default', '', NULL, '2741', '2025-02-11 15:50:47', '2741', '2025-02-11 15:50:47', b'0', 'Clue', 'Indice');
package cn.iocoder.yudao.module.sale.dal.dataobject.offer;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
......@@ -169,6 +170,46 @@ public class OfferDO extends BaseDO {
*/
private Integer transportId;
/**
* 销售阶段 字典sale_stage
*/
private Integer saleStage;
/**
* 销售阶段 字典ecw_offer_customer_status
*/
private Integer customerStatus;
/**
* 销售阶段 字典ecw_offer_cargo_status
*/
private Integer cargoStatus;
/**
* 销售阶段 字典ecw_offer_inquiry_source
*/
private Integer inquirySource;
/**
* 厂家
*/
private String manufacturer;
/**
* 厂家电话
*/
private String manufacturerPhone;
/**
* 原因数据字典
*/
private Integer reasonDict;
/**
* 预计发货时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date estimatedShippingTime;
@ApiModelProperty(value = "线路id")
private Long lineId;
......
......@@ -89,6 +89,181 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
.orderByDesc(OfferDO::getOfferId));
}
@ResultType(OfferRespVO.class)
@Select({
"<script>",
"SELECT SUM(ifnull(op.volume,0)) volume,SUM(ifnull(op.weight,0)) weight ",
"from ecw_offer o ",
"join ecw_customer_contacts cc on (o.relation = 1 and cc.id = o.consignor_id) or (o.relation = 2 and cc.id = o.consignee_id) ",
"join ecw_customer user on user.id = o.relation_id ",
"left join system_user u on u.id = o.follow_up_salesman_id ",
"join ecw_region s on o.objective_id = s.id ",
"join ecw_warehouse_line line on o.line_id = line.id ",
"join ecw_warehouse st on line.start_warehouse_id = st.id ",
"join ecw_warehouse dst on line.dest_warehouse_id = dst.id ",
"left join ecw_channel l on o.channel_id = l.channel_id ",
"JOIN ecw_offer_prod op on op.offer_id = o.offer_id ",
"where o.deleted = 0 and op.deleted = 0",
//customerStatus
"<when test = 'pageVO.customerStatusList != null and pageVO.customerStatusList.size() > 0'>",
"AND o.customer_status IN",
"<foreach item='item' collection='pageVO.customerStatusList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//inquirySourceList
"<when test = 'pageVO.inquirySourceList != null and pageVO.inquirySourceList.size() > 0'>",
"AND o.inquiry_source IN",
"<foreach item='item' collection='pageVO.inquirySourceList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//saleStageList
"<when test = 'pageVO.saleStageList != null and pageVO.saleStageList.size() > 0'>",
"AND o.sale_stage IN",
"<foreach item='item' collection='pageVO.saleStageList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//cargoStatusList
"<when test = 'pageVO.cargoStatusList != null and pageVO.cargoStatusList.size() > 0'>",
"AND o.cargo_status IN",
"<foreach item='item' collection='pageVO.cargoStatusList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//destCountryIds
"<when test = 'pageVO.destCountryIds != null and pageVO.destCountryIds.size() > 0'>",
"AND dst.guojia IN",
"<foreach item='destCountryId' collection='pageVO.destCountryIds' open='(' close=')' separator=','> #{destCountryId} </foreach>",
"</when>",
//objectiveIds
"<when test = 'pageVO.objectiveIds != null and pageVO.objectiveIds.size() > 0'>",
"AND dst.shi IN",
"<foreach item='objectiveId' collection='pageVO.objectiveIds' open='(' close=')' separator=','> #{objectiveId} </foreach>",
"</when>",
//destWarehouseIds
"<when test = 'pageVO.destWarehouseIds != null and pageVO.destWarehouseIds.size() > 0'>",
"AND dst.id IN",
"<foreach item='destWarehouseId' collection='pageVO.destWarehouseIds' open='(' close=')' separator=','> #{destWarehouseId} </foreach>",
"</when>",
//customerId
"<when test = 'pageVO.customerId != null'>",
"AND o.relation_id = #{pageVO.customerId} ",
"</when>",
"<when test = 'pageVO.beginEstimatedShippingTime != null and pageVO.endEstimatedShippingTime != null '>",
"AND o.`estimated_shipping_time` between #{pageVO.beginEstimatedShippingTime} and #{pageVO.endEstimatedShippingTime}",
"</when>",
"<when test = 'pageVO.manufacturer != null and pageVO.manufacturer != \"\" '>",
"AND o.manufacturer like concat('%',concat(#{pageVO.manufacturer},'%'))",
"</when>",
"<when test = 'pageVO.manufacturerPhone != null and pageVO.manufacturerPhone != \"\" '>",
"AND o.manufacturer_phone like concat('%',concat(#{pageVO.manufacturerPhone},'%'))",
"</when>",
"<when test = 'pageVO.relationPhone != null and pageVO.relationPhone != \"\" '>",
"AND cc.phone_new like concat('%',concat(#{pageVO.relationPhone},'%'))",
"</when>",
"<when test = 'pageVO.deptId != null'>",
"AND o.dept_id = #{pageVO.deptId} ",
"</when>",
"<when test= 'pageVO.deptIdList != null and pageVO.deptIdList.size() > 0'>",
"AND (o.dept_id IN",
"<foreach item='deptId' collection='pageVO.deptIdList' open='(' close=')' separator=','> #{deptId} </foreach>",
" or ",
"(SELECT u.dept_id FROM system_user u WHERE u.id = o.creator) IN",
"<foreach item='deptId' collection='pageVO.deptIdList' open='(' close=')' separator=','> #{deptId} </foreach>)",
"</when>",
"<when test = 'pageVO.creator != null and pageVO.creator != \"\" '>",
"AND (o.`salesman_id` = #{pageVO.creator} or o.`creator` = #{pageVO.creator})",
"</when>",
"<when test = 'pageVO.status != null'>",
"AND o.`status` = #{pageVO.status}",
"</when>",
"<when test = 'pageVO.transportId != null'>",
"AND o.`transport_id` = #{pageVO.transportId}",
"</when>",
"<when test = 'pageVO.departureId != null'>",
"AND o.`departure_id` = #{pageVO.departureId}",
"</when>",
"<when test = 'pageVO.objectiveId != null'>",
"AND o.`objective_id` = #{pageVO.objectiveId}",
"</when>",
"<when test = 'pageVO.control != null'>",
"AND o.`control` = #{pageVO.control}",
"</when>",
"<when test = 'pageVO.customsType != null'>",
"AND o.`customs_type` = #{pageVO.customsType}",
"</when>",
"<when test = 'pageVO.number != null and pageVO.number != \"\" '>",
"AND o.`number` like concat('%',concat(#{pageVO.number},'%'))",
"</when>",
"<when test = 'pageVO.orderNo != null and pageVO.orderNo != \"\" '>",
"AND o.`order_no` like concat('%',concat(#{pageVO.orderNo},'%'))",
"</when>",
"<when test = 'pageVO.searchNumber != null and pageVO.searchNumber != \"\" '>",
"AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`number`,'')) like concat('%',concat(#{pageVO.searchNumber},'%'))",
"</when>",
"<when test = 'pageVO.beginCreateTime != null and pageVO.endCreateTime != null '>",
"AND o.`create_time` between #{pageVO.beginCreateTime} and #{pageVO.endCreateTime}",
"</when>",
"<when test = 'pageVO.beginEndTime != null and pageVO.endEndTime != null '>",
"AND o.`end_time` between #{pageVO.beginEndTime} and #{pageVO.endEndTime}",
"</when>",
"<when test = 'pageVO.expired != null and pageVO.expired.after != null and pageVO.expired.before != null'>",
"AND o.`end_time` between #{pageVO.expired.after} and #{pageVO.expired.before}",
"</when>",
"<when test = 'pageVO.importances != null and pageVO.importances.size() > 0'>",
"AND o.`importance` IN ",
"<foreach item='importance' collection='pageVO.importances' open='(' close=')' separator=','> #{importance} </foreach>",
"</when>",
"<when test = 'pageVO.salesmanIds != null and pageVO.salesmanIds.size() > 0'>",
"AND o.`follow_up_salesman_id` IN ",
"<foreach item='id' collection='pageVO.salesmanIds' open='(' close=')' separator=','> #{id} </foreach>",
"</when>",
// 根据创建人查询
"<when test = 'pageVO.creatorIds != null and pageVO.creatorIds.size() > 0'>",
"AND o.`creator` IN ",
"<foreach item='id' collection='pageVO.creatorIds' open='(' close=')' separator=','> #{id} </foreach>",
"</when>",
"<when test = 'pageVO.statusList != null and pageVO.statusList.size() > 0'>",
"AND o.`status` IN ",
"<foreach item='it' collection='pageVO.statusList' open='(' close=')' separator=','> #{it} </foreach>",
"</when>",
"<when test = 'pageVO.channelIds != null and pageVO.channelIds.size() > 0'>",
"AND o.`channel_id` IN ",
"<foreach item='it' collection='pageVO.channelIds' open='(' close=')' separator=','> #{it} </foreach>",
"</when>",
"<when test = 'pageVO.sourceIds != null and pageVO.sourceIds.size() > 0'>",
"AND user.`source` IN ",
"<foreach item='it' collection='pageVO.sourceIds' open='(' close=')' separator=','> #{it} </foreach>",
"</when>",
"<when test = 'pageVO.beginStopTime != null and pageVO.endStopTime != null '>",
"AND o.`stop_time` between #{pageVO.beginStopTime} and #{pageVO.endStopTime}",
"</when>",
"<when test = 'pageVO.prodTitle != null and pageVO.prodTitle != \"\" '>",
"and (o.offer_id in(",
"select op.offer_id ",
"from ecw_offer_prod op ",
"left join ecw_product_type pt ",
"on pt.id = op.product_type ",
"where concat(IFNULL(op.`prod_title_zh`,''),IFNULL(op.`prod_title_en`,''),IFNULL(pt.`title_zh`,''),IFNULL(pt.`title_en`,'')) like concat('%',concat(#{pageVO.prodTitle},'%'))",
"))",
"</when>",
"<when test = 'pageVO.relationId != null'>",
"AND o.`relation_id` = #{pageVO.relationId}",
"</when>",
"<when test = 'pageVO.followUpSalesmanId != null'>",
"AND o.`follow_up_salesman_id` = #{pageVO.followUpSalesmanId}",
"</when>",
"<when test = 'pageVO.searchCustomer != null and pageVO.searchCustomer != \"\" '>",
"AND o.`relation_id` in(select cc.customer_id from ecw_customer_contacts cc where concat(cc.`name`, cc.phone_new) like concat('%',concat(#{pageVO.searchCustomer},'%')))",
"</when>",
"</script>"
})
OfferRespVO statistics(@Param("pageVO") OfferPageReqVO pageVO);
@ResultType(OfferRespVO.class)
@Select({
......@@ -97,6 +272,9 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"if(#{lang} = 0, o.departure ->> '$.titleZh', o.departure ->> '$.titleEn') as departure_name, ",
"if(#{lang} = 0, o.objective ->> '$.titleZh', o.objective ->> '$.titleEn') as objective_name, ",
"user.number as customer_number, ",
"user.name AS customer_name,",
"user.enter_open_sea_time,",
"user.estimate_enter_open_sea_time,",
"(select count(1) from ecw_customer_followup l where l.offer_id = o.offer_id) as log_count, ",
"(SELECT su.nickname FROM system_user as su WHERE su.id = o.creator AND su.deleted = 0 ) as creator_name,",
// 跟进客户经理
......@@ -120,6 +298,30 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"left join ecw_channel l on o.channel_id = l.channel_id ",
"where o.deleted = 0",
//customerStatus
"<when test = 'pageVO.customerStatusList != null and pageVO.customerStatusList.size() > 0'>",
"AND o.customer_status IN",
"<foreach item='item' collection='pageVO.customerStatusList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//inquirySourceList
"<when test = 'pageVO.inquirySourceList != null and pageVO.inquirySourceList.size() > 0'>",
"AND o.inquiry_source IN",
"<foreach item='item' collection='pageVO.inquirySourceList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//saleStageList
"<when test = 'pageVO.saleStageList != null and pageVO.saleStageList.size() > 0'>",
"AND o.sale_stage IN",
"<foreach item='item' collection='pageVO.saleStageList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//cargoStatusList
"<when test = 'pageVO.cargoStatusList != null and pageVO.cargoStatusList.size() > 0'>",
"AND o.cargo_status IN",
"<foreach item='item' collection='pageVO.cargoStatusList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//destCountryIds
"<when test = 'pageVO.destCountryIds != null and pageVO.destCountryIds.size() > 0'>",
"AND dst.guojia IN",
......@@ -143,6 +345,18 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"AND o.relation_id = #{pageVO.customerId} ",
"</when>",
"<when test = 'pageVO.beginEstimatedShippingTime != null and pageVO.endEstimatedShippingTime != null '>",
"AND o.`estimated_shipping_time` between #{pageVO.beginEstimatedShippingTime} and #{pageVO.endEstimatedShippingTime}",
"</when>",
"<when test = 'pageVO.manufacturer != null and pageVO.manufacturer != \"\" '>",
"AND o.manufacturer like concat('%',concat(#{pageVO.manufacturer},'%'))",
"</when>",
"<when test = 'pageVO.manufacturerPhone != null and pageVO.manufacturerPhone != \"\" '>",
"AND o.manufacturer_phone like concat('%',concat(#{pageVO.manufacturerPhone},'%'))",
"</when>",
"<when test = 'pageVO.relationPhone != null and pageVO.relationPhone != \"\" '>",
"AND cc.phone_new like concat('%',concat(#{pageVO.relationPhone},'%'))",
"</when>",
"<when test = 'pageVO.deptId != null'>",
"AND o.dept_id = #{pageVO.deptId} ",
"</when>",
......@@ -259,6 +473,31 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"join ecw_warehouse dst on line.dest_warehouse_id = dst.id ",
"left join ecw_channel l on o.channel_id = l.channel_id ",
"where o.deleted = 0",
//customerStatus
"<when test = 'pageVO.customerStatusList != null and pageVO.customerStatusList.size() > 0'>",
"AND o.customer_status IN",
"<foreach item='item' collection='pageVO.customerStatusList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//inquirySourceList
"<when test = 'pageVO.inquirySourceList != null and pageVO.inquirySourceList.size() > 0'>",
"AND o.inquiry_source IN",
"<foreach item='item' collection='pageVO.inquirySourceList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//saleStageList
"<when test = 'pageVO.saleStageList != null and pageVO.saleStageList.size() > 0'>",
"AND o.sale_stage IN",
"<foreach item='item' collection='pageVO.saleStageList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//cargoStatusList
"<when test = 'pageVO.cargoStatusList != null and pageVO.cargoStatusList.size() > 0'>",
"AND o.cargo_status IN",
"<foreach item='item' collection='pageVO.cargoStatusList' open='(' close=')' separator=','> #{item} </foreach>",
"</when>",
//startWarehouseIds
"<when test = 'pageVO.startWarehouseIds != null and pageVO.startWarehouseIds.size() > 0'>",
"AND st.id IN",
......@@ -288,6 +527,18 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"AND o.relation_id = #{pageVO.customerId} ",
"</when>",
"<when test = 'pageVO.beginEstimatedShippingTime != null and pageVO.endEstimatedShippingTime != null '>",
"AND o.`estimated_shipping_time` between #{pageVO.beginEstimatedShippingTime} and #{pageVO.endEstimatedShippingTime}",
"</when>",
"<when test = 'pageVO.manufacturer != null and pageVO.manufacturer != \"\" '>",
"AND o.manufacturer like concat('%',concat(#{pageVO.manufacturer},'%'))",
"</when>",
"<when test = 'pageVO.manufacturerPhone != null and pageVO.manufacturerPhone != \"\" '>",
"AND o.manufacturer_phone like concat('%',concat(#{pageVO.manufacturerPhone},'%'))",
"</when>",
"<when test = 'pageVO.relationPhone != null and pageVO.relationPhone != \"\" '>",
"AND cc.phone_new like concat('%',concat(#{pageVO.relationPhone},'%'))",
"</when>",
"<when test = 'pageVO.deptId != null'>",
"AND o.dept_id = #{pageVO.deptId} ",
"</when>",
......@@ -455,4 +706,5 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"</script>"
})
OfferRespVO info(@Param("offerId") Long offerId, @Param("lang") Integer lang);
}
package cn.iocoder.yudao.module.sale.service.offer;
import java.io.IOException;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.commission.CustomerCommissionDO;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferDO;
import cn.iocoder.yudao.module.sale.vo.offer.*;
import cn.iocoder.yudao.module.sale.vo.offer.prod.OfferProdCreateReqVO;
import cn.iocoder.yudao.module.sale.vo.offerApproval.OfferApprovalBackInfoVO;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
/**
* 报价单管理 Service 接口
*
......@@ -197,4 +196,11 @@ public interface OfferService extends IService<OfferDO> {
* @return
*/
List<OfferRespVO> getCustomerOfferSelect(Long customerId, String searchKey);
/**
* 汇总
* @param pageVO
* @return
*/
OfferRespVO statistics(OfferPageReqVO pageVO);
}
......@@ -7,24 +7,26 @@ import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
import cn.iocoder.yudao.framework.common.util.validation.StrValidationUtils;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
import cn.iocoder.yudao.module.bpm.api.BpmCreateServiceFactory;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLineDO;
import cn.iocoder.yudao.module.depository.dal.mysql.warehouse.WarehouseLineMapper;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.customer.service.zhongPao.ZhongPaoService;
import cn.iocoder.yudao.module.customer.vo.zhongPao.CustomerZhongPaoQueryVO;
import cn.iocoder.yudao.module.customer.vo.zhongPao.ZhongPaoBestVO;
import cn.iocoder.yudao.module.depository.dal.mysql.warehouse.WarehouseLineMapper;
import cn.iocoder.yudao.module.depository.dto.LogisticsInfoDto;
import cn.iocoder.yudao.module.ecw.api.customer.CustomerApi;
import cn.iocoder.yudao.module.ecw.dal.dataobject.currency.CurrencyDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.service.currency.CurrencyService;
import cn.iocoder.yudao.module.customer.service.zhongPao.ZhongPaoService;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
......@@ -35,22 +37,18 @@ import cn.iocoder.yudao.module.order.enums.OrderNumberEnum;
import cn.iocoder.yudao.module.order.enums.OrderStatusEnum;
import cn.iocoder.yudao.module.order.service.order.OrderConsigneeService;
import cn.iocoder.yudao.module.order.service.order.OrderConsignorService;
import cn.iocoder.yudao.module.order.service.orderNumberLog.OrderNumberLogService;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.product.dto.CouponAvailableGroupDto;
import cn.iocoder.yudao.module.product.dto.FeeDto;
import cn.iocoder.yudao.module.product.enums.FeeTypeEnum;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.service.orderNumberLog.OrderNumberLogService;
import cn.iocoder.yudao.module.order.vo.order.OrderCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemCreateReqVO;
import cn.iocoder.yudao.module.product.component.ProdCostCalculation;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO;
import cn.iocoder.yudao.module.product.dto.CalculationCostResultDto;
import cn.iocoder.yudao.module.product.dto.CouponAvailableGroupDto;
import cn.iocoder.yudao.module.product.dto.FeeDto;
import cn.iocoder.yudao.module.product.dto.ProdCostDto;
import cn.iocoder.yudao.module.product.enums.FeeTypeEnum;
import cn.iocoder.yudao.module.product.param.ProdConditionParam;
import cn.iocoder.yudao.module.product.service.product.ProductService;
import cn.iocoder.yudao.module.sale.convert.offer.OfferConvert;
......@@ -105,10 +103,10 @@ import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.NOT_FIND_CURRENCY;
import static cn.iocoder.yudao.module.sale.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.sale.enums.ErrorCodeConstants.DEPARTURE_NOT_EXISTS;
import static cn.iocoder.yudao.module.sale.enums.ErrorCodeConstants.OBJECTIVE_NOT_EXISTS;
import static cn.iocoder.yudao.module.sale.enums.ErrorCodeConstants.PROD_NOT_EXISTS;
import static cn.iocoder.yudao.module.sale.enums.ErrorCodeConstants.*;
/**
* 报价单管理 Service 实现类
......@@ -379,11 +377,13 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
param.setOneSeaFreight(offerProdDO.getOneSeaFreight());
param.setOrgFreightPrice(offerProdDO.getOriginalSeaFreight());
param.setFreightCurrency(Objects.isNull(offerProdDO.getSeaFreightCurrency()) ? null : Integer.valueOf(String.valueOf(offerProdDO.getSeaFreightCurrency())));
param.setFreightVolume(offerProdDO.getSeaFreightVolume());
param.setOneClearanceFee(offerProdDO.getOneClearanceFreight());
param.setClearanceFeeCurrency(Objects.isNull(offerProdDO.getClearanceFreightCurrency()) ? null : Integer.valueOf(String.valueOf(offerProdDO.getClearanceFreightCurrency())));
param.setClearanceFeeVolume(offerProdDO.getClearanceFreightVolume());
param.setOrgClearanceFeePrice(offerProdDO.getOriginalClearanceFreight());
param.setLiquidFreightPrice(offerProdDO.getLiquidFreightPrice());
param.setLiquidClearanceFeePrice(offerProdDO.getLiquidClearanceFeePrice());
......@@ -777,7 +777,9 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (specialApplyVO.getType() == 1 || specialApplyVO.getType() == 2) {
offerProdDO.setSpecialPriceType(Boolean.TRUE);
offerProdDO.setOneSeaFreight(specialApplyVO.getSeaFreight());
offerProdDO.setOriginalSeaFreight(specialApplyVO.getOrgSeaFreight());
offerProdDO.setOneClearanceFreight(specialApplyVO.getClearanceFreight());
offerProdDO.setOriginalClearanceFreight(specialApplyVO.getOrgClearanceFreight());
}
if (specialApplyVO.getType() == 3) {
// 计算新的销售价
......@@ -903,6 +905,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (offerResultVO.getResult() == 0) {
// 输单
offerDO.setReason(offerResultVO.getReason());
offerDO.setReasonDict(offerResultVO.getReasonDict());
offerDO.setOldStatus(offerDO.getStatus());
offerDO.setStatus(5);
offerDO.setOrderId(-1L);
......@@ -1100,6 +1103,11 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
}
@Override
public OfferRespVO statistics(OfferPageReqVO pageVO) {
return offerMapper.statistics(pageVO);
}
// @Override
// public PageResult<OfferRespVO> deptOfferPage(OfferPageReqVO pageReqVO) {
// IPage<OfferRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
......@@ -1539,4 +1547,5 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
.orderByDesc(OfferDO::getOrderId).last("limit 10"));
return OfferConvert.INSTANCE.convertList(offerDOList);
}
}
package cn.iocoder.yudao.module.sale.vo.offer;
import cn.iocoder.yudao.framework.common.validation.Marks;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.*;
import java.util.Date;
/**
......@@ -167,5 +164,44 @@ public class OfferBaseVO {
@ApiModelProperty(value = "商户洽谈的跟进记录数量")
private Integer logCount;
/**
* 销售阶段 字典sale_stage
*/
private Integer saleStage;
/**
* 销售阶段 字典ecw_offer_customer_status
*/
private Integer customerStatus;
/**
* 销售阶段 字典ecw_offer_cargo_status
*/
private Integer cargoStatus;
/**
* 销售阶段 字典ecw_offer_inquiry_source
*/
private Integer inquirySource;
/**
* 厂家
*/
private String manufacturer;
/**
* 厂家电话
*/
private String manufacturerPhone;
/**
* 原因数据字典
*/
private Integer reasonDict;
/**
* 预计发货时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date estimatedShippingTime;
}
......@@ -64,6 +64,14 @@ public class OfferPageReqVO extends PageParam {
@ApiModelProperty(value = "结束预计结束时间")
private Date endStopTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始预计发货时间")
private Date beginEstimatedShippingTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束预计发货时间")
private Date endEstimatedShippingTime;
@ApiModelProperty(value = "控货")
private Boolean control;
......@@ -180,6 +188,9 @@ public class OfferPageReqVO extends PageParam {
@ApiModelProperty(value = "目的仓ID集合")
private List<Long> destWarehouseIds;
@ApiModelProperty(value = "客户状态")
private List<Long> customerStatusList;
@ApiModelProperty(value = "有效期")
private TimeSlot expired;
......@@ -201,4 +212,21 @@ public class OfferPageReqVO extends PageParam {
@ApiModelProperty(value = "客户来源列表")
private List<Long> sourceIds;
@ApiModelProperty(value = "询盘来源")
private List<Long> inquirySourceList;
@ApiModelProperty(value = "销售阶段")
private List<Long> saleStageList;
@ApiModelProperty(value = "货物状态")
private List<Long> cargoStatusList;
@ApiModelProperty(value = "联系人手机号")
private String relationPhone;
@ApiModelProperty(value = "厂家电话")
private String manufacturer;
@ApiModelProperty(value = "厂家电话")
private String manufacturerPhone;
}
......@@ -2,17 +2,21 @@ package cn.iocoder.yudao.module.sale.vo.offer;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.CustomerFollowupBackVO;
import cn.iocoder.yudao.module.depository.dto.LogisticsInfoDto;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferProdDO;
import cn.iocoder.yudao.module.sale.vo.offer.prod.OfferProdRespVO;
import cn.iocoder.yudao.module.sale.vo.offer.transport.OfferTransportCreateReqVO;
import cn.iocoder.yudao.module.sale.vo.offer.transport.OfferTransportRespVO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.*;
import io.swagger.annotations.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ApiModel("管理后台 - 报价单管理 Response VO")
@Data
......@@ -90,6 +94,17 @@ public class OfferRespVO extends OfferBaseVO {
@ApiModelProperty(value = "客户编号")
private String customerNumber;
@ApiModelProperty(value = "客户名称")
private String customerName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "进入公海时间")
private Date enterOpenSeaTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "预计进入公海时间")
private Date estimateEnterOpenSeaTime;
@ApiModelProperty(value = "客户经理所属部门")
private String deptName;
......@@ -100,4 +115,60 @@ public class OfferRespVO extends OfferBaseVO {
@TableField(exist = false)
private CustomerFollowupBackVO followupBackVO;
@ApiModelProperty("商品明细")
@TableField(exist = false)
private List<OfferProdDO> offerProds;
/**
* 销售阶段 字典sale_stage
*/
private Integer saleStage;
/**
* 销售阶段 字典ecw_offer_customer_status
*/
private Integer customerStatus;
/**
* 销售阶段 字典ecw_offer_cargo_status
*/
private Integer cargoStatus;
/**
* 销售阶段 字典ecw_offer_inquiry_source
*/
private Integer inquirySource;
/**
* 厂家
*/
private String manufacturer;
/**
* 厂家电话
*/
private String manufacturerPhone;
/**
* 原因数据字典
*/
private Integer reasonDict;
/**
* 预计发货时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date estimatedShippingTime;
/**
* 体积
*/
private BigDecimal volume;
/**
* 重量
*/
private BigDecimal weight;
@ApiModelProperty(value = "是否特价")
private Boolean specialPriceType;
}
......@@ -24,4 +24,9 @@ public class OfferResultVO {
@ApiModelProperty(value = "关联订单号")
private String orderNo;
/**
* 原因数据字典
*/
private Integer reasonDict;
}
package cn.iocoder.yudao.module.sale.controller.admin.offer;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.module.customer.service.customerFollowup.CustomerFollowupService;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerRespVO;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferDO;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferProdDO;
import cn.iocoder.yudao.module.sale.service.offer.OfferProdService;
import cn.iocoder.yudao.module.sale.service.offer.OfferService;
import cn.iocoder.yudao.module.sale.vo.offer.*;
import cn.iocoder.yudao.module.sale.vo.offerApproval.OfferApprovalBackInfoVO;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleRespDTO;
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ROLE_NOT_EXISTS;
import cn.iocoder.yudao.module.sale.service.offer.OfferService;
@Api(tags = "管理后台 - 报价单管理")
@RestController
@RequestMapping("/ecw/offer")
......@@ -56,6 +56,8 @@ public class OfferController {
private RoleApi roleApi;
@Resource
private CustomerFollowupService customerFollowupService;
@Resource
private OfferProdService offerProdService;
@PostMapping("/create")
@ApiOperation("创建报价单管理")
......@@ -191,14 +193,38 @@ public class OfferController {
.eq(CustomerFollowupDO::getOfferId, respVO.getOfferId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
List<OfferProdDO> offerProdDOList = offerProdService.selectList(new LambdaQueryWrapperX<OfferProdDO>()
.eq(OfferProdDO::getOfferId, respVO.getOfferId())
.orderByDesc(OfferProdDO::getOfferProdId));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
if (offerProdDOList!=null) {
BigDecimal volume= new BigDecimal(0);
BigDecimal weight=new BigDecimal(0);
for (OfferProdDO offerProdDO : offerProdDOList) {
volume = volume.add(offerProdDO.getVolume());
weight = weight.add(offerProdDO.getWeight());
if (offerProdDO.getSpecialPriceType()){
respVO.setSpecialPriceType(offerProdDO.getSpecialPriceType());
}
}
respVO.setVolume(volume);
respVO.setWeight(weight);
respVO.setOfferProds(offerProdDOList);
}
}
}
return success(pageResult);
}
@GetMapping("/statistics")
@ApiOperation("汇总")
// @PreAuthorize("@ss.hasPermission('ecw:offer:query')")
public CommonResult<OfferRespVO> statistics(@Valid OfferPageReqVO pageVO) {
return success(offerService.statistics(pageVO));
}
@GetMapping("/data/space/page")
@ApiOperation("获得报价单管理数据权限分页")
......
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