Commit 93b9c44d authored by jiaorz's avatar jiaorz

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

parents 7cb58ff6 678ab118
...@@ -141,12 +141,12 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -141,12 +141,12 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
if (Objects.nonNull(appUserPositionTempFindDTO.getCompanyId())) { if (Objects.nonNull(appUserPositionTempFindDTO.getCompanyId())) {
criteria.andEqualTo("companyId", appUserPositionTempFindDTO.getCompanyId()); criteria.andEqualTo("companyId", appUserPositionTempFindDTO.getCompanyId());
} }
if(Objects.nonNull(appUserPositionTempFindDTO.getStatus())) { if (Objects.nonNull(appUserPositionTempFindDTO.getStatus())) {
if (DataStatus.USERED.code == appUserPositionTempFindDTO.getStatus()) { if (DataStatus.USERED.code == appUserPositionTempFindDTO.getStatus()) {
criteria.andNotEqualTo("userId",0); criteria.andNotEqualTo("userId", 0);
} }
if (DataStatus.NO_USERED.code == appUserPositionTempFindDTO.getStatus()) { if (DataStatus.NO_USERED.code == appUserPositionTempFindDTO.getStatus()) {
criteria.andEqualTo("userId",0); criteria.andEqualTo("userId", 0);
} }
} }
example.setOrderByClause("upd_time desc"); example.setOrderByClause("upd_time desc");
...@@ -168,11 +168,11 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -168,11 +168,11 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
for (AppUserPositionTemp appUserPositionTemp : data) { for (AppUserPositionTemp appUserPositionTemp : data) {
appUserPositionTempVo = new AppUserPositionTempVo(); appUserPositionTempVo = new AppUserPositionTempVo();
BeanUtils.copyProperties(appUserPositionTemp, appUserPositionTempVo); BeanUtils.copyProperties(appUserPositionTemp, appUserPositionTempVo);
String postionName = postionMap == null ? "" : postionMap.get(appUserPositionTemp.getPositionId())==null?"":postionMap.get(appUserPositionTemp.getPositionId()).getName(); String postionName = postionMap == null ? "" : postionMap.get(appUserPositionTemp.getPositionId()) == null ? "" : postionMap.get(appUserPositionTemp.getPositionId()).getName();
String jobName = jobMap == null ? "" : jobMap.get(appUserPositionTemp.getJobId())==null?"":jobMap.get(appUserPositionTemp.getJobId()).getName(); String jobName = jobMap == null ? "" : jobMap.get(appUserPositionTemp.getJobId()) == null ? "" : jobMap.get(appUserPositionTemp.getJobId()).getName();
appUserPositionTempVo.setPositionName(postionName); appUserPositionTempVo.setPositionName(postionName);
appUserPositionTempVo.setJobName(jobName); appUserPositionTempVo.setJobName(jobName);
appUserPositionTempVo.setStatus(appUserPositionTemp.getUserId() == null ? DataStatus.NO_USERED.code : appUserPositionTemp.getUserId()==0?DataStatus.NO_USERED.code:DataStatus.USERED.code); appUserPositionTempVo.setStatus(appUserPositionTemp.getUserId() == null ? DataStatus.NO_USERED.code : appUserPositionTemp.getUserId() == 0 ? DataStatus.NO_USERED.code : DataStatus.USERED.code);
appUserPositionTempVos.add(appUserPositionTempVo); appUserPositionTempVos.add(appUserPositionTempVo);
} }
...@@ -184,8 +184,8 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -184,8 +184,8 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return dataVO; return dataVO;
} }
public Map<String,Object> importUserPostion(List<String[]> userPostionData) { public Map<String, Object> importUserPostion(List<String[]> userPostionData) {
Map<String,Object> result = new HashMap<>(2); Map<String, Object> result = new HashMap<>(2);
List<Map<String, Object>> errorResult = Lists.newArrayList(); List<Map<String, Object>> errorResult = Lists.newArrayList();
Map<String, Object> errorResultMap; Map<String, Object> errorResultMap;
...@@ -194,37 +194,37 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -194,37 +194,37 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
for (int i = 0; i < userPostionData.size(); i++) { for (int i = 0; i < userPostionData.size(); i++) {
String[] data = userPostionData.get(i); String[] data = userPostionData.get(i);
Integer postionId = null; Integer postionId = null;
String name=""; String name = "";
String phone=""; String phone = "";
String postionName=""; String postionName = "";
try { try {
name = data[0]; name = data[0];
phone = data[1]; phone = data[1];
if (StringUtils.isEmpty(phone)){ if (StringUtils.isEmpty(phone)) {
throw new BaseException("手机号为空"); throw new BaseException("手机号为空");
} }
postionName = data[2]; postionName = data[2];
if (StringUtils.isEmpty(postionName)){ if (StringUtils.isEmpty(postionName)) {
throw new BaseException("身份为空"); throw new BaseException("身份为空");
} }
if (StringUtils.isNotBlank(name)){ if (StringUtils.isNotBlank(name)) {
name.replaceAll(" ",""); name.replaceAll(" ", "");
} }
Example example = new Example(AppUserPositionTemp.class); Example example = new Example(AppUserPositionTemp.class);
example.createCriteria().andEqualTo("phone", phone).andEqualTo("isDel", 0); example.createCriteria().andEqualTo("phone", phone).andEqualTo("isDel", 0);
List<AppUserPositionTemp> list = selectByExample(example); List<AppUserPositionTemp> list = selectByExample(example);
Integer id=0; Integer id = 0;
Integer userId=0; Integer userId = 0;
if (list.size()>0){ if (list.size() > 0) {
AppUserPositionTemp appUserPositionTemp1= list.get(0); AppUserPositionTemp appUserPositionTemp1 = list.get(0);
id=appUserPositionTemp1.getId(); id = appUserPositionTemp1.getId();
userId=appUserPositionTemp1.getUserId(); userId = appUserPositionTemp1.getUserId();
} }
if (userId==null||userId==0){ if (userId == null || userId == 0) {
//根据手机号查询userId //根据手机号查询userId
AppUserLogin userLogin = loginBiz.checkeUserLogin(phone); AppUserLogin userLogin = loginBiz.checkeUserLogin(phone);
if (Objects.nonNull(userLogin)) { if (Objects.nonNull(userLogin)) {
userId=userLogin.getId(); userId = userLogin.getId();
} }
} }
for (Map.Entry<Integer, String> integerStringEntry : entrySet) { for (Map.Entry<Integer, String> integerStringEntry : entrySet) {
...@@ -233,21 +233,21 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -233,21 +233,21 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
break; break;
} }
} }
String companyName=data[3]; String companyName = data[3];
Integer companyId=0; Integer companyId = 0;
if (StringUtils.isNotBlank(companyName)){ if (StringUtils.isNotBlank(companyName)) {
BranchCompany branchCompany=vehicleFeign.companyId(companyName); BranchCompany branchCompany = vehicleFeign.companyId(companyName);
if (branchCompany!=null){ if (branchCompany != null) {
companyId=branchCompany.getId(); companyId = branchCompany.getId();
companyName=branchCompany.getName(); companyName = branchCompany.getName();
}else { } else {
companyName=null; companyName = null;
} }
} }
String jobName=data[4]; String jobName = data[4];
Integer jobId=2; Integer jobId = 2;
if (StringUtils.isNotBlank(jobName)&&jobName.contains("销售")){ if (StringUtils.isNotBlank(jobName) && jobName.contains("销售")) {
jobId=1; jobId = 1;
} }
appUserPositionTemp = new AppUserPositionTemp(); appUserPositionTemp = new AppUserPositionTemp();
appUserPositionTemp.setName(name); appUserPositionTemp.setName(name);
...@@ -256,45 +256,45 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -256,45 +256,45 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
appUserPositionTemp.setCompanyId(companyId); appUserPositionTemp.setCompanyId(companyId);
appUserPositionTemp.setCompanyName(companyName); appUserPositionTemp.setCompanyName(companyName);
appUserPositionTemp.setJobId(jobId); appUserPositionTemp.setJobId(jobId);
if (userId!=null&&userId>0) { if (userId != null && userId > 0) {
//更新用户身份信息 //更新用户身份信息
detailBiz.updateUserPositionByUserId(userId, postionId); detailBiz.updateUserPositionByUserId(userId, postionId);
appUserPositionTemp.setUserId(userId); appUserPositionTemp.setUserId(userId);
} }
if (id!=null&&id>0){ if (id != null && id > 0) {
appUserPositionTemp.setId(id); appUserPositionTemp.setId(id);
updateSelectiveById(appUserPositionTemp); updateSelectiveById(appUserPositionTemp);
}else { } else {
insertSelective(appUserPositionTemp); insertSelective(appUserPositionTemp);
} }
} catch (BaseException ex) { } catch (BaseException ex) {
errorResultMap = new HashMap<>(1); errorResultMap = new HashMap<>(1);
errorResultMap.put("num", i); errorResultMap.put("num", i);
errorResultMap.put("msg",ex.getMessage()); errorResultMap.put("msg", ex.getMessage());
errorResult.add(errorResultMap); errorResult.add(errorResultMap);
}catch (ArrayIndexOutOfBoundsException ex){ } catch (ArrayIndexOutOfBoundsException ex) {
errorResultMap = new HashMap<>(1); errorResultMap = new HashMap<>(1);
errorResultMap.put("num", i); errorResultMap.put("num", i);
String msg= ""; String msg = "";
if(StringUtils.isEmpty(phone)){ if (StringUtils.isEmpty(phone)) {
msg+="手机号码缺失"; msg += "手机号码缺失";
} }
if (StringUtils.isEmpty(postionName)){ if (StringUtils.isEmpty(postionName)) {
msg+=",身份信息缺失"; msg += ",身份信息缺失";
} }
errorResultMap.put("msg",msg); errorResultMap.put("msg", msg);
errorResult.add(errorResultMap); errorResult.add(errorResultMap);
} catch (Exception ex){ } catch (Exception ex) {
errorResultMap = new HashMap<>(1); errorResultMap = new HashMap<>(1);
errorResultMap.put("num", i); errorResultMap.put("num", i);
errorResultMap.put("msg","数据"+Arrays.toString(data)+"保存失败"); errorResultMap.put("msg", "数据" + Arrays.toString(data) + "保存失败");
errorResult.add(errorResultMap); errorResult.add(errorResultMap);
} }
} }
result.put("success",userPostionData.size()-errorResult.size()); result.put("success", userPostionData.size() - errorResult.size());
result.put("error",errorResult.size()); result.put("error", errorResult.size());
result.put("data",errorResult); result.put("data", errorResult);
return result; return result;
} }
...@@ -313,52 +313,52 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -313,52 +313,52 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
} }
public void setPostionIdByPhone(String phone){ public void setPostionIdByPhone(String phone) {
try { try {
Example example = new Example(AppUserPositionTemp.class); Example example = new Example(AppUserPositionTemp.class);
example.createCriteria().andEqualTo("phone", phone).andEqualTo("isDel", 0); example.createCriteria().andEqualTo("phone", phone).andEqualTo("isDel", 0);
List<AppUserPositionTemp> list = selectByExample(example); List<AppUserPositionTemp> list = selectByExample(example);
if (CollectionUtils.isEmpty(list)){ if (CollectionUtils.isEmpty(list)) {
log.info("----用户无身份----phone==="+phone); log.info("----用户无身份----phone===" + phone);
return; return;
} }
AppUserPositionTemp positionTemp=list.get(0); AppUserPositionTemp positionTemp = list.get(0);
if (positionTemp.getUserId()>0){ if (positionTemp.getUserId() > 0) {
log.info("----用户已存在身份----phone==="+phone); log.info("----用户已存在身份----phone===" + phone);
return; return;
} }
//根据手机号查询userId //根据手机号查询userId
AppUserLogin userLogin = loginBiz.checkeUserLogin(phone); AppUserLogin userLogin = loginBiz.checkeUserLogin(phone);
if (userLogin==null) { if (userLogin == null) {
log.info("----用户不存在----phone==="+phone); log.info("----用户不存在----phone===" + phone);
return; return;
} }
Integer userId=userLogin.getId(); Integer userId = userLogin.getId();
positionTemp.setUserId(userId); positionTemp.setUserId(userId);
int num=updateSelectiveByIdRe(positionTemp); int num = updateSelectiveByIdRe(positionTemp);
if (num>0){ if (num > 0) {
Integer postionId=positionTemp.getPositionId(); Integer postionId = positionTemp.getPositionId();
log.info("----用户---postionId===="+postionId+"----phone==="+phone); log.info("----用户---postionId====" + postionId + "----phone===" + phone);
detailBiz.updateUserPositionByUserId(userId, postionId); detailBiz.updateUserPositionByUserId(userId, postionId);
} }
}catch (Exception e){ } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
public AppUserPositionTemp getOne(Integer userId){ public AppUserPositionTemp getOne(Integer userId) {
Example example = new Example(AppUserPositionTemp.class); Example example = new Example(AppUserPositionTemp.class);
example.createCriteria().andEqualTo("userId", userId).andEqualTo("isDel", 0); example.createCriteria().andEqualTo("userId", userId).andEqualTo("isDel", 0);
List<AppUserPositionTemp> list=selectByExample(example); List<AppUserPositionTemp> list = selectByExample(example);
if (list.size()>0){ if (list.size() > 0) {
return list.get(0); return list.get(0);
} }
return null; return null;
} }
public List<Integer> getUserIdByParentCompany(List<Integer> parentCompanyId) { public List<Integer> getUserIdByParentCompany(List<Integer> parentCompanyId) {
return mapper.getUserIdByParentCompany(parentCompanyId); return mapper.getUserIdByParentCompany(parentCompanyId);
} }
/** /**
......
package com.xxfc.platform.order.bo; package com.xxfc.platform.order.bo;
import cn.hutool.json.JSONObject;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.StatisticsStatusEnum;
import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/** /**
* @author libin * @author libin
...@@ -40,6 +30,7 @@ public class FeeTypeBo implements Serializable { ...@@ -40,6 +30,7 @@ public class FeeTypeBo implements Serializable {
private BigDecimal breakRulesRegulationAmount = BigDecimal.ZERO; private BigDecimal breakRulesRegulationAmount = BigDecimal.ZERO;
private BigDecimal lossSpecifiedAmount = BigDecimal.ZERO; private BigDecimal lossSpecifiedAmount = BigDecimal.ZERO;
private BigDecimal extraAmount = BigDecimal.ZERO; private BigDecimal extraAmount = BigDecimal.ZERO;
private BigDecimal extraNoDeductibleAmount = BigDecimal.ZERO;
} }
......
...@@ -132,12 +132,14 @@ public enum StatisticsStatusEnum { ...@@ -132,12 +132,14 @@ public enum StatisticsStatusEnum {
if (orderAccountBo.getAccountType().equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) { if (orderAccountBo.getAccountType().equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
//订单押金 //订单押金
feeTypeBo.setDepositAmount(feeTypeBo.getDepositAmount().add(accountDetailEntity.getDepositAmount())); feeTypeBo.setDepositAmount(feeTypeBo.getDepositAmount().add(accountDetailEntity.getDepositAmount()));
//订单金额(不包含免赔和押金)
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().add(accountDetailEntity.getOrderAmount()));
if (hasDamageSafe) { if (hasDamageSafe) {
BigDecimal dameSafeAmount = getDameSafeAmount(orderAccountBo.getData()); BigDecimal dameSafeAmount = getDameSafeAmount(orderAccountBo.getData());
feeTypeBo.setNoDeductibleAmount(feeTypeBo.getNoDeductibleAmount().add(dameSafeAmount)); feeTypeBo.setNoDeductibleAmount(feeTypeBo.getNoDeductibleAmount().add(dameSafeAmount));
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().subtract(feeTypeBo.getNoDeductibleAmount()));
} }
//订单金额(不包含免赔和押金)
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleAmount()));
} else { } else {
//退款订单押金 //退款订单押金
feeTypeBo.setDepositRefundAmount(feeTypeBo.getDepositRefundAmount().add(accountDetailEntity.getDepositAmount())); feeTypeBo.setDepositRefundAmount(feeTypeBo.getDepositRefundAmount().add(accountDetailEntity.getDepositAmount()));
...@@ -182,6 +184,10 @@ public enum StatisticsStatusEnum { ...@@ -182,6 +184,10 @@ public enum StatisticsStatusEnum {
feeTypeBo.setExtraAmount(feeTypeBo.getExtraAmount().add(extendAmount)); feeTypeBo.setExtraAmount(feeTypeBo.getExtraAmount().add(extendAmount));
} }
} }
//其他费用-延迟用车不记免赔
if (Objects.equals(DeductionTypeEnum.OTHER_DELAY_SAFE.getCode(),deduction.getType())){
feeTypeBo.setExtraNoDeductibleAmount(feeTypeBo.getExtraNoDeductibleAmount().add(deductionAmount));
}
} }
//退款订单金额(不包含免赔和押金) //退款订单金额(不包含免赔和押金)
feeTypeBo.setOrderRefundAmount(feeTypeBo.getOrderRefundAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleRefundAmount())); feeTypeBo.setOrderRefundAmount(feeTypeBo.getOrderRefundAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleRefundAmount()));
......
...@@ -45,4 +45,6 @@ public class OrderRentVehicleReceivedStatistics extends OrderReceivedStatisticsB ...@@ -45,4 +45,6 @@ public class OrderRentVehicleReceivedStatistics extends OrderReceivedStatisticsB
@ApiModelProperty("不计免赔费用") @ApiModelProperty("不计免赔费用")
private BigDecimal noDeductibleRefundAmount; private BigDecimal noDeductibleRefundAmount;
@Column(name = "extra_no_deductible_amount")
private BigDecimal extraNoDeductibleAmount;
} }
...@@ -47,6 +47,8 @@ import java.util.*; ...@@ -47,6 +47,8 @@ import java.util.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT;
import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI; import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
...@@ -200,7 +202,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -200,7 +202,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
originType = OrderAccountDeduction.ORIGIN_ORDER; originType = OrderAccountDeduction.ORIGIN_ORDER;
}else { }else {
stringBuilder = depositRefundDescBuilder; stringBuilder = depositRefundDescBuilder;
originType = OrderAccountDeduction.ORIGIN_DEPOSIT; originType = ORIGIN_DEPOSIT;
} }
oad.getDeductions().add(initDeduction(totalDeductAmount, stringBuilder.toString(), DeductionTypeEnum.VIOLATE_CANCEL, originType)); oad.getDeductions().add(initDeduction(totalDeductAmount, stringBuilder.toString(), DeductionTypeEnum.VIOLATE_CANCEL, originType));
} }
...@@ -436,13 +438,13 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -436,13 +438,13 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv); handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv);
if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) { if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) {
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, ORIGIN_DEPOSIT)
); );
} }
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, ORIGIN_DEPOSIT)
); );
//剩余押金 = 押金 - 违章保证金 - 定损金额 //剩余押金 = 押金 - 违章保证金 - 定损金额
...@@ -618,7 +620,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -618,7 +620,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
//如果没有修改,则添加 //如果没有修改,则添加
if(Boolean.FALSE.equals(flag)) { if(Boolean.FALSE.equals(flag)) {
OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), DeductionTypeEnum.OTHER_DELAY_SAFE, OrderAccountDeduction.ORIGIN_DEPOSIT); OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), DeductionTypeEnum.OTHER_DELAY_SAFE, ORIGIN_DEPOSIT);
oad.getDeductions().add(oadNew); oad.getDeductions().add(oadNew);
//修改归还押金金额 //修改归还押金金额
resetDeposit(oad); resetDeposit(oad);
...@@ -634,8 +636,29 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -634,8 +636,29 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
private void resetDeposit(OrderAccountDetail oad) { private void resetDeposit(OrderAccountDetail oad) {
//修改归还押金金额 //修改归还押金金额
BigDecimal toDeduction = oad.getDeductions().parallelStream().map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
oad.setDepositAmount(oad.getOriginDepositAmount().subtract(toDeduction)); //扣费(押金源)
BigDecimal toDeduction = oad.getDeductions().parallelStream().filter(oadTemp ->
(Integer.valueOf(ORIGIN_DEPOSIT).equals(oadTemp.getOrigin()))
).map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//扣费(订单_押金源)
BigDecimal toOdDeduction = oad.getDeductions().parallelStream().filter(oadTemp ->
(Integer.valueOf(ORIGIN_ORDER_DEPOSIT).equals(oadTemp.getOrigin()))
).map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal toExtendDeduction = oad.getOriginOrderAmount().subtract(toOdDeduction);
//如果订单原款 - 扣费 小于零,则押金有额外扣费
if(toExtendDeduction.compareTo(BigDecimal.ZERO) < 0) {
//置反
toExtendDeduction = BigDecimal.ZERO.subtract(toExtendDeduction);
}else {
//否则 则置为零
toExtendDeduction = BigDecimal.ZERO;
}
oad.setDepositAmount(oad.getOriginDepositAmount().subtract(toDeduction).subtract(toExtendDeduction));
} }
private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) { private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) {
...@@ -658,7 +681,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -658,7 +681,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
//如果没有修改,则添加 //如果没有修改,则添加
if(Boolean.FALSE.equals(flag)) { if(Boolean.FALSE.equals(flag)) {
OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), dte, OrderAccountDeduction.ORIGIN_DEPOSIT); OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), dte, ORIGIN_DEPOSIT);
oad.getDeductions().add(oadNew); oad.getDeductions().add(oadNew);
//修改归还押金金额 //修改归还押金金额
resetDeposit(oad); resetDeposit(oad);
...@@ -692,7 +715,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -692,7 +715,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != orderViolation) { if(null != orderViolation) {
//设置扣款项 //设置扣款项
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, ORIGIN_DEPOSIT)
); );
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
......
...@@ -17,6 +17,17 @@ ...@@ -17,6 +17,17 @@
<result property="payWay" column="pay_way"/> <result property="payWay" column="pay_way"/>
<result property="companyId" column="company_id"/> <result property="companyId" column="company_id"/>
<result property="crtTime" column="crt_time"/> <result property="crtTime" column="crt_time"/>
<result property="extraNoDeductibleAmount" column="extral_no_deductible_amount"/>
<result property="orderRefundAmount" column="order_refund_amount"/>
<result property="lateFeeAmount" column="late_fee_amount"/>
<result property="extraAmount" column="extra_amount"/>
<result property="companyName" column="company_name"/>
<result property="noDeductibleAmount" column="no_deductible_amount"/>
<result property="noDeductibleRefundAmount" column="no_deductible_refund_amount"/>
<result property="lossSpecifiedAmount" column="loss_specified_amount"/>
<result property="depositRefundAmount" column="deposit_refund_amount"/>
<result property="depositAmount" column="deposit_amount"/>
<result property="breakRulesRegulationAmount" column="break_rules_regulation_amount"/>
</resultMap> </resultMap>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
......
...@@ -97,7 +97,7 @@ public class ServiceTest { ...@@ -97,7 +97,7 @@ public class ServiceTest {
@Test @Test
public void testMemberStatistics(){ public void testMemberStatistics(){
Date date = DateTime.parse("2019-11-28").toDate(); Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate(); Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate(); Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -106,7 +106,7 @@ public class ServiceTest { ...@@ -106,7 +106,7 @@ public class ServiceTest {
@Test @Test
public void testRentVehicleStatistics(){ public void testRentVehicleStatistics(){
Date date = DateTime.parse("2019-11-29").toDate(); Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate(); Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate(); Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -127,13 +127,13 @@ public class ServiceTest { ...@@ -127,13 +127,13 @@ public class ServiceTest {
public void testOrderReceivedStatisticsJobHandler(){ public void testOrderReceivedStatisticsJobHandler(){
cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd"); cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd");
// cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1); // cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
// orderReceivedStatisticsJobHandler.execute("2019-10-08"); orderReceivedStatisticsJobHandler.execute("2019-11-15");
LocalDate startLocalDate = LocalDate.of(2019, 10, 01); /* LocalDate startLocalDate = LocalDate.of(2019, 10, 01);
LocalDate endLocalDate = LocalDate.of(2019,12,20); LocalDate endLocalDate = LocalDate.of(2019,12,19);
while (startLocalDate.isBefore(endLocalDate)){ while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1); startLocalDate = startLocalDate.plusDays(1);
orderReceivedStatisticsJobHandler.execute(dateStr); orderReceivedStatisticsJobHandler.execute(dateStr);
} }*/
} }
} }
...@@ -71,7 +71,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> { ...@@ -71,7 +71,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
String refundDesc = StringUtils.isNotBlank(orderRefundVo.getRefundDesc()) ? orderRefundVo.getRefundDesc() : "审核通过,退款"; String refundDesc = StringUtils.isNotBlank(orderRefundVo.getRefundDesc()) ? orderRefundVo.getRefundDesc() : "审核通过,退款";
String out_refund_no = Snowflake.build() + ""; String out_refund_no = Snowflake.build() + "";
if (StringUtils.isBlank(order_no) || StringUtils.isBlank(appid) || StringUtils.isBlank(mchId) || StringUtils.isBlank(partnerKey) if (StringUtils.isBlank(order_no) || StringUtils.isBlank(appid) || StringUtils.isBlank(mchId) || StringUtils.isBlank(partnerKey)
|| payAmount == null || payAmount == 0 || refundAmount == null || refundAmount == 0) { || payAmount == null || payAmount == 0 || (refundAmount == null && orderRefundVo.getFreeze2PayAmount() == null) || (refundAmount == 0 && orderRefundVo.getFreeze2PayAmount() == 0)) {
log.error("-----参数为空-----------"); log.error("-----参数为空-----------");
return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空"); return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空");
} }
......
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