Commit 1faf4505 authored by hezhen's avatar hezhen

Merge branch 'hz_dev' into base-modify

parents f1df06ae 80430f91
...@@ -40,7 +40,8 @@ public class BranchCompanyStockRight{ ...@@ -40,7 +40,8 @@ public class BranchCompanyStockRight{
*/ */
private Integer type; private Integer type;
private Integer state; @Column(name = "stock_state")
private Integer stockState;
/** /**
......
package com.xxfc.platform.vehicle.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 分公司信息
*/
@Data
public class CompanyVo {
/**
* 公司基本信息表
*/
@ApiModelProperty("公司基本信息id")
Integer id;
@ApiModelProperty("公司全名称")
String name;
@ApiModelProperty("公司封面")
String cover;
@ApiModelProperty("轮播图")
String images;
@ApiModelProperty("片区id")
Integer zoneId;
@ApiModelProperty("公司简介")
String describes;
@ApiModelProperty("详情")
String content;
@ApiModelProperty("地址-省/直辖市(编码)")
Integer addrProvince;
@ApiModelProperty("地址-市(编码)")
Integer addrCity;
@ApiModelProperty("地址-镇/县(编码)")
Integer addrTown;
/**
* 分支机构
*/
@ApiModelProperty("分支机构id")
Integer companyId;
@ApiModelProperty("分支机构名称")
String companyName;
@ApiModelProperty("详细地址")
String addrDetail;
@ApiModelProperty("上下架:1-上架;2-下架")
Integer state;
@ApiModelProperty("负责人")
private String leader;
@ApiModelProperty("负责人联系方式")
private String leaderContactInfo;
@ApiModelProperty("公司状态")
private Integer status;
@ApiModelProperty("公司地址-纬度")
private BigDecimal latitude;
@ApiModelProperty("公司地址-经度")
private BigDecimal longitude;
@ApiModelProperty("租车客服电话")
private String vehiceServicePhone;
@ApiModelProperty("旅游客服电话")
private String tourServicePhone;
/**
* 股权信息
*/
@ApiModelProperty("股份id")
Integer stockId;
@ApiModelProperty("剩余股份")
Integer balance;
@ApiModelProperty("股份总数")
Integer total;
@ApiModelProperty("股份单价")
BigDecimal price;
@ApiModelProperty("排序")
Integer rank;
@ApiModelProperty("(-1:下架,0:筹备中,1:筹备完成,2:上架)")
Integer stockState;
@ApiModelProperty("股价类型:1-万/股;2-港万/股")
Integer type;
}
...@@ -3,18 +3,140 @@ package com.xxfc.platform.vehicle.biz; ...@@ -3,18 +3,140 @@ package com.xxfc.platform.vehicle.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.vehicle.entity.*; 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.mapper.CompanyBaseMapper;
import com.xxfc.platform.vehicle.pojo.vo.CompanyVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
@Service @Service
@Slf4j @Slf4j
public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> { public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
@Autowired
BranchCompanyStockRightBiz stockRightBiz;
@Autowired
BranchCompanyStockInfoMapper stockInfoMapper;
@Value("${branchCompanyPic.url}")
private String companyUrl;
//临时数据同步 //临时数据同步
// public ObjectRestResponse public ObjectRestResponse synchro(){
List<BranchCompanyStockInfo> list= stockInfoMapper.selectAll();
if (list.size()>0){
for (BranchCompanyStockInfo companyStockInfo:list){
int num=0;
String companyName=companyStockInfo.getCompanyName();
Integer balance=companyStockInfo.getBalance();
Integer total=companyStockInfo.getTotal();
BigDecimal price=companyStockInfo.getPrice();
CompanyBase companyBase=new CompanyBase();
companyBase.setAddrCity(companyStockInfo.getAddrCity());
companyBase.setAddrProvince(companyStockInfo.getAddrProvince());
companyBase.setName(companyName);
companyBase.setCover(companyUrl+"/image/admin/upload"+companyStockInfo.getCompanyPic());
companyBase.setImages(companyUrl+"/image/admin/upload"+companyStockInfo.getCompanyPic());
insertSelective(companyBase);
Integer companyBaseId=companyBase.getId();
if (companyBaseId!=null){
BranchCompanyStockRight branchCompanyStockRight=new BranchCompanyStockRight();
branchCompanyStockRight.setBalance(balance);
branchCompanyStockRight.setPrice(price);
branchCompanyStockRight.setTotal(total);
branchCompanyStockRight.setCompanyBaseId(companyBaseId);
branchCompanyStockRight.setStockState(2);
stockRightBiz.insertSelective(branchCompanyStockRight);
}
num++;
log.info("----成功---num=="+num+"---companyBaseId==="+companyBaseId);
}
}
return ObjectRestResponse.succ();
}
//设置基础信息
public ObjectRestResponse updCompany(CompanyVo companyVo){
if (companyVo==null|| StringUtils.isBlank(companyVo.getCompanyName())|| StringUtils.isBlank(companyVo.getName())||
companyVo.getZoneId()==null||companyVo.getZoneId()==0|| companyVo.getAddrProvince()==null||companyVo.getAddrProvince()==0
|| companyVo.getAddrCity()==null||companyVo.getAddrCity()==0){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
Integer state=companyVo.getState()==null?2:companyVo.getState();
if (state==1&&(StringUtils.isBlank(companyVo.getAddrDetail())||StringUtils.isBlank(companyVo.getImages())||StringUtils.isBlank(companyVo.getDescribes())||StringUtils.isBlank(companyVo.getContent())
||StringUtils.isBlank(companyVo.getLeader())||StringUtils.isBlank(companyVo.getLeaderContactInfo())||StringUtils.isBlank(companyVo.getTourServicePhone())||StringUtils.isBlank(companyVo.getVehiceServicePhone()))){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"上架时参数不能为空");
}
CompanyBase companyBase=new CompanyBase();
BeanUtils.copyProperties(companyVo,companyBase);
Integer companyBaseId=companyVo.getId();
if (companyBaseId==null||companyBaseId==0){
insertSelective(companyBase);
companyBaseId=companyBase.getId();
}else {
updateSelectiveById(companyBase);
}
BranchCompany branchCompany=new BranchCompany();
BeanUtils.copyProperties(companyVo,branchCompany);
branchCompany.setCompanyBaseId(companyBaseId);
branchCompany.setName(companyVo.getCompanyName());
Integer companyId=companyVo.getCompanyId();
if (companyId==null||companyId==0){
branchCompany.setId(null);
insertSelective(companyBase);
}else {
branchCompany.setId(companyId);
updateSelectiveById(companyBase);
}
return ObjectRestResponse.succ();
}
//设置股权信息
public ObjectRestResponse updStockInfo(CompanyVo companyVo){
if (companyVo==null|| StringUtils.isBlank(companyVo.getCompanyName())|| StringUtils.isBlank(companyVo.getName())||
companyVo.getZoneId()==null||companyVo.getZoneId()==0|| companyVo.getAddrProvince()==null||companyVo.getAddrProvince()==0
|| companyVo.getAddrCity()==null||companyVo.getAddrCity()==0){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
Integer state=companyVo.getState()==null?2:companyVo.getState();
if (state==1&&(StringUtils.isBlank(companyVo.getAddrDetail())||StringUtils.isBlank(companyVo.getImages())||StringUtils.isBlank(companyVo.getDescribes())||StringUtils.isBlank(companyVo.getContent())
||StringUtils.isBlank(companyVo.getLeader())||StringUtils.isBlank(companyVo.getLeaderContactInfo())||StringUtils.isBlank(companyVo.getTourServicePhone())||StringUtils.isBlank(companyVo.getVehiceServicePhone()))){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"上架时参数不能为空");
}
CompanyBase companyBase=new CompanyBase();
BeanUtils.copyProperties(companyVo,companyBase);
Integer companyBaseId=companyVo.getId();
if (companyBaseId==null||companyBaseId==0){
insertSelective(companyBase);
companyBaseId=companyBase.getId();
}else {
updateSelectiveById(companyBase);
}
BranchCompany branchCompany=new BranchCompany();
BeanUtils.copyProperties(companyVo,branchCompany);
branchCompany.setCompanyBaseId(companyBaseId);
branchCompany.setName(companyVo.getCompanyName());
Integer companyId=companyVo.getCompanyId();
if (companyId==null||companyId==0){
branchCompany.setId(null);
insertSelective(companyBase);
}else {
branchCompany.setId(companyId);
updateSelectiveById(companyBase);
}
return ObjectRestResponse.succ();
}
} }
package com.xxfc.platform.vehicle.rest.admin;
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.CompanyBaseBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.RestResponse;
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.vo.BranchCompanyStockInfoRightVo;
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;
@RestController
@IgnoreClientToken
@IgnoreUserToken
@RequestMapping("company/base")
public class CompanyBaseController extends BaseController<CompanyBaseBiz> {
@PostMapping("synchro")
public ObjectRestResponse<String> synchro() {
return baseBiz.synchro();
}
}
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