子单加价,缺少确定付款时生成细单。
This commit is contained in:
parent
bab6425637
commit
80df72d80c
|
|
@ -202,7 +202,7 @@ public class OrderController extends BaseController {
|
|||
od.setOrderMasterCode(om.getCode());
|
||||
od.setCustomerId(om.getCustomerId());
|
||||
od.setOrderType(om.getOrderType());
|
||||
od.setOrderStatus(request.getWorkerId() == om.getWorkerId() ? OrderStatus.GOING.code() : OrderStatus.RECEIVE.code());
|
||||
od.setOrderStatus(request.getWorkerId().equals(om.getWorkerId()) ? OrderStatus.GOING.code() : OrderStatus.RECEIVE.code());
|
||||
od.setWorkerId(request.getWorkerId());
|
||||
od.setRevTime(om.getRevTime());
|
||||
od.setExpectTimeStart(om.getExpectTimeStart());
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.ghy.payment.service.FinancialDetailService;
|
|||
import com.ghy.payment.service.OrderFineRecordService;
|
||||
import com.ghy.system.domain.SysArea;
|
||||
import com.ghy.system.service.ISysAreaService;
|
||||
import com.ghy.web.pojo.vo.OrderChangePriceRequest;
|
||||
import com.ghy.web.pojo.vo.OrderListResponse;
|
||||
import com.ghy.web.pojo.vo.OrderStandard;
|
||||
import com.ghy.worker.domain.Worker;
|
||||
|
|
@ -49,6 +50,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -145,7 +147,7 @@ public class OrderDetailController extends BaseController {
|
|||
GoodsImgs qryImgsObj = new GoodsImgs();
|
||||
qryImgsObj.setRemark(request.getId().toString());
|
||||
qryImgsObj.setImgType(ImgType.FINISH_IMG.getId());
|
||||
qryImgsObj.setGoodsId(0l);
|
||||
qryImgsObj.setGoodsId(0L);
|
||||
List<GoodsImgs> goodsImgs = goodsImgsService.qryGoodsImgs(qryImgsObj);
|
||||
finishImgList = goodsImgs.stream().map(GoodsImgs::getImgUrl).collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -404,7 +406,7 @@ public class OrderDetailController extends BaseController {
|
|||
OrderDetail orderDetail = orderDetailService.selectById(request.getOrderDetailId());
|
||||
OrderMaster orderMaster = orderMasterService.selectById(orderDetail.getOrderMasterId());
|
||||
if (orderDetail.getOrderStatus() != OrderStatus.SERVER.code()
|
||||
|| orderMaster.getPayStatus() != PayStatus.PAID.getCode()) {
|
||||
|| !orderMaster.getPayStatus().equals(PayStatus.PAID.getCode())) {
|
||||
return AjaxResult.error("未支付订单或非服务中订单,发起完单失败");
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +414,7 @@ public class OrderDetailController extends BaseController {
|
|||
List<GoodsImgs> finishImgObjList = new ArrayList<GoodsImgs>();
|
||||
for (String imgUrl: request.getFinishImgList()) {
|
||||
GoodsImgs finishImgObj = new GoodsImgs();
|
||||
finishImgObj.setGoodsId(0l);
|
||||
finishImgObj.setGoodsId(0L);
|
||||
finishImgObj.setImgType(ImgType.FINISH_IMG.getId());
|
||||
finishImgObj.setImgUrl(imgUrl);
|
||||
finishImgObj.setRemark(String.valueOf(request.getOrderDetailId()));
|
||||
|
|
@ -446,4 +448,17 @@ public class OrderDetailController extends BaseController {
|
|||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/app/change/price")
|
||||
@ResponseBody
|
||||
public AjaxResult changePrice(@Valid @RequestBody OrderChangePriceRequest request){
|
||||
try {
|
||||
return toAjax(orderDetailService.changePrice(request.getOrderDetailId(), request.getChangeMoney()));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
return AjaxResult.error("改价失败!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ghy.web.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 改价请求实体
|
||||
* @author clunt
|
||||
*/
|
||||
@Data
|
||||
public class OrderChangePriceRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
private Long orderDetailId;
|
||||
|
||||
@NotNull
|
||||
private BigDecimal changeMoney;
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.ghy.order.service;
|
|||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -115,4 +116,15 @@ public interface OrderDetailService {
|
|||
* @return 数量
|
||||
*/
|
||||
Long countOrderDetailList(OrderDetail orderDetail);
|
||||
|
||||
/**
|
||||
* 子单改价接口
|
||||
* @param orderDetailId 子单id
|
||||
* @param changeMoney 改价金额
|
||||
* @return 成功/失败
|
||||
*/
|
||||
int changePrice(Long orderDetailId, BigDecimal changeMoney);
|
||||
|
||||
int sureChange(Long financialChangeRecordId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.ghy.common.core.text.Convert;
|
|||
import com.ghy.common.enums.AdapayOrderType;
|
||||
import com.ghy.common.enums.OrderStatus;
|
||||
import com.ghy.common.enums.PayStatus;
|
||||
import com.ghy.common.exception.base.BaseException;
|
||||
import com.ghy.common.utils.AdapayUtils;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
|
|
@ -17,9 +18,11 @@ import com.ghy.order.mapper.OrderDetailMapper;
|
|||
import com.ghy.order.mapper.OrderMasterMapper;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||
import com.ghy.payment.domain.FinancialDetail;
|
||||
import com.ghy.payment.domain.FinancialMaster;
|
||||
import com.ghy.payment.service.AdapayService;
|
||||
import com.ghy.payment.service.FinancialChangeRecordService;
|
||||
import com.ghy.payment.service.FinancialDetailService;
|
||||
import com.ghy.payment.service.FinancialMasterService;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
|
|
@ -70,6 +73,8 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
|||
private FinancialMasterService financialMasterService;
|
||||
@Resource
|
||||
private FinancialDetailService financialDetailService;
|
||||
@Resource
|
||||
private FinancialChangeRecordService financialChangeRecordService;
|
||||
|
||||
@Override
|
||||
public int insertOrderDetail(OrderDetail orderDetail) {
|
||||
|
|
@ -353,4 +358,36 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
|||
public Long countOrderDetailList(OrderDetail orderDetail) {
|
||||
return orderDetailMapper.countOrderDetailList(orderDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int changePrice(Long orderDetailId, BigDecimal changeMoney) {
|
||||
OrderDetail orderDetail = orderDetailMapper.selectById(orderDetailId);
|
||||
if(orderDetail==null){
|
||||
throw new BaseException("子单不存在!");
|
||||
}
|
||||
FinancialChangeRecord param = new FinancialChangeRecord();
|
||||
param.setPayStatus(0L);
|
||||
param.setOrderDetailId(orderDetailId);
|
||||
List<FinancialChangeRecord> list = financialChangeRecordService.selectFinancialChangeRecordList(param);
|
||||
FinancialChangeRecord financialChangeRecord;
|
||||
if(list.size() > 0){
|
||||
// 修改现有
|
||||
financialChangeRecord = list.get(0);
|
||||
financialChangeRecord.setChangeMoney(changeMoney);
|
||||
return financialChangeRecordService.updateFinancialChangeRecord(financialChangeRecord);
|
||||
}else {
|
||||
// 创建改单记录
|
||||
financialChangeRecord = new FinancialChangeRecord();
|
||||
financialChangeRecord.setOrderDetailId(orderDetailId);
|
||||
financialChangeRecord.setChangeMoney(changeMoney);
|
||||
financialChangeRecord.setStatus(0L);
|
||||
financialChangeRecord.setPayStatus(0L);
|
||||
return financialChangeRecordService.insertFinancialChangeRecord(financialChangeRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sureChange(Long financialChangeRecordId) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
package com.ghy.payment.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ghy.common.annotation.Excel;
|
||||
import com.ghy.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 改价记录对象 financial_change_record
|
||||
*
|
||||
* @author clunt
|
||||
* @date 2022-09-15
|
||||
*/
|
||||
public class FinancialChangeRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private String id;
|
||||
|
||||
/** 改价子单 */
|
||||
@Excel(name = "改价子单")
|
||||
private Long orderDetailId;
|
||||
|
||||
/** 改价金额 */
|
||||
@Excel(name = "改价金额")
|
||||
private BigDecimal changeMoney;
|
||||
|
||||
/** 状态0.待审核 1.审核通过 2.审核拒绝 */
|
||||
@Excel(name = "状态0.待审核 1.审核通过 2.审核拒绝")
|
||||
private Long status;
|
||||
|
||||
/** 0 待支付 1.已支付 */
|
||||
@Excel(name = "0 待支付 1.已支付")
|
||||
private Long payStatus;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setOrderDetailId(Long orderDetailId)
|
||||
{
|
||||
this.orderDetailId = orderDetailId;
|
||||
}
|
||||
|
||||
public Long getOrderDetailId()
|
||||
{
|
||||
return orderDetailId;
|
||||
}
|
||||
public void setChangeMoney(BigDecimal changeMoney)
|
||||
{
|
||||
this.changeMoney = changeMoney;
|
||||
}
|
||||
|
||||
public BigDecimal getChangeMoney()
|
||||
{
|
||||
return changeMoney;
|
||||
}
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setPayStatus(Long payStatus)
|
||||
{
|
||||
this.payStatus = payStatus;
|
||||
}
|
||||
|
||||
public Long getPayStatus()
|
||||
{
|
||||
return payStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("orderDetailId", getOrderDetailId())
|
||||
.append("changeMoney", getChangeMoney())
|
||||
.append("status", getStatus())
|
||||
.append("payStatus", getPayStatus())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.ghy.payment.mapper;
|
||||
|
||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
*/
|
||||
public interface FinancialChangeRecordMapper {
|
||||
|
||||
/**
|
||||
* 查询改价记录
|
||||
*
|
||||
* @param id 改价记录主键
|
||||
* @return 改价记录
|
||||
*/
|
||||
public FinancialChangeRecord selectFinancialChangeRecordById(String id);
|
||||
|
||||
/**
|
||||
* 查询改价记录列表
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 改价记录集合
|
||||
*/
|
||||
public List<FinancialChangeRecord> selectFinancialChangeRecordList(FinancialChangeRecord financialChangeRecord);
|
||||
|
||||
/**
|
||||
* 新增改价记录
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFinancialChangeRecord(FinancialChangeRecord financialChangeRecord);
|
||||
|
||||
/**
|
||||
* 修改改价记录
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFinancialChangeRecord(FinancialChangeRecord financialChangeRecord);
|
||||
|
||||
/**
|
||||
* 删除改价记录
|
||||
*
|
||||
* @param id 改价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFinancialChangeRecordById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除改价记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFinancialChangeRecordByIds(String[] ids);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.ghy.payment.service;
|
||||
|
||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
*/
|
||||
public interface FinancialChangeRecordService {
|
||||
|
||||
/**
|
||||
* 查询改价记录
|
||||
*
|
||||
* @param id 改价记录主键
|
||||
* @return 改价记录
|
||||
*/
|
||||
public FinancialChangeRecord selectFinancialChangeRecordById(String id);
|
||||
|
||||
/**
|
||||
* 查询改价记录列表
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 改价记录集合
|
||||
*/
|
||||
public List<FinancialChangeRecord> selectFinancialChangeRecordList(FinancialChangeRecord financialChangeRecord);
|
||||
|
||||
/**
|
||||
* 新增改价记录
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFinancialChangeRecord(FinancialChangeRecord financialChangeRecord);
|
||||
|
||||
/**
|
||||
* 修改改价记录
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFinancialChangeRecord(FinancialChangeRecord financialChangeRecord);
|
||||
|
||||
/**
|
||||
* 批量删除改价记录
|
||||
*
|
||||
* @param ids 需要删除的改价记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFinancialChangeRecordByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除改价记录信息
|
||||
*
|
||||
* @param id 改价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFinancialChangeRecordById(String id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.ghy.payment.service.impl;
|
||||
|
||||
import com.ghy.common.core.text.Convert;
|
||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||
import com.ghy.payment.mapper.FinancialChangeRecordMapper;
|
||||
import com.ghy.payment.service.FinancialChangeRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
*/
|
||||
@Service
|
||||
public class FinancialChangeRecordServiceImpl implements FinancialChangeRecordService {
|
||||
|
||||
@Autowired
|
||||
private FinancialChangeRecordMapper financialChangeRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询改价记录
|
||||
*
|
||||
* @param id 改价记录主键
|
||||
* @return 改价记录
|
||||
*/
|
||||
@Override
|
||||
public FinancialChangeRecord selectFinancialChangeRecordById(String id)
|
||||
{
|
||||
return financialChangeRecordMapper.selectFinancialChangeRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询改价记录列表
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 改价记录
|
||||
*/
|
||||
@Override
|
||||
public List<FinancialChangeRecord> selectFinancialChangeRecordList(FinancialChangeRecord financialChangeRecord)
|
||||
{
|
||||
return financialChangeRecordMapper.selectFinancialChangeRecordList(financialChangeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增改价记录
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFinancialChangeRecord(FinancialChangeRecord financialChangeRecord)
|
||||
{
|
||||
return financialChangeRecordMapper.insertFinancialChangeRecord(financialChangeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改改价记录
|
||||
*
|
||||
* @param financialChangeRecord 改价记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFinancialChangeRecord(FinancialChangeRecord financialChangeRecord)
|
||||
{
|
||||
return financialChangeRecordMapper.updateFinancialChangeRecord(financialChangeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除改价记录
|
||||
*
|
||||
* @param ids 需要删除的改价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFinancialChangeRecordByIds(String ids)
|
||||
{
|
||||
return financialChangeRecordMapper.deleteFinancialChangeRecordByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除改价记录信息
|
||||
*
|
||||
* @param id 改价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFinancialChangeRecordById(String id)
|
||||
{
|
||||
return financialChangeRecordMapper.deleteFinancialChangeRecordById(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?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.ghy.payment.mapper.FinancialChangeRecordMapper">
|
||||
|
||||
<resultMap type="FinancialChangeRecord" id="FinancialChangeRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="orderDetailId" column="order_detail_id" />
|
||||
<result property="changeMoney" column="change_money" />
|
||||
<result property="status" column="status" />
|
||||
<result property="payStatus" column="pay_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFinancialChangeRecordVo">
|
||||
select id, order_detail_id, change_money, status, pay_status from financial_change_record
|
||||
</sql>
|
||||
|
||||
<select id="selectFinancialChangeRecordList" parameterType="FinancialChangeRecord" resultMap="FinancialChangeRecordResult">
|
||||
<include refid="selectFinancialChangeRecordVo"/>
|
||||
<where>
|
||||
<if test="orderDetailId != null "> and order_detail_id = #{orderDetailId}</if>
|
||||
<if test="changeMoney != null "> and change_money = #{changeMoney}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="payStatus != null "> and pay_status = #{payStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFinancialChangeRecordById" parameterType="String" resultMap="FinancialChangeRecordResult">
|
||||
<include refid="selectFinancialChangeRecordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertFinancialChangeRecord" parameterType="FinancialChangeRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into financial_change_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderDetailId != null">order_detail_id,</if>
|
||||
<if test="changeMoney != null">change_money,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="payStatus != null">pay_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderDetailId != null">#{orderDetailId},</if>
|
||||
<if test="changeMoney != null">#{changeMoney},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="payStatus != null">#{payStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFinancialChangeRecord" parameterType="FinancialChangeRecord">
|
||||
update financial_change_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="orderDetailId != null">order_detail_id = #{orderDetailId},</if>
|
||||
<if test="changeMoney != null">change_money = #{changeMoney},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="payStatus != null">pay_status = #{payStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteFinancialChangeRecordById" parameterType="String">
|
||||
delete from financial_change_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFinancialChangeRecordByIds" parameterType="String">
|
||||
delete from financial_change_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue