Commit a01a4299 authored by jiaorz's avatar jiaorz

Merge branch 'master-modify-cutAmount' into dev

parents b8e4f7b0 df999680
......@@ -15,6 +15,7 @@ public enum OrderCostEnum {
* 编码
*/
private String code;
/**
* 类型描述
*/
......
package com.xxfc.platform.order.entity;
import com.github.wxiaoqi.security.common.util.JsonUtil;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -327,4 +329,8 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "费用其他明细 type:1--取消违约金;2--取消费用明细;3--提前还车费用明细;4--延期还车费用明细")
private String costDetailExtend;
public void handelCostDetailExtend(CostDetailExtend costDetailExtend) {
this.costDetailExtend = JsonUtil.objectToJson(((CostDetailExtend)costDetailExtend));
}
}
package com.xxfc.platform.order.entity;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.util.JsonUtil;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import com.xxfc.platform.tour.entity.TourUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -251,4 +253,8 @@ public class OrderTourDetail implements Serializable {
@Transient
private List<TourUser> userVoList;
public void handelCostDetailExtend(CostDetailExtend costDetailExtend) {
this.costDetailExtend = JsonUtil.objectToJson(((CostDetailExtend)costDetailExtend));
}
}
......@@ -11,19 +11,19 @@ public class OrderAccountDetail {
/**
* 实际返回订单款 账单的的orderAmount 对应的是 订单的商品金额
*/
BigDecimal orderAmount;
BigDecimal orderAmount = BigDecimal.ZERO;
/**
* 实际返回押金款
*/
BigDecimal depositAmount;
BigDecimal depositAmount = BigDecimal.ZERO;
/**
* 原来要返回的订单款 账单的的orderAmount 对应的是 订单的商品金额
*/
BigDecimal originOrderAmount;
BigDecimal originOrderAmount = BigDecimal.ZERO;
/**
* 原来要返回的押金款
*/
BigDecimal originDepositAmount;
BigDecimal originDepositAmount = BigDecimal.ZERO;
/**
* 扣款列表
......
......@@ -9,32 +9,32 @@ public class CancelStartedVO extends CostDetailExtend {
/**
* 消费金额(实际计费)
*/
private BigDecimal consumeAmount;
private BigDecimal consumeAmount = BigDecimal.ZERO;
/**
* 租车单价
*/
private BigDecimal modelAmount;
private BigDecimal modelAmount = BigDecimal.ZERO;
/**
* 使用天数
*/
private Integer usedDayNum;
private Integer usedDayNum = 0;
/**
* 使用金额
*/
private BigDecimal usedAmount;
private BigDecimal usedAmount = BigDecimal.ZERO;
/**
* 使用免费天数
*/
private Integer usedfreeDayNum;
private Integer usedfreeDayNum = 0;
/**
* 使用免费金额
*/
private BigDecimal usedFreeAmount;
private BigDecimal usedFreeAmount = BigDecimal.ZERO;
/**
* 违约金描述
......@@ -44,5 +44,20 @@ public class CancelStartedVO extends CostDetailExtend {
/**
* 违约金金额
*/
private BigDecimal violateAmount;
private BigDecimal violateAmount = BigDecimal.ZERO;
/**
* 优惠金额
*/
private BigDecimal couponAmount = BigDecimal.ZERO;
/**
* 优惠描述
*/
private String couponDesc;
/**
* 原订单是否包含优惠券
*/
private Boolean hadConpon = Boolean.FALSE;
}
......@@ -188,7 +188,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
refundGoodsAmount = new BigDecimal((IntervalUtil.evaluate(dic.getDetail(), new MapContext(){{
//ga : goodsAmount
set("ga", goodsAmount);
}})).toString());
}})+ "").toString());
refundDescBuilder = refundDescBuilder.insert(0, names[1]+ ",");
if(goodsAmount.subtract(refundGoodsAmount).compareTo(BigDecimal.ZERO) > 0) {
orderAccountDetail.getDeductions().add(initDeduction(goodsAmount.subtract(refundGoodsAmount), names[1], DeductionTypeEnum.VIOLATE_CANCEL, OrderAccountDeduction.ORIGIN_DEPOSIT));
......
......@@ -14,6 +14,7 @@ import com.xxfc.platform.order.pojo.price.CancelStartedVO;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
......@@ -69,24 +70,51 @@ public class OrderTemplateBiz extends BaseBiz<OrderTemplateMapper,OrderTemplate>
}});
}
/**
* 计算费用明细
* @param vo
* @return
*/
public void handleCostDetailExtend(CancelNoStartVO vo) {
public <T extends CostDetailExtend> void handleCostDetailExtend(T costDetailExtend) {
switch (costDetailExtend.getType()) {
case CostDetailExtend.CANCEL_NO_START :
break;
case CostDetailExtend.CANCEL_STARTED :
OrderTemplate template = selectByCode(OrderCostEnum.RENT_VEHICLE.getCode());
template.setTemplate(result(template.getTemplate(), new HashMap(){{
put("children", handleChildren(costDetailExtend));
put("consumeAmount", ((CancelStartedVO)costDetailExtend).getConsumeAmount());
}}));
break;
case CostDetailExtend.FINLISH_ADVANCE :
break;
case CostDetailExtend.FINLISH_DELAY :
break;
default:
break;
}
OrderTemplate template = selectByCode(OrderCostEnum.CANCEL_NO_START.getCode());
vo.setCostDetail(result(template.getTemplate(), Dict.parse(vo)));
costDetailExtend.setCostDetail(result(template.getTemplate(), Dict.parse(costDetailExtend)));
}
/**
* 取消费用明细
* @param vo
* @return
*/
public void handleCostDetailExtend(CancelStartedVO vo) {
OrderTemplate template = selectByCode(OrderCostEnum.CANCEL_STARTED.getCode());
vo.setCostDetail(result(template.getTemplate(), Dict.parse(vo)));
public <T extends CostDetailExtend> String handleChildren(T costDetailExtend) {
StringBuffer childrenStr = new StringBuffer("");
if(costDetailExtend instanceof CancelStartedVO) {
CancelStartedVO cancelStartedVO = (CancelStartedVO)costDetailExtend;
childrenStr.append(",${tem_0401}");
if(cancelStartedVO.getUsedfreeDayNum() > 0 ) {
childrenStr.append(",${tem_0402}");
}
if(cancelStartedVO.getHadConpon()) {
if(cancelStartedVO.getCouponAmount().compareTo(BigDecimal.ZERO) > 0) {
childrenStr.append(",${tem_0901}");
}else {
childrenStr.append(",${tem_0902}");
}
}
if(cancelStartedVO.getViolateAmount().compareTo(BigDecimal.ZERO) > 0) {
childrenStr.append(",${tem_0903}");
}
}
if(childrenStr.length() > 0){
childrenStr.deleteCharAt(0);
}
return childrenStr.toString();
}
public static void main(String[] args) {
......
......@@ -175,7 +175,7 @@ public class OrderCancelBiz {
}
}
orderTemplateBiz.handleCostDetailExtend(csv);
orvd.setCostDetailExtend(csv.getCostDetail());
orvd.handelCostDetailExtend(csv);
orderRentVehicleBiz.updateSelectiveByIdRe(orvd);
}else {
//没到出车时间
......@@ -190,7 +190,7 @@ public class OrderCancelBiz {
}
}
//退款流程
orderAccountBiz.rentRefundProcessCancel(hasUpdateOrder, orderItem.getRealAmount(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), freeDayAmount, null);
orderAccountBiz.rentRefundProcessCancel(hasUpdateOrder, orderItem.getRealAmount(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), freeDayAmount, oad);
//如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) {
......@@ -201,7 +201,7 @@ public class OrderCancelBiz {
setViolateDesc(deduction.getName());
}};
orderTemplateBiz.handleCostDetailExtend(cnsv);
orvd.setCostDetailExtend(cnsv.getCostDetail());
orvd.handelCostDetailExtend(cnsv);
orderRentVehicleBiz.updateSelectiveByIdRe(orvd);
}
}
......
......@@ -14,7 +14,6 @@ import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundStatusEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.entity.Dictionary;
......@@ -231,15 +230,15 @@ public class OrderMsgBiz {
//后台发送消息(客服)
Cofig cofig = configFeign.getAllByType(ConfigFeign.TYPE_CUS_SER+ "").getData().get(0);
smsParams.clear();
sms2BgUser(cofig.getValue(), startCompanyDetail, endCompanyDetail, orvd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_C, smsParams);
sms2BgUser(cofig.getValue(), startCompanyDetail, endCompanyDetail, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_C, smsParams);
//后台发送消息(出车人)
smsParams.clear();
sms2BgUser(startCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_D, smsParams);
sms2BgUser(startCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_D, smsParams);
//后台发送消息(收车人)
smsParams.clear();
sms2BgUser(endCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_E, smsParams);
sms2BgUser(endCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_E, smsParams);
}else {
log.error("通知短信异常,开始公司id 不存在或者为0 订单号:{}", baseOrder.getId());
......@@ -253,7 +252,7 @@ public class OrderMsgBiz {
//后台发送消息(客服)
Cofig cofig = configFeign.getAllByType(ConfigFeign.TYPE_CUS_SER+ "").getData().get(0);
smsParams.clear();
sms2BgUser(cofig.getValue(), startCompanyDetailTour, null, orvd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_H, smsParams);
sms2BgUser(cofig.getValue(), startCompanyDetailTour, null, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_H, smsParams);
break;
case MEMBER:
......@@ -297,6 +296,9 @@ public class OrderMsgBiz {
}else {
smstype = SmsTemplateDTO.CANCEL_A;
}
//发送用户取消消息
sms2AppUser(startCompanyDetail, endCompanyDetail, orvd, otd, omd, baseOrder, appUserDTO, smstype, smsParams);
}else {
//使用免费天数
if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
......@@ -304,18 +306,17 @@ public class OrderMsgBiz {
}else {
smstype = SmsTemplateDTO.CANCEL_C;
}
//发送用户退款消息
smsParams.clear();
sms2RefundAppUser(BigDecimal.ZERO, orderAccount.getDeductAmount(), orderAccount.getAccountAmount(), BigDecimal.ZERO, baseOrder, appUserDTO, smstype, smsParams);
}
//发送用户取消消息
sms2AppUser(startCompanyDetail, endCompanyDetail, orvd, otd, omd, baseOrder, appUserDTO, smstype, smsParams);
//发送用户退款消息
smsParams.clear();
sms2RefundAppUser(BigDecimal.ZERO, orderAccount.getDeductAmount(), orderAccount.getAccountAmount(), BigDecimal.ZERO, baseOrder, appUserDTO, smstype, smsParams);
//后台发送消息(出车人)
smsParams.clear();
sms2BgUser(startCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, baseOrder, appUserDTO, SmsTemplateDTO.CANCEL_E, smsParams);
sms2BgUser(startCompanyDetail.getVehiceServicePhone(), startCompanyDetail, endCompanyDetail, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.CANCEL_E, smsParams);
}else {
log.error("通知后台客户短信异常,结束公司id 不存在或者为0 订单号:{}", baseOrder.getId());
}
......@@ -326,7 +327,7 @@ public class OrderMsgBiz {
//后台发送消息(客服)
Cofig cofig = configFeign.getAllByType(ConfigFeign.TYPE_CUS_SER+ "").getData().get(0);
smsParams.clear();
sms2BgUser(cofig.getValue(), startCompanyDetailTour, null, orvd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_C, smsParams);
sms2BgUser(cofig.getValue(), startCompanyDetailTour, null, orvd, otd, baseOrder, appUserDTO, SmsTemplateDTO.PAY_C, smsParams);
break;
case MEMBER:
break;
......@@ -441,8 +442,8 @@ public class OrderMsgBiz {
}
private void sms2BgUser(String phone,BranchCompany sCompany, BranchCompany eCompany, OrderRentVehicleDetail orvd, BaseOrder baseOrder, AppUserDTO appUserDTO, Integer smstype, List<String> smsParams) {
handelSmsParamBg(sCompany, eCompany, orvd, baseOrder, smsParams, appUserDTO, smstype);
private void sms2BgUser(String phone,BranchCompany sCompany, BranchCompany eCompany, OrderRentVehicleDetail orvd, OrderTourDetail otd, BaseOrder baseOrder, AppUserDTO appUserDTO, Integer smstype, List<String> smsParams) {
handelSmsParamBg(sCompany, eCompany, orvd, otd, baseOrder, smsParams, appUserDTO, smstype);
SmsTemplateDTO smsTemplateDTO = new SmsTemplateDTO(){{
setPhoneNumbers(phone);
setType(smstype);
......@@ -509,6 +510,13 @@ public class OrderMsgBiz {
smsParams.add(USER_N+ appUserDTO.getRealname());
}
break;
case SmsTemplateDTO.CANCEL_B :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
}
break;
case SmsTemplateDTO.PAY_I :
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
......@@ -578,7 +586,7 @@ public class OrderMsgBiz {
}
}
private void handelSmsParamBg(BranchCompany sCompany, BranchCompany eCompany, OrderRentVehicleDetail orvd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int paramHandelType) {
private void handelSmsParamBg(BranchCompany sCompany, BranchCompany eCompany, OrderRentVehicleDetail orvd, OrderTourDetail otd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int paramHandelType) {
if(null == eCompany) {
eCompany = new BranchCompany();
eCompany.setName("");
......@@ -630,7 +638,7 @@ public class OrderMsgBiz {
smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName());
smsParams.add(sCompany.getTourServicePhone());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(otd.getStartTime())));
break;
case SmsTemplateDTO.CANCEL_F :
smsParams.add(appUserDTO.getRealname());
......@@ -638,7 +646,7 @@ public class OrderMsgBiz {
smsParams.add(baseOrder.getName());
smsParams.add(sCompany.getName());
smsParams.add(sCompany.getTourServicePhone());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(otd.getStartTime())));
break;
default:
break;
......
......@@ -411,7 +411,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
* @return
*/
private void costDetail(RentVehiclePriceVO vo, String children) {
OrderTemplate template = orderTemplateBiz.selectById(OrderCostEnum.RENT_VEHICLE.getCode());
OrderTemplate template = orderTemplateBiz.selectByCode(OrderCostEnum.RENT_VEHICLE.getCode());
template.setTemplate(orderTemplateBiz.result(template.getTemplate(), new HashMap(){{
put("children", children);
put("vehicleAmount", vo.getVehicleAmount());
......
......@@ -310,7 +310,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
* @return
*/
private void costDetail(TourPriceVO vo, String children) {
OrderTemplate template = orderTemplateBiz.selectById(OrderCostEnum.RENT_VEHICLE.getCode());
OrderTemplate template = orderTemplateBiz.selectByCode(OrderCostEnum.RENT_VEHICLE.getCode());
template.setTemplate(orderTemplateBiz.result(template.getTemplate(), new HashMap(){{
put("children", children);
}}));
......
......@@ -98,7 +98,6 @@
<when test="targetStatus == 7">`actual_start_date` = now()</when>
<when test="targetStatus == 3">`actual_end_date` = now()</when>
</choose>
where id = #{id} and `status` = #{conditionStatus}
</update>
......@@ -503,7 +502,7 @@
<if test="code != null">
and v3.code = #{code}
</if>
and v1.book_user != -2
and v1.book_user != -2 and book_end_date &gt;= now()
</where>
group by v1.id
order by create_time DESC
......
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