提交 9bf5a5f9 作者: 张小凤

ServiceSettleAccountsVO(update)

上级 2f9ea870
......@@ -19,6 +19,10 @@ import javax.validation.constraints.NotNull;
@AllArgsConstructor
@NoArgsConstructor
public class MyPreemptQO {
@ApiModelProperty(value = "需求id(不需要就不要传此字段)", required = true, example = "1")
private Integer requirementsInfoId;
@ApiModelProperty(value = "当前页", required = true, example = "1")
@NotNull(message = "当前页不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
......
......@@ -19,6 +19,10 @@ import javax.validation.constraints.NotNull;
@AllArgsConstructor
@NoArgsConstructor
public class MyPublishQO {
@ApiModelProperty(value = "需求id不需要就不要传此字段 对应的是 ", required = true, example = "1")
private Integer requirementsInfoId;
@ApiModelProperty(value = "当前页", required = true, example = "1")
@NotNull(message = "当前页不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
......
......@@ -31,7 +31,7 @@ public class ServiceSettleAccountsVO implements Serializable {
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
@ApiModelProperty(value = "结算的用户", example = "1", hidden = true)
private Integer userAccountId;
......
......@@ -200,7 +200,7 @@ public class RequirementsController extends BaseController {
@PostMapping("settleAccounts")
public ResultBody settleAccounts(HttpServletRequest request, @RequestBody @Validated(value = {Insert.class}) ServiceSettleAccountsVO settleAccountsVO) {
settleAccountsVO.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return requirementsService.settleAccounts(settleAccountsVO);
return requirementsService.settleAccounts(settleAccountsVO, request);
}
......
......@@ -4,6 +4,7 @@ import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.qo.MyPreemptQO;
import com.mmc.csf.infomation.qo.MyPublishQO;
import com.mmc.csf.infomation.vo.ServiceSettleAccountsVO;
import com.mmc.csf.release.entity.requirements.*;
import org.apache.ibatis.annotations.Mapper;
......@@ -147,4 +148,8 @@ public interface RequirementsDao {
ServiceSettleAccountsDTO settleAccountsDTO(Integer requirementsInfoId);
ServiceEvaluateDTO serviceEvaluateDTO(Integer requirementsInfoId);
RequirementsInfoDO selectSettleAccounts(ServiceSettleAccountsVO settleAccountsVO);
RequirementsServiceDO serviceSettleAccounts(ServiceSettleAccountsVO settleAccountsVO);
}
......@@ -82,7 +82,7 @@ public interface RequirementsService {
ResultBody<ServiceFulfilATaskDTO> fulfilATaskDetails(Integer requirementsInfoId, Integer userAccountId);
ResultBody settleAccounts(ServiceSettleAccountsVO settleAccountsVO);
ResultBody settleAccounts(ServiceSettleAccountsVO settleAccountsVO, HttpServletRequest request);
ResultBody<ServiceSettleAccountsDTO> settleAccountsDetails(Integer requirementsInfoId, Integer userAccountId);
......
......@@ -1022,10 +1022,9 @@ public class RequirementsServiceImpl implements RequirementsService {
applyRefundVO.setRefund(longWeChat);
applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber());
applyRefundVO.setReason("退发布者微信支付的任务佣金");
applyRefund(applyRefundVO, "");
feignApplyRefund(applyRefundVO, "");
}
requirementsDao.updateInfo(requirementsInfoDO.getId(), 7);
}
......@@ -1241,7 +1240,7 @@ public class RequirementsServiceImpl implements RequirementsService {
//requirementsInfoDO.setLevelCashAmount(cashAmt);
if (rushAndTop.compareTo(cashAmt) == 1) {
publisherWalletFlowVO.setTopYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(tempTotalAmount);
requirementsInfoDO.setLevelCashAmount(cashAmt);
} else if (rushAndTop.compareTo(cashAmt) == -1) {
// userCashAmt = cashAmt.subtract(rushAndTop);
publisherWalletFlowVO.setTopYxjAmount(rushAndTop);
......@@ -1602,6 +1601,7 @@ public class RequirementsServiceImpl implements RequirementsService {
BigDecimal add = cashAmount.add(salaryAmount);
BigDecimal add1 = add.add(weChat);
requirementsServiceDO.setPreemptTotalAmount(add1);
requirementsServiceDO.setOpenid(openid);
requirementsDao.insertService(requirementsServiceDO);
requirementsInfoDO.setRepertory(repertory - 1);
requirementsDao.updateGrabTheOrder(grabTheOrderVO.getRequirementsInfoId(), requirementsInfoDO.getRepertory());
......@@ -1669,12 +1669,65 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override
public ResultBody settleAccounts(ServiceSettleAccountsVO settleAccountsVO) {
public ResultBody settleAccounts(ServiceSettleAccountsVO settleAccountsVO, HttpServletRequest request) {
RequirementsInfoDO infoDO = requirementsDao.selectSettleAccounts(settleAccountsVO);
RequirementsServiceDO requirementsServiceDO = requirementsDao.serviceSettleAccounts(settleAccountsVO);
IsNullConvertZeroUtil.checkIsNull(infoDO);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
ServiceSettleAccountsDO settleAccountsDO = new ServiceSettleAccountsDO(settleAccountsVO);
requirementsDao.settleAccounts(settleAccountsDO);
requirementsDao.updateScene(settleAccountsVO.getRequirementsInfoId(), 5);
requirementsDao.updateInfo(settleAccountsVO.getRequirementsInfoId(), 5);
//正常结算
WalletFlowVO walletFlowVO = new WalletFlowVO();
PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//给发布者发送
BigDecimal orderAmount = infoDO.getOrderAmount();
BigDecimal bigDecimal = new BigDecimal(0.9);
BigDecimal bigDecimal1 = orderAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
publisherWalletFlowVO.setModeOfPayment(700);
publisherWalletFlowVO.setFlyerSalaryAmount(bigDecimal1);
publisherWalletFlowVO.setCashAmount(infoDO.getCashAmount().negate());
publisherWalletFlowVO.setSalaryAmount(infoDO.getSalaryAmount().negate());
publisherWalletFlowVO.setUserAccountId(settleAccountsVO.getUserAccountId());
publisherWalletFlowVO.setOperateUserAccountId(settleAccountsVO.getUserAccountId());
if ("TOP_ORDER".equals(infoDO.getOrderLevel())) {
publisherWalletFlowVO.setTopYxjAmount(infoDO.getLevelCashAmount().negate());
publisherWalletFlowVO.setTopSalaryAmount(infoDO.getLevelSalaryAmount().negate());
} else if ("RUSH_ORDER".equals(infoDO.getOrderLevel())) {
publisherWalletFlowVO.setUrgentYxjAmount(infoDO.getLevelCashAmount().negate());
publisherWalletFlowVO.setUrgentSalaryAmount(infoDO.getLevelSalaryAmount().negate());
}
//退飞手钱
flyerWalletFlowVO.setModeOfPayment(700);
flyerWalletFlowVO.setCashAmount(requirementsServiceDO.getCashAmount());
flyerWalletFlowVO.setSalaryAmount(requirementsServiceDO.getSalaryAmount());
flyerWalletFlowVO.setUserAccountId(requirementsServiceDO.getPilotCertificationUserId());
flyerWalletFlowVO.setOperateUserAccountId(settleAccountsVO.getUserAccountId());
ApplyRefundVO applyRefundVO = new ApplyRefundVO();
if (requirementsServiceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0) {
applyRefundVO.setReason("原路退回");
applyRefundVO.setOutTradeNo(requirementsServiceDO.getWechatPayOrderNumber());
BigDecimal weChat = requirementsServiceDO.getWeChat();
BigDecimal decimal = new BigDecimal(100);
long longValueWeChat = weChat.multiply(new BigDecimal(100)).longValue();
applyRefundVO.setRefund(longValueWeChat);
applyRefund(applyRefundVO, request.getHeader("token"));
}
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
flyerCancel(walletFlowVO, request.getHeader("token"));
return ResultBody.success();
}
......@@ -1727,6 +1780,24 @@ public class RequirementsServiceImpl implements RequirementsService {
/**
* 不带token 退款
*/
public ResultBody feignApplyRefund(ApplyRefundVO applyRefundVO, String token) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(applyRefundVO), headers);
ResponseEntity<Object> exchange = null;
try {
exchange = restTemplate.exchange(paymentApp + "/payment/wechat/applyRefund", HttpMethod.POST, entity, Object.class);
} catch (RestClientException e) {
return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
return ResultBody.success();
}
/**
* 退款
*/
public ResultBody applyRefund(ApplyRefundVO applyRefundVO, String token) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论