更新分成逻辑
This commit is contained in:
parent
dd9ecb1c48
commit
f2c8e5b2d5
|
@ -16,6 +16,7 @@ import lombok.Getter;
|
|||
public enum BonusStatus {
|
||||
|
||||
INVALID("INVALID", "未出账"),
|
||||
VALID("VALID", "已出账"),
|
||||
WAIT_DIVIDE("WAIT_DIVIDE", "待分成"),
|
||||
DIVIDEND("DIVIDEND", "已分成");
|
||||
|
||||
|
@ -23,12 +24,12 @@ public enum BonusStatus {
|
|||
private final String msg;
|
||||
|
||||
public static List<String> valid() {
|
||||
return CollectionUtils.map(BonusStatus::getStatus, WAIT_DIVIDE, DIVIDEND);
|
||||
return CollectionUtils.map(BonusStatus::getStatus, VALID, WAIT_DIVIDE, DIVIDEND);
|
||||
}
|
||||
|
||||
// 允许打款的分成状态
|
||||
public static List<String> canPay() {
|
||||
return CollectionUtils.map(BonusStatus::getStatus, WAIT_DIVIDE);
|
||||
return CollectionUtils.map(BonusStatus::getStatus, VALID, WAIT_DIVIDE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -271,9 +271,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="validByBst">
|
||||
update bst_bonus bb
|
||||
set bb.status = 'WAIT_DIVIDE',
|
||||
bb.wait_amount = bb.wait_amount + bb.invalid_amount,
|
||||
bb.invalid_amount = 0
|
||||
set bb.status = 'VALID'
|
||||
where bb.bst_type = #{bstType}
|
||||
and bb.bst_id = #{bstId}
|
||||
and bb.status = 'INVALID'
|
||||
|
@ -312,7 +310,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item.id}
|
||||
</foreach>
|
||||
and <include refid="checkAmount"/>
|
||||
and bb.status in ('INVALID', 'WAIT_DIVIDE')
|
||||
and bb.status in ('INVALID', 'VALID', 'WAIT_DIVIDE')
|
||||
</update>
|
||||
|
||||
<update id="pay">
|
||||
|
|
|
@ -25,18 +25,17 @@ public class DeviceUtil {
|
|||
}
|
||||
|
||||
// 转换经纬度坐标系并赋值
|
||||
if (sys.getLon() != null && sys.getLat() != null) {
|
||||
// 只有定位是正常的才认为是有获取到定位
|
||||
if (sys.getLon() != null && sys.getLat() != null
|
||||
&& !MathUtils.equals(sys.getLon(), BigDecimal.ZERO)
|
||||
&& !MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
||||
List<BigDecimal> coordinates = GpsCoordinateUtils.coordinateConvert(sys.getLon(), sys.getLat());
|
||||
if (coordinates != null && coordinates.size() >= 2) {
|
||||
device.setLongitude(coordinates.get(1));
|
||||
device.setLatitude(coordinates.get(0));
|
||||
|
||||
// 只有定位是正常的才认为是有获取到定位
|
||||
if (!MathUtils.equals(device.getLongitude(), BigDecimal.ZERO) && !MathUtils.equals(device.getLatitude(), BigDecimal.ZERO)) {
|
||||
device.setLastLocationTime(at);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
device.setLastTime(at);
|
||||
device.setVoltage(sys.getBat());
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusBstType;
|
||||
import com.ruoyi.bst.bonus.service.BonusService;
|
||||
import com.ruoyi.bst.device.domain.enums.DeviceUnLockType;
|
||||
import com.ruoyi.bst.device.domain.vo.DeviceIotVO;
|
||||
|
@ -75,6 +76,10 @@ public class OrderPayHandlerImpl implements PayHandler {
|
|||
int rows = orderMapper.updateByQuery(data, query);
|
||||
ServiceUtil.assertion(rows != 1, "更新ID为%s的订单失败", order.getId());
|
||||
|
||||
// 分成出账
|
||||
boolean valid = bonusService.validByBst(BonusBstType.ORDER, order.getId());
|
||||
ServiceUtil.assertion(!valid, "ID为%s的订单分成出账失败", order.getId());
|
||||
|
||||
// 开始使用订单设备
|
||||
int start = orderDeviceService.start(orderDevice);
|
||||
ServiceUtil.assertion(start != 1, "开始使用ID为%s的订单设备失败", orderDevice.getId());
|
||||
|
|
Loading…
Reference in New Issue
Block a user