Commit 863c2cb3 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev' into dev

parents 9f2e2766 7feca3fb
...@@ -79,6 +79,11 @@ public class BaseUserMemberLevel implements Serializable { ...@@ -79,6 +79,11 @@ public class BaseUserMemberLevel implements Serializable {
@ApiModelProperty(value = "赠送免费天数") @ApiModelProperty(value = "赠送免费天数")
private Integer number; private Integer number;
//免费天数价值
@Column(name = "days_price")
@ApiModelProperty(value = "免费天数价值")
private BigDecimal daysPrice;
@Column(name = "big_icon") @Column(name = "big_icon")
@ApiModelProperty(value = "大图标") @ApiModelProperty(value = "大图标")
private String bigIcon; private String bigIcon;
......
...@@ -87,8 +87,8 @@ public interface UserFeign { ...@@ -87,8 +87,8 @@ public interface UserFeign {
* @param ids * @param ids
* @return * @return
*/ */
@RequestMapping(value = "/public/getByUserIds", method = RequestMethod.GET) @GetMapping(value = "/public/getByUserIds")
public ObjectRestResponse<List<AppUserVo>> getByUserIds(@RequestParam("ids")List<Integer> ids); ObjectRestResponse<List<AppUserVo>> getByUserIds(@RequestParam("ids")List<Integer> ids);
/** /**
* 购买会员 * 购买会员
......
...@@ -93,4 +93,11 @@ public class AppUserVo { ...@@ -93,4 +93,11 @@ public class AppUserVo {
private Integer state; private Integer state;
@ApiModelProperty(value = "支付宝授权返回的code") @ApiModelProperty(value = "支付宝授权返回的code")
private String aliCode; private String aliCode;
@ApiModelProperty(value = "用户职位名称")
private String jobTitle;
@ApiModelProperty(value = "用户会员名称")
private String memberName;
} }
...@@ -21,4 +21,6 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> { ...@@ -21,4 +21,6 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
void updateUserPositionByUserId(@Param("userId") Integer id, @Param("positionId") Integer positionId); void updateUserPositionByUserId(@Param("userId") Integer id, @Param("positionId") Integer positionId);
List<Integer> getUserIdByUsername(@Param("keywords") String keywords); List<Integer> getUserIdByUsername(@Param("keywords") String keywords);
AppUserVo getUserVo();
} }
\ No newline at end of file
...@@ -33,18 +33,55 @@ ...@@ -33,18 +33,55 @@
<result column="code" property="code"/> <result column="code" property="code"/>
<result column="inviter_account" property="inviterAccount"/> <result column="inviter_account" property="inviterAccount"/>
<result column="state" property="state"/> <result column="state" property="state"/>
<result column="jobTitle" property="jobTitle"/>
<result column="memberName" property="memberName"/>
</resultMap> </resultMap>
<!-- 获取用户信息 --> <!-- 获取用户信息 -->
<select id="getUserInfo" resultMap="AppUserVoMap"> <select id="getUserInfo" resultMap="AppUserVoMap">
select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.* from app_user_login l select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as jobTitle,buml.name as memberName from app_user_login l
left join app_user_detail d left join app_user_detail d
on d.userid = l.id on d.userid = l.id
where d.userid = #{userId} limit 1 left join base_user_member bum
on bum.user_id=l.id
left join base_user_member_level buml
on bum.member_level = buml.level
left join app_user_position p
on d.position_id=p.id
where
p.is_del=0
and
buml.isdel=0
and
bum.is_del=0
and
d.userid = #{userId} limit 1
</select> </select>
<!-- &lt;!&ndash; 获取用户信息 &ndash;&gt;-->
<!-- <select id="getUserVo" resultMap="AppUserVoMap">-->
<!-- select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as jobTitle,buml.name as memberName from app_user_login l-->
<!-- left join app_user_detail d-->
<!-- on d.userid = l.id-->
<!-- left join base_user_member bum-->
<!-- on bum.user_id=l.id-->
<!-- left join base_user_member_level buml-->
<!-- on bum.member_level = buml.level-->
<!-- left join app_user_position p-->
<!-- on d.position_id=p.id-->
<!-- where-->
<!-- p.is_del=0-->
<!-- and-->
<!-- buml.isdel=0-->
<!-- and-->
<!-- bum.is_del=0-->
<!-- and-->
<!-- d.userid = #{userId} limit 1-->
<!-- </select>-->
<select id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String"> <select id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String">
select d.userid from app_user_login l select d.userid from app_user_login l
left join app_user_detail d left join app_user_detail d
......
...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.dto.UserInfoDTO; ...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.dto.UserInfoDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.activity.dto.ActivityListDTO; import com.xxfc.platform.activity.dto.ActivityListDTO;
import com.xxfc.platform.activity.dto.ActivityPopularizeRelationDTO; import com.xxfc.platform.activity.dto.ActivityPopularizeRelationDTO;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.entity.IntegralUserTotal; import com.xxfc.platform.activity.entity.IntegralUserTotal;
import com.xxfc.platform.activity.vo.UserCouponVo; import com.xxfc.platform.activity.vo.UserCouponVo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -12,7 +13,9 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -12,7 +13,9 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -73,4 +76,14 @@ public interface ActivityFeign { ...@@ -73,4 +76,14 @@ public interface ActivityFeign {
@ApiOperation("查询活动的时间") @ApiOperation("查询活动的时间")
@GetMapping("/activityList/time/{activityId}") @GetMapping("/activityList/time/{activityId}")
ActivityListDTO findActivityStartTimeAndEndTimeById(@PathVariable(value = "activityId") Integer activityId); ActivityListDTO findActivityStartTimeAndEndTimeById(@PathVariable(value = "activityId") Integer activityId);
@ApiOperation("获取所用优惠卷")
@GetMapping("/coupon/coupons")
Map<String, Coupon> coupons();
@ApiOperation("获取所用优惠卷")
@GetMapping("/coupon/couponsBycouponIds")
List<Coupon> couponsByTickerNoList(@RequestParam(value = "tickerNoList") List<String> tickerNoList);
} }
package com.xxfc.platform.activity.biz; package com.xxfc.platform.activity.biz;
import cn.hutool.core.collection.CollectionUtil;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.activity.constant.CouponUsed; import com.xxfc.platform.activity.constant.CouponUsed;
import com.xxfc.platform.activity.dto.CouponDTO; import com.xxfc.platform.activity.dto.CouponDTO;
import com.xxfc.platform.activity.dto.CouponFindDTO; import com.xxfc.platform.activity.dto.CouponFindDTO;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.entity.UserCoupon;
import com.xxfc.platform.activity.vo.CouponPagVo; import com.xxfc.platform.activity.vo.CouponPagVo;
import com.xxfc.platform.activity.vo.CouponTitleVo; import com.xxfc.platform.activity.vo.CouponTitleVo;
import com.xxfc.platform.activity.vo.CouponVo; import com.xxfc.platform.activity.vo.CouponVo;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.mapper.CouponMapper; import com.xxfc.platform.activity.mapper.CouponMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -17,10 +22,9 @@ import org.springframework.util.CollectionUtils; ...@@ -17,10 +22,9 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
/** /**
* 优惠券表 * 优惠券表
...@@ -31,7 +35,8 @@ import java.util.Objects; ...@@ -31,7 +35,8 @@ import java.util.Objects;
*/ */
@Service @Service
public class CouponBiz extends BaseBiz<CouponMapper, Coupon> { public class CouponBiz extends BaseBiz<CouponMapper, Coupon> {
@Autowired
private UserCouponBiz userCouponBiz;
//获取优惠卷 //获取优惠卷
public Coupon getCouponByUsed(Integer used){ public Coupon getCouponByUsed(Integer used){
...@@ -122,4 +127,20 @@ public class CouponBiz extends BaseBiz<CouponMapper, Coupon> { ...@@ -122,4 +127,20 @@ public class CouponBiz extends BaseBiz<CouponMapper, Coupon> {
public List<CouponTitleVo> getCouponTitleList() { public List<CouponTitleVo> getCouponTitleList() {
return mapper.selectTitles(); return mapper.selectTitles();
} }
public Map<String, Coupon> getCoupons() {
HashMap<String, Coupon> map = Maps.newHashMap();
List<Coupon> coupons = mapper.getCoupons();
if (CollectionUtil.isNotEmpty(coupons)) {
for (Coupon coupon : coupons) {
map.put(coupon.getId().toString(),coupon);
}
}
return map;
}
public List<Coupon> couponsByTickerNoList(List<String> tickerNoList) {
return mapper.couponsByTickerNoList(tickerNoList);
}
} }
\ No newline at end of file
...@@ -2,9 +2,12 @@ package com.xxfc.platform.activity.mapper; ...@@ -2,9 +2,12 @@ package com.xxfc.platform.activity.mapper;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.vo.CouponTitleVo; import com.xxfc.platform.activity.vo.CouponTitleVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 优惠券表 * 优惠券表
...@@ -16,4 +19,9 @@ import java.util.List; ...@@ -16,4 +19,9 @@ import java.util.List;
public interface CouponMapper extends Mapper<Coupon> { public interface CouponMapper extends Mapper<Coupon> {
List<CouponTitleVo> selectTitles(); List<CouponTitleVo> selectTitles();
List<Coupon> getCoupons();
List<Coupon> couponsByTickerNoList(@Param(value = "tickerNoList") List<String> tickerNoList);
} }
...@@ -3,13 +3,30 @@ package com.xxfc.platform.activity.rest; ...@@ -3,13 +3,30 @@ package com.xxfc.platform.activity.rest;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.activity.biz.CouponBiz; import com.xxfc.platform.activity.biz.CouponBiz;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import io.swagger.annotations.ApiOperation;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("coupon") @RequestMapping("coupon")
public class CouponController extends BaseController<CouponBiz, Coupon> { public class CouponController extends BaseController<CouponBiz, Coupon> {
@ApiOperation("获取所用优惠卷")
@GetMapping("/coupons")
public Map<String, Coupon> coupons() {
return baseBiz.getCoupons();
}
@ApiOperation("获取所用优惠卷")
@GetMapping("/couponsBycouponIds")
public List<Coupon> couponsBycouponIds(@RequestParam(value = "tickerNoList") List<String> tickerNoList) {
return baseBiz.couponsByTickerNoList(tickerNoList);
}
} }
\ No newline at end of file
...@@ -40,4 +40,21 @@ ...@@ -40,4 +40,21 @@
<select id="selectTitles" resultType="com.xxfc.platform.activity.vo.CouponTitleVo"> <select id="selectTitles" resultType="com.xxfc.platform.activity.vo.CouponTitleVo">
select `id`,`title` from `coupon` where `is_del`=0 select `id`,`title` from `coupon` where `is_del`=0
</select> </select>
<select id="getCoupons" resultType="com.xxfc.platform.activity.entity.Coupon" >
select id ,title,used_amount from coupon
</select>
<select id="couponsByTickerNoList" resultType="com.xxfc.platform.activity.entity.Coupon">
select c.* from user_coupon u left join coupon c on u.coupon_id=c.id
<where>
u.ticker_no in
<foreach collection="tickerNoList" item="no" index="index" open="(" separator="," close=")">
#{no}
</foreach>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -84,4 +84,6 @@ public class ImQuestion { ...@@ -84,4 +84,6 @@ public class ImQuestion {
*/ */
private Integer source; private Integer source;
private String address;
} }
\ No newline at end of file
package com.xxfc.platform.im.biz; package com.xxfc.platform.im.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -8,6 +10,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -8,6 +10,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant; import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
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.im.dto.MsgTypeEnum; import com.xxfc.platform.im.dto.MsgTypeEnum;
import com.xxfc.platform.im.dto.QuestionParamDto; import com.xxfc.platform.im.dto.QuestionParamDto;
...@@ -51,6 +54,11 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -51,6 +54,11 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
questionParamDto.setUserId(Long.parseLong(appUserLogin.getId() + "")); questionParamDto.setUserId(Long.parseLong(appUserLogin.getId() + ""));
} }
} }
if (questionParamDto.getStartTime() != null) {
if(questionParamDto.getEndTime() == null) {
questionParamDto.setEndTime(System.currentTimeMillis());
}
}
Query query = new Query(questionParamDto); Query query = new Query(questionParamDto);
PageDataVO<QuestionListVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getQuestionList(query.getSuper())); PageDataVO<QuestionListVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getQuestionList(query.getSuper()));
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
...@@ -94,6 +102,19 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -94,6 +102,19 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public ObjectRestResponse update(ImQuestion imQuestion) {
if (imQuestion == null || imQuestion.getId() == null) {
return ObjectRestResponse.paramIsEmpty();
}
ImQuestion oldValue = mapper.selectByPrimaryKey(imQuestion.getId());
if (oldValue == null) {
return ObjectRestResponse.createFailedResult(ResultCode.IM_MSG_NOT_EXIST_CODE, ResultCode.getMsg(ResultCode.IM_MSG_NOT_EXIST_CODE));
}
BeanUtil.copyProperties(imQuestion, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(oldValue);
return ObjectRestResponse.succ();
}
/** /**
* 删除消息,修改isDel为true * 删除消息,修改isDel为true
* *
......
...@@ -47,4 +47,10 @@ public class ImQuestionController { ...@@ -47,4 +47,10 @@ public class ImQuestionController {
public ObjectRestResponse deleteById(Long id) { public ObjectRestResponse deleteById(Long id) {
return imQuestionBiz.deleteById(id); return imQuestionBiz.deleteById(id);
} }
@PostMapping(value = "/bg/app/unauth/update")
@ApiOperation(value = "修改问答信息")
public ObjectRestResponse update(@RequestBody ImQuestion imQuestion) {
return imQuestionBiz.update(imQuestion);
}
} }
...@@ -294,8 +294,18 @@ public class BaseOrder implements Serializable { ...@@ -294,8 +294,18 @@ public class BaseOrder implements Serializable {
@Column(name = "facilitate_phone") @Column(name = "facilitate_phone")
String facilitatePhone; String facilitatePhone;
//支付类型 /**
@ApiModelProperty(value = "支付方式") * 1:微信公众号支付 2.支付宝即时到账,3,银联
*/
@ApiModelProperty(value = "1:微信公众号支付 2.支付宝即时到账,3,银联")
@Column(name = "pay_way") @Column(name = "pay_way")
private Integer payWay; private Integer payWay;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
@Column(name = "remark")
private Integer remark;
} }
...@@ -136,4 +136,8 @@ public class OrderVehicleCrosstown { ...@@ -136,4 +136,8 @@ public class OrderVehicleCrosstown {
private Integer orperaterId; private Integer orperaterId;
private String userLicenseImg; private String userLicenseImg;
private String checkUser;
private String checkTel;
} }
\ No newline at end of file
package com.xxfc.platform.order.pojo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 费用明细
* @author Administrator
*/
@Data
public class DetailsOfExpenses {
private String key;
private String detail;
private BigDecimal val =BigDecimal.ZERO;
}
package com.xxfc.platform.order.pojo.order; package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.DetailsOfExpenses;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
@Data @Data
public class OrderListVo extends BaseOrder { public class OrderListVo extends BaseOrder {
...@@ -44,4 +51,30 @@ public class OrderListVo extends BaseOrder { ...@@ -44,4 +51,30 @@ public class OrderListVo extends BaseOrder {
private List<OrderItem> items; private List<OrderItem> items;
@ApiModelProperty(value = "用户职位名称")
private String jobTitle;
@ApiModelProperty(value = "用户会员名称")
private String memberName;
@ApiModelProperty(value = "随车物品")
private String carArticlesJson;
@ApiModelProperty(value = "使用优惠卷")
List<Coupon> couponList;
@ApiModelProperty(value = "退还优惠卷")
List<Coupon> backCouponList;
/**
* 费用详情
*/
private RentVehiclePriceVO rentVehiclePriceVO;
/**
* 费用明细
*/
private List<Map<String,String>> detailsOfExpenses;
} }
package com.xxfc.platform.order.pojo.order; package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.order.entity.DepositRefundRecord; import com.xxfc.platform.order.entity.DepositRefundRecord;
import com.xxfc.platform.order.entity.OrderVehicleCrosstown; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
@Data @Data
...@@ -35,8 +38,47 @@ public class OrderVehicleCrosstownDto extends OrderVehicleCrosstown { ...@@ -35,8 +38,47 @@ public class OrderVehicleCrosstownDto extends OrderVehicleCrosstown {
private String vehicleNumberPlat; private String vehicleNumberPlat;
/**
* 操作人昵称
*/
private String username; private String username;
List<DepositRefundRecord> depositRefundRecord; List<DepositRefundRecord> depositRefundRecord;
/**
* 操作人
*/
private String operatorName;
/**
* 操作人手机
*/
private String operatorPhone;
/**
* 操作时间
*/
private Long operatorTime;
/**
* 退还优惠卷
*/
private List<Coupon> backCoupons;
private List<DedDetailDTO> dedDetailDTOList;
private List<DedDetailDTO> violateDetailList;
private String types;
private List<String> typeList;
private Integer address;
private Integer showType;
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ public class OrderPriceVO { ...@@ -16,7 +16,7 @@ public class OrderPriceVO {
public BigDecimal realAmount = BigDecimal.ZERO; public BigDecimal realAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "优惠券扣除的费用") @ApiModelProperty(value = "优惠券扣除的费用")
public BigDecimal couponAmount = BigDecimal.ZERO; public BigDecimal couponAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "优惠券扣除的费用") @ApiModelProperty(value = "优惠券描述")
public String couponDesc = ""; public String couponDesc = "";
@ApiModelProperty(value = "参数json") @ApiModelProperty(value = "参数json")
......
...@@ -17,9 +17,9 @@ public class RentVehiclePriceVO extends OrderPriceVO{ ...@@ -17,9 +17,9 @@ public class RentVehiclePriceVO extends OrderPriceVO{
BigDecimal damageSafeAmount = BigDecimal.ZERO; BigDecimal damageSafeAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "押金价格") @ApiModelProperty(value = "押金价格")
BigDecimal deposit = BigDecimal.ZERO; BigDecimal deposit = BigDecimal.ZERO;
@ApiModelProperty(value = "天数") @ApiModelProperty(value = "天数")
Integer dayNum = 0; Integer dayNum = 0;
@ApiModelProperty(value = "车辆天数") @ApiModelProperty(value = "扣除免费天数后的车辆天数")
Integer vehicleDayNum = 0; Integer vehicleDayNum = 0;
@ApiModelProperty(value = "车辆个数") @ApiModelProperty(value = "车辆个数")
Integer vehicleNum = 0; Integer vehicleNum = 0;
......
...@@ -18,6 +18,7 @@ import com.github.wxiaoqi.security.common.util.Query; ...@@ -18,6 +18,7 @@ import com.github.wxiaoqi.security.common.util.Query;
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.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz; import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz; import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
...@@ -748,9 +749,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -748,9 +749,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
switch (sign) { switch (sign) {
case 2: case 2:
sendMsgDTO.setRoutKey(KEY_ORDER_CANCEL); sendMsgDTO.setRoutKey(KEY_ORDER_CANCEL);
// mqSenderFeign.sendMessage(ORDER_TOPIC, KEY_ORDER_CANCEL, JSONUtil.toJsonStr(orderMQDTO));
break; break;
case 4: case 4:
sendMsgDTO.setRoutKey(KEY_ORDER_PAY); sendMsgDTO.setRoutKey(KEY_ORDER_PAY);
// mqSenderFeign.sendMessage(ORDER_TOPIC, KEY_ORDER_PAY, JSONUtil.toJsonStr(orderMQDTO));
break; break;
case 6: case 6:
sendMsgDTO.setRoutKey(KEY_ORDER_FINLISH); sendMsgDTO.setRoutKey(KEY_ORDER_FINLISH);
...@@ -785,6 +788,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -785,6 +788,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
/** /**
* 订单查询类 * 订单查询类
*/ */
...@@ -792,4 +796,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -792,4 +796,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
public static class QueryOrderDetailDTO extends QueryOrderDTO { public static class QueryOrderDetailDTO extends QueryOrderDTO {
private String no; private String no;
} }
/**
* 获取退还优惠卷
* @param orderId
*/
public List<Coupon> getReturnCouponByOrderId(Integer orderId) {
BaseOrder baseOrder = mapper.selectByPrimaryKey(orderId);
String backCoupon = baseOrder.getBackCoupon();
if (StringUtils.isNotBlank(backCoupon)) {
String[] couponArray = backCoupon.split(",");
return activityFeign.couponsByTickerNoList(Lists.newArrayList(couponArray));
}
return Lists.newArrayList();
}
} }
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.xxfc.platform.order.biz; ...@@ -2,6 +2,9 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -11,6 +14,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -11,6 +14,7 @@ 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.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.user.UserInfoBiz; import com.xxfc.platform.activity.user.UserInfoBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz; import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum; import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum;
...@@ -18,6 +22,7 @@ import com.xxfc.platform.order.contant.enumerate.DepositRefundStatus; ...@@ -18,6 +22,7 @@ import com.xxfc.platform.order.contant.enumerate.DepositRefundStatus;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum; import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper; import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO; import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto; import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
...@@ -32,18 +37,22 @@ import com.xxfc.platform.vehicle.pojo.CompanyDetail; ...@@ -32,18 +37,22 @@ import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.VehicleArrivalVo; import com.xxfc.platform.vehicle.pojo.VehicleArrivalVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureVo; import com.xxfc.platform.vehicle.pojo.VehicleDepartureVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.map.HashedMap; import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;
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.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;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.stream.Collectors;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
...@@ -82,7 +91,10 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -82,7 +91,10 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd"); public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
public List<OrderVehicleCrosstownDto> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) { public List<OrderVehicleCrosstownDto> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
if (StringUtils.isNotBlank(orderVehicleCrosstownDto.getTypes())) {
String[] types = orderVehicleCrosstownDto.getTypes().split(",");
orderVehicleCrosstownDto.setTypeList(Lists.newArrayList(types));
}
List<OrderVehicleCrosstownDto> list = mapper.selectByOrderId(orderVehicleCrosstownDto); List<OrderVehicleCrosstownDto> list = mapper.selectByOrderId(orderVehicleCrosstownDto);
for (OrderVehicleCrosstownDto value : list) { for (OrderVehicleCrosstownDto value : list) {
if (value != null && value.getOrperaterId() != null && value.getType() != 1) { if (value != null && value.getOrperaterId() != null && value.getType() != 1) {
...@@ -94,8 +106,38 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -94,8 +106,38 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
} }
} }
} }
if (value.getType() == 2 || value.getType() == 3) {
List<Coupon> c = baseOrderBiz.getReturnCouponByOrderId(value.getOrderId());
value.setBackCoupons(c);
}
if (StringUtils.isNotBlank(value.getDedDetail())) {
List<DedDetailDTO> dddList = JSONUtil.toList(JSONUtil.parseArray(value.getDedDetail()), DedDetailDTO.class);
value.setDedDetailDTOList(dddList);
}
if (StringUtils.isNotBlank(value.getViolateDetail())) {
List<DedDetailDTO> dddList = JSONUtil.toList(JSONUtil.parseArray(value.getViolateDetail()), DedDetailDTO.class);
value.setViolateDetailList(dddList);
}
updateCrossRecord(value); updateCrossRecord(value);
List<DepositRefundRecord> depositRefundRecords = orderDepositRefundRecordBiz.selectByCrossId(value.getId()); List<DepositRefundRecord> depositRefundRecords = orderDepositRefundRecordBiz.selectByCrossId(value.getId());
if ( orderVehicleCrosstownDto.getAddress()!=null&&
1 == orderVehicleCrosstownDto.getAddress() && CollectionUtil.isNotEmpty(depositRefundRecords)) {
depositRefundRecords = depositRefundRecords.parallelStream().filter(e -> {
if (e.getStatus() == 1) {
value.setShowType(1);
return false;
}
if (e.getStatus() == 4) {
value.setShowType(2);
return false;
}
return true;
}).collect(Collectors.toList());
}
value.setDepositRefundRecord(depositRefundRecords == null || depositRefundRecords.size() <= 0 ? null : depositRefundRecords); value.setDepositRefundRecord(depositRefundRecords == null || depositRefundRecords.size() <= 0 ? null : depositRefundRecords);
} }
return list; return list;
...@@ -110,7 +152,11 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -110,7 +152,11 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
if (value.getOrperaterId() != null) { if (value.getOrperaterId() != null) {
ObjectRestResponse<AppUserDTO> objectRestResponse = userFeign.userDetailById(value.getOrperaterId()); ObjectRestResponse<AppUserDTO> objectRestResponse = userFeign.userDetailById(value.getOrperaterId());
if (objectRestResponse.getData() != null) { if (objectRestResponse.getData() != null) {
value.setUsername(objectRestResponse.getData().getNickname()); AppUserDTO data = objectRestResponse.getData();
value.setUsername(data.getNickname());
value.setOperatorName(data.getRealname());
value.setOperatorPhone(data.getUsername());
value.setOperatorTime(value.getCrtTime());
} }
} }
if (value.getUserLicenseId() != null) { if (value.getUserLicenseId() != null) {
...@@ -221,12 +267,8 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -221,12 +267,8 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
} }
vehicleDepartureVo.setUse("用户租车"); vehicleDepartureVo.setUse("用户租车");
vehicleDepartureVo.setBookRecordId(orderRentVehicleDetail.getBookRecordId()); vehicleDepartureVo.setBookRecordId(orderRentVehicleDetail.getBookRecordId());
vehicleDepartureVo.setCheckMan(userDTO.getName()); vehicleDepartureVo.setCheckMan(orderVehicleCrosstownDto.getCheckUser());
if(StringUtils.isNotBlank(orderVehicleCrosstownDto.getLicensePhone())) { vehicleDepartureVo.setCheckManTel(orderVehicleCrosstownDto.getCheckTel());
vehicleDepartureVo.setCheckManTel(orderVehicleCrosstownDto.getLicensePhone());
} else {
vehicleDepartureVo.setCheckManTel("13656235623");
}
try { try {
RestResponse restResponse = vehicleFeign.departureBySmall(vehicleDepartureVo); RestResponse restResponse = vehicleFeign.departureBySmall(vehicleDepartureVo);
log.error("返回信息: " + restResponse.toString()); log.error("返回信息: " + restResponse.toString());
...@@ -238,14 +280,9 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -238,14 +280,9 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
vehicleArrivalVo.setVehicleId(orderRentVehicleDetail.getVehicleId()); vehicleArrivalVo.setVehicleId(orderRentVehicleDetail.getVehicleId());
vehicleArrivalVo.setArrivalBranchCompanyId(userDTO.getCompanyId()); vehicleArrivalVo.setArrivalBranchCompanyId(userDTO.getCompanyId());
vehicleArrivalVo.setMileage(orderVehicleCrosstownDto.getMileage()); vehicleArrivalVo.setMileage(orderVehicleCrosstownDto.getMileage());
vehicleArrivalVo.setRecycleMan(userDTO.getName()); vehicleArrivalVo.setRecycleMan(orderVehicleCrosstownDto.getCheckUser());
vehicleArrivalVo.setRecycleManTel("13656235623"); vehicleArrivalVo.setRecycleManTel(orderVehicleCrosstownDto.getCheckTel());
vehicleArrivalVo.setBookRecordId(orderRentVehicleDetail.getBookRecordId()); vehicleArrivalVo.setBookRecordId(orderRentVehicleDetail.getBookRecordId());
if (appUserDTO != null) {
vehicleArrivalVo.setRecycleManTel(appUserDTO.getUsername());
} else {
vehicleArrivalVo.setRecycleManTel("13565235623");
}
try { try {
RestResponse restResponse = vehicleFeign.arrivalBySmall(vehicleArrivalVo); RestResponse restResponse = vehicleFeign.arrivalBySmall(vehicleArrivalVo);
log.info("返回信息: " + restResponse.toString()); log.info("返回信息: " + restResponse.toString());
...@@ -257,7 +294,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -257,7 +294,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
//定损扣除费用 //定损扣除费用
if (StringUtils.isNotBlank(orderVehicleCrosstownDto.getDedDetail())) { if (StringUtils.isNotBlank(orderVehicleCrosstownDto.getDedDetail())) {
JSONArray jsonArray = JSONArray.parseArray(orderVehicleCrosstownDto.getDedDetail()); JSONArray jsonArray = JSONArray.parseArray(orderVehicleCrosstownDto.getDedDetail());
if(jsonArray != null && jsonArray.size() > 0) { if (jsonArray != null && jsonArray.size() > 0) {
orderVehicleCrosstownDto.setDeduction(true); orderVehicleCrosstownDto.setDeduction(true);
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = JSONObject.parseObject(jsonArray.get(i).toString()); JSONObject jsonObject = JSONObject.parseObject(jsonArray.get(i).toString());
...@@ -270,7 +307,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -270,7 +307,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
//延期扣除费用 //延期扣除费用
if (StringUtils.isNotBlank(orderVehicleCrosstownDto.getViolateDetail())) { if (StringUtils.isNotBlank(orderVehicleCrosstownDto.getViolateDetail())) {
JSONArray jsonArray = JSONArray.parseArray(orderVehicleCrosstownDto.getViolateDetail()); JSONArray jsonArray = JSONArray.parseArray(orderVehicleCrosstownDto.getViolateDetail());
if(jsonArray != null && jsonArray.size() > 0) { if (jsonArray != null && jsonArray.size() > 0) {
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = JSONObject.parseObject(jsonArray.get(i).toString()); JSONObject jsonObject = JSONObject.parseObject(jsonArray.get(i).toString());
if (jsonObject.getString("cost") != null) { if (jsonObject.getString("cost") != null) {
...@@ -326,6 +363,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -326,6 +363,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
private void handleOrderStatus(BaseOrder baseOrder, OrderRentVehicleDetail orderRentVehicleDetail, OrderVehicleCrosstown orderVehicleCrosstown, AppUserDTO appUserDTO) { private void handleOrderStatus(BaseOrder baseOrder, OrderRentVehicleDetail orderRentVehicleDetail, OrderVehicleCrosstown orderVehicleCrosstown, AppUserDTO appUserDTO) {
//交车完成 设置订单状态为出行中 //交车完成 设置订单状态为出行中
BigDecimal totalAmount = orderRentVehicleDetail.getDeposit(); BigDecimal totalAmount = orderRentVehicleDetail.getDeposit();
......
...@@ -41,7 +41,7 @@ public class FeignHeadConfiguration { ...@@ -41,7 +41,7 @@ public class FeignHeadConfiguration {
* 遍历请求头里面的属性字段,将logId和token添加到新的请求头中转发到下游服务 * 遍历请求头里面的属性字段,将logId和token添加到新的请求头中转发到下游服务
* */ * */
if ("Authorization".equalsIgnoreCase(name)) { if ("Authorization".equalsIgnoreCase(name)) {
log.debug("添加自定义请求头key:" + name + ",value:" + value); // log.debug("添加自定义请求头key:" + name + ",value:" + value);
requestTemplate.header(name, value); requestTemplate.header(name, value);
} else { } else {
//log.debug("FeignHeadConfiguration", "非自定义请求头key:" + name + ",value:" + value + "不需要添加!"); //log.debug("FeignHeadConfiguration", "非自定义请求头key:" + name + ",value:" + value + "不需要添加!");
......
...@@ -3,6 +3,9 @@ package com.xxfc.platform.order.rest; ...@@ -3,6 +3,9 @@ package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
...@@ -17,6 +20,9 @@ import com.github.wxiaoqi.security.common.rest.CommonBaseController; ...@@ -17,6 +20,9 @@ import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
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.google.common.collect.Lists;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.BaseOrderBiz; import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderItemBiz; import com.xxfc.platform.order.biz.OrderItemBiz;
import com.xxfc.platform.order.biz.OrderRentVehicleBiz; import com.xxfc.platform.order.biz.OrderRentVehicleBiz;
...@@ -24,8 +30,10 @@ import com.xxfc.platform.order.biz.OrderUserLicenseBiz; ...@@ -24,8 +30,10 @@ import com.xxfc.platform.order.biz.OrderUserLicenseBiz;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum; import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.entity.OrderItem; import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail; import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.DetailsOfExpenses;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO; import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import com.xxfc.platform.order.pojo.order.*; import com.xxfc.platform.order.pojo.order.*;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.order.service.OrderRentVehicleService; import com.xxfc.platform.order.service.OrderRentVehicleService;
import com.xxfc.platform.tour.entity.TourUser; import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
...@@ -39,15 +47,19 @@ import com.xxfc.platform.vehicle.pojo.BookVehicleVO; ...@@ -39,15 +47,19 @@ import com.xxfc.platform.vehicle.pojo.BookVehicleVO;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import jodd.util.StringUtil;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
...@@ -82,12 +94,16 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -82,12 +94,16 @@ public class BackStageOrderController extends CommonBaseController implements Us
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Autowired
ActivityFeign activityFeign;
@Autowired @Autowired
TourFeign tourFeign; TourFeign tourFeign;
@Resource @Resource
VehicleFeign vehicleFeign; VehicleFeign vehicleFeign;
@Override @Override
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
...@@ -104,54 +120,106 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -104,54 +120,106 @@ public class BackStageOrderController extends CommonBaseController implements Us
dto.setEndTime(new Date().getTime()); dto.setEndTime(new Date().getTime());
} }
} }
if (StringUtils.isNotBlank(dto.getPhone())||StringUtils.isNotBlank(dto.getRealName())) { if (StringUtils.isNotBlank(dto.getPhone()) || StringUtils.isNotBlank(dto.getRealName())) {
List<AppUserLogin> appUserLoins = userFeign.getOne(dto.getPhone(),dto.getRealName()); List<AppUserLogin> appUserLoins = userFeign.getOne(dto.getPhone(), dto.getRealName());
if (CollectionUtil.isNotEmpty(appUserLoins)) { if (CollectionUtil.isNotEmpty(appUserLoins)) {
List<Integer> collect = appUserLoins.parallelStream().map(AppUserLogin::getId).collect(Collectors.toList()); List<Integer> collect = appUserLoins.parallelStream().map(AppUserLogin::getId).collect(Collectors.toList());
dto.setUserIds(collect); dto.setUserIds(collect);
}else { } else {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
} }
UserDTO userDTO = getAdminUserInfo(); UserDTO userDTO = getAdminUserInfo();
if (userDTO == null) { if (userDTO == null) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
if(dto.getType() != null && dto.getType() != 3) { if (dto.getType() != null && dto.getType() != 3) {
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone()); List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone());
List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList()); List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList());
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
} }
if (StringUtils.isNotEmpty(dto.getPlateNumber())||StringUtils.isNotEmpty(dto.getVehicleCode())){ if (dto.getZoneId() != null) {
List<String> vehicleIds = vehicleFeign.findbyPlateNumberAndVehicleCod(dto.getPlateNumber(),dto.getVehicleCode()); if (userDTO.getDataAll() != 1 && !dto.getZoneId().equals(userDTO.getZoneId())) {
dto.setVehicleIds(vehicleIds); return ObjectRestResponse.succ(new PageDataVO<>());
} else {
ArrayList<Integer> zoneIds = new ArrayList<>();
zoneIds.add(dto.getZoneId());
dto.setZoneIds(zoneIds);
} }
}
if (dto.getStartCompanyId() != null) {
if (userDTO.getDataAll() != 1 && !dto.getStartCompanyId().equals(userDTO.getId())) {
return ObjectRestResponse.succ(new PageDataVO<>());
} else {
ArrayList<Integer> companyIds = new ArrayList<>();
companyIds.add(dto.getStartCompanyId());
dto.setCompanyIds(companyIds);
}
}
if (StringUtils.isNotEmpty(dto.getPlateNumber()) || StringUtils.isNotEmpty(dto.getVehicleCode())) {
List<String> vehicleIds = vehicleFeign.findbyPlateNumberAndVehicleCod(dto.getPlateNumber(), dto.getVehicleCode());
dto.setVehicleIds(vehicleIds);
}
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper())); PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper()));
List<OrderListVo> list = pageDataVO.getData(); List<OrderListVo> list = pageDataVO.getData();
List<Integer> userIds = list.stream().map(OrderListVo::getUserId).distinct().collect(Collectors.toList()); List<Integer> userIds = list.stream().map(OrderListVo::getUserId).distinct().collect(Collectors.toList());
if (userIds != null && userIds.size() > 0) { if (userIds != null && userIds.size() > 0) {
ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds); ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds);
log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData()); log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData());
Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>(); Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>();
if(objectRestResponse.getData() != null) { if (objectRestResponse.getData() != null) {
for(AppUserVo appUserVo : objectRestResponse.getData()) { for (AppUserVo appUserVo : objectRestResponse.getData()) {
if(appUserVo != null) { if (appUserVo != null) {
appvoMap.put(appUserVo.getUserid(), appUserVo); appvoMap.put(appUserVo.getUserid(), appUserVo);
} }
} }
} }
for (OrderListVo orderPageVO : list) { for (OrderListVo orderPageVO : list) {
AppUserVo appUserVo = appvoMap.get(orderPageVO.getUserId()); AppUserVo appUserVo = appvoMap.get(orderPageVO.getUserId());
if(appUserVo != null) { if (appUserVo != null) {
orderPageVO.setTelephone(appUserVo.getUsername()); orderPageVO.setTelephone(appUserVo.getUsername());
orderPageVO.setUsername(appUserVo.getNickname()); orderPageVO.setUsername(appUserVo.getNickname());
orderPageVO.setRealName(appUserVo.getRealname()); orderPageVO.setRealName(appUserVo.getRealname());
orderPageVO.setJobTitle(appUserVo.getJobTitle());
orderPageVO.setMemberName(appUserVo.getMemberName());
}
String costDetail = orderPageVO.getOrderRentVehicleDetail().getCostDetail();
ObjectMapper objectMapper = new ObjectMapper();
try {
Map<String,Object> map = objectMapper.readValue(costDetail, Map.class);
String paramJson = (String) map.get("paramJson");
if (StringUtil.isNotBlank(paramJson)){
RentVehiclePriceVO rentVehiclePriceVO = objectMapper.readValue(paramJson, RentVehiclePriceVO.class);
orderPageVO.setRentVehiclePriceVO(rentVehiclePriceVO);
} }
List<Map<String,String>> children= (List<Map<String, String>>) map.get("children");
orderPageVO.setDetailsOfExpenses(children);
} catch (IOException e) {
e.printStackTrace();
}
if (dto.getType()==1) {
if (StringUtils.isNotBlank(orderPageVO.getCouponTickerNos())) {
String[] couponIds = orderPageVO.getCouponTickerNos().split(",");
List<Coupon> couponList = activityFeign.couponsByTickerNoList(Lists.newArrayList(couponIds));
orderPageVO.setCouponList(couponList);
}
}
if (orderPageVO.getOrderRentVehicleDetail() != null && orderPageVO.getOrderRentVehicleDetail().getVehicleId() != null) { if (orderPageVO.getOrderRentVehicleDetail() != null && orderPageVO.getOrderRentVehicleDetail().getVehicleId() != null) {
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderPageVO.getOrderRentVehicleDetail().getVehicleId()); RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderPageVO.getOrderRentVehicleDetail().getVehicleId());
log.info("获取车辆信息返回消息:{}", restResponse.getData()); log.info("获取车辆信息返回消息:{}", restResponse.getData());
...@@ -194,7 +262,7 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -194,7 +262,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
if (startResponse.getData() != null) { if (startResponse.getData() != null) {
orderPageVO.setStartCompanyName(startResponse.getData().getName()); orderPageVO.setStartCompanyName(startResponse.getData().getName());
} }
if(StringUtils.isNotBlank(orderPageVO.getOrderTourDetail().getTourUserIds())) { if (StringUtils.isNotBlank(orderPageVO.getOrderTourDetail().getTourUserIds())) {
List<TourUser> tourUsers = tourFeign.getTourUsers(orderPageVO.getOrderTourDetail().getTourUserIds()).getData(); List<TourUser> tourUsers = tourFeign.getTourUsers(orderPageVO.getOrderTourDetail().getTourUserIds()).getData();
orderPageVO.getOrderTourDetail().setUserVoList(tourUsers == null || tourUsers.size() <= 0 ? new ArrayList<>() : tourUsers); orderPageVO.getOrderTourDetail().setUserVoList(tourUsers == null || tourUsers.size() <= 0 ? new ArrayList<>() : tourUsers);
} }
...@@ -218,12 +286,12 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -218,12 +286,12 @@ public class BackStageOrderController extends CommonBaseController implements Us
} }
} }
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
if(StringUtils.isNotBlank(dto.getKeywords())) { if (StringUtils.isNotBlank(dto.getKeywords())) {
List<Integer> list = userFeign.getUserIdByUsername(dto.getKeywords()); List<Integer> list = userFeign.getUserIdByUsername(dto.getKeywords());
if(list != null) { if (list != null) {
userIds.addAll(list); userIds.addAll(list);
} }
if(userIds.size() <= 0) { if (userIds.size() <= 0) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
} }
...@@ -234,9 +302,9 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -234,9 +302,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
} }
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone()); List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone());
List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList()); List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList());
if(dto.getStartCompanyId() != null) { if (dto.getStartCompanyId() != null) {
if(companyIds.size() > 0) { if (companyIds.size() > 0) {
if(companyIds.contains(dto.getStartCompanyId())) { if (companyIds.contains(dto.getStartCompanyId())) {
companyIds.clear(); companyIds.clear();
companyIds.add(dto.getStartCompanyId()); companyIds.add(dto.getStartCompanyId());
} else { } else {
...@@ -258,9 +326,9 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -258,9 +326,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
orderPageVO.setCode(restResponse.getData().getCode()); orderPageVO.setCode(restResponse.getData().getCode());
} }
} }
if(orderPageVO.getUserId() != null) { if (orderPageVO.getUserId() != null) {
AppUserDTO appUserDTO = userFeign.userDetailById(orderPageVO.getUserId()).getData(); AppUserDTO appUserDTO = userFeign.userDetailById(orderPageVO.getUserId()).getData();
if(appUserDTO != null) { if (appUserDTO != null) {
orderPageVO.setUsername(appUserDTO.getUsername()); orderPageVO.setUsername(appUserDTO.getUsername());
orderPageVO.setRealName(appUserDTO.getRealname()); orderPageVO.setRealName(appUserDTO.getRealname());
} }
...@@ -332,20 +400,20 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -332,20 +400,20 @@ public class BackStageOrderController extends CommonBaseController implements Us
query.put("userId", null); query.put("userId", null);
PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper())); PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
OrderPageVO orderPageVO = page.getData().get(0); OrderPageVO orderPageVO = page.getData().get(0);
if(null == orderPageVO) { if (null == orderPageVO) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("订单不存在")); throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("订单不存在"));
} }
//预约新的车辆 //预约新的车辆
RentVehicleBO bo = BeanUtil.toBean(orderPageVO.getOrderRentVehicleDetail(), RentVehicleBO.class); RentVehicleBO bo = BeanUtil.toBean(orderPageVO.getOrderRentVehicleDetail(), RentVehicleBO.class);
bo.setOrder(orderPageVO); bo.setOrder(orderPageVO);
bo.setBookVehicleVO(new BookVehicleVO(){{ bo.setBookVehicleVO(new BookVehicleVO() {{
setBookStartDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8)))); setBookStartDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8)))); setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
setBookStartDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8)))); setBookStartDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8)))); setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
}}); }});
List<OrderAccompanyDTO> oads = JSONUtil.toList(JSONUtil.parseArray(orderItemBiz.selectOne(new OrderItem(){{ List<OrderAccompanyDTO> oads = JSONUtil.toList(JSONUtil.parseArray(orderItemBiz.selectOne(new OrderItem() {{
setOrderId(orderPageVO.getId()); setOrderId(orderPageVO.getId());
setType(ItemTypeEnum.ACCOMPANY.getCode()); setType(ItemTypeEnum.ACCOMPANY.getCode());
}}).getDetail()), OrderAccompanyDTO.class); }}).getDetail()), OrderAccompanyDTO.class);
...@@ -355,7 +423,7 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -355,7 +423,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
//如果成功则取消旧车的预约 //如果成功则取消旧车的预约
RestResponse<Integer> rentUnbookResponse = vehicleFeign.rentUnbookVehicle(oldBookRecordId); RestResponse<Integer> rentUnbookResponse = vehicleFeign.rentUnbookVehicle(oldBookRecordId);
//设置新的vehicleId 和 record //设置新的vehicleId 和 record
orderRentVehicleBiz.updateSelectiveByIdRe(new OrderRentVehicleDetail(){{ orderRentVehicleBiz.updateSelectiveByIdRe(new OrderRentVehicleDetail() {{
setId(bo.getId()); setId(bo.getId());
setVehicleId(bo.getVehicleId()); setVehicleId(bo.getVehicleId());
setBookRecordId(bo.getBookRecordId()); setBookRecordId(bo.getBookRecordId());
......
...@@ -319,6 +319,8 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -319,6 +319,8 @@ public class BaseOrderController extends CommonBaseController implements UserRes
private Integer startZoneId; private Integer startZoneId;
private Integer zoneId;
private Integer userId; private Integer userId;
private Integer type; private Integer type;
...@@ -340,6 +342,8 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -340,6 +342,8 @@ public class BaseOrderController extends CommonBaseController implements UserRes
//订单用户ID列表 //订单用户ID列表
private List<Integer> userIds; private List<Integer> userIds;
//订单用户大区id列表
private List<Integer> zoneIds;
//订单用户手机号或订单用户真实姓名 //订单用户手机号或订单用户真实姓名
private String keywords; private String keywords;
......
...@@ -114,12 +114,14 @@ ...@@ -114,12 +114,14 @@
</select> </select>
<select id="listOrder" parameterType="Map" resultMap="orderListMap"> <select id="listOrder" parameterType="Map" resultMap="orderListMap">
select b.* select b.*,i.detail as carArticlesJson
from base_order b from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
LEFT JOIN order_tour_detail t on t.order_id = b.id LEFT JOIN order_tour_detail t on t.order_id = b.id
LEFT JOIN order_member_detail m on m.order_id = b.id LEFT JOIN order_member_detail m on m.order_id = b.id
LEFT JOIN order_item i on b.id = i.order_id
<where> <where>
i.type=104
<if test="crtUser != null"> <if test="crtUser != null">
and b.crt_user = #{crtUser} and b.crt_user = #{crtUser}
</if> </if>
......
...@@ -51,6 +51,12 @@ ...@@ -51,6 +51,12 @@
<if test="orderNo != null"> <if test="orderNo != null">
and o.order_no = #{orderNo} and o.order_no = #{orderNo}
</if> </if>
<if test="typeList != null and typeList.size() != 0">
and o.type in
<foreach collection="typeList" item="type" index="index" open="(" separator="," close=")">
#{type}
</foreach>
</if>
</where> </where>
</select> </select>
<select id="selectByOrderNo" parameterType="java.util.Map" resultType="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto"> <select id="selectByOrderNo" parameterType="java.util.Map" resultType="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto">
......
...@@ -15,6 +15,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO; ...@@ -15,6 +15,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey; import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.Area; import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockInfo; import com.xxfc.platform.vehicle.entity.BranchCompanyStockInfo;
...@@ -416,4 +417,17 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -416,4 +417,17 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
public List<Integer> getCompanyIds(String dataZone ,String dataCompany) { public List<Integer> getCompanyIds(String dataZone ,String dataCompany) {
return vehicleBiz.dataCompany(dataZone, dataCompany); return vehicleBiz.dataCompany(dataZone, dataCompany);
} }
public ObjectRestResponse delCompanyByBaseId(Integer id) {
Example example = new Example(BranchCompany.class);
example.createCriteria().andEqualTo("companyBaseId", id);
example.createCriteria().andEqualTo("isDel", 0);
BranchCompany branchCompany = mapper.selectOneByExample(example);
if(branchCompany == null) {
return ObjectRestResponse.createFailedResult(ResCode.BRANCH_COMPANY_UNEXIST.getCode(), ResCode.BRANCH_COMPANY_UNEXIST.getDesc());
}
branchCompany.setIsDel(1);
updateSelectiveByIdRe(branchCompany);
return ObjectRestResponse.succ();
}
} }
...@@ -8,7 +8,6 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -8,7 +8,6 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil; import com.github.wxiaoqi.security.common.util.RandomUtil;
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.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey; import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.*; import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.mapper.BranchCompanyStockInfoMapper; import com.xxfc.platform.vehicle.mapper.BranchCompanyStockInfoMapper;
...@@ -32,7 +31,6 @@ import javax.servlet.http.HttpServletRequest; ...@@ -32,7 +31,6 @@ import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner;
@Service @Service
@Slf4j @Slf4j
...@@ -388,6 +386,7 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> { ...@@ -388,6 +386,7 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
companyBase.setId(id); companyBase.setId(id);
companyBase.setIsDel(1); companyBase.setIsDel(1);
updateSelectiveById(companyBase); updateSelectiveById(companyBase);
branchCompanyBiz.delCompanyByBaseId(id);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.vehicle.entity.Constant;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class ImportVehicleDataBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Autowired
private ConstantBiz constantBiz;
@Transactional(rollbackFor = Exception.class)
public Object parsingUploadedFiles(List<List<Object>> excel) {
try {
StringBuffer stringBuffer = new StringBuffer();
StringBuffer stringBuffer2 = new StringBuffer();
for (int i = 0; i < excel.size(); i++) {
System.out.println(i);
List<Object> list = excel.get(i);
//获取车牌号
String numberPlate = (String) list.get(2);
if (StringUtils.isBlank(numberPlate)) {
continue;
}
Example example = new Example(Vehicle.class);
example.createCriteria().andEqualTo("numberPlate", numberPlate);
List<Vehicle> vehicles = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(vehicles)) {
stringBuffer.append(numberPlate).append(",");
continue;
}
Example example1 = new Example(Constant.class);
example1.createCriteria().andEqualTo("type", 3);
List<Constant> constants = constantBiz.selectByExample(example1);
for (Vehicle vehicle : vehicles) {
if (i==83){
System.out.println("测试");
}
log.info("修改前:" + vehicle.toString());
if (numberPlate.equals(vehicle.getNumberPlate()) && !( String.valueOf(list.get(1)).equals(vehicle.getCode()))) {
stringBuffer2.append("numberPlate:" + numberPlate).append(",").append("code:" + ((String) list.get(2))).append("|");
}
//设置托管人
if (list.get(5) != null) {
vehicle.setBelongTo(2);
vehicle.setBelongToName((String) list.get(5));
}
//设置车架号
if (list.get(6) != null) {
vehicle.setVin((String) list.get(6));
}
// //设置交强险公司
// if (list.get(7) != null && !((String) list.get(7)).trim().equals("未知")) {
// String company = (String) list.get(7);
// for (Constant constant : constants) {
// if (constant.getVal().contains(company)) {
// vehicle.setStrongInsuranceCompany(constant.getCode());
// break;
// }
// }
//
//
// }
//
// //设置交强险单号
// if (list.get(8) != null) {
// vehicle.setStrongInsuranceNo((String) list.get(8));
// }
//
// //设置交强险到期时间
// if ((list.get(9) != null) && String.valueOf(list.get(9)).trim() != "") {
// vehicle.setStrongInsuranceEndDate(((DateTime) list.get(9)).toJdkDate());
// }
//设置商业险公司
if (list.get(10) != null) {
String company = (String) list.get(10);
for (Constant constant : constants) {
if (constant.getVal().contains(company)) {
vehicle.setInsuranceCompany(constant.getCode());
break;
}
}
}
//设置商业险单号
if (list.get(11) != null) {
vehicle.setInsuranceNo((String) list.get(11));
}
//设置商业险到期时间
if (list.get(12) != null&&String.valueOf(list.get(12)).trim()!="") {
vehicle.setInsuranceEndDate(((DateTime) list.get(12)).toJdkDate());
}
//设置年审时间
if (list.get(13) != null&&String.valueOf(list.get(13)).trim()!="") {
DateTime dateTime = (DateTime) list.get(13);
vehicle.setAnnualVerificationDate(dateTime.toJdkDate());
}
//设置发动机号
if (list.get(14) != null) {
vehicle.setEngineNum(String.valueOf(list.get(14)) );
}
System.out.println(i);
log.info("修改后:" + vehicle.toString());
mapper.updateByPrimaryKeySelective(vehicle);
}
}
System.out.println("stringBuffer:"+stringBuffer);
System.out.println("stringBuffer2:"+stringBuffer2);
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return null;
}
}
package com.xxfc.platform.vehicle.rest.admin;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.vehicle.biz.ImportVehicleDataBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
/**
* @author Administrator
*/
@RestController
@RequestMapping("/vehicle/import")
@Slf4j
public class ImportVehicleDataController extends BaseController<ImportVehicleDataBiz> {
@PostMapping("/excel/import")
public ObjectRestResponse excelImport(@RequestParam("file")MultipartFile excelFile) throws IOException {
String filename = excelFile.getOriginalFilename();
String split = filename.substring(filename.lastIndexOf("."));
if (".xlsx".equals(split)) {
ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"文件格式错误,必须为.xlsx文件!!");
}
List<List<Object>> excel= ExcelUtil.getReader(excelFile.getInputStream()).read();
if (excel==null||excel.size()<3) {
ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"导入文件无数据!!");
}
excel.remove(0);
excel.remove(1);
log.error(String.valueOf(excel.size()));
return ObjectRestResponse.succ(baseBiz.parsingUploadedFiles(excel));
}
}
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