Commit 355c3d3e authored by hezhen's avatar hezhen

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

parents 4fc3777a adba6369
......@@ -32,6 +32,7 @@ public class ServiceAuthRestInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
// 配置该注解,说明不进行服务拦截
IgnoreClientToken annotation = handlerMethod.getBeanType().getAnnotation(IgnoreClientToken.class);
......@@ -51,5 +52,8 @@ public class ServiceAuthRestInterceptor extends HandlerInterceptorAdapter {
}
}
throw new ClientForbiddenException("Client is Forbidden!");
} else {
return super.preHandle(request, response, handler);
}
}
}
......@@ -31,6 +31,7 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
// 配置该注解,说明不进行用户拦截
IgnoreUserToken annotation = handlerMethod.getBeanType().getAnnotation(IgnoreUserToken.class);
......@@ -50,10 +51,10 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
IJWTInfo infoFromToken = null;
try {
infoFromToken = userAuthUtil.getInfoFromToken(token);
}catch (Exception e){
} catch (Exception e) {
if (annotation != null) {
return super.preHandle(request, response, handler);
}else {
} else {
throw e;
}
}
......@@ -63,6 +64,9 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
BaseContextHandler.setToken(token);
// 这里可以添加RequestType
return super.preHandle(request, response, handler);
}else {
return super.preHandle(request, response, handler);
}
}
@Override
......
......@@ -98,6 +98,9 @@ public class CampsiteShopPageDTO implements Serializable {
@ApiModelProperty("地址")
private String address;
@ApiModelProperty("联系人")
private String concat;
@Override
public boolean equals(Object o) {
if (this == o) {
......
......@@ -91,6 +91,9 @@ public class CampsiteShopPageVo implements Serializable {
@JsonIgnore
private Long crtTime;
@ApiModelProperty("联系人")
private String concat;
@ApiModelProperty(value = "電話")
private String phone;
......
......@@ -11,10 +11,7 @@ import com.xxfc.platform.campsite.vo.CampsiteShopDetailVo;
import com.xxfc.platform.campsite.vo.CampsiteShopPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -63,8 +60,8 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
return getBaseBiz().getAllByHome(page,limit);
}
@GetMapping(value = "/app/unauth/webchat_official/campsites")
public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsitesForPublicNumber(CampsiteShopFindDTO campsiteShopFindDTO){
@PostMapping(value = "/app/unauth/webchat_official/campsites")
public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsitesForPublicNumber(@RequestBody CampsiteShopFindDTO campsiteShopFindDTO){
PageDataVO<CampsiteShopPageVo> campsiteShops = baseBiz.findCampsiteShopPageByType(campsiteShopFindDTO);
return ObjectRestResponse.succ(campsiteShops);
......
......@@ -37,7 +37,7 @@
<!--根据类型查询全部-->
<select id="findAllCampsiteShopsByTypeOrCode" resultType="com.xxfc.platform.campsite.dto.CampsiteShopPageDTO">
select cs.id as `id`,cs.name as `name`,cs.logo as `logo`,cs.url as `url`,cs.province_name as `provinceName`,cs.city_name as `cityName`,cs.service_phone as `phone`,
cs.longitude as `longitude`,cs.latitude as `latitude`,`address` as `address`,cs.hot as `hot`,cs.crt_time as `crtTime`,ct.id as `storeId`,ct.name as `storeTypeName`
cs.longitude as `longitude`,cs.latitude as `latitude`,`address` as `address`,cs.hot as `hot`,cs.crt_time as `crtTime`,cs.concat as `concat`,ct.id as `storeId`,ct.name as `storeTypeName`
FROM `campsite_shop_tag` cst
left JOIN `campsite_shop` cs on cst.shop_id=cs.id
left JOIN `campsite_tag` ct on cst.tag_id=ct.id
......
......@@ -100,6 +100,13 @@ public class CompanyBase {
@ApiModelProperty("更新时间")
private Integer isDel;
@Column(name = "province_name")
private String provinceName;
@Column(name = "city_name")
private String cityName;
@Column(name = "towm_name")
private String townName;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.pojo.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 11:03
*/
@Data
public class BranchCompanyStockRightDTO {
private Integer id;
private String companyName;
private Integer balance;
private Integer total;
private BigDecimal price;
private String cover;
private Integer type;
}
package com.xxfc.platform.vehicle.pojo.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/22 19:58
*/
@Data
public class BranchCompanyStockRightFindDTO extends PageParam {
private Integer provinceCode;
private Integer cityCode;
private BigDecimal price;
}
package com.xxfc.platform.vehicle.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 13:51
*/
@Data
public class CompanyBaseDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分公司名称
*/
@ApiModelProperty("分公司名称")
private String name;
/**
* 公司封面
*/
@ApiModelProperty("公司封面")
private String cover;
/**
* 轮播图
*/
@ApiModelProperty("轮播图")
private String images;
@ApiModelProperty("公司简介")
private String describes;
@ApiModelProperty("详情")
private String content;
@ApiModelProperty("地址-省/直辖市")
private String provinceName;
@ApiModelProperty("地址-市")
private String cityName;
@ApiModelProperty("地址-镇/县")
private String townName;
@ApiModelProperty("具体地址")
private String address;
}
package com.xxfc.platform.vehicle.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/22 20:03
*/
@Data
public class BranchCompanyStockRightForWeChatOfficeVO {
private Integer id;
private String companyName;
private Integer balance;
private Integer total;
private BigDecimal price;
private String cover;
private Integer type;
}
package com.xxfc.platform.vehicle.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 12:18
*/
@Data
public class CompanyBaseVo {
/**
* 分公司名称
*/
@ApiModelProperty("分公司名称")
private String name;
/**
* 公司封面
*/
@ApiModelProperty("公司封面")
private String cover;
/**
* 轮播图
*/
@ApiModelProperty("轮播图")
private String images;
@ApiModelProperty("公司简介")
private String describes;
@ApiModelProperty("详情")
private String content;
@ApiModelProperty("地址-省/直辖市")
private String province;
@ApiModelProperty("地址-市")
private String city;
@ApiModelProperty("地址-镇/县")
private String town;
@ApiModelProperty("具体地址")
private String address;
}
......@@ -6,11 +6,16 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.StringToolsUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockRight;
import com.xxfc.platform.vehicle.mapper.*;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockSearchVo;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyStockRightDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyStockRightFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockRightForWeChatOfficeVO;
import com.xxfc.platform.vehicle.util.excel.ExcelImport;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
......@@ -45,12 +51,12 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
//更新股权
public ObjectRestResponse updStockInfo(BranchCompanyStockInfoRightVo stockInfoVo) {
if (stockInfoVo==null||stockInfoVo.getCompanyId()==null||stockInfoVo.getCompanyId()==0){
if (stockInfoVo == null || stockInfoVo.getCompanyId() == null || stockInfoVo.getCompanyId() == 0) {
}
Integer id=stockInfoVo.getId();
if (!checkInfo(id,stockInfoVo.getCompanyId())){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"分公司已存在");
Integer id = stockInfoVo.getId();
if (!checkInfo(id, stockInfoVo.getCompanyId())) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "分公司已存在");
}
BranchCompanyStockRight stockInfo = new BranchCompanyStockRight();
BeanUtils.copyProperties(stockInfoVo, stockInfo);
......@@ -58,26 +64,26 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
stockInfo.setBalance(stockInfo.getTotal());
}
if (stockInfoVo.getState() == null) {
stockInfo.setState(0);
stockInfo.setStockState(0);
}
if (id==null||id==0){
if (id == null || id == 0) {
mapper.insertSelective(stockInfo);
}else {
} else {
mapper.updateByPrimaryKeySelective(stockInfo);
}
return ObjectRestResponse.succ();
}
//检查是否存在分公司
public boolean checkInfo(Integer id,Integer companyId) {
Example example=new Example(BranchCompanyStockRight.class);
Example.Criteria criteria=example.createCriteria();
criteria.andEqualTo("companyId",companyId);
if (id!=null&&id>0){
criteria.andNotEqualTo("id",id);
}
List<BranchCompanyStockRight> list=mapper.selectByExample(example);
if (list.size()>0)
public boolean checkInfo(Integer id, Integer companyId) {
Example example = new Example(BranchCompanyStockRight.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("companyId", companyId);
if (id != null && id > 0) {
criteria.andNotEqualTo("id", id);
}
List<BranchCompanyStockRight> list = mapper.selectByExample(example);
if (list.size() > 0)
return false;
return true;
}
......@@ -91,6 +97,7 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
/**
* 获取所有的股权单价
*
* @return
*/
public List<Integer> getAllPrice() {
......@@ -99,26 +106,26 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
//更新股份
public int updateBalance(Integer companyId,Integer balance,Integer lastBalance){
return mapper.updateBalance(companyId,balance,lastBalance);
public int updateBalance(Integer companyId, Integer balance, Integer lastBalance) {
return mapper.updateBalance(companyId, balance, lastBalance);
}
//删除股权
public void delete(Integer id) {
BranchCompanyStockRight stockRight=new BranchCompanyStockRight();
BranchCompanyStockRight stockRight = new BranchCompanyStockRight();
stockRight.setId(id);
stockRight.setIsDel(1);
mapper.updateByPrimaryKeySelective(stockRight);
}
//导入
public ObjectRestResponse<String> importExcel(MultipartFile multipartfile, HttpServletRequest request){
public ObjectRestResponse<String> importExcel(MultipartFile multipartfile, HttpServletRequest request) {
try {
List<String[]> readExcel = ExcelImport.getExcelData(multipartfile);
if(readExcel.size()<4){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"导入不能没数据!!!");
if (readExcel.size() < 4) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "导入不能没数据!!!");
}
List<BranchCompanyStockRight> list=new ArrayList<>();
List<BranchCompanyStockRight> list = new ArrayList<>();
for (int i = 3; i < readExcel.size(); i++) {
BranchCompanyStockRight stockInfoVo = new BranchCompanyStockRight();
String[] str = readExcel.get(i);
......@@ -136,27 +143,50 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
} else {
str3 = str3.replace("万/股", "");
}
if (!StringToolsUtil.isBigDecimal(str3)||!StringToolsUtil.isNumer(str[4])||!StringToolsUtil.isNumer(str[5])){
if (!StringToolsUtil.isBigDecimal(str3) || !StringToolsUtil.isNumer(str[4]) || !StringToolsUtil.isNumer(str[5])) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "第" + (i + 1) + "行的数据格式不对");
}
BigDecimal price = new BigDecimal(str3);
price=price.multiply(new BigDecimal("10000"));
price = price.multiply(new BigDecimal("10000"));
Integer balance = Integer.parseInt(str[4]);
Integer total =Integer.parseInt(str[5])+balance;
Integer total = Integer.parseInt(str[5]) + balance;
stockInfoVo.setPrice(price);
stockInfoVo.setBalance(balance);
stockInfoVo.setTotal(total);
stockInfoVo.setState(2);
stockInfoVo.setStockState(2);
list.add(stockInfoVo);
}
mapper.addCompamyList(list);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"网络异常!");
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "网络异常!");
}
return ObjectRestResponse.succ();
}
public PageDataVO<BranchCompanyStockRightForWeChatOfficeVO> findWithPageByPriceOrCode(BranchCompanyStockRightFindDTO branchCompanyStockRightFindDTO) {
PageDataVO<BranchCompanyStockRightForWeChatOfficeVO> dataPage = new PageDataVO<>();
PageDataVO<BranchCompanyStockRightDTO> pageDataVO = PageDataVO.pageInfo(branchCompanyStockRightFindDTO.getPage(), branchCompanyStockRightFindDTO.getLimit(),
() -> mapper.findWithPageByPriceOrCode(branchCompanyStockRightFindDTO.getPrice(), branchCompanyStockRightFindDTO.getProvinceCode(), branchCompanyStockRightFindDTO.getCityCode()));
List<BranchCompanyStockRightDTO> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){
return dataPage;
}
List<BranchCompanyStockRightForWeChatOfficeVO> stockRights = new ArrayList<>();
BranchCompanyStockRightForWeChatOfficeVO branchCompanyStockRightForWeChatOfficeVO;
for (BranchCompanyStockRightDTO branchCompanyStockRight : data) {
branchCompanyStockRightForWeChatOfficeVO= new BranchCompanyStockRightForWeChatOfficeVO();
BeanUtils.copyProperties(branchCompanyStockRight,branchCompanyStockRightForWeChatOfficeVO);
stockRights.add(branchCompanyStockRightForWeChatOfficeVO);
}
dataPage.setTotalCount(pageDataVO.getTotalCount());
dataPage.setTotalPage(pageDataVO.getTotalPage());
dataPage.setPageNum(pageDataVO.getPageNum());
dataPage.setPageSize(pageDataVO.getPageSize());
dataPage.setData(stockRights);
return dataPage;
}
}
......@@ -7,6 +7,8 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.mapper.BranchCompanyStockInfoMapper;
import com.xxfc.platform.vehicle.mapper.CompanyBaseMapper;
import com.xxfc.platform.vehicle.pojo.dto.CompanyBaseDetailDTO;
import com.xxfc.platform.vehicle.pojo.vo.CompanyBaseVo;
import com.xxfc.platform.vehicle.pojo.vo.CompanyVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -158,5 +160,11 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
return ObjectRestResponse.succ();
}
public CompanyBaseVo findCompanyDetailById(Integer id) {
CompanyBaseVo companyBaseVo = new CompanyBaseVo();
CompanyBaseDetailDTO companyBaseDetailDTO = mapper.findCompanyBaseById(id);
BeanUtils.copyProperties(companyBaseDetailDTO,companyBaseVo);
return companyBaseVo;
}
}
......@@ -51,7 +51,7 @@ public class VehicleJobHandler extends IJobHandler {
int betweenMonth = Integer.valueOf(dictionary.getDetail()).intValue();
int month = nowMonth + betweenMonth> 12 ? (betweenMonth + nowMonth) - 12 : nowMonth + betweenMonth;
year = month > nowMonth ? year : year + 1;
String yearAndMonth = String.format("%d-%s", year, month>10?month:"0"+month);
String yearAndMonth = String.format("%d-%s", year, month>=10?month:"0"+month);
XxlJobLogger.log("----查询到的车型ids:【{}】",existVehicleIds);
if (CollectionUtils.isNotEmpty(existVehicleIds)) {
List<VehicleBookInfo> bookInfos = existVehicleIds.stream().map(vehicleId -> {
......
......@@ -3,10 +3,12 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockRight;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockSearchVo;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyStockRightDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List;
......@@ -25,4 +27,6 @@ public interface BranchCompanyStockRightMapper extends Mapper<BranchCompanyStock
int addCompamyList(@Param("list") List<BranchCompanyStockRight> list);
Integer getCompanyInfo(@Param("name")String name);
List<BranchCompanyStockRightDTO> findWithPageByPriceOrCode(@Param("price") BigDecimal price, @Param("provinceCode") Integer provinceCode, @Param("cityCode") Integer cityCode);
}
\ No newline at end of file
......@@ -2,9 +2,21 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.CompanyBase;
import com.xxfc.platform.vehicle.pojo.dto.CompanyBaseDetailDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
public interface CompanyBaseMapper extends Mapper<CompanyBase> {
@Select("SELECT cb.*,bc.addr_detail AS `address` FROM (SELECT * FROM `company_base` WHERE `id`=#{id}) AS `cb` LEFT JOIN `branch_company` AS `bc` ON bc.company_base_id = cb.id;")
@Results(value = {
@Result(property = "provinceName",column = "addr_province"),
@Result(property = "cityName",column = "addr_city"),
@Result(property = "townName",column = "addr_town")
})
CompanyBaseDetailDTO findCompanyBaseById(@Param("id") Integer id);
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ 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.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.BranchCompanyStockApplyInfoBiz;
import com.xxfc.platform.vehicle.biz.BranchCompanyStockRightBiz;
import com.xxfc.platform.vehicle.common.BaseController;
......@@ -12,13 +13,17 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockApplyInfo;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockApplyVo;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockSearchVo;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyStockRightFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockRightForWeChatOfficeVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
@RestController
@IgnoreClientToken
......@@ -191,4 +196,21 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return baseBiz.importExcel(multipartfile,request);
}
@GetMapping("/app/unauth/stock_right_price")
public ObjectRestResponse<List<Integer>> getStorkRightPrices(){
List<Integer> allPrice = baseBiz.getAllPrice();
return ObjectRestResponse.succ(allPrice);
}
/**
* 微信公众号查询
* @param branchCompanyStockRightFindDTO
* @return
*/
@PostMapping("/app/unauth/webchat_office/stockrights")
public ObjectRestResponse<PageDataVO<BranchCompanyStockRightForWeChatOfficeVO>> findBranchCompanyStockRightsForWechatOffice(@RequestBody BranchCompanyStockRightFindDTO branchCompanyStockRightFindDTO){
PageDataVO<BranchCompanyStockRightForWeChatOfficeVO> branchCompanyStockRightForWeChatOfficeVOPageDataVO = baseBiz.findWithPageByPriceOrCode(branchCompanyStockRightFindDTO);
return ObjectRestResponse.succ(branchCompanyStockRightForWeChatOfficeVOPageDataVO);
}
}
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.biz.CompanyBaseBiz;
import com.xxfc.platform.vehicle.pojo.vo.CompanyBaseVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 12:16
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/company_base")
public class CompanyBaseController {
private final CompanyBaseBiz companyBaseBiz;
@GetMapping("/detail/{id}")
public ObjectRestResponse<CompanyBaseVo> findCompanyDetailById(@PathVariable(value = "id") Integer id){
CompanyBaseVo companyBaseVo = companyBaseBiz.findCompanyDetailById(id);
return ObjectRestResponse.succ(companyBaseVo);
}
}
......@@ -18,7 +18,7 @@
r.price,
r.rank,
r.total,
r.state,
r.stock_state,
c.addr_city AS addrCity,
c.addr_province AS addrProvince,
c.`name` AS companyName
......@@ -45,8 +45,11 @@
</trim>
order by rank DESC,price DESC
</select>
<select id="selectAllPrice" resultType="int">
select distinct price from branch_company_stock_info_right where is_del=0 order by price
<select id="selectAllPrice" resultType="integer">
SELECT DISTINCT
`price`
FROM
( SELECT `price` / 10000 AS `price` FROM branch_company_stock_info_right WHERE is_del = 0 ) AS `bcsir` ORDER BY price DESC
</select>
<select id="selectInfoById" resultType="com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo">
SELECT
......@@ -58,7 +61,7 @@
r.price,
r.rank,
r.total,
r.state,
r.stock_state,
c.addr_city AS addrCity,
c.addr_province AS addrProvince,
c.`name` AS companyName
......@@ -74,10 +77,38 @@
<insert id="addCompamyList" parameterType="java.util.List">
insert into branch_company_stock_info_right (
company_id,balance,total,price,state,company_pic,crt_time,upd_time
company_id,balance,total,price,stock_state,company_pic,crt_time,upd_time
) VALUES
<foreach collection ="list" item="item" index="index" separator =",">
(#{item.companyId},#{item.balance},#{item.total},#{item.price},#{item.state},#{item.companyPic},#{item.crtTime},#{item.updTime})
<foreach collection="list" item="item" index="index" separator=",">
(#{item.companyId},#{item.balance},#{item.total},#{item.price},#{item.stockState}
,#{item.companyPic},#{item.crtTime},#{item.updTime})
</foreach>
</insert>
<select id="findWithPageByPriceOrCode"
resultType="com.xxfc.platform.vehicle.pojo.dto.BranchCompanyStockRightDTO">
SELECT
cb.id,
bcsir.balance,
bcsir.total,
bcsir.type,
bcsir.price/10000 as `price`,
cb.cover,
cb.name as `companyName`
FROM
( SELECT id, company_base_id, balance, total, price, type FROM `branch_company_stock_info_right` WHERE
`stock_state` =
2 AND `is_del`=0
<if test="price != null">
AND `price`=#{price}*10000
</if>
) AS `bcsir`
INNER JOIN ( SELECT id, `name`, cover FROM `company_base` WHERE 1=1
<if test="provinceCode != null">
AND `addr_province`=#{provinceCode}
</if>
<if test="cityCode != null">
AND `addr_city`=#{cityCode}
</if>
) AS `cb` ON cb.id = bcsir.company_base_id order by bcsir.price desc
</select>
</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