Commit dba20b6f authored by 周健威's avatar 周健威

Merge branch 'master' into holiday-price

parents 0bcc34e1 5986a018
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import com.ace.cache.annotation.Cache; import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel; import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.mapper.BaseUserMemberLevelMapper; import com.github.wxiaoqi.security.admin.mapper.BaseUserMemberLevelMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -52,6 +53,7 @@ public class UserMemberLevelBiz extends BaseBiz<BaseUserMemberLevelMapper,BaseUs ...@@ -52,6 +53,7 @@ public class UserMemberLevelBiz extends BaseBiz<BaseUserMemberLevelMapper,BaseUs
return levelAndDiscountMap; return levelAndDiscountMap;
} }
@CacheClear(key = "member")
public void updateMemberBaseInfo(BaseUserMemberLevel baseUserMemberLevel) { public void updateMemberBaseInfo(BaseUserMemberLevel baseUserMemberLevel) {
int affectRows = mapper.updateByPrimaryKeySelective(baseUserMemberLevel); int affectRows = mapper.updateByPrimaryKeySelective(baseUserMemberLevel);
if (affectRows==0){ if (affectRows==0){
......
...@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.mapper.CustomerServiceMapper; import com.xxfc.platform.im.mapper.CustomerServiceMapper;
import com.xxfc.platform.im.vo.CustomerServiceVO; import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -54,14 +55,14 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -54,14 +55,14 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO, customerService); BeanUtils.copyProperties(customerServiceDTO, customerService);
if (Objects.isNull(customerServiceDTO.getId())){ if (Objects.isNull(customerServiceDTO.getId())) {
customerService.setCreateTime(Instant.now().toEpochMilli()); customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone())); customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
customerService.setIsDel(false); customerService.setIsDel(false);
customerService.setPassword(INIT_PASSWORD); customerService.setPassword(StringUtils.isEmpty(customerServiceDTO.getPassword()) ? INIT_PASSWORD : customerServiceDTO.getPassword().trim().length() > 0 ? customerServiceDTO.getPassword() : INIT_PASSWORD);
Map<String, Object> imMap = new HashMap<>(2); Map<String, Object> imMap = new HashMap<>(2);
imMap.put("telephone", customerServiceDTO.getTelphone()); imMap.put("telephone", customerServiceDTO.getTelphone());
imMap.put("password", INIT_PASSWORD); imMap.put("password", DigestUtils.md5Hex(customerService.getPassword()));
imMap.put("nickname", customerService.getName()); imMap.put("nickname", customerService.getName());
BaseResponse imResponse = userBiz.register(imMap); BaseResponse imResponse = userBiz.register(imMap);
String imResult = imResponse.getMessage(); String imResult = imResponse.getMessage();
...@@ -73,10 +74,10 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -73,10 +74,10 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
} }
customerService.setImUserId((Integer) userId); customerService.setImUserId((Integer) userId);
mapper.insertSelective(customerService); mapper.insertSelective(customerService);
}else { } else {
customerService.setUpdateTime(Instant.now().toEpochMilli()); customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())){ if (!StringUtils.isEmpty(customerServiceDTO.getPassword())) {
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(),customerServiceDTO.getPassword()); userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(), customerServiceDTO.getPassword());
} }
mapper.updateByPrimaryKeySelective(customerService); mapper.updateByPrimaryKeySelective(customerService);
} }
...@@ -121,12 +122,12 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -121,12 +122,12 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
public void updatePasswordByPhone(String telphone, String password) { public void updatePasswordByPhone(String telphone, String password) {
Example example = new Example(CustomerService.class); Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("telphone",telphone); criteria.andEqualTo("telphone", telphone);
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
customerService.setPassword(password); customerService.setPassword(DigestUtils.md5Hex(password));
customerService.setUpdateTime(Instant.now().toEpochMilli()); customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByExampleSelective(customerService,example); mapper.updateByExampleSelective(customerService, example);
} }
public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) { public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) {
...@@ -134,11 +135,11 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -134,11 +135,11 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
Example example = new Example(CustomerService.class); Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",false); criteria.andEqualTo("isDel", false);
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page,limit,()->mapper.selectByExample(example)); PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page, limit, () -> mapper.selectByExample(example));
List<CustomerService> data = pageDataVO.getData(); List<CustomerService> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){ if (CollectionUtils.isEmpty(data)) {
return dataVO; return dataVO;
} }
...@@ -146,7 +147,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -146,7 +147,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerServiceVO customerServiceVO; CustomerServiceVO customerServiceVO;
for (CustomerService customerService : data) { for (CustomerService customerService : data) {
customerServiceVO = new CustomerServiceVO(); customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO); BeanUtils.copyProperties(customerService, customerServiceVO);
customerServiceVOS.add(customerServiceVO); customerServiceVOS.add(customerServiceVO);
} }
...@@ -161,7 +162,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -161,7 +162,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
public CustomerServiceDTO findCustomerServiceById(Long id) { public CustomerServiceDTO findCustomerServiceById(Long id) {
CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO(); CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO();
CustomerService customerService = mapper.selectByPrimaryKey(id); CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerServiceDTO); BeanUtils.copyProperties(customerService, customerServiceDTO);
return customerServiceDTO; return customerServiceDTO;
} }
} }
...@@ -279,4 +279,18 @@ public class BaseOrder implements Serializable { ...@@ -279,4 +279,18 @@ public class BaseOrder implements Serializable {
@ApiModelProperty(value = "返回的优惠券") @ApiModelProperty(value = "返回的优惠券")
@Column(name = "back_coupon") @Column(name = "back_coupon")
String backCoupon; String backCoupon;
/**
* 促成人后台管理系统用户id
*/
@ApiModelProperty(value = "促成人后台管理系统用户id")
@Column(name = "facilitate_id")
Integer facilitateId;
/**
* 促成人联系方式
*/
@ApiModelProperty(value = "促成人联系方式")
@Column(name = "facilitate_phone")
String facilitatePhone;
} }
...@@ -33,4 +33,12 @@ public interface OrderDetail extends OrderItemInter { ...@@ -33,4 +33,12 @@ public interface OrderDetail extends OrderItemInter {
public void setAppUserDTO(AppUserDTO appUserDTO); public void setAppUserDTO(AppUserDTO appUserDTO);
// public Integer getFacilitateId();
//
// public void setFacilitateId(Integer facilitateId);
public String getFacilitatePhone();
public void setFacilitatePhone(String facilitatePhone);
} }
...@@ -11,6 +11,7 @@ import com.xxfc.platform.order.entity.OrderTourDetail; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.entity.inter.OrderDetail; import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.TourUser; import com.xxfc.platform.tour.entity.TourUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
...@@ -20,6 +21,12 @@ public class MemberBO extends OrderMemberDetail implements OrderDetail { ...@@ -20,6 +21,12 @@ public class MemberBO extends OrderMemberDetail implements OrderDetail {
private BaseOrder order; private BaseOrder order;
private BaseUserMemberLevel baseUserMemberLevel; private BaseUserMemberLevel baseUserMemberLevel;
AppUserDTO appUserDTO; AppUserDTO appUserDTO;
/**
* 促成人联系方式
*/
@ApiModelProperty(value = "促成人联系方式")
String facilitatePhone;
/** /**
* 下单来源,1--app;2--小程序 * 下单来源,1--app;2--小程序
*/ */
......
...@@ -27,6 +27,12 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail ...@@ -27,6 +27,12 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
private Integer rentFreeDay; private Integer rentFreeDay;
private AppUserDTO appUserDTO; private AppUserDTO appUserDTO;
/**
* 促成人联系方式
*/
@ApiModelProperty(value = "促成人联系方式")
String facilitatePhone;
/** /**
* 下单来源,1--app;2--小程序 * 下单来源,1--app;2--小程序
*/ */
......
...@@ -11,6 +11,7 @@ import com.xxfc.platform.order.entity.inter.OrderDetail; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.TourUser; import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.vehicle.entity.VehicleModel; import com.xxfc.platform.vehicle.entity.VehicleModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
...@@ -21,6 +22,11 @@ public class TourBO extends OrderTourDetail implements OrderDetail { ...@@ -21,6 +22,11 @@ public class TourBO extends OrderTourDetail implements OrderDetail {
TourGood tourGood; TourGood tourGood;
List<TourUser> tourUsers; List<TourUser> tourUsers;
AppUserDTO appUserDTO; AppUserDTO appUserDTO;
/**
* 促成人联系方式
*/
@ApiModelProperty(value = "促成人联系方式")
String facilitatePhone;
/** /**
* 下单来源,1--app;2--小程序 * 下单来源,1--app;2--小程序
......
...@@ -3,6 +3,8 @@ package com.xxfc.platform.order.pojo.order.add; ...@@ -3,6 +3,8 @@ package com.xxfc.platform.order.pojo.order.add;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
@Data @Data
public class AddOrderCommonDTO { public class AddOrderCommonDTO {
/** /**
...@@ -17,4 +19,16 @@ public class AddOrderCommonDTO { ...@@ -17,4 +19,16 @@ public class AddOrderCommonDTO {
*/ */
@ApiModelProperty(value = "优惠券ids") @ApiModelProperty(value = "优惠券ids")
private String couponIds; private String couponIds;
// /**
// * 促成人后台管理系统用户id
// */
// @ApiModelProperty(value = "促成人后台管理系统用户id")
// Integer facilitateId;
/**
* 促成人联系方式
*/
@ApiModelProperty(value = "促成人联系方式")
String facilitatePhone;
} }
...@@ -283,9 +283,11 @@ public class OrderMsgBiz { ...@@ -283,9 +283,11 @@ public class OrderMsgBiz {
if(null != orvd.getEndCompanyId() && !SYS_FALSE.equals(orvd.getEndCompanyId())) { if(null != orvd.getEndCompanyId() && !SYS_FALSE.equals(orvd.getEndCompanyId())) {
//新的账单 记录 OUT_ORDER_FUND 返回订单款取消订单 //新的账单 记录 OUT_ORDER_FUND 返回订单款取消订单
//查询 201, "取消订单退款" 并且状态为真
OrderAccount orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{ OrderAccount orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
setAccountType(AccountTypeEnum.OUT_ORDER_FUND.getCode()); setAccountType(AccountTypeEnum.OUT_ORDER_FUND.getCode());
setAccountStatus(SYS_TRUE);
}}); }});
if(BigDecimal.ZERO.equals(orderAccount.getDeductAmount())) { if(BigDecimal.ZERO.equals(orderAccount.getDeductAmount())) {
...@@ -311,8 +313,6 @@ public class OrderMsgBiz { ...@@ -311,8 +313,6 @@ public class OrderMsgBiz {
sms2RefundAppUser(BigDecimal.ZERO, orderAccount.getDeductAmount(), orderAccount.getAccountAmount(), BigDecimal.ZERO, baseOrder, appUserDTO, smstype, smsParams); sms2RefundAppUser(BigDecimal.ZERO, orderAccount.getDeductAmount(), orderAccount.getAccountAmount(), BigDecimal.ZERO, baseOrder, appUserDTO, smstype, smsParams);
} }
//后台发送消息(出车人) //后台发送消息(出车人)
smsParams.clear(); smsParams.clear();
sms2BgUser(startCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.CANCEL_E, smsParams); sms2BgUser(startCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.CANCEL_E, smsParams);
...@@ -422,9 +422,11 @@ public class OrderMsgBiz { ...@@ -422,9 +422,11 @@ public class OrderMsgBiz {
OrderAccount orderAccount; OrderAccount orderAccount;
if(RefundStatusEnum.RESIDUE_ILLEGAL.getCode().equals(baseOrder.getRefundStatus())) { if(RefundStatusEnum.RESIDUE_ILLEGAL.getCode().equals(baseOrder.getRefundStatus())) {
smstype = SmsTemplateDTO.REFUND_A; smstype = SmsTemplateDTO.REFUND_A;
//查询 203, "部分押金(扣除该扣除的 + 保留违章预备金)" 并且状态为真
orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{ orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
setAccountType(AccountTypeEnum.OUT_PART_DEPOSIT.getCode()); setAccountType(AccountTypeEnum.OUT_PART_DEPOSIT.getCode());
setAccountStatus(SYS_TRUE);
}}); }});
OrderAccountDetail oad = JSONUtil.toBean(orderAccount.getAccountDetail(), OrderAccountDetail.class); OrderAccountDetail oad = JSONUtil.toBean(orderAccount.getAccountDetail(), OrderAccountDetail.class);
...@@ -447,9 +449,11 @@ public class OrderMsgBiz { ...@@ -447,9 +449,11 @@ public class OrderMsgBiz {
residueAmount = orvd.getReturnPayResidue(); residueAmount = orvd.getReturnPayResidue();
}else if(RefundStatusEnum.REFUND_DEPOSIT.getCode().equals(baseOrder.getRefundStatus())){ }else if(RefundStatusEnum.REFUND_DEPOSIT.getCode().equals(baseOrder.getRefundStatus())){
smstype = SmsTemplateDTO.REFUND_B; smstype = SmsTemplateDTO.REFUND_B;
//查询 204, "剩余押金(扣除该扣除的)" 并且状态为真
orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{ orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
setAccountType(AccountTypeEnum.OUT_RESIDUE_DEPOSIT.getCode()); setAccountType(AccountTypeEnum.OUT_RESIDUE_DEPOSIT.getCode());
setAccountStatus(SYS_TRUE);
}}); }});
originalAmount = orderAccount.getOriginalAmount(); originalAmount = orderAccount.getOriginalAmount();
violateAmount = orderAccount.getDeductAmount(); violateAmount = orderAccount.getDeductAmount();
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.service; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface; import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
...@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -66,12 +68,21 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or ...@@ -66,12 +68,21 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
* 创建基础订单 * 创建基础订单
* @return * @return
*/ */
public BaseOrder createBaseOrder(Integer orderOrigin, AppUserDTO appUserDTO) { public BaseOrder createBaseOrder(Integer orderOrigin, String facilitatePhone, AppUserDTO appUserDTO) {
BaseOrder baseOrder = new BaseOrder(); BaseOrder baseOrder = new BaseOrder();
//设置下单来源 //设置下单来源
baseOrder.setOrderOrigin(orderOrigin); baseOrder.setOrderOrigin(orderOrigin);
//根据facilitatePhone 查询后台管理系统人员 未完成
if(StrUtil.isNotBlank(facilitatePhone)) {
baseOrder.setFacilitatePhone(facilitatePhone);
List<AppUserLogin> appUserDTOList = userFeign.getOne(facilitatePhone, null);
if(null != appUserDTOList && appUserDTOList.size() > 0) {
baseOrder.setFacilitateId(appUserDTOList.get(0).getId());
}
}
//设置订单号 //设置订单号
baseOrder.setNo(OrderUtil.GetOrderNumber("", OrderUtil.APP_MID)); baseOrder.setNo(OrderUtil.GetOrderNumber("", OrderUtil.APP_MID));
//设置订单类型 //设置订单类型
...@@ -89,12 +100,13 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or ...@@ -89,12 +100,13 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
//设置用户id //设置用户id
baseOrder.setUserId(appUserDTO.getUserid()); baseOrder.setUserId(appUserDTO.getUserid());
baseOrder.setMemberLevel(appUserDTO.getMemberLevel()); baseOrder.setMemberLevel(appUserDTO.getMemberLevel());
return baseOrder; return baseOrder;
} }
public void initDetail(Detail detail) { public void initDetail(Detail detail) {
// Integer appUserId = (null == detail.getAppUserDTO())? Integer.valueOf(BaseContextHandler.getUserID()): detail.getAppUserDTO().getUserid(); // Integer appUserId = (null == detail.getAppUserDTO())? Integer.valueOf(BaseContextHandler.getUserID()): detail.getAppUserDTO().getUserid();
BaseOrder order = createBaseOrder(detail.getOrderOrigin(), detail.getAppUserDTO()); BaseOrder order = createBaseOrder(detail.getOrderOrigin(), detail.getFacilitatePhone(), detail.getAppUserDTO());
detail.setOrder(order); detail.setOrder(order);
} }
......
package com.xxfc.platform.tour.comstnt;
public enum WebsiteTourType {
POPULAR(1,"热门路线"),CHARACTERISTIC(2,"特色旅游"),
NEW(3,"新开辟路线"),RECOMMEND(4,"推荐路线");
private Integer code;
private String msg;
WebsiteTourType(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
package com.xxfc.platform.tour.entity;
import lombok.Data;
import java.util.List;
@Data
public class WebsiteQuery {
private Integer limit=6;
private Integer type = 1;
private List<Integer> tagIds;
}
...@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.util.RandomUtil; ...@@ -13,6 +13,7 @@ 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.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
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.tour.dto.*; import com.xxfc.platform.tour.dto.*;
import com.xxfc.platform.tour.entity.*; import com.xxfc.platform.tour.entity.*;
import com.xxfc.platform.tour.mapper.*; import com.xxfc.platform.tour.mapper.*;
...@@ -20,8 +21,12 @@ import com.xxfc.platform.tour.vo.TourGoodVo; ...@@ -20,8 +21,12 @@ import com.xxfc.platform.tour.vo.TourGoodVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -38,6 +43,11 @@ import java.util.*; ...@@ -38,6 +43,11 @@ import java.util.*;
@Slf4j @Slf4j
public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
@Value("${officialWebsite.popular}")
private String popular;
@Value("${officialWebsite.characteristic}")
private String characteristic;
@Autowired @Autowired
private TourGoodBannerBiz bannerBiz; private TourGoodBannerBiz bannerBiz;
@Autowired @Autowired
...@@ -322,7 +332,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -322,7 +332,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
*/ */
public List<GoodDataVO> getAllByHome(Integer page, Integer limit){ public List<GoodDataVO> getAllByHome(Integer page, Integer limit){
return mapper.findAllByHome((page-1)*limit,limit); return mapper.findAllByHome((page-1)*limit,limit);
}; }
/** /**
* 获取指定数量的随机旅游路线 * 获取指定数量的随机旅游路线
...@@ -345,6 +355,48 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -345,6 +355,48 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
} }
return ObjectRestResponse.succ(resultList); return ObjectRestResponse.succ(resultList);
} }
public List homePageTour(WebsiteQuery query) {
if (Objects.isNull(query)) {
return new ArrayList();
}
setQueryTagIds(query);
List<TourGood> list = mapper.getList(query);
return CollectionUtils.isNotEmpty(list)?list:new ArrayList<>();
}
private void setQueryTagIds(WebsiteQuery query) {
if (CollectionUtils.isEmpty(query.getTagIds())) {
List<Integer> list=new ArrayList<>();
Integer type = query.getType();
if (type==1) {
if (StringUtils.isNotBlank(popular)) {
String[] popularIds = popular.split(",");
for (String id : popularIds) {
list.add(Integer.parseInt(id));
}
}
}
if (type==2) {
if (StringUtils.isNotBlank(characteristic)) {
String[] characteristicIds = characteristic.split(",");
for (String id : characteristicIds) {
list.add(Integer.parseInt(id));
}
}
}
query.setTagIds(list);
}
}
public List newTour(Integer limit) {
List list = mapper.newTour(limit);
return CollectionUtils.isNotEmpty(list)?list:new ArrayList<>();
}
} }
...@@ -3,6 +3,7 @@ package com.xxfc.platform.tour.mapper; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.tour.mapper;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.tour.dto.GoodSearchDTO; import com.xxfc.platform.tour.dto.GoodSearchDTO;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.WebsiteQuery;
import com.xxfc.platform.tour.vo.TourGoodVo; import com.xxfc.platform.tour.vo.TourGoodVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -36,4 +37,8 @@ public interface TourGoodMapper extends Mapper<TourGood> { ...@@ -36,4 +37,8 @@ public interface TourGoodMapper extends Mapper<TourGood> {
* @return * @return
*/ */
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size); List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<TourGood> getList(WebsiteQuery query);
List newTour(Integer limit);
} }
package com.xxfc.platform.tour.rest.officialWebsite;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodBiz;
import com.xxfc.platform.tour.comstnt.WebsiteTourType;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.WebsiteQuery;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("website")
@IgnoreClientToken
@IgnoreUserToken
@Api(tags = {"官网"})
public class OfficialWebsiteTourController extends BaseController<TourGoodBiz, TourGood> {
@PostMapping("/app/unauth/tour")
public ObjectRestResponse homePageTour(@RequestBody WebsiteQuery query) throws Exception {
return ObjectRestResponse.succ(baseBiz.homePageTour(query));
}
@GetMapping("/app/unauth/tour/new")
public ObjectRestResponse newTour(@RequestParam(value = "limit", defaultValue = "6") Integer limit) {
return ObjectRestResponse.succ(baseBiz.newTour(limit));
}
}
\ No newline at end of file
...@@ -56,8 +56,10 @@ ...@@ -56,8 +56,10 @@
SELECT t.* from tour_good t SELECT t.* from tour_good t
left join ( left join (
select good_id, select good_id,
IFNULL(ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS( #{params.latitude} * PI() / 180.0) IFNULL(ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS(
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 ,0 ) AS distance latitude * PI() / 180.0)*COS( #{params.latitude} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 ,0 ) AS
distance
FROM tour_good_site WHERE type=2 ) gs ON t.id=gs.good_id FROM tour_good_site WHERE type=2 ) gs ON t.id=gs.good_id
where t.is_del=0 AND t.status=1 where t.is_del=0 AND t.status=1
<if test="params.distance != null and params.distance != ''and params.distance >0"> <if test="params.distance != null and params.distance != ''and params.distance >0">
...@@ -121,4 +123,45 @@ ...@@ -121,4 +123,45 @@
ORDER BY g.rank DESC ,g.id DESC ORDER BY g.rank DESC ,g.id DESC
</select> </select>
<select id="getList" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
SELECT
g.id AS `id`,
g. NAME AS `name`,
g.cover AS `imgUrl`,
g.price
FROM
tour_good g,
tour_good_tag t
WHERE
g.id = t.good_id
AND g.is_del = 0
AND t.is_del = 0
AND g.status = 1
AND t.tag_id IN
<foreach collection="tagIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY g.id
ORDER BY
g.rank ASC,
g.crt_time DESC
LIMIT #{limit}
</select>
<select id="newTour" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
SELECT
id,
name,
cover AS imgUrl,
price
FROM
tour_good
WHERE
is_del = 0
AND
status = 1
ORDER BY
crt_time DESC
LIMIT #{limit}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -107,8 +107,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -107,8 +107,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
* @param type * @param type
* @return * @return
*/ */
public List getHomePageArticle(Integer type) { public List getHomePageArticle(Integer type,Integer limit) {
List<Article> articleList = mapper.getArticleList(type,HOME_PAGE_NUMBER,null,null); List<Article> articleList = mapper.getArticleList(type,limit,null,null);
// if (Objects.isNull(articleList)) { // if (Objects.isNull(articleList)) {
// return new ArrayList(); // return new ArrayList();
// } else { // } else {
......
...@@ -55,8 +55,9 @@ public class ArticleController extends BaseController<ArticleBiz, Article> { ...@@ -55,8 +55,9 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
@GetMapping("/app/unauth/homePage/{type}") @GetMapping("/app/unauth/homePage/{type}")
@ApiOperation(value = "获取首页文章列表") @ApiOperation(value = "获取首页文章列表")
public ObjectRestResponse getHomePageArticle(@PathVariable Integer type){ public ObjectRestResponse getHomePageArticle(@PathVariable Integer type
return ObjectRestResponse.succ(baseBiz.getHomePageArticle(type)); ,@RequestParam(value = "limit",defaultValue = "9") Integer limit){
return ObjectRestResponse.succ(baseBiz.getHomePageArticle(type,limit));
} }
@Override @Override
......
...@@ -5,7 +5,7 @@ import com.xxfc.platform.universal.biz.UserMessage; ...@@ -5,7 +5,7 @@ import com.xxfc.platform.universal.biz.UserMessage;
import java.util.Map; import java.util.Map;
/** /**
* 用户认证 * 用户认证接口 (使用@Primary实现的优先级提升优先级)
* @author Administrator * @author Administrator
*/ */
public interface UserAuthentication { public interface UserAuthentication {
......
...@@ -25,7 +25,7 @@ import java.util.Map; ...@@ -25,7 +25,7 @@ import java.util.Map;
*/ */
@Service @Service
@Slf4j @Slf4j
@Primary //@Primary
public class BJCYAuthentication implements UserAuthentication { public class BJCYAuthentication implements UserAuthentication {
private final String host = "http://aliyunverifyidcard.haoservice.com"; private final String host = "http://aliyunverifyidcard.haoservice.com";
private final String path = "/idcard/VerifyIdcardv2"; private final String path = "/idcard/VerifyIdcardv2";
...@@ -39,7 +39,8 @@ public class BJCYAuthentication implements UserAuthentication { ...@@ -39,7 +39,8 @@ public class BJCYAuthentication implements UserAuthentication {
private final String ret="error_code"; private final String ret="error_code";
@Override @Override
public boolean certificate(UserMessage message) { public boolean certificate(UserMessage message) {
Map<String, String> headers = new HashMap<String, String>(); return true;
/*Map<String, String> headers = new HashMap<String, String>();
headers.put(tokenHead, token); headers.put(tokenHead, token);
Map<String, String> querys = new HashMap<String, String>(); Map<String, String> querys = new HashMap<String, String>();
querys.put(cardNo, message.getIdNumber()); querys.put(cardNo, message.getIdNumber());
...@@ -66,7 +67,7 @@ public class BJCYAuthentication implements UserAuthentication { ...@@ -66,7 +67,7 @@ public class BJCYAuthentication implements UserAuthentication {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return false; return false;*/
} }
} }
......
...@@ -12,6 +12,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -12,6 +12,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.StatusLine; import org.apache.http.StatusLine;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
...@@ -24,6 +25,7 @@ import java.util.Map; ...@@ -24,6 +25,7 @@ import java.util.Map;
*/ */
@Service @Service
@Slf4j @Slf4j
@Primary
public class XCFQAuthentication implements UserAuthentication { public class XCFQAuthentication implements UserAuthentication {
private String cAppcode="acea1c8811f748b3a65815f11db357c4"; private String cAppcode="acea1c8811f748b3a65815f11db357c4";
...@@ -33,10 +35,8 @@ public class XCFQAuthentication implements UserAuthentication { ...@@ -33,10 +35,8 @@ public class XCFQAuthentication implements UserAuthentication {
*/ */
private String cHost = "https://idcert.market.alicloudapi.com"; private String cHost = "https://idcert.market.alicloudapi.com";
private String cPath = "/idcard"; private String cPath = "/idcard";
private String cMethod = "GET"; private String cMethod = "GET";
//响应:认证错误码字段名 //响应:认证错误码字段名
...@@ -45,7 +45,6 @@ public class XCFQAuthentication implements UserAuthentication { ...@@ -45,7 +45,6 @@ public class XCFQAuthentication implements UserAuthentication {
//响应:认证通过码 //响应:认证通过码
private String certifResultCode = "01"; private String certifResultCode = "01";
//请求:身份证号字段名 //请求:身份证号字段名
private String idCardName = "idCard"; private String idCardName = "idCard";
...@@ -55,11 +54,9 @@ public class XCFQAuthentication implements UserAuthentication { ...@@ -55,11 +54,9 @@ public class XCFQAuthentication implements UserAuthentication {
@Override @Override
public boolean certificate(UserMessage message) { public boolean certificate(UserMessage message) {
//map携带身份证和姓名进行认证 //map携带身份证和姓名进行认证
Map<String, String> querys = new HashMap<>(); Map<String, String> querys = new HashMap<>();
querys.put(idCardName, message.getIdNumber()); querys.put(idCardName, message.getIdNumber());
querys.put(cName, message.getName()); querys.put(cName, message.getName());
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + cAppcode); headers.put("Authorization", "APPCODE " + cAppcode);
try { try {
......
...@@ -91,6 +91,6 @@ ...@@ -91,6 +91,6 @@
<if test="cityCode != null"> <if test="cityCode != null">
AND `addr_city`=#{cityCode} AND `addr_city`=#{cityCode}
</if> </if>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY `id` ) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id
</select> </select>
</mapper> </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