This commit is contained in:
邱贞招 2024-10-28 15:24:35 +08:00
parent 0525f5117b
commit 131960c0ad
13 changed files with 94 additions and 30 deletions

View File

@ -205,7 +205,7 @@ public class AppVerifyController extends BaseController
statusList = null;
}
order.setStatusList(statusList);
List<RlOrderVO> rlOrderVOS = orderService.selectRlOrderList(order);
List<RlOrderVO> rlOrderVOS = orderService.selectRlOrderListNoIsolate(order);
return success(rlOrderVOS);
}

View File

@ -60,4 +60,11 @@ public interface RlDividendDetailMapper
* @return 结果
*/
public int deleteRlDividendDetailByIds(Long[] ids);
/**
* 根据订单号查询分账明细列表
* @param orderNo
* @return
*/
List<RlDividendDetailVO> selectRlDividendDetailListByOrderNo(String orderNo);
}

View File

@ -31,6 +31,13 @@ public interface IRlDividendDetailService
*/
public List<RlDividendDetailVO> selectRlDividendDetailList(RlDividendDetail rlDividendDetail);
/**
* 根据订单号查询分账明细列表
* @param orderNo 订单号
* @return 分账明细集合
*/
public List<RlDividendDetailVO> selectRlDividendDetailListByOrderNo(String orderNo);
/**
* 新增分账明细
*

View File

@ -61,6 +61,14 @@ public interface IRlOrderService
*/
public List<RlOrderVO> selectRlOrderList(RlOrderQuery rlOrder);
/**
* 查询订单列表
*
* @param rlOrder 订单
* @return 订单集合
*/
public List<RlOrderVO> selectRlOrderListNoIsolate(RlOrderQuery rlOrder);
/**
* 查询所有订单列表
*

View File

@ -175,20 +175,24 @@ public class CallbackServiceImpl implements CallbackService {
throw new ServiceException("【微信支付回调】更新订单信息失败");
}
/** 计算分成金额更新分成状态 */
logger.info("=================1111111111111111111111111==================");
BigDecimal totalDividendAmount = originalOrder.getLeaseFee().add(originalOrder.getOverdueFee());
RlDividendDetail rlDividendDetail = new RlDividendDetail();
rlDividendDetail.setOrderNo(originalOrder.getOrderNo());
List<RlDividendDetailVO> rlDividendDetailVOS = dividendDetailService.selectRlDividendDetailList(rlDividendDetail);
logger.info("=================2222222222222222222222222==================");
List<RlDividendDetailVO> rlDividendDetailVOS = dividendDetailService.selectRlDividendDetailListByOrderNo(originalOrder.getOrderNo());
logger.info("=================3333333333333333333333333==================");
dividendDetailService.calculationAmount(rlDividendDetailVOS,totalDividendAmount);
logger.info("=================4444444444444444444444444==================");
// 批量生成账变记录
generateChangeBalance(rlDividendDetailVOS,originalOrder);
logger.info("=================5555555555555555555555555==================");
/** 记录订单履历 */
if(!orderOperService.recordOrderHistory(originalOrder.getOrderNo(),ServiceConstants.ORDER_OPERATION_PAY,
originalOrder.getStatus(),updateOrder.getStatus(),BigDecimal.ZERO,originalOrder.getPayFee(),originalOrder.getUserId(),originalOrder.getPhone(),"订单支付:已支付 "+originalOrder.getPayFee()+"")){
throw new ServiceException("【订单履历-支付】更新订单信息失败");
}
logger.info("=================6666666666666666666666666==================");
logger.info("=================【微信支付回调】全部结束!!!!!==================");
return Boolean.TRUE;
});

View File

@ -42,7 +42,7 @@ public class RlAccessoryServiceImpl implements IRlAccessoryService
* @return 配件
*/
@Override
@DataScope(agentAlias = "a",userAlias = "u")
@DataScope(agentAlias = "ag",userAlias = "u")
public List<RlAccessory> selectRlAccessoryList(RlAccessory rlAccessory)
{
return rlAccessoryMapper.selectRlAccessoryList(rlAccessory);

View File

@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.List;
/**
@ -72,6 +73,16 @@ public class RlDividendDetailServiceImpl implements IRlDividendDetailService
return rlDividendDetailMapper.selectRlDividendDetailList(rlDividendDetail);
}
/**
* 根据订单号查询分账明细列表
* @param orderNo
* @return
*/
@Override
public List<RlDividendDetailVO> selectRlDividendDetailListByOrderNo(String orderNo) {
return rlDividendDetailMapper.selectRlDividendDetailListByOrderNo(orderNo);
}
/**
* 新增分账明细
*

View File

@ -246,6 +246,18 @@ public class RlOrderServiceImpl implements IRlOrderService
return orderMapper.selectRlOrderList(rlOrder);
}
/**
* 查询订单列表 不待数据隔离
*
* @param rlOrder 订单
* @return 订单
*/
@Override
public List<RlOrderVO> selectRlOrderListNoIsolate(RlOrderQuery rlOrder)
{
return orderMapper.selectRlOrderList(rlOrder);
}
/**
* 查询所有订单列表
*
@ -541,12 +553,19 @@ public class RlOrderServiceImpl implements IRlOrderService
if(order == null){
throw new RuntimeException("订单不存在");
}
if(!(ServiceConstants.ORDER_STATUS_TO_BE_TAKEN.equals(order.getStatus()) ||
ServiceConstants.ORDER_STATUS_TO_BE_SENT.equals(order.getStatus()) || ServiceConstants.ORDER_STATUS_TO_BE_PAID.equals(order.getStatus()))){
// 取消订单改成配送工单还没有接单前可以取消订单
// 判断是否在配送工单还没有接单前
if(Integer.parseInt(order.getStatus()) >= Integer.parseInt(ServiceConstants.ORDER_STATUS_IN_DELIVERY)){
throw new RuntimeException("订单已配送或已使用,不能取消");
}
if(ServiceConstants.ORDER_PAY_STATUS_PAID.equals(order.getPaid())){
throw new RuntimeException("订单已支付,不能取消");
// 如果订单已支付则发起退款
RlOrderQuery rlOrderQuery = new RlOrderQuery();
BeanUtils.copyBeanProp(rlOrderQuery,order);
int refund = refund(rlOrderQuery);
if(refund <= 0){
throw new RuntimeException("【订单取消】退款失败");
}
}
RlOrder rlOrder = new RlOrder();
rlOrder.setOrderNo(orderNo);
@ -740,7 +759,9 @@ public class RlOrderServiceImpl implements IRlOrderService
if(ObjectUtil.isNull(rlOrderVO)){
throw new ServiceException("订单不存在");
}
if(!ServiceConstants.ORDER_STATUS_ORDER_END.equals(rlOrderVO.getStatus())){
if (!(ServiceConstants.ORDER_STATUS_ORDER_END.equals(rlOrderVO.getStatus()) ||
ServiceConstants.ORDER_STATUS_TO_BE_TAKEN.equals(rlOrderVO.getStatus()) ||
ServiceConstants.ORDER_STATUS_TO_BE_SENT.equals(rlOrderVO.getStatus()))) {
throw new ServiceException("退款失败,订单未结束");
}
if(ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT.equals(rlOrderVO.getPaid())){

View File

@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.accessory_id, a.name, a.status, a.create_by, a.create_time, a.update_time, m.model from rl_accessory a
left join rl_model_accessory ma on a.accessory_id = ma.accessory_id
left join rl_model m on m.model_id = ma.model_id
left join rl_agent a on a.agent_id = m.agent_id
left join rl_agent ag on ag.agent_id = m.agent_id
</sql>
<select id="selectRlAccessoryList" parameterType="RlAccessory" resultMap="RlAccessoryResult">

View File

@ -35,6 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectRlDividendDetailListByOrderNo" parameterType="String"
resultMap="RlDividendDetailResult">
<include refid="selectRlDividendDetailVo"/>
where dd.order_no = #{orderNo}
</select>
<insert id="insertRlDividendDetail" parameterType="RlDividendDetail" useGeneratedKeys="true" keyProperty="id">
insert into rl_dividend_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -34,12 +34,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRlOperatingAreaByAreaId" parameterType="Long" resultMap="RlOperatingAreaResult">
<include refid="selectRlOperatingAreaVo"/>
where area_id = #{areaId}
where oa.area_id = #{areaId}
</select>
<select id="selectRlOperatingAreaByAgentId" parameterType="Long" resultMap="RlOperatingAreaResult">
<include refid="selectRlOperatingAreaVo"/>
where agent_id = #{agentId}
where oa.agent_id = #{agentId}
</select>
<insert id="insertRlOperatingArea" parameterType="RlOperatingArea" useGeneratedKeys="true" keyProperty="areaId">

View File

@ -7,12 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlRefundVO" id="EtRefundResult" autoMapping="true" />
<sql id="selectEtRefundVo">
select id, refund_no, order_no, user_id, amount, dispatch_fee, manage_fee, lease_fee, appointment_fee, type, reason, create_time, item_desc,refund_result from et_refund
select id, refund_no, order_no, user_id, amount, dispatch_fee, delivery_fee, lease_fee, deposit, type, reason, create_time, item_desc,refund_result from rl_refund
</sql>
<select id="selectEtRefundList" parameterType="RlRefund" resultMap="EtRefundResult">
select r.id, r.refund_no, o.area_id areaId,oa.area_name areaName,r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.manage_fee,
r.lease_fee, r.appointment_fee, r.type, r.reason, r.create_time, r.item_desc,r.refund_result from et_refund r
select r.id, r.refund_no, o.area_id areaId,oa.area_name areaName,r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.delivery_fee,
r.lease_fee, r.deposit, r.type, r.reason, r.create_time, r.item_desc,r.refund_result from rl_refund r
INNER JOIN et_order o on o.order_no = r.order_no
left join et_user u on u.user_id = r.user_id
LEFT JOIN et_operating_area oa ON o.area_id = oa.area_id
@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertEtRefund" parameterType="RlRefund">
insert into et_refund
insert into rl_refund
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="refundNo != null">refund_no,</if>
@ -57,11 +57,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if>
<if test="amount != null">amount,</if>
<if test="dispatchFee != null">dispatch_fee,</if>
<if test="manageFee != null">manage_fee,</if>
<if test="deliveryFee != null">delivery_fee,</if>
<if test="leaseFee != null">lease_fee,</if>
<if test="appointmentFee != null">appointment_fee,</if>
<if test="type != null">type,</if>
<if test="reason != null">reason,</if>
<if test="deposit != null">deposit,</if>
<if test="createTime != null">create_time,</if>
<if test="itemDesc != null">item_desc,</if>
<if test="refundResult != null">refund_result,</if>
@ -73,11 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">#{userId},</if>
<if test="amount != null">#{amount},</if>
<if test="dispatchFee != null">#{dispatchFee},</if>
<if test="manageFee != null">#{manageFee},</if>
<if test="deliveryFee != null">#{deliveryFee},</if>
<if test="leaseFee != null">#{leaseFee},</if>
<if test="appointmentFee != null">#{appointmentFee},</if>
<if test="type != null">#{type},</if>
<if test="reason != null">#{reason},</if>
<if test="deposit != null">#{deposit},</if>
<if test="createTime != null">#{createTime},</if>
<if test="itemDesc != null">#{itemDesc},</if>
<if test="refundResult != null">#{refund_result},</if>
@ -85,16 +85,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateEtRefund" parameterType="RlRefund">
update et_refund
update rl_refund
<trim prefix="SET" suffixOverrides=",">
<if test="refundNo != null">refund_no = #{refundNo},</if>
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="manageFee != null">manage_fee = #{manageFee},</if>
<if test="deliveryFee != null">delivery_fee = #{deliveryFee},</if>
<if test="leaseFee != null">lease_fee = #{leaseFee},</if>
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
<if test="deposit != null">deposit = #{deposit},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@ -104,14 +104,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateEtRefundByRefundNo">
update et_refund
update rl_refund
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="manageFee != null">manage_fee = #{manageFee},</if>
<if test="deliveryFee != null">delivery_fee = #{deliveryFee},</if>
<if test="leaseFee != null">lease_fee = #{leaseFee},</if>
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
<if test="deposit != null">deposit = #{deposit},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@ -122,11 +122,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteEtRefundById" parameterType="Long">
delete from et_refund where id = #{id}
delete from rl_refund where id = #{id}
</delete>
<delete id="deleteEtRefundByIds" parameterType="String">
delete from et_refund where id in
delete from rl_refund where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ref.id,
ref.refund_no
FROM et_order o
LEFT JOIN et_refund ref ON ref.order_no = o.order_no
LEFT JOIN rl_refund ref ON ref.order_no = o.order_no
WHERE o.status = '4'
AND o.paid = '1'
AND o.type = 2 and o.user_id = #{userId}

View File

@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSmStoreVo"/>
where 1=1 and ss.deleted = false
<include refid="searchCondition"/>
${params.dataScope}
${query.params.dataScope}
order by ss.create_time desc
</select>