提交 4447e497 作者: 张小凤

BackRequirementsDao.xml(update)

上级 d20cecdf
...@@ -173,4 +173,8 @@ public interface RequirementsDao { ...@@ -173,4 +173,8 @@ public interface RequirementsDao {
RequirementsAmountUpdateDTO amountUpdateDTO(Integer requirementsInfoId); RequirementsAmountUpdateDTO amountUpdateDTO(Integer requirementsInfoId);
void insertPlatformOrderEarnings(BigDecimal earnings, Integer requirementsInfoId, Integer userAccountId); void insertPlatformOrderEarnings(BigDecimal earnings, Integer requirementsInfoId, Integer userAccountId);
void updateRequirementsAmount(RequirementsInfoDO requirementsInfoDO);
void updateAmounts(RequirementsServiceDO requirementsServiceDO);
} }
...@@ -167,6 +167,10 @@ public class RequirementsInfoDO implements Serializable { ...@@ -167,6 +167,10 @@ public class RequirementsInfoDO implements Serializable {
@ApiModelProperty(value = "抢单者电话") @ApiModelProperty(value = "抢单者电话")
private String preemptPhone; private String preemptPhone;
@ApiModelProperty(value = "平台总收益")
@IsNullConvertZero
private BigDecimal orderEarnings;
public RequirementsInfoVO buildRequirementsInfoVO() { public RequirementsInfoVO buildRequirementsInfoVO() {
return RequirementsInfoVO.builder().id(this.id).requirementTypeId(this.requirementTypeId).userAccountId(this.userAccountId).publishName(this.publishName) return RequirementsInfoVO.builder().id(this.id).requirementTypeId(this.requirementTypeId).userAccountId(this.userAccountId).publishName(this.publishName)
.publishPhone(this.publishPhone).requireDescription(this.requireDescription).solved(this.solved).taskStartTime(this.taskStartTime).taskEndTime(this.taskEndTime) .publishPhone(this.publishPhone).requireDescription(this.requireDescription).solved(this.solved).taskStartTime(this.taskStartTime).taskEndTime(this.taskEndTime)
......
...@@ -78,6 +78,10 @@ public class RequirementsServiceDO implements Serializable { ...@@ -78,6 +78,10 @@ public class RequirementsServiceDO implements Serializable {
@ApiModelProperty(value = "手机号", hidden = true) @ApiModelProperty(value = "手机号", hidden = true)
private String phoneNum; private String phoneNum;
@ApiModelProperty(value = "平台总收益")
@IsNullConvertZero
private BigDecimal orderEarnings;
public RequirementsServiceDO(PilotCertificationInteriorDTO pilot, ServiceRequirementsDO requirementsInfoDO) { public RequirementsServiceDO(PilotCertificationInteriorDTO pilot, ServiceRequirementsDO requirementsInfoDO) {
this.pilotCertificationId = pilot.getId(); this.pilotCertificationId = pilot.getId();
this.pilotCertificationUserId = pilot.getUserAccountId(); this.pilotCertificationUserId = pilot.getUserAccountId();
......
...@@ -99,6 +99,9 @@ public class ServiceOrderFormDetailsDO { ...@@ -99,6 +99,9 @@ public class ServiceOrderFormDetailsDO {
@ApiModelProperty(value = "状态", example = "100") @ApiModelProperty(value = "状态", example = "100")
private String orderStatus; private String orderStatus;
@ApiModelProperty(value = "当前状态")
private String doing;
public ServiceOrderFormDetailsDTO buildOrderFormDetails() { public ServiceOrderFormDetailsDTO buildOrderFormDetails() {
return ServiceOrderFormDetailsDTO.builder() return ServiceOrderFormDetailsDTO.builder()
......
...@@ -737,6 +737,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -737,6 +737,7 @@ public class RequirementsServiceImpl implements RequirementsService {
public ResultBody droneFlyerCancel(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request) { public ResultBody droneFlyerCancel(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request) {
RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId); RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
Integer serviceFlowId = requirementsServiceDO.getServiceFlowId(); Integer serviceFlowId = requirementsServiceDO.getServiceFlowId();
if (serviceFlowId != 2) { if (serviceFlowId != 2) {
return ResultBody.error(ResultEnum.YOU_CANNOT_CANCEL_THE_ORDER_AT_THIS_TIME.getResultMsg()); return ResultBody.error(ResultEnum.YOU_CANNOT_CANCEL_THE_ORDER_AT_THIS_TIME.getResultMsg());
...@@ -764,6 +765,10 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -764,6 +765,10 @@ public class RequirementsServiceImpl implements RequirementsService {
requirementsServiceDO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder); requirementsServiceDO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder);
//飞手单方面取消将20之二十退回到发布者佣金里面 //飞手单方面取消将20之二十退回到发布者佣金里面
flyerCancel(walletFlowVO, request.getHeader("token")); flyerCancel(walletFlowVO, request.getHeader("token"));
BigDecimal orderEarnings = requirementsServiceDO.getOrderEarnings();
BigDecimal add = orderEarnings.add(earnings);
requirementsServiceDO.setOrderEarnings(add);
requirementsDao.updateAmounts(requirementsServiceDO);
requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId); requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
requirementsDao.updateScene(requirementsInfoId, 7); requirementsDao.updateScene(requirementsInfoId, 7);
requirementsDao.updateInfo(requirementsInfoId, 7); requirementsDao.updateInfo(requirementsInfoId, 7);
...@@ -955,6 +960,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -955,6 +960,7 @@ public class RequirementsServiceImpl implements RequirementsService {
if (requirementsInfoDO == null) { if (requirementsInfoDO == null) {
return ResultBody.error("当前订单不存在"); return ResultBody.error("当前订单不存在");
} }
IsNullConvertZeroUtil.checkIsNull(requirementsInfoDO);
Integer serviceFlowId = requirementsInfoDO.getServiceFlowId(); Integer serviceFlowId = requirementsInfoDO.getServiceFlowId();
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
WalletFlowVO walletFlowVO = new WalletFlowVO(); WalletFlowVO walletFlowVO = new WalletFlowVO();
...@@ -1051,6 +1057,10 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1051,6 +1057,10 @@ public class RequirementsServiceImpl implements RequirementsService {
//平台抽取百分之十 //平台抽取百分之十
//发布者取消 //发布者取消
BigDecimal earnings = orderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal earnings = orderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings();
BigDecimal add = orderEarnings.add(earnings);
requirementsInfoDO.setOrderEarnings(add);
requirementsDao.updateRequirementsAmount(requirementsInfoDO);
requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId); requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
flyerWalletFlowVO.setSalaryAmount(receiveSalaryAmount); flyerWalletFlowVO.setSalaryAmount(receiveSalaryAmount);
flyerWalletFlowVO.setUserAccountId(requirementsInfoDO.getPilotCertificationUserId()); flyerWalletFlowVO.setUserAccountId(requirementsInfoDO.getPilotCertificationUserId());
...@@ -1770,11 +1780,13 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1770,11 +1780,13 @@ public class RequirementsServiceImpl implements RequirementsService {
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) { if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) { if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setCashAmount(tempTotalAmount); publisherWalletFlowVO.setCashAmount(tempTotalAmount);
requirementsInfoDO.setCashAmount(tempTotalAmount);
// walletFlowVO.setCashAmount(tempTotalAmount); // walletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO; tempTotalAmount = BigDecimal.ZERO;
} else { } else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt); tempTotalAmount = tempTotalAmount.subtract(cashAmt);
publisherWalletFlowVO.setCashAmount(cashAmt); publisherWalletFlowVO.setCashAmount(cashAmt);
requirementsInfoDO.setCashAmount(cashAmt);
// walletFlowVO.setCashAmount(cashAmt); // walletFlowVO.setCashAmount(cashAmt);
} }
} }
...@@ -1783,10 +1795,12 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1783,10 +1795,12 @@ public class RequirementsServiceImpl implements RequirementsService {
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) { if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) { if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setSalaryAmount(tempTotalAmount); publisherWalletFlowVO.setSalaryAmount(tempTotalAmount);
requirementsInfoDO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO; tempTotalAmount = BigDecimal.ZERO;
} else { } else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt); tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
publisherWalletFlowVO.setSalaryAmount(salaryAmt); publisherWalletFlowVO.setSalaryAmount(salaryAmt);
requirementsInfoDO.setSalaryAmount(salaryAmt);
} }
} }
...@@ -1794,6 +1808,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1794,6 +1808,7 @@ public class RequirementsServiceImpl implements RequirementsService {
case "3": case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) { if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
requirementsInfoDO.setWeChat(tempTotalAmount); requirementsInfoDO.setWeChat(tempTotalAmount);
requirementsInfoDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO; tempTotalAmount = BigDecimal.ZERO;
} }
break; break;
...@@ -1984,16 +1999,17 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1984,16 +1999,17 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) { if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了 //表示订单计算完成,需要支付的钱都算出来了
System.out.println(flyerWalletFlowVO); // System.out.println(flyerWalletFlowVO);
System.out.println(requirementsServiceDO); // System.out.println(requirementsServiceDO);
flyerWalletFlowVO.setUserAccountId(grabTheOrderVO.getUserAccountId()); flyerWalletFlowVO.setUserAccountId(grabTheOrderVO.getUserAccountId());
flyerWalletFlowVO.setOperateUserAccountId(grabTheOrderVO.getUserAccountId()); flyerWalletFlowVO.setOperateUserAccountId(grabTheOrderVO.getUserAccountId());
// requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount()); // requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
// requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount()); // requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
requirementsServiceDO.setWeChat(orderNumberDTO.getWeChatPay()); if (orderNumberDTO != null) {
requirementsServiceDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber()); requirementsServiceDO.setWeChat(orderNumberDTO.getWeChatPay());
requirementsServiceDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber());
}
// BigDecimal cashAndSalaryAmount = walletFlowVO.getCashAmount().add(walletFlowVO.getSalaryAmount()); // BigDecimal cashAndSalaryAmount = walletFlowVO.getCashAmount().add(walletFlowVO.getSalaryAmount());
// BigDecimal preemptTotalAmount = cashAndSalaryAmount.add(orderNumberDTO.getWeChatPay()); // BigDecimal preemptTotalAmount = cashAndSalaryAmount.add(orderNumberDTO.getWeChatPay());
// requirementsServiceDO.setPreemptTotalAmount(preemptTotalAmount); // requirementsServiceDO.setPreemptTotalAmount(preemptTotalAmount);
......
...@@ -4,6 +4,51 @@ ...@@ -4,6 +4,51 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.csf.release.dao.BackRequirementsDao"> <mapper namespace="com.mmc.csf.release.dao.BackRequirementsDao">
<resultMap id="serviceDetails" type="com.mmc.csf.release.entity.requirements.ServiceOrderFormDetailsDO">
<result property="id" column="id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="serviceId" column="service_id"/>
<result property="serviceName" column="service_name"/>
<result property="publisherNumber" column="publisher_number"/>
<result property="orderAmount" column="order_amount"/>
<result property="taskStartTime" column="task_start_time"/>
<result property="taskEndTime" column="task_end_time"/>
<result property="taskAddress" column="task_address"/>
<result property="latitude" column="latitude"/>
<result property="longitude" column="longitude"/>
<result property="salaryAmount" column="salary_amount"/>
<result property="weChat" column="we_chat"/>
<result property="preemptCashAmount" column="preemptCashAmount"/>
<result property="preemptSalaryAmount" column="preemptSalaryAmount"/>
<result property="preemptWeChat" column="preemptWeChat"/>
<result property="updateOrderAmount" column="update_order_amount"/>
<result property="requireDescription" column="require_description"/>
<result property="orderStatus" column="order_status"/>
<result property="doing" column="doing"/>
<collection property="orderEarningsDTO" ofType="com.mmc.csf.infomation.dto.PlatformOrderEarningsDTO"
select="selectOrderEarnings"
column="{requirementsInfoId=id}">
</collection>
</resultMap>
<select id="selectOrderEarnings" resultType="com.mmc.csf.infomation.dto.PlatformOrderEarningsDTO">
SELECT poe.id,
poe.order_amount,
poe.liquidated_damages,
poe.requirements_info_id,
poe.create_time,
poe.update_time,
poe.user_account_id,
ra.order_level_amount,
ra.order_level_amount
FROM platform_order_earnings poe
LEFT JOIN requirements_amount ra ON poe.requirements_info_id = ra.id
where poe.requirements_info_id = #{requirementsInfoId}
</select>
<select id="serviceOrderFormList" resultType="com.mmc.csf.release.entity.requirements.ServiceOrderFormDO"> <select id="serviceOrderFormList" resultType="com.mmc.csf.release.entity.requirements.ServiceOrderFormDO">
SELECT SELECT
ri.id, ri.id,
...@@ -61,7 +106,7 @@ ...@@ -61,7 +106,7 @@
</if> </if>
</select> </select>
<select id="serviceOrderFormDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceOrderFormDetailsDO"> <select id="serviceOrderFormDetails" resultMap="serviceDetails">
SELECT ri.id, SELECT ri.id,
ri.create_time, ri.create_time,
ri.update_time, ri.update_time,
...@@ -77,10 +122,10 @@ ...@@ -77,10 +122,10 @@
ra.cash_amount, ra.cash_amount,
ra.salary_amount, ra.salary_amount,
ra.we_chat, ra.we_chat,
rs.cash_amount AS preemptCashAmount, rs.cash_amount AS preemptCashAmount,
rs.salary_amount AS preemptSalaryAmount, rs.salary_amount AS preemptSalaryAmount,
rs.we_chat AS preemptWeChat, rs.we_chat AS preemptWeChat,
ra.update_order_amount AS updateOrderAmount, ra.update_order_amount,
ri.require_description, ri.require_description,
sf.order_status, sf.order_status,
sf.doing sf.doing
......
...@@ -104,6 +104,19 @@ ...@@ -104,6 +104,19 @@
set is_solved = 1 set is_solved = 1
where id = #{requirementsInfoId} where id = #{requirementsInfoId}
</update> </update>
<update id="updateRequirementsAmount">
update requirements_amount
set order_earnings=#{orderEarnings}
where requirements_info_id = #{id}
</update>
<update id="updateAmounts">
update requirements_amount
set order_earnings=#{orderEarnings}
where requirements_info_id = #{requirementsInfoId}
</update>
<update id="updateRequirementsInfo" parameterType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO"> <update id="updateRequirementsInfo" parameterType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
update requirements_info update requirements_info
<set> <set>
...@@ -432,11 +445,11 @@ ...@@ -432,11 +445,11 @@
INSERT INTO requirements_amount(requirements_info_id, user_account_id, create_time, update_time, order_amount, INSERT INTO requirements_amount(requirements_info_id, user_account_id, create_time, update_time, order_amount,
total_amount, order_level_amount, order_level, cash_amount, we_chat, total_amount, order_level_amount, order_level, cash_amount, we_chat,
salary_amount, wechat_pay_order_number, level_cash_amount, salary_amount, wechat_pay_order_number, level_cash_amount,
level_we_chat_amount, level_salary_amount) level_we_chat_amount, level_salary_amount, order_earnings)
VALUES (#{requirementsInfoId}, #{userAccountId}, NOW(), NOW(), #{orderAmount}, VALUES (#{requirementsInfoId}, #{userAccountId}, NOW(), NOW(), #{orderAmount},
#{totalAmount}, #{orderLevelAmount}, #{orderLevel}, #{cashAmount}, #{weChat}, #{totalAmount}, #{orderLevelAmount}, #{orderLevel}, #{cashAmount}, #{weChat},
#{salaryAmount}, #{wechatPayOrderNumber}, #{levelCashAmount}, #{levelWeChatAmount}, #{salaryAmount}, #{wechatPayOrderNumber}, #{levelCashAmount}, #{levelWeChatAmount},
#{levelSalaryAmount}); #{levelSalaryAmount}, #{orderLevelAmount});
</insert> </insert>
<select id="grabTheOrder" resultType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO"> <select id="grabTheOrder" resultType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO">
...@@ -764,7 +777,8 @@ ...@@ -764,7 +777,8 @@
rs.preempt_total_amount, rs.preempt_total_amount,
rs.service_flow_id, rs.service_flow_id,
ra.order_amount, ra.order_amount,
ri.openid ri.openid,
ra.order_earnings
FROM requirements_info ri FROM requirements_info ri
LEFT JOIN requirements_type rt LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id ON rt.id = ri.requirement_type_id
...@@ -813,7 +827,8 @@ ...@@ -813,7 +827,8 @@
rs.pilot_certification_user_id, rs.pilot_certification_user_id,
rs.openid as flyerOpenid, rs.openid as flyerOpenid,
ri.create_time, ri.create_time,
ra.order_level_amount ra.order_level_amount,
ra.order_earnings
FROM requirements_info ri FROM requirements_info ri
LEFT JOIN requirements_type rt LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id ON rt.id = ri.requirement_type_id
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论