Commit aca2b54b authored by libin's avatar libin

股权

parent 5628808e
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.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;
}
...@@ -6,11 +6,15 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -6,11 +6,15 @@ 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.StringToolsUtil; import com.github.wxiaoqi.security.common.util.StringToolsUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode; 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.entity.BranchCompanyStockRight;
import com.xxfc.platform.vehicle.mapper.*; import com.xxfc.platform.vehicle.mapper.*;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockSearchVo; 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.BranchCompanyStockInfoRightVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockRightForWeChatOfficeVO;
import com.xxfc.platform.vehicle.util.excel.ExcelImport; import com.xxfc.platform.vehicle.util.excel.ExcelImport;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -18,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -18,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -45,12 +50,12 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM ...@@ -45,12 +50,12 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
//更新股权 //更新股权
public ObjectRestResponse updStockInfo(BranchCompanyStockInfoRightVo stockInfoVo) { 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(); Integer id = stockInfoVo.getId();
if (!checkInfo(id,stockInfoVo.getCompanyId())){ if (!checkInfo(id, stockInfoVo.getCompanyId())) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"分公司已存在"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "分公司已存在");
} }
BranchCompanyStockRight stockInfo = new BranchCompanyStockRight(); BranchCompanyStockRight stockInfo = new BranchCompanyStockRight();
BeanUtils.copyProperties(stockInfoVo, stockInfo); BeanUtils.copyProperties(stockInfoVo, stockInfo);
...@@ -60,24 +65,24 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM ...@@ -60,24 +65,24 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
if (stockInfoVo.getState() == null) { if (stockInfoVo.getState() == null) {
stockInfo.setState(0); stockInfo.setState(0);
} }
if (id==null||id==0){ if (id == null || id == 0) {
mapper.insertSelective(stockInfo); mapper.insertSelective(stockInfo);
}else { } else {
mapper.updateByPrimaryKeySelective(stockInfo); mapper.updateByPrimaryKeySelective(stockInfo);
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
//检查是否存在分公司 //检查是否存在分公司
public boolean checkInfo(Integer id,Integer companyId) { public boolean checkInfo(Integer id, Integer companyId) {
Example example=new Example(BranchCompanyStockRight.class); Example example = new Example(BranchCompanyStockRight.class);
Example.Criteria criteria=example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("companyId",companyId); criteria.andEqualTo("companyId", companyId);
if (id!=null&&id>0){ if (id != null && id > 0) {
criteria.andNotEqualTo("id",id); criteria.andNotEqualTo("id", id);
} }
List<BranchCompanyStockRight> list=mapper.selectByExample(example); List<BranchCompanyStockRight> list = mapper.selectByExample(example);
if (list.size()>0) if (list.size() > 0)
return false; return false;
return true; return true;
} }
...@@ -91,6 +96,7 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM ...@@ -91,6 +96,7 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
/** /**
* 获取所有的股权单价 * 获取所有的股权单价
*
* @return * @return
*/ */
public List<Integer> getAllPrice() { public List<Integer> getAllPrice() {
...@@ -99,26 +105,26 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM ...@@ -99,26 +105,26 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
//更新股份 //更新股份
public int updateBalance(Integer companyId,Integer balance,Integer lastBalance){ public int updateBalance(Integer companyId, Integer balance, Integer lastBalance) {
return mapper.updateBalance(companyId,balance,lastBalance); return mapper.updateBalance(companyId, balance, lastBalance);
} }
//删除股权 //删除股权
public void delete(Integer id) { public void delete(Integer id) {
BranchCompanyStockRight stockRight=new BranchCompanyStockRight(); BranchCompanyStockRight stockRight = new BranchCompanyStockRight();
stockRight.setId(id); stockRight.setId(id);
stockRight.setIsDel(1); stockRight.setIsDel(1);
mapper.updateByPrimaryKeySelective(stockRight); mapper.updateByPrimaryKeySelective(stockRight);
} }
//导入 //导入
public ObjectRestResponse<String> importExcel(MultipartFile multipartfile, HttpServletRequest request){ public ObjectRestResponse<String> importExcel(MultipartFile multipartfile, HttpServletRequest request) {
try { try {
List<String[]> readExcel = ExcelImport.getExcelData(multipartfile); List<String[]> readExcel = ExcelImport.getExcelData(multipartfile);
if(readExcel.size()<4){ if (readExcel.size() < 4) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"导入不能没数据!!!"); return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "导入不能没数据!!!");
} }
List<BranchCompanyStockRight> list=new ArrayList<>(); List<BranchCompanyStockRight> list = new ArrayList<>();
for (int i = 3; i < readExcel.size(); i++) { for (int i = 3; i < readExcel.size(); i++) {
BranchCompanyStockRight stockInfoVo = new BranchCompanyStockRight(); BranchCompanyStockRight stockInfoVo = new BranchCompanyStockRight();
String[] str = readExcel.get(i); String[] str = readExcel.get(i);
...@@ -136,13 +142,13 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM ...@@ -136,13 +142,13 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
} else { } else {
str3 = str3.replace("万/股", ""); 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) + "行的数据格式不对"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "第" + (i + 1) + "行的数据格式不对");
} }
BigDecimal price = new BigDecimal(str3); BigDecimal price = new BigDecimal(str3);
price=price.multiply(new BigDecimal("10000")); price = price.multiply(new BigDecimal("10000"));
Integer balance = Integer.parseInt(str[4]); Integer balance = Integer.parseInt(str[4]);
Integer total =Integer.parseInt(str[5])+balance; Integer total = Integer.parseInt(str[5]) + balance;
stockInfoVo.setPrice(price); stockInfoVo.setPrice(price);
stockInfoVo.setBalance(balance); stockInfoVo.setBalance(balance);
stockInfoVo.setTotal(total); stockInfoVo.setTotal(total);
...@@ -150,13 +156,36 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM ...@@ -150,13 +156,36 @@ public class BranchCompanyStockRightBiz extends BaseBiz<BranchCompanyStockRightM
list.add(stockInfoVo); list.add(stockInfoVo);
} }
mapper.addCompamyList(list); mapper.addCompamyList(list);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"网络异常!"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "网络异常!");
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public PageDataVO<BranchCompanyStockRightForWeChatOfficeVO> findWithPageByPriceOrCode(BranchCompanyStockRightFindDTO branchCompanyStockRightFindDTO) {
PageDataVO<BranchCompanyStockRightForWeChatOfficeVO> dataPage = new PageDataVO<>();
PageDataVO<BranchCompanyStockRight> pageDataVO = PageDataVO.pageInfo(branchCompanyStockRightFindDTO.getPage(), branchCompanyStockRightFindDTO.getLimit(),
() -> mapper.findWithPageByPriceOrCode(branchCompanyStockRightFindDTO.getPrice(), branchCompanyStockRightFindDTO.getProvinceCode(), branchCompanyStockRightFindDTO.getCityCode()));
List<BranchCompanyStockRight> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){
return dataPage;
}
List<BranchCompanyStockRightForWeChatOfficeVO> stockRights = new ArrayList<>();
BranchCompanyStockRightForWeChatOfficeVO branchCompanyStockRightForWeChatOfficeVO;
for (BranchCompanyStockRight 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;
}
} }
...@@ -51,7 +51,7 @@ public class VehicleJobHandler extends IJobHandler { ...@@ -51,7 +51,7 @@ public class VehicleJobHandler extends IJobHandler {
int betweenMonth = Integer.valueOf(dictionary.getDetail()).intValue(); int betweenMonth = Integer.valueOf(dictionary.getDetail()).intValue();
int month = nowMonth + betweenMonth> 12 ? (betweenMonth + nowMonth) - 12 : nowMonth + betweenMonth; int month = nowMonth + betweenMonth> 12 ? (betweenMonth + nowMonth) - 12 : nowMonth + betweenMonth;
year = month > nowMonth ? year : year + 1; 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); XxlJobLogger.log("----查询到的车型ids:【{}】",existVehicleIds);
if (CollectionUtils.isNotEmpty(existVehicleIds)) { if (CollectionUtils.isNotEmpty(existVehicleIds)) {
List<VehicleBookInfo> bookInfos = existVehicleIds.stream().map(vehicleId -> { List<VehicleBookInfo> bookInfos = existVehicleIds.stream().map(vehicleId -> {
......
...@@ -7,6 +7,7 @@ import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo; ...@@ -7,6 +7,7 @@ import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockInfoRightVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
...@@ -25,4 +26,6 @@ public interface BranchCompanyStockRightMapper extends Mapper<BranchCompanyStock ...@@ -25,4 +26,6 @@ public interface BranchCompanyStockRightMapper extends Mapper<BranchCompanyStock
int addCompamyList(@Param("list") List<BranchCompanyStockRight> list); int addCompamyList(@Param("list") List<BranchCompanyStockRight> list);
Integer getCompanyInfo(@Param("name")String name); Integer getCompanyInfo(@Param("name")String name);
List<BranchCompanyStockRight> findWithPageByPriceOrCode(@Param("price") BigDecimal price,@Param("provinceCode") Integer provinceCode,@Param("cityCode") Integer cityCode);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; ...@@ -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.auth.client.annotation.IgnoreUserToken;
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.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.BranchCompanyStockApplyInfoBiz;
import com.xxfc.platform.vehicle.biz.BranchCompanyStockRightBiz; import com.xxfc.platform.vehicle.biz.BranchCompanyStockRightBiz;
import com.xxfc.platform.vehicle.common.BaseController; import com.xxfc.platform.vehicle.common.BaseController;
...@@ -12,7 +13,9 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode; ...@@ -12,7 +13,9 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockApplyInfo; import com.xxfc.platform.vehicle.entity.BranchCompanyStockApplyInfo;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockApplyVo; import com.xxfc.platform.vehicle.pojo.BranchCompanyStockApplyVo;
import com.xxfc.platform.vehicle.pojo.BranchCompanyStockSearchVo; 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.BranchCompanyStockInfoRightVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyStockRightForWeChatOfficeVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -191,4 +194,15 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp ...@@ -191,4 +194,15 @@ public class BranchCompanyStockRightController extends BaseController<BranchComp
return baseBiz.importExcel(multipartfile,request); return baseBiz.importExcel(multipartfile,request);
} }
/**
* 微信公众号查询
* @param branchCompanyStockRightFindDTO
* @return
*/
@GetMapping("/webchat_office/stockrights")
public ObjectRestResponse<PageDataVO<BranchCompanyStockRightForWeChatOfficeVO>> findBranchCompanyStockRightsForWechatOffice(BranchCompanyStockRightFindDTO branchCompanyStockRightFindDTO){
PageDataVO<BranchCompanyStockRightForWeChatOfficeVO> branchCompanyStockRightForWeChatOfficeVOPageDataVO = baseBiz.findWithPageByPriceOrCode(branchCompanyStockRightFindDTO);
return ObjectRestResponse.succ(branchCompanyStockRightForWeChatOfficeVOPageDataVO);
}
} }
...@@ -76,8 +76,34 @@ ...@@ -76,8 +76,34 @@
insert into branch_company_stock_info_right ( insert into branch_company_stock_info_right (
company_id,balance,total,price,state,company_pic,crt_time,upd_time company_id,balance,total,price,state,company_pic,crt_time,upd_time
) VALUES ) VALUES
<foreach collection ="list" item="item" index="index" separator =","> <foreach collection="list" item="item" index="index" separator=",">
(#{item.companyId},#{item.balance},#{item.total},#{item.price},#{item.state},#{item.companyPic},#{item.crtTime},#{item.updTime}) (#{item.companyId},#{item.balance},#{item.total},#{item.price},#{item.state},#{item.companyPic},#{item.crtTime},#{item.updTime})
</foreach> </foreach>
</insert> </insert>
<select id="findWithPageByPriceOrCode"
resultType="com.xxfc.platform.vehicle.entity.BranchCompanyStockRight">
SELECT
bcsir.id,
bcsir.balance,
bcsir.total,
bcsir.type,
bcsir.price,
cb.cover,
cb.name
FROM
( SELECT id, company_base_id, balance, total, price, type FROM `branch_company_stock_info_right` WHERE `state` =
2 AND `is_del`=0
<if test="price != null">
AND `price`=#{price}
</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`=#{provinceCode}
</if>
) AS `cb` ON cb.id = bcsir.company_base_id
</select>
</mapper> </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