Commit ec506e95 authored by wuwz's avatar wuwz

Merge remote-tracking branch 'origin/dev-chw' into dev-chw

parents 942344bd 8e57b8fc
......@@ -78,6 +78,15 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return selectByExample(example);
}
public List<T> selectByBuilder(Function<Example.Builder, Example.Builder> builderFun, String orderStr) {
Example.Builder builder = builderFun.apply(new Example.Builder(entityClass));
Example example = builder.build();
if(StrUtil.isNotBlank(orderStr)) {
example.setOrderByClause(orderStr);
}
return selectByExample(example);
}
public List<T> selectByWeekendsOr(Supplier<List<WeekendSqls<T>>> where, String orderStr) {
List<WeekendSqls<T>> whereSqlss = where.get();
Example.Builder builder = new Example.Builder(entityClass);
......
......@@ -4,8 +4,10 @@ import java.util.HashMap;
import java.util.Map;
public enum CompanyWalletITypeEnum {
COMPANY(1, "商家"),
CATH(2, "提现"),
COMPANY(1, "订单收入"),
REGULATION(2, "违章收入"),
CATH(3, "订单提现"),
REGULATION_CATH(4, "违章提现"),
;
/**
* 编码
......
......@@ -25,5 +25,7 @@ public class BaseOrderAcceptDetailedDTO extends PageParam implements DataInter {
private Integer acceptId;
private Integer iType;
}
package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.DataInter;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class BaseOrderRevenueFindDTO extends PageParam implements DataInter {
private Integer status;
private String month;
Integer companyId;
List<Integer> dataCorporationIds;
List<Integer> dataCompanyIds;
Integer bizType;
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/12 9:20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyAccountDTO {
@ApiModelProperty("店铺id")
private Integer companyId;
@ApiModelProperty(value = "银行账号")
private String bankAccount;
@ApiModelProperty(value = "开户名")
private String bankName;
@ApiModelProperty(value = "开户行")
private String bank;
}
package com.github.wxiaoqi.security.admin.dto;
import lombok.Data;
/**
* 店铺钱包设置密码
*/
@Data
public class CompanyWalletPwdDTO {
private Integer companyId;
private String phone;
private String mobilecod;
private String password;
private Integer type;
}
\ No newline at end of file
......@@ -25,8 +25,8 @@ public class WalletCathApplyDTO {
@ApiModelProperty("门店")
private List<JSONObject> companyIds;
@ApiModelProperty("营收Id")
private Integer revenueId;
@ApiModelProperty("提现金额")
......@@ -40,6 +40,9 @@ public class WalletCathApplyDTO {
@ApiModelProperty("账号名称")
private String accountName;
@ApiModelProperty("开户名")
private String bank;
......
......@@ -23,7 +23,8 @@ import java.util.List;
public class WalletCathDTO extends PageParam implements DataInter {
@ApiModelProperty("提现Id")
private Integer id;
@ApiModelProperty("门店")
private Integer companyId;
......
......@@ -32,6 +32,8 @@ public class WalletCathSumDto {
//钱包版本
private Integer version;
private Integer withdrawWay;
......
......@@ -3,9 +3,7 @@ package com.github.wxiaoqi.security.admin.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
......@@ -208,12 +206,4 @@ public class CompanyInfo {
@ApiModelProperty("公司地址-经度")
private BigDecimal longitude;
public String getHeadLogo(){
if (StringUtils.isBlank(headLogo)){
headLogo="https://chwplatform.upyuns.com/image/app/shop_logo_default.png";
}
return headLogo;
}
}
\ No newline at end of file
......@@ -42,6 +42,18 @@ public class CompanyWalletCath implements Serializable {
@ApiModelProperty(value = "门店ID")
private Integer companyId;
@Column(name = "wallet_detail_id")
@ApiModelProperty(value = "钱包明细id")
private Integer walletDetailId;
@Column(name = "revenue_id")
@ApiModelProperty(value = "营收id")
private Integer revenueId;
/**
* 提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)
*/
......@@ -128,9 +140,15 @@ public class CompanyWalletCath implements Serializable {
private String updUser;
@Column(name = "order_no")
@ApiModelProperty(value = "第三方订单号:如微信,支付宝,银行卡等")
@ApiModelProperty(value = "订单号")
private String orderNo;
@Column(name = "cath_no")
@ApiModelProperty(value = "提现单号")
private String cathNo;
@Column(name = "account_name")
private String accountName;
......
......@@ -17,6 +17,14 @@ import java.math.BigDecimal;
@AllArgsConstructor
@NoArgsConstructor
public class ApplyCathVo {
@ApiModelProperty("营收Id")
private Integer revenueId;
/**
* 用户ID
*/
......@@ -47,7 +55,17 @@ public class ApplyCathVo {
@ApiModelProperty(value = "支付类型")
private Integer cathType;
@ApiModelProperty(value = "账号名称")
private String accountName;
@ApiModelProperty(value = "开户行")
private String bank;
@ApiModelProperty(value = "订单号")
private String orderNo;
}
package com.github.wxiaoqi.security.admin.vo;
import com.github.wxiaoqi.security.admin.constant.enumerate.CompanyWalletSourceEnum;
import com.github.wxiaoqi.security.admin.entity.BaseOrderRevenue;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/12 9:20
*/
@Data
public class BaseOrderRevenueVo extends BaseOrderRevenue {
private BigDecimal withdrawAmount;
private String showTypeStr;
public String getShowTypeStr() {
String type = this.getType();
showTypeStr = "";
if (StringUtils.isNotBlank(type)) {
String[] values = type.split(",");
List<String> list = Arrays.asList(values);
if (list.contains(CompanyWalletSourceEnum.VEHICLE.getCode()+"")) {
if (list.contains(CompanyWalletSourceEnum.WATER.getCode()+"")){
showTypeStr = "租赁费+上级拥金";
}else {
showTypeStr = "租赁费";
}
} else if (list.contains(CompanyWalletSourceEnum.WATER.getCode()+"")) {
if (list.contains(CompanyWalletSourceEnum.VEHICLE.getCode()+"")){
showTypeStr = "租赁费+上级拥金";
}else {
showTypeStr = "上级拥金";
}
} else if (list.contains(CompanyWalletSourceEnum.REGULATION.getCode()+"")) {
showTypeStr = "违章金";
}
}
return showTypeStr;
}
}
......@@ -23,6 +23,7 @@ public class BaseCommissionRatioBiz extends BaseBiz<BaseCommissionRatioMapper, B
public List<BaseCommissionRatio> getList(){
Example example=new Example(BaseCommissionRatio.class);
example.createCriteria().andEqualTo("status",1);
example.setOrderByClause("type asc");
return mapper.selectByExample(example);
}
......
......@@ -135,10 +135,11 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
BigDecimal amount=BigDecimal.ZERO;
BigDecimal companyDivisionAmount=orderAmount;
BigDecimal extrac = new BigDecimal(100);
BigDecimal companyExtrac=new BigDecimal(100);
if (baseCommissionRatios.size() > 0){
//先计算分给店铺
BigDecimal companyExtrac = baseCommissionRatios.stream().map(BaseCommissionRatio::getExtract).reduce(BigDecimal.ZERO,BigDecimal::add);
companyExtrac = new BigDecimal(100).subtract(companyExtrac);
extrac = baseCommissionRatios.stream().map(BaseCommissionRatio::getExtract).reduce(BigDecimal.ZERO,BigDecimal::add);
companyExtrac = new BigDecimal(100).subtract(extrac);
//店铺金额
companyDivisionAmount=orderAmount.multiply(companyExtrac).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
//其他金额
......@@ -173,23 +174,25 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
continue;
}
BigDecimal divisionAmount ;
BigDecimal extract1=commissionRatio.getExtract();
if (num.equals(baseCommissionRatios.size())){
divisionAmount=otherDivisionAmount.subtract(amount);
extract1=extrac;
}else {
divisionAmount=orderAmount.multiply(commissionRatio.getExtract()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
divisionAmount=orderAmount.multiply(extract1).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
}
BaseOrderAcceptDetailed acceptDetailed=new BaseOrderAcceptDetailed();
BeanUtils.copyProperties(orderWaterDTO,acceptDetailed);
acceptDetailed.setMchId(mchId);
acceptDetailed.setOrderAmount(orderAmount);
acceptDetailed.setDivisionAmount(divisionAmount);
acceptDetailed.setExtract(commissionRatio.getExtract());
acceptDetailed.setExtract(extract1);
acceptDetailed.setDivisionType(divisionType);
acceptDetailed.setAddTime(System.currentTimeMillis());
acceptDetailed.setStatus(0);
insertSelective(acceptDetailed);
amount=amount.add(divisionAmount);
extrac=extrac.subtract(commissionRatio.getExtract());
extrac=extrac.subtract(extract1);
orderWaterDTO.setAcceptId(acceptDetailed.getId());
sellingWaterBiz.payOrderWater(orderWaterDTO);
}
......@@ -199,7 +202,7 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
BaseOrderAcceptDetailed acceptDetailed=new BaseOrderAcceptDetailed();
BeanUtils.copyProperties(orderWaterDTO,acceptDetailed);
acceptDetailed.setMchId(companyId);
acceptDetailed.setExtract(extrac);
acceptDetailed.setExtract(companyExtrac);
acceptDetailed.setOrderAmount(orderAmount);
acceptDetailed.setDivisionAmount(companyDivisionAmount);
acceptDetailed.setDivisionType(5);
......@@ -258,7 +261,6 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
amount=amount.subtract(acceptDetailed1.getDivisionAmount());
}
}
othderAccept(orderDetailDTO);
}
}
}
......@@ -293,6 +295,7 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
if (acceptAmount.compareTo(BigDecimal.ZERO) > 0){
payOrderFAccept(orderWaterDTO,orderDetailDTO);
}
othderAccept(orderDetailDTO);
log.info("订单完成分账----finishOrderWater--------orderId===" + orderId + "----amount====" + amount + "--orderType===" + orderType);
}
......
......@@ -2,17 +2,24 @@ package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.constant.enumerate.CompanyWalletITypeEnum;
import com.github.wxiaoqi.security.admin.constant.enumerate.CompanyWalletSourceEnum;
import com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO;
import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.mapper.BaseOrderRevenueMapper;
import com.github.wxiaoqi.security.admin.vo.BaseOrderRevenueVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -64,6 +71,34 @@ public class BaseOrderRevenueBiz extends BaseBiz<BaseOrderRevenueMapper, BaseOrd
}
public PageDataVO<BaseOrderRevenueVo> selectList(BaseOrderRevenueFindDTO revenueFindDTO) {
return PageDataVO.pageInfo(revenueFindDTO.getPage(), revenueFindDTO.getLimit(), () -> getList(revenueFindDTO));
}
public List<BaseOrderRevenueVo> getList(BaseOrderRevenueFindDTO revenueFindDTO){
return mapper.selectList(revenueFindDTO);
}
public BigDecimal sumAmount(BaseOrderRevenueFindDTO revenueFindDTO){
return mapper.sumAmount(revenueFindDTO);
}
public Integer getType(String type){
Integer itype = CompanyWalletITypeEnum.CATH.getCode();
if (StringUtils.isNotBlank(type)) {
String[] values = type.split(",");
List<String> list = Arrays.asList(values);
if (list.contains(CompanyWalletSourceEnum.REGULATION.getCode()+"")) {
itype = CompanyWalletITypeEnum.REGULATION_CATH.getCode();
}
}
return itype;
}
}
......@@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.dto.CompanyApplyFindDTO;
import com.github.wxiaoqi.security.admin.entity.BranchCompany;
import com.github.wxiaoqi.security.admin.entity.CompanyInfo;
import com.github.wxiaoqi.security.admin.entity.CompanyInfoApply;
import com.github.wxiaoqi.security.admin.entity.CompanyInfoOrder;
import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.mapper.CompanyInfoApplyMapper;
import com.github.wxiaoqi.security.admin.vo.CompanyApplyVo;
import com.github.wxiaoqi.security.admin.vo.CompanyInfoVo;
......@@ -21,6 +18,8 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.ThirdFeign;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -29,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
......@@ -46,6 +46,12 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company
@Autowired
CompanyInfoOrderBiz companyInfoOrderBiz;
@Autowired
ThirdFeign thirdFeign;
@Autowired
AppUserLoginBiz appUserLoginBiz;
@Transactional(rollbackFor = Exception.class)
public CompanyInfoApply saveApply(CompanyInfo companyInfo){
......@@ -109,6 +115,8 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company
return companyInfoApply;
}
public Long checkStatus(Long branchId){
CompanyInfoApply companyInfoApply=new CompanyInfoApply();
companyInfoApply.setBranchId(branchId);
......@@ -189,12 +197,37 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company
companyInfoApply1.setBranchId(id);
updateSelectiveById(companyInfoApply1);
}
}
sendSms(companyInfoApply);
}
public void sendSms(CompanyInfoApply companyInfoApply){
try {
//发送短信通知用户
companyInfoApply=selectById(companyInfoApply.getId());
List<String> smsParams = new ArrayList<>();
String name = StringUtils.isBlank(companyInfoApply.getName()) ? "" : companyInfoApply.getName();
smsParams.add(name);
Integer userId = companyInfoApply.getAppUserId() == null ? 0 : companyInfoApply.getAppUserId();
AppUserLogin userLogin = appUserLoginBiz.selectById(userId);
if (userLogin == null){
return;
}
Integer type=companyInfoApply.getStatus() == 1 ? SmsTemplateDTO.COMPANY_S : SmsTemplateDTO.COMPANY_F;
thirdFeign.sendTemplate(new SmsTemplateDTO(){{
setPhoneNumbers(userLogin.getUsername());
setType(type);
setParams(smsParams.toArray(new String[smsParams.size()]));
}});
}catch (Exception e){
log.error(e.getMessage(), e);
return;
}
}
public CompanyInfoVo getCompanyInfo(CompanyInfo companyInfo){
Long branchId = companyInfo.getId() == null ? 0L : companyInfo.getId();
......
......@@ -78,6 +78,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
companyInfo.setId(id);
updateSelectiveById(companyInfo);
}else {
setHeadLog(companyInfo);
insertSelective(companyInfo);
id=companyInfo.getId();
//初始化商家账号
......@@ -100,6 +101,19 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
return id;
}
public void setHeadLog(CompanyInfo companyInfo){
String headLog = companyInfo.getHeadLogo();
if (StringUtils.isBlank(headLog)){
Long id = companyInfo.getId() == null ? 0L : companyInfo.getId();
if ( id > 0){
CompanyInfo companyInfo1=selectById(id);
headLog=companyInfo1 == null ? null : companyInfo1.getHeadLogo();
}
headLog = StringUtils.isBlank(headLog) ? "https://chwplatform.upyuns.com/image/app/shop_logo_default.png" : headLog;
}
companyInfo.setHeadLogo(headLog);
}
//app上级用户为店铺推荐人
public void setInviterAccount(CompanyInfoApply companyInfoApply){
Integer inviterAccount = companyInfoApply.getInviterAccount() == null ? 0 : companyInfoApply.getInviterAccount();
......@@ -137,6 +151,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
if (id > 0L ){
updateSelectiveById(companyInfo);
}else {
setHeadLog(companyInfo);
insertSelective(companyInfo);
}
sendQueue(companyInfo);
......@@ -216,4 +231,8 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
groupBiz.modifyUserGroups(user.getId(),members);
}
public CompanyInfo getInfoByCompanyId(Integer companyId){
return mapper.getInfoByCompanyId(companyId);
}
}
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO;
import com.github.wxiaoqi.security.admin.dto.CompanyWalletDTO;
import com.github.wxiaoqi.security.admin.dto.WalletDetailDTO;
import com.github.wxiaoqi.security.admin.entity.CompanyWallet;
......@@ -11,6 +12,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
......@@ -23,6 +25,11 @@ public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet
@Autowired
BaseOrderRevenueBiz revenueBiz;
public void updCompanyWallet(CompanyWallet companyWallet){
mapper.updMyWater(companyWallet);
}
......@@ -65,7 +72,10 @@ public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet
CompanyWalletVo companyWalletVo = list.get(0);
companyWalletVo.setTodayAmount(mapper.todayAmount(companyWalletVo.getCompanyId()));
companyWalletVo.setNotDoAmount(mapper.notDoAmount(companyWalletVo.getCompanyId()));
companyWalletVo.setMonthAmount(mapper.monthAmount(companyWalletVo.getCompanyId(),walletDTO.getMonth()));
BaseOrderRevenueFindDTO baseOrderRevenueFindDTO = new BaseOrderRevenueFindDTO();
baseOrderRevenueFindDTO.setCompanyId(companyWalletVo.getCompanyId());
baseOrderRevenueFindDTO.setMonth(walletDTO.getMonth());
companyWalletVo.setMonthAmount(revenueBiz.sumAmount(baseOrderRevenueFindDTO));
return companyWalletVo;
}
......
......@@ -65,6 +65,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
.builder()
.orderNo(orderWaterDTO.getOrderNo())
.divisionTypes(divisionTypes)
.iType(CompanyWalletITypeEnum.COMPANY.getCode())
.build();
updByIdOrOrderNo(acceptDetailedDTO);
}
......@@ -77,6 +78,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
BaseOrderAcceptDetailedDTO acceptDetailedDTO = BaseOrderAcceptDetailedDTO
.builder()
.acceptId(acceptId)
.iType(CompanyWalletITypeEnum.REGULATION.getCode())
.build();
updByIdOrOrderNo(acceptDetailedDTO);
}
......@@ -112,7 +114,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
companyWalletDetail.setCompanyId(acceptDetailedVO.getMchId());
companyWalletDetail.setSAmount(companyAmount);
companyWalletDetail.setSource(source);
companyWalletDetail.setItype(CompanyWalletITypeEnum.COMPANY.getCode());
companyWalletDetail.setItype(acceptDetailedDTO.getIType());
insertSelective(companyWalletDetail);
walletDetails.add(companyWalletDetail);
}
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO;
import com.github.wxiaoqi.security.admin.entity.BaseOrderRevenue;
import com.github.wxiaoqi.security.admin.vo.BaseOrderRevenueVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List;
public interface BaseOrderRevenueMapper extends Mapper<BaseOrderRevenue>, SelectByIdListMapper<BaseOrderRevenue,Integer> {
BaseOrderRevenue infoByOrderNo(@Param("orderNo") String orderNo, @Param("type")String type,@Param("companyId")Integer companyId);
List<BaseOrderRevenueVo> selectList(BaseOrderRevenueFindDTO revenueFindDTO);
BigDecimal sumAmount(BaseOrderRevenueFindDTO revenueFindDTO);
}
\ No newline at end of file
......@@ -2,8 +2,14 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.CompanyInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface CompanyInfoMapper extends Mapper<CompanyInfo>, SelectByIdListMapper<CompanyInfo,Long> {
@Select("SELECT * FROM company_info WHERE id in (SELECT company_id FROM branch_company WHERE id=#{companyId} )")
CompanyInfo getInfoByCompanyId(@Param("companyId")Integer companyId);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.WalletCathDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathSumDto;
import com.github.wxiaoqi.security.admin.entity.CompanyWalletCath;
import com.github.wxiaoqi.security.admin.vo.CompanyWalletCathVo;
import org.apache.ibatis.annotations.Param;
......@@ -27,4 +28,12 @@ public interface CompanyWalletCathMapper extends Mapper<CompanyWalletCath> {
@Select("SELECT IFNULL(SUM(amount),0) FROM company_wallet_cath WHERE company_id =#{companyId} AND stauts=0")
BigDecimal sunAmountByStatus(@Param("companyId") Integer companyId);
/**
* 计算提现的金额
* @param type 1-日;2-月
* @return
*/
WalletCathSumDto sumCathAmount(@Param("companyId") Integer companyId, @Param("type") int type);
}
......@@ -37,7 +37,7 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
List<CompanyWalletVo> selectList(CompanyWalletDTO walletDTO);
@Select("SELECT IFNULL(SUM(amount),0) FROM company_wallet_detail WHERE type=1 and company_id=#{companyId} and from_unixtime(crt_time/1000,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')")
@Select("SELECT IFNULL(SUM(amount),0) FROM base_order_revenue WHERE amount > 0 and is_del = 0 and company_id=#{companyId} and from_unixtime(crt_time/1000,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')")
BigDecimal todayAmount(@Param("companyId") Integer companyId);
......@@ -45,6 +45,6 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
BigDecimal monthAmount(@Param("companyId") Integer companyId,@Param("month") String month);
@Select("SELECT IFNULL(SUM(division_amount-fee),0) FROM base_order_accept_detailed WHERE `status`=0 and mch_id=#{companyId} and division_type in (3,5,6,7,8)")
@Select("SELECT IFNULL(SUM(amount),0) FROM base_order_revenue WHERE amount > 0 and is_del = 0 and company_id=#{companyId} and status = 0")
BigDecimal notDoAmount(@Param("companyId") Integer companyId);
}
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletCathBiz;
import com.github.wxiaoqi.security.admin.dto.CompanyAccountDTO;
import com.github.wxiaoqi.security.admin.dto.CompanyWalletPwdDTO;
import com.github.wxiaoqi.security.admin.vo.ApplyCathVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("app/companyWalletCath")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Api(tags = {"店铺提现"})
public class AppCompanyCathController extends BaseController<CompanyWalletCathBiz> {
@GetMapping("sendSMS")
@ApiOperation("发送验证码")
public ObjectRestResponse sendSMS() throws Exception{
baseBiz.sendSMS(getUserName());
return ObjectRestResponse.succ();
}
@GetMapping("checkCode")
@ApiOperation("检查验证码")
public ObjectRestResponse checkCode(
@RequestParam(value = "mobilecode", defaultValue = "") String mobilecod) throws Exception{
return baseBiz.checkCode(getUserName(), mobilecod);
}
@PostMapping("setPwd")
@ApiOperation("设置密码")
public ObjectRestResponse setPwd(@RequestBody CompanyWalletPwdDTO companyWalletPwdDTO) throws Exception{
if (companyWalletPwdDTO.getCompanyId() == null || companyWalletPwdDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyWalletPwdDTO.setCompanyId(companyIds.get(0));
}
}
if (StringUtils.isBlank(companyWalletPwdDTO.getPhone())){
companyWalletPwdDTO.setPhone(getUserName());
}
return baseBiz.setPwd(companyWalletPwdDTO);
}
@GetMapping("checkSetPwdOrAccount")
@ApiOperation("检查用户是否设置过(支付密码或银行卡)")
public ObjectRestResponse checkSetPwdOrAccount(@RequestParam(value = "companyId", defaultValue = "0") Integer companyId) {
if (companyId == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyId=companyIds.get(0);
}
}
return ObjectRestResponse.succ(baseBiz.checkSetPwdOrAccount(companyId));
}
@PostMapping("applyCath")
@ApiOperation("提现申请")
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo) {
if (applyCathVo.getUserId() == null || applyCathVo.getUserId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
applyCathVo.setUserId(companyIds.get(0));
}
}
return baseBiz.applyCath(applyCathVo);
}
@PostMapping("updAccount")
@ApiOperation("设置银行卡")
public ObjectRestResponse updAccount(@RequestBody CompanyAccountDTO companyAccountDTO) {
if (companyAccountDTO.getCompanyId() == null || companyAccountDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyAccountDTO.setCompanyId(companyIds.get(0));
}
}
baseBiz.updAccount(companyAccountDTO);
return ObjectRestResponse.succ();
}
}
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.BaseOrderRevenueBiz;
import com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("app/revenue")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Api(tags = {"营收明细"})
public class AppOrderRevenueController extends BaseController<BaseOrderRevenueBiz> {
@GetMapping("selectList")
@ApiModelProperty("列表")
public ObjectRestResponse selectList(BaseOrderRevenueFindDTO orderRevenueFindDTO) {
if (orderRevenueFindDTO.getCompanyId() == null || orderRevenueFindDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
orderRevenueFindDTO.setCompanyId(companyIds.get(0));
}
}
return ObjectRestResponse.succ(baseBiz.selectList(orderRevenueFindDTO));
}
@GetMapping("sumAmount")
@ApiModelProperty("总营收")
public ObjectRestResponse sumAmount(BaseOrderRevenueFindDTO orderRevenueFindDTO) {
if (orderRevenueFindDTO.getCompanyId() == null || orderRevenueFindDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
orderRevenueFindDTO.setCompanyId(companyIds.get(0));
}
}
return ObjectRestResponse.succ(baseBiz.sumAmount(orderRevenueFindDTO));
}
}
......@@ -73,20 +73,6 @@ public class AdminCompanyWalletDetailController extends BaseController<CompanyWa
}
@RequestMapping(value = "applyCath", method = RequestMethod.POST)
@ApiModelProperty(value = "提现申请")
public ObjectRestResponse applyCath(@RequestBody CompanyWalletCath walletCathDTO) {
walletCathBiz.applyCath(walletCathDTO);
return ObjectRestResponse.succ();
}
@RequestMapping(value = "applyCathList", method = RequestMethod.POST)
@ApiModelProperty(value = "提现申请List")
public ObjectRestResponse applyCathList(@RequestBody WalletCathApplyDTO walletCathApplyDTO) {
walletCathBiz.applyCathList(walletCathApplyDTO);
return ObjectRestResponse.succ();
}
@RequestMapping(value = "withDrawProcess", method = RequestMethod.POST)
@ApiModelProperty(value = "提现审核")
......@@ -96,4 +82,11 @@ public class AdminCompanyWalletDetailController extends BaseController<CompanyWa
}
@RequestMapping(value = "selectListByCath", method = RequestMethod.GET)
@ApiModelProperty(value = "提现记录")
public ObjectRestResponse<PageDataVO<CompanyWalletDetailVo>> selectListByCath(WalletCathDTO walletCathDTO) {
return ObjectRestResponse.succ(walletCathBiz.selectList(walletCathDTO));
}
}
\ No newline at end of file
......@@ -281,6 +281,15 @@ public class AppUserRest {
}
@ApiModelProperty("注销")
@PostMapping("cancelUsername")
public ObjectRestResponse updUsername(@RequestParam(value = "mobilecode") String mobilecode,HttpServletRequest request)throws Exception{
IJWTInfo infoFromToken = authUtil.getInfoFromToken(userAuthConfig.getToken(request));
return appPermissionService.cancelUsername(Integer.parseInt(infoFromToken.getId()),mobilecode);
}
/*@GetMapping("/app/unauth/test")
@IgnoreUserToken
public ObjectRestResponse test(){
......
......@@ -1278,6 +1278,29 @@ public class AppPermissionService {
}
//注销
public ObjectRestResponse cancelUsername(Integer userId,String mobileCode){
if (StringUtils.isBlank(mobileCode) || userId == 0 || userId == null ){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
// 是否已存在
AppUserLogin user = appUserLoginBiz.selectById(userId);
if (user==null){
return ObjectRestResponse.createFailedResult(ResultCode.EXIST_CODE, "用户不存在");
}
if (StringUtils.isBlank(checkCodeByUsername(user.getUsername(),mobileCode))){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"验证码错误");
}
AppUserLogin userLogin=new AppUserLogin();
userLogin.setId(userId);
userLogin.setIsdel(1);
userLogin.setUsername(user.getUsername()+user.getId());
appUserLoginBiz.disable(userLogin);
return ObjectRestResponse.succ();
}
/**
* 注册用户
*
......
......@@ -10,4 +10,59 @@
</if>
</select>
<select id="selectList" resultType="com.github.wxiaoqi.security.admin.vo.BaseOrderRevenueVo"
parameterType="com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO">
SELECT *,(amount-cath_amount) as withdrawAmount FROM base_order_revenue
<where>
amount > 0 and is_del = 0
<if test=" month != null and month != '' ">
and from_unixtime(upd_time/1000,'%Y-%m')=#{month}
</if>
<if test=" status != null ">
<choose>
<when test="status == 1">
and `status` in (1,3)
</when>
<when test="status == 2">
and `status` in (2,4)
</when>
<otherwise>
and `status`=#{status}
</otherwise>
</choose>
</if>
<if test=" companyId != null ">
and `company_id`=#{companyId}
</if>
</where>
order by upd_time desc
</select>
<select id="sumAmount" resultType="BigDecimal"
parameterType="com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO">
SELECT IFNULL(SUM(amount),0) as totalAmount FROM base_order_revenue
<where>
amount > 0 and is_del = 0
<if test=" month != null and month != '' ">
and from_unixtime(upd_time/1000,'%Y-%m')=#{month}
</if>
<if test=" status != null ">
<choose>
<when test="status == 1">
and `status` in (1,3)
</when>
<otherwise>
and `status`=#{status}
</otherwise>
</choose>
</if>
<if test=" companyId != null ">
and `company_id`=#{companyId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.order.mapper.CompanyWalletCathMapper">
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.CompanyWalletCathMapper">
<select id="selectList" resultType="com.xxfc.platform.order.pojo.vo.CompanyWalletCathVo" parameterType="com.xxfc.platform.order.pojo.dto.WalletCathDTO">
<select id="selectList" resultType="com.github.wxiaoqi.security.admin.vo.CompanyWalletCathVo" parameterType="com.github.wxiaoqi.security.admin.dto.WalletCathDTO">
SELECT
wc.*,
c.`name` as companyName,
......@@ -20,6 +20,9 @@
<if test="branchId != null and branchId > 0">
and c.company_id=#{branchId}
</if>
<if test="id != null and id > 0">
and wc.id=#{id}
</if>
<if test="orderNo != null and orderNo != '' ">
and wc.order_no like concat('%',#{orderNo},'%')
</if>
......@@ -56,4 +59,22 @@
order by wc.crt_time desc
</select>
<select id="sumCathAmount" resultType="com.github.wxiaoqi.security.admin.dto.WalletCathSumDto">
select IFNULL(SUM(amount),0) as sumAmount,COUNT(*) as `number` from company_wallet_cath
<where>
company_id=#{companyId} and stauts in(0,1)
<choose>
<when test="type ==1 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</when>
<when test="type==2 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m') = date_format(now(),'%Y-%m')
</when>
<otherwise>
</otherwise>
</choose>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -27,6 +27,8 @@ public interface ConfigFeign {
public static final int TYPE_BRANCH_COMPANY=111;
public static final int TYPE_COMPANY_CATH=89;
@RequestMapping(value = "/cofig/app/unauth/types",method = RequestMethod.GET)
ObjectRestResponse<List<Cofig>> getAllByType(@RequestParam("types") String types);
......
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
......@@ -34,10 +36,19 @@ public class BranchCompany {
private String name;
@ApiModelProperty("门头照")
@Column(name = "head_logo")
private String headLogo;
@Column(name = "short_name")
@ApiModelProperty("简称")
private String shortName;
@Column(name = "business_scope")
@ApiModelProperty("经营范围(逗号隔开)")
private String businessScope;
/**
* 分支机构类型
*/
......@@ -119,6 +130,18 @@ public class BranchCompany {
*/
@ApiModelProperty("负责人联系方式")
private String leaderContactInfo;
@ApiModelProperty("邀请码")
private String code;
@ApiModelProperty("邀请人id")
@Column(name = "inviter_account")
private Integer inviterAccount;
/**
* 分公司状态
*/
......@@ -172,4 +195,13 @@ public class BranchCompany {
@Column(name = "is_del")
private Integer isDel;
//浏览量
@Column(name = "browse_num")
private Integer browseNum;
//点赞数量
@Column(name = "give_num")
private Integer giveNum;
}
\ No newline at end of file
......@@ -3,12 +3,14 @@ package com.xxfc.platform.order.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Data
......@@ -27,6 +29,12 @@ public class CompanyInfo {
private String name;
@ApiModelProperty("门头照")
@Column(name = "head_logo")
private String headLogo;
@ApiModelProperty("公司类型:1-个体;2-企业")
private Integer type;
......@@ -62,6 +70,22 @@ public class CompanyInfo {
private String mobile;
@ApiModelProperty("联系人身份证")
@Column(name = "contact_number")
private String contactNumber;
@ApiModelProperty("联系人身份证正面")
@Column(name = "contact_front_url")
private String contactFrontUrl;
@ApiModelProperty("联系人身份证反面")
@Column(name = "contact_back_url")
private String contactBackUrl;
@ApiModelProperty("营业执照")
@Column(name = "business_license")
private String businessLicense;
......@@ -144,6 +168,24 @@ public class CompanyInfo {
private String registerCode;
@Column(name = "bank_account")
@ApiModelProperty("银行账号")
private String bankAccount;
@Column(name = "bank_name")
@ApiModelProperty("开户名")
private String bankName;
@Column(name = "bank")
@ApiModelProperty("开户行")
private String bank;
@Column(name = "crt_time")
private Long crtTime;
......@@ -156,4 +198,15 @@ public class CompanyInfo {
@Column(name = "is_del")
private Integer isDel;
@ApiModelProperty("公司地址-纬度")
private BigDecimal latitude;
/**
* 公司地址-经度
*/
@ApiModelProperty("公司地址-经度")
private BigDecimal longitude;
}
\ No newline at end of file
package com.xxfc.platform.order.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
......@@ -237,4 +238,7 @@ public class ShuntApply implements Serializable {
@Column(name = "is_bizdel")
private Integer isBizdel;
@Column(name = "real_amount")
private BigDecimal realAmount;
}
......@@ -266,4 +266,11 @@ public class SpecialRent implements Serializable {
@Column(name = "over_time")
@ApiModelProperty(value = "超时时间戳", hidden = true )
private Long overTime;
/**
* 超时时间戳
*/
@Column(name = "price_type")
@ApiModelProperty(value = "超时时间戳", hidden = true )
private Integer priceType;
}
......@@ -2,6 +2,8 @@ package com.xxfc.platform.order.pojo.bg;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.math.BigDecimal;
import java.util.Date;
......@@ -109,4 +111,7 @@ public class BgOrderListVo {
private Integer refundStatus;
//员工身份
private String positionName;
@Column(name = "order_sign")
private Integer orderSign;
}
......@@ -30,6 +30,10 @@ public class WalletCathDTO extends PageParam implements DataInter {
private Integer companyId;
@ApiModelProperty("提现Id")
private Integer id;
@ApiModelProperty("企业")
private Integer branchId;
......
......@@ -14,6 +14,8 @@ import java.util.List;
public class ActivityOrderBO extends OrderActiveDetail implements OrderDetail {
private BaseOrder order;
private AppUserDTO appUserDTO;
/**
* 促成人联系方式
*/
......
......@@ -48,4 +48,8 @@ public class QueryOrderDTO extends PageParam {
private Integer refundStatus;
private Integer orderSign;
private String multiOrderSign;
}
\ No newline at end of file
......@@ -41,6 +41,11 @@ public class RentVehiclePriceVO extends OrderPriceVO{
private String costDetail = "";
@ApiModelProperty(value = "价格类型:1-按天;2-按小时")
private Integer priceType;
/**
* 订单标记 1--普通订单;2--需求预定申请订单;3--特惠租车订单
*/
private Integer orderSign = 1;
// /**
// * 原租车天数
......
......@@ -650,17 +650,20 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
).map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal toExtendDeduction = oad.getOriginOrderAmount().subtract(toOdDeduction);
BigDecimal residueOrderAmount = oad.getOriginOrderAmount().subtract(toOdDeduction);
//如果订单原款 - 扣费 小于零,则押金有额外扣费
if(toExtendDeduction.compareTo(BigDecimal.ZERO) < 0) {
//置反
//置反 去用押金抵扣
toExtendDeduction = BigDecimal.ZERO.subtract(toExtendDeduction);
residueOrderAmount = BigDecimal.ZERO;
}else {
//否则 则置为零
toExtendDeduction = BigDecimal.ZERO;
}
oad.setDepositAmount(oad.getOriginDepositAmount().subtract(toDeduction).subtract(toExtendDeduction));
oad.setOrderAmount(residueOrderAmount);
}
private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) {
......@@ -703,6 +706,22 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return mapper.getOrderAccountByOrderType(term);
}
public void handleRentDepositMarginV2(BaseOrder baseOrder, OrderRentVehicleDetail orvd){
Integer crosstownTypeEnum;
//判断是否定损过
if(SYS_TRUE.equals(orvd.getFixedLossStatus())) {
crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode();
}else {
crosstownTypeEnum = CrosstownTypeEnum.ARRIVE.getCode();
}
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(baseOrder.getId());
setType(crosstownTypeEnum);
}});
handleRentDepositMargin(baseOrder, orvd, crosstown);
}
public void handleRentDepositMargin(BaseOrder baseOrder, OrderRentVehicleDetail orvd, OrderVehicleCrosstown crosstown) {
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
......
......@@ -55,6 +55,9 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
@Autowired
UserFeign userFeign;
@Autowired
OrderAccountBiz orderAccountBiz;
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
@Override
public UserFeign getUserFeign() {
......@@ -97,13 +100,14 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
if (baseOrder != null) {
baseOrder.setRefundStatus(3);
baseOrderBiz.updateSelectiveByIdRe(baseOrder);
//触发违章金退款
//orderAccountBiz.handleRentDepositMarginV2(baseOrder, orderRentVehicleDetail);
}
} else {
throw new BaseException("The operation cannot be changed at this time");
}
}
}
/**
......
package com.xxfc.platform.order.biz;
import com.xxfc.platform.order.rest.ShuntApplyController;
import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.mapper.ShuntApplyMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 调车申请
*
......@@ -15,4 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class ShuntApplyBiz extends BaseBiz<ShuntApplyMapper, ShuntApply> {
public List<ShuntApply> pageList(ShuntApplyController.QueryDTO dto){
return mapper.pageList(dto);
}
}
\ No newline at end of file
......@@ -113,6 +113,7 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
specialRent.setBrandId(vehicle.getBrandId());
specialRent.setCategoryId(vehicle.getCategoryId());
specialRent.setGoodsType(vehicle.getGoodsType());
specialRent.setPriceType(vehicle.getPriceType());
//缓存商品信息
specialRent.setGoodsJson(JSONUtil.parse(vehicle).toString());
......
......@@ -402,7 +402,7 @@ public class OrderCancelBiz {
orderRentVehicleBiz.updateSelectiveById(orvd);
}
if(BaseOrder.ORDER_SIGN_APPLY == baseOrder.getOrderOrigin()) {
if(BaseOrder.ORDER_SIGN_APPLY == baseOrder.getOrderSign()) {
//更新 申请状态
ShuntApply shuntApply = shuntApplyBiz.selectOne(new ShuntApply(){{
setOrderNo(baseOrder.getNo());
......@@ -422,7 +422,7 @@ public class OrderCancelBiz {
}
}
if(BaseOrder.ORDER_SIGN_SPECIAL == baseOrder.getOrderOrigin()) {
if(BaseOrder.ORDER_SIGN_SPECIAL == baseOrder.getOrderSign()) {
//更新 申请状态
SpecialRent specialRent = specialRentBiz.selectOne(new SpecialRent(){{
setOrderNo(baseOrder.getNo());
......
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.rest.ShuntApplyController;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 调车申请
*
......@@ -11,5 +14,6 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2020-09-09 14:49:51
*/
public interface ShuntApplyMapper extends Mapper<ShuntApply> {
public List<ShuntApply> pageList(ShuntApplyController.QueryDTO dto);
}
......@@ -20,7 +20,6 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.biz.inner.OrderCancelBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.*;
......@@ -59,7 +58,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Controller
......@@ -432,6 +430,8 @@ public class BaseOrderController extends CommonBaseController implements UserRes
Integer bizType;
private String multiOrderSign;
}
@RequestMapping(value = "/app/unauth/refund/{no}/{refundAmount}", method = RequestMethod.POST)
......@@ -469,19 +469,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes
setOrderId(baseOrder.getId());
}});
Integer crosstownTypeEnum;
//判断是否定损过
if(SYS_TRUE.equals(orvd.getFixedLossStatus())) {
crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode();
}else {
crosstownTypeEnum = CrosstownTypeEnum.ARRIVE.getCode();
}
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(baseOrder.getId());
setType(crosstownTypeEnum);
}});
orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown);
orderAccountBiz.handleRentDepositMarginV2(baseOrder, orvd);
return ObjectRestResponse.succ();
}
......
......@@ -61,6 +61,7 @@ public class OrderViolationController extends BaseController<OrderViolationBiz,
return ObjectRestResponse.succ();
}
/**
* 通过订单id查询违章记录
*
......
......@@ -170,11 +170,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
}
dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID()));
Query query = new Query(dto);
PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> {
w.andEqualTo(ShuntApply::getUserId, dto.getUserId());
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
return w;
}, " crt_time desc "), ShuntApplyVO.class);
PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.pageList(dto), ShuntApplyVO.class);
pages.getData().forEach(data -> {
data.setAppUserDTO(userFeign.userDetailById(data.getUserId()).getData());
});
......@@ -182,6 +178,22 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
return ObjectRestResponse.succ(pages);
}
@RequestMapping(value = "/toOrderPayCount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "待下单、待支付数量")
public ObjectRestResponse<Integer> toPayCount() {
//查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
QueryDTO dto = new QueryDTO();
dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID()));
dto.setPageStatus(QueryDTO.PAGE_STATUS_TOORDERPAY);
Query query = new Query(dto);
return ObjectRestResponse.succ(baseBiz.pageList(dto).size());
}
@RequestMapping(value = "/applyOrder", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "申请调车下单")
......@@ -211,19 +223,27 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
dto.setEndCompanyId(shuntApply.getEndCompanyId());
RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto);
bo.setOrderSign(BaseOrder.ORDER_SIGN_APPLY);
bo.setBookRecordId(shuntApply.getBookRecordId());
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
orderRentVehicleService.applyCreateOrder(bo, shuntApply.getOrderNo());
baseBiz.updateSelectiveById(new ShuntApply(){{
setId(shuntApply.getId());
setStatus(ShuntApply.STATUS_ORDER);
setOrderStatus(ShuntApply.ORDER_STATUS_TOPAY);
setRealAmount(bo.getOrder().getRealAmount());
}});
return ObjectRestResponse.succ(bo.getOrder());
}
@Data
public static class QueryDTO extends PageParam {
public static final int PAGE_STATUS_ING = 1;
public static final int PAGE_STATUS_TOORDERPAY = 2;
public static final int PAGE_STATUS_PAYED = 3;
public static final int PAGE_STATUS_CNL = 4;
Integer userId;
Integer pageStatus;
}
@Data
......@@ -310,7 +330,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
ShuntApply shuntApply = baseBiz.selectById(dto.getApplyId());
if(null == shuntApply || shuntApply.getStatus() != STATUS_CRT) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE,Sets.newSet("该需求已失效"));
throw new BaseException("该需求已失效", ResultCode.PARAM_ILLEGAL_CODE);
}
RentVehicleBO detail = new RentVehicleBO();
......@@ -335,7 +355,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
orderRentVehicleService.acquireVehicle(detail, null , null);
}catch (Exception e) {
getLog().error(e.getMessage(), e);
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE,Sets.newSet("无法选择该车辆"));
throw new BaseException("无法选择该车辆", ResultCode.PARAM_ILLEGAL_CODE);
}
shuntApply.setVehicleId(dto.getVehicleId());
......
......@@ -110,14 +110,12 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
}
@RequestMapping(value = "/app/pageList", method = RequestMethod.GET)
@RequestMapping(value = "/app/unauth/app/pageList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分页查询可参加特惠租车")
@IgnoreUserToken
public ObjectRestResponse<SpecialRentVO> pageList(QueryDTO dto) {
//查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
Query query = new Query(dto);
PageDataVO<SpecialRentVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> {
w.andIn(SpecialRent::getStatus, CollUtil.newArrayList(STATUS_CRT, STATUS_AUTOCNL_ORDER, STATUS_AUTOCNL_TOPAY, STATUS_AUTOCNL_PAYED));
......@@ -193,6 +191,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto);
bo.setOrderSign(BaseOrder.ORDER_SIGN_SPECIAL);
bo.setAppUserDTO(getAppUser());
bo.setBookRecordId(specialRent.getBookRecordId());
orderRentVehicleService.specialCreateOrder(bo, specialRent.getOrderNo());
baseBiz.updateSelectiveById(new SpecialRent(){{
setId(specialRent.getId());
......
......@@ -567,6 +567,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//生成订单明细
RentVehiclePriceVO rvp = new RentVehiclePriceVO();
rvp.setOrderSign(detail.getOrderSign());
rvp.setDeposit(depositAmount);
rvp.setDriverPrice(DRIVER_PRICE);
rvp.setDamageSafePrice(DAMAGE_SAFE);
......@@ -758,6 +759,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//生成订单明细
RentVehiclePriceVO rvp = new RentVehiclePriceVO();
rvp.setOrderSign(detail.getOrderSign());
rvp.setDeposit(depositAmount);
rvp.setDriverPrice(DRIVER_PRICE);
rvp.setDamageSafePrice(DAMAGE_SAFE);
......
......@@ -62,6 +62,17 @@
select *
from base_order
<where>
<if test="multiOrderSign != null">
and
(
<foreach collection="multiOrderSign.split(',')" index="sIndex" item="signEntity" separator=" or ">
order_sign = #{signEntity}
</foreach>
)
</if>
<if test="orderSign != null">
and order_sign = #{orderSign}
</if>
<if test="crtUser != null">
and crt_user = #{crtUser}
</if>
......@@ -222,6 +233,9 @@
AND b.status = -1
and b.refund_status in (0,2)
</if>
<if test="refundStatus != null">
and b.refund_status = #{refundStatus}
</if>
<if test="status != null and status != -1">
and b.status = #{status}
</if>
......@@ -257,6 +271,14 @@
<select id="getAllOrderList" parameterType="Map" resultType="com.xxfc.platform.order.pojo.bg.BgOrderListVo">
SELECT * from order_list_info
<where>
<if test="multiOrderSign != null">
and
(
<foreach collection="multiOrderSign.split(',')" index="sIndex" item="signEntity" separator=" or ">
order_sign = #{signEntity}
</foreach>
)
</if>
<if test="userIds != null and userIds.size() > 0">
and userId in
<foreach collection="userIds" item="item" open="(" separator="," close=")">
......
......@@ -24,4 +24,32 @@
<result property="endCompanyName" column="end_company_name"/>
</resultMap>
<select id="pageList" resultType="com.xxfc.platform.order.entity.ShuntApply">
select *
from shunt_apply
<where>
is_del = 0
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="pageStatus != null">
<if test="pageStatus == 1">
and status = 1
</if>
<if test="pageStatus == 2">
and ((status = 4 and order_status = 1) or status = 3)
</if>
<if test="pageStatus == 3">
and status = 4 and order_status = 2
</if>
<if test="pageStatus == 4">
and status in (2, 501, 502, 503, 504)
</if>
</if>
</where>
order by crt_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -73,7 +73,14 @@ public class SmsTemplateDTO {
public static final int PAY_J= 27;
//小程序密码通知
public static final int PWD= 28;
//商家审核(通过)
public static final int COMPANY_S= 29;
//商家审核(不通过)
public static final int COMPANY_F= 30;
//商品审核(通过)
public static final int GOODS_S= 31;
//商品审核(不通过)
public static final int GOODS_F= 32;
//类型:1-租车订单通知(普通用户),2-租车订单短信(会员权益),3-旅游订单短信,4-加入会员通知
......
......@@ -81,9 +81,16 @@ public class AliYunSmsBiz {
public static final String TEMPLATE_ID_PAY_I= "SMS_205435086";
//旅游(上车通知)27
public static final String TEMPLATE_ID_PAY_J= "SMS_173345606";
//旅游(上车通知)27
//旅游(上车通知)28
public static final String PWD= "SMS_174990497";
//商家审核(通过)29
public static final String COMPANY_SUCESS= "SMS_205439814";
//商家审核(不通过)30
public static final String COMPANY_FAIL= "SMS_205449712";
//商品审核(通过)31
public static final String GOODS_SUCESS= "SMS_205439817";
//商品审核(不通过)32
public static final String GOODS_FAIL= "SMS_205439818";
......@@ -172,6 +179,18 @@ public class AliYunSmsBiz {
case 28 :
SmsService.sendTemplateToJson(phoneNumbers,params,PWD);
break;
case 29 :
SmsService.sendTemplateToJson(phoneNumbers,params,COMPANY_SUCESS);
break;
case 30 :
SmsService.sendTemplateToJson(phoneNumbers,params,COMPANY_FAIL);
break;
case 31 :
SmsService.sendTemplateToJson(phoneNumbers,params,GOODS_SUCESS);
break;
case 32 :
SmsService.sendTemplateToJson(phoneNumbers,params,GOODS_FAIL);
break;
}
......
package com.xxfc.platform.vehicle.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
......@@ -34,6 +36,11 @@ public class BranchCompany {
private String name;
@ApiModelProperty("门头照")
@Column(name = "head_logo")
private String headLogo;
@Column(name = "short_name")
@ApiModelProperty("简称")
private String shortName;
......@@ -42,7 +49,6 @@ public class BranchCompany {
@Column(name = "business_scope")
@ApiModelProperty("经营范围(逗号隔开)")
private String businessScope;
/**
* 分支机构类型
*/
......@@ -124,6 +130,18 @@ public class BranchCompany {
*/
@ApiModelProperty("负责人联系方式")
private String leaderContactInfo;
@ApiModelProperty("邀请码")
private String code;
@ApiModelProperty("邀请人id")
@Column(name = "inviter_account")
private Integer inviterAccount;
/**
* 分公司状态
*/
......@@ -177,7 +195,6 @@ public class BranchCompany {
@Column(name = "is_del")
private Integer isDel;
//浏览量
@Column(name = "browse_num")
private Integer browseNum;
......@@ -186,4 +203,5 @@ public class BranchCompany {
@Column(name = "give_num")
private Integer giveNum;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Table(name = "company_info")
......@@ -16,22 +22,45 @@ public class CompanyInfo {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("app用户id")
@Column(name = "app_user_id")
private Integer appUserId;
@ApiModelProperty("公司名称")
private String name;
@ApiModelProperty("门头照")
@Column(name = "head_logo")
private String headLogo;
@ApiModelProperty("公司类型:1-个体;2-企业")
private Integer type;
@ApiModelProperty("法人姓名")
@Column(name = "legal_person")
private String legalPerson;
@ApiModelProperty("公司名称")
@ApiModelProperty("法人身份证")
@Column(name = "legal_id_number")
private String legalIdNumber;
@ApiModelProperty("身份证正面")
@Column(name = "front_url")
private String frontUrl;
@ApiModelProperty("法人身份证反面")
@Column(name = "back_url")
private String backUrl;
@ApiModelProperty("联系人")
private String contact;
......@@ -42,11 +71,122 @@ public class CompanyInfo {
private String mobile;
@ApiModelProperty("联系人身份证")
@Column(name = "contact_number")
private String contactNumber;
@ApiModelProperty("联系人身份证正面")
@Column(name = "contact_front_url")
private String contactFrontUrl;
@ApiModelProperty("联系人身份证反面")
@Column(name = "contact_back_url")
private String contactBackUrl;
@ApiModelProperty("营业执照")
@Column(name = "business_license")
private String businessLicense;
@ApiModelProperty("合同s,逗号隔开")
@Column(name = "contract_imgs")
private String contractImgs;
/**
* 地址-省/直辖市(编码)
*/
@Column(name = "addr_province")
@ApiModelProperty("地址-省/直辖市(编码)")
private Integer addrProvince;
/**
* 地址-省/直辖市(编码)名称
*/
@Column(name = "province_name")
@ApiModelProperty("地址-省/直辖市(编码)名称")
private String provinceName;
/**
* 地址-市(编码)
*/
@Column(name = "addr_city")
@ApiModelProperty("地址-市(编码)")
private Integer addrCity;
/**
* 地址-市(编码)名称
*/
@Column(name = "city_name")
@ApiModelProperty("地址-市(编码名称")
private String cityName;
/**
* 地址-镇/县(编码)
*/
@Column(name = "addr_town")
@ApiModelProperty("地址-镇/县(编码)")
private Integer addrTown;
/**
* 地址-县名称
*/
@Column(name = "town_name")
@ApiModelProperty("县名称")
private String townName;
/**
* 详细地址
*/
@Column(name = "addr_detail")
@ApiModelProperty("详细地址")
private String addrDetail;
@ApiModelProperty("成立日期")
@Column(name = "open_date")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyyMMdd",timezone="GMT+8")
private Date openDate;
@ApiModelProperty("营业执照有效期")
@Column(name = "license_date")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyyMMdd",timezone="GMT+8")
private Date licenseDate;
@Column(name = "register_code")
@ApiModelProperty("统一社会信用代码/注册号")
private String registerCode;
@Column(name = "bank_account")
@ApiModelProperty("银行账号")
private String bankAccount;
@Column(name = "bank_name")
@ApiModelProperty("开户名")
private String bankName;
@Column(name = "bank")
@ApiModelProperty("开户行")
private String bank;
@Column(name = "crt_time")
private Long crtTime;
......@@ -59,4 +199,15 @@ public class CompanyInfo {
@Column(name = "is_del")
private Integer isDel;
@ApiModelProperty("公司地址-纬度")
private BigDecimal latitude;
/**
* 公司地址-经度
*/
@ApiModelProperty("公司地址-经度")
private BigDecimal longitude;
}
\ No newline at end of file
......@@ -10,4 +10,6 @@ public class CompanySearchVO extends BranchCompany {
BigDecimal distance;
String companyName;
Integer appUserId;
}
......@@ -4,15 +4,22 @@ package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.BeanUtils;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleApply;
import com.xxfc.platform.vehicle.mapper.VehicleApplyMapper;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleApplyFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleApplyVo;
import lombok.extern.slf4j.Slf4j;
......@@ -21,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
......@@ -36,6 +44,15 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{
@Autowired
VehicleExtensionBiz extensionBiz;
@Autowired
ThirdFeign thirdFeign;
@Autowired
UserFeign userFeign;
@Autowired
BranchCompanyBiz branchCompanyBiz;
......@@ -45,10 +62,10 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{
throw new BaseException("参数不能为空",ResultCode.FAILED_CODE);
}
String vehicleId=StringUtils.isBlank(vehicle.getId()) ? "" : vehicle.getId();
/* List<Vehicle> list=vehicleBiz.getListByExample(vehicleId,vehicle.getName());
List<Vehicle> list=vehicleBiz.getListByExample(vehicleId,vehicle.getNumberPlate());
if (list.size() > 0){
throw new BaseException("公司名称不能重复",ResultCode.FAILED_CODE);
}*/
throw new BaseException("车牌号不能重复",ResultCode.FAILED_CODE);
}
setPriceType(vehicle);
VehicleApply vehicleApply=new VehicleApply();
BeanUtils.copyProperties(vehicle,vehicleApply);
......@@ -147,6 +164,42 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{
}
}
sendSms(vehicleApply);
}
public void sendSms(VehicleApply vehicleApply){
try {
//发送短信通知用户
vehicleApply=selectById(vehicleApply.getId());
List<String> smsParams = new ArrayList<>();
String name = StringUtils.isBlank(vehicleApply.getName()) ? "" : vehicleApply.getName();
smsParams.add(name);
Integer companyId = vehicleApply.getSubordinateBranch() == null ? 0 : vehicleApply.getSubordinateBranch();
if (companyId == 0){
return;
}
CompanySearchDTO companySearchDTO = new CompanySearchDTO();
companySearchDTO.setId(companyId);
List<CompanySearchVO> list = branchCompanyBiz.getList(companySearchDTO);
if (list.size() == 0){
return;
}
CompanySearchVO companySearchVO = list.get(0);
ObjectRestResponse<AppUserDTO> restResponse = userFeign.userDetailById(companySearchVO.getAppUserId());
if (restResponse.getData() == null){
return;
}
AppUserDTO appUserDTO = restResponse.getData();
Integer type=vehicleApply.getApplyStatus() == 1 ? SmsTemplateDTO.GOODS_S : SmsTemplateDTO.GOODS_F;
thirdFeign.sendTemplate(new SmsTemplateDTO(){{
setPhoneNumbers(appUserDTO.getUsername());
setType(type);
setParams(smsParams.toArray(new String[smsParams.size()]));
}});
}catch (Exception e){
log.error(e.getMessage(), e);
return;
}
}
......
......@@ -1605,18 +1605,18 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
public List<Vehicle> getListByExample(String vehicleId,String name){
public List<Vehicle> getListByExample(String vehicleId,String numberPlate){
Example example=new Example(Vehicle.class);
example.createCriteria().andEqualTo("name",name).andNotEqualTo("id",vehicleId);
example.createCriteria().andEqualTo("numberPlate",numberPlate).andNotEqualTo("id",vehicleId);
return selectByExample(example);
}
public String addOrUpd(VehicleApply vehicleApply){
String vehicleId=StringUtils.isBlank(vehicleApply.getVehicleId()) ? "" : vehicleApply.getVehicleId();
/* List<Vehicle> list=getListByExample(vehicleId,vehicleApply.getName());
List<Vehicle> list=getListByExample(vehicleId,vehicleApply.getNumberPlate());
if (list.size() > 0){
throw new BaseException("公司名称不能重复", ResultCode.FAILED_CODE);
}*/
throw new BaseException("车牌号不能重复", ResultCode.FAILED_CODE);
}
Vehicle vehicle= JSONUtil.toBean(vehicleApply.getChangeJson(),Vehicle.class);
if (StringUtils.isNotBlank(vehicleId)){
vehicle.setExtensionList(null);
......
......@@ -53,7 +53,7 @@
</select>
<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,i.app_user_id as appUserId
<if test="lon != null and lat != null">
, st_distance_sphere(point(#{lon}, #{lat}), point(c.longitude, c.latitude)) as distance
</if>
......
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