加价补充字段,查询接口开发
This commit is contained in:
parent
c06438b2e8
commit
05c6c97aad
|
|
@ -453,7 +453,8 @@ public class OrderDetailController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changePrice(@Valid @RequestBody OrderChangePriceRequest request){
|
public AjaxResult changePrice(@Valid @RequestBody OrderChangePriceRequest request){
|
||||||
try {
|
try {
|
||||||
return toAjax(orderDetailService.changePrice(request.getOrderDetailId(), request.getChangeMoney()));
|
Assert.notNull(request.getChangeMoney(), "报价不能为空");
|
||||||
|
return toAjax(orderDetailService.changePrice(request.getOrderDetailId(), request.getChangeMoney(), request.getType(), request.getRemark()));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||||
|
|
@ -461,4 +462,15 @@ public class OrderDetailController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/app/getChangePrice")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult getChangePrice(@Valid @RequestBody OrderChangePriceRequest request){
|
||||||
|
try {
|
||||||
|
return AjaxResult.success(orderDetailService.getChangedPriceRecord(request.getOrderDetailId()));
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||||
|
return AjaxResult.error("查询改价失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ public class OrderChangePriceRequest implements Serializable {
|
||||||
@NotNull
|
@NotNull
|
||||||
private Long orderDetailId;
|
private Long orderDetailId;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private BigDecimal changeMoney;
|
private BigDecimal changeMoney;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.ghy.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上门报价类型枚举类
|
||||||
|
* @author ydq
|
||||||
|
* @date : 2022-09-24 22:35
|
||||||
|
*/
|
||||||
|
public enum ChangePriceType {
|
||||||
|
CUR_ORDER_CHANGE_MONEY(1, "本单报价"),
|
||||||
|
ADD_ORDER_CHANGE_MONEY(2, "加单报价");
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
ChangePriceType(int code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ghy.order.service;
|
package com.ghy.order.service;
|
||||||
|
|
||||||
import com.ghy.order.domain.OrderDetail;
|
import com.ghy.order.domain.OrderDetail;
|
||||||
|
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -121,10 +122,13 @@ public interface OrderDetailService {
|
||||||
* 子单改价接口
|
* 子单改价接口
|
||||||
* @param orderDetailId 子单id
|
* @param orderDetailId 子单id
|
||||||
* @param changeMoney 改价金额
|
* @param changeMoney 改价金额
|
||||||
|
* @param type 报价类型
|
||||||
|
* @param remark 备注
|
||||||
* @return 成功/失败
|
* @return 成功/失败
|
||||||
*/
|
*/
|
||||||
int changePrice(Long orderDetailId, BigDecimal changeMoney);
|
int changePrice(Long orderDetailId, BigDecimal changeMoney, Integer type, String remark);
|
||||||
|
|
||||||
int sureChange(Long financialChangeRecordId);
|
int sureChange(Long financialChangeRecordId);
|
||||||
|
|
||||||
|
FinancialChangeRecord getChangedPriceRecord(Long orderDetailId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int changePrice(Long orderDetailId, BigDecimal changeMoney) {
|
public int changePrice(Long orderDetailId, BigDecimal changeMoney, Integer type, String remark) {
|
||||||
OrderDetail orderDetail = orderDetailMapper.selectById(orderDetailId);
|
OrderDetail orderDetail = orderDetailMapper.selectById(orderDetailId);
|
||||||
if(orderDetail==null){
|
if(orderDetail==null){
|
||||||
throw new BaseException("子单不存在!");
|
throw new BaseException("子单不存在!");
|
||||||
|
|
@ -374,6 +374,8 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
// 修改现有
|
// 修改现有
|
||||||
financialChangeRecord = list.get(0);
|
financialChangeRecord = list.get(0);
|
||||||
financialChangeRecord.setChangeMoney(changeMoney);
|
financialChangeRecord.setChangeMoney(changeMoney);
|
||||||
|
financialChangeRecord.setType(type);
|
||||||
|
financialChangeRecord.setRemark(remark);
|
||||||
return financialChangeRecordService.updateFinancialChangeRecord(financialChangeRecord);
|
return financialChangeRecordService.updateFinancialChangeRecord(financialChangeRecord);
|
||||||
}else {
|
}else {
|
||||||
// 创建改单记录
|
// 创建改单记录
|
||||||
|
|
@ -382,6 +384,8 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
financialChangeRecord.setChangeMoney(changeMoney);
|
financialChangeRecord.setChangeMoney(changeMoney);
|
||||||
financialChangeRecord.setStatus(0L);
|
financialChangeRecord.setStatus(0L);
|
||||||
financialChangeRecord.setPayStatus(0L);
|
financialChangeRecord.setPayStatus(0L);
|
||||||
|
financialChangeRecord.setType(type);
|
||||||
|
financialChangeRecord.setRemark(remark);
|
||||||
return financialChangeRecordService.insertFinancialChangeRecord(financialChangeRecord);
|
return financialChangeRecordService.insertFinancialChangeRecord(financialChangeRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -390,4 +394,15 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
public int sureChange(Long financialChangeRecordId) {
|
public int sureChange(Long financialChangeRecordId) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinancialChangeRecord getChangedPriceRecord(Long orderDetailId) {
|
||||||
|
FinancialChangeRecord param = new FinancialChangeRecord();
|
||||||
|
param.setOrderDetailId(orderDetailId);
|
||||||
|
List<FinancialChangeRecord> list = financialChangeRecordService.selectFinancialChangeRecordList(param);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,10 @@ public class FinancialChangeRecord extends BaseEntity
|
||||||
@Excel(name = "0 待支付 1.已支付")
|
@Excel(name = "0 待支付 1.已支付")
|
||||||
private Long payStatus;
|
private Long payStatus;
|
||||||
|
|
||||||
|
/** 1.本单报价 2.加单报价 **/
|
||||||
|
@Excel(name = "1.本单报价 2.加单报价")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
public void setId(String id)
|
public void setId(String id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
@ -81,6 +85,14 @@ public class FinancialChangeRecord extends BaseEntity
|
||||||
return payStatus;
|
return payStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Integer type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
@ -89,6 +101,7 @@ public class FinancialChangeRecord extends BaseEntity
|
||||||
.append("changeMoney", getChangeMoney())
|
.append("changeMoney", getChangeMoney())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("payStatus", getPayStatus())
|
.append("payStatus", getPayStatus())
|
||||||
|
.append("type", getType())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectFinancialChangeRecordVo">
|
<sql id="selectFinancialChangeRecordVo">
|
||||||
select id, order_detail_id, change_money, status, pay_status from financial_change_record
|
select id, order_detail_id, change_money, status, pay_status, type, remark from financial_change_record
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectFinancialChangeRecordList" parameterType="FinancialChangeRecord" resultMap="FinancialChangeRecordResult">
|
<select id="selectFinancialChangeRecordList" parameterType="FinancialChangeRecord" resultMap="FinancialChangeRecordResult">
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
<if test="status != null "> and status = #{status}</if>
|
<if test="status != null "> and status = #{status}</if>
|
||||||
<if test="payStatus != null "> and pay_status = #{payStatus}</if>
|
<if test="payStatus != null "> and pay_status = #{payStatus}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectFinancialChangeRecordById" parameterType="String" resultMap="FinancialChangeRecordResult">
|
<select id="selectFinancialChangeRecordById" parameterType="String" resultMap="FinancialChangeRecordResult">
|
||||||
|
|
@ -38,12 +39,16 @@
|
||||||
<if test="changeMoney != null">change_money,</if>
|
<if test="changeMoney != null">change_money,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="payStatus != null">pay_status,</if>
|
<if test="payStatus != null">pay_status,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="orderDetailId != null">#{orderDetailId},</if>
|
<if test="orderDetailId != null">#{orderDetailId},</if>
|
||||||
<if test="changeMoney != null">#{changeMoney},</if>
|
<if test="changeMoney != null">#{changeMoney},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="payStatus != null">#{payStatus},</if>
|
<if test="payStatus != null">#{payStatus},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
@ -54,6 +59,8 @@
|
||||||
<if test="changeMoney != null">change_money = #{changeMoney},</if>
|
<if test="changeMoney != null">change_money = #{changeMoney},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="payStatus != null">pay_status = #{payStatus},</if>
|
<if test="payStatus != null">pay_status = #{payStatus},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -69,4 +76,4 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue