Commit 799364f9 authored by 332784038@qq.com's avatar 332784038@qq.com

报价单业务修改完善

parent 2ec88a7c
-- 增加报价单目的国字段
alter table ecw_offer add COLUMN dest_country_id bigint DEFAULT 0 comment '目的国id';
update ecw_offer o join ecw_warehouse_line l on o.line_id = l.id join ecw_warehouse w on w.id = l.dest_warehouse_id set o.dest_country_id = w.guojia;
\ No newline at end of file
......@@ -8,6 +8,8 @@ import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import javax.validation.constraints.NotNull;
/**
* 报价单管理 DO
......@@ -70,6 +72,9 @@ public class OfferDO extends BaseDO {
* 始发地信息
*/
private String departure;
@ApiModelProperty(value = "目的地国ID")
private Long destCountryId;
/**
* 目的地
*/
......
......@@ -93,38 +93,28 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
@Select({
"<script>",
"select o.*, ",
// "o.number, ",
// "o.order_no, ",
// "o.order_id, ",
"if(#{lang} = 0, o.departure ->> '$.titleZh', o.departure ->> '$.titleEn') as departure_name, ",
"if(#{lang} = 0, o.objective ->> '$.titleZh', o.objective ->> '$.titleEn') as objective_name, ",
// "o.start_time, ",
// "o.end_time, ",
// "o.stop_time, ",
// "o.status, ",
// "o.transport_id, ",
// "o.est_cost, ",
// "o.create_time, ",
// "o.update_time, ",
"user.number as customer_number, ",
"(select count(1) from ecw_customer_followup l where l.offer_id = o.offer_id) as log_count, ",
"u.nickname as creator_name, ",
"u.nickname as business_manager_name, ",
// "(SELECT cc.`name` FROM ecw_customer_contacts cc WHERE ( o.relation = 1 AND cc.id = o.consignor_id ) OR ( o.relation = 2 AND cc.id = o.consignee_id)) AS relation_name ",
"cc.name as relation_name, ",
"cc.area_code as relation_area_code, ",
"cc.phone_new as relation_phone, ",
"if(#{lang} = 0, l.name_zh , l.name_en ) as channel_name, ",
"line.start_warehouse_id, ",
"line.dest_warehouse_id, ",
"if(#{lang} = 0, l.name_zh , l.name_en ) as channel_name, ",
"if(#{lang} = 0, l.name_zh , l.name_en ) as channel_name, ",
"if(#{lang} = 0, st.title_zh , st.title_en) as start_warehouse_name, ",
"if(#{lang} = 0, dst.title_zh , dst.title_en) as dest_warehouse_name, ",
"line.transport_type ",
"from ecw_offer o ",
"left 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) ",
"left join ecw_customer user on user.id = o.relation_id ",
"left join system_user u on u.id = o.follow_up_salesman_id ",
"left join ecw_region s on o.objective_id = s.id ",
"left join ecw_warehouse_line line on o.line_id = line.id ",
"left join ecw_warehouse st on line.start_warehouse_id = st.id ",
"left 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",
......@@ -152,7 +142,6 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"AND o.relation_id = #{pageVO.customerId} ",
"</when>",
"<when test = 'pageVO.deptId != null'>",
"AND o.dept_id = #{pageVO.deptId} ",
"</when>",
......@@ -254,11 +243,21 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"<script>",
"select count(1)",
"from ecw_offer o ",
"left join ecw_customer c on c.id = o.relation_id ",
"left 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) ",
"left join ecw_customer user on user.id = o.relation_id ",
"left join system_user u on u.id = o.follow_up_salesman_id ",
"left join ecw_region s on o.objective_id = s.id ",
"left join ecw_warehouse_line line on o.line_id = line.id ",
"left join ecw_warehouse st on line.start_warehouse_id = st.id ",
"left 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",
//startWarehouseIds
"<when test = 'pageVO.startWarehouseIds != null and pageVO.startWarehouseIds.size() > 0'>",
"AND st.id IN",
"<foreach item='startWarehouseId' collection='pageVO.startWarehouseIds' open='(' close=')' separator=','> #{startWarehouseId} </foreach>",
"</when>",
//destCountryIds
"<when test = 'pageVO.destCountryIds != null and pageVO.destCountryIds.size() > 0'>",
"AND dst.guojia IN",
......@@ -281,6 +280,7 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"<when test = 'pageVO.customerId != null'>",
"AND o.relation_id = #{pageVO.customerId} ",
"</when>",
"<when test = 'pageVO.deptId != null'>",
"AND o.dept_id = #{pageVO.deptId} ",
"</when>",
......@@ -327,9 +327,6 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"<when test = 'pageVO.beginEndTime != null and pageVO.endEndTime != null '>",
"AND o.`end_time` between #{pageVO.beginEndTime} and #{pageVO.endEndTime}",
"</when>",
"<when test = 'pageVO.beginStopTime != null and pageVO.endStopTime != null '>",
"AND o.`stop_time` between #{pageVO.beginStopTime} and #{pageVO.endStopTime}",
"</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>",
......@@ -350,14 +347,11 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"<foreach item='it' collection='pageVO.channelIds' open='(' close=')' separator=','> #{it} </foreach>)",
"</when>",
"<when test = 'pageVO.sourceIds != null and pageVO.sourceIds.size() > 0'>",
"AND c.`source` IN ",
"AND user.`source` IN ",
"<foreach item='it' collection='pageVO.sourceIds' open='(' close=')' separator=','> #{it} </foreach>)",
"</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 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(",
......@@ -371,6 +365,9 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"<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>",
......
......@@ -65,5 +65,7 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_ASSOCIATION_OFFER_NO_CAN_UPDATE = new ErrorCode(1004010052, "order.association.offer.no.can.update");
ErrorCode ORDER_BOUND_OFFER = new ErrorCode(1004010053, "order.bound.offer");
ErrorCode OFFER_LINE_NOT_EXIST = new ErrorCode(1004010054, "line.not.exist");
ErrorCode OFFER_DEPARTURE_OBJECTIVE_AND_LINE_NOT_AGREEMENT = new ErrorCode(1004010055, "offer.departure.objective.and.line.not.agreement");
}
......@@ -209,6 +209,18 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (Objects.nonNull(createReqVO.getEstCostVO())) {
offer.setEstCost(JSONObject.toJSONString(createReqVO.getEstCostVO()));
}
LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId(
createReqVO.getLineId());
if (Objects.isNull(logisticsInfoDto)) {
throw exception(OFFER_LINE_NOT_EXIST);
}
if (!Objects.equals(logisticsInfoDto.getStartCityId(),
createReqVO.getDepartureId()) || !Objects.equals(
logisticsInfoDto.getDestCityId(), createReqVO.getObjectiveId()) || !Objects.equals(
logisticsInfoDto.getDestCountryId(), createReqVO.getDestCountryId())) {
throw exception(OFFER_DEPARTURE_OBJECTIVE_AND_LINE_NOT_AGREEMENT);
}
// offer.setStatus(2);// 确认中
// 查询始发地与目的地信息
RegionDO departure = regionService.getRegion(offer.getDepartureId());
......@@ -534,6 +546,18 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (Objects.nonNull(updateReqVO.getEstCostVO())) {
updateObj.setEstCost(JSONObject.toJSONString(updateReqVO.getEstCostVO()));
}
LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId(
updateReqVO.getLineId());
if (Objects.isNull(logisticsInfoDto)) {
throw exception(OFFER_LINE_NOT_EXIST);
}
if (!Objects.equals(logisticsInfoDto.getStartCityId(),
updateReqVO.getDepartureId()) || !Objects.equals(
logisticsInfoDto.getDestCityId(), updateReqVO.getObjectiveId()) || !Objects.equals(
logisticsInfoDto.getDestCountryId(), updateReqVO.getDestCountryId())) {
throw exception(OFFER_DEPARTURE_OBJECTIVE_AND_LINE_NOT_AGREEMENT);
}
// 查询始发地与目的地信息
RegionDO departure = regionService.getRegion(updateReqVO.getDepartureId());
if (Objects.isNull(departure) || (!StrUtil.equals(departure.getType(), "2") && !StrUtil.equals(departure.getType(), "3"))) {
......@@ -642,7 +666,12 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (CollectionUtil.isEmpty(offerProdDOList)) {
throw exception(OFFER_PROD_NOT_NULL);
}
respVO.setOfferProdRespVOList(OfferProdConvert.INSTANCE.convertList(offerProdDOList));
LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId(
respVO.getLineId());
respVO.setLogisticsInfoDto(logisticsInfoDto);
return respVO;
}
......
......@@ -60,6 +60,10 @@ public class OfferBaseVO {
@NotNull(message = "objective.not.exists")
private Long objectiveId;
@ApiModelProperty(value = "目的地国ID")
@NotNull(message = "目的国不能为空")
private Long destCountryId;
// @ApiModelProperty(value = "目的地信息")
// private String objective;
......
......@@ -174,6 +174,9 @@ public class OfferPageReqVO extends PageParam {
@ApiModelProperty(value = "目的地id集合")
private List<Long> objectiveIds;
@ApiModelProperty(value = "目的仓ID集合")
private List<Long> startWarehouseIds;
@ApiModelProperty(value = "目的仓ID集合")
private List<Long> destWarehouseIds;
......
package cn.iocoder.yudao.module.sale.vo.offer;
import cn.iocoder.yudao.module.depository.dto.LogisticsInfoDto;
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;
......@@ -32,7 +33,10 @@ public class OfferRespVO extends OfferBaseVO {
private OfferTransportRespVO transportVO;
@ApiModelProperty(value = "报价单商品列表")
List<OfferProdRespVO> offerProdRespVOList;
private List<OfferProdRespVO> offerProdRespVOList;
@ApiModelProperty(value = "物流信息")
private LogisticsInfoDto logisticsInfoDto;
@ApiModelProperty(value = "始发地名称")
private String departureName;
......@@ -59,10 +63,14 @@ public class OfferRespVO extends OfferBaseVO {
// 线路相关
@ExcelProperty("始发仓库id")
@ApiModelProperty("始发仓库id")
private Long startWarehouseId;
@ExcelProperty("目的仓库id")
@ApiModelProperty("始发仓库名称")
private Long startWarehouseName;
@ApiModelProperty("目的仓库id")
private Long destWarehouseId;
@ApiModelProperty("目的仓库名称")
private Long destWarehouseName;
@ExcelProperty("运输方式")
private String transportType;
......
This diff is collapsed.
......@@ -645,7 +645,9 @@ order.cargo.control.cancel.pick.reject=The release record of the control order i
order.cargo.control.cancel.pick.cancel=The release record of the control order has been cancelled
warehouse.in.item.quantity.required=warehouse in item quantity required
order.line.not.exist=Order line does not exist
line.not.exist=The line does not exist
order.departure.objective.and.line.not.agreement=The order origin destination is inconsistent with the route
offer.departure.objective.and.line.not.agreement=The offer origin destination is inconsistent with the route
transport.and.line.not.agreement=The shipping method of the order does not match the route information. Please reselect the route information
prod.brand.not.null=brand is not null or zero
preload.not.exist=Goods are not pre-loaded in the shipment order
......
......@@ -651,7 +651,9 @@ order.cargo.control.cancel.pick.reject=\u63A7\u8D27\u8BA2\u5355\u5DF2\u653E\u8D2
order.cargo.control.cancel.pick.cancel=\u63A7\u8D27\u8BA2\u5355\u5DF2\u653E\u8D27\u8BB0\u5F55\u8C03\u8D27\u5BA1\u6279\u53D6\u6D88
warehouse.in.item.quantity.required=\u5165\u4ED3\u9879\u6570\u91CF\u5FC5\u586B
order.line.not.exist=\u8BA2\u5355\u7EBF\u8DEF\u4E0D\u5B58\u5728
line.not.exist=\u7ebf\u8def\u4e0d\u5b58\u5728
order.departure.objective.and.line.not.agreement=\u8BA2\u5355\u59CB\u53D1\u5730\u76EE\u7684\u5730\u4E0E\u7EBF\u8DEF\u4E0D\u4E00\u81F4
offer.departure.objective.and.line.not.agreement=\u62a5\u4ef7\u5355\u59cb\u53d1\u5730\u76ee\u7684\u5730\u4e0e\u7ebf\u8def\u4e0d\u4e00\u81f4
transport.and.line.not.agreement=\u8BA2\u5355\u8FD0\u8F93\u65B9\u5F0F\u4E0E\u7EBF\u8DEF\u4FE1\u606F\u4E0D\u5339\u914D\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u7EBF\u8DEF\u4FE1\u606F
prod.brand.not.null=\u54C1\u724C\u4E0D\u80FD\u4E3A\u7A7A\u62160
preload.not.exist=\u51FA\u8D27\u5355\u672A\u9884\u88C5\u8D27\u7269
......
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