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

商品,公司相关

parent 22eec2e9
package com.github.wxiaoqi.security.auth.controller; package com.github.wxiaoqi.security.auth.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.service.AuthService; import com.github.wxiaoqi.security.auth.service.AuthService;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationChwRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.constant.RequestTypeConstants; import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
...@@ -17,6 +19,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -17,6 +19,9 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map; import java.util.Map;
import static com.github.wxiaoqi.security.common.constant.RequestTypeConstants.BUSINESS;
import static com.github.wxiaoqi.security.common.constant.RequestTypeConstants.OPERATE;
@Api(tags = "用户登录") @Api(tags = "用户登录")
@RestController @RestController
@RequestMapping("jwt") @RequestMapping("jwt")
...@@ -54,7 +59,7 @@ public class AuthController { ...@@ -54,7 +59,7 @@ public class AuthController {
@RequestMapping(value = "/chw/token", method = RequestMethod.POST) @RequestMapping(value = "/chw/token", method = RequestMethod.POST)
public ObjectRestResponse<String> chwCreateAuthenticationToken( public ObjectRestResponse<String> chwCreateAuthenticationToken(
@RequestBody JwtAuthenticationRequest authenticationRequest, @RequestBody JwtAuthenticationChwRequest authenticationRequest,
HttpServletRequest request) throws Exception { HttpServletRequest request) throws Exception {
log.info(authenticationRequest.getUsername()+" require logging..."); log.info(authenticationRequest.getUsername()+" require logging...");
// keliii 分请求类型处理token // keliii 分请求类型处理token
...@@ -63,10 +68,15 @@ public class AuthController { ...@@ -63,10 +68,15 @@ public class AuthController {
requestType = RequestTypeConstants.BASE; requestType = RequestTypeConstants.BASE;
} }
final String token; final String token;
if (RequestTypeConstants.APP.equals(requestType)) { if(StrUtil.isNotBlank(requestType)) {
token = appAuthService.login(authenticationRequest); if(OPERATE.equals(requestType)) {
} else { authenticationRequest.setBizType(1);
token = authService.login(authenticationRequest); }else if (BUSINESS.equals(requestType)) {
authenticationRequest.setBizType(2);
}
token = authService.loginChw(authenticationRequest);
}else {
token = "";
} }
return new ObjectRestResponse<String>().data(token); return new ObjectRestResponse<String>().data(token);
} }
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.api.vo.user.AppUserInfo; import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import com.github.wxiaoqi.security.api.vo.user.UserInfo; import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.configuration.FeignConfiguration; import com.github.wxiaoqi.security.auth.configuration.FeignConfiguration;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationChwRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -22,6 +23,9 @@ public interface IUserService { ...@@ -22,6 +23,9 @@ public interface IUserService {
@RequestMapping(value = "/api/user/validate", method = RequestMethod.POST) @RequestMapping(value = "/api/user/validate", method = RequestMethod.POST)
public UserInfo validate(@RequestBody JwtAuthenticationRequest authenticationRequest); public UserInfo validate(@RequestBody JwtAuthenticationRequest authenticationRequest);
@RequestMapping(value = "/api/user/chw/validate", method = RequestMethod.POST)
public UserInfo validateChw(@RequestBody JwtAuthenticationChwRequest authenticationRequest);
@RequestMapping(value = "/api/user/validate/small", method = RequestMethod.POST) @RequestMapping(value = "/api/user/validate/small", method = RequestMethod.POST)
public UserInfo validateSmall(@RequestBody JwtAuthenticationRequest authenticationRequest); public UserInfo validateSmall(@RequestBody JwtAuthenticationRequest authenticationRequest);
......
...@@ -2,11 +2,13 @@ package com.github.wxiaoqi.security.auth.service; ...@@ -2,11 +2,13 @@ package com.github.wxiaoqi.security.auth.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationChwRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
public interface AuthService { public interface AuthService {
String login(JwtAuthenticationRequest authenticationRequest) throws Exception; String login(JwtAuthenticationRequest authenticationRequest) throws Exception;
String loginChw(JwtAuthenticationChwRequest authenticationRequest) throws Exception;
ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception; ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception;
String refresh(String oldToken) throws Exception; String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception; void validate(String token) throws Exception;
......
...@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; ...@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.auth.common.util.jwt.JWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.JWTInfo;
import com.github.wxiaoqi.security.auth.feign.IUserService; import com.github.wxiaoqi.security.auth.feign.IUserService;
import com.github.wxiaoqi.security.auth.service.AuthService; import com.github.wxiaoqi.security.auth.service.AuthService;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationChwRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil; import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil;
import com.github.wxiaoqi.security.common.constant.RequestTypeConstants; import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
...@@ -42,6 +43,11 @@ public class AppAuthServiceImpl implements AuthService { ...@@ -42,6 +43,11 @@ public class AppAuthServiceImpl implements AuthService {
throw new UserInvalidException("用户不存在或账户密码错误!"); throw new UserInvalidException("用户不存在或账户密码错误!");
} }
@Override
public String loginChw(JwtAuthenticationChwRequest authenticationRequest) throws Exception {
return null;
}
@Override @Override
public ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception { public ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception {
UserInfo info = userService.validateSmall(authenticationRequest); UserInfo info = userService.validateSmall(authenticationRequest);
......
...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; ...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.auth.common.util.jwt.JWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.JWTInfo;
import com.github.wxiaoqi.security.auth.feign.IUserService; import com.github.wxiaoqi.security.auth.feign.IUserService;
import com.github.wxiaoqi.security.auth.service.AuthService; import com.github.wxiaoqi.security.auth.service.AuthService;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationChwRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil; import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil;
import com.github.wxiaoqi.security.common.constant.RequestTypeConstants; import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
...@@ -41,6 +42,15 @@ public class AuthServiceImpl implements AuthService { ...@@ -41,6 +42,15 @@ public class AuthServiceImpl implements AuthService {
throw new UserInvalidException("用户不存在或账户密码错误!"); throw new UserInvalidException("用户不存在或账户密码错误!");
} }
@Override
public String loginChw(JwtAuthenticationChwRequest authenticationRequest) throws Exception {
UserInfo info = userService.validateChw(authenticationRequest);
if (!StringUtils.isEmpty(info.getId())) {
return jwtTokenUtil.generateToken(new JWTInfo(info.getUsername(), info.getId() + "", info.getName()));
}
throw new UserInvalidException("用户不存在或账户密码错误!");
}
@Override @Override
public ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception { public ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception {
UserInfo info = userService.validateSmall(authenticationRequest); UserInfo info = userService.validateSmall(authenticationRequest);
......
package com.github.wxiaoqi.security.auth.util.user;
import java.io.Serializable;
public class JwtAuthenticationChwRequest implements Serializable {
private static final long serialVersionUID = -8445943548965154778L;
private String username;
private String password;
private Integer bizType;
public JwtAuthenticationChwRequest(String username, String password, Integer bizType) {
this.username = username;
this.password = password;
this.bizType = bizType;
}
public JwtAuthenticationChwRequest() {
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
}
...@@ -10,5 +10,7 @@ public class RequestTypeConstants { ...@@ -10,5 +10,7 @@ public class RequestTypeConstants {
public static final String BASE = "BASE"; public static final String BASE = "BASE";
public static final String APP = "APP"; public static final String APP = "APP";
public static final String WX = "WX"; public static final String WX = "WX";
public static final String OPERATE = "OPERATE";
public static final String BUSINESS = "BUSINESS";
} }
...@@ -43,7 +43,7 @@ public class UserRest { ...@@ -43,7 +43,7 @@ public class UserRest {
@RequestMapping(value = "/user/chw/validate", method = RequestMethod.POST) @RequestMapping(value = "/user/chw/validate", method = RequestMethod.POST)
public @ResponseBody UserInfo chwValidate(@RequestBody Map<String,String> body){ public @ResponseBody UserInfo chwValidate(@RequestBody Map<String,String> body){
return permissionService.validate(body.get("username"),body.get("password")); return permissionService.validateChw(body.get("username"), body.get("password"), Integer.valueOf(body.get("bizType")));
} }
@RequestMapping(value = "/user/validate/small", method = RequestMethod.POST) @RequestMapping(value = "/user/validate/small", method = RequestMethod.POST)
......
...@@ -66,6 +66,23 @@ public class PermissionService { ...@@ -66,6 +66,23 @@ public class PermissionService {
} }
return info; return info;
} }
public UserInfo validateChw(String username,String password, Integer bizType){
UserInfo info = new UserInfo();
//User user = userBiz.getUserByUsername(username);
User user = userBiz.selectOne(new User(){{
setUsername(username);
setBizType(bizType);
}});
if (user!=null){
if (encoder.matches(password, user.getPassword())) {
BeanUtils.copyProperties(user, info);
info.setId(user.getId().toString());
}
}
return info;
}
//小程序登录 //小程序登录
public UserInfo validateSmall(String username,String password){ public UserInfo validateSmall(String username,String password){
UserInfo info = new UserInfo(); UserInfo info = new UserInfo();
......
...@@ -92,4 +92,9 @@ public class DictionaryKey { ...@@ -92,4 +92,9 @@ public class DictionaryKey {
* 取消时间缓冲(分钟) * 取消时间缓冲(分钟)
*/ */
public static final String CANCEL_TIME_BUFFER = "CANCEL_TIME_BUFFER"; public static final String CANCEL_TIME_BUFFER = "CANCEL_TIME_BUFFER";
/**
* 商品类别
*/
public static final String VEHICLE_GOODS_TYPE = "VEHICLE_GOODS_TYPE";
} }
package com.xxfc.platform.vehicle.pojo;
import lombok.Data;
@Data
public class CompanySearchOldDTO {
Integer page;
Integer limit;
Integer addrCity;
String lon;
String lat;
Integer state;
Integer isShow = 1;
Integer isDel = 0;
}
\ No newline at end of file
...@@ -24,10 +24,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany; ...@@ -24,10 +24,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockInfo; import com.xxfc.platform.vehicle.entity.BranchCompanyStockInfo;
import com.xxfc.platform.vehicle.entity.SysRegion; import com.xxfc.platform.vehicle.entity.SysRegion;
import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper; import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo; import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
...@@ -231,6 +228,11 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -231,6 +228,11 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return PageDataVO.pageInfo(branchCompanyPageInfo); return PageDataVO.pageInfo(branchCompanyPageInfo);
} }
public PageDataVO<BranchCompany> searchOld(CompanySearchOldDTO vo) {
PageHelper.startPage(vo.getPage(), vo.getLimit());
PageInfo<BranchCompany> branchCompanyPageInfo = new PageInfo<>(mapper.searchOld(vo.getLon(), vo.getLat(), vo.getAddrCity(), vo.getState(), vo.getIsShow(), vo.getIsDel()));
return PageDataVO.pageInfo(branchCompanyPageInfo);
}
public List<CompanySearchVO> getList(CompanySearchDTO vo){ public List<CompanySearchVO> getList(CompanySearchDTO vo){
return mapper.search(vo); return mapper.search(vo);
......
...@@ -15,6 +15,7 @@ import java.util.List; ...@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdListMapper<BranchCompany,Integer> { public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdListMapper<BranchCompany,Integer> {
List<BranchCompany> searchOld(@Param("lon") String lon, @Param("lat") String lat, @Param("addrCity") Integer addrCity, Integer state, Integer isShow, Integer isDel);
List<CompanySearchVO> search(CompanySearchDTO companySearchDTO); List<CompanySearchVO> search(CompanySearchDTO companySearchDTO);
List<BranchCompany> selectByZoneId(Map<String, Object> param); List<BranchCompany> selectByZoneId(Map<String, Object> param);
......
...@@ -16,10 +16,7 @@ import com.xxfc.platform.vehicle.common.RestResponse; ...@@ -16,10 +16,7 @@ import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode; import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.Area; import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo; import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo; import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
...@@ -248,4 +245,11 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -248,4 +245,11 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return ObjectRestResponse.succ(baseBiz.getList(vo)); return ObjectRestResponse.succ(baseBiz.getList(vo));
} }
@RequestMapping(value ="/search",method = RequestMethod.GET)
@IgnoreUserToken
@IgnoreClientToken
public RestResponse<PageDataVO<BranchCompany>> search(@Validated CompanySearchOldDTO vo) {
return RestResponse.data(baseBiz.searchOld(vo));
}
} }
package com.xxfc.platform.vehicle.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Maps;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.biz.*;
import com.xxfc.platform.vehicle.common.BaseController;
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.jobhandler.VehicleJobHandler;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehicleFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import com.xxfc.platform.vehicle.rest.admin.BgVehicleCategoryController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
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 java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.xxfc.platform.universal.constant.DictionaryKey.VEHICLE;
@RestController
@RequestMapping("/public")
@Slf4j
@IgnoreClientToken
@Api(value="公共controller",tags={"公共controller"})
public class PublicController {
@Autowired
ThirdFeign thirdFeign;
@Data
public static class GoodsType {
private Integer id;
private String name;
}
@ApiOperation("查询所有类别")
@IgnoreUserToken
@RequestMapping(value = "/app/unauth/goodsType/all",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<List<GoodsType>> goodsTypeAll() {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
String jsonStr = dictionaryMap.get(VEHICLE+ "_"+ DictionaryKey.VEHICLE_GOODS_TYPE).getDetail();
return ObjectRestResponse.succ(JSONUtil.toList(JSONUtil.parseArray(jsonStr), GoodsType.class));
}
}
package com.xxfc.platform.vehicle.rest.admin;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.vehicle.biz.VehicleBrandBiz;
import com.xxfc.platform.vehicle.entity.VehicleBrand;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("backstage/vehicleBrand")
public class BgVehicleBrandController extends BaseController<VehicleBrandBiz, VehicleBrand> {
}
\ No newline at end of file
package com.xxfc.platform.vehicle.rest.admin; package com.xxfc.platform.vehicle.rest.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.biz.VehicleCategoryBiz; import com.xxfc.platform.vehicle.biz.VehicleCategoryBiz;
import com.xxfc.platform.vehicle.entity.VehicleCategory; import com.xxfc.platform.vehicle.entity.VehicleCategory;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
import static com.xxfc.platform.universal.constant.DictionaryKey.VEHICLE;
@RestController @RestController
@RequestMapping("admin/vehicleCategory") @RequestMapping("admin/vehicleCategory")
public class BgVehicleCategoryController extends BaseController<VehicleCategoryBiz, VehicleCategory> { public class BgVehicleCategoryController extends BaseController<VehicleCategoryBiz, VehicleCategory> {
......
...@@ -24,6 +24,34 @@ ...@@ -24,6 +24,34 @@
<result column="state" property="state"/> <result column="state" property="state"/>
</resultMap> </resultMap>
<select id="searchOld" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO">
select *
<if test="lon != null and lat != null">
, st_distance_sphere(point(#{lon}, #{lat}), point(longitude, latitude)) as distance
</if>
from branch_company
<where>
<if test="addrCity != null">
and (addr_city = #{addrCity} or addr_province = #{addrCity} or addr_town = #{addrCity})
</if>
<if test="lon != null and lat != null">
and longitude is not null and latitude is not null
</if>
<if test="state != null">
and state = #{state}
</if>
<if test="isShow != null">
and is_show = #{isShow}
</if>
<if test="isDel != null">
and is_del = #{isDel}
</if>
</where>
<if test="lon != null and lat != null">
order by distance asc
</if>
</select>
<select id="search" parameterType="com.xxfc.platform.vehicle.pojo.CompanySearchDTO" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO"> <select id="search" parameterType="com.xxfc.platform.vehicle.pojo.CompanySearchDTO" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO">
select c.*,i.name as companyName select c.*,i.name as companyName
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
......
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