Commit da48fdd6 authored by hezhen's avatar hezhen

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents 2c222552 d8329299
......@@ -46,7 +46,6 @@ public class TokenAop {
/**
* userFeign.userDetailByToken(""); 获取app用户的信息
* userFeign.userinfoByToken(""); 获取后台用户的信息
* Todo 还有token 校验规则 ,是否过期 未加入检验 .......
* @param proceedingJoinPoint
* @return
*/
......
......@@ -24,6 +24,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.github.wxiaoqi.security.admin.config.RabbitAdminConfig.*;
import static com.xxfc.platform.order.pojo.mq.OrderMQDTO.*;
@Component
@Slf4j
......@@ -46,16 +47,29 @@ public class WaterMQHandler {
String messageId = message.getMessageProperties().getMessageId();
String msg = new String(message.getBody(), "UTF-8");
OrderMQDTO orderMQDTO = JSONUtil.toBean(msg, OrderMQDTO.class);
OrderWaterDTO orderWaterDTO = new OrderWaterDTO(){{
OrderWaterDTO orderWaterDTO = new OrderWaterDTO() {{
setUserId(orderMQDTO.getUserId());
setOrderNo(orderMQDTO.getNo());
setOrderId(orderMQDTO.getId());
}};
switch (orderMQDTO.getSign()) {
case ORDER_PAY:
orderWaterDTO.setStatus(1);
break;
case ORDER_FINISH:
orderWaterDTO.setStatus(2);
break;
case ORDER_CANCEL:
orderWaterDTO.setStatus(3);
break;
default:
break;
}
switch (OrderTypeEnum.get(orderMQDTO.getType())) {
case RENT_VEHICLE:
orderWaterDTO.setGoodsDTOList(
new ArrayList<OrderGoodsDTO>(){{
add(new OrderGoodsDTO(){{
new ArrayList<OrderGoodsDTO>() {{
add(new OrderGoodsDTO() {{
setGoodId(orderMQDTO.getOrderRentVehicleDetail().getModelId());
setGoodNumber(1);
setImg(orderMQDTO.getPicture());
......@@ -68,8 +82,8 @@ public class WaterMQHandler {
break;
case TOUR:
orderWaterDTO.setGoodsDTOList(
new ArrayList<OrderGoodsDTO>(){{
add(new OrderGoodsDTO(){{
new ArrayList<OrderGoodsDTO>() {{
add(new OrderGoodsDTO() {{
setGoodId(orderMQDTO.getOrderTourDetail().getGoodId());
setGoodNumber(1);
setImg(orderMQDTO.getPicture());
......@@ -82,8 +96,8 @@ public class WaterMQHandler {
break;
case MEMBER:
orderWaterDTO.setGoodsDTOList(
new ArrayList<OrderGoodsDTO>(){{
add(new OrderGoodsDTO(){{
new ArrayList<OrderGoodsDTO>() {{
add(new OrderGoodsDTO() {{
setGoodId(orderMQDTO.getOrderMemberDetail().getMemberLevelId());
setGoodNumber(1);
setImg(orderMQDTO.getPicture());
......@@ -115,31 +129,5 @@ public class WaterMQHandler {
}
}
});
// log.info("接收到的消息:json = {}", json);
// try{
//
// OrderWaterDTO orderWaterDTO = JSONObject.parseObject(json, OrderWaterDTO.class);
// waterBiz.orderWater(orderWaterDTO);
// }catch (Exception e){
// log.info("接收到的消息失败");
// e.printStackTrace();
// }
}
@RabbitListener(queues = {ORDER_FINLISH_USER_RE_QUEUE})
public void integralHandler2(String json) {
log.info("接收到的消息:json = {}", json);
try{
OrderWaterDTO orderWaterDTO = JSONObject.parseObject(json, OrderWaterDTO.class);
waterBiz.orderWater(orderWaterDTO);
}catch (Exception e){
log.info("接收到的消息失败");
e.printStackTrace();
}
}
}
......@@ -18,6 +18,12 @@
<artifactId>xx-activity-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-order-api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
......@@ -6,6 +6,8 @@ import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
......@@ -21,14 +23,19 @@ public class RabbitActivityConfig extends RabbitCommonConfig {
//新人注册有礼
public static final String ACTIVITY_NEW_QUEUE = "activity.new.queue";
public static final String INTEGRAL_HANDLE_QUEUE = "integral_handle_queue";
//优惠券
public static final String COUPON_CANCEL_QUEUE = "coupon.cancel.queue";
static {
myQueue = new ArrayList<BindDTO>(){{
add(new BindDTO(INTEGRAL_QUEUE, RabbitConstant.ORDER_TOPIC, "order.#"));
add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register"));
add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.auth"));
add(new BindDTO(ACTIVITY_NEW_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register"));
add(new BindDTO(ACTIVITY_NEW_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.auth"));
add(new BindDTO(INTEGRAL_HANDLE_QUEUE, RabbitConstant.INTEGRAL_TOPIC, RabbitConstant.INTEGRAL_ROUTING_KEY));
add(new BindDTO(INTEGRAL_QUEUE, ORDER_TOPIC, "order.#"));
add(new BindDTO(POPULARZIE_0101_QUEUE, ADMIN_TOPIC, KEY_APPUSER_REGISTER));
add(new BindDTO(POPULARZIE_0101_QUEUE, ADMIN_TOPIC, KEY_APPUSER_AUTH));
add(new BindDTO(ACTIVITY_NEW_QUEUE, ADMIN_TOPIC, KEY_APPUSER_REGISTER));
add(new BindDTO(ACTIVITY_NEW_QUEUE, ADMIN_TOPIC, KEY_APPUSER_AUTH));
add(new BindDTO(INTEGRAL_HANDLE_QUEUE, INTEGRAL_TOPIC, INTEGRAL_ROUTING_KEY));
add(new BindDTO(COUPON_CANCEL_QUEUE, ORDER_TOPIC, KEY_ORDER_CANCEL));
}};
}
......
package com.xxfc.platform.activity.handler;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO;
import com.rabbitmq.client.Channel;
import com.xxfc.platform.activity.biz.ActivityPopularizeBiz;
import com.xxfc.platform.activity.biz.ActivityUserJoinBiz;
import com.xxfc.platform.activity.biz.UserCouponBiz;
import com.xxfc.platform.activity.config.RabbitActivityConfig;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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;
@Component
@Slf4j
public class CouponMQHandler {
@Autowired
ActivityPopularizeBiz activityPopularizeBiz;
@Autowired
ActivityUserJoinBiz activityUserJoinBiz;
@Autowired
UserCouponBiz userCouponBiz;
@RabbitListener(queues = {RabbitActivityConfig.COUPON_CANCEL_QUEUE})
public void popularizeHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
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");
log.info("接收到的消息:msg = {}, 消息ID是:messageId = {} ", msg, messageId);
if (StringUtils.isNotBlank(msg)) {
OrderMQDTO orderMQDTO = JSONUtil.toBean(msg, OrderMQDTO.class);
if(StrUtil.isNotBlank(orderMQDTO.getCouponTickerNos())) {
for(String tickerNo : orderMQDTO.getCouponTickerNos().split(",")) {
// 返还优惠券
userCouponBiz.cancelTickerNo(tickerNo);
}
}
}
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) {
i.printStackTrace();
}
e.printStackTrace();
}
}
});
}
}
......@@ -235,4 +235,11 @@ public class BaseOrder implements Serializable {
@ApiModelProperty(value = "优惠券优惠的价格")
@Column(name = "coupon_amount")
private BigDecimal couponAmount;
/**
* 使用的优惠券票号,逗号分割
*/
@ApiModelProperty(value = "使用的优惠券票号,逗号分割")
@Column(name = "coupon_ticker_no")
private String couponTickerNos;
}
......@@ -9,10 +9,10 @@ import lombok.Data;
@Data
public class OrderMQDTO extends BaseOrder {
public static final Integer ORDER_CRT = 1;
public static final Integer ORDER_CANCEL = 2;
public static final Integer ORDER_PAY = 4;
public static final Integer ORDER_FINISH = 6;
public static final int ORDER_CRT = 1;
public static final int ORDER_CANCEL = 2;
public static final int ORDER_PAY = 4;
public static final int ORDER_FINISH = 6;
OrderRentVehicleDetail orderRentVehicleDetail;
......
......@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.IntervalUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.google.common.collect.Lists;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
......@@ -93,6 +94,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
@Autowired
OrderMsgBiz orderMsgBiz;
@Autowired
ActivityFeign activityFeign;
public List<OrderPageVO> pageByParm(Map<String, Object> paramMap){
return mapper.pageByParm(paramMap);
}
......
......@@ -161,16 +161,14 @@ public class BaseOrderController extends CommonBaseController implements UserRes
List<Integer> userIds = list.stream().map(OrderListVo::getUserId).distinct().collect(Collectors.toList());
if(userIds != null && userIds.size() >0) {
ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds);
log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getMessage());
for (OrderListVo orderPageVO : list) {
if (objectRestResponse.getData() != null && objectRestResponse.getData().size() > 0) {
for (AppUserVo appUserVo : objectRestResponse.getData()) {
if (appUserVo != null && appUserVo.getUserid() == orderPageVO.getUserId()) {
if (appUserVo != null) {
orderPageVO.setTelephone(appUserVo.getUsername());
orderPageVO.setUsername(appUserVo.getNickname());
// ObjectRestResponse<AppUser> restResponse = userFeign.get(appUserVo.getUserid());
// if(restResponse.isRel()) {
// orderPageVO.setTelephone( restResponse.getData().getUsername());
// }
}
}
}
......
......@@ -245,6 +245,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) {
couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo().get(0), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().get(0));
}
}
//总价格(包含押金)
......
......@@ -218,6 +218,9 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) {
couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo().get(0), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().get(0));
}
}
//总价格
......
......@@ -13,8 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.security.common.handler",
"com.github.wxiaoqi.security.common.log"
"com.github.wxiaoqi.security.common.handler"
})
@EnableDiscoveryClient
@EnableAceAuthClient
......
......@@ -82,16 +82,15 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
}
@PostMapping(value = "/app/notify/alipay")
@PostMapping(value = "/app/unauth/notify/alipay")
@IgnoreUserToken
public String alipayNotify(){
return baseBiz.alipayNotify();
}
@GetMapping(value = "/app/generate_payment")
public Object generatePayment(@RequestParam("orderCode") String orderCode, @RequestParam("description") String description,
@RequestParam("payType") String payType, @RequestParam("amount") Integer amount) {
Object resp = baseBiz.generatePayment(orderCode, description, payType, amount);
public Object generatePayment(OrderPayVo orderPayVo) {
Object resp = baseBiz.generatePayment(orderPayVo);
return resp;
}
......
......@@ -27,4 +27,7 @@ public class VehiclePlanDto extends PageParam {
@ApiModelProperty(value = "停车分公司Id")
private Integer parkBranchCompanyId;
@ApiModelProperty(value = "所属分公司大区")
private Integer zoneId;
}
package com.xxfc.platform.vehicle.rest;
import cn.hutool.core.bean.BeanUtil;
import com.ace.cache.annotation.Cache;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
......@@ -24,11 +23,13 @@ import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleBookInfo;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleWarningMsg;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -39,12 +40,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP;
import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP_NAME;
......@@ -417,9 +417,10 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
@RequestMapping(value = "/getVehiclePlanList", method = RequestMethod.GET)
@RequestMapping(value = "/app/unauth/getVehiclePlanList", method = RequestMethod.GET)
@ApiOperation(value = "获取排车信息")
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse<Map<String, Object>> getVehiclePlanList(VehiclePlanDto vehiclePlanDto) {
//获取统计信息
List<VehicleCountVo> vehicleCountVos = baseBiz.countVehicleByParam(vehiclePlanDto);
......
......@@ -425,6 +425,8 @@
<select id="getAllVehicle" parameterType="java.util.Map" resultMap="searchModel">
select *
from vehicle v1
-- 所属分公司
LEFT JOIN branch_company bc2 ON v1.subordinate_branch = bc2.id
<where>
<if test="startTime != null">
and v1.create_time between #{startTime} and #{endTime}
......@@ -441,36 +443,46 @@
<if test="parkBranchCompanyId != null">
and v1.park_branch_company_id = #{parkBranchCompanyId}
</if>
<if test="zoneId !=null">
and bc2.zone_id = #{zoneId}
</if>
</where>
</select>
<select id="countVehicleByParam" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto"
resultType="com.xxfc.platform.vehicle.pojo.VehicleCountVo">
SELECT count(*) total ,
CASE
WHEN travel_status = 1 THEN
WHEN v1.status = 1 THEN
'1'
WHEN travel_status = 2 THEN
WHEN v1.status = 2 THEN
'2'
WHEN travel_status = 3 THEN
WHEN v1.status = 3 THEN
'3'
WHEN travel_status = 4 THEN
WHEN v1.status = 4 THEN
'4'
WHEN v1.status = 5 THEN
'5'
ELSE
'-1'
'6'
END travel_status,
CASE
WHEN travel_status = 1 THEN
'出行中'
WHEN travel_status = 2 THEN
'预约中'
WHEN travel_status = 3 THEN
'空闲中'
WHEN travel_status = 4 THEN
'保养中'
WHEN v1.status = 1 THEN
'正常运行'
WHEN v1.status = 2 THEN
'维修'
WHEN v1.status = 3 THEN
'报废'
WHEN v1.status = 4 THEN
'出车'
WHEN v1.status = 5 THEN
'保养'
ELSE
'不可用'
END detail
from vehicle v1
-- 所属分公司
LEFT JOIN branch_company bc1 ON v1.subordinate_branch = bc1.id
<where>
<if test="startTime != null">
and v1.create_time between #{startTime} and #{endTime}
......@@ -487,10 +499,15 @@
<if test="parkBranchCompanyId != null">
and v1.park_branch_company_id = #{parkBranchCompanyId}
</if>
<if test="zoneId !=null">
and bc1.zone_id = #{zoneId}
</if>
</where>
GROUP BY travel_status
GROUP BY v1.status
union all
SELECT count(*) total, '0' travel_status, '总数' detail from vehicle v2
-- 所属分公司
LEFT JOIN branch_company bc2 ON v2.subordinate_branch = bc2.id
<where>
<if test="startTime != null">
and v2.create_time between #{startTime} and #{endTime}
......@@ -507,44 +524,10 @@
<if test="parkBranchCompanyId != null">
and v2.park_branch_company_id = #{parkBranchCompanyId}
</if>
</where>
union all
SELECT count(*) total,
CASE
WHEN status = 1 THEN
'5'
WHEN status = 2 THEN
'6'
ELSE
'7'
END travel_status,
CASE
WHEN status = 1 THEN
'正常运行'
WHEN status = 2 THEN
'维修'
ELSE
'报废'
END travel_status
FROM vehicle v3
<where>
<if test="startTime != null">
and v3.create_time between #{startTime} and #{endTime}
</if>
<if test="numberPlate != null">
and v3.number_plate = #{numberPlate}
</if>
<if test="status != null">
and v3.status = #{status}
</if>
<if test="subordinateBranch != null">
and v3.subordinate_branch = #{subordinateBranch}
</if>
<if test="parkBranchCompanyId != null">
and v3.park_branch_company_id = #{parkBranchCompanyId}
<if test="zoneId !=null">
and bc2.zone_id = #{zoneId}
</if>
</where>
GROUP BY status
</select>
<!-- 查询可用车辆/车型 的公用 from 和 where 部分条件 -->
......
......@@ -29,6 +29,7 @@
select w.*
from vehicle_warning_msg w
left join vehicle v on w.vehicle_id = v.id
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
<where>
<if test="vehicleId != null">
and w.vehicle_id = #{vehicleId}
......@@ -48,6 +49,9 @@
<if test="parkBranchCompanyId != null">
and v.park_branch_company_id = #{parkBranchCompanyId}
</if>
<if test="zoneId !=null">
and bc2.zone_id = #{zoneId}
</if>
</where>
</select>
......
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