update 占桩订单优化

This commit is contained in:
Guoqs
2024-07-25 17:22:12 +08:00
parent 64f9797f82
commit ed7c0f5e5c
5 changed files with 69 additions and 2 deletions

View File

@@ -111,4 +111,14 @@ public class OrderPileOccupyController extends BaseController {
// {
// return toAjax(orderPileOccupyService.deleteByPrimaryKey(ids));
// }
/**
* 重新计算占桩金额
* retryCalculateOccupyPileOrderAmount
*/
@PreAuthorize("@ss.hasPermi('pile:occupy:edit')")
@PostMapping("/retryCalculateOccupyPileOrderAmount")
public AjaxResult retryCalculateOccupyPileOrderAmount(@RequestBody MakeOrderFreeDTO dto) {
return toAjax(orderPileOccupyService.retryCalculateOccupyPileOrderAmount(dto.getOccupyCode()));
}
}

View File

@@ -66,6 +66,8 @@ public interface OrderPileOccupyService{
void stopOccupyPileOrder(OrderPileOccupy orderPileOccupy);
int retryCalculateOccupyPileOrderAmount(String occupyCode);
/**
* 通过memberid查询挂起状态订单
* @param memberId

View File

@@ -282,6 +282,26 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
orderPileOccupyMapper.updateByPrimaryKeySelective(orderPileOccupy);
}
@Override
public int retryCalculateOccupyPileOrderAmount(String occupyCode) {
OrderPileOccupy orderPileOccupy = queryByOccupyCode(occupyCode);
// 计算金额
BigDecimal orderAmount = calculateOccupyPileOrderAmount(orderPileOccupy);
if (orderAmount.compareTo(BigDecimal.ZERO) > 0) {
// 需要支付金额,订单挂起
orderPileOccupy.setStatus(Constants.TWO); // 2-订单挂起
} else {
// 订单金额为0
orderPileOccupy.setPayStatus(Constants.TWO); // 2-无需支付
orderPileOccupy.setStatus(Constants.ONE); // 1-订单完成
}
orderPileOccupy.setOrderAmount(orderAmount);
// 更新数据库
int i = orderPileOccupyMapper.updateByPrimaryKeySelective(orderPileOccupy);
return i;
}
/**
* 计算占桩订单金额
* calculateTheAmountOfTheOccupancyOrder

View File

@@ -50,4 +50,13 @@ export function noNeedPay(data) {
method: 'post',
data: data
})
}
}
// 重新计算
export function retryCalculateOccupyPileOrderAmount(data) {
return request({
url: '/pile/occupy/retryCalculateOccupyPileOrderAmount',
method: 'post',
data: data
})
}

View File

@@ -106,6 +106,9 @@
<el-button size="mini" type="text" v-hasPermi="['pile:occupy:remove']"
@click="getPay(scope.row.id, scope.row.occupyCode)">无需支付
</el-button>
<el-button size="mini" type="text" v-hasPermi="['pile:occupy:remove']"
@click="retryCalculateOccupyPileOrderAmount(scope.row.id, scope.row.occupyCode)">重新计算占桩订单金额
</el-button>
</template>
</el-table-column>
</el-table>
@@ -177,7 +180,15 @@
</template>
<script>
import { listOccupy, getOccupy, delOccupy, addOccupy, updateOccupy, noNeedPay } from "@/api/pile/occupy";
import {
listOccupy,
getOccupy,
delOccupy,
addOccupy,
updateOccupy,
noNeedPay,
retryCalculateOccupyPileOrderAmount
} from "@/api/pile/occupy";
export default {
name: "Occupy",
@@ -367,6 +378,21 @@ export default {
this.dataId = m
this.numbering = n
},
// 重新计算占桩订单金额
retryCalculateOccupyPileOrderAmount(id, occupyCode) {
const param = {
occupyCode: occupyCode
};
retryCalculateOccupyPileOrderAmount(param).then(res => {
console.log(res);
if (res.code === 200) {
this.$modal.msgSuccess("操作成功");
this.getList();
}
});
},
// type状态
agreeChange(value) {
this.radio = value