Commit d44c04f4 authored by hezhen's avatar hezhen

Merge branch 'master-chw' of http://113.105.137.151:22280/youjj/cloud-platform into master-chw

parents 5a4fb70e b8b5890d
...@@ -54,6 +54,8 @@ public class RabbitConstant { ...@@ -54,6 +54,8 @@ public class RabbitConstant {
public static final String KEY_VCOMPANY_UPD="vcompany:upd"; public static final String KEY_VCOMPANY_UPD="vcompany:upd";
public static final String KEY_VEHICLE_RECEIVE="vehicle:receive";
static { static {
exchangeTopicSet = new HashSet<String>() {{ exchangeTopicSet = new HashSet<String>() {{
add(ADMIN_TOPIC); add(ADMIN_TOPIC);
......
...@@ -48,4 +48,8 @@ public class GoodDataVO{ ...@@ -48,4 +48,8 @@ public class GoodDataVO{
@ApiModelProperty("seo*html标签优化") @ApiModelProperty("seo*html标签优化")
private String imgDesc; private String imgDesc;
private String distance;
private String labels;
} }
...@@ -4,6 +4,8 @@ package com.github.wxiaoqi.security.admin.dto; ...@@ -4,6 +4,8 @@ package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam; import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -18,4 +20,6 @@ public class AppraiseLabeInfoDTO extends PageParam { ...@@ -18,4 +20,6 @@ public class AppraiseLabeInfoDTO extends PageParam {
private Integer type; private Integer type;
private Integer enable; private Integer enable;
private List<Integer>types;
} }
...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.dto; ...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam; import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
import java.util.List; import java.util.List;
/** /**
...@@ -40,4 +41,12 @@ public class UserCommentFindDTO extends PageParam{ ...@@ -40,4 +41,12 @@ public class UserCommentFindDTO extends PageParam{
private Integer companyId; private Integer companyId;
private Integer isDesc; private Integer isDesc;
private String orderNo;
private String appraiseJson;
private Integer point;
private Integer isAnonymous;
} }
...@@ -42,10 +42,10 @@ public class AppraiseLabelInfo implements Serializable { ...@@ -42,10 +42,10 @@ public class AppraiseLabelInfo implements Serializable {
private Integer point; private Integer point;
/** /**
* 1-全部,2-房车,3-机车,4-游艇,5豪车 * 0-全部,1-房车,2-机车,3-游艇,4豪车
*/ */
@Column(name = "type") @Column(name = "type")
@ApiModelProperty(value = "1-全部,2-房车,3-机车,4-游艇,5豪车") @ApiModelProperty(value = "0-全部,1-房车,2-机车,3-游艇,4豪车")
private Integer type; private Integer type;
/** /**
...@@ -90,5 +90,6 @@ public class AppraiseLabelInfo implements Serializable { ...@@ -90,5 +90,6 @@ public class AppraiseLabelInfo implements Serializable {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer sort; private Integer sort;
@Column(name = "tag_type")
private Integer tagType;
} }
package com.github.wxiaoqi.security.admin.entity; package com.github.wxiaoqi.security.admin.entity;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor; ...@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author libin * @author libin
...@@ -96,4 +98,31 @@ public class UserComment { ...@@ -96,4 +98,31 @@ public class UserComment {
@Transient @Transient
private Integer isCompany; private Integer isCompany;
/**
* 订单编号
*/
@Column(name = "order_no")
private String orderNo;
/**
* 评论详情
*/
@Column(name = "appraise_json")
private String appraiseJson;
/**
* 评价总分
*/
@Column(name = "point")
private Integer point;
/**
* 是否匿名0-不匿名,1-匿名
*/
@Column(name = "is_anonymous")
private Integer isAnonymous;
@Transient
private List<JSONObject> jsonList;
} }
...@@ -40,6 +40,10 @@ public class AppraiseLabelInfoBiz extends BaseBiz<AppraiseLabelInfoMapper, Appra ...@@ -40,6 +40,10 @@ public class AppraiseLabelInfoBiz extends BaseBiz<AppraiseLabelInfoMapper, Appra
return ObjectRestResponse.succ(PageDataVO.pageInfo(pageInfo)); return ObjectRestResponse.succ(PageDataVO.pageInfo(pageInfo));
} }
public ObjectRestResponse selectAppList(AppraiseLabeInfoDTO appraiseLabeInfoDTO){
return ObjectRestResponse.succ(getList(appraiseLabeInfoDTO));
}
public void saveOrUpd(AppraiseLabelInfo appraiseLabelInfo){ public void saveOrUpd(AppraiseLabelInfo appraiseLabelInfo){
Long id = appraiseLabelInfo.getId() == null ? 0L :appraiseLabelInfo.getId(); Long id = appraiseLabelInfo.getId() == null ? 0L :appraiseLabelInfo.getId();
if (id > 0L ){ if (id > 0L ){
......
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO; import com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO;
...@@ -9,11 +12,15 @@ import com.github.wxiaoqi.security.admin.mapper.UserCommentMapper; ...@@ -9,11 +12,15 @@ import com.github.wxiaoqi.security.admin.mapper.UserCommentMapper;
import com.github.wxiaoqi.security.admin.vo.UserCommentVo; import com.github.wxiaoqi.security.admin.vo.UserCommentVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.feign.OrderFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
...@@ -23,7 +30,8 @@ import java.util.List; ...@@ -23,7 +30,8 @@ import java.util.List;
@Service @Service
@Slf4j @Slf4j
public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
@Autowired
private OrderFeign orderFeign;
...@@ -138,5 +146,74 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{ ...@@ -138,5 +146,74 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
return dataVO; return dataVO;
} }
/**
* 订单评论
* 处理维度
* 总分
* @param userComment
*/
public void saveComment(UserComment userComment){
String no = userComment.getOrderNo();
if(no == null || ("").equals(no)){
throw new BaseException("订单号不能为空", ResultCode.FAILED_CODE);
}
ObjectRestResponse<BaseOrder> ba = orderFeign.queryByNo(no);
if(ba.getData() == null){
throw new BaseException("订单错误", ResultCode.FAILED_CODE);
}
BaseOrder baseOrder = ba.getData();
if(baseOrder.getIsAppraise() == 1){
throw new BaseException("订单已评价,不能重复评论", ResultCode.FAILED_CODE);
}
JSONArray jsonArray = JSONArray.parseArray(userComment.getAppraiseJson());
if(jsonArray == null || jsonArray.size() == 0){
throw new BaseException("评论维度不能为空", ResultCode.FAILED_CODE);
}
Integer point = 0;
//处理维度和总分
//[{"id":1,"name":"配送标签","point":10,"star":1},{"id":2,"name":"配送标签","point":20,"star":2}]
for(int i =0 ;i <jsonArray.size(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
point += jsonObject.getInteger("point");
}
userComment.setPoint(point);
Integer parentId = userComment.getParentId() == null ? 0 : userComment.getParentId();
Integer rootParentId = userComment.getRootParentId() == null ? 0 : userComment.getRootParentId();
if (parentId > 0){
UserComment parentComment = selectById(parentId);
if (parentComment == null ){
throw new BaseException("该评论不存在", ResultCode.FAILED_CODE);
}
rootParentId=parentComment.getRootParentId();
userComment.setSoureId(parentComment.getSoureId());
userComment.setSoureUserId(parentComment.getSoureUserId());
userComment.setSoureType(parentComment.getSoureType());
userComment.setToUserId(parentComment.getUserId());
userComment.setRootParentId(rootParentId);
}else {
if (StringUtils.isBlank(userComment.getSoureId())){
throw new BaseException("资源ID不能为空", ResultCode.FAILED_CODE);
}
}
userComment.setCreateTime(new Date());
insertSelective(userComment);
Integer id = userComment.getId();
if (id > 0 ){
if (rootParentId == 0){
UserComment userComment1=new UserComment();
userComment1.setId(id);
userComment1.setRootParentId(id);
updateSelectiveById(userComment1);
}else {
mapper.addreplyNum(rootParentId);
}
}
baseOrder.setIsAppraise(1);
orderFeign.updateBaseOrder(baseOrder);
}
} }
...@@ -95,5 +95,18 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> { ...@@ -95,5 +95,18 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> {
} }
@PostMapping("saveComment")
@ApiModelProperty("评论")
public ObjectRestResponse saveComment(@RequestBody UserComment userComment) {
userComment.setUserId(getCurrentUserIdInt());
baseBiz.saveComment(userComment);
return ObjectRestResponse.succ();
}
@GetMapping("app/unauth/selectCommentList")
@ApiModelProperty("列表")
@IgnoreUserToken
public ObjectRestResponse selectCommentList(UserCommentFindDTO commentFindDTO) {
return ObjectRestResponse.succ( baseBiz.selectList(commentFindDTO));
}
} }
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.dto.AppraiseLabeInfoDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.admin.biz.AppraiseLabelInfoBiz; import com.github.wxiaoqi.security.admin.biz.AppraiseLabelInfoBiz;
import com.github.wxiaoqi.security.admin.entity.AppraiseLabelInfo; import com.github.wxiaoqi.security.admin.entity.AppraiseLabelInfo;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -11,4 +15,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -11,4 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("app/appraiseLabelInfo") @RequestMapping("app/appraiseLabelInfo")
public class AppraiseLabelInfoController extends BaseController<AppraiseLabelInfoBiz, AppraiseLabelInfo> { public class AppraiseLabelInfoController extends BaseController<AppraiseLabelInfoBiz, AppraiseLabelInfo> {
@GetMapping("tag/selectList")
@ApiModelProperty("标签列表")
public ObjectRestResponse applySelectList(AppraiseLabeInfoDTO appraiseLabeInfoDTO) {
return baseBiz.selectAppList(appraiseLabeInfoDTO);
}
} }
\ No newline at end of file
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
<if test="enable != null"> <if test="enable != null">
AND a.enable = #{enable} AND a.enable = #{enable}
</if> </if>
<if test="types != null and types.size() > 0">
and a.type in
<foreach collection="types" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by a.upd_time DESC order by a.upd_time DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -44,13 +44,16 @@ public class AppHomeController extends BaseController<CofigBiz,Cofig> { ...@@ -44,13 +44,16 @@ public class AppHomeController extends BaseController<CofigBiz,Cofig> {
public ObjectRestResponse<List<GoodDataVO>> goodList( public ObjectRestResponse<List<GoodDataVO>> goodList(
@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit, @RequestParam(value = "limit",defaultValue = "4") Integer limit,
@RequestParam(value = "type",defaultValue = "1") Integer type @RequestParam(value = "type",defaultValue = "1") Integer type,
@RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude
){ ){
List<GoodDataVO> list=new ArrayList<>(); List<GoodDataVO> list=new ArrayList<>();
if (type==2){ if (type==2){
list=tourFeign.goodList(page,limit); list=tourFeign.goodList(page,limit);
}else if (type==3){ }else if (type==3){
list=campsiteFeign.goodList(page,limit); //list=campsiteFeign.goodList(page,limit);
list=campsiteFeign.goodList(page,limit,longitude,latitude);
}else if (type==4){ }else if (type==4){
return vehicleFeign.goodList(page,limit); return vehicleFeign.goodList(page,limit);
} }
......
...@@ -25,10 +25,16 @@ import java.util.List; ...@@ -25,10 +25,16 @@ import java.util.List;
@FeignClient(name = "xx-campsite",path = "/campsiteShop") @FeignClient(name = "xx-campsite",path = "/campsiteShop")
public interface CampsiteFeign { public interface CampsiteFeign {
/*@ApiOperation("首页营地列表")
@GetMapping(value = "/app/shopList")
List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "4") Integer limit);*/
@ApiOperation("首页营地列表") @ApiOperation("首页营地列表")
@GetMapping(value = "/app/shopList") @GetMapping(value = "/app/shopList")
List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page, List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "4") Integer limit); @RequestParam(value = "limit", defaultValue = "4") Integer limit,
@RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude);
@GetMapping(value = "/app/unauth/findRandomVehicle") @GetMapping(value = "/app/unauth/findRandomVehicle")
ObjectRestResponse findRandomVehicle(@RequestParam(value = "number") Integer number); ObjectRestResponse findRandomVehicle(@RequestParam(value = "number") Integer number);
......
...@@ -82,8 +82,27 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -82,8 +82,27 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
* @param limit * @param limit
* @return * @return
*/ */
public List<GoodDataVO> getAllByHome(Integer page, Integer limit) { public List<GoodDataVO> getAllByHome(Integer page, Integer limit,Double lat ,Double lon) {
return mapper.findAllByHome((page - 1) * limit, limit); //return mapper.findAllByHome((page - 1) * limit, limit);
List<GoodDataVO>list = new ArrayList<GoodDataVO>();
if(lat != null && lat > 0 && lon != null && lon > 0){
list = mapper.findAllAndJlByHome((page - 1) * limit, limit,lat,lon);
}else{
list = mapper.findAllByHome((page - 1) * limit, limit);
}
//增加标签
for(GoodDataVO goodDataVO : list){
List<CampsiteShopTagDTO> listTag= campsiteShopTagBiz.findByCampsiteShopId(goodDataVO.getId());
if(listTag.size() > 0){
String labels = "";
for(CampsiteShopTagDTO campsiteShopTagDTO : listTag){
labels += campsiteShopTagDTO.getName() + ",";
}
labels = labels.substring(0,labels.length()-1);
goodDataVO.setLabels(labels);
}
}
return list;
} }
......
...@@ -33,6 +33,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> { ...@@ -33,6 +33,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
*/ */
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size); List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<GoodDataVO> findAllAndJlByHome(@Param("start") Integer start, @Param("size") Integer size,@Param("lat")Double lat,@Param("lon")Double lon);
List<GoodDataVO> findAll(); List<GoodDataVO> findAll();
/** /**
......
...@@ -68,8 +68,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp ...@@ -68,8 +68,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
@ApiOperation("首页营地列表") @ApiOperation("首页营地列表")
@GetMapping(value = "/app/shopList") @GetMapping(value = "/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page, public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "4") Integer limit) { @RequestParam(value = "limit", defaultValue = "4") Integer limit,
return getBaseBiz().getAllByHome(page, limit); @RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude) {
return getBaseBiz().getAllByHome(page, limit,longitude,latitude);
} }
@ApiOperation("随机获取营地") @ApiOperation("随机获取营地")
......
...@@ -94,6 +94,19 @@ ...@@ -94,6 +94,19 @@
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER} limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select> </select>
<select id="findAllAndJlByHome" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt,cs.img_title as `imgTitle`,cs.img_keyword as `imgKeyword`,cs.img_desc as `imgDesc`,
ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0
- #{lat} * PI() / 180.0)/2), 2)
+COS( latitude * PI() / 180.0)*COS(#{lat} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{lon} * PI() /
180.0)/2),2))))*6378.137)*10000)/10000 as distance
FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select>
<select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO"> <select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt,cs.img_title as `imgTitle`,cs.img_keyword as `imgKeyword`,cs.img_desc as `imgDesc` select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt,cs.img_title as `imgTitle`,cs.img_keyword as `imgKeyword`,cs.img_desc as `imgDesc`
FROM `campsite_shop` cs FROM `campsite_shop` cs
......
...@@ -144,11 +144,11 @@ ...@@ -144,11 +144,11 @@
</dependency> </dependency>
<!-- 分布式锁 --> <!-- 分布式锁 -->
<dependency> <!-- <dependency>-->
<groupId>org.redisson</groupId> <!-- <groupId>org.redisson</groupId>-->
<artifactId>redisson-spring-boot-starter</artifactId> <!-- <artifactId>redisson-spring-boot-starter</artifactId>-->
<version>3.11.0</version> <!-- <version>3.11.0</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
......
...@@ -11,6 +11,7 @@ public enum AccountTypeEnum { ...@@ -11,6 +11,7 @@ public enum AccountTypeEnum {
OUT_DEPOSIT(202, "所有押金"), OUT_DEPOSIT(202, "所有押金"),
OUT_PART_DEPOSIT(203, "部分押金(扣除该扣除的 + 保留违章预备金)"), OUT_PART_DEPOSIT(203, "部分押金(扣除该扣除的 + 保留违章预备金)"),
OUT_RESIDUE_DEPOSIT(204, "剩余押金(扣除该扣除的)"), OUT_RESIDUE_DEPOSIT(204, "剩余押金(扣除该扣除的)"),
OUT_RESIDUE_ORDER(205, "部分订单退款"),
; ;
/** /**
* 编码 * 编码
......
...@@ -18,6 +18,7 @@ public enum DeductionTypeEnum { ...@@ -18,6 +18,7 @@ public enum DeductionTypeEnum {
VIOLATE_TRAFFIC_DEDUCT(401, "违章扣款"), VIOLATE_TRAFFIC_DEDUCT(401, "违章扣款"),
VIOLATE_TRAFFIC_KEEP(402, "违章扣款保留金"), VIOLATE_TRAFFIC_KEEP(402, "违章扣款保留金"),
OTHER_DELAY_SAFE(501, "其他费用-延迟用车不记免赔"), OTHER_DELAY_SAFE(501, "其他费用-延迟用车不记免赔"),
OTHER_PUBLISH_REJECTED(502, "其他费用-申请调车接单被拒绝退款"),
; ;
/** /**
* 编码 * 编码
......
...@@ -8,6 +8,7 @@ public enum OrderTypeEnum { ...@@ -8,6 +8,7 @@ public enum OrderTypeEnum {
TOUR(2, "旅游订单"), TOUR(2, "旅游订单"),
MEMBER(3, "会员订单"), MEMBER(3, "会员订单"),
ACTIVITY(4, "活动订单"), ACTIVITY(4, "活动订单"),
PUBLISH(5, "调车需求订单"),
; ;
/** /**
* 编码 * 编码
......
...@@ -363,4 +363,7 @@ public class BaseOrder implements Serializable { ...@@ -363,4 +363,7 @@ public class BaseOrder implements Serializable {
@Column(name = "order_sign") @Column(name = "order_sign")
private Integer orderSign; private Integer orderSign;
@Column(name = "is_appraise")
private Integer isAppraise;
} }
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* 订单需求接单详情表
*
* @author hezhen
* @email 18178966185@163.com
* @date 2019-09-09 15:51:16
*/
@Data
@Table(name = "order_pulish_receive_detail")
public class OrderPulishReceiveDetail implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键")
private Integer id;
@Column(name = "order_id")
@ApiModelProperty(value = "订单id")
private Integer orderId;
@Column(name = "company_id")
@ApiModelProperty(value = "公司id")
private Integer companyId;
@Column(name = "publish_id")
@ApiModelProperty(value = "需求id")
private Integer publishId;
@Column(name = "type")
@ApiModelProperty(value = "类型:1-接单者;2-发布者")
private Integer type;
@Column(name = "receive_ids")
@ApiModelProperty(value = "接单ids(逗号隔开)")
private String receiveIds;
@Column(name = "refuse_receive_ids")
@ApiModelProperty(value = "拒绝的接单ids")
private String refuseReceiveIds;
}
...@@ -55,8 +55,12 @@ public class SpecialRent implements Serializable { ...@@ -55,8 +55,12 @@ public class SpecialRent implements Serializable {
@Column(name = "status") @Column(name = "status")
@ApiModelProperty(value = "状态 0--删除 1--创建 2--取消 3--等待下单 4--下单成功") @ApiModelProperty(value = "状态 0--删除 1--创建 2--取消 3--等待下单 4--下单成功")
private Integer status; private Integer status;
/** public void setStatus(Integer status) {
this.status = status;
}
/**
* 创建时间 * 创建时间
*/ */
@Column(name = "crt_time") @Column(name = "crt_time")
...@@ -273,4 +277,11 @@ public class SpecialRent implements Serializable { ...@@ -273,4 +277,11 @@ public class SpecialRent implements Serializable {
@Column(name = "price_type") @Column(name = "price_type")
@ApiModelProperty(value = "超时时间戳", hidden = true ) @ApiModelProperty(value = "超时时间戳", hidden = true )
private Integer priceType; private Integer priceType;
/**
* 历史订单号
*/
@Column(name = "old_order_no")
@ApiModelProperty(value = "历史订单号", hidden = true )
private String oldOrderNo;
} }
...@@ -2,10 +2,14 @@ package com.xxfc.platform.order.feign; ...@@ -2,10 +2,14 @@ package com.xxfc.platform.order.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderInvoice; import com.xxfc.platform.order.entity.OrderInvoice;
import com.xxfc.platform.order.pojo.dto.OrderDTO; import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.dto.OrderDetailDTO; import com.xxfc.platform.order.pojo.dto.OrderDetailDTO;
import com.xxfc.platform.order.pojo.dto.ReceiveRefundDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.PulishReceiveBO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -46,4 +50,18 @@ public interface OrderFeign { ...@@ -46,4 +50,18 @@ public interface OrderFeign {
@RequestMapping(value = "chw/orderDetail/app/unauth/getOrderDetail", method = RequestMethod.GET) @RequestMapping(value = "chw/orderDetail/app/unauth/getOrderDetail", method = RequestMethod.GET)
ObjectRestResponse<OrderDetailDTO> getOrderDetail(@RequestParam("orderNo")String orderNo, @RequestParam("type")Integer type); ObjectRestResponse<OrderDetailDTO> getOrderDetail(@RequestParam("orderNo")String orderNo, @RequestParam("type")Integer type);
@PostMapping(value = "chw/orderPulishReceive/add")
ObjectRestResponse<BaseOrder> add(@RequestBody PulishReceiveBO bo);
@GetMapping(value = "/baseOrder/queryByNo")
ObjectRestResponse<BaseOrder> queryByNo(@RequestParam("no")String no);
@PostMapping(value = "/baseOrder/updateBaseOrder")
BaseOrder updateBaseOrder(@RequestBody BaseOrder baseOrder);
@PostMapping(value = "chw/orderPulishReceive/app/unauth/refund")
ObjectRestResponse refund(@RequestBody ReceiveRefundDTO receiveRefundDTO);
} }
package com.xxfc.platform.order.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class ReceiveRefundDTO {
@ApiModelProperty("退款金额")
private BigDecimal refundAmount;
@ApiModelProperty("退款描述")
private String refundDesc;
private String orderNo;
}
package com.xxfc.platform.order.pojo.order;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderPulishReceiveDetail;
import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class PulishReceiveBO extends OrderPulishReceiveDetail implements OrderDetail {
private BaseOrder order;
private List<VehiclePublishReceiveVo> receiveVos;
AppUserDTO appUserDTO;
/**
* 促成人联系方式
*/
@ApiModelProperty(value = "促成人联系方式")
String facilitatePhone;
/**
* 下单来源,1--app;2--小程序
*/
private Integer orderOrigin;
/**
* 优惠券*
*/
private List<String> tickerNo;
/**
* 订单子项
*/
List<OrderItem> items;
}
package com.xxfc.platform.order.pojo.order.add;
import com.xxfc.platform.order.entity.OrderPulishReceiveDetail;
import com.xxfc.platform.vehicle.entity.VehiclePublishReceive;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class AddPublishReceiveDTO extends OrderPulishReceiveDetail {
@ApiModelProperty("接单用户Id")
private Integer userId;
@ApiModelProperty("接单详情")
List<VehiclePublishReceive> receives;
}
package com.xxfc.platform.order.redis;
public class KlockConstant {
//头部
public static final String HEAD_SPECIAL_RENT = "klock:specialRent";
//功能
public static final String SPECIAL_RENT_ENTITY = HEAD_SPECIAL_RENT+ ":entity";
}
...@@ -51,6 +51,11 @@ ...@@ -51,6 +51,11 @@
<version>3.2.3.RELEASE</version> <version>3.2.3.RELEASE</version>
</dependency> </dependency>
<dependency>
<groupId>cn.keking</groupId>
<artifactId>spring-boot-klock-starter</artifactId>
<version>1.4-RELEASE</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -62,6 +62,7 @@ import com.xxfc.platform.vehicle.entity.Vehicle; ...@@ -62,6 +62,7 @@ import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO;
import com.xxfc.platform.vehicle.util.DistanceUtil; import com.xxfc.platform.vehicle.util.DistanceUtil;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -70,6 +71,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -70,6 +71,7 @@ import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -82,7 +84,6 @@ import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*; ...@@ -82,7 +84,6 @@ import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.pojo.mq.OrderMQDTO.*; import static com.xxfc.platform.order.pojo.mq.OrderMQDTO.*;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
import static com.xxfc.platform.universal.constant.DictionaryKey.ILLEGAL_TYPE; import static com.xxfc.platform.universal.constant.DictionaryKey.ILLEGAL_TYPE;
/** /**
...@@ -154,6 +155,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -154,6 +155,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
@Autowired @Autowired
SpecialRentBiz specialRentBiz; SpecialRentBiz specialRentBiz;
@Autowired
OrderPulishReceiveDetailBiz receiveDetailBiz;
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
...@@ -756,7 +760,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -756,7 +760,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
ObjectRestResponse orr = userFeign.buyMember(userMemberDTO); ObjectRestResponse orr = userFeign.buyMember(userMemberDTO);
log.info("orr.getStatus() : " + orr.getStatus()); log.info("orr.getStatus() : " + orr.getStatus());
} else if (OrderTypeEnum.RENT_VEHICLE.getCode().equals(baseOrder.getType())) { } else if(OrderTypeEnum.PUBLISH.getCode().equals(baseOrder.getType())){
updateOrder.setStatus(OrderStatusEnum.ORDER_TOSTART.getCode());
}else if (OrderTypeEnum.RENT_VEHICLE.getCode().equals(baseOrder.getType())) {
updateOrder.setStatus(OrderStatusEnum.ORDER_TOSTART.getCode()); updateOrder.setStatus(OrderStatusEnum.ORDER_TOSTART.getCode());
orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail() {{ orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail() {{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
...@@ -842,17 +848,33 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -842,17 +848,33 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
//处理App用户提醒短信的发送 //处理App用户提醒短信的发送
// orderMsgBiz.handelAppUserMsg(orvd, omd, baseOrder, appUserDTO); // orderMsgBiz.handelAppUserMsg(orvd, omd, baseOrder, appUserDTO);
orderMsgBiz.handelMsgPayNew(orvd, otd, omd, baseOrder, appUserDTO);
//处理后台用户提醒短信的发送 if (OrderTypeEnum.PUBLISH.getCode().equals(baseOrder.getType())){
OrderPulishReceiveDetail receiveDetail = new OrderPulishReceiveDetail();
receiveDetail.setOrderId(baseOrder.getId());
receiveDetail=receiveDetailBiz.selectOne(receiveDetail);
if (receiveDetail != null ){
Integer receiveType = receiveDetail.getType() == null ? 0 : receiveDetail.getType();
VehiclePublishReceiveDTO publishReceiveDTO = new VehiclePublishReceiveDTO();
BeanUtils.copyProperties(receiveDetail,publishReceiveDTO);
publishReceiveDTO.setStatus(receiveType == 2 ? VehiclePublishReceiveDTO.AGREE : VehiclePublishReceiveDTO.PAY);
publishReceiveDTO.setOrderNo(baseOrder.getNo());
vehicleFeign.updReceive(publishReceiveDTO);
}
}else {
orderMsgBiz.handelMsgPayNew(orvd, otd, omd, baseOrder, appUserDTO);
//处理后台用户提醒短信的发送
// orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY); // orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY);
sendOrderMq(orvd, otd, omd, baseOrder, ORDER_PAY); sendOrderMq(orvd, otd, omd, baseOrder, ORDER_PAY);
if (OrderTypeEnum.MEMBER.getCode().equals(baseOrder.getType())) { if (OrderTypeEnum.MEMBER.getCode().equals(baseOrder.getType())) {
sendOrderMq(orvd, otd, omd, baseOrder, ORDER_FINISH); sendOrderMq(orvd, otd, omd, baseOrder, ORDER_FINISH);
//订单完成时,payway为 支付宝,则转支付 //订单完成时,payway为 支付宝,则转支付
baseOrder.setPayWay(payWay); baseOrder.setPayWay(payWay);
orderAccountBiz.finishFreeze2PayAmount(baseOrder); orderAccountBiz.finishFreeze2PayAmount(baseOrder);
}
} }
} }
} else { } else {
log.error(" order has payed , orderNo:{}, tradeNo:{} ", orderNo, tradeNo); log.error(" order has payed , orderNo:{}, tradeNo:{} ", orderNo, tradeNo);
......
...@@ -47,6 +47,7 @@ import java.util.*; ...@@ -47,6 +47,7 @@ import java.util.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.contant.enumerate.AccountTypeEnum.OUT_RESIDUE_ORDER;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT; import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT; import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT;
import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI; import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI;
...@@ -219,6 +220,31 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -219,6 +220,31 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return refundAmount; return refundAmount;
} }
/**
* 调车发布 退款流程
* @param baseOrder 基础订单信息
* @param refundDesc 退款描述
* @param originalRefundAmount 原退款金额
* @param deductAmount 扣除金额
*/
public void publishRefundProcess(BaseOrder baseOrder, String refundDesc, BigDecimal originalRefundAmount, BigDecimal deductAmount) {
BigDecimal refundAmount = BigDecimal.ZERO.add(originalRefundAmount);
if(null != deductAmount) {
refundAmount = originalRefundAmount.subtract(deductAmount);
}
BigDecimal finalRefundAmount = refundAmount;
OrderAccountDetail oad = new OrderAccountDetail(){{
setOriginOrderAmount(originalRefundAmount);
setOrderAmount(finalRefundAmount);
}};
OrderAccountDeduction violateDeduction = initDeduction(deductAmount, refundDesc, DeductionTypeEnum.OTHER_PUBLISH_REJECTED, OrderAccountDeduction.ORIGIN_ORDER);
oad.getDeductions().add(violateDeduction);
refundSubProcess(baseOrder, refundDesc, originalRefundAmount, refundAmount, OUT_RESIDUE_ORDER.getCode(), RefundStatusEnum.ALL.getCode(), oad);
}
/** /**
* 退款子流程 * 退款子流程
* @param baseOrder 基础订单信息 * @param baseOrder 基础订单信息
......
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderPulishReceiveDetail;
import com.xxfc.platform.order.mapper.OrderPulishReceiveDetailMapper;
import org.springframework.stereotype.Service;
/**
*
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-19 17:00:35
*/
@Service
public class OrderPulishReceiveDetailBiz extends BaseBiz<OrderPulishReceiveDetailMapper, OrderPulishReceiveDetail> {
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime; ...@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.ace.cache.annotation.Cache;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
...@@ -25,6 +26,7 @@ import com.xxfc.platform.vehicle.pojo.vo.VehicleVO; ...@@ -25,6 +26,7 @@ import com.xxfc.platform.vehicle.pojo.vo.VehicleVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mockito.internal.util.collections.Sets; import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.klock.annotation.Klock;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.SpecialRent; import com.xxfc.platform.order.entity.SpecialRent;
...@@ -37,6 +39,7 @@ import java.util.List; ...@@ -37,6 +39,7 @@ import java.util.List;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.xxfc.platform.order.entity.SpecialRent.STATUS_CRT; import static com.xxfc.platform.order.entity.SpecialRent.STATUS_CRT;
import static com.xxfc.platform.order.redis.KlockConstant.SPECIAL_RENT_ENTITY;
import static com.xxfc.platform.vehicle.entity.Vehicle.STATE_DOWN; import static com.xxfc.platform.vehicle.entity.Vehicle.STATE_DOWN;
/** /**
...@@ -162,6 +165,7 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> { ...@@ -162,6 +165,7 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
rabbitProduct.sendSpecialDelayMessage(selectById(specialRent.getId()), delayTime); rabbitProduct.sendSpecialDelayMessage(selectById(specialRent.getId()), delayTime);
} }
@Klock(name = SPECIAL_RENT_ENTITY, keys = {"#specialRent.id"})
public Long handleRent(@RequestBody SpecialRent specialRent, VehicleVO vehicle) { public Long handleRent(@RequestBody SpecialRent specialRent, VehicleVO vehicle) {
RentVehicleBO detail = new RentVehicleBO(); RentVehicleBO detail = new RentVehicleBO();
detail.setStartTime(specialRent.getStartTime()); detail.setStartTime(specialRent.getStartTime());
...@@ -170,6 +174,12 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> { ...@@ -170,6 +174,12 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
detail.setStartAddr(specialRent.getStartCompanyName()); detail.setStartAddr(specialRent.getStartCompanyName());
detail.setStartCompanyId(specialRent.getStartCompanyId()); detail.setStartCompanyId(specialRent.getStartCompanyId());
detail.setEndCompanyId(specialRent.getEndCompanyId()); detail.setEndCompanyId(specialRent.getEndCompanyId());
if(StrUtil.isNotBlank(specialRent.getOrderNo())) {
if(StrUtil.isBlank(specialRent.getOldOrderNo())) {
specialRent.setOldOrderNo("");
}
specialRent.setOldOrderNo(specialRent.getOldOrderNo()+ ","+ specialRent.getOrderNo());
}
detail.setOrder(new BaseOrder(){{setNo(OrderUtil.GetOrderNumber("", OrderUtil.APP_MID));}}); detail.setOrder(new BaseOrder(){{setNo(OrderUtil.GetOrderNumber("", OrderUtil.APP_MID));}});
detail.setRentFreeDay(SYS_FALSE); detail.setRentFreeDay(SYS_FALSE);
detail.setBookVehicleVO(new BookVehicleVO(){{ detail.setBookVehicleVO(new BookVehicleVO(){{
......
...@@ -29,6 +29,7 @@ import com.xxfc.platform.universal.entity.Dictionary; ...@@ -29,6 +29,7 @@ import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleVO; import com.xxfc.platform.vehicle.pojo.vo.VehicleVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -110,6 +111,10 @@ public class OrderCancelBiz { ...@@ -110,6 +111,10 @@ public class OrderCancelBiz {
@Autowired @Autowired
ActivityFeign activityFeign; ActivityFeign activityFeign;
@Autowired
OrderPulishReceiveDetailBiz receiveDetailBiz;
private static Map<Integer, List<Integer>> cancelAble; private static Map<Integer, List<Integer>> cancelAble;
static { static {
cancelAble = new HashMap<Integer, List<Integer>>(); cancelAble = new HashMap<Integer, List<Integer>>();
...@@ -127,6 +132,9 @@ public class OrderCancelBiz { ...@@ -127,6 +132,9 @@ public class OrderCancelBiz {
cancelAble.put(OrderTypeEnum.ACTIVITY.getCode(), new LinkedList<Integer>(){{ cancelAble.put(OrderTypeEnum.ACTIVITY.getCode(), new LinkedList<Integer>(){{
add(OrderStatusEnum.ORDER_UNPAY.getCode()); add(OrderStatusEnum.ORDER_UNPAY.getCode());
}}); }});
cancelAble.put(OrderTypeEnum.PUBLISH.getCode(), new LinkedList<Integer>(){{
add(OrderStatusEnum.ORDER_UNPAY.getCode());
}});
} }
/** /**
...@@ -140,6 +148,7 @@ public class OrderCancelBiz { ...@@ -140,6 +148,7 @@ public class OrderCancelBiz {
OrderTourDetail otd = new OrderTourDetail(); OrderTourDetail otd = new OrderTourDetail();
OrderMemberDetail omd = new OrderMemberDetail(); OrderMemberDetail omd = new OrderMemberDetail();
OrderActiveDetail orderActiveDetail = new OrderActiveDetail(); OrderActiveDetail orderActiveDetail = new OrderActiveDetail();
OrderPulishReceiveDetail receiveDetail = new OrderPulishReceiveDetail();
if(cancelAble.get(baseOrder.getType()).contains(baseOrder.getStatus())) { if(cancelAble.get(baseOrder.getType()).contains(baseOrder.getStatus())) {
BaseOrder updateOrder = new BaseOrder(){{ BaseOrder updateOrder = new BaseOrder(){{
setId(baseOrder.getId()); setId(baseOrder.getId());
...@@ -370,27 +379,23 @@ public class OrderCancelBiz { ...@@ -370,27 +379,23 @@ public class OrderCancelBiz {
//已支付,并且是待出行状态,取消预约 //已支付,并且是待出行状态,取消预约
if(OrderStatusEnum.ORDER_CANCEL.getCode().equals(baseOrder.getStatus()) && SYS_TRUE.equals(baseOrder.getHasPay())){ if(OrderStatusEnum.ORDER_CANCEL.getCode().equals(baseOrder.getStatus()) && SYS_TRUE.equals(baseOrder.getHasPay())){
vehicleFeign.rentUnbookVehicle(orvd.getBookRecordId()); vehicleFeign.rentUnbookVehicle(orvd.getBookRecordId());
//特惠租车 恢复排班记录
if (BaseOrder.ORDER_SIGN_SPECIAL == baseOrder.getOrderSign()) {
SpecialRent specialRent = specialRentBiz.selectOne(new SpecialRent(){{
setOrderNo(baseOrder.getNo());
}});
VehicleVO vehicle = vehicleFeign.getVehicleDetail(specialRent.getVehicleId()).getData();
Long delayTime = specialRentBiz.handleRent(specialRent, vehicle);
specialRent.setUpdTime(null);
specialRentBiz.updateSelectiveById(specialRent);
rabbitProduct.sendSpecialDelayMessage(specialRentBiz.selectById(specialRent.getId()), delayTime);
}
}else { }else {
//非特惠租车 拒绝之前预约 //未支付,拒绝之前的预约
if(BaseOrder.ORDER_SIGN_SPECIAL != baseOrder.getOrderSign()) { RestResponse<Integer> restResponse = vehicleFeign.rentRejectVehicleBooking(orvd.getBookRecordId());
//未支付,拒绝之前的预约
RestResponse<Integer> restResponse = vehicleFeign.rentRejectVehicleBooking(orvd.getBookRecordId());
}
} }
// //特惠租车 恢复排班记录
// if (BaseOrder.ORDER_SIGN_SPECIAL == baseOrder.getOrderSign()) {
// SpecialRent specialRent = specialRentBiz.selectOne(new SpecialRent(){{
// setOrderNo(baseOrder.getNo());
// }});
// VehicleVO vehicle = vehicleFeign.getVehicleDetail(specialRent.getVehicleId()).getData();
// Long delayTime = specialRentBiz.handleRent(specialRent, vehicle);
// specialRent.setUpdTime(null);
// specialRentBiz.updateSelectiveById(specialRent);
// rabbitProduct.sendSpecialDelayMessage(specialRentBiz.selectById(specialRent.getId()), delayTime);
// }
//取消租车免费天数使用 //取消租车免费天数使用
if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) { if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
Integer freeDays = (null == inProgressVO) ? orvd.getFreeDays(): inProgressVO.getBackFreeDays(); Integer freeDays = (null == inProgressVO) ? orvd.getFreeDays(): inProgressVO.getBackFreeDays();
...@@ -429,6 +434,12 @@ public class OrderCancelBiz { ...@@ -429,6 +434,12 @@ public class OrderCancelBiz {
}}); }});
if(null != specialRent ) { if(null != specialRent ) {
//特惠租车 恢复排班记录
VehicleVO vehicle = vehicleFeign.getVehicleDetail(specialRent.getVehicleId()).getData();
Long delayTime = specialRentBiz.handleRent(specialRent, vehicle);
specialRent.setUpdTime(null);
specialRentBiz.updateSelectiveById(specialRent);
Integer status = SpecialRent.STATUS_AUTOCNL_TOPAY; Integer status = SpecialRent.STATUS_AUTOCNL_TOPAY;
if(SYS_TRUE.equals(baseOrder.getHasPay())) { if(SYS_TRUE.equals(baseOrder.getHasPay())) {
// //
...@@ -440,7 +451,10 @@ public class OrderCancelBiz { ...@@ -440,7 +451,10 @@ public class OrderCancelBiz {
setStatus(finalStatus); setStatus(finalStatus);
setOrderStatus(SpecialRent.ORDER_STATUS_CANCEL); setOrderStatus(SpecialRent.ORDER_STATUS_CANCEL);
}}); }});
rabbitProduct.sendSpecialDelayMessage(specialRentBiz.selectById(specialRent.getId()), delayTime);
} }
} }
}else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) { }else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
...@@ -468,6 +482,14 @@ public class OrderCancelBiz { ...@@ -468,6 +482,14 @@ public class OrderCancelBiz {
} }
}else if(OrderTypeEnum.PUBLISH.getCode().equals(baseOrder.getType())) {
receiveDetail = receiveDetailBiz.selectOne(new OrderPulishReceiveDetail(){{
setOrderId(baseOrder.getId());
}});
VehiclePublishReceiveDTO receiveDTO = new VehiclePublishReceiveDTO();
BeanUtils.copyProperties(receiveDetail,receiveDTO);
receiveDTO.setStatus(VehiclePublishReceiveDTO.CANCEL);
vehicleFeign.updReceive(receiveDTO);
} }
//返还优惠券 //返还优惠券
......
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderPulishReceiveDetail;
import tk.mybatis.mapper.common.Mapper;
/**
*
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-19 17:00:35
*/
public interface OrderPulishReceiveDetailMapper extends Mapper<OrderPulishReceiveDetail> {
}
...@@ -523,4 +523,17 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -523,4 +523,17 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return baseOrderBiz.updateBaseOrder(baseOrder); return baseOrderBiz.updateBaseOrder(baseOrder);
} }
@RequestMapping(value = "/queryByNo", method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<BaseOrder> queryByNo(String no) {
BaseOrder baseOrder = new BaseOrder();
baseOrder.setNo(no);
return ObjectRestResponse.succ(baseOrderBiz.selectOne(baseOrder));
}
@RequestMapping(value = "/updateBaseOrder", method = RequestMethod.POST)
@IgnoreClientToken
public void updateBaseOrder(@RequestBody BaseOrder baseOrder) {
baseOrderBiz.updateSelectiveById(baseOrder);
}
} }
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.OrderPulishReceiveDetailBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderPulishReceiveDetail;
import com.xxfc.platform.order.pojo.dto.ReceiveRefundDTO;
import com.xxfc.platform.order.pojo.order.PulishReceiveBO;
import com.xxfc.platform.order.service.OrderPulishReceiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("chw/orderPulishReceive")
@Api(value = "调车需求订单", tags = {"调车需求订单"})
@IgnoreClientToken
public class OrderPulishReceiveController extends BaseController<OrderPulishReceiveDetailBiz, OrderPulishReceiveDetail> {
@Autowired
OrderPulishReceiveService receiveService;
@Autowired
UserFeign userFeign;
@RequestMapping(value = "add", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "确认订单")
public ObjectRestResponse<BaseOrder> add(@RequestBody PulishReceiveBO bo) {
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
//查询优惠券
receiveService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder());
}
@PostMapping(value = "app/unauth/refund")
@ResponseBody
@ApiOperation(value = "退款")
@IgnoreUserToken
public ObjectRestResponse refund(@RequestBody ReceiveRefundDTO receiveRefundDTO) {
receiveService.refund(receiveRefundDTO);
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
...@@ -31,10 +31,12 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -31,10 +31,12 @@ import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.klock.annotation.Klock;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.xxfc.platform.order.entity.SpecialRent.*; import static com.xxfc.platform.order.entity.SpecialRent.*;
import static com.xxfc.platform.order.redis.KlockConstant.SPECIAL_RENT_ENTITY;
@RestController @RestController
@RequestMapping("/chw/specialRent") @RequestMapping("/chw/specialRent")
...@@ -160,6 +162,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia ...@@ -160,6 +162,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
@RequestMapping(value = "/app/specialOrder", method = RequestMethod.POST) @RequestMapping(value = "/app/specialOrder", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "特惠租车下单") @ApiOperation(value = "特惠租车下单")
@Klock(name = SPECIAL_RENT_ENTITY, keys = {"#dto.specialId"})
public ObjectRestResponse specialOrder(@RequestBody SpecialOrderDTO dto) { public ObjectRestResponse specialOrder(@RequestBody SpecialOrderDTO dto) {
//查询列表数据 //查询列表数据
......
package com.xxfc.platform.order.service;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.pojo.dto.ReceiveRefundDTO;
import com.xxfc.platform.order.pojo.order.PulishReceiveBO;
import com.xxfc.platform.order.pojo.price.OrderPriceVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Service
@Log4j
public class OrderPulishReceiveService extends AbstractOrderHandle<OrderPulishReceiveDetailBiz, PulishReceiveBO> implements UserRestInterface {
@Autowired
VehicleFeign vehicleFeign;
@Autowired
ThirdFeign thirdFeign;
@Autowired
OrderAccountBiz orderAccountBiz;
@Autowired
BaseOrderBiz baseOrderBiz;
private static Integer IS_CHILD = 1;
private static Integer LEVEL_DEFAULT = 0;
private static Integer NUMBER_ZERO = 0;
private static Long autoCancelTime;
@Autowired
OrderCostDetailBiz orderCostDetailBiz;
@Autowired
OrderTemplateBiz orderTemplateBiz;
@Autowired
protected UserAuthConfig userAuthConfig;
@Autowired
ActivityFeign activityFeign;
@Autowired
public HttpServletRequest request;
private SimpleDateFormat simleFormatter = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
private DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("YYYYMMddHHmmss");
@PostConstruct
public void init() {
this.channel = null;
this.orderTypeEnum = OrderTypeEnum.PUBLISH;
}
@Override
public void initDetail(PulishReceiveBO bo) {
super.initDetail(bo);
initDictionary();
}
public void initDictionary() {
dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
this.autoCancelTime = Long.valueOf(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.ACT_MEMBER).getDetail());
}
@Override
public void handleDetail(PulishReceiveBO bo) {
//设置订单状态为3
bo.getOrder().setStatus(OrderStatusEnum.ORDER_UNPAY.getCode());
List<VehiclePublishReceiveVo> receiveVos = bo.getReceiveVos();
if (receiveVos.size() > 0 ){
VehiclePublishReceiveVo receiveVo = receiveVos.get(0);
//设置订单图片
bo.getOrder().setPicture(receiveVo.getCover());
//设置订单名称
bo.getOrder().setName(receiveVo.getName());
}
super.handleDetail(bo);
//发送定时取消订单(30分钟)
rabbitProduct.sendDelayMessage(bo.getOrder(), autoCancelTime);
}
@Override
public void handleCalculate(PulishReceiveBO bo) {
OrderPriceVO tpv = calculatePrice(bo);
BeanUtil.copyProperties(tpv, bo.getOrder());
BeanUtil.copyProperties(tpv, bo);
}
@Override
public OrderPriceVO calculatePrice(PulishReceiveBO detail) {
BigDecimal orderAmount = BigDecimal.ZERO;
BigDecimal goodsAmount = BigDecimal.ZERO;
BigDecimal realAmount = BigDecimal.ZERO;
BigDecimal couponAmount = BigDecimal.ZERO;
//设置Item
/* OrderItem memberOrderItem = orderItemBiz.initOrderItem(detail.getBaseUserMemberLevel().getPrice(), 1, detail.getBaseUserMemberLevel().getName(), detail.getBaseUserMemberLevel().getId() + "", ItemTypeEnum.MEMBER);
detail.setItems(new ArrayList<OrderItem>());
detail.getItems().add(memberOrderItem);*/
List<VehiclePublishReceiveVo> receiveVos = detail.getReceiveVos();
BigDecimal receiveAmount = BigDecimal.ZERO;
if (receiveVos.size() > 0 ) {
if (detail.getType().equals(1)){
receiveAmount = receiveVos.parallelStream().filter(oadTemp ->
(Integer.valueOf(VehiclePublishReceiveDTO.ADD).equals(oadTemp.getStatus()))
).map(VehiclePublishReceiveVo::getReceiveAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
}else {
receiveAmount = receiveVos.parallelStream().filter(oadTemp ->
(Integer.valueOf(VehiclePublishReceiveDTO.PAY).equals(oadTemp.getStatus()))
).map(VehiclePublishReceiveVo::getPublishAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
}
}
//商品价格
goodsAmount = goodsAmount.add(receiveAmount);
/* //vehicleAmount 优惠券处理
if (null != detail.getTickerNo() && detail.getTickerNo().size() > 0) {
couponAmount = activityFeign.use(detail.getOrder().getUserId(), detail.getTickerNo(), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if (couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().stream().collect(Collectors.joining(",")));
detail.getOrder().setHasDiscount(SYS_TRUE);
memberOrderItem.handleCouponAmount(couponAmount);
}
}*/
//订单总价格
orderAmount = orderAmount.add(goodsAmount);
//真实价格
realAmount = realAmount.add(orderAmount).subtract(couponAmount);
//生成订单明细
OrderPriceVO opv = new OrderPriceVO();
opv.setOrderAmount(orderAmount);
opv.setGoodsAmount(goodsAmount);
opv.setRealAmount(realAmount);
opv.setCouponAmount(couponAmount);
return opv;
}
public void refund(ReceiveRefundDTO receiveRefundDTO){
BaseOrder baseOrder = baseOrderBiz.selectOne(new BaseOrder() {{
setNo(receiveRefundDTO.getOrderNo());
}});
if (baseOrder == null || !baseOrder.getHasPay().equals(SYS_TRUE)){
throw new BaseException("该订单无法退款", ResultCode.FAILED_CODE);
}
String refundDesc = receiveRefundDTO.getRefundDesc();
BigDecimal realAmount = baseOrder.getRealAmount();
BigDecimal deductAmount = realAmount.subtract(receiveRefundDTO.getRefundAmount());
orderAccountBiz.publishRefundProcess(baseOrder, refundDesc, baseOrder.getRealAmount(), deductAmount);
}
}
...@@ -45,6 +45,11 @@ public class VehiclePublishGoods implements Serializable { ...@@ -45,6 +45,11 @@ public class VehiclePublishGoods implements Serializable {
private Integer number; private Integer number;
@Column(name = "receive_number")
@ApiModelProperty(value = "已接数量")
private Integer receiveNumber;
@Column(name = "receive_amount") @Column(name = "receive_amount")
@ApiModelProperty(value = "接单者服务费(单个商品)") @ApiModelProperty(value = "接单者服务费(单个商品)")
private BigDecimal receiveAmount; private BigDecimal receiveAmount;
......
...@@ -3,10 +3,7 @@ package com.xxfc.platform.vehicle.entity; ...@@ -3,10 +3,7 @@ package com.xxfc.platform.vehicle.entity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -40,11 +37,46 @@ public class VehiclePublishReceive implements Serializable { ...@@ -40,11 +37,46 @@ public class VehiclePublishReceive implements Serializable {
private String vehicleId; private String vehicleId;
@Column(name = "name")
@ApiModelProperty(value = "商品名称")
private String name;
@Column(name = "goods_type")
@ApiModelProperty(value = "商品类型 1--房车;2--机车;3--游艇;4-豪车")
private Integer goodsType;
@Column(name = "brand_id")
@ApiModelProperty(value = "品牌id")
private Integer brandId;
@Column(name = "category_id")
@ApiModelProperty(value = "型号id")
private Integer categoryId;
@Column(name = "cover")
@ApiModelProperty(value = "封面")
private String cover;
@Column(name = "extension_list")
@ApiModelProperty(value = "扩展信息(逗号隔开)")
private String extensionList;
@Column(name = "publish_goods_id") @Column(name = "publish_goods_id")
@ApiModelProperty(value = "需求子id") @ApiModelProperty(value = "需求子id")
private Integer publishGoodsId; private Integer publishGoodsId;
@Column(name = "receive_user_id")
@ApiModelProperty(value = "接单人id")
private Integer receiveUserId;
@Column(name = "receive_company_id") @Column(name = "receive_company_id")
@ApiModelProperty(value = "接单公司id") @ApiModelProperty(value = "接单公司id")
private Integer receiveCompanyId; private Integer receiveCompanyId;
......
...@@ -32,7 +32,7 @@ public class VehicleUseTime implements Serializable { ...@@ -32,7 +32,7 @@ public class VehicleUseTime implements Serializable {
@Column(name = "vehicle_id") @Column(name = "vehicle_id")
@ApiModelProperty(value = "商品id") @ApiModelProperty(value = "商品id")
private Integer vehicleId; private String vehicleId;
@Column(name = "company_id") @Column(name = "company_id")
...@@ -41,6 +41,12 @@ public class VehicleUseTime implements Serializable { ...@@ -41,6 +41,12 @@ public class VehicleUseTime implements Serializable {
@Column(name = "publish_id")
@ApiModelProperty(value = "需求id")
private Integer publishId;
@Column(name = "start_time") @Column(name = "start_time")
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
private Long startTime; private Long startTime;
......
...@@ -266,4 +266,7 @@ public interface VehicleFeign { ...@@ -266,4 +266,7 @@ public interface VehicleFeign {
@RequestMapping(value = "/vehicleInfo/rent/apply/usable-vehicle", method = RequestMethod.POST) @RequestMapping(value = "/vehicleInfo/rent/apply/usable-vehicle", method = RequestMethod.POST)
public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd); public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd);
@PostMapping("app/publishAeceive/app/unauth/updReceive")
ObjectRestResponse updReceive(@RequestBody VehiclePublishReceiveDTO publishReceiveDTO);
} }
...@@ -27,6 +27,13 @@ public class VehiclePublishFindDTO extends PageParam implements DataInter { ...@@ -27,6 +27,13 @@ public class VehiclePublishFindDTO extends PageParam implements DataInter {
private Integer type; private Integer type;
@ApiModelProperty("类型:1-我的发布;2-我的接单")
private Integer receivetype;
@ApiModelProperty("子需求id")
private Integer publishGoodsId;
@ApiModelProperty("类型:1-调度信息;2-我的发布") @ApiModelProperty("类型:1-调度信息;2-我的发布")
private Integer selectType; private Integer selectType;
...@@ -43,6 +50,8 @@ public class VehiclePublishFindDTO extends PageParam implements DataInter { ...@@ -43,6 +50,8 @@ public class VehiclePublishFindDTO extends PageParam implements DataInter {
@ApiModelProperty("当前时间") @ApiModelProperty("当前时间")
private Long nowTime; private Long nowTime;
private String orderNo;
List<Integer> dataCorporationIds; List<Integer> dataCorporationIds;
......
package com.xxfc.platform.vehicle.pojo.dto;
import com.xxfc.platform.vehicle.entity.VehiclePublish;
import com.xxfc.platform.vehicle.entity.VehiclePublishReceive;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class VehiclePublishReceiveDTO{
public static final int ADD=0;//接单添加
public static final int PAY=1;//接单支付
public static final int REFUSE=2;//确认全部拒绝
public static final int AGREE=3;//确认
public static final int CANCEL=4;//取消
public static final int COLLECT=5;//收车
@ApiModelProperty("需求Id")
private Integer publishId;
@ApiModelProperty("类型:1-接单者;2-发布者")
private Integer type;
@ApiModelProperty("接单公司Id")
private Integer companyId;
@ApiModelProperty("接单用户Id")
private Integer userId;
List<Integer> ids;
@ApiModelProperty(value = "接单ids(逗号隔开)")
private String receiveIds;
@ApiModelProperty(value = "拒绝的接单ids")
private String refuseReceiveIds;
private Integer status;
@ApiModelProperty("需求详情")
VehiclePublish vehiclePublish;
@ApiModelProperty("接单详情")
List<VehiclePublishReceiveVo> receiveVos;
private String orderNo;
private BigDecimal goodsAmount;
private BigDecimal payAmount;
private Long nowTime;
public Long getNowTime(){
return System.currentTimeMillis();
}
}
package com.xxfc.platform.vehicle.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class VehicleReceiveRefundDTO {
@ApiModelProperty("需求id")
private Integer publishId;
private String orderNoStr;
}
package com.xxfc.platform.vehicle.pojo.vo;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.VehiclePublishReceive;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class ReceiveVo extends VehiclePublishReceive {
@ApiModelProperty("总数")
Long number;
@ApiModelProperty("待确认数量")
Long waitNumber;
@ApiModelProperty("确认数量")
Long confirmNumber;
@ApiModelProperty("拒绝数量")
Long refusedNumber;
private BigDecimal payAmount;
private BigDecimal goodsAmount;
private BigDecimal refusedAmount;
@ApiModelProperty("按钮状态:1-待确认;2-已确认;3-已完成;4-已取消")
private Integer buttonState;
@ApiModelProperty("发布公司")
BranchCompany publishCompany;
@ApiModelProperty("需求id")
private Integer publishId;
@ApiModelProperty("类型:1-我要车;2-我有车")
private Integer type;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("状态str")
private String statusStr;
@ApiModelProperty("接单ids")
private String ids;
private List<VehiclePublishGoodsVo> publishGoodsVos;
private List<VehiclePublishReceiveVo> publishReceiveVos;
}
...@@ -29,4 +29,7 @@ public class UsableVeicleVO extends Vehicle { ...@@ -29,4 +29,7 @@ public class UsableVeicleVO extends Vehicle {
@ApiModelProperty(value = "公里数") @ApiModelProperty(value = "公里数")
BigDecimal distance; BigDecimal distance;
private String manageProvinceName;
private String manageCityName;
} }
...@@ -18,5 +18,12 @@ public class VehiclePublishGoodsVo extends VehiclePublishGoods { ...@@ -18,5 +18,12 @@ public class VehiclePublishGoodsVo extends VehiclePublishGoods {
@ApiModelProperty("型号名称") @ApiModelProperty("型号名称")
String categoryName; String categoryName;
private List<VehicleExtensionVO> extensionVOS; @ApiModelProperty("商品数量")
Integer goodsNumber;
List<VehicleExtensionVO> extensionVOS;
List<VehiclePublishReceiveVo> receiveVos;
} }
package com.xxfc.platform.vehicle.pojo.vo;
import com.xxfc.platform.vehicle.entity.VehiclePublishReceive;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class VehiclePublishReceiveVo extends VehiclePublishReceive {
@ApiModelProperty("品牌名称")
String brandName;
@ApiModelProperty("型号名称")
String categoryName;
@ApiModelProperty("车牌号")
String numberPlate;
@ApiModelProperty("数量")
Long number;
@ApiModelProperty("待确认数量")
Long waitNumber;
@ApiModelProperty("按钮状态:1-确认;2-收车;3-完成")
private Integer buttonState;
@ApiModelProperty("用户名")
String userName;
private List<VehicleExtensionVO> extensionVOS;
@ApiModelProperty("接单公司")
String receiveCompanyName;
@ApiModelProperty("发布公司")
String publishCompanyName;
@ApiModelProperty("需求id")
private Integer publishId;
@ApiModelProperty("接单者服务费(单个商品)")
private BigDecimal receiveAmount;
@ApiModelProperty("发布服务费(单个商品)")
private BigDecimal publishAmount;
@ApiModelProperty("状态str")
private String statusStr;
@ApiModelProperty("接单ids")
private String ids;
@ApiModelProperty("编号")
String code;
private List<VehiclePublishReceiveVo> publishReceiveVos;
}
...@@ -18,4 +18,25 @@ public class VehiclePublishVo extends VehiclePublish { ...@@ -18,4 +18,25 @@ public class VehiclePublishVo extends VehiclePublish {
@ApiModelProperty("需求商品") @ApiModelProperty("需求商品")
List<VehiclePublishGoodsVo> publishGoodsVos; List<VehiclePublishGoodsVo> publishGoodsVos;
@ApiModelProperty("状态描述")
String statusStr;
public String getStatusStr(){
Integer status = getStatus() == null ? 0 : getStatus();
if (status.equals(1) || status.equals(3)){
statusStr = "已结束";
}else if (status.equals(2)){
statusStr = "待收藏";
}else if (status.equals(0)){
if (getConfirmNumber() != null && getConfirmNumber() > 0){
statusStr = "已接"+getConfirmNumber()+"辆";
}else {
statusStr = "接单中";
}
}
return statusStr;
}
} }
...@@ -41,6 +41,7 @@ import com.xxfc.platform.vehicle.pojo.dto.VehicleFindAppDTO; ...@@ -41,6 +41,7 @@ import com.xxfc.platform.vehicle.pojo.dto.VehicleFindAppDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehicleFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto; import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO; import com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleExtensionVO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleVO; import com.xxfc.platform.vehicle.pojo.vo.VehicleVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
...@@ -1786,6 +1787,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1786,6 +1787,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
vehicleVO.setStatusText(statusText); vehicleVO.setStatusText(statusText);
vehicleVO.setHandleOption(handleOption); vehicleVO.setHandleOption(handleOption);
vehicleVO.setVehicleTitle(vehicleTitle); vehicleVO.setVehicleTitle(vehicleTitle);
vehicleVO.setExtensionVOS(extensionBiz.getTree(vehicleId));
} }
} }
......
...@@ -133,6 +133,11 @@ public class VehicleExtensionBiz extends BaseBiz<VehicleEextensionMapper, Vehicl ...@@ -133,6 +133,11 @@ public class VehicleExtensionBiz extends BaseBiz<VehicleEextensionMapper, Vehicl
} }
public String getExtensionIds(String vehicleId){
return mapper.getExtensionIds(vehicleId);
}
......
...@@ -11,15 +11,19 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode; ...@@ -11,15 +11,19 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign; import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehiclePublish; import com.xxfc.platform.vehicle.entity.VehiclePublish;
import com.xxfc.platform.vehicle.entity.VehiclePublishGoods; import com.xxfc.platform.vehicle.entity.VehiclePublishGoods;
import com.xxfc.platform.vehicle.entity.VehiclePublishReceive;
import com.xxfc.platform.vehicle.mapper.VehiclePublishMapper; import com.xxfc.platform.vehicle.mapper.VehiclePublishMapper;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishVo; import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -36,7 +40,15 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl ...@@ -36,7 +40,15 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl
@Autowired @Autowired
ConfigFeign configFeign; ConfigFeign configFeign;
@Autowired
VehicleBiz vehicleBiz;
@Autowired
VehiclePublishReceiveBiz publishReceiveBiz;
@Transactional(rollbackFor = Exception.class)
public void addOrUpd(VehiclePublish vehiclePublish){ public void addOrUpd(VehiclePublish vehiclePublish){
List<VehiclePublishGoods> goodsList = vehiclePublish.getPublishGoodsList(); List<VehiclePublishGoods> goodsList = vehiclePublish.getPublishGoodsList();
if (CollectionUtils.isEmpty(goodsList)){ if (CollectionUtils.isEmpty(goodsList)){
...@@ -47,6 +59,10 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl ...@@ -47,6 +59,10 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl
Integer id = vehiclePublish.getId(); Integer id = vehiclePublish.getId();
JSONObject config = getConfig(); JSONObject config = getConfig();
for (VehiclePublishGoods publishGoods : goodsList){ for (VehiclePublishGoods publishGoods : goodsList){
String vehicleId = publishGoods.getVehicleId();
if (StringUtils.isNotBlank(vehicleId)){
checkVehiclePublish(vehicleId);
}
publishGoods.setId(null); publishGoods.setId(null);
publishGoods.setPublishId(id); publishGoods.setPublishId(id);
publishGoods.setGoodsType(vehiclePublish.getGoodsType()); publishGoods.setGoodsType(vehiclePublish.getGoodsType());
...@@ -57,6 +73,23 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl ...@@ -57,6 +73,23 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl
} }
public void checkVehiclePublish(String vehicleId){
Vehicle vehicle = vehicleBiz.selectById(vehicleId);
if (vehicle == null ){
throw new BaseException(vehicle.getName()+"不存在",ResultCode.FAILED_CODE);
}
VehiclePublishGoods vehiclePublishGoods = publishGoodsBiz.getGoods(vehicleId);
if (vehiclePublishGoods != null ){
throw new BaseException(vehicle.getName()+"已存在无法发布",ResultCode.FAILED_CODE);
}
VehiclePublishReceive publishReceive = publishReceiveBiz.getReceivByVehicleId(vehicleId);
if (publishReceive != null ){
throw new BaseException(vehicle.getName()+"已接单无法发布",ResultCode.FAILED_CODE);
}
}
...@@ -81,6 +114,17 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl ...@@ -81,6 +114,17 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl
} }
public VehiclePublishVo detail(VehiclePublishFindDTO publishFindDTO){
PageDataVO<VehiclePublishVo> pageDataVO = selectList(publishFindDTO);
List<VehiclePublishVo> list = pageDataVO.getData();
VehiclePublishVo publishVo = new VehiclePublishVo();
if (CollectionUtils.isNotEmpty(list)){
publishVo=list.get(0);
}
return publishVo;
}
//入驻规则管理 //入驻规则管理
public JSONObject getConfig(){ public JSONObject getConfig(){
...@@ -98,6 +142,16 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl ...@@ -98,6 +142,16 @@ public class VehiclePublishBiz extends BaseBiz<VehiclePublishMapper, VehiclePubl
} }
public void updWaitConfirmNumber(Integer number,Integer id){
mapper.updWaitConfirmNumber(number,id);
}
public void updConfirmNumber(Integer number,Integer id){
mapper.updConfirmNumber(number,id);
}
......
...@@ -2,12 +2,17 @@ package com.xxfc.platform.vehicle.biz; ...@@ -2,12 +2,17 @@ package com.xxfc.platform.vehicle.biz;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.tour.dto.TourUserScoreListDTO;
import com.xxfc.platform.vehicle.entity.VehiclePublishGoods; import com.xxfc.platform.vehicle.entity.VehiclePublishGoods;
import com.xxfc.platform.vehicle.mapper.VehiclePublishGoodsMapper; import com.xxfc.platform.vehicle.mapper.VehiclePublishGoodsMapper;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleExtensionVO; import com.xxfc.platform.vehicle.pojo.vo.VehicleExtensionVO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo; import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -17,6 +22,8 @@ import org.springframework.stereotype.Service; ...@@ -17,6 +22,8 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -28,11 +35,31 @@ public class VehiclePublishGoodsBiz extends BaseBiz<VehiclePublishGoodsMapper, V ...@@ -28,11 +35,31 @@ public class VehiclePublishGoodsBiz extends BaseBiz<VehiclePublishGoodsMapper, V
@Autowired @Autowired
VehicleExtensionBiz extensionBiz; VehicleExtensionBiz extensionBiz;
@Autowired
VehiclePublishReceiveBiz publishReceiveBiz;
@Autowired
UserFeign userFeign;
public List<VehiclePublishGoodsVo> getList(VehiclePublishFindDTO publishFindDTO){ public List<VehiclePublishGoodsVo> getList(VehiclePublishFindDTO publishFindDTO){
List<VehiclePublishGoodsVo> list = mapper.selectList(publishFindDTO); List<VehiclePublishGoodsVo> list = mapper.selectList(publishFindDTO);
setGoodsList(list,publishFindDTO);
return list;
}
public List<VehiclePublishGoodsVo> getListByOrderNo(VehiclePublishFindDTO publishFindDTO){
List<VehiclePublishGoodsVo> list = mapper.selectListByOrderNo(publishFindDTO);
setGoodsList(list,publishFindDTO);
return list;
}
public void setGoodsList(List<VehiclePublishGoodsVo> list,VehiclePublishFindDTO publishFindDTO){
Integer receivetype = publishFindDTO.getReceivetype() == null ? 0 : publishFindDTO.getReceivetype();
if (CollectionUtils.isNotEmpty(list)){ if (CollectionUtils.isNotEmpty(list)){
for (VehiclePublishGoodsVo publishGoodsVo : list){ for (VehiclePublishGoodsVo publishGoodsVo : list){
String vehicleId = publishGoodsVo.getVehicleId(); String vehicleId = publishGoodsVo.getVehicleId();
...@@ -46,9 +73,74 @@ public class VehiclePublishGoodsBiz extends BaseBiz<VehiclePublishGoodsMapper, V ...@@ -46,9 +73,74 @@ public class VehiclePublishGoodsBiz extends BaseBiz<VehiclePublishGoodsMapper, V
} }
} }
publishGoodsVo.setExtensionVOS(extensionVOS); publishGoodsVo.setExtensionVOS(extensionVOS);
if (receivetype > 0)
setReceive(publishGoodsVo,publishFindDTO);
} }
} }
return list; }
public void setReceive(VehiclePublishGoodsVo publishGoodsVo,VehiclePublishFindDTO publishFindDTO){
publishFindDTO.setPublishGoodsId(publishGoodsVo.getId());
List<VehiclePublishReceiveVo> list = publishReceiveBiz.getListByUserId(publishFindDTO);
if (CollectionUtils.isNotEmpty(list)){
List<Integer> userIds = list.stream().map(VehiclePublishReceiveVo::getReceiveUserId).distinct().collect(Collectors.toList());
List<AppUserVo> appUserVos = userFeign.getByUserIds(userIds).getData();
if (log.isDebugEnabled()){
log.debug("根据用户ids查询出用户信息:【{}】",appUserVos);
}
Map<Integer, AppUserVo> userMap = appUserVos.stream().collect(Collectors.toMap(AppUserVo::getUserid, Function.identity()));
for (VehiclePublishReceiveVo receiveVo : list){
AppUserVo appUserVo = userMap.get(receiveVo.getReceiveUserId());
if (appUserVo != null ){
receiveVo.setUserName(appUserVo.getUsername());
}
String statusStr = receiveVo.getStatusStr();
if (StringUtils.isNotBlank(statusStr)){
List<Integer> statusIds = Arrays.asList(statusStr.split(",")).parallelStream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
Long count = statusIds.stream().filter(x->x == 1).count();
count = count == null ? 0L :count;
receiveVo.setWaitNumber(count);
Integer buttonState = 0;
if (count > 0){
buttonState = 1;
}else {
if (statusStr.contains("3")){
buttonState =2;
}else if (statusStr.contains("5"))
buttonState = 3;
}
receiveVo.setButtonState(buttonState);
}
String ids = receiveVo.getIds();
if (StringUtils.isNotBlank(ids)){
List<Integer> idList = Arrays.asList(ids.split(",")).parallelStream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
VehiclePublishReceiveDTO receiveDTO = new VehiclePublishReceiveDTO();
receiveDTO.setIds(idList);
receiveVo.setPublishReceiveVos( publishReceiveBiz.getListByIds(receiveDTO));
}
}
publishGoodsVo.setReceiveVos(list);
}
}
public List<VehiclePublishGoods> getListByPublishId(Integer publishId){
return mapper.groupGoodsIdList(publishId);
}
public void updReceiveNumber(Integer publishId){
List<VehiclePublishGoods> list = getListByPublishId(publishId);
if (CollectionUtils.isNotEmpty(list)){
for (VehiclePublishGoods publishGoods : list){
updateSelectiveById(publishGoods);
}
}
}
public VehiclePublishGoods getGoods(String vehicleId){
return mapper.getGoodsByVehicleId(vehicleId);
} }
......
...@@ -3,10 +3,16 @@ package com.xxfc.platform.vehicle.biz; ...@@ -3,10 +3,16 @@ package com.xxfc.platform.vehicle.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.vehicle.entity.VehicleUseTime; import com.xxfc.platform.vehicle.entity.VehicleUseTime;
import com.xxfc.platform.vehicle.mapper.VehicleUseTimeMapper; import com.xxfc.platform.vehicle.mapper.VehicleUseTimeMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Service @Service
...@@ -15,6 +21,28 @@ public class VehicleUseTimeBiz extends BaseBiz<VehicleUseTimeMapper, VehicleUseT ...@@ -15,6 +21,28 @@ public class VehicleUseTimeBiz extends BaseBiz<VehicleUseTimeMapper, VehicleUseT
public void addOrUpd(VehicleUseTime vehicleUseTime){
String vehicleId = vehicleUseTime.getVehicleId();
if (StringUtils.isBlank(vehicleId) ){
throw new BaseException("参数不能为空", ResultCode.FAILED_CODE);
}
Example example = new Example(VehicleUseTime.class);
example.createCriteria().andEqualTo("vehicleId",vehicleId).andEqualTo("status",1);
List<VehicleUseTime> list = selectByExample(example);
if (list.size() > 0){
VehicleUseTime vehicleUseTime1 = list.get(0);
vehicleUseTime.setId(vehicleUseTime1.getId());
updateSelectiveById(vehicleUseTime);
}else {
Integer companyId = vehicleUseTime.getCompanyId() == null ? 0 :vehicleUseTime.getCompanyId();
if ( companyId == 0){
throw new BaseException("参数不能为空", ResultCode.FAILED_CODE);
}
insertSelective(vehicleUseTime);
}
}
......
...@@ -26,6 +26,9 @@ public class RabbitVehicleConfig extends RabbitCommonConfig { ...@@ -26,6 +26,9 @@ public class RabbitVehicleConfig extends RabbitCommonConfig {
//同步门店信息 //同步门店信息
public static final String VEHICLE_COMPANY_UPD_QUEUE = "vehicle.company:upd.queue"; public static final String VEHICLE_COMPANY_UPD_QUEUE = "vehicle.company:upd.queue";
//接单退款消息
public static final String VEHICLE_RECEVIE_REFUND_QUEUE = "vehicle.recevie:refund.queue";
static { static {
myQueue = new ArrayList<BindDTO>() {{ myQueue = new ArrayList<BindDTO>() {{
...@@ -33,6 +36,8 @@ public class RabbitVehicleConfig extends RabbitCommonConfig { ...@@ -33,6 +36,8 @@ public class RabbitVehicleConfig extends RabbitCommonConfig {
add(new BindDTO(VEHICLE_CORPORATION_UPD_QUEUE, ADMIN_TOPIC, KEY_CORPORATION_UPD)); add(new BindDTO(VEHICLE_CORPORATION_UPD_QUEUE, ADMIN_TOPIC, KEY_CORPORATION_UPD));
//门店 //门店
add(new BindDTO(VEHICLE_COMPANY_UPD_QUEUE, ADMIN_TOPIC, KEY_COMPANY_UPD)); add(new BindDTO(VEHICLE_COMPANY_UPD_QUEUE, ADMIN_TOPIC, KEY_COMPANY_UPD));
//接单退款消息
add(new BindDTO(VEHICLE_RECEVIE_REFUND_QUEUE, VEHICLE_TOPIC, KEY_VEHICLE_RECEIVE));
}}; }};
} }
} }
......
...@@ -6,6 +6,7 @@ import com.xxfc.platform.vehicle.entity.VehicleExtension; ...@@ -6,6 +6,7 @@ import com.xxfc.platform.vehicle.entity.VehicleExtension;
import com.xxfc.platform.vehicle.pojo.dto.VehicleExtensionFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehicleExtensionFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleExtensionVO; import com.xxfc.platform.vehicle.pojo.vo.VehicleExtensionVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper; import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -28,4 +29,7 @@ public interface VehicleEextensionMapper extends Mapper<VehicleExtension>, Selec ...@@ -28,4 +29,7 @@ public interface VehicleEextensionMapper extends Mapper<VehicleExtension>, Selec
List<VehicleExtensionVO> selectListByPlatCata(VehicleExtensionFindDTO vehicleExtensionFindDTO); List<VehicleExtensionVO> selectListByPlatCata(VehicleExtensionFindDTO vehicleExtensionFindDTO);
@Select("SELECT GROUP_CONCAT(cata_id) FROM vehicle_extension WHERE vehicle_id=#{vehicleId} and is_del = 0")
String getExtensionIds(@Param("vehicleId") String vehicleId);
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ package com.xxfc.platform.vehicle.mapper; ...@@ -4,6 +4,8 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehiclePublishGoods; import com.xxfc.platform.vehicle.entity.VehiclePublishGoods;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo; import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper; import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -14,4 +16,23 @@ public interface VehiclePublishGoodsMapper extends Mapper<VehiclePublishGoods>, ...@@ -14,4 +16,23 @@ public interface VehiclePublishGoodsMapper extends Mapper<VehiclePublishGoods>,
List<VehiclePublishGoodsVo> selectList(VehiclePublishFindDTO publishFindDTO); List<VehiclePublishGoodsVo> selectList(VehiclePublishFindDTO publishFindDTO);
List<VehiclePublishGoodsVo> selectListByOrderNo(VehiclePublishFindDTO publishFindDTO);
@Select("SELECT r.publish_goods_id as id,IFNULL(COUNT(r.id),0) as receiveNumber FROM vehicle_publish_receive r \n" +
"\n" +
"LEFT JOIN vehicle_publish_goods g ON r.publish_goods_id = g.id\n" +
"\n" +
"WHERE g.publish_id=#{publishId} and r.`status` in (1,3) and r.is_del = 0\n" +
"\n" +
"GROUP BY r.publish_goods_id")
List<VehiclePublishGoods> groupGoodsIdList(@Param("publishId") Integer publishId );
@Select("SELECT g.* FROM vehicle_publish_goods g\n" +
"\n" +
"LEFT JOIN vehicle_publish p ON g.publish_id=p.id\n" +
"\n" +
"WHERE g.vehicle_id = #{vehicleId} and p.`status` in (0,2)")
VehiclePublishGoods getGoodsByVehicleId(@Param("vehicleId")String vehicleId);
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ package com.xxfc.platform.vehicle.mapper; ...@@ -4,6 +4,8 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehiclePublish; import com.xxfc.platform.vehicle.entity.VehiclePublish;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishVo; import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper; import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -14,4 +16,11 @@ public interface VehiclePublishMapper extends Mapper<VehiclePublish>, SelectById ...@@ -14,4 +16,11 @@ public interface VehiclePublishMapper extends Mapper<VehiclePublish>, SelectById
List<VehiclePublishVo> selectList(VehiclePublishFindDTO publishFindDTO); List<VehiclePublishVo> selectList(VehiclePublishFindDTO publishFindDTO);
@Update("update vehicle_publish set wait_confirm_number=wait_confirm_number+#{number} where id=#{id}")
void updWaitConfirmNumber(@Param("number") Integer number,@Param("id")Integer id);
@Update("update vehicle_publish set confirm_number=confirm_number+#{number},wait_confirm_number=wait_confirm_number-#{number} where id=#{id} and confirm_number >= (confirm_number+#{number}) and (wait_confirm_number-#{number}) >= 0 ")
void updConfirmNumber(@Param("number") Integer number,@Param("id")Integer id);
} }
\ No newline at end of file
...@@ -2,9 +2,36 @@ package com.xxfc.platform.vehicle.mapper; ...@@ -2,9 +2,36 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehiclePublishReceive; import com.xxfc.platform.vehicle.entity.VehiclePublishReceive;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO;
import com.xxfc.platform.vehicle.pojo.vo.ReceiveVo;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper; import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface VehiclePublishReceiveMapper extends Mapper<VehiclePublishReceive>, SelectByIdListMapper<VehiclePublishReceive,Integer> { public interface VehiclePublishReceiveMapper extends Mapper<VehiclePublishReceive>, SelectByIdListMapper<VehiclePublishReceive,Integer> {
List<VehiclePublishReceiveVo> selectList(VehiclePublishReceiveDTO receiveDTO);
void updReceiveById(VehiclePublishReceiveDTO receiveDTO);
String getOrderNoStr(@Param("publishOrderNo") String publishOrderNo,@Param("ids")List<Integer> ids);
List<VehiclePublishReceiveVo> getListByUserId(VehiclePublishFindDTO publishFindDTO);
List<ReceiveVo> selectListByReceive(VehiclePublishFindDTO publishFindDTO);
List<VehiclePublishGoodsVo> getListByNumber(@Param("receiveOrderNo") String receiveOrderNo);
@Select("SELECT * FROM vehicle_publish_receive \n" +
"WHERE vehicle_id = #{vehicleId} and `status` in (0,1,3)")
VehiclePublishReceive getReceivByVehicleId(@Param("vehicleId")String vehicleId);
} }
\ No newline at end of file
package com.xxfc.platform.vehicle.mqhandler;
import cn.hutool.json.JSONUtil;
import com.rabbitmq.client.Channel;
import com.xxfc.platform.vehicle.biz.CompanyInfoBiz;
import com.xxfc.platform.vehicle.biz.VehiclePublishReceiveBiz;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import com.xxfc.platform.vehicle.pojo.dto.VehicleReceiveRefundDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.xxfc.platform.vehicle.config.RabbitVehicleConfig.VEHICLE_CORPORATION_UPD_QUEUE;
import static com.xxfc.platform.vehicle.config.RabbitVehicleConfig.VEHICLE_RECEVIE_REFUND_QUEUE;
@Component
@Slf4j
public class VehicleReceiveMQHandler {
@Autowired
VehiclePublishReceiveBiz publishReceiveBiz;
/**
* 接单退款信息
* @param
*/
@RabbitListener(queues = VEHICLE_RECEVIE_REFUND_QUEUE)
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
log.info("接单退款信息 messageJson:"+ JSONUtil.parse(message));
try {
Thread.sleep(2000L);
}catch (Exception e) {
log.error(e.getMessage(), e);
}
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
String messageId = message.getMessageProperties().getMessageId();
String msg = new String(message.getBody(), "UTF-8");
VehicleReceiveRefundDTO receiveRefundDTO = JSONUtil.toBean(msg, VehicleReceiveRefundDTO.class);
publishReceiveBiz.refundReceiveQueue(receiveRefundDTO);
executorService.shutdown();
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
channel.basicAck(deliveryTag, false);
} catch (Exception e) {
log.info("接收到的消息失败");
try {
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} catch (IOException i) {
log.error(e.getMessage(), i);
}
log.error(e.getMessage(), e);
}
}
});
}
}
...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.util.BeanUtils; ...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.util.BeanUtils;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.VehicleApplyBiz; import com.xxfc.platform.vehicle.biz.VehicleApplyBiz;
import com.xxfc.platform.vehicle.biz.VehiclePublishBiz; import com.xxfc.platform.vehicle.biz.VehiclePublishBiz;
import com.xxfc.platform.vehicle.biz.VehiclePublishGoodsBiz;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleApply; import com.xxfc.platform.vehicle.entity.VehicleApply;
import com.xxfc.platform.vehicle.entity.VehiclePublish; import com.xxfc.platform.vehicle.entity.VehiclePublish;
...@@ -16,6 +17,7 @@ import io.swagger.annotations.Api; ...@@ -16,6 +17,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -29,6 +31,9 @@ import java.util.List; ...@@ -29,6 +31,9 @@ import java.util.List;
@Api(tags = {"商品需求"}) @Api(tags = {"商品需求"})
public class AppVehiclePublishController extends BaseController<VehiclePublishBiz> { public class AppVehiclePublishController extends BaseController<VehiclePublishBiz> {
@Autowired
VehiclePublishGoodsBiz publishGoodsBiz;
...@@ -75,16 +80,27 @@ public class AppVehiclePublishController extends BaseController<VehiclePublishBi ...@@ -75,16 +80,27 @@ public class AppVehiclePublishController extends BaseController<VehiclePublishBi
@ApiModelProperty("详情") @ApiModelProperty("详情")
@IgnoreUserToken @IgnoreUserToken
public ObjectRestResponse detail(VehiclePublishFindDTO publishFindDTO) { public ObjectRestResponse detail(VehiclePublishFindDTO publishFindDTO) {
PageDataVO<VehiclePublishVo> pageDataVO = baseBiz.selectList(publishFindDTO); return ObjectRestResponse.succ(baseBiz.detail(publishFindDTO));
List<VehiclePublishVo> list = pageDataVO.getData(); }
VehiclePublishVo publishVo = new VehiclePublishVo();
if (CollectionUtils.isNotEmpty(list)){
publishVo=list.get(0); @GetMapping("orderDetail")
} @ApiModelProperty("订单详情")
return ObjectRestResponse.succ(publishVo); public ObjectRestResponse orderDetail(VehiclePublishFindDTO publishFindDTO) {
return ObjectRestResponse.succ(publishGoodsBiz.getListByOrderNo(publishFindDTO));
} }
@GetMapping("publishDetail")
@ApiModelProperty("我的发布详情")
@IgnoreUserToken
public ObjectRestResponse publishDetail(VehiclePublishFindDTO publishFindDTO) {
publishFindDTO.setReceivetype(1);
return ObjectRestResponse.succ(baseBiz.detail(publishFindDTO));
}
......
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.biz.VehiclePublishReceiveBiz;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("app/publishAeceive")
@Api(tags = {"商品需求"})
public class AppVehiclePublishReceiveController extends BaseController<VehiclePublishReceiveBiz> {
@PostMapping("meet")
@ApiModelProperty("接单")
public ObjectRestResponse meet(@RequestBody VehiclePublishReceiveDTO publishReceiveDTO) throws Exception {
setPublishReceiveDTO(publishReceiveDTO);
return ObjectRestResponse.succ(baseBiz.receive(publishReceiveDTO));
}
@PostMapping("confirmOrder")
@ApiModelProperty("确认订单")
public ObjectRestResponse confirmOrder(@RequestBody VehiclePublishReceiveDTO publishReceiveDTO) throws Exception {
setPublishReceiveDTO(publishReceiveDTO);
return ObjectRestResponse.succ(baseBiz.confirmOrder(publishReceiveDTO));
}
public void setPublishReceiveDTO(VehiclePublishReceiveDTO publishReceiveDTO)throws Exception{
if (publishReceiveDTO.getCompanyId() == null || publishReceiveDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
publishReceiveDTO.setCompanyId(companyIds.get(0));
}
}
publishReceiveDTO.setUserId(Integer.parseInt(getUserId()));
}
@PostMapping("app/unauth/updReceive")
@ApiModelProperty("支付后处理")
@IgnoreUserToken
public ObjectRestResponse updReceive(@RequestBody VehiclePublishReceiveDTO publishReceiveDTO) {
baseBiz.updOrderReceive(publishReceiveDTO);
return ObjectRestResponse.succ();
}
@GetMapping("selectList")
@ApiModelProperty("我的接单")
public ObjectRestResponse selectListByCompany(VehiclePublishFindDTO publishFindDTO) {
if (publishFindDTO.getCompanyId() == null || publishFindDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
publishFindDTO.setCompanyId(companyIds.get(0));
}
}
return ObjectRestResponse.succ(baseBiz.selectList(publishFindDTO));
}
@GetMapping("detail")
@ApiModelProperty("我的接单详情")
public ObjectRestResponse detail(VehiclePublishFindDTO publishFindDTO) {
return ObjectRestResponse.succ(baseBiz.getInfo(publishFindDTO.getOrderNo()));
}
}
...@@ -1118,6 +1118,8 @@ ...@@ -1118,6 +1118,8 @@
<select id="searchUsableVehicle" parameterType="java.util.Map" <select id="searchUsableVehicle" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO"> resultType="com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO">
select v.* select v.*
, bcm.province_name as manageProvinceName
, bcm.city_name as manageCityName
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance ,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if> </if>
...@@ -1187,6 +1189,7 @@ ...@@ -1187,6 +1189,7 @@
</if> </if>
left join vehicle_model vm on v.model_id = vm.id left join vehicle_model vm on v.model_id = vm.id
left join branch_company bc on v.park_branch_company_id = bc.id left join branch_company bc on v.park_branch_company_id = bc.id
left join branch_company bcm on v.manage_company_id = bcm.id
<!-- <if test="startCompanyId != null and endCompanyId != null ">--> <!-- <if test="startCompanyId != null and endCompanyId != null ">-->
<!-- <!--
* 原(大于预约结束时间,小于预约开始时间的预约记录) * 原(大于预约结束时间,小于预约开始时间的预约记录)
......
...@@ -18,5 +18,22 @@ ...@@ -18,5 +18,22 @@
</where> </where>
order by g.number DESC order by g.number DESC
</select> </select>
<select id="selectListByOrderNo" resultType="com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO">
SELECT r.goodsNumber,g.*,IFNULL(b1.cn_name,b.cn_name) as brandName,IFNULL(c1.`name`,c.`name`) as categoryName FROM
(SELECT COUNT(id) as goodsNumber,publish_goods_id FROM vehicle_publish_receive
WHERE receive_order_no = #{orderNo}
GROUP BY publish_goods_id) r
LEFT JOIN vehicle_publish_goods g ON r.publish_goods_id=g.id
LEFT JOIN vehicle v ON g.vehicle_id=v.id
LEFT JOIN vehicle_brand b1 ON v.brand_id=b1.id
LEFT JOIN vehicle_category c1 ON v.category_id=c1.id
LEFT JOIN vehicle_brand b ON g.brand_id=b.id
LEFT JOIN vehicle_category c ON g.category_id=c.id
order by g.number DESC
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
<if test="companyId != null and companyId > 0"> <if test="companyId != null and companyId > 0">
AND p.`company_id`= #{companyId} AND p.`company_id`= #{companyId}
</if> </if>
<if test="publishId != null and publishId > 0">
AND p.`id`= #{publishId}
</if>
<if test="goodsType != null "> <if test="goodsType != null ">
AND p.`goods_type`= #{goodsType} AND p.`goods_type`= #{goodsType}
</if> </if>
......
<?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="com.xxfc.platform.vehicle.mapper.VehiclePublishReceiveMapper">
<select id="selectList" resultType="com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO">
SELECT r.*,
b.cn_name as brandName,
c.`name` categoryName,
bc.`name` as receiveCompanyName,
bc1.`name` as publishCompanyName,
g.`publish_id` as publishId,
g.`receive_amount` as receiveAmount,
g.`publish_amount` as publishAmount
FROM vehicle_publish_receive r
LEFT JOIN vehicle_brand b ON r.brand_id=b.id
LEFT JOIN vehicle_category c ON r.category_id=c.id
LEFT JOIN branch_company bc ON r.receive_company_id = bc.id
LEFT JOIN branch_company bc1 ON r.publish_company_id = bc1.id
LEFT JOIN vehicle_publish_goods g ON r.publish_goods_id=g.id
<where>
r.is_del = 0
<if test="publishId != null and publishId > 0">
AND g.`publish_id`= #{publishId}
</if>
<if test="orderNo != null and orderNo != '' ">
AND r.`receive_order_no`= #{orderNo}
</if>
<if test="ids != null and ids.size > 0">
and r.id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
order by r.id DESC
</select>
<update id="updReceiveById" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO">
UPDATE vehicle_publish_receive SET
<choose>
<when test="type != null and type == 1">
receive_order_no = #{orderNo},receive_time=#{nowTime}
</when>
<otherwise>
publish_order_no = #{orderNo},ack_time=#{nowTime}
</otherwise>
</choose>
WHERE
id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="getOrderNoStr" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO" resultType="java.lang.String">
SELECT GROUP_CONCAT(distinct receive_order_no) FROM vehicle_publish_receive
<where>
<if test="publishOrderNo != null and publishOrderNo != '' ">
and publish_order_no =#{publishOrderNo}
</if>
<if test="ids != null and ids.size > 0">
and id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<select id="getListByUserId" resultType="com.xxfc.platform.vehicle.pojo.vo.VehiclePublishReceiveVo" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO">
SELECT
COUNT(id) as number,
r.receive_user_id as receiveUserId,
r.receive_time as receiveTime,
GROUP_CONCAT(r.`status`) as statusStr,
GROUP_CONCAT(r.id) as ids
FROM vehicle_publish_receive r
WHERE r.publish_goods_id = #{publishGoodsId}
<choose>
<when test="receivetype != null and receivetype == 1">
AND r.`status` in (1,3,5)
</when>
<when test="receivetype != null and receivetype == 2">
AND r.`status` in (1,2,3,5)
</when>
</choose>
GROUP BY r.receive_user_id
</select>
<select id="selectListByReceive" resultType="com.xxfc.platform.vehicle.pojo.vo.ReceiveVo" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePublishReceiveDTO">
SELECT
r.receive_order_no as receiveOrderNo,
COUNT(r.id) as number,
r.receive_company_id as receiveCompanyId,
r.crt_time as crtTime,
p.start_time as startTime,
p.end_time as endTime,
p.id as publishId,
p.type,
GROUP_CONCAT(r.`status`) statusStr,
GROUP_CONCAT(r.`id`) ids,
r.cover,
r.publish_company_id as publishCompanyId,
IFNULL(SUM(g.receive_amount),0) as payAmount,
IFNULL(g.receive_amount,0) as goodsAmount
FROM vehicle_publish_receive r
LEFT JOIN vehicle_publish_goods g ON r.publish_goods_id = g.id
LEFT JOIN vehicle_publish p ON g.publish_id = p.id
<where>
r.is_del = 0
<if test="companyId != null and companyId > 0">
AND r.receive_company_id= #{companyId}
</if>
<if test="orderNo != null and orderNo != '' ">
AND r.receive_order_no= #{orderNo}
</if>
</where>
GROUP BY r.receive_order_no
ORDER BY r.crt_time DESC
</select>
<select id="getListByNumber" resultType="com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo">
SELECT
COUNT(r.id)as goodsNumber,
g.publish_id as publishId,
IFNULL(b1.cn_name,b.cn_name) as brandName,
IFNULL(c1.`name`,c.`name`) as categoryName
FROM vehicle_publish_receive r
LEFT JOIN vehicle_publish_goods g ON r.publish_goods_id = g.id
LEFT JOIN vehicle v ON g.vehicle_id=v.id
LEFT JOIN vehicle_brand b1 ON v.brand_id=b1.id
LEFT JOIN vehicle_category c1 ON v.category_id=c1.id
LEFT JOIN vehicle_brand b ON g.brand_id=b.id
LEFT JOIN vehicle_category c ON g.category_id=c.id
<where>
r.is_del = 0 and r.receive_order_no=#{receiveOrderNo}
</where>
GROUP BY r.publish_goods_id
ORDER BY goodsNumber DESC
</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