Commit a88005e3 authored by libin's avatar libin

旅游核销

parent 956f49a1
......@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
/**
* @author libin
......@@ -31,6 +32,10 @@ public class TourGoodOrderFindVo extends PageParam {
*出发时间
*/
@NotEmpty(message = "出发时间不断能空")
private Long trvaelTime;
private Date trvaelTime;
private String travelDate;
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @author libin
......@@ -21,6 +22,11 @@ public class TourGoodOrderVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 核销订单id
*/
private Integer id;
/**
* 商品名称
*/
......@@ -52,12 +58,17 @@ public class TourGoodOrderVo implements Serializable {
private int leaveOfnum;
/**
* 分公司名称
* 是否出行 '状态:0-未出行;1-已出行'
*/
private Integer travelStatus;
/**
* 开始出行日期
*/
private String companyName;
private Date startDate;
/**
* 是否出行 '状态:0-未出行;1-已出行'
* 开始出行时间
*/
private Integer travelStatus;
private Date startTime;
}
package com.xxfc.platform.tour.biz;
import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.sun.org.apache.regexp.internal.RE;
import com.xxfc.platform.tour.dto.GoodSiteDTO;
import com.xxfc.platform.tour.dto.GoodSpePriceDTO;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.TourGoodSite;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.mapper.TourGoodVerificationMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.*;
/**
* 旅游线路核销明细
......@@ -31,16 +21,6 @@ import java.util.stream.Collectors;
@Service
public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,TourGoodVerification> {
@Autowired
private TourGoodSiteBiz tourGoodSiteBiz;
@Autowired
private TourGoodBiz tourGoodBiz;
@Autowired
private TourGoodSpeBiz tourGoodSpeBiz;
//删除线路核销
public void delGoodVerification(List<Integer> ids){ mapper.delVerification(ids);}
......@@ -60,54 +40,18 @@ public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,
* @return
*/
public PageDataVO<TourGoodOrderVo> findTourGoodOrdersPage(TourGoodOrderFindVo tourGoodOrderFindVo) {
//根据分公司id查询 -->tour_good_site表查询(分公司id 正常路线,未删除) 查询出商品id , 站点id, 出发时间(8:00)
PageDataVO<GoodSiteDTO> goodSiteDTOPageDataVO = tourGoodSiteBiz.findTourGoodSitePageByCompanyId(tourGoodOrderFindVo.getCompanyId());
List<GoodSiteDTO> goodSiteDTOS = goodSiteDTOPageDataVO.getData();
Map<Integer, GoodSiteDTO> goodSiteDTOMap = goodSiteDTOS.stream().collect(Collectors.toMap(K -> K.getGoodId(), Function.identity()));
//商品id查询-->tour_good_spe_price表查询出商品id 商品规格id,出行时间(date 2018-08-09)
List<Integer> goodIds = goodSiteDTOS.stream().map(GoodSiteDTO::getGoodId).collect(Collectors.toList());
List<GoodSpePriceDTO> goodSpePriceDTOS = tourGoodSpeBiz.findTourGoodSpePricePageByGoodIds(goodIds);
Map<Integer, GoodSpePriceDTO> goodSpePriceDTOMap = goodSpePriceDTOS.stream().collect(Collectors.toMap(K -> K.getGoodId(), Function.identity()));
//根据商品规格id 站点id 商品id 查询出 总人数,核销人数,状态
List<TourGoodVerification> tourGoodVerifications = new ArrayList<>();
//商品id和站点id 组装的map
Map<Integer, Integer> goodAndSiteOfIdMap = goodSiteDTOS.stream().collect(Collectors.toMap(K -> K.getGoodId(), V -> V.getId()));
for (GoodSpePriceDTO goodSpePriceDTO : goodSpePriceDTOS) {
TourGoodVerification tourGoodVerification = mapper.findByGoodSpecIdAndGoodSiteIdAndGoodId(goodSpePriceDTO.getSpeId(),goodAndSiteOfIdMap.get(goodSpePriceDTO.getGoodId()),goodSpePriceDTO.getGoodId());
tourGoodVerifications.add(tourGoodVerification);
}
Map<Integer, TourGoodVerification> goodVerificationMap = tourGoodVerifications.stream().collect(Collectors.toMap(K -> K.getGoodId(), Function.identity()));
//根据商品id查询--->tour_good 表查询 商品名称,商品封面
List<Integer> goodIdList = tourGoodVerifications.stream().map(TourGoodVerification::getGoodId).collect(Collectors.toList());
List<TourGood> tourGoods = tourGoodBiz.findByGoodIds(goodIdList);
//组装TourGoodOrderVo数据
List<TourGoodOrderVo> tourGoodOrderVos = new ArrayList<>();
for (TourGood tourGood : tourGoods) {
TourGoodOrderVo tourGoodOrderVo = TourGoodOrderVo
.builder()
.name(tourGood.getName())
.coverUrl(tourGood.getCover())
.companyName("")
.headcount(0)
.tripOfNum(0)
.leaveOfnum(0)
.travelStatus(0)
.travelTime("")
.build();
tourGoodOrderVos.add(tourGoodOrderVo);
}
PageDataVO<TourGoodOrderVo> goodOrderVoPageDataVO = new PageDataVO<>();
goodOrderVoPageDataVO.setData(tourGoodOrderVos);
goodOrderVoPageDataVO.setPageSize(goodSiteDTOPageDataVO.getPageSize());
goodOrderVoPageDataVO.setPageNum(goodSiteDTOPageDataVO.getPageNum());
goodOrderVoPageDataVO.setTotalCount(goodSiteDTOPageDataVO.getTotalCount());
goodOrderVoPageDataVO.setTotalPage(goodSiteDTOPageDataVO.getTotalPage());
return goodOrderVoPageDataVO;
return null;
Date trvaelTime = tourGoodOrderFindVo.getTrvaelTime();
String dateStr = DateUtil.format(trvaelTime, "YYYY-MM-dd");
tourGoodOrderFindVo.setTravelDate(dateStr);
PageDataVO<TourGoodOrderVo> tourGoodOrderVoPageDataVO= PageDataVO.pageInfo(tourGoodOrderFindVo.getPage(), tourGoodOrderFindVo.getLimit(), () -> mapper.findVerificationAll(tourGoodOrderFindVo));
List<TourGoodOrderVo> tourGoodOrderVos = tourGoodOrderVoPageDataVO.getData();
tourGoodOrderVos.stream().peek(tourGoodOrderVo -> {
tourGoodOrderVo.setLeaveOfnum(tourGoodOrderVo.getHeadcount()-tourGoodOrderVo.getTripOfNum());
String startDateStr = DateUtil.format(tourGoodOrderVo.getStartDate(),"YYYY.MM.dd");
tourGoodOrderVo.setTravelTime(startDateStr);
}).count();
return tourGoodOrderVoPageDataVO;
}
......
......@@ -2,6 +2,8 @@ package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
......@@ -46,4 +48,11 @@ public interface TourGoodVerificationMapper extends Mapper<TourGoodVerification>
*/
@Update("update tour_good_verification set `status`=#{status} where where `id`=#{verficationId}")
int updateStatusByGoodIdAndSpeIdAndSiteId(@Param("verficationId") Integer verficationId,@Param("status") Integer status);
/**
* 查询核销订单
* @param tourGoodOrderFindVo
* @return
*/
List<TourGoodOrderVo> findVerificationAll(TourGoodOrderFindVo tourGoodOrderFindVo );
}
......@@ -28,4 +28,13 @@
)
</if>
</update>
<select id="findVerificationAll" resultType="com.xxfc.platform.tour.vo.TourGoodOrderVo">
select * from (SELECT v.id as `id`,v.total_person as `headcount`,v.status as `travelStatus`,v.verification_person as `tripOfNum`,g.name as `name`,
g.cover as `coverUrl`,p.start_time as `startDate`,s.depart_time as `startTime`FROM tour_good_verification v
LEFT JOIN tour_good_site s ON v.site_id=s.id
LEFT JOIN tour_good g ON v.good_id=g.id
LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id
WHERE s.company_id=#{companyId} and v.status=#{orderStatus} and p.start_time=#{travelDate} ) as `goodOrder`
</select>
</mapper>
\ No newline at end of file
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