Commit 58145fca authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents 3923fb1b 9b6fa040
......@@ -40,4 +40,43 @@ public class StringToolsUtil {
String REGEX_ID_CARD = "(^\\d{18}$)|(^\\d{15}$)";
return Pattern.matches(REGEX_ID_CARD, idCard);
}
public static boolean isNumer( String str){
boolean flag = false;
try{
if(StringUtils.isBlank(str)) {
flag = false;
}
Pattern regex =Pattern.compile("[0-9]*");
Matcher m = regex .matcher(str);
flag = m.matches();
}catch(Exception e){
flag = false;
}
return flag;
}
public static boolean isBigDecimal(String str) {
if (str == null || str.trim().length() == 0) {
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
int i = (chars[0] == '-') ? 1 : 0;
if (i == sz) return false;
if (chars[i] == '.') return false;//除了负号,第一位不能为'小数点'
boolean radixPoint = false;
for (; i < sz; i++) {
if (chars[i] == '.') {
if (radixPoint) return false;
radixPoint = true;
} else if (!(chars[i] >= '0' && chars[i] <= '9')) {
return false;
}
}
return true;
}
}
package com.xxfc.platform.campsite.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description 公众号
* @data 2019/8/22 14:07
*/
@Data
public class CampsiteShopFindDTO extends PageParam {
private Integer proviceCode;
private Integer cityCode;
private Integer type;
}
package com.xxfc.platform.campsite.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -7,8 +8,6 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;
......@@ -67,13 +66,6 @@ public class CampsiteShopPageVo implements Serializable {
@ApiModelProperty(value = "店铺类型名称")
private String storeTypeName;
/**
* 店铺类型id
*/
@ApiModelProperty(value = "店铺类型id")
private String storeId;
/**
* 经度
*/
......@@ -96,6 +88,7 @@ public class CampsiteShopPageVo implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间", hidden = true)
@JsonIgnore
private Long crtTime;
@ApiModelProperty(value = "電話")
......
......@@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Table;
import java.io.Serializable;
......
......@@ -59,7 +59,6 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
*/
private static final String CAMPSITE_LIST_CACHE_PREKEY = "campsite_cache:";
private static final String CAMSITE_DETAIL_CACHE_PREKEY = "campsite:detail:cache:";
private static final String CAMPSITE_CACHE_ALL = "all";
private static final long CAMPSITE_CACHE_EXPIRE_TIME = 6000;
/**
......@@ -79,27 +78,27 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
}
public PageDataVO<CampsiteShopPageVo> findCampsiteShopPageByType(Integer type, Integer pageNo, Integer pageSize) {
String result;
if (Objects.isNull(type)) {
result = campHashOperations.get(CAMPSITE_LIST_CACHE_PREKEY,String.format("%s%d%d",CAMPSITE_CACHE_ALL,pageNo,pageSize));
} else {
result = campHashOperations.get(CAMPSITE_LIST_CACHE_PREKEY, String.format("%s%d%d", String.valueOf(type), pageNo, pageSize));
}
public PageDataVO<CampsiteShopPageVo> findCampsiteShopPageByType(CampsiteShopFindDTO campsiteShopFindDTO) {
String campsite_cache_key = String.format("%s%s%s%s%s", campsiteShopFindDTO.getType() == null ? "" : campsiteShopFindDTO.getType() + ":",
campsiteShopFindDTO.getProviceCode() == null ? "" : campsiteShopFindDTO.getProviceCode() + ":",
campsiteShopFindDTO.getCityCode()==null?"":campsiteShopFindDTO.getCityCode()+":",
campsiteShopFindDTO.getPage()+":",
campsiteShopFindDTO.getLimit());
String result = campHashOperations.get(CAMPSITE_LIST_CACHE_PREKEY,campsite_cache_key);
if (result != null) {
return JSONObject.parseObject(result, new TypeReference<PageDataVO<CampsiteShopPageVo>>() {
});
}
PageDataVO<CampsiteShopPageVo> campsiteShopPageDataVO = new PageDataVO<>();
PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.findAllCampsiteShopsByType(type));
PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(), () -> mapper.findAllCampsiteShopsByTypeOrCode(campsiteShopFindDTO.getType(),campsiteShopFindDTO.getProviceCode(),campsiteShopFindDTO.getCityCode()));
List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData();
if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) {
campsiteShopPageDataVO.setData(new ArrayList<CampsiteShopPageVo>());
campsiteShopPageDataVO.setData(Collections.EMPTY_LIST);
return campsiteShopPageDataVO;
}
if (log.isDebugEnabled()) {
log.debug("根据type=【{}】查询到的店铺数据:【{}】", type, campsiteShopPageDTOS);
log.debug("根据type=【{}】查询到的店铺数据:【{}】", campsiteShopFindDTO.getType(), campsiteShopPageDTOS);
}
List<CampsiteShopPageVo> campsiteShopPageVoList = new ArrayList<>();
......@@ -117,11 +116,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
campsiteShopPageDataVO.setPageNum(pageDataVO.getPageNum());
campsiteShopPageDataVO.setData(campsiteShopPageVoList);
if (Objects.isNull(type)) {
campHashOperations.put(CAMPSITE_LIST_CACHE_PREKEY, String.format("%s%d%d",CAMPSITE_CACHE_ALL,pageNo,pageSize), JSONObject.toJSONString(campsiteShopPageDataVO));
} else {
campHashOperations.put(CAMPSITE_LIST_CACHE_PREKEY, String.format("%s%d%d", String.valueOf(type), pageNo, pageSize), JSONObject.toJSONString(campsiteShopPageDataVO));
}
campHashOperations.put(CAMPSITE_LIST_CACHE_PREKEY,campsite_cache_key,JSONObject.toJSONString(campsiteShopPageDataVO));
return campsiteShopPageDataVO;
}
......@@ -167,7 +162,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
}
campsiteShopDetailVo.setTypeNames(shopTagDTOS == null ? Collections.EMPTY_LIST : shopTagDTOS.stream().map(CampsiteShopTagDTO::getName).collect(Collectors.toList()));
//根据经纬度算距离
if (campsiteShopDetailDTO.getLongitude()!=null && campsiteShopDetailDTO.getLatitude()!=null) {
if (campsiteShopDetailDTO.getLongitude() != null && campsiteShopDetailDTO.getLatitude() != null) {
double distance = getDistance(campsiteShopDetailDTO.getLongitude(), campsiteShopDetailDTO.getLatitude(), longitude, latitude);
if (log.isDebugEnabled()) {
log.debug("根据店铺经度=【{}】,纬度=【{}】和自己所在位置的经度=【{}】,纬度=【{}】计算出的距离:【{}km】", campsiteShopDetailDTO.getLongitude(), campsiteShopDetailDTO.getLatitude(), longitude, latitude, distance);
......@@ -307,7 +302,6 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
}
public int upperOrLowerShelves(Integer id, Integer status) {
int effectRows = mapper.updateCampsiteSaleStatusById(id, status);
if (effectRows > 0) {
......
package com.xxfc.platform.campsite.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.campsite.dto.CampsiteShopCarouselDTO;
import com.xxfc.platform.campsite.dto.CampsiteShopCarouselDetailDTO;
import com.xxfc.platform.campsite.entity.CampsiteShopCarousel;
import com.xxfc.platform.campsite.mapper.CampsiteShopCarouselMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import com.xxfc.platform.campsite.entity.CampsiteShopCarousel;
import com.xxfc.platform.campsite.mapper.CampsiteShopCarouselMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......
......@@ -13,7 +13,7 @@ import java.util.List;
/**
* 营地店铺表
*
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-17 10:28:48
......@@ -23,12 +23,16 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
/**
* 根据店铺类型查找店铺列表
*
* @param typeId
*/
List<CampsiteShopPageDTO> findAllCampsiteShopsByType(@Param("typeId") Integer typeId);
List<CampsiteShopPageDTO> findAllCampsiteShopsByTypeOrCode(@Param("typeId") Integer typeId,
@Param("proviceCode") Integer proviceCode,
@Param("cityCode") Integer cityCode);
/**
* 首页营地列表
*
* @param start
* @param size
* @return
......@@ -37,6 +41,7 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
/**
* 根据店铺id查询
*
* @param id
* @return
*/
......@@ -44,6 +49,7 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
/**
* 根据条件查询
*
* @param campsiteShopAdminFindDTO
* @return
*/
......@@ -51,14 +57,16 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
/**
* 更新店铺的状态
*
* @param id
* @param status
* @return
*/
int updateCampsiteStatusById(@Param("id") int id,@Param("status") int status);
int updateCampsiteStatusById(@Param("id") int id, @Param("status") int status);
/**
* 更新店铺的上下架状态
*
* @param id
* @param status
* @return
......@@ -67,9 +75,10 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
/**
* 检验营地名称
*
* @param id
* @param name
* @return
*/
int checkNameExist(@Param("id") Integer id,@Param("name") String name);
int checkNameExist(@Param("id") Integer id, @Param("name") String name);
}
......@@ -5,10 +5,10 @@ import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.campsite.biz.CampsiteShopBiz;
import com.xxfc.platform.campsite.dto.CampsiteShopFindDTO;
import com.xxfc.platform.campsite.entity.CampsiteShop;
import com.xxfc.platform.campsite.vo.CampsiteShopDetailVo;
import com.xxfc.platform.campsite.vo.CampsiteShopPageVo;
import com.xxfc.platform.campsite.vo.CampsiteShopVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -32,10 +32,14 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
@ApiOperation("分页查询营地列表")
@GetMapping("/app/unauth/shops")
public ObjectRestResponse<PageDataVO<CampsiteShopVo>> findCampsiteShopPageByType(@RequestParam(value = "type", required = false) Integer type,
public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsiteShopPageByType(@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "6") Integer pageSize) {
PageDataVO<CampsiteShopPageVo> pageDataVO = getBaseBiz().findCampsiteShopPageByType(type, pageNo, pageSize);
CampsiteShopFindDTO campsiteShopFindDTO = new CampsiteShopFindDTO();
campsiteShopFindDTO.setType(type);
campsiteShopFindDTO.setPage(pageNo);
campsiteShopFindDTO.setLimit(pageSize);
PageDataVO<CampsiteShopPageVo> pageDataVO = getBaseBiz().findCampsiteShopPageByType(campsiteShopFindDTO);
return ObjectRestResponse.succ(pageDataVO);
}
......@@ -59,5 +63,11 @@ 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){
PageDataVO<CampsiteShopPageVo> campsiteShops = baseBiz.findCampsiteShopPageByType(campsiteShopFindDTO);
return ObjectRestResponse.succ(campsiteShops);
}
}
\ No newline at end of file
......@@ -35,7 +35,7 @@
</resultMap>
<!--根据类型查询全部-->
<select id="findAllCampsiteShopsByType" resultType="com.xxfc.platform.campsite.dto.CampsiteShopPageDTO">
<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`
FROM `campsite_shop_tag` cst
......@@ -44,7 +44,14 @@
where cs.sale_state=1 and cs.is_del=0
<if test="typeId!=null">
and cst.tag_id=#{typeId}
</if> order by `crtTime` DESC
</if>
<if test="proviceCode != null">
and `province`=#{proviceCode}
</if>
<if test="cityCode != null">
and `city`=#{cityCode}
</if>
order by `crtTime` DESC
</select>
<!--首页查询全部-->
......
package com.xxfc.platform.vehicle.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.vehicle.constant.BranchCompanyStockApplyState;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockApplyInfo;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockRight;
import com.xxfc.platform.vehicle.mapper.BranchCompanyStockApplyInfoMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockApplyInfoVo;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockApplyVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service
public class BranchCompanyStockApplyInfoBiz extends BaseBiz<BranchCompanyStockApplyInfoMapper, BranchCompanyStockApplyInfo> {
@Autowired
BranchCompanyStockRightBiz branchCompanyStockRightBiz;
/**
* 申请购买
* @param applyVo
*/
public void apply(BranchCompanyStockApplyVo applyVo) {
BranchCompanyStockRight stockInfo = branchCompanyStockRightBiz.selectById(applyVo.getCompanyId());
if (stockInfo == null) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_UNEXIST.getDesc(), ResCode.BRANCH_COMPANY_STOCK_UNEXIST.getCode());
}
if (stockInfo.getBalance() <= 0) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_NO_BALANCE.getDesc(), ResCode.BRANCH_COMPANY_STOCK_NO_BALANCE.getCode());
}
if (stockInfo.getBalance() < applyVo.getCount()) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_BALANCE_NOT_ENOUGH.getDesc(), ResCode.BRANCH_COMPANY_STOCK_BALANCE_NOT_ENOUGH.getCode());
}
BranchCompanyStockApplyInfo applyInfo = new BranchCompanyStockApplyInfo();
BeanUtils.copyProperties(applyVo, applyInfo);
applyInfo.setState(BranchCompanyStockApplyState.Apply.getCode());
applyInfo.setCreateTime(new Date());
mapper.insertSelective(applyInfo);
}
public PageInfo<BranchCompanyStockApplyInfoVo> selectApplyAll(Integer page, Integer limit) {
PageHelper.startPage(page, limit);
return new PageInfo<>(mapper.selectVoAll());
}
/**
* 取消申请,修改申请状态
* @param applyId
*/
public void cancelApply(Integer applyId) {
BranchCompanyStockApplyInfo applyInfo = mapper.selectByPrimaryKey(applyId);
if (applyInfo == null) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_APPLY_INFO_UNEXIST.getDesc(),
ResCode.BRANCH_COMPANY_STOCK_APPLY_INFO_UNEXIST.getCode());
}
applyInfo.setState(BranchCompanyStockApplyState.Cancel.getCode());
applyInfo.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(applyInfo);
}
/**
* 确认申请购买股权,修改库存
* @param applyId
*/
@Transactional
public void buy(Integer applyId) {
BranchCompanyStockApplyInfo applyInfo = mapper.selectByPrimaryKey(applyId);
if (applyInfo == null) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_APPLY_INFO_UNEXIST.getDesc(),
ResCode.BRANCH_COMPANY_STOCK_APPLY_INFO_UNEXIST.getCode());
}
if (!applyInfo.getState().equals(BranchCompanyStockApplyState.Apply.getCode())) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_APPLY_INFO_STATE_LOCKED.getDesc(),
ResCode.BRANCH_COMPANY_STOCK_APPLY_INFO_STATE_LOCKED.getCode());
}
BranchCompanyStockRight stockInfo = branchCompanyStockRightBiz.selectById(applyInfo.getCompanyId());
if (stockInfo == null) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_UNEXIST.getDesc(), ResCode.BRANCH_COMPANY_STOCK_UNEXIST.getCode());
}
if (stockInfo.getBalance() < applyInfo.getCount()) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_BALANCE_NOT_ENOUGH.getDesc(), ResCode.BRANCH_COMPANY_STOCK_BALANCE_NOT_ENOUGH.getCode());
}
int result = branchCompanyStockRightBiz.updateBalance(applyInfo.getCompanyId(), stockInfo.getBalance() - applyInfo.getCount(), stockInfo.getBalance());
if (result == 0) {
throw new BaseException(ResCode.BRANCH_COMPANY_STOCK_BALANCE_NOT_ENOUGH.getDesc(), ResCode.BRANCH_COMPANY_STOCK_BALANCE_NOT_ENOUGH.getCode());
}
applyInfo.setState(BranchCompanyStockApplyState.Buy.getCode());
applyInfo.setUpdateTime(new Date());
mapper.updateByPrimaryKey(applyInfo);
}
public BranchCompanyStockApplyInfo getApplyById(Integer id) {
return mapper.selectByPrimaryKey(id);
}
public void updateApply(BranchCompanyStockApplyInfo applyInfo) {
mapper.updateByPrimaryKeySelective(applyInfo);
}
public void deleteApply(Integer id) {
mapper.deleteByPrimaryKey(id);
}
}
......@@ -4,13 +4,25 @@ 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.vo.BranchCompanyStockInfoRightVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface BranchCompanyStockRightMapper extends Mapper<BranchCompanyStockRight> {
//获取股权列表
List<BranchCompanyStockInfoRightVo> search(BranchCompanyStockSearchVo searchVo);
//获取股价列表
List<Integer> selectAllPrice();
//获取一条记录
BranchCompanyStockInfoRightVo selectInfoById(@Param("id")Integer id);
//修改股权
int updateBalance(@Param("companyId") Integer companyId, @Param("balance") Integer balance, @Param("lastBalance") Integer lastBalance);
//批量添加
int addCompamyList(@Param("list") List<BranchCompanyStockRight> list);
Integer getCompanyInfo(@Param("name")String name);
}
\ No newline at end of file
......@@ -4,8 +4,8 @@ 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.xxfc.platform.vehicle.biz.BranchCompanyStockApplyInfoBiz;
import com.xxfc.platform.vehicle.biz.BranchCompanyStockRightBiz;
import com.xxfc.platform.vehicle.biz.BranchCompanyStockService;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
......@@ -13,8 +13,8 @@ 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.vo.BranchCompanyStockInfoRightVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -26,31 +26,18 @@ import javax.servlet.http.HttpServletRequest;
@RequestMapping("branchCompany/stock/right")
public class BranchCompanyStockRightController extends BaseController<BranchCompanyStockRightBiz> {
private static Integer MAX_DRIVING_LICENSE_SIZE = 10*1024*1024;//10M
@Autowired
BranchCompanyStockService branchCompanyStockService;
BranchCompanyStockApplyInfoBiz branchCompanyStockApplyInfoBiz;
/**
* 分页获取
* @param page
* @param limit
* @return
*/
@GetMapping("page")
public RestResponse page(Integer page, Integer limit) {
if (page == null || limit == null) {
page = 1;
limit = 10;
}
return RestResponse.suc(baseBiz.selectAll(page, limit));
}
/**
* 搜索
* @param searchVo
* @return
*/
@ApiOperation(value = "获取股权列表")
@GetMapping("search")
public RestResponse search(BranchCompanyStockSearchVo searchVo) {
if (searchVo.getPage() == null || searchVo.getLimit() == null) {
......@@ -60,26 +47,18 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.suc(baseBiz.search(searchVo));
}
@GetMapping("{id}")
public RestResponse get(@PathVariable("id") Integer id) {
if (id == null) {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
return RestResponse.suc(branchCompanyStockService.selectById(id));
}
@ApiOperation(value = "获取股权信息")
@GetMapping("info/{id}")
public RestResponse getInfo(@PathVariable("id") Integer id) {
if (id == null) {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
return RestResponse.suc(branchCompanyStockService.getInfoById(id));
return RestResponse.suc(baseBiz.getInfoById(id));
}
/**
* 更新
* 编辑
* @return
*/
@RequestMapping(value ="/updStockInfo",method = RequestMethod.POST)
......@@ -91,7 +70,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
}
/**
* 更新
* 新增
* @return
*/
@RequestMapping(value ="/addStockInfo",method = RequestMethod.POST)
......@@ -113,24 +92,6 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return ObjectRestResponse.succ();
}
@RequestMapping(value ="/upload/companyPic",method = RequestMethod.POST)
public RestResponse uploadCompanyPic(@RequestParam("file") MultipartFile file)
throws Exception{
String contentType = file.getContentType(); //图片文件类型
if(!contentType.equals("image/jpeg") && !contentType.equals("image/gif")){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
if(file.getSize() > MAX_DRIVING_LICENSE_SIZE){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
return branchCompanyStockService.uploadCompanyPic(file);
}
@IgnoreUserToken
@RequestMapping(value="/download/companyPic",method=RequestMethod.GET)
public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
return branchCompanyStockService.downloadCompanyPic(realFileRelPath);
}
/**
* 申请购买
......@@ -143,7 +104,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
branchCompanyStockService.apply(applyVo);
branchCompanyStockApplyInfoBiz.apply(applyVo);
return RestResponse.suc();
}
......@@ -153,7 +114,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
page = 1;
limit = 10;
}
return RestResponse.suc(branchCompanyStockService.selectApplyAll(page, limit));
return RestResponse.suc(branchCompanyStockApplyInfoBiz.selectApplyAll(page, limit));
}
@GetMapping("apply/{id}")
......@@ -162,7 +123,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
return RestResponse.suc(branchCompanyStockService.getApplyById(id));
return RestResponse.suc(branchCompanyStockApplyInfoBiz.getApplyById(id));
}
@PutMapping("apply")
......@@ -171,7 +132,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
branchCompanyStockService.updateApply(applyInfo);
branchCompanyStockApplyInfoBiz.updateApply(applyInfo);
return RestResponse.suc();
}
......@@ -181,7 +142,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
branchCompanyStockService.deleteApply(id);
branchCompanyStockApplyInfoBiz.deleteApply(id);
return RestResponse.suc();
}
......@@ -195,7 +156,7 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
branchCompanyStockService.cancelApply(applyId);
branchCompanyStockApplyInfoBiz.cancelApply(applyId);
return RestResponse.suc();
}
......@@ -208,13 +169,13 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
branchCompanyStockService.buy(applyId);
branchCompanyStockApplyInfoBiz.buy(applyId);
return RestResponse.suc();
}
@GetMapping("allPrice")
public RestResponse getAllPrice() {
return RestResponse.suc(branchCompanyStockService.getAllPrice());
return RestResponse.suc(baseBiz.getAllPrice());
}
......@@ -225,9 +186,9 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
* @return
*/
@PostMapping("importExcel")
public RestResponse importExcel(@RequestParam(value = "file") MultipartFile multipartfile,
HttpServletRequest request) {
return branchCompanyStockService.importExcel(multipartfile,request);
public ObjectRestResponse<String> importExcel(@RequestParam(value = "file") MultipartFile multipartfile,
HttpServletRequest request) {
return baseBiz.importExcel(multipartfile,request);
}
}
......@@ -3,14 +3,11 @@
<mapper namespace="com.xxfc.platform.vehicle.mapper.BranchCompanyStockRightMapper">
<update id="updateBalance">
update branch_company_stock_info
update branch_company_stock_info_right
set balance = #{balance}
where id = #{companyId} and balance = #{lastBalance}
</update>
<select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.BranchCompanyStockInfoVo">
select *
from branch_company_stock_info
</select>
<select id="search" resultType="com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo">
SELECT
distinct r.company_id as companyId,
......@@ -29,7 +26,7 @@
branch_company_stock_info_right r
LEFT JOIN branch_company c ON r.company_id = c.id
<trim prefix="where" suffixOverrides="and">
c.is_del = 0
c.is_del = 0 and
<if test="companyName != null">
c.name like CONCAT('%',#{companyName},'%')
</if>
......@@ -46,21 +43,41 @@
r.price &lt;= #{priceEnd} and
</if>
</trim>
order by rank desc
order by rank DESC,price DESC
</select>
<select id="selectAllPrice" resultType="int">
select distinct price from branch_company_stock_info order by price
select distinct price from branch_company_stock_info_right where is_del=0 order by price
</select>
<select id="selectInfoById" resultType="com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo">
SELECT
distinct r.company_id as companyId,
r.id,
r.balance,
r.company_pic as companyPic,
r.info,
r.price,
r.rank,
r.total,
r.state,
c.addr_city AS addrCity,
c.addr_province AS addrProvince,
c.`name` AS companyName
FROM
branch_company_stock_info_right r
LEFT JOIN branch_company c ON r.company_id = c.id
where c.is_del = 0 and r.id=#{id} and r.is_del=0
</select>
<select id="selectInfoById" resultType="String">
select info from branch_company_stock_info where id = #{id}
<select id="getCompanyInfo" resultType="Integer">
SELECT id FROM branch_company WHERE `name`=#{name} and is_del=0 limit 1
</select>
<insert id="addCompamyList" parameterType="java.util.List">
insert into branch_company_stock_info (
balance,total,price,company_name,addr_province,addr_city,state,company_pic
insert into branch_company_stock_info_right (
company_id,balance,total,price,state,company_pic,crt_time,upd_time
) VALUES
<foreach collection ="list" item="item" index="index" separator =",">
(#{item.balance},#{item.total},#{item.price},#{item.companyName},#{item.addrProvince},#{item.addrCity},#{item.state},#{item.companyPic})
(#{item.companyId},#{item.balance},#{item.total},#{item.price},#{item.state},#{item.companyPic},#{item.crtTime},#{item.updTime})
</foreach>
</insert>
</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