Commit 420232d1 authored by libin's avatar libin

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

parents d240f038 156eb5bc
......@@ -102,7 +102,7 @@ public class AuthController {
if(result==null){
data.put("status",1001);
}else {
String token=appAuthService.getToken(username,result.getInteger("userid"));
String token=appAuthService.getToken(username,result.getInteger("userId"));
data.put("token",token);
}
}
......@@ -122,7 +122,7 @@ public class AuthController {
if(result==null){
data.put("status",1001);
}else {
String token=appAuthService.getToken(result.getString("username"),result.getInteger("userid"));
String token=appAuthService.getToken(result.getString("username"),result.getInteger("userId"));
data.put("token",token);
}
}
......@@ -141,7 +141,7 @@ public class AuthController {
if(result==null){
data.put("status",1001);
}else {
String token=appAuthService.getToken(username,result.getInteger("userid"));
String token=appAuthService.getToken(username,result.getInteger("userId"));
data.put("token",token);
}
}
......
......@@ -3,6 +3,8 @@ package com.github.wxiaoqi.security.common.exception;
import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import java.util.Map;
/**
* Created by ace on 2017/9/8.
*/
......@@ -50,4 +52,9 @@ public class BaseException extends RuntimeException {
super(ResultCode.getMsg(code));
this.status = code;
}
public BaseException(int code, Map<String, Object> map) {
super(ResultCode.getMsg(code));
this.status = code;
}
}
......@@ -40,7 +40,12 @@ public class EntityUtils {
* @author 王浩彬
*/
public static <T> void setCreateInfo(T entity){
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request;
try {
request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
}catch (Exception e) {
request = null;
}
String hostIp = "";
String name = "";
String id = "";
......@@ -81,7 +86,12 @@ public class EntityUtils {
* @author 王浩彬
*/
public static <T> void setUpdatedInfo(T entity){
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request;
try {
request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
}catch (Exception e) {
request = null;
}
String hostIp = "";
String name = "";
String id = "";
......
......@@ -5,6 +5,10 @@ import com.github.wxiaoqi.security.common.util.SystemProperty;
public class ResultCode {
////////////////////////////参数相关///////////////////////////
public static int PARAM_ILLEGAL_CODE = Integer.valueOf(SystemProperty.getResultConfig("PARAM_ILLEGAL_CODE"));
public static int PARAM_EXPIRE_CODE = Integer.valueOf(SystemProperty.getResultConfig("PARAM_EXPIRE_CODE"));
// 操作成功
public static int SUCCESS_CODE = Integer.valueOf(SystemProperty.getResultConfig("SUCCESS_CODE"));
// 操作失败
......
......@@ -32,6 +32,14 @@ RSTOKEN_NULL_CODE=1007
DB_OPERATION_FAIL_CODE=1008
1008=数据库操作失败
#参数非法
PARAM_ILLEGAL_CODE=1011
1011=参数非法,请修改
#参数时效已过时
PARAM_EXPIRE_CODE=1010
1010=参数时效已过时,不能使用
#请求微信接口失败
WXAPI_CODE=2001
#微信用不不存在
......
package com.github.wxiaoqi.security.admin.entity;
import lombok.Data;
import javax.persistence.Column;
@Data
public class AppUserManage {
private AppUserLogin appUserLogin;
private AppUserDetail appUserDetail;
private BaseUserMember baseUserMember;
}
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.mapper.*;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.apache.commons.beanutils.BeanUtilsBean;
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;
/**
* app用户管理业务逻辑层
*
* @author Administrator
*/
@Service
public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail> {
@Autowired
private AppUserLoginMapper appUserLoginMapper;
/**
* 根据条件查询
*
* @param appUserVo
* @return
*/
public AppUserVo findAllByQuery(AppUserVo appUserVo) {
return mapper.selectAppUserManage(appUserVo);
}
@Transactional
public void deleteAppUser(Integer id) {
AppUserLogin appUserLogin = new AppUserLogin();
appUserLogin.setIsdel(1);
Example example = new Example(AppUserLogin.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("id", id);
appUserLogin.setUpdatetime(System.currentTimeMillis());
appUserLoginMapper.updateByExampleSelective(appUserLogin, example);
AppUserDetail appUserDetail = new AppUserDetail();
appUserDetail.setIsdel(1);
appUserDetail.setUpdatetime(System.currentTimeMillis());
Example detailExample = new Example(AppUserLogin.class);
Example.Criteria detailCriteria = detailExample.createCriteria();
criteria.andEqualTo("id", id);
mapper.updateByExampleSelective(appUserDetail, detailCriteria);
}
public AppUserVo findOneById(Integer id) {
return mapper.getUserInfo(id);
}
@Transactional
public void save(AppUserVo appUserVo) {
AppUserLogin appUserLogin = new AppUserLogin();
AppUserDetail appUserDetail = new AppUserDetail();
try {
BeanUtilsBean.getInstance().copyProperties(appUserLogin, appUserVo);
BeanUtilsBean.getInstance().copyProperties(appUserDetail, appUserVo);
if (appUserVo.getUserid() == null || appUserVo.getUserid() == 0) {
//设置登录用户信息
appUserLogin.setIsdel(0);
appUserLogin.setCreatetime(System.currentTimeMillis());
appUserLogin.setCertificationStatus(0);
appUserLogin.setStatus(0);
//设置用户详情
appUserDetail.setIsdel(0);
if (appUserDetail.getIsMember() == null) {
appUserDetail.setIsMember(0);
}
appUserLoginMapper.insertSelective(appUserLogin);
mapper.insertSelective(appUserDetail);
} else {
appUserLogin.setUpdatetime(System.currentTimeMillis());
appUserDetail.setUpdatetime(System.currentTimeMillis());
appUserLoginMapper.updateByPrimaryKeySelective(appUserLogin);
mapper.updateByPrimaryKeySelective(appUserDetail);
}
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
}
}
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
......@@ -10,5 +11,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
//查询用户信息
public AppUserVo getUserInfo(@Param("userId") Integer userId);
AppUserVo selectAppUserManage(AppUserVo appUserVo);
}
\ No newline at end of file
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import tk.mybatis.mapper.common.Mapper;
public interface AppUserLoginMapper extends Mapper<AppUserLogin> {
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUser;
import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.entity.Group;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
......@@ -17,4 +18,6 @@ public interface AppUserMapper extends Mapper<AppUser> {
int insertAppUserGroup(@Param("appUserId") Integer appUserId, @Param("groups") Set<Integer> groups);
int deleteAppUserGroup(Integer appUserId);
}
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.AppUserManageBiz;
import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import org.springframework.web.bind.annotation.*;
/**
* app用户管理类
* @author Administrator
*/
@RestController
@RequestMapping("appUsersManage")
public class AppUsersManageController extends BaseController<AppUserManageBiz,AppUserManage> {
/**
* 查询所有
* @return
*/
@GetMapping("/findAll")
public ObjectRestResponse<AppUserVo> findAllByQuery(@RequestBody AppUserVo appUserVo){
return ObjectRestResponse.succ(baseBiz.findAllByQuery(appUserVo));
}
/**
* 删除
* @param id
* @return
*/
@DeleteMapping("/deleteById/{id}")
public ObjectRestResponse deleteById(@PathVariable Integer id){
baseBiz.deleteAppUser(id);
return ObjectRestResponse.succ();
}
/**
* 查询一条
* @param id
* @return
*/
@GetMapping("/findOneById/{id}")
public ObjectRestResponse<AppUserVo> findOneById(@PathVariable Integer id){
return ObjectRestResponse.succ(baseBiz.findOneById(id));
}
@PostMapping("/save")
public ObjectRestResponse save(@RequestBody AppUserVo appUserVo){
baseBiz.save(appUserVo);
return ObjectRestResponse.succ();
}
}
......@@ -241,8 +241,8 @@ public class AppPermissionService {
userLogin.setUsername(username);
appUserLoginBiz.updateSelectiveById(userLogin);
}
data.put("im_token",access_token);
data.put("im_userId",imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
if (data != null) {
......@@ -282,7 +282,7 @@ public class AppPermissionService {
// 返回结果
// data.put("token", token);
data.put("username", username);
data.put("userid", userid);
data.put("userId", userid);
}
return data;
......@@ -366,8 +366,8 @@ public class AppPermissionService {
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
......@@ -453,8 +453,8 @@ public class AppPermissionService {
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(userLogin.getUsername(),imPassword,imUserId);
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
......@@ -495,8 +495,8 @@ public class AppPermissionService {
String imPassword=user.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
......
......@@ -28,6 +28,91 @@
<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
left join app_user_detail d
on d.userid = l.id where d.userid = #{userId} limit 1
where d.userid = #{userId} limit 1
</select>
<select id="selectAppUserManage" parameterType="Integer" 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
left join app_user_detail d
on d.userid = l.id where 1=1
<if test="id != null">
and d.id =#{id}
</if>
<if test="userid != null" >
and d.userid = #{userId}
</if>
<if test="username != null" >
and l.username=#{username}
</if>
<if test="imUserd != null" >
and l.im_userid=#{imUserid}
</if>
<if test="wxOpenid != null" >
and l.wx_openid=#{wxOpenid}
</if>
<if test="unionid != null" >
and l.unionid=#{unionid}
</if>
<if test="openid != null" >
and l.openid=#{openid}
</if>
<if test="status != null" >
and l.status=#{status}
</if>
<if test="idNumber != null" >
and l.id_number=#{idNumber}
</if>
<if test="certificationStatus != null" >
and l.certification_status=#{certificationStatus}
</if>
<if test="isMember != null" >
and d.is member=#{isMember}
</if>
<if test="nickname != null" >
and d.nickname=#{nickname}
</if>
<if test="realname != null" >
and d.realname=#{realname}
</if>
<if test="email != null" >
and d.email=#{email}
</if>
<if test="sex != null" >
and d.sex=#{sex}
</if>
<if test="birthday != null" >
and d.birthday=#{birthday}
</if>
<if test="personSign != null" >
and d.person_sign=#{personSign}
</if>
<if test="remark != null" >
and d.remark=#{remark}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -21,4 +21,6 @@
right join app_group_member agm on bg.id = agm.group_id
where user_id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -75,6 +75,7 @@ public class UserBiz {
return baseResponse;
}
/**
* 登录
* @param map
......
......@@ -14,12 +14,10 @@ public class AddRentVehicleDTO{
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//开始时间
@Column(name = "start_time")
@ApiModelProperty(value = "开始时间")
private Long startTime;
//结束时间
@Column(name = "end_time")
@ApiModelProperty(value = "结束时间")
private Long endTime;
......@@ -36,12 +34,10 @@ public class AddRentVehicleDTO{
private String bookEndDate;
//天数
@Column(name = "day_num")
@ApiModelProperty(value = "天数")
private Integer dayNum;
//取车地点
@Column(name = "start_addr")
@ApiModelProperty(value = "取车地点")
private String startAddr;
......@@ -51,7 +47,6 @@ public class AddRentVehicleDTO{
private String endAddr;
//取车城市编号
@Column(name = "start_city")
@ApiModelProperty(value = "取车城市编号")
private Integer startCity;
......@@ -61,7 +56,6 @@ public class AddRentVehicleDTO{
private Integer endCity;
//取车城市名称
@Column(name = "start_city_name")
@ApiModelProperty(value = "取车城市名称")
private String startCityName;
......@@ -71,30 +65,42 @@ public class AddRentVehicleDTO{
private String endCityName;
//司机类型 1--公司司机;2--自己司机
@Column(name = "driver_type")
@ApiModelProperty(value = "司机类型 1--公司司机;2--自己司机")
private Integer driverType;
//自己司机ids
@Column(name = "my_driver_ids")
@ApiModelProperty(value = "自己司机ids")
private String myDriverIds;
//出发公司Id
@Column(name = "start_company_id")
@ApiModelProperty(value = "出发公司Id")
private Integer startCompanyId;
//结束公司Id
@Column(name = "end_company_id")
@ApiModelProperty(value = "结束公司Id")
private Integer endCompanyId;
//车型id
@Column(name = "model_id")
@ApiModelProperty(value = "车型id")
private Integer modelId;
//车型id
@ApiModelProperty(value = "是否购买免赔")
private Integer damageSafe;
/**
* 是否使用出租免费天数
*/
@ApiModelProperty(value = "是否使用出租免费天数")
private Integer rentFreeDay;
/**
* 优惠券ids
*/
@ApiModelProperty(value = "优惠券ids")
private String couponIds;
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......
......@@ -68,4 +68,10 @@ public class AddTourDTO {
@Column(name = "has_insure")
@ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要")
Integer hasInsure;
/**
* 优惠券ids
*/
@ApiModelProperty(value = "优惠券ids")
private String couponIds;
}
......@@ -129,12 +129,13 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
*/
public void cancel(BaseOrder baseOrder) {
if(cancelAble.get(baseOrder.getType()).contains(baseOrder.getStatus())) {
int updateResult = this.updateSelectiveByIdRe(new BaseOrder(){{
BaseOrder updateOrder = new BaseOrder(){{
setId(baseOrder.getId());
setStatus(OrderStatusEnum.ORDER_CANCEL.getCode());
setCancelReason(baseOrder.getCancelReason());
setVersion(baseOrder.getVersion());
}});
}};
int updateResult = this.updateSelectiveByIdRe(updateOrder);
//如果取消失败,则抛异常
if(updateResult <= 0) {
......@@ -143,7 +144,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//触发退款流程
//判断是否已支付
if(baseOrder.getHasPay().equals(SYS_TRUE)) {
if(SYS_TRUE.equals(baseOrder.getHasPay())) {
//判断订单类型
if(OrderTypeEnum.RentVehicle.getCode().equals(baseOrder.getType())) {
OrderRentVehicleDetail orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail(){{
......
package com.xxfc.platform.order.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -52,5 +53,14 @@ public class RabbitUserConfig {
public Binding cfgDelayBinding(Queue cfgDelayQueue, CustomExchange cfgUserDelayExchange){
return BindingBuilder.bind(cfgDelayQueue).to(cfgUserDelayExchange).with(ORDER_CANCEL_KEY).noargs();
}
// @Bean
// public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory){
// SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
// factory.setConnectionFactory(connectionFactory);
//// factory.setMessageConverter(new Jackson2JsonMessageConverter());
// factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
// return factory;
// }
}
......@@ -56,7 +56,7 @@ public class RabbitConsumer {
* 其中的参数如果为true是把消息退回到queue但是有可能被其它的consumer(集群)接收到,
* 设置为false是只补发给当前的consumer
*/
channel.basicRecover(false);
channel.basicRecover(true);
}
}
}
......@@ -38,7 +38,7 @@ public class OrderTourVerificationController extends CommonBaseController {
@Autowired
UserFeign userFeign;
public UserDTO getUserInfo(){ return userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();}
public UserDTO getUserInfo(){ return userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();}
@RequestMapping(value = "/verification/orderlist",method = RequestMethod.GET)
@ApiOperation(value = "旅游核销订单列表")
......
......@@ -87,31 +87,12 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
detail.setOrderId(detail.getOrder().getId());
detailBiz.insertSelective(detail);
detail.getOrder().setDetailId(detail.getId());
baseOrderBiz.updateSelectiveById(detail.getOrder());
int updateResult =baseOrderBiz.updateSelectiveByIdRe(detail.getOrder());
if(updateResult > 0) {
detail.getOrder().setVersion(detail.getOrder().getVersion() + 1);
}
}
// /**
// * 创建订单及其多子项
// * @param details
// */
// public void createOrder(List<Detail> details) {
// BaseOrder order = createOrder();
// for(Detail detail : details) {
// preHandleDetail(order, detail);
// }
// handleDetail(details);
// }
//
// /**
// * 处理订单多子项
// * @param details
// */
// public void handleDetail(List<Detail> details){
// for(Detail detail : details) {
// detailBiz.insertSelective(detail);
// }
// }
/**
* 计算价格
* @param detail
......
......@@ -92,7 +92,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
super.handleDetail(bo);
//发送定时取消订单(30分钟)
rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 30);
//rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 30);
rabbitProduct.sendDelayMessage(bo.getOrder(), 100L * 6 * 3);
}
@Override
......@@ -116,7 +117,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
AppUserDTO dto = detail.getAppUserDTO();
//如果用户存在,并且为会员,并且车辆有优惠价
if(null != dto && null != detail.getRentFreeDay() && detail.getRentFreeDay() > 0 && dto.getRentFreeDays() > 0) {
if(null != dto && null != detail.getRentFreeDay() && detail.getRentFreeDay() > 0 ) {
if(dto.getRentFreeDays() <= 0) {
throw new BaseException(ResultCode.PARAM_EXPIRE_CODE);
}
if(detail.getDayNum() > dto.getRentFreeDays()) {
freeDayNum = dto.getRentFreeDays();
}else {
......@@ -127,6 +131,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
vehicleDayNum = detail.getDayNum();
}
detail.setFreeDays(freeDayNum);
//计算价格
//计算车辆费用
VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData();
......@@ -136,7 +142,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
String[] prices = StrUtil.isBlank(vehicleModel.getRentDiscountPrice())
?new String[]{vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString()}
:vehicleModel.getRentDiscountPrice().split(",");
switch (MemberEnum.getByCode(detail.getAppUserDTO().getIsMember())) {
switch (MemberEnum.getByCode(detail.getAppUserDTO().getMemberLevel())) {
case NORMAL:
modelAmount = handleDiscount(vehicleModel, prices, NORMAL);
break;
......@@ -199,7 +205,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
private BigDecimal handleDiscount(VehicleModel vehicleModel, String[] prices, MemberEnum memberEnum) {
BigDecimal modelAmount;//会员比例
if(DISCOUNT_STATUS_MEMBER.equals(vehicleModel.getRentDiscountStatus())) {
modelAmount = new BigDecimal(String.valueOf((memberEnum.getPercent()/100))).multiply(vehicleModel.getPrice());
modelAmount = new BigDecimal(String.valueOf((memberEnum.getPercent()/100d))).multiply(vehicleModel.getPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
}else {
//会员固定价列表
modelAmount = new BigDecimal(prices[(memberEnum.getCode() - 1)]);
......@@ -220,7 +226,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
childrenStr.append(",${tem_0104}");
}
if(childrenStr.length() > 0){
childrenStr.deleteCharAt(1);
childrenStr.deleteCharAt(0);
}
return childrenStr.toString();
}
......@@ -242,6 +248,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
private void acquireVehicle(RentVehicleBO detail) {
//根据车型、时间、距离,门店,预定车辆
RentVehicleBookDTO rentVehicleBookDTO = BeanUtil.toBean(detail.getBookVehicleVO(), RentVehicleBookDTO.class);
rentVehicleBookDTO.setModelId(detail.getModelId());
rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO);
detail.setVehicleId(orr.getData().getVehicleId());
......
......@@ -209,11 +209,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
childrenStr.append(",${tem_0203}");
}
String str = childrenStr.toString();
if(str.length() > 0) {
str = str.substring(1, str.length());
if(childrenStr.length() > 0){
childrenStr.deleteCharAt(0);
}
return str;
return childrenStr.toString();
}
/**
......
......@@ -78,6 +78,8 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
//获取出行时间
List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id);
detailVo.setTourDepartTimeVo(timelist);
Integer stock=priceMapper.getTotalStock(id);
detailVo.setStock(stock);
//获取出发地点
List<TourDepartVo> departList = siteMapper.getlistByGoodId(id);
detailVo.setTourDepartVo(departList);
......
......@@ -18,6 +18,9 @@ public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
List<TourDepartTimeVo> getAllByGoodId(@Param("goodId") Integer goodId);
//获取总库存
Integer getTotalStock(@Param("goodId") Integer goodId);
//减库存
int updStockById(@Param("id") Integer id,@Param("number") Integer number,@Param("type") Integer type);
......
......@@ -34,7 +34,7 @@ public class TourUserController extends TourBaseController<TourUserBiz> {
@GetMapping("/app/unauth/getTourUser/{isChild}")
public ObjectRestResponse findListByTourUserByIsChild(@PathVariable int isChild){
AppUserDTO userInfo = getUserInfo();
Integer id = userInfo.getId();
Integer id = userInfo.getUserid();
List<TourUser> tourUsers= baseBiz.findListByTourUserByIsChild(id,isChild);
return ObjectRestResponse.succ(tourUsers);
......@@ -115,7 +115,7 @@ public class TourUserController extends TourBaseController<TourUserBiz> {
if (userInfo==null||userInfo.getUserid()==null||userInfo.getUserid()==0) {
ObjectRestResponse.createDefaultFail();
}
Integer id = userInfo.getId();
Integer id = userInfo.getUserid();
List<TourUser> tourUsers= baseBiz.getTourUser(id);
return ObjectRestResponse.succ(tourUsers);
}
......
......@@ -41,6 +41,11 @@
FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0 ORDER BY start_time
</select>
<!-- 获取出行时间 -->
<select id="getTotalStock" resultType="Integer" >
SELECT IFNULL(SUM(stock),0) as stock FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0 and IFNULL(DATEDIFF(start_time,NOW()),0)>0
</select>
<!-- 减库存-->
<update id="updStockById">
update tour_good_spe_price set
......
package com.xxfc.platform.universal.api;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.model.JuheResult;
import com.xxfc.platform.universal.vo.TrafficViolations;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
//@FeignClient(name = "xx-universal")
@RequestMapping("/3p/tv")
public interface ITrafficViolationsFeign {
}
package com.xxfc.platform.universal.api;
import com.xxfc.platform.universal.model.JuheResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient("xx-third-party")
@RequestMapping("3p/tv")
public interface ITrafficViolationsService {
/**
* 获取支持的城市
* @param province
* @return
*/
@RequestMapping(value = "city", method = RequestMethod.GET)
JuheResult getCityInfo(String province);
/**
* 查违章
* @param city 城市代码
* @param hphm 车牌号码
* @param hpzl 车辆类型 01:大车,02:小车
* @param engineno 发动机号
* @param classno 车架号
* @return
*/
@RequestMapping(value = "trafficViolations", method = RequestMethod.GET)
JuheResult queryTrafficViolations(String city, String hphm, String hpzl, String engineno, String classno);
/**
* 获取剩余查询次数
* @return
*/
@RequestMapping(value = "balance", method = RequestMethod.GET)
JuheResult getBalance();
/**
* 根据车牌查归属地
* @param hphm 车牌号码
* @return
*/
@RequestMapping(value = "carPre", method = RequestMethod.GET)
JuheResult carPre(String hphm);
}
package com.xxfc.platform.universal.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.code.IdentityDialect;
import javax.persistence.Column;
import javax.persistence.Id;
import java.util.Date;
@Data
public class searchableCity {
@Id
@KeySql(dialect = IdentityDialect.MYSQL)
private Integer id;
private String code;
@Column(name = "city_name")
private String cityName;
@Column(name = "create_date")
@DateTimeFormat(pattern ="yyyy-MM-dd HH:mm:ss" )
@JsonFormat(timezone = "GMT-8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDate;
@Column(name = "update_date")
@DateTimeFormat(pattern ="yyyy-MM-dd HH:mm:ss" )
@JsonFormat(timezone = "GMT-8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateDate;
}
......@@ -5,11 +5,9 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.universal.entity.OrderRefund;
import com.xxfc.platform.universal.vo.OrderPayVo;
import com.xxfc.platform.universal.vo.OrderRefundVo;
import com.xxfc.platform.universal.vo.TrafficViolations;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -30,4 +28,25 @@ public interface ThirdFeign {
@RequestMapping(value = "/refund/app/wx", method = RequestMethod.POST)
public ObjectRestResponse<String> refund(@RequestBody OrderRefundVo orderRefundVo);
/**
* 获取支持的城市
* @return
*/
@GetMapping("/city")
ObjectRestResponse getCityInfo();
/**
* 违章车辆查询
* @return
*/
@PostMapping("/trafficViolations")
ObjectRestResponse queryTrafficViolations(@RequestBody TrafficViolations trafficViolations) ;
/**
* 车辆类型查询
* @return
*/
@GetMapping("/LicensePlateType")
ObjectRestResponse getLicensePlateType();
}
package com.xxfc.platform.universal.vo;
import lombok.Data;
@Data
public class TrafficViolations {
/**
* 车牌类型
*/
private String type;
/**
* 车牌号码
*/
private String plateno;
/**
* 发动机号
*/
private String engineno;
/**
* 车架号
*/
private String frameno;
}
......@@ -19,7 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAceCache
@EnableTransactionManagement
@tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.universal.mapper")
@EnableFeignClients(value = {"com.github.wxiaoqi.security.auth.client.feign", "com.xxfc.platform","com.github.wxiaoqi.security.admin.feign"},defaultConfiguration = HeaderConfig.class)
@EnableFeignClients(value = {"com.xxfc.platform","com.github.wxiaoqi.security"},defaultConfiguration = HeaderConfig.class)
public class UniversalApplication {
public static void main(String[] args) {
......
package com.xxfc.platform.universal.controller;
import com.xxfc.platform.universal.api.ITrafficViolationsService;
import com.xxfc.platform.universal.model.JuheResult;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.universal.service.TrafficViolationsService;
import com.xxfc.platform.universal.vo.TrafficViolations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("3p/tv")
public class TrafficViolationsController {
//implements ITrafficViolationsService {
// @Autowired
// TrafficViolationsService tvService;
//
// @Override
// @GetMapping("city")
// public JuheResult getCityInfo(String province) {
// return tvService.getCity(province);
// }
//
// @Override
// @GetMapping("trafficViolations")
// public JuheResult queryTrafficViolations(String city, String hphm, String hpzl, String engineno, String classno) {
// return tvService.queryViolations(city, hphm, hpzl, engineno, classno);
// }
//
// @Override
// @GetMapping("balance")
// public JuheResult getBalance() {
// return tvService.queryBalance();
// }
//
// @Override
// @GetMapping("carPre")
// public JuheResult carPre(String hphm) {
// return tvService.queryCityByHphm(hphm);
// }
@Autowired
TrafficViolationsService tvService;
/**
* 获取支持的城市
* @return
*/
@GetMapping("/city")
public ObjectRestResponse getCityInfo() {
try {
return ObjectRestResponse.succ(JSONObject.parse(tvService.getCity()));
} catch (Exception e) {
e.printStackTrace();
return ObjectRestResponse.createDefaultFail();
}
}
/**
* 违章车辆查询
* @return
*/
@PostMapping("/trafficViolations")
public ObjectRestResponse queryTrafficViolations(@RequestBody TrafficViolations trafficViolations) {
try {
return ObjectRestResponse.succ(JSONObject.parse(tvService.queryViolations(trafficViolations)));
} catch (Exception e) {
e.printStackTrace();
return ObjectRestResponse.createDefaultFail();
}
}
/**
* 车辆类型查询
* @return
*/
@GetMapping("/LicensePlateType")
public ObjectRestResponse getLicensePlateType() {
try {
return ObjectRestResponse.succ(JSONObject.parse(tvService.getLicensePlateType()));
} catch (Exception e) {
e.printStackTrace();
return ObjectRestResponse.createDefaultFail();
}
}
}
package com.xxfc.platform.universal.service;
import com.alibaba.fastjson.JSON;
import com.xxfc.platform.universal.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.universal.entity.searchableCity;
import com.xxfc.platform.universal.utils.CertifHttpUtils;
import com.xxfc.platform.universal.vo.TrafficViolations;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 违章查询
* 注意:调用"北京库斯曼科技有限公司"的接口,返回参是Unicode编码
*/
//@Service
@Service
public class TrafficViolationsService {
@Value("${juhe.key}")
private String KEY;
//支持的城市
private static final String URL_GET_CITY = "http://v.juhe.cn/wz/citys?" +
"province={province}&dtype={dtype}&format={format}&callback={callback}&key={key}";
//查违章
private static final String URL_QUERY_WZ = "http://v.juhe.cn/wz/query?" +
"dtype={dtype}&city={city}&hphm={hphm}&hpzl={hpzl}&engineno={engineno}&classno={classno}&key={key}";
//剩余次数
private static final String URL_BALANCE = "http://v.juhe.cn/wz/status?" +
"dtype={dtype}&key={key}";
//根据车牌查城市
private static final String URL_CAR_PRE = "http://v.juhe.cn/wz/carPre?" +
"hphm={hphm}&key={key}";
@Autowired
RestTemplate restTemplate;
@Value("${ALIYUN.CODE}")
private String CODE;
@Value("${RETURN.TYPE}")
private String TYPE;
private static final String CITY_HOST = "https://weizhang.market.alicloudapi.com";
private static final String CITY_PATH = "/wz/province";
private static final String CITY_METHOD = "GET";
private static final String VIOLATIONS_HOST = "https://weizhang.market.alicloudapi.com";
private static final String VIOLATIONS_PATH = "/wz/query";
private static final String VIOLATIONS_METHOD = "GET";
private static final String GET_LICENSE_PLATE_TYPE_HOST = "https://weizhang.market.alicloudapi.com";
private static final String GET_LICENSE_PLATE_TYPE_PATH = "/wz/type";
private static final String GET_LICENSE_PLATE_TYPE_METHOD = "GET";
private static final String TYPE_NAME = "type";
private static final String PLATENO_NAME="plateno";
private static final String ENGINENO_NAME="engineno";
private static final String FRAMENO_NAME="frameno";
private static final String AUTHORIZATION="Authorization";
/**
* 获取支持城市
* province string N 默认全部,省份简写,如:ZJ、JS
* dtype string N 返回数据格式:json或xml或jsonp,默认json
* format int N 格式选择1或2,默认1
* callback String N 返回格式选择jsonp时,必须传递
* {"resultcode":"101","reason":"error key","result":null,"error_code":10001}
* 支持城市
*
* @return
* @throws Exception type 返回参数类型
*/
public JuheResult<Map<String, JuheTrafficViolationsProvinceInfo>> getCity(String province) {
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("key", KEY);
paramsMap.put("province", province == null ? "" : province);
paramsMap.put("dtype", "json");
paramsMap.put("format", "");
paramsMap.put("callback", "");
return query(URL_GET_CITY, paramsMap);
@Scheduled(cron = "0 0 0 * * ?")
public String getCity() throws Exception {
Map<String, String> headers = new HashMap<String, String>();
headers.put(AUTHORIZATION, "APPCODE " + CODE);
Map<String, String> querys = new HashMap<String, String>();
querys.put(TYPE_NAME, TYPE);
HttpResponse httpResponse = CertifHttpUtils.doGet(CITY_HOST, CITY_PATH, CITY_METHOD, headers, querys);
HttpEntity entity = httpResponse.getEntity();
String result = EntityUtils.toString(entity);
JSONObject.parseObject(result, searchableCity.class);
return unicodeToString(EntityUtils.toString(entity));
}
/**
* 查违章
* dtype string 否 返回数据格式:默认:json
* city String 是 城市代码 *
* hphm String 是 号牌号码 完整7位 ,需要utf8 urlencode*
* hpzl String 是 号牌类型,默认02:小型车,01:大型车
* engineno String 否 发动机号 (具体是否需要根据城市接口中的参数填写)
* classno String 否 车架号 (具体是否需要根据城市接口中的参数填写)
* 违章车辆查询
*
* @param trafficViolations
* @return
*/
public JuheResult<JuheTrafficViolationsInfo> queryViolations(String city, String hphm, String hpzl,
String engineno, String classno) {
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("key", KEY);
paramsMap.put("dtype", "json");
paramsMap.put("city", city);
paramsMap.put("hphm", hphm);
paramsMap.put("hpzl", hpzl);
paramsMap.put("engineno", engineno);
paramsMap.put("classno", classno);
return query(URL_QUERY_WZ, paramsMap);
public String queryViolations(TrafficViolations trafficViolations) throws Exception {
Map<String, String> headers = new HashMap<String, String>();
headers.put(AUTHORIZATION, "APPCODE " + CODE);
Map<String, String> querys = new HashMap<String, String>();
querys.put(TYPE_NAME, trafficViolations.getType());
querys.put(PLATENO_NAME, trafficViolations.getPlateno());
querys.put(ENGINENO_NAME, trafficViolations.getEngineno());
querys.put(FRAMENO_NAME, trafficViolations.getFrameno());
HttpResponse httpResponse = CertifHttpUtils.doGet(VIOLATIONS_HOST, VIOLATIONS_PATH, VIOLATIONS_METHOD, headers, querys);
HttpEntity entity = httpResponse.getEntity();
return unicodeToString(EntityUtils.toString(entity));
}
/**
* 查询剩余次数
* 查询车牌类型
*
* @return
* @throws Exception
*
*/
public JuheResult<JuheTrafficViolationsBalanceInfo> queryBalance() {
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("key", KEY);
paramsMap.put("dtype", "json");
return query(URL_BALANCE, paramsMap);
public String getLicensePlateType() throws Exception {
Map<String, String> headers = new HashMap<String, String>();
headers.put(AUTHORIZATION, "APPCODE " + CODE);
HashMap<String, String> querys = new HashMap<>();
HttpResponse httpResponse = CertifHttpUtils.doGet(GET_LICENSE_PLATE_TYPE_HOST,
GET_LICENSE_PLATE_TYPE_PATH,
GET_LICENSE_PLATE_TYPE_METHOD,
headers,
querys
);
HttpEntity entity = httpResponse.getEntity();
return unicodeToString(EntityUtils.toString(entity));
}
/**
* 根据车牌前缀查城市参数
* Unicode转汉字字符串
* @param str
* @return
*/
public JuheResult<JuheCarPreInfo> queryCityByHphm(String hphm) {
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("key", KEY);
paramsMap.put("hphm", hphm);
return query(URL_CAR_PRE, paramsMap);
}
private JuheResult query(String url, Map<String, String> paramsMap) {
try {
String responseStr = restTemplate.getForObject(url, String.class, paramsMap);
return JSON.parseObject(responseStr, JuheResult.class);
} catch (RestClientException ex) {
JuheResult result = new JuheResult();
result.setReason("请求错误");
result.setResultcode("500");
return result;
private String unicodeToString(String str) {
Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))");
Matcher matcher = pattern.matcher(str);
char ch;
while (matcher.find()) {
String group = matcher.group(2);
ch = (char) Integer.parseInt(group, 16);
String group1 = matcher.group(1);
str = str.replace(group1, ch + "");
}
return str;
}
}
#\u8BA4\u8BC1\u63A5\u53E3\u9700\u8981\u643A\u5E26\u7684\u53C2\u6570
#A\u8BA4\u8BC1
#A-\u8BA4\u8BC1
certif.cHost=https://idcert.market.alicloudapi.com
certif.cPath=/idcard
certif.cMethod=GET
certif.cAppcode=acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u8EAB\u4EFD\u8BC1\u53F7\u5B57\u6BB5\u540D\u79F0
certif.idCardName=idCard
#\u59D3\u540D\u5B57\u6BB5\u540D\u79F0
certif.cName=name
#2.\u54CD\u5E94
#\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.certifRet=status
#\u8BA4\u8BC1\u6210\u529F\u7801
certif.certifResultCode=01
#B\u56FE\u7247\u89E3\u6790
#B-\u56FE\u7247\u89E3\u6790
certif.iHost=https://ocridcard.market.alicloudapi.com
certif.iPath =/idimages
certif.iPath=/idimages
certif.iMethod=POST
certif.iAppcode =acea1c8811f748b3a65815f11db357c4
certif.iAppcode=acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u56FE\u7247url\u5B57\u6BB5\u540D
certif.picName=image
......@@ -34,7 +28,6 @@ certif.typeName=idCardSide
certif.frontParameter=front
#\u56FE\u7247\u80CC\u9762\u6807\u8BC6\u53C2\u6570
certif.backParameter=back
#2.\u54CD\u5E94
#\u56FE\u7247\u89E3\u6790\u54CD\u5E94\u643A\u5E26\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.imageRet=code
......@@ -48,3 +41,9 @@ certif.numberName=code
certif.iName=name
#\u8EAB\u4EFD\u8BC1\u5230\u671F\u65F6\u95F4\u5B57\u6BB5\u540D
certif.expirationDateName=expiryDate
#C-\u8FDD\u7AE0\u8F66\u8F86\u67E5\u8BE2
#\u63A5\u53E3appcode
ALIYUN.CODE=acea1c8811f748b3a65815f11db357c4
#\u8FD4\u56DE\u53C2\u6570\u7C7B\u578B(HTML/JSON/JSONP/XML)
RETURN.TYPE=JSON
\ No newline at end of file
......@@ -13,33 +13,39 @@ import com.xxfc.platform.vehicle.pojo.AddOrUpdateAccompanyingItem;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.pojo.QueryAccompanyItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
@RestController
@RequestMapping("/accompanyingItem")
@IgnoreClientToken
@Slf4j
public class AccompanyingItemController extends BaseController<AccompanyingItemBiz> {
@Autowired
AccompanyingItemBiz accompanyingItemBiz;
@RequestMapping(value ="/{id}",method = RequestMethod.GET)
private RestResponse<AccompanyingItem> get(@PathVariable Integer id) throws Exception{
/**
*
* @param id
* @return
* @throws Exception
*/
@GetMapping(value ="/{id}")
public RestResponse<AccompanyingItem> get(@PathVariable Integer id) throws Exception{
return RestResponse.codeAndData(RestResponse.SUC_CODE,baseBiz.get(id));
}
@RequestMapping(value ="/all",method = RequestMethod.GET)
private RestResponse<List<AccompanyingItem>> getAll(){
return RestResponse.codeAndData(RestResponse.SUC_CODE,accompanyingItemBiz.getAll());
public RestResponse<List<AccompanyingItem>> getAll(){
return RestResponse.codeAndData(RestResponse.SUC_CODE,baseBiz.getAll());
}
@RequestMapping(value ="/page",method = RequestMethod.GET)
private RestResponse<PageDataVO<AccompanyingItem>> getByPage(@RequestParam String queryAccompanyItemVoJson) throws Exception{
public RestResponse<PageDataVO<AccompanyingItem>> getByPage(@RequestParam String queryAccompanyItemVoJson) throws Exception{
QueryAccompanyItemVo queryAccompanyItemVo = null;
try {
queryAccompanyItemVo = JSON.parseObject(queryAccompanyItemVoJson,QueryAccompanyItemVo.class);
......@@ -52,17 +58,17 @@ public class AccompanyingItemController extends BaseController<AccompanyingItemB
}
@RequestMapping(value ="",method = RequestMethod.POST)
private RestResponse<Integer> add(@RequestBody AddOrUpdateAccompanyingItem addOrUpdateAccompanyingItem) throws Exception{
public RestResponse<Integer> add(@RequestBody AddOrUpdateAccompanyingItem addOrUpdateAccompanyingItem) throws Exception{
return baseBiz.add(addOrUpdateAccompanyingItem);
}
@RequestMapping(value ="",method = RequestMethod.PUT)
private RestResponse<Integer> update(@RequestBody AddOrUpdateAccompanyingItem addOrUpdateAccompanyingItem) throws Exception{
public RestResponse<Integer> update(@RequestBody AddOrUpdateAccompanyingItem addOrUpdateAccompanyingItem) throws Exception{
return baseBiz.update(addOrUpdateAccompanyingItem);
}
@RequestMapping(value ="/{id}",method = RequestMethod.DELETE)
private RestResponse<Integer> del(@PathVariable Integer id) throws Exception{
public RestResponse<Integer> del(@PathVariable Integer id) throws Exception{
return baseBiz.del(id);
}
}
......@@ -12,12 +12,18 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 片区
*/
@RestController
@RequestMapping("/area")
@Slf4j
@IgnoreClientToken
public class AreaController extends BaseController<AreaBiz, Area> {
/**
* 获取所有片区
* @return
*/
@GetMapping("/findAll")
public RestResponse<List<Area>> findAll(){
return RestResponse.suc(baseBiz.selectListAll());
......
......@@ -24,15 +24,14 @@
, st_distance_sphere(point(#{lon}, #{lat}), point(longitude, latitude)) as distance
</if>
from branch_company
<trim prefix="where" suffixOverrides="and">
<if test="addrCity != null">
addr_city = #{addrCity}
</if>
<if test="lon != null and lat != null">
longitude is not null and latitude is not null
</if>
</trim>
<where>
<if test="addrCity != null">
and addr_city = #{addrCity}
</if>
<if test="lon != null and lat != null">
and longitude is not null and latitude is not null
</if>
</where>
<if test="lon != null and lat != null">
order by distance asc
</if>
......
......@@ -66,7 +66,7 @@
left join
vehicle_book_info vbi on v.`id` = vbi.vehicle
</if>
LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id 58 left join branch_company bc on v.`subordinate_branch` = bc.id
LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
where
v.is_del=0
......
......@@ -13,6 +13,8 @@ import com.alibaba.fastjson.JSONObject;
import com.github.stuxuhai.jpinyin.PinyinHelper;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.google.common.collect.Sets;
import com.mysql.cj.conf.RuntimeProperty;
import com.xxfc.platform.vehicle.VehicleApplication;
import com.xxfc.platform.vehicle.biz.SysRegionBiz;
import com.xxfc.platform.vehicle.constant.RedisKey;
......@@ -29,9 +31,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.io.PrintStream;
import java.util.*;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes={VehicleApplication.class})
......@@ -59,6 +60,8 @@ public class RegionTest {
public class NewData{
Long id;
String name;
String lat;
String lon;
}
@Data
......@@ -131,34 +134,61 @@ public class RegionTest {
System.out.println("test");
}
@Test
public void test1() {
int i = DateTime.now().getMinuteOfDay() / 5;
System.out.println("DateTime.now().getMinuteOfDay() / 5++++++++++++"+i);
String redisLockKey = RedisKey.SYS_REGION_REFRESH_LOCK +i;//同一日每5分钟只刷新一次
System.out.println("redisLockKey++++++++++++++++"+redisLockKey);
String s = String.valueOf(DateTime.now().getMillis());
System.out.println("s++++++++++++++++++"+s);
Boolean suc = customRedisTemplate.opsForValue().setIfAbsent(redisLockKey, s);
Boolean test1 = customRedisTemplate.opsForValue().setIfAbsent("1", "2");
Boolean test2 = customRedisTemplate.opsForValue().setIfAbsent("1", "3");
System.out.println("test1///////////////////////////////"+test1);
System.out.println("test2///////////////////////////////"+test2);
System.out.println("suc++++++++++++++++++++"+suc);
}
// @Test
// public void test1() {
// int i = DateTime.now().getMinuteOfDay() / 5;
// System.out.println("DateTime.now().getMinuteOfDay() / 5++++++++++++"+i);
// String redisLockKey = RedisKey.SYS_REGION_REFRESH_LOCK +i;//同一日每5分钟只刷新一次
// System.out.println("redisLockKey++++++++++++++++"+redisLockKey);
// String s = String.valueOf(DateTime.now().getMillis());
// System.out.println("s++++++++++++++++++"+s);
// Boolean suc = customRedisTemplate.opsForValue().setIfAbsent(redisLockKey, s);
// Boolean test1 = customRedisTemplate.opsForValue().setIfAbsent("1", "2");
// Boolean test2 = customRedisTemplate.opsForValue().setIfAbsent("1", "3");
// System.out.println("test1///////////////////////////////"+test1);
// System.out.println("test2///////////////////////////////"+test2);
// System.out.println("suc++++++++++++++++++++"+suc);
// }
//
// @Test
// public void testRedis() {
// SysRegion sysRegion = getSysRegion(1);
// System.out.println("sysRegion+++++++++"+sysRegion);
// System.out.println("TEST_REDIS_KEY+++++++++++" + TEST_REDIS_KEY);
// }
//
// @Cache(key = TEST_REDIS_KEY)
// private SysRegion getSysRegion(int id){
// SysRegion sysRegion = sysRegionBiz.selectById(2);
// return sysRegion;
// }
@Test
public void testRedis() {
SysRegion sysRegion = getSysRegion(1);
System.out.println("sysRegion+++++++++"+sysRegion);
System.out.println("TEST_REDIS_KEY+++++++++++" + TEST_REDIS_KEY);
}
@Cache(key = TEST_REDIS_KEY)
private SysRegion getSysRegion(int id){
SysRegion sysRegion = sysRegionBiz.selectById(2);
return sysRegion;
}
@Test
public void testStream(){
List<Integer> integers = Arrays.asList(1, 3, 5, 7, 9,9);
HashSet<Integer> objects = new HashSet<>();
objects.addAll(integers);
System.out.println(objects);
System.out.println("获取最小值");
Optional<Integer> min = objects.parallelStream().min(Integer::compareTo);
if (min.isPresent()) {
System.out.println(min.get());
}
System.out.println("获取最大");
Optional<Integer> max = integers.parallelStream().max(Integer::compareTo);
if (max.isPresent()) {
System.out.println(max.get());
}
System.out.println("排序");
integers.stream().sorted().forEach(elem -> System.out.println(elem));
System.out.println("筛选");
integers.parallelStream().filter(e ->e>1).filter(e -> e<9).forEach(e -> System.out.println(e));
System.out.println("list的总和为");
integers.stream().reduce((a,b) -> a+b).ifPresent(System.out::println);
}
}
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