提交 408e1895 作者: 恶龙咆哮

Merge branch 'develop'

package com.mmc.csf.infomation.dto;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author 张培
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AgreePilotOrderDTO {
@ApiModelProperty(value = "订单id")
private Integer requirementsInfoId;
@ApiModelProperty(value = "状态")
private Integer serviceFlowId;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private FlowDictionaryDTO flowDictionaryDTO;
}
...@@ -27,6 +27,8 @@ public class FlowDictionaryAndTimeDTO implements Serializable { ...@@ -27,6 +27,8 @@ public class FlowDictionaryAndTimeDTO implements Serializable {
@ApiModelProperty(value = "抢单", example = "抢单") @ApiModelProperty(value = "抢单", example = "抢单")
private RequirementsServiceDTO requirementsServiceDTO; private RequirementsServiceDTO requirementsServiceDTO;
@ApiModelProperty(value = "需求方同意", example = "需求方同意")
private AgreePilotOrderDTO agreePilotOrderDTO;
//抵达现场地址 //抵达现场地址
// service_arrive_scene // service_arrive_scene
@ApiModelProperty(value = "抵达现场", example = "抵达现场") @ApiModelProperty(value = "抵达现场", example = "抵达现场")
......
package com.mmc.csf.infomation.qo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 张培
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AgreeOrRefusePilotQO {
@ApiModelProperty(value = "订单id")
private Integer requireInfoId;
@ApiModelProperty(value = "同意传2 进入飞手到达现场 拒绝传 11")
private Integer serviceFlowId;
@ApiModelProperty(value = "接单飞手的user_id")
private Integer pilotCertificationUserId;
}
...@@ -51,5 +51,7 @@ public class GrabTheOrderVO { ...@@ -51,5 +51,7 @@ public class GrabTheOrderVO {
@ApiModelProperty(value = "手机号", hidden = true) @ApiModelProperty(value = "手机号", hidden = true)
private String phoneNum; private String phoneNum;
@ApiModelProperty(value = "订单需求总人数")
private Integer requireNum;
} }
package com.mmc.csf.infomation.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 张培
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OnlyRequirementsInfoId {
@ApiModelProperty(value = "订单id")
private Integer requirementsInfoId;
}
...@@ -64,6 +64,8 @@ public class RequirementsInfoVO implements Serializable { ...@@ -64,6 +64,8 @@ public class RequirementsInfoVO implements Serializable {
@ApiModelProperty(value = "任务纬度", example = "44.344324") @ApiModelProperty(value = "任务纬度", example = "44.344324")
private Double latitude; private Double latitude;
@ApiModelProperty(value = "订单的父订单id")
private Integer fatherRequireId;
@ApiModelProperty(value = "需求描述", example = "描述一下", required = true) @ApiModelProperty(value = "需求描述", example = "描述一下", required = true)
@NotNull(message = "需求描述不能为空", groups = {Insert.class}) @NotNull(message = "需求描述不能为空", groups = {Insert.class})
...@@ -183,4 +185,10 @@ public class RequirementsInfoVO implements Serializable { ...@@ -183,4 +185,10 @@ public class RequirementsInfoVO implements Serializable {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;
@ApiModelProperty(value = "还剩多少人可以抢单")
private Integer repertory;
@ApiModelProperty(value = "订单共需多少人")
private Integer requireNum;
} }
...@@ -113,4 +113,8 @@ public class ServiceRequirementsVO implements Serializable { ...@@ -113,4 +113,8 @@ public class ServiceRequirementsVO implements Serializable {
@ApiModelProperty(value = "区编码", required = false) @ApiModelProperty(value = "区编码", required = false)
private Integer districtCode; private Integer districtCode;
@ApiModelProperty(value = "订单总共需要多少人")
private Integer requireNum;
} }
...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/ims newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/ims
newTag: 5b768dd050a69db88baacd372d9ebf0fb137f30a newTag: 97386bd54f4c23cce1e94e1ed1602aaa7512b695
...@@ -2,6 +2,7 @@ package com.mmc.csf.release.controller; ...@@ -2,6 +2,7 @@ package com.mmc.csf.release.controller;
import com.mmc.csf.common.util.web.ResultBody; import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.infomation.dto.*; import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.AgreeOrRefusePilotQO;
import com.mmc.csf.infomation.qo.IndustryCaseQO; import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.qo.MyPreemptQO; import com.mmc.csf.infomation.qo.MyPreemptQO;
import com.mmc.csf.infomation.qo.MyPublishQO; import com.mmc.csf.infomation.qo.MyPublishQO;
...@@ -13,6 +14,7 @@ import com.mmc.csf.release.model.group.Page; ...@@ -13,6 +14,7 @@ import com.mmc.csf.release.model.group.Page;
import com.mmc.csf.release.model.group.Update; import com.mmc.csf.release.model.group.Update;
import com.mmc.csf.release.service.RequirementsService; import com.mmc.csf.release.service.RequirementsService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -358,5 +360,19 @@ public class RequirementsController extends BaseController { ...@@ -358,5 +360,19 @@ public class RequirementsController extends BaseController {
return requirementsService.deleteRequire(requirementsInfoId, this.getUserLoginInfoFromRedis(request).getUserAccountId()); return requirementsService.deleteRequire(requirementsInfoId, this.getUserLoginInfoFromRedis(request).getUserAccountId());
} }
@ApiOperation(value = "小程序—获取子订单详细信息")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("selectRequireSonInfo")
public ResultBody<RequirementsInfoVO> selectRequireSonInfo(HttpServletRequest request, @Validated(value = {Page.class}) @ApiParam(value = "查询所有子订单信息", required = true) @RequestBody MyPublishQO param){
return ResultBody.success(requirementsService.selectRequireSonInfo(this.getUserLoginInfoFromRedis(request).getUserAccountId(), param));
}
@ApiOperation(value = "小程序—发单方(同意/拒绝)该飞手")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("agreeOrRefusePilot")
public ResultBody agreeOrRefusePilot(@RequestBody AgreeOrRefusePilotQO param) {
return requirementsService.agreeOrRefusePilot(param);
}
} }
package com.mmc.csf.release.dao; package com.mmc.csf.release.dao;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.infomation.dto.*; import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.AgreeOrRefusePilotQO;
import com.mmc.csf.infomation.qo.IndustryCaseQO; import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.qo.MyPreemptQO; import com.mmc.csf.infomation.qo.MyPreemptQO;
import com.mmc.csf.infomation.qo.MyPublishQO; import com.mmc.csf.infomation.qo.MyPublishQO;
...@@ -85,6 +87,9 @@ public interface RequirementsDao { ...@@ -85,6 +87,9 @@ public interface RequirementsDao {
void addPublishService(ServiceRequirementsDO requirementsInfoDO); void addPublishService(ServiceRequirementsDO requirementsInfoDO);
void addPublishServiceSon(ServiceRequirementsSonDO serviceRequirementsSonDO);
ServiceRequirementsDO grabTheOrder(Integer requirementsInfoId); ServiceRequirementsDO grabTheOrder(Integer requirementsInfoId);
void updateGrabTheOrder(Integer requirementsInfoId, Integer repertory); void updateGrabTheOrder(Integer requirementsInfoId, Integer repertory);
...@@ -158,6 +163,8 @@ public interface RequirementsDao { ...@@ -158,6 +163,8 @@ public interface RequirementsDao {
ServiceArriveSceneDTO serviceArriveSceneDTO(Integer requirementsInfoId); ServiceArriveSceneDTO serviceArriveSceneDTO(Integer requirementsInfoId);
AgreePilotOrderDTO serviceAgreePilotOrderDTO(Integer requirementsInfoId);
ServiceFulfilATaskDTO serviceFulfilATaskDTO(Integer requirementsInfoId); ServiceFulfilATaskDTO serviceFulfilATaskDTO(Integer requirementsInfoId);
ServiceSettleAccountsDTO settleAccountsDTO(Integer requirementsInfoId); ServiceSettleAccountsDTO settleAccountsDTO(Integer requirementsInfoId);
...@@ -217,4 +224,101 @@ public interface RequirementsDao { ...@@ -217,4 +224,101 @@ public interface RequirementsDao {
BigDecimal getServiceOrderAmount(); BigDecimal getServiceOrderAmount();
/**
* 根据父订单获取子订单中没被抢的id
* @param fatherRequireId 父订单id
* @return {@link Integer} 没被抢的子订单id 只返回一个
*/
Integer getRequirementsSonInfoId(Integer fatherRequireId);
/**
* 修改父订单中还需多少人字段
* @param fatherRequireId 父订单id
* @param fatherRepertory 还需多少人
* @return {@link Integer}
*/
Integer updateRequirementsInfoRepertory(Integer fatherRequireId,Integer fatherRepertory);
/**
* 查找用户有没有已经抢过这个多人订单了
* @param fatherRequireId 父订单id
* @param userId 抢单用户id
* @return {@link Integer}1 就是已经抢过这个订单了 0 就是没抢过
*/
Integer selectBooleanByFatherIdAndUserId(Integer fatherRequireId,Integer userId);
/**
* 根据父订单id 查找所有子订单信息
* @param param 父订单id
* @return {@link List}<{@link RequirementsInfoDO}>
*/
List<RequirementsInfoDO> selectRequireSonInfo(MyPublishQO param);
/**
* 保存飞手被同意或拒绝接单信息
* @param param 是否同意飞手信息
*/
void insertAgreePilotOrder(AgreeOrRefusePilotQO param);
/**
* 根据订单id修改所需人数以及该订单的状态
* @param requireInfoId 订单id
*/
void updateRequirementsInfoByRefusePilot(Integer requireInfoId);
/**
* 根据订单查找父订单id
* @param requireInfoId 订单id
* @return {@link Integer}
*/
Integer selectFatherRequireIdBySonId(Integer requireInfoId);
/**
* 根据订单id查找该订单还需人数
* @param requireInfoId 订单id
* @return {@link Integer}
*/
Integer selectRepertoryByRequireId(Integer requireInfoId);
/**
* 根据订单id和飞手用户id删除接单的信息
* @param requireInfoId 订单id
* @param pilotUserId 飞手id
* @return {@link Integer}
*/
Integer updateRequirementsService(Integer requireInfoId,Integer pilotUserId);
/**
* 根据订单id和飞手用户id查询该飞手是被拒绝还是同意
* @param requirementsId 订单id 对应requirement_info表的id
* @param userAccountId 用户的id
* @return {@link Integer} 2 就是同意 11 是拒绝
*/
Integer selectServiceIdByRequireIdAndUserId(Integer requirementsId,Integer userAccountId);
/**
* 根绝订单id获取所需总人数
* @param requirementsId 订单id
* @return {@link Integer}
*/
Integer selectRequirementsNum(Integer requirementsId);
/**
* 根据父订单id查询不满足状态条件的子订单数量
* @param requirementsId 父订单id
* @return {@link Integer}
*/
Integer selectServiceFlowIdByFatherId(Integer requirementsId);
/**
* 去抢单表中查看用户是否被拒绝过
* @param requireId 订单的id
* @param userAccountId 抢单飞手的用户id
* @return {@link Integer}
*/
Integer selectRequirementsRefuse(Integer requireId,Integer userAccountId);
} }
...@@ -98,6 +98,22 @@ public class RequirementsAmountDO implements Serializable { ...@@ -98,6 +98,22 @@ public class RequirementsAmountDO implements Serializable {
this.levelWeChatAmount = requirementsInfoDO.getLevelWeChatAmount(); this.levelWeChatAmount = requirementsInfoDO.getLevelWeChatAmount();
this.levelCashAmount = requirementsInfoDO.getLevelCashAmount(); this.levelCashAmount = requirementsInfoDO.getLevelCashAmount();
} }
public RequirementsAmountDO(ServiceRequirementsSonDO requirementsInfoDO) {
this.requirementsInfoId = requirementsInfoDO.getId();
this.orderAmount = requirementsInfoDO.getOrderAmount();
this.totalAmount = requirementsInfoDO.getTotalAmount();
this.orderLevelAmount = requirementsInfoDO.getOrderLevelAmount();
this.orderLevel = requirementsInfoDO.getOrderLevel();
this.weChat = requirementsInfoDO.getWeChat();
this.salaryAmount = requirementsInfoDO.getSalaryAmount();
this.wechatPayOrderNumber = requirementsInfoDO.getWechatPayOrderNumber();
this.userAccountId = requirementsInfoDO.getUserAccountId();
this.cashAmount = requirementsInfoDO.getCashAmount();
this.levelSalaryAmount = requirementsInfoDO.getLevelSalaryAmount();
this.levelWeChatAmount = requirementsInfoDO.getLevelWeChatAmount();
this.levelCashAmount = requirementsInfoDO.getLevelCashAmount();
}
public RequirementsAmountDO(ServiceRequirementsEditVO requirementsEditVO) { public RequirementsAmountDO(ServiceRequirementsEditVO requirementsEditVO) {
this.orderAmount = requirementsEditVO.getOrderAmount(); this.orderAmount = requirementsEditVO.getOrderAmount();
......
...@@ -93,6 +93,9 @@ public class RequirementsInfoDO implements Serializable { ...@@ -93,6 +93,9 @@ public class RequirementsInfoDO implements Serializable {
@ApiModelProperty(value = "允许几人抢单", example = "允许几人抢单") @ApiModelProperty(value = "允许几人抢单", example = "允许几人抢单")
private Integer repertory; private Integer repertory;
@ApiModelProperty(value = "任务所需总人数")
private Integer requireNum;
private String insurance; private String insurance;
private String doing; private String doing;
...@@ -177,6 +180,8 @@ public class RequirementsInfoDO implements Serializable { ...@@ -177,6 +180,8 @@ public class RequirementsInfoDO implements Serializable {
@ApiModelProperty(value = "发布者openid") @ApiModelProperty(value = "发布者openid")
private String openid; private String openid;
@ApiModelProperty(value = "订单的父订单id")
private Integer fatherRequireId;
public RequirementsInfoVO buildRequirementsInfoVO() { public RequirementsInfoVO buildRequirementsInfoVO() {
...@@ -191,6 +196,7 @@ public class RequirementsInfoDO implements Serializable { ...@@ -191,6 +196,7 @@ public class RequirementsInfoDO implements Serializable {
.requireUrl(this.requireUrl) .requireUrl(this.requireUrl)
.orderLevelEnum(this.orderLevel) .orderLevelEnum(this.orderLevel)
.serviceId(this.serviceId) .serviceId(this.serviceId)
.fatherRequireId(this.fatherRequireId)
.serviceName(this.serviceName) .serviceName(this.serviceName)
.totalAmount(this.totalAmount) .totalAmount(this.totalAmount)
.insurance(this.insurance) .insurance(this.insurance)
...@@ -211,6 +217,8 @@ public class RequirementsInfoDO implements Serializable { ...@@ -211,6 +217,8 @@ public class RequirementsInfoDO implements Serializable {
.preemptPhone(this.preemptPhone) .preemptPhone(this.preemptPhone)
.pilotCertificationId(this.pilotCertificationId) .pilotCertificationId(this.pilotCertificationId)
.createTime(this.createTime) .createTime(this.createTime)
.repertory(this.repertory)
.requireNum(this.requireNum)
.build(); .build();
} }
......
...@@ -145,6 +145,8 @@ public class ServiceRequirementsDO { ...@@ -145,6 +145,8 @@ public class ServiceRequirementsDO {
@ApiModelProperty(value = "服务名称") @ApiModelProperty(value = "服务名称")
private String serviceName; private String serviceName;
@ApiModelProperty(value = "订单总共所需多少人")
private Integer requireNum;
public ServiceRequirementsDO(ServiceRequirementsVO serviceRequirementsVO) { public ServiceRequirementsDO(ServiceRequirementsVO serviceRequirementsVO) {
this.id = serviceRequirementsVO.getId(); this.id = serviceRequirementsVO.getId();
...@@ -172,5 +174,8 @@ public class ServiceRequirementsDO { ...@@ -172,5 +174,8 @@ public class ServiceRequirementsDO {
this.provinceCode = serviceRequirementsVO.getProvinceCode(); this.provinceCode = serviceRequirementsVO.getProvinceCode();
this.cityCode = serviceRequirementsVO.getCityCode(); this.cityCode = serviceRequirementsVO.getCityCode();
this.districtCode = serviceRequirementsVO.getDistrictCode(); this.districtCode = serviceRequirementsVO.getDistrictCode();
this.requireNum = serviceRequirementsVO.getRequireNum();
} }
} }
package com.mmc.csf.release.entity.requirements;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mmc.csf.config.IsNullConvertZero;
import com.mmc.csf.infomation.vo.OrderLevelEnum;
import com.mmc.csf.release.model.group.Insert;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
/**
* @author 张培
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServiceRequirementsSonDO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "id")
@NotBlank(message = "服务类型id不能为空", groups = {Insert.class, Update.class})
private Integer serviceId;
@ApiModelProperty(value = "飞行日期——任务开始时间", example = "2023-07-25", required = true)
@NotNull(message = "任务开始时间不能为空", groups = {Insert.class, Update.class})
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date taskStartTime;
@ApiModelProperty(value = "飞行日期——任务结束时间", example = "2023-07-26", required = true)
@NotNull(message = "任务开始时间不能为空", groups = {Insert.class, Update.class})
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date taskEndTime;
@ApiModelProperty(value = "飞行位置——任务地址", example = "广东省深圳市", required = true)
@NotBlank(message = "任务地址不能为空", groups = {Insert.class, Update.class})
private String taskAddress;
@ApiModelProperty(value = "飞行位置——任务经度", example = "23.344324")
private Double longitude;
@ApiModelProperty(value = "飞行位置——任务纬度", example = "44.344324")
private Double latitude;
@ApiModelProperty(value = "省份编码", required = false)
//@NotNull(message = "省份编码不能为空", groups = {Insert.class})
private Integer provinceCode;
@ApiModelProperty(value = "市编码", required = false)
private Integer cityCode;
@ApiModelProperty(value = "区编码", required = false)
private Integer districtCode;
@ApiModelProperty(value = "需求描述", example = "描述一下", required = true)
@NotNull(message = "需求描述不能为空", groups = {Insert.class})
@Length(max = 300, message = "字符过长")
private String requireDescription;
@ApiModelProperty(value = "订单金额", example = "订单金额", required = true)
@NotNull(message = "订单金额", groups = {Insert.class})
@IsNullConvertZero
private BigDecimal orderAmount;
@ApiModelProperty(value = "飞手保险", example = "飞手保险", required = true)
@NotNull(message = "飞手保险", groups = {Insert.class})
private String insurance;
@ApiModelProperty(value = "订单级别", example = "订单级别", required = true)
@NotNull(message = "订单级别", groups = {Insert.class})
private OrderLevelEnum orderLevelEnum;
@ApiModelProperty(value = "后台获取token里面的用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "发布者姓名", example = "张三")
private String publishName;
@ApiModelProperty(value = "发布者电话", example = "1892994543", required = true)
@NotNull(message = "发布者电话不能为空", groups = {Insert.class})
private String publishPhone;
@ApiModelProperty(value = "发布者订单编号")
private String publisherNumber;
@ApiModelProperty(value = "0普通 100急单 300置顶")
@IsNullConvertZero
private BigDecimal orderLevelAmount;
@ApiModelProperty(value = "订单级别 REGULAR_ORDER,RUSH_ORDER,TOP_ORDER")
private String orderLevel;
@ApiModelProperty(value = "总金额", example = "100", required = true)
@NotNull(message = "总金额", groups = {Insert.class})
@IsNullConvertZero
private BigDecimal totalAmount;
@ApiModelProperty(value = "云享金", example = "10")
@IsNullConvertZero
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10")
@IsNullConvertZero
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信金额", example = "10")
@IsNullConvertZero
private BigDecimal weChat;
@ApiModelProperty(value = "微信支付订单编号", example = "R202308191657303116170")
private String wechatPayOrderNumber;
private Integer repertory;
@ApiModelProperty(value = "支付方式,云享金:1,佣金:2,微信支付:3", example = "1,2,3")
private String paymentType;
@ApiModelProperty(value = "地区编码")
private String adcode;
@IsNullConvertZero
@ApiModelProperty(value = "置顶/加急 佣金支付多少", example = "100")
private BigDecimal levelSalaryAmount;
@ApiModelProperty(value = "置顶/加急 微信支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelWeChatAmount;
@ApiModelProperty(value = "置顶/加急 云享金支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelCashAmount;
@ApiModelProperty(value = "openid")
private String openid;
@ApiModelProperty(value = "服务名称")
private String serviceName;
@ApiModelProperty(value = "订单总共所需多少人")
private Integer requireNum;
@ApiModelProperty(value = "上级订单id")
private Integer fatherRequireId;
public ServiceRequirementsSonDO(ServiceRequirementsDO serviceRequirementsDO) {
BigDecimal decimalSum = new BigDecimal(serviceRequirementsDO.getRequireNum());
this.serviceId = serviceRequirementsDO.getServiceId();
this.taskStartTime = serviceRequirementsDO.getTaskStartTime();
this.taskEndTime = serviceRequirementsDO.getTaskEndTime();
this.taskAddress = serviceRequirementsDO.getTaskAddress();
this.longitude = serviceRequirementsDO.getLongitude();
this.latitude = serviceRequirementsDO.getLatitude();
this.provinceCode = serviceRequirementsDO.getProvinceCode();
this.cityCode = serviceRequirementsDO.getCityCode();
this.districtCode = serviceRequirementsDO.getDistrictCode();
this.requireDescription = serviceRequirementsDO.getRequireDescription();
this.orderAmount = serviceRequirementsDO.getOrderAmount().divide(decimalSum,2, RoundingMode.HALF_UP);
this.insurance = serviceRequirementsDO.getInsurance();
this.orderLevelEnum = serviceRequirementsDO.getOrderLevelEnum();
this.userAccountId = serviceRequirementsDO.getUserAccountId();
this.publishName = serviceRequirementsDO.getPublishName();
this.publishPhone = serviceRequirementsDO.getPublishPhone();
this.publisherNumber = serviceRequirementsDO.getPublisherNumber();
this.orderLevelAmount = serviceRequirementsDO.getOrderLevelAmount();
this.orderLevel = serviceRequirementsDO.getOrderLevel();
this.totalAmount = serviceRequirementsDO.getTotalAmount().divide(decimalSum,2,RoundingMode.HALF_UP);
this.cashAmount = serviceRequirementsDO.getCashAmount().divide(decimalSum,2,RoundingMode.HALF_UP);
this.salaryAmount = serviceRequirementsDO.getSalaryAmount().divide(decimalSum,2,RoundingMode.HALF_UP);
this.weChat = serviceRequirementsDO.getWeChat().divide(decimalSum,2,RoundingMode.HALF_UP);
this.wechatPayOrderNumber = serviceRequirementsDO.getWechatPayOrderNumber();
this.repertory = 1;
this.paymentType = serviceRequirementsDO.getPaymentType();
this.adcode = serviceRequirementsDO.getAdcode();
this.levelSalaryAmount = serviceRequirementsDO.getLevelSalaryAmount().divide(decimalSum,2,RoundingMode.HALF_UP);
this.levelWeChatAmount = serviceRequirementsDO.getLevelWeChatAmount().divide(decimalSum,2,RoundingMode.HALF_UP);
this.levelCashAmount = serviceRequirementsDO.getLevelCashAmount().divide(decimalSum,2,RoundingMode.HALF_UP);
this.openid = serviceRequirementsDO.getOpenid();
this.serviceName = serviceRequirementsDO.getServiceName();
this.requireNum = 1;
this.fatherRequireId = serviceRequirementsDO.getId();
}
}
...@@ -3,6 +3,7 @@ package com.mmc.csf.release.service; ...@@ -3,6 +3,7 @@ package com.mmc.csf.release.service;
import com.mmc.csf.common.util.page.PageResult; import com.mmc.csf.common.util.page.PageResult;
import com.mmc.csf.common.util.web.ResultBody; import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.infomation.dto.*; import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.AgreeOrRefusePilotQO;
import com.mmc.csf.infomation.qo.IndustryCaseQO; import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.qo.MyPreemptQO; import com.mmc.csf.infomation.qo.MyPreemptQO;
import com.mmc.csf.infomation.qo.MyPublishQO; import com.mmc.csf.infomation.qo.MyPublishQO;
...@@ -126,4 +127,20 @@ public interface RequirementsService { ...@@ -126,4 +127,20 @@ public interface RequirementsService {
ResultBody flyHandAgree(FlyHandAgreeVO agreeVO, HttpServletRequest request); ResultBody flyHandAgree(FlyHandAgreeVO agreeVO, HttpServletRequest request);
ServiceRequirementsDO getRepertory(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request); ServiceRequirementsDO getRepertory(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request);
/**
* 根据父订单的id找到所有子订单信息
* @param userAccountId 发单人的id
* @param param 条件 父id在里面
* @return {@link PageResult}
*/
PageResult selectRequireSonInfo(Integer userAccountId, MyPublishQO param);
/**
* 同意或者拒绝飞手接单
* @param param 参数
* @return {@link ResultBody}
*/
ResultBody agreeOrRefusePilot(AgreeOrRefusePilotQO param);
} }
...@@ -9,6 +9,7 @@ import com.mmc.csf.common.util.web.ResultBody; ...@@ -9,6 +9,7 @@ import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.common.util.web.ResultEnum; import com.mmc.csf.common.util.web.ResultEnum;
import com.mmc.csf.config.IsNullConvertZeroUtil; import com.mmc.csf.config.IsNullConvertZeroUtil;
import com.mmc.csf.infomation.dto.*; import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.AgreeOrRefusePilotQO;
import com.mmc.csf.infomation.qo.IndustryCaseQO; import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.qo.MyPreemptQO; import com.mmc.csf.infomation.qo.MyPreemptQO;
import com.mmc.csf.infomation.qo.MyPublishQO; import com.mmc.csf.infomation.qo.MyPublishQO;
...@@ -23,11 +24,14 @@ import com.mmc.csf.release.industry.IndustryTypeDTO; ...@@ -23,11 +24,14 @@ import com.mmc.csf.release.industry.IndustryTypeDTO;
import com.mmc.csf.release.industry.UserPayInfoVO; import com.mmc.csf.release.industry.UserPayInfoVO;
import com.mmc.csf.release.service.RequirementsService; import com.mmc.csf.release.service.RequirementsService;
import com.mmc.csf.release.util.RestTemplateUtil; import com.mmc.csf.release.util.RestTemplateUtil;
import com.sun.xml.bind.v2.TODO;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gavaghan.geodesy.Ellipsoid; import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator; import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve; import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates; import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
...@@ -218,6 +222,15 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -218,6 +222,15 @@ public class RequirementsServiceImpl implements RequirementsService {
if (requirementsInfoVO.getPublish() == 0) { if (requirementsInfoVO.getPublish() == 0) {
requirementsInfoVO.setPublishPhone(""); requirementsInfoVO.setPublishPhone("");
} }
Integer status = requirementsDao.selectServiceIdByRequireIdAndUserId(id, userAccountId);
if (status == null) {
return ResultBody.success(requirementsInfoVO);
}
//如果该飞手被拒绝 需要修改当前订单的状态
if (requirementsDao.selectServiceIdByRequireIdAndUserId(id, userAccountId) == 11) {
requirementsInfoVO.setOrderStatus("170");
}
return ResultBody.success(requirementsInfoVO); return ResultBody.success(requirementsInfoVO);
} }
...@@ -720,97 +733,106 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -720,97 +733,106 @@ public class RequirementsServiceImpl implements RequirementsService {
RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId); RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO); IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
Integer serviceFlowId = requirementsServiceDO.getServiceFlowId(); Integer serviceFlowId = requirementsServiceDO.getServiceFlowId();
if (serviceFlowId != 2) { if (serviceFlowId != 10) {
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());
} else {
//修改订单所需人数以及订单状态
requirementsDao.updateRequirementsInfoByRefusePilot(requirementsInfoId);
requirementsDao.updateScene(requirementsInfoId,1);
Integer fatherRequireId = requirementsDao.selectFatherRequireIdBySonId(requirementsInfoId);
Integer repertory = requirementsDao.selectRepertoryByRequireId(fatherRequireId);
requirementsDao.updateRequirementsInfoRepertory(fatherRequireId, repertory);
return ResultBody.success();
} }
BigDecimal bigDecimal = new BigDecimal(0.9);
BigDecimal preemptTotalAmount = requirementsServiceDO.getPreemptTotalAmount();
BigDecimal percentagePenaltyOfOrder = preemptTotalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
//平台抽取百分之十
BigDecimal earnings = preemptTotalAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP);
WalletFlowVO walletFlowVO = new WalletFlowVO();
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(walletFlowVO);
PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(walletFlowVO);
flyerWalletFlowVO.setModeOfPayment(600);
flyerWalletFlowVO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder.negate());
flyerWalletFlowVO.setUserAccountId(userAccountId);
flyerWalletFlowVO.setOperateUserAccountId(userAccountId);
//如果微信里面的钱大于需要扣除的钱
/* if (requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == 1 ||
requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == 0) {
//
}*/
//如果微信里面的钱小于需要扣除的金额
if (requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == -1) {
//优先扣除微信的钱
BigDecimal subtract = preemptTotalAmount.subtract(requirementsServiceDO.getWeChat());
if (requirementsServiceDO.getSalaryAmount().compareTo(subtract) == -1) {
BigDecimal sub2 = subtract.subtract(requirementsServiceDO.getSalaryAmount());
flyerWalletFlowVO.setSalaryCashPledge(requirementsServiceDO.getSalaryAmount().negate());
if (sub2.compareTo(requirementsServiceDO.getCashAmount()) == 0 ||
sub2.compareTo(requirementsServiceDO.getCashAmount()) == -1) {
//云享金扣除违约多少
flyerWalletFlowVO.setYxjCashPledge(sub2.negate());
}
} else if (requirementsServiceDO.getSalaryAmount().compareTo(subtract) == 1 ||
requirementsServiceDO.getSalaryAmount().compareTo(subtract) == 0) {
flyerWalletFlowVO.setSalaryCashPledge(subtract.negate());
}
}
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
//给发布者退钱
publisherWalletFlowVO.setUserAccountId(infoDO.getUserAccountId());
publisherWalletFlowVO.setModeOfPayment(600);
publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
publisherWalletFlowVO.setSalaryAmount(infoDO.getSalaryAmount());
publisherWalletFlowVO.setCashAmount(infoDO.getCashAmount());
//退云享金和佣金
if (infoDO.getOrderLevel().equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(infoDO.getLevelCashAmount());
publisherWalletFlowVO.setUrgentSalaryAmount(infoDO.getLevelSalaryAmount());
}
if (infoDO.getOrderLevel().equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopYxjAmount(infoDO.getLevelCashAmount());
publisherWalletFlowVO.setTopSalaryAmount(infoDO.getLevelSalaryAmount());
}
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
//给发布者微信退钱
String wechatPayOrderNumber = infoDO.getWechatPayOrderNumber();
if (wechatPayOrderNumber != null) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO();
BigDecimal weChat = infoDO.getWeChat();
BigDecimal levelWeChatAmount = infoDO.getLevelWeChatAmount();
BigDecimal add = weChat.add(levelWeChatAmount);
long longValue = add.multiply(new BigDecimal(100)).longValue();
applyRefundVO.setRefund(longValue);
applyRefundVO.setReason("退回微信支付金额");
applyRefundVO.setOutTradeNo(infoDO.getWechatPayOrderNumber());
applyRefund(applyRefundVO, request.getHeader("token"));
}
IsNullConvertZeroUtil.checkIsNull(infoDO);
//任务佣金 // BigDecimal bigDecimal = new BigDecimal(0.9);
requirementsServiceDO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder); // BigDecimal preemptTotalAmount = requirementsServiceDO.getPreemptTotalAmount();
//飞手单方面取消将20之二十退回到发布者佣金里面 // BigDecimal percentagePenaltyOfOrder = preemptTotalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
flyerCancel(walletFlowVO, request.getHeader("token")); // //平台抽取百分之十
requirementsServiceDO.setOrderEarnings(new BigDecimal(0)); // BigDecimal earnings = preemptTotalAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal orderEarnings = requirementsServiceDO.getOrderEarnings(); // WalletFlowVO walletFlowVO = new WalletFlowVO();
BigDecimal add = orderEarnings.add(earnings); // FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
requirementsServiceDO.setOrderEarnings(add); // IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
requirementsServiceDO.setRequirementsInfoId(requirementsServiceDO.getId()); // IsNullConvertZeroUtil.checkIsNull(walletFlowVO);
requirementsDao.updateAmounts(requirementsServiceDO); // PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
// requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId); // IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
requirementsDao.updatePlatformOrderEarnings(earnings, requirementsInfoId, userAccountId); // IsNullConvertZeroUtil.checkIsNull(walletFlowVO);
requirementsDao.updateScene(requirementsInfoId, 7); // flyerWalletFlowVO.setModeOfPayment(600);
requirementsDao.updateInfo(requirementsInfoId, 7); // flyerWalletFlowVO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder.negate());
requirementsDao.updateFlow(requirementsInfoId, 7); // flyerWalletFlowVO.setUserAccountId(userAccountId);
this.sendMsgPublishInfoAuth(requirementsServiceDO); // flyerWalletFlowVO.setOperateUserAccountId(userAccountId);
return ResultBody.success(ResultEnum.PAYMENT_SUCCESS.getResultMsg()); // //如果微信里面的钱大于需要扣除的钱
// /* if (requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == 1 ||
// requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == 0) {
// //
// }*/
// //如果微信里面的钱小于需要扣除的金额
// if (requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == -1) {
// //优先扣除微信的钱
// BigDecimal subtract = preemptTotalAmount.subtract(requirementsServiceDO.getWeChat());
// if (requirementsServiceDO.getSalaryAmount().compareTo(subtract) == -1) {
// BigDecimal sub2 = subtract.subtract(requirementsServiceDO.getSalaryAmount());
// flyerWalletFlowVO.setSalaryCashPledge(requirementsServiceDO.getSalaryAmount().negate());
// if (sub2.compareTo(requirementsServiceDO.getCashAmount()) == 0 ||
// sub2.compareTo(requirementsServiceDO.getCashAmount()) == -1) {
// //云享金扣除违约多少
// flyerWalletFlowVO.setYxjCashPledge(sub2.negate());
// }
// } else if (requirementsServiceDO.getSalaryAmount().compareTo(subtract) == 1 ||
// requirementsServiceDO.getSalaryAmount().compareTo(subtract) == 0) {
// flyerWalletFlowVO.setSalaryCashPledge(subtract.negate());
// }
// }
// walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
// //给发布者退钱
// publisherWalletFlowVO.setUserAccountId(infoDO.getUserAccountId());
// publisherWalletFlowVO.setModeOfPayment(600);
// publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
// publisherWalletFlowVO.setSalaryAmount(infoDO.getSalaryAmount());
// publisherWalletFlowVO.setCashAmount(infoDO.getCashAmount());
// //退云享金和佣金
// if (infoDO.getOrderLevel().equals("RUSH_ORDER")) {
// publisherWalletFlowVO.setUrgentYxjAmount(infoDO.getLevelCashAmount());
// publisherWalletFlowVO.setUrgentSalaryAmount(infoDO.getLevelSalaryAmount());
// }
// if (infoDO.getOrderLevel().equals("TOP_ORDER")) {
// publisherWalletFlowVO.setTopYxjAmount(infoDO.getLevelCashAmount());
// publisherWalletFlowVO.setTopSalaryAmount(infoDO.getLevelSalaryAmount());
// }
//
// walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
// //给发布者微信退钱
// String wechatPayOrderNumber = infoDO.getWechatPayOrderNumber();
// if (wechatPayOrderNumber != null) {
// ApplyRefundVO applyRefundVO = new ApplyRefundVO();
// BigDecimal weChat = infoDO.getWeChat();
// BigDecimal levelWeChatAmount = infoDO.getLevelWeChatAmount();
// BigDecimal add = weChat.add(levelWeChatAmount);
// long longValue = add.multiply(new BigDecimal(100)).longValue();
// applyRefundVO.setRefund(longValue);
// applyRefundVO.setReason("退回微信支付金额");
// applyRefundVO.setOutTradeNo(infoDO.getWechatPayOrderNumber());
// applyRefund(applyRefundVO, request.getHeader("token"));
// }
// IsNullConvertZeroUtil.checkIsNull(infoDO);
//
// //任务佣金
// requirementsServiceDO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder);
// //飞手单方面取消将20之二十退回到发布者佣金里面
// flyerCancel(walletFlowVO, request.getHeader("token"));
// requirementsServiceDO.setOrderEarnings(new BigDecimal(0));
// BigDecimal orderEarnings = requirementsServiceDO.getOrderEarnings();
// BigDecimal add = orderEarnings.add(earnings);
// requirementsServiceDO.setOrderEarnings(add);
// requirementsServiceDO.setRequirementsInfoId(requirementsServiceDO.getId());
// requirementsDao.updateAmounts(requirementsServiceDO);
// // requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
// requirementsDao.updatePlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
// requirementsDao.updateScene(requirementsInfoId, 7);
// requirementsDao.updateInfo(requirementsInfoId, 7);
// requirementsDao.updateFlow(requirementsInfoId, 7);
// this.sendMsgPublishInfoAuth(requirementsServiceDO);
// return ResultBody.success(ResultEnum.PAYMENT_SUCCESS.getResultMsg());
} }
...@@ -1011,7 +1033,20 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1011,7 +1033,20 @@ public class RequirementsServiceImpl implements RequirementsService {
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO(); FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO); IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO); IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
if (serviceFlowId == 1) {
Boolean condition1 = false;
Boolean condition2 = false;
//如果是多人订单 需要判断每一个子订单是否是在 1,10 状态
if (requirementsDao.selectRequirementsNum(requirementsInfoId) > 1) {
if (requirementsDao.selectServiceFlowIdByFatherId(requirementsInfoId) == 0) {
condition2 = true;
condition1 = true;
}
} else {
condition1 = serviceFlowId == 1;
condition2 = serviceFlowId == 10;
}
if (condition1 || condition2) {
//飞手无责取消 将全部退回 不包含加急或者置顶 //飞手无责取消 将全部退回 不包含加急或者置顶
//支付 //支付
if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 || if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
...@@ -1047,195 +1082,197 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1047,195 +1082,197 @@ public class RequirementsServiceImpl implements RequirementsService {
requirementsDao.updateInfo(requirementsInfoId, 7); requirementsDao.updateInfo(requirementsInfoId, 7);
requirementsDao.updateFlow(requirementsInfoId, 7); requirementsDao.updateFlow(requirementsInfoId, 7);
return ResultBody.success(ResultEnum.THE_AMOUNT_OF_THE_MISSION_WILL_BE_RETURNED.getResultMsg()); return ResultBody.success(ResultEnum.THE_AMOUNT_OF_THE_MISSION_WILL_BE_RETURNED.getResultMsg());
} } else {
if (serviceFlowId != 2 && serviceFlowId != 1) {
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());
} }
//单方面取消订单并且飞手已经抢单 // if (serviceFlowId != 2 && serviceFlowId != 1) {
if (serviceFlowId == 2) { // return ResultBody.error(ResultEnum.YOU_CANNOT_CANCEL_THE_ORDER_AT_THIS_TIME.getResultMsg());
BigDecimal orderAmount = requirementsInfoDO.getOrderAmount(); // }
BigDecimal bigDecimal = new BigDecimal(0.7); // //单方面取消订单并且飞手已经抢单
//剩余金额 // if (serviceFlowId == 2) {
BigDecimal residueOrderAmount = orderAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP); // BigDecimal orderAmount = requirementsInfoDO.getOrderAmount();
//先退微信 再退任务佣金 最后退云享金 // BigDecimal bigDecimal = new BigDecimal(0.7);
BigDecimal weChat = requirementsInfoDO.getWeChat(); // //剩余金额
//微信需要退款多少金额 // BigDecimal residueOrderAmount = orderAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
//微信金额大于扣除之后的金额 // //先退微信 再退任务佣金 最后退云享金
BigDecimal refundCashAmount = new BigDecimal(0); // BigDecimal weChat = requirementsInfoDO.getWeChat();
BigDecimal refundSalaryAmount = new BigDecimal(0); // //微信需要退款多少金额
BigDecimal refundWeChat = new BigDecimal(0); // //微信金额大于扣除之后的金额
//飞手获得的金额 // BigDecimal refundCashAmount = new BigDecimal(0);
BigDecimal receiveSalaryAmount = orderAmount.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP); // BigDecimal refundSalaryAmount = new BigDecimal(0);
BigDecimal freeze = orderAmount.multiply(new BigDecimal(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP); // BigDecimal refundWeChat = new BigDecimal(0);
//微信支付金额大于需要退款金额 // //飞手获得的金额
if (weChat.compareTo(residueOrderAmount) == 1) { // BigDecimal receiveSalaryAmount = orderAmount.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP);
// BigDecimal freeze = orderAmount.multiply(new BigDecimal(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP);
//云享金扣除多少 // //微信支付金额大于需要退款金额
// publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate()); // if (weChat.compareTo(residueOrderAmount) == 1) {
//佣金扣除多少 //
// publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate()); // //云享金扣除多少
//违约云享金多少 // // publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate());
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate()); // //佣金扣除多少
//违约佣金 // // publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate());
publisherWalletFlowVO.setSalaryCashPledge(requirementsInfoDO.getSalaryAmount().negate()); // //违约云享金多少
// publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
//用户退百分之七十的费用 // //违约佣金
refundWeChat = residueOrderAmount; // publisherWalletFlowVO.setSalaryCashPledge(requirementsInfoDO.getSalaryAmount().negate());
BigDecimal multiply = refundWeChat.multiply(new BigDecimal(100)); //
Long longWeChat = multiply.longValue(); // //用户退百分之七十的费用
applyRefundVO.setRefund(longWeChat); // refundWeChat = residueOrderAmount;
applyRefundVO.setReason("扣除飞手百分之三十的费用"); // BigDecimal multiply = refundWeChat.multiply(new BigDecimal(100));
applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber()); // Long longWeChat = multiply.longValue();
//退款到微信 // applyRefundVO.setRefund(longWeChat);
applyRefund(applyRefundVO, request.getHeader("token")); // applyRefundVO.setReason("扣除飞手百分之三十的费用");
} // applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber());
//微信支付金额小于需要退款金额 // //退款到微信
if (weChat.compareTo(residueOrderAmount) == -1 || // applyRefund(applyRefundVO, request.getHeader("token"));
weChat.compareTo(refundCashAmount) == 0) { // }
//优先扣除微信里面的钱 // //微信支付金额小于需要退款金额
BigDecimal returnToWechat = residueOrderAmount.subtract(requirementsInfoDO.getWeChat()); // if (weChat.compareTo(residueOrderAmount) == -1 ||
// weChat.compareTo(refundCashAmount) == 0) {
BigDecimal residueAmount = new BigDecimal(0); // //优先扣除微信里面的钱
if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == 1) { // BigDecimal returnToWechat = residueOrderAmount.subtract(requirementsInfoDO.getWeChat());
//退回佣金 //
residueAmount = returnToWechat.subtract(requirementsInfoDO.getSalaryAmount()); // BigDecimal residueAmount = new BigDecimal(0);
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount()); // if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == 1) {
publisherWalletFlowVO.setCashAmount(residueAmount); // //退回佣金
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().subtract(residueAmount).negate()); // residueAmount = returnToWechat.subtract(requirementsInfoDO.getSalaryAmount());
// publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount());
} // publisherWalletFlowVO.setCashAmount(residueAmount);
if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == 0) { // publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().subtract(residueAmount).negate());
publisherWalletFlowVO.setSalaryAmount(returnToWechat); //
} // }
// if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == 0) {
//如果退回的佣金小于支付的佣金 // publisherWalletFlowVO.setSalaryAmount(returnToWechat);
if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == -1) { // }
residueAmount = requirementsInfoDO.getSalaryAmount().subtract(returnToWechat); //
//one // //如果退回的佣金小于支付的佣金
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().subtract(residueAmount)); // if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == -1) {
publisherWalletFlowVO.setSalaryCashPledge(residueAmount.negate()); // residueAmount = requirementsInfoDO.getSalaryAmount().subtract(returnToWechat);
//修改2 // //one
//修改三 // publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().subtract(residueAmount));
// publisherWalletFlowVO.setSalaryCashPledge(residueAmount.negate());
if (residueAmount.compareTo(BigDecimal.ZERO) == 1) { // //修改2
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate()); // //修改三
} //
} // if (residueAmount.compareTo(BigDecimal.ZERO) == 1) {
//如果退回佣金等于0 // publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
if (residueAmount.compareTo(BigDecimal.ZERO) == 0) { // }
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate()); // }
} // //如果退回佣金等于0
// if (residueAmount.compareTo(BigDecimal.ZERO) == 0) {
if (residueAmount.compareTo(BigDecimal.ZERO) == -1) { // publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
publisherWalletFlowVO.setUserAccountId(userAccountId); // }
publisherWalletFlowVO.setOperateUserAccountId(userAccountId); //
publisherWalletFlowVO.setModeOfPayment(300); // if (residueAmount.compareTo(BigDecimal.ZERO) == -1) {
publisherWalletFlowVO.setSalaryAmount(residueAmount.negate()); // publisherWalletFlowVO.setUserAccountId(userAccountId);
System.out.println(residueAmount); // publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
BigDecimal subtract = requirementsInfoDO.getSalaryAmount().subtract(residueAmount.negate()); // publisherWalletFlowVO.setModeOfPayment(300);
publisherWalletFlowVO.setSalaryCashPledge(subtract.negate()); // publisherWalletFlowVO.setSalaryAmount(residueAmount.negate());
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate()); // System.out.println(residueAmount);
// BigDecimal subtract = requirementsInfoDO.getSalaryAmount().subtract(residueAmount.negate());
// BigDecimal subtract = requirementsInfoDO.getSalaryAmount().subtract(residueAmount.negate()); // publisherWalletFlowVO.setSalaryCashPledge(subtract.negate());
// publisherWalletFlowVO.setSalaryCashPledge(subtract.negate()); // publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
//
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); // // BigDecimal subtract = requirementsInfoDO.getSalaryAmount().subtract(residueAmount.negate());
//flyerCancel(walletFlowVO, request.getHeader("token")); // // publisherWalletFlowVO.setSalaryCashPledge(subtract.negate());
//退回的佣金大于0 //
} else if (residueAmount.compareTo(BigDecimal.ZERO) == 1) { // walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
// publisherWalletFlowVO.setCashAmount(residueAmount); // //flyerCancel(walletFlowVO, request.getHeader("token"));
publisherWalletFlowVO.setUserAccountId(userAccountId); // //退回的佣金大于0
publisherWalletFlowVO.setOperateUserAccountId(userAccountId); // } else if (residueAmount.compareTo(BigDecimal.ZERO) == 1) {
publisherWalletFlowVO.setModeOfPayment(300); // // publisherWalletFlowVO.setCashAmount(residueAmount);
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); // publisherWalletFlowVO.setUserAccountId(userAccountId);
//退回任务佣金 // publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
//flyerCancel(walletFlowVO, request.getHeader("token")); // publisherWalletFlowVO.setModeOfPayment(300);
// walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
} // //退回任务佣金
BigDecimal weChatAmount = requirementsInfoDO.getWeChat(); // //flyerCancel(walletFlowVO, request.getHeader("token"));
long longWeChat = weChatAmount.multiply(new BigDecimal(100)).longValue(); //
applyRefundVO.setRefund(longWeChat); // }
applyRefundVO.setReason("退回方式——微信佣金云享金"); // BigDecimal weChatAmount = requirementsInfoDO.getWeChat();
applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber()); // long longWeChat = weChatAmount.multiply(new BigDecimal(100)).longValue();
applyRefund(applyRefundVO, request.getHeader("token")); // applyRefundVO.setRefund(longWeChat);
} // applyRefundVO.setReason("退回方式——微信佣金云享金");
// applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber());
//平台抽取百分之十 // applyRefund(applyRefundVO, request.getHeader("token"));
//发布者取消 // }
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); // BigDecimal earnings = orderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP);
requirementsDao.updateRequirementsAmount(requirementsInfoDO); // BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings();
// requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId); // BigDecimal add = orderEarnings.add(earnings);
requirementsDao.updatePlatformOrderEarnings(earnings, requirementsInfoId, userAccountId); // requirementsInfoDO.setOrderEarnings(add);
// requirementsDao.updateRequirementsAmount(requirementsInfoDO);
// // requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
if (serviceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 || // requirementsDao.updatePlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
serviceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 || //
serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0) { //
System.out.println(freeze); // if (serviceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
//优先扣除微信 // serviceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 ||
BigDecimal weChat1 = requirementsInfoDO.getWeChat(); // serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0) {
//如果微信扣除的金额小于飞手获得的钱 // System.out.println(freeze);
if (weChat1.compareTo(freeze) == -1) { // //优先扣除微信
//还需要扣除多少 // BigDecimal weChat1 = requirementsInfoDO.getWeChat();
BigDecimal subtract = freeze.subtract(weChat1); // //如果微信扣除的金额小于飞手获得的钱
if (subtract.compareTo(requirementsInfoDO.getSalaryAmount()) == 1) { // if (weChat1.compareTo(freeze) == -1) {
publisherWalletFlowVO.setSalaryCashPledge(requirementsInfoDO.getSalaryAmount().negate()); // //还需要扣除多少
// BigDecimal subtract = freeze.subtract(weChat1);
BigDecimal subtract1 = subtract.subtract(requirementsInfoDO.getSalaryAmount()); // if (subtract.compareTo(requirementsInfoDO.getSalaryAmount()) == 1) {
if (subtract1.compareTo(BigDecimal.ZERO) == 0 || subtract1.compareTo(BigDecimal.ZERO) == 1) { // publisherWalletFlowVO.setSalaryCashPledge(requirementsInfoDO.getSalaryAmount().negate());
publisherWalletFlowVO.setYxjCashPledge(subtract1.negate()); //
} // BigDecimal subtract1 = subtract.subtract(requirementsInfoDO.getSalaryAmount());
} // if (subtract1.compareTo(BigDecimal.ZERO) == 0 || subtract1.compareTo(BigDecimal.ZERO) == 1) {
if (subtract.compareTo(requirementsInfoDO.getSalaryAmount()) == -1) { // publisherWalletFlowVO.setYxjCashPledge(subtract1.negate());
//update // }
if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) == 0) { // }
publisherWalletFlowVO.setSalaryCashPledge(subtract.negate()); // if (subtract.compareTo(requirementsInfoDO.getSalaryAmount()) == -1) {
} // //update
if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0) { // if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) == 0) {
BigDecimal subtract1 = requirementsInfoDO.getCashAmount().subtract(publisherWalletFlowVO.getCashAmount()); // publisherWalletFlowVO.setSalaryCashPledge(subtract.negate());
publisherWalletFlowVO.setYxjCashPledge(subtract1.negate()); // }
} // if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0) {
//publisherWalletFlowVO.setYxjCashPledge(subtract.negate()); // BigDecimal subtract1 = requirementsInfoDO.getCashAmount().subtract(publisherWalletFlowVO.getCashAmount());
} // publisherWalletFlowVO.setYxjCashPledge(subtract1.negate());
// }
} // //publisherWalletFlowVO.setYxjCashPledge(subtract.negate());
//飞手应该获得的金额 // }
publisherWalletFlowVO.setUserAccountId(userAccountId); //
publisherWalletFlowVO.setOperateUserAccountId(userAccountId); // }
publisherWalletFlowVO.setModeOfPayment(300); // //飞手应该获得的金额
publisherWalletFlowVO.setPercentagePenaltyOfOrder(receiveSalaryAmount.negate()); // publisherWalletFlowVO.setUserAccountId(userAccountId);
flyerWalletFlowVO.setCashAmount(serviceDO.getCashAmount()); // publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount()); // publisherWalletFlowVO.setModeOfPayment(300);
flyerWalletFlowVO.setUserAccountId(requirementsInfoDO.getPilotCertificationUserId()); // publisherWalletFlowVO.setPercentagePenaltyOfOrder(receiveSalaryAmount.negate());
flyerWalletFlowVO.setOperateUserAccountId(userAccountId); // flyerWalletFlowVO.setCashAmount(serviceDO.getCashAmount());
flyerWalletFlowVO.setModeOfPayment(300); // flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount());
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); // flyerWalletFlowVO.setUserAccountId(requirementsInfoDO.getPilotCertificationUserId());
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO); // flyerWalletFlowVO.setOperateUserAccountId(userAccountId);
String s = String.valueOf(walletFlowVO); // flyerWalletFlowVO.setModeOfPayment(300);
log.info(s); // walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
flyerCancel(walletFlowVO, request.getHeader("token")); // walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
} // String s = String.valueOf(walletFlowVO);
//飞手全额退款 // log.info(s);
if (serviceDO.getWechatPayOrderNumber() != null) { // flyerCancel(walletFlowVO, request.getHeader("token"));
ApplyRefundVO arv = new ApplyRefundVO(); // }
arv.setReason("全额退款"); // //飞手全额退款
arv.setRefund(serviceDO.getWeChat().multiply(new BigDecimal(100)).longValue()); // if (serviceDO.getWechatPayOrderNumber() != null) {
arv.setOutTradeNo(serviceDO.getWechatPayOrderNumber()); // ApplyRefundVO arv = new ApplyRefundVO();
applyRefund(arv, request.getHeader("token")); // arv.setReason("全额退款");
} // arv.setRefund(serviceDO.getWeChat().multiply(new BigDecimal(100)).longValue());
// arv.setOutTradeNo(serviceDO.getWechatPayOrderNumber());
requirementsInfoDO.setReceiveSalaryAmount(receiveSalaryAmount); // applyRefund(arv, request.getHeader("token"));
//给飞手发送短信 // }
this.sendMsgFlyerInfoAuth(requirementsInfoDO); //
requirementsDao.updateInfo(requirementsInfoId, 7); // requirementsInfoDO.setReceiveSalaryAmount(receiveSalaryAmount);
requirementsDao.updateFlow(requirementsInfoId, 7); // //给飞手发送短信
return ResultBody.success(ResultEnum.REFUND_PERCENTAGE.getResultMsg()); // this.sendMsgFlyerInfoAuth(requirementsInfoDO);
} // requirementsDao.updateInfo(requirementsInfoId, 7);
// requirementsDao.updateFlow(requirementsInfoId, 7);
return ResultBody.success(); // return ResultBody.success(ResultEnum.REFUND_PERCENTAGE.getResultMsg());
// }
//
// return ResultBody.success();
} }
/** /**
...@@ -1246,30 +1283,30 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1246,30 +1283,30 @@ public class RequirementsServiceImpl implements RequirementsService {
* @return * @return
*/ */
@Override @Override
public ResultBody cancelAll(LiabilityProblemVO liabilityProblemVO, Integer userAccountId,HttpServletRequest request) { public ResultBody cancelAll(LiabilityProblemVO liabilityProblemVO, Integer userAccountId, HttpServletRequest request) {
RequirementsServiceDO requirementsServiceDO = requirementsDao.customerDroneFlyerCancel(liabilityProblemVO.getRequirementsInfoId()); RequirementsServiceDO requirementsServiceDO = requirementsDao.customerDroneFlyerCancel(liabilityProblemVO.getRequirementsInfoId());
RequirementsInfoDO requirementsInfoDO = requirementsDao.customerPublisherCancel(liabilityProblemVO.getRequirementsInfoId(), userAccountId); RequirementsInfoDO requirementsInfoDO = requirementsDao.customerPublisherCancel(liabilityProblemVO.getRequirementsInfoId(), userAccountId);
liabilityProblemVO.setUserAccountId(userAccountId); liabilityProblemVO.setUserAccountId(userAccountId);
if (requirementsInfoDO.getServiceFlowId()==8 || if (requirementsInfoDO.getServiceFlowId() == 8 ||
requirementsInfoDO.getServiceFlowId()==6 || requirementsInfoDO.getServiceFlowId() == 6 ||
requirementsInfoDO.getServiceFlowId()==7 || requirementsInfoDO.getServiceFlowId() == 7 ||
requirementsInfoDO.getServiceFlowId()==5){ requirementsInfoDO.getServiceFlowId() == 5) {
return ResultBody.error("客服不能介入当前状态"); return ResultBody.error("客服不能介入当前状态");
} }
if (requirementsServiceDO==null){ if (requirementsServiceDO == null) {
return ResultBody.error("没有人抢单不能判定责任"); return ResultBody.error("没有人抢单不能判定责任");
} }
int i = requirementsDao.selectCustomer(liabilityProblemVO.getRequirementsInfoId()); int i = requirementsDao.selectCustomer(liabilityProblemVO.getRequirementsInfoId());
if (i!=0){ if (i != 0) {
return ResultBody.error("请勿重复判定"); return ResultBody.error("请勿重复判定");
} }
requirementsDao.customerServiceIntervention(liabilityProblemVO); requirementsDao.customerServiceIntervention(liabilityProblemVO);
//双方无责 //双方无责
if (liabilityProblemVO.getDuty().equals(1)){ if (liabilityProblemVO.getDuty().equals(1)) {
requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7);
requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7);
WalletFlowVO walletFlowVO = new WalletFlowVO(); WalletFlowVO walletFlowVO = new WalletFlowVO();
...@@ -1291,7 +1328,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1291,7 +1328,7 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
//退发布者费用 //退发布者费用
if (requirementsInfoDO.getWechatPayOrderNumber()!=null){ if (requirementsInfoDO.getWechatPayOrderNumber() != null) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
applyRefundVO.setReason("客服介入退款"); applyRefundVO.setReason("客服介入退款");
applyRefundVO.setRefund(requirementsInfoDO.getWeChat().multiply(new BigDecimal(100)).longValue()); applyRefundVO.setRefund(requirementsInfoDO.getWeChat().multiply(new BigDecimal(100)).longValue());
...@@ -1299,7 +1336,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1299,7 +1336,7 @@ public class RequirementsServiceImpl implements RequirementsService {
applyRefund(applyRefundVO, request.getHeader("token")); applyRefund(applyRefundVO, request.getHeader("token"));
} }
//退飞手费用 //退飞手费用
if (requirementsServiceDO.getWechatPayOrderNumber()!=null){ if (requirementsServiceDO.getWechatPayOrderNumber() != null) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
applyRefundVO.setReason("客服介入退款"); applyRefundVO.setReason("客服介入退款");
applyRefundVO.setRefund(requirementsServiceDO.getWeChat().multiply(new BigDecimal(100)).longValue()); applyRefundVO.setRefund(requirementsServiceDO.getWeChat().multiply(new BigDecimal(100)).longValue());
...@@ -1307,10 +1344,10 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1307,10 +1344,10 @@ public class RequirementsServiceImpl implements RequirementsService {
applyRefund(applyRefundVO, request.getHeader("token")); applyRefund(applyRefundVO, request.getHeader("token"));
} }
//退云享金及余额 //退云享金及余额
if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO)!=0 || if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
requirementsInfoDO.getSalaryAmount().compareTo(BigDecimal.ZERO)!=0 || requirementsInfoDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 ||
requirementsServiceDO.getCashAmount().compareTo(BigDecimal.ZERO)!=0 || requirementsServiceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
requirementsServiceDO.getSalaryAmount().compareTo(BigDecimal.ZERO)!=0){ requirementsServiceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
publisherWalletFlowVO.setModeOfPayment(500); publisherWalletFlowVO.setModeOfPayment(500);
publisherWalletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId()); publisherWalletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId());
...@@ -1327,7 +1364,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1327,7 +1364,7 @@ public class RequirementsServiceImpl implements RequirementsService {
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO); walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
flyerCancel(walletFlowVO,request.getHeader("token")); flyerCancel(walletFlowVO, request.getHeader("token"));
//给发布者或者飞手发送信息 //给发布者或者飞手发送信息
this.publicSendMsgPublishInfoAuth(requirementsServiceDO); this.publicSendMsgPublishInfoAuth(requirementsServiceDO);
...@@ -1337,17 +1374,17 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1337,17 +1374,17 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
} }
//发布者责任 //发布者责任
if (liabilityProblemVO.getDuty().equals(2)){ if (liabilityProblemVO.getDuty().equals(2)) {
// publisherCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsInfoDO.getUserAccountId(),request); // publisherCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsInfoDO.getUserAccountId(),request);
publisherCancelDuty(liabilityProblemVO.getRequirementsInfoId(),requirementsInfoDO.getUserAccountId(),request); publisherCancelDuty(liabilityProblemVO.getRequirementsInfoId(), requirementsInfoDO.getUserAccountId(), request);
requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7);
requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7);
return ResultBody.success(); return ResultBody.success();
} }
//飞手责任 //飞手责任
if (liabilityProblemVO.getDuty().equals(3)){ if (liabilityProblemVO.getDuty().equals(3)) {
// droneFlyerCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsServiceDO.getPilotCertificationUserId(),request); // droneFlyerCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsServiceDO.getPilotCertificationUserId(),request);
droneFlyerCancelDuty(liabilityProblemVO.getRequirementsInfoId(),requirementsServiceDO.getPilotCertificationUserId(),request); droneFlyerCancelDuty(liabilityProblemVO.getRequirementsInfoId(), requirementsServiceDO.getPilotCertificationUserId(), request);
requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7);
requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7);
return ResultBody.success(); return ResultBody.success();
...@@ -1355,7 +1392,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1355,7 +1392,7 @@ public class RequirementsServiceImpl implements RequirementsService {
return ResultBody.success(); return ResultBody.success();
} }
public ResultBody publisherCancelDuty(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request){ public ResultBody publisherCancelDuty(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request) {
RequirementsInfoDO requirementsInfoDO = requirementsDao.publisherCancel(requirementsInfoId, userAccountId); RequirementsInfoDO requirementsInfoDO = requirementsDao.publisherCancel(requirementsInfoId, userAccountId);
RequirementsServiceDO serviceDO = requirementsDao.serviceReq(requirementsInfoId); RequirementsServiceDO serviceDO = requirementsDao.serviceReq(requirementsInfoId);
if (serviceDO != null) { if (serviceDO != null) {
...@@ -1498,13 +1535,13 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1498,13 +1535,13 @@ public class RequirementsServiceImpl implements RequirementsService {
if (serviceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 || if (serviceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
serviceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 || serviceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 ||
serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0 || serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0 ||
requirementsInfoDO.getLevelCashAmount().compareTo(BigDecimal.ZERO)!=0|| requirementsInfoDO.getLevelCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
requirementsInfoDO.getLevelSalaryAmount().compareTo(BigDecimal.ZERO)!=0) { requirementsInfoDO.getLevelSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
if (requirementsInfoDO.getOrderLevel().equals("RUSH_ORDER")){ if (requirementsInfoDO.getOrderLevel().equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(requirementsInfoDO.getLevelCashAmount().negate()); publisherWalletFlowVO.setUrgentYxjAmount(requirementsInfoDO.getLevelCashAmount().negate());
publisherWalletFlowVO.setUrgentSalaryAmount(requirementsInfoDO.getLevelSalaryAmount().negate()); publisherWalletFlowVO.setUrgentSalaryAmount(requirementsInfoDO.getLevelSalaryAmount().negate());
} }
if (requirementsInfoDO.getOrderLevel().equals("TOP_ORDER")){ if (requirementsInfoDO.getOrderLevel().equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopYxjAmount(requirementsInfoDO.getLevelCashAmount().negate()); publisherWalletFlowVO.setTopYxjAmount(requirementsInfoDO.getLevelCashAmount().negate());
publisherWalletFlowVO.setTopSalaryAmount(requirementsInfoDO.getLevelSalaryAmount().negate()); publisherWalletFlowVO.setTopSalaryAmount(requirementsInfoDO.getLevelSalaryAmount().negate());
} }
...@@ -1549,8 +1586,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1549,8 +1586,7 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
public ResultBody droneFlyerCancelDuty(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request) {
public ResultBody droneFlyerCancelDuty(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request){
RequirementsInfoDO infoDO = requirementsDao.publisherCancelFlyer(requirementsInfoId); RequirementsInfoDO infoDO = requirementsDao.publisherCancelFlyer(requirementsInfoId);
RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId); RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO); IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
...@@ -1698,6 +1734,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1698,6 +1734,7 @@ public class RequirementsServiceImpl implements RequirementsService {
/** /**
* 给飞手短信 * 给飞手短信
*
* @param requirementsServiceDO * @param requirementsServiceDO
*/ */
private void publicSendMsgPublishInfoAuth(RequirementsServiceDO requirementsServiceDO) { private void publicSendMsgPublishInfoAuth(RequirementsServiceDO requirementsServiceDO) {
...@@ -1917,9 +1954,9 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1917,9 +1954,9 @@ public class RequirementsServiceImpl implements RequirementsService {
publisherWalletFlowVO.setUserAccountId(amountUpdateDO.getUserAccountId()); publisherWalletFlowVO.setUserAccountId(amountUpdateDO.getUserAccountId());
publisherWalletFlowVO.setOperateUserAccountId(amountUpdateDO.getUserAccountId()); publisherWalletFlowVO.setOperateUserAccountId(amountUpdateDO.getUserAccountId());
String wechatPayOrderNumber = amountUpdateDO.getWechatPayOrderNumber(); String wechatPayOrderNumber = amountUpdateDO.getWechatPayOrderNumber();
if (wechatPayOrderNumber!=null){ if (wechatPayOrderNumber != null) {
UserPayInfoVO userPayInfoVO = queryUserPayInfo(amountUpdateDO.getWechatPayOrderNumber(), request); UserPayInfoVO userPayInfoVO = queryUserPayInfo(amountUpdateDO.getWechatPayOrderNumber(), request);
if (!userPayInfoVO.getTradeState().equals("SUCCESS")){ if (!userPayInfoVO.getTradeState().equals("SUCCESS")) {
return ResultBody.error("支付失败,请重新支付"); return ResultBody.error("支付失败,请重新支付");
} }
} }
...@@ -1932,16 +1969,16 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1932,16 +1969,16 @@ public class RequirementsServiceImpl implements RequirementsService {
requirementsDao.updateScene(amountVO.getRequirementsInfoId(), 8); requirementsDao.updateScene(amountVO.getRequirementsInfoId(), 8);
requirementsDao.updateInfo(amountVO.getRequirementsInfoId(), 8); requirementsDao.updateInfo(amountVO.getRequirementsInfoId(), 8);
int amountUpdate = requirementsDao.findAmountUpdate(amountUpdateDO.getRequirementsInfoId()); int amountUpdate = requirementsDao.findAmountUpdate(amountUpdateDO.getRequirementsInfoId());
if (amountUpdate!=0){ if (amountUpdate != 0) {
return ResultBody.error("只能修改一次不能重复修改"); return ResultBody.error("只能修改一次不能重复修改");
}else{ } else {
requirementsDao.requirementsAmountUpdate(amountUpdateDO); requirementsDao.requirementsAmountUpdate(amountUpdateDO);
} }
if (amountUpdateDO.getSalaryAmount().compareTo(BigDecimal.ZERO)!=0 || if (amountUpdateDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 ||
amountUpdateDO.getCashAmount().compareTo(BigDecimal.ZERO)!=0){ amountUpdateDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0) {
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
flyerCancelNO(walletFlowVO,request.getHeader("token")); flyerCancelNO(walletFlowVO, request.getHeader("token"));
} }
//倒计时 //倒计时
...@@ -1965,7 +2002,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1965,7 +2002,7 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
@Override @Override
public ResultBody confirmSettlement(Integer userAccountId, Integer requirementsInfoId,HttpServletRequest request) { public ResultBody confirmSettlement(Integer userAccountId, Integer requirementsInfoId, HttpServletRequest request) {
RequirementsInfoDO requirementsInfoDO = requirementsDao.publisherCancelFlyers(requirementsInfoId); RequirementsInfoDO requirementsInfoDO = requirementsDao.publisherCancelFlyers(requirementsInfoId);
ServiceSettleAccountsVO settleAccountsVO = new ServiceSettleAccountsVO(); ServiceSettleAccountsVO settleAccountsVO = new ServiceSettleAccountsVO();
settleAccountsVO.setRequirementsInfoId(requirementsInfoId); settleAccountsVO.setRequirementsInfoId(requirementsInfoId);
...@@ -1982,9 +2019,9 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1982,9 +2019,9 @@ public class RequirementsServiceImpl implements RequirementsService {
if (requirementsInfoDO == null) { if (requirementsInfoDO == null) {
return ResultBody.error("结算失败"); return ResultBody.error("结算失败");
} }
BigDecimal earnings=BigDecimal.ZERO; BigDecimal earnings = BigDecimal.ZERO;
//修改金额 //修改金额
if (updateAmount!=null){ if (updateAmount != null) {
//继续支付需要扣除金额 //继续支付需要扣除金额
IsNullConvertZeroUtil.checkIsNull(updateAmount); IsNullConvertZeroUtil.checkIsNull(updateAmount);
publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate()); publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate());
...@@ -1992,8 +2029,8 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1992,8 +2029,8 @@ public class RequirementsServiceImpl implements RequirementsService {
publisherWalletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId()); publisherWalletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId());
publisherWalletFlowVO.setOperateUserAccountId(userAccountId); publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
publisherWalletFlowVO.setModeOfPayment(1000); publisherWalletFlowVO.setModeOfPayment(1000);
if (updateAmount.getCashAmount().compareTo(BigDecimal.ZERO)!=0|| if (updateAmount.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
updateAmount.getSalaryAmount().compareTo(BigDecimal.ZERO)!=0){ updateAmount.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal cash = publisherWalletFlowVO.getCashAmount().negate(); BigDecimal cash = publisherWalletFlowVO.getCashAmount().negate();
BigDecimal salary = publisherWalletFlowVO.getSalaryAmount().negate(); BigDecimal salary = publisherWalletFlowVO.getSalaryAmount().negate();
...@@ -2004,12 +2041,13 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2004,12 +2041,13 @@ public class RequirementsServiceImpl implements RequirementsService {
// publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getSalaryAmount().negate()); // publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getSalaryAmount().negate());
//publisherWalletFlowVO.setRefundCashAmount(updateAmount.getCashAmount().negate()); //publisherWalletFlowVO.setRefundCashAmount(updateAmount.getCashAmount().negate());
}if(updateAmount.getReturnCashAmount().compareTo(BigDecimal.ZERO)!=0 || }
updateAmount.getReturnSalaryAmount().compareTo(BigDecimal.ZERO)!=0){ if (updateAmount.getReturnCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
updateAmount.getReturnSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
publisherWalletFlowVO.setRefundCashAmount(updateAmount.getReturnCashAmount()); publisherWalletFlowVO.setRefundCashAmount(updateAmount.getReturnCashAmount());
publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getReturnSalaryAmount()); publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getReturnSalaryAmount());
} }
if (updateAmount.getReturnWeChat().compareTo(BigDecimal.ZERO)!=0){ if (updateAmount.getReturnWeChat().compareTo(BigDecimal.ZERO) != 0) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
applyRefundVO.setReason("飞手确认退款"); applyRefundVO.setReason("飞手确认退款");
applyRefundVO.setOutTradeNo(updateAmount.getWechatPayOrderNumber()); applyRefundVO.setOutTradeNo(updateAmount.getWechatPayOrderNumber());
...@@ -2020,10 +2058,10 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2020,10 +2058,10 @@ public class RequirementsServiceImpl implements RequirementsService {
//给飞手金额 //给飞手金额
BigDecimal updateOrderAmount = updateAmount.getUpdateOrderAmount(); BigDecimal updateOrderAmount = updateAmount.getUpdateOrderAmount();
BigDecimal multiply = updateOrderAmount.multiply(new BigDecimal(0.9)).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal multiply = updateOrderAmount.multiply(new BigDecimal(1.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
publisherWalletFlowVO.setFlyerSalaryAmount(multiply); publisherWalletFlowVO.setFlyerSalaryAmount(multiply);
//平台收益 //平台收益
earnings = updateOrderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP); earnings = updateOrderAmount.multiply(new BigDecimal(0.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
} }
flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount()); flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount());
...@@ -2032,7 +2070,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2032,7 +2070,7 @@ public class RequirementsServiceImpl implements RequirementsService {
flyerWalletFlowVO.setOperateUserAccountId(userAccountId); flyerWalletFlowVO.setOperateUserAccountId(userAccountId);
flyerWalletFlowVO.setModeOfPayment(1000); flyerWalletFlowVO.setModeOfPayment(1000);
if (serviceDO.getWeChat().compareTo(BigDecimal.ZERO)!=0){ if (serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
applyRefundVO.setReason("原路退回"); applyRefundVO.setReason("原路退回");
applyRefundVO.setOutTradeNo(serviceDO.getWechatPayOrderNumber()); applyRefundVO.setOutTradeNo(serviceDO.getWechatPayOrderNumber());
...@@ -2045,10 +2083,10 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2045,10 +2083,10 @@ public class RequirementsServiceImpl implements RequirementsService {
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO); walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
flyerCancelNO(walletFlowVO,request.getHeader("token")); flyerCancelNO(walletFlowVO, request.getHeader("token"));
BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings(); BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings();
BigDecimal add = orderEarnings.add(earnings); BigDecimal add = orderEarnings.add(earnings);
requirementsDao.updateOrderEarnings(add,requirementsInfoId); requirementsDao.updateOrderEarnings(add, requirementsInfoId);
requirementsDao.updateInfo(requirementsInfoId, 5); requirementsDao.updateInfo(requirementsInfoId, 5);
requirementsDao.updateScene(requirementsInfoId, 5); requirementsDao.updateScene(requirementsInfoId, 5);
return ResultBody.success(); return ResultBody.success();
...@@ -2261,6 +2299,9 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2261,6 +2299,9 @@ public class RequirementsServiceImpl implements RequirementsService {
//抢单 //抢单
RequirementsServiceDTO requirementsServiceDTO = requirementsDao.requirementsServiceDTO(requirementsInfoId); RequirementsServiceDTO requirementsServiceDTO = requirementsDao.requirementsServiceDTO(requirementsInfoId);
flowDictionaryAndTimeDTO.setRequirementsServiceDTO(requirementsServiceDTO); flowDictionaryAndTimeDTO.setRequirementsServiceDTO(requirementsServiceDTO);
//发单方同意或者拒绝
AgreePilotOrderDTO agreePilotOrderDTO = requirementsDao.serviceAgreePilotOrderDTO(requirementsInfoId);
flowDictionaryAndTimeDTO.setAgreePilotOrderDTO(agreePilotOrderDTO);
//抵达现场 //抵达现场
ServiceArriveSceneDTO arriveSceneDTO = requirementsDao.serviceArriveSceneDTO(requirementsInfoId); ServiceArriveSceneDTO arriveSceneDTO = requirementsDao.serviceArriveSceneDTO(requirementsInfoId);
flowDictionaryAndTimeDTO.setServiceArriveSceneDTO(arriveSceneDTO); flowDictionaryAndTimeDTO.setServiceArriveSceneDTO(arriveSceneDTO);
...@@ -2315,57 +2356,57 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2315,57 +2356,57 @@ public class RequirementsServiceImpl implements RequirementsService {
IsNullConvertZeroUtil.checkIsNull(serviceDO); IsNullConvertZeroUtil.checkIsNull(serviceDO);
IsNullConvertZeroUtil.checkIsNull(requirementsInfoDO); IsNullConvertZeroUtil.checkIsNull(requirementsInfoDO);
if (requirementsInfoDO.getServiceFlowId()==5){ if (requirementsInfoDO.getServiceFlowId() == 5) {
return ResultBody.error("已结算"); return ResultBody.error("已结算");
} }
if (requirementsInfoDO == null) { if (requirementsInfoDO == null) {
return ResultBody.error("结算失败"); return ResultBody.error("结算失败");
} }
BigDecimal earnings=BigDecimal.ZERO; BigDecimal earnings = BigDecimal.ZERO;
//修改金额 //修改金额
if (updateAmount!=null){ if (updateAmount != null) {
//继续支付需要扣除金额 //继续支付需要扣除金额
IsNullConvertZeroUtil.checkIsNull(updateAmount); IsNullConvertZeroUtil.checkIsNull(updateAmount);
if (updateAmount.getUpdateOrderAmount().compareTo(updateAmount.getOrderAmount())==-1){ if (updateAmount.getUpdateOrderAmount().compareTo(updateAmount.getOrderAmount()) == -1) {
if (updateAmount.getReturnSalaryAmount().compareTo(BigDecimal.ZERO)!=0){ if (updateAmount.getReturnSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal orderAmount = updateAmount.getOrderAmount(); BigDecimal orderAmount = updateAmount.getOrderAmount();
BigDecimal returnSalaryAmount = updateAmount.getReturnSalaryAmount(); BigDecimal returnSalaryAmount = updateAmount.getReturnSalaryAmount();
BigDecimal subtract = orderAmount.subtract(returnSalaryAmount); BigDecimal subtract = orderAmount.subtract(returnSalaryAmount);
publisherWalletFlowVO.setSalaryAmount(subtract.negate()); publisherWalletFlowVO.setSalaryAmount(subtract.negate());
if (requirementsInfoDO.getSalaryAmount().compareTo(updateAmount.getReturnSalaryAmount())==0){ if (requirementsInfoDO.getSalaryAmount().compareTo(updateAmount.getReturnSalaryAmount()) == 0) {
publisherWalletFlowVO.setSalaryAmount(BigDecimal.ZERO); publisherWalletFlowVO.setSalaryAmount(BigDecimal.ZERO);
} }
if (requirementsInfoDO.getSalaryAmount().compareTo(updateAmount.getReturnSalaryAmount())==1){ if (requirementsInfoDO.getSalaryAmount().compareTo(updateAmount.getReturnSalaryAmount()) == 1) {
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().subtract(updateAmount.getReturnSalaryAmount()).negate()); publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().subtract(updateAmount.getReturnSalaryAmount()).negate());
} }
}else{ } else {
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate()); publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate());
} }
if (updateAmount.getReturnCashAmount().compareTo(BigDecimal.ZERO)!=0){ if (updateAmount.getReturnCashAmount().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal orderAmount = updateAmount.getOrderAmount(); BigDecimal orderAmount = updateAmount.getOrderAmount();
BigDecimal returnCashAmount = updateAmount.getReturnCashAmount(); BigDecimal returnCashAmount = updateAmount.getReturnCashAmount();
BigDecimal subtract = orderAmount.subtract(returnCashAmount); BigDecimal subtract = orderAmount.subtract(returnCashAmount);
publisherWalletFlowVO.setCashAmount(subtract.negate()); publisherWalletFlowVO.setCashAmount(subtract.negate());
if (requirementsInfoDO.getCashAmount().compareTo(updateAmount.getReturnCashAmount())==0){ if (requirementsInfoDO.getCashAmount().compareTo(updateAmount.getReturnCashAmount()) == 0) {
publisherWalletFlowVO.setCashAmount(BigDecimal.ZERO); publisherWalletFlowVO.setCashAmount(BigDecimal.ZERO);
} }
if (updateAmount.getReturnCashAmount().compareTo(requirementsInfoDO.getCashAmount())==-1){ if (updateAmount.getReturnCashAmount().compareTo(requirementsInfoDO.getCashAmount()) == -1) {
BigDecimal cashAmount = requirementsInfoDO.getCashAmount(); BigDecimal cashAmount = requirementsInfoDO.getCashAmount();
BigDecimal returnCashAmount1 = updateAmount.getReturnCashAmount(); BigDecimal returnCashAmount1 = updateAmount.getReturnCashAmount();
BigDecimal subtract1 = cashAmount.subtract(returnCashAmount1); BigDecimal subtract1 = cashAmount.subtract(returnCashAmount1);
publisherWalletFlowVO.setCashAmount(subtract1.negate()); publisherWalletFlowVO.setCashAmount(subtract1.negate());
} }
}else{ } else {
publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate()); publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate());
} }
} }
if (updateAmount.getUpdateOrderAmount().compareTo(updateAmount.getOrderAmount())==1){ if (updateAmount.getUpdateOrderAmount().compareTo(updateAmount.getOrderAmount()) == 1) {
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate()); publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate());
publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate()); publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate());
} }
...@@ -2373,8 +2414,8 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2373,8 +2414,8 @@ public class RequirementsServiceImpl implements RequirementsService {
publisherWalletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId()); publisherWalletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId());
publisherWalletFlowVO.setOperateUserAccountId(agreeVO.getUserAccountId()); publisherWalletFlowVO.setOperateUserAccountId(agreeVO.getUserAccountId());
publisherWalletFlowVO.setModeOfPayment(1000); publisherWalletFlowVO.setModeOfPayment(1000);
if (updateAmount.getCashAmount().compareTo(BigDecimal.ZERO)!=0|| if (updateAmount.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
updateAmount.getSalaryAmount().compareTo(BigDecimal.ZERO)!=0){ updateAmount.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal cash = publisherWalletFlowVO.getCashAmount().negate(); BigDecimal cash = publisherWalletFlowVO.getCashAmount().negate();
BigDecimal salary = publisherWalletFlowVO.getSalaryAmount().negate(); BigDecimal salary = publisherWalletFlowVO.getSalaryAmount().negate();
...@@ -2385,12 +2426,13 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2385,12 +2426,13 @@ public class RequirementsServiceImpl implements RequirementsService {
// publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getSalaryAmount().negate()); // publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getSalaryAmount().negate());
//publisherWalletFlowVO.setRefundCashAmount(updateAmount.getCashAmount().negate()); //publisherWalletFlowVO.setRefundCashAmount(updateAmount.getCashAmount().negate());
}if(updateAmount.getReturnCashAmount().compareTo(BigDecimal.ZERO)!=0 || }
updateAmount.getReturnSalaryAmount().compareTo(BigDecimal.ZERO)!=0){ if (updateAmount.getReturnCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
updateAmount.getReturnSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
publisherWalletFlowVO.setRefundCashAmount(updateAmount.getReturnCashAmount()); publisherWalletFlowVO.setRefundCashAmount(updateAmount.getReturnCashAmount());
publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getReturnSalaryAmount()); publisherWalletFlowVO.setRefundSalaryAmount(updateAmount.getReturnSalaryAmount());
} }
if (updateAmount.getReturnWeChat().compareTo(BigDecimal.ZERO)!=0){ if (updateAmount.getReturnWeChat().compareTo(BigDecimal.ZERO) != 0) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
applyRefundVO.setReason("飞手确认退款"); applyRefundVO.setReason("飞手确认退款");
applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber()); applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber());
...@@ -2399,14 +2441,13 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2399,14 +2441,13 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
//给飞手金额 //给飞手金额
BigDecimal updateOrderAmount = updateAmount.getUpdateOrderAmount(); BigDecimal updateOrderAmount = updateAmount.getUpdateOrderAmount();
BigDecimal multiply = updateOrderAmount.multiply(new BigDecimal(0.9)).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal multiply = updateOrderAmount.multiply(new BigDecimal(1.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
publisherWalletFlowVO.setFlyerSalaryAmount(multiply); publisherWalletFlowVO.setFlyerSalaryAmount(multiply);
//平台收益 //平台收益
earnings = updateOrderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP); earnings = updateOrderAmount.multiply(new BigDecimal(0.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
} }
flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount()); flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount());
...@@ -2418,7 +2459,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2418,7 +2459,7 @@ public class RequirementsServiceImpl implements RequirementsService {
/** /**
* 退飞手金额 * 退飞手金额
*/ */
if (serviceDO.getWeChat().compareTo(BigDecimal.ZERO)!=0){ if (serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO(); ApplyRefundVO applyRefundVO = new ApplyRefundVO();
applyRefundVO.setReason("原路退回"); applyRefundVO.setReason("原路退回");
applyRefundVO.setOutTradeNo(serviceDO.getWechatPayOrderNumber()); applyRefundVO.setOutTradeNo(serviceDO.getWechatPayOrderNumber());
...@@ -2431,21 +2472,21 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2431,21 +2472,21 @@ public class RequirementsServiceImpl implements RequirementsService {
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO); walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO); walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
flyerCancelNO(walletFlowVO,request.getHeader("token")); flyerCancelNO(walletFlowVO, request.getHeader("token"));
BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings(); BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings();
BigDecimal add = orderEarnings.add(earnings); BigDecimal add = orderEarnings.add(earnings);
requirementsDao.updateOrderEarnings(add,agreeVO.getRequirementsInfoId()); requirementsDao.updateOrderEarnings(add, agreeVO.getRequirementsInfoId());
requirementsDao.updateInfo(agreeVO.getRequirementsInfoId(), 5); requirementsDao.updateInfo(agreeVO.getRequirementsInfoId(), 5);
requirementsDao.updateScene(agreeVO.getRequirementsInfoId(), 5); requirementsDao.updateScene(agreeVO.getRequirementsInfoId(), 5);
return ResultBody.success(); return ResultBody.success();
} }
@Override @Override
public ResultBody publishService(ServiceRequirementsVO serviceRequirementsVO, HttpServletRequest request) { public ResultBody publishService(ServiceRequirementsVO serviceRequirementsVO, HttpServletRequest request) {
//这个是几个人的订单
Integer sum = serviceRequirementsVO.getRequireNum();
//获取用户基本信息 //获取用户基本信息
UserAccountSimpleDTO userAccountSimpleDTO = feignGetUserSimpleInfo(serviceRequirementsVO.getUserAccountId(), request); UserAccountSimpleDTO userAccountSimpleDTO = feignGetUserSimpleInfo(serviceRequirementsVO.getUserAccountId(), request);
String openid = userAccountSimpleDTO.getOpenid(); String openid = userAccountSimpleDTO.getOpenid();
...@@ -2580,8 +2621,6 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2580,8 +2621,6 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
} }
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
if (orderLevelEnum.equals("RUSH_ORDER")) { if (orderLevelEnum.equals("RUSH_ORDER")) {
//加急的云享金 //加急的云享金
...@@ -2646,9 +2685,6 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2646,9 +2685,6 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
//不存在加急或者置顶 //不存在加急或者置顶
if (rushAndTop.compareTo(BigDecimal.ZERO) == 0) { if (rushAndTop.compareTo(BigDecimal.ZERO) == 0) {
...@@ -2697,8 +2733,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2697,8 +2733,7 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
} }
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) { if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
System.out.println(requirementsInfoDO); System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO); System.out.println(publisherWalletFlowVO);
...@@ -2722,9 +2757,12 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2722,9 +2757,12 @@ public class RequirementsServiceImpl implements RequirementsService {
IndustryTypeDTO industryTypeDTO = getIndustryTypeById(requirementsInfoDO.getServiceId()); IndustryTypeDTO industryTypeDTO = getIndustryTypeById(requirementsInfoDO.getServiceId());
requirementsInfoDO.setServiceName(industryTypeDTO.getTypeName()); requirementsInfoDO.setServiceName(industryTypeDTO.getTypeName());
requirementsInfoDO.setOpenid(openid); requirementsInfoDO.setOpenid(openid);
// sum是1说明订单只需一个人 sum>1 说明是多人需要创建子订单
requirementsInfoDO.setRepertory(requirementsInfoDO.getRequireNum());
requirementsDao.addPublishService(requirementsInfoDO); requirementsDao.addPublishService(requirementsInfoDO);
RequirementsAmountDO requirementsAmountDO = new RequirementsAmountDO(requirementsInfoDO); RequirementsAmountDO requirementsAmountDO = new RequirementsAmountDO(requirementsInfoDO);
requirementsDao.addAmount(requirementsAmountDO); requirementsDao.addAmount(requirementsAmountDO);
if (sum == 1) {
requirementsDao.insertPlatformOrderEarnings(new BigDecimal(0), requirementsInfoDO.getId(), 0); requirementsDao.insertPlatformOrderEarnings(new BigDecimal(0), requirementsInfoDO.getId(), 0);
if (requirementsAmountDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 if (requirementsAmountDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 || requirementsAmountDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0
...@@ -2734,6 +2772,29 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2734,6 +2772,29 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
return ResultBody.success(); return ResultBody.success();
} else { } else {
//循环添加子订单
for (int i = 0; i < sum; i++) {
ServiceRequirementsSonDO requirementsSonDO = new ServiceRequirementsSonDO(requirementsInfoDO);
requirementsDao.addPublishServiceSon(requirementsSonDO);
System.out.println(requirementsSonDO);
RequirementsAmountDO requirementsAmountSonDO = new RequirementsAmountDO(requirementsSonDO);
System.out.println(requirementsAmountSonDO);
System.out.println("-------------------------");
requirementsDao.addAmount(requirementsAmountSonDO);
requirementsDao.insertPlatformOrderEarnings(new BigDecimal(0), requirementsSonDO.getId(), 0);
if (requirementsAmountSonDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountSonDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountSonDO.getLevelCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountSonDO.getLevelSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
feignWalletFlow(publisherWalletFlowVO, request.getHeader("token"));
}
}
return ResultBody.success();
}
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法 //云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败"); return ResultBody.success("下单失败");
} }
...@@ -2796,6 +2857,40 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2796,6 +2857,40 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override @Override
public ResultBody grabTheOrder(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request) { public ResultBody grabTheOrder(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request) {
//这是这个订单所需要的总人数
Integer requireNum = grabTheOrderVO.getRequireNum();
if (requireNum == null || grabTheOrderVO.getRequirementsInfoId() == null) {
return ResultBody.error("参数不全");
}
Integer fatherRequireId = null, fatherRepertory = null;
//requireNum >= 2就说明这个订单是分开的有子订单
if (requireNum >= 2) {
fatherRequireId = grabTheOrderVO.getRequirementsInfoId();
//不让同一个用户对一个多人订单重复下单
if (requirementsDao.selectBooleanByFatherIdAndUserId(fatherRequireId, grabTheOrderVO.getUserAccountId()) > 0) {
return ResultBody.error("不能重复抢一个订单");
}
ServiceRequirementsDO fatherRequirementsInfoDO = requirementsDao.grabTheOrder(fatherRequireId);
fatherRepertory = fatherRequirementsInfoDO.getRepertory();
if (fatherRepertory <= 0) {
return ResultBody.error("需求已被其他人抢走");
}
if (grabTheOrderVO.getRequirementsInfoId().equals(fatherRequirementsInfoDO.getId()) && grabTheOrderVO.getUserAccountId().equals(fatherRequirementsInfoDO.getUserAccountId())) {
return ResultBody.error("自己不能抢自己发布的需求");
}
//获取没被抢的子订单id
Integer requirementsSonInfoId = requirementsDao.getRequirementsSonInfoId(fatherRequireId);
grabTheOrderVO.setRequirementsInfoId(requirementsSonInfoId);
} else {
//单人被拒绝后也不能再次抢单
Integer countRefuse = requirementsDao.selectRequirementsRefuse(grabTheOrderVO.getRequirementsInfoId(), grabTheOrderVO.getUserAccountId());
if (countRefuse == 1) {
return ResultBody.error("不能重复抢一个订单");
}
}
UserAccountSimpleDTO userAccountSimpleDTO = feignGetUserSimpleInfo(grabTheOrderVO.getUserAccountId(), request); UserAccountSimpleDTO userAccountSimpleDTO = feignGetUserSimpleInfo(grabTheOrderVO.getUserAccountId(), request);
String openid = userAccountSimpleDTO.getOpenid(); String openid = userAccountSimpleDTO.getOpenid();
...@@ -2804,6 +2899,7 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2804,6 +2899,7 @@ public class RequirementsServiceImpl implements RequirementsService {
if (grabTheOrderVO.getRequirementsInfoId().equals(requirementsInfoDO.getId()) && grabTheOrderVO.getUserAccountId().equals(requirementsInfoDO.getUserAccountId())) { if (grabTheOrderVO.getRequirementsInfoId().equals(requirementsInfoDO.getId()) && grabTheOrderVO.getUserAccountId().equals(requirementsInfoDO.getUserAccountId())) {
return ResultBody.error("自己不能抢自己发布的需求"); return ResultBody.error("自己不能抢自己发布的需求");
} }
//飞手 //飞手
PilotCertificationInteriorDTO pilot = feignInteriorDetailPilot(grabTheOrderVO.getUserAccountId(), request); PilotCertificationInteriorDTO pilot = feignInteriorDetailPilot(grabTheOrderVO.getUserAccountId(), request);
if (pilot == null) { if (pilot == null) {
...@@ -2821,110 +2917,117 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -2821,110 +2917,117 @@ public class RequirementsServiceImpl implements RequirementsService {
RequirementsServiceDO requirementsServiceDO = new RequirementsServiceDO(pilot, requirementsInfoDO); RequirementsServiceDO requirementsServiceDO = new RequirementsServiceDO(pilot, requirementsInfoDO);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO); IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
//用户云享金+用户佣金>总金额 // //用户云享金+用户佣金>总金额
//剩余后台云享金 // //剩余后台云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt(); // BigDecimal cashAmt = payWalletDTO.getCashAmt();
//剩余佣金 // //剩余佣金
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt(); // BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
//用户云享金加上佣金的总金额 // //用户云享金加上佣金的总金额
BigDecimal cashAndSalary = cashAmt.add(salaryAmt); // BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
//需要支付的总金额(任务佣金) // //需要支付的总金额(任务佣金)
BigDecimal totalAmount = requirementsInfoDO.getOrderAmount(); // BigDecimal totalAmount = requirementsInfoDO.getOrderAmount();
BigDecimal bigDecimal = new BigDecimal(0.3); // BigDecimal bigDecimal = new BigDecimal(0.0);
totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP); // totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
String json = stringRedisTemplate.opsForValue().get(grabTheOrderVO.getWechatPayOrderNumber() + grabTheOrderVO.getUserAccountId()); // String json = stringRedisTemplate.opsForValue().get(grabTheOrderVO.getWechatPayOrderNumber() + grabTheOrderVO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class); // GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
if (orderNumberDTO != null) { // if (orderNumberDTO != null) {
IsNullConvertZeroUtil.checkIsNull(orderNumberDTO); // IsNullConvertZeroUtil.checkIsNull(orderNumberDTO);
} // }
//
//需要冻结的金额 // //需要冻结的金额
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO(); // FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO); // IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO); // //IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//PublisherWalletFlowVO publisherWalletFlowVO = walletFlowVO.getPublisherWalletFlowVO(); // //PublisherWalletFlowVO publisherWalletFlowVO = walletFlowVO.getPublisherWalletFlowVO();
BigDecimal tempTotalAmount = totalAmount; // BigDecimal tempTotalAmount = totalAmount;
String paymentType = grabTheOrderVO.getPaymentType(); // String paymentType = grabTheOrderVO.getPaymentType();
String[] split = paymentType.split(","); // String[] split = paymentType.split(",");
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet()); // Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
TreeSet<String> objects = new TreeSet<>(collect); // TreeSet<String> objects = new TreeSet<>(collect);
for (String type : objects) { // for (String type : objects) {
switch (type) { // switch (type) {
case "1": // case "1":
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) {
flyerWalletFlowVO.setCashAmount(tempTotalAmount); // flyerWalletFlowVO.setCashAmount(tempTotalAmount);
requirementsServiceDO.setCashAmount(tempTotalAmount); // requirementsServiceDO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO; // tempTotalAmount = BigDecimal.ZERO;
} else { // } else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt); // tempTotalAmount = tempTotalAmount.subtract(cashAmt);
flyerWalletFlowVO.setCashAmount(cashAmt); // flyerWalletFlowVO.setCashAmount(cashAmt);
requirementsServiceDO.setCashAmount(cashAmt); // requirementsServiceDO.setCashAmount(cashAmt);
} // }
} // }
break; // break;
case "2": // case "2":
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) {
flyerWalletFlowVO.setSalaryAmount(tempTotalAmount); // flyerWalletFlowVO.setSalaryAmount(tempTotalAmount);
requirementsServiceDO.setSalaryAmount(tempTotalAmount); // requirementsServiceDO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO; // tempTotalAmount = BigDecimal.ZERO;
} else { // } else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt); // tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
flyerWalletFlowVO.setSalaryAmount(salaryAmt); // flyerWalletFlowVO.setSalaryAmount(salaryAmt);
requirementsServiceDO.setSalaryAmount(salaryAmt); // requirementsServiceDO.setSalaryAmount(salaryAmt);
} // }
} // }
break; // break;
case "3": // case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) { // if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
// publisherWalletFlowVO.setWeChat(tempTotalAmount); // // publisherWalletFlowVO.setWeChat(tempTotalAmount);
requirementsServiceDO.setWeChat(tempTotalAmount); // requirementsServiceDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO; // tempTotalAmount = BigDecimal.ZERO;
} // }
break; // break;
default: // default:
break; // break;
} // }
} // }
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());
if (orderNumberDTO != null) { // if (orderNumberDTO != null) {
requirementsServiceDO.setWeChat(orderNumberDTO.getWeChatPay()); // requirementsServiceDO.setWeChat(orderNumberDTO.getWeChatPay());
requirementsServiceDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber()); // 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);
BigDecimal cashAmount = requirementsServiceDO.getCashAmount(); // BigDecimal cashAmount = requirementsServiceDO.getCashAmount();
BigDecimal salaryAmount = requirementsServiceDO.getSalaryAmount(); // BigDecimal salaryAmount = requirementsServiceDO.getSalaryAmount();
BigDecimal weChat = requirementsServiceDO.getWeChat(); // BigDecimal weChat = requirementsServiceDO.getWeChat();
BigDecimal add = cashAmount.add(salaryAmount); // BigDecimal add = cashAmount.add(salaryAmount);
BigDecimal add1 = add.add(weChat); // BigDecimal add1 = add.add(weChat);
requirementsServiceDO.setPreemptTotalAmount(add1); // requirementsServiceDO.setPreemptTotalAmount(add1);
requirementsServiceDO.setOpenid(openid); // requirementsServiceDO.setOpenid(openid);
requirementsServiceDO.setPhoneNum(grabTheOrderVO.getPhoneNum()); // requirementsServiceDO.setPhoneNum(grabTheOrderVO.getPhoneNum());
//微信是否支付成功 //微信是否支付成功
requirementsDao.insertService(requirementsServiceDO); requirementsDao.insertService(requirementsServiceDO);
requirementsInfoDO.setRepertory(repertory - 1); requirementsInfoDO.setRepertory(repertory - 1);
requirementsDao.updateGrabTheOrder(grabTheOrderVO.getRequirementsInfoId(), requirementsInfoDO.getRepertory()); requirementsDao.updateGrabTheOrder(grabTheOrderVO.getRequirementsInfoId(), requirementsInfoDO.getRepertory());
if (requirementsServiceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 // if (requirementsServiceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsServiceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) { // || requirementsServiceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
walletFlow(flyerWalletFlowVO, request.getHeader("token")); // walletFlow(flyerWalletFlowVO, request.getHeader("token"));
// }
//如果是多人订单 还要去修改父订单还需多少人字段
if (requireNum >= 2) {
Integer repertoryNeed = requirementsDao.selectRepertoryByRequireId(fatherRequireId);
requirementsDao.updateRequirementsInfoRepertory(fatherRequireId, repertoryNeed);
} }
OnlyRequirementsInfoId onlyRequirementsInfoId = new OnlyRequirementsInfoId();
onlyRequirementsInfoId.setRequirementsInfoId(grabTheOrderVO.getRequirementsInfoId());
return ResultBody.success(); return ResultBody.success(onlyRequirementsInfoId);
} else { // } else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法 // //云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("抢单失败"); // return ResultBody.success("抢单失败");
} // }
} }
...@@ -3000,11 +3103,11 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -3000,11 +3103,11 @@ public class RequirementsServiceImpl implements RequirementsService {
//给发布者发送 //给发布者发送
BigDecimal orderAmount = infoDO.getOrderAmount(); BigDecimal orderAmount = infoDO.getOrderAmount();
BigDecimal bigDecimal = new BigDecimal(0.9); BigDecimal bigDecimal = new BigDecimal(1.0);
BigDecimal bigDecimal1 = orderAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal bigDecimal1 = orderAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
publisherWalletFlowVO.setModeOfPayment(700); publisherWalletFlowVO.setModeOfPayment(700);
publisherWalletFlowVO.setFlyerSalaryAmount(bigDecimal1); publisherWalletFlowVO.setFlyerSalaryAmount(bigDecimal1);
BigDecimal bigDecimal2 = orderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal bigDecimal2 = orderAmount.multiply(new BigDecimal(0.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
publisherWalletFlowVO.setCashAmount(infoDO.getCashAmount().negate()); publisherWalletFlowVO.setCashAmount(infoDO.getCashAmount().negate());
publisherWalletFlowVO.setSalaryAmount(infoDO.getSalaryAmount().negate()); publisherWalletFlowVO.setSalaryAmount(infoDO.getSalaryAmount().negate());
...@@ -3070,6 +3173,48 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -3070,6 +3173,48 @@ public class RequirementsServiceImpl implements RequirementsService {
return ResultBody.success(serviceEvaluateDTO); return ResultBody.success(serviceEvaluateDTO);
} }
@Override
public PageResult selectRequireSonInfo(Integer userAccountId, MyPublishQO param) {
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
param.setUserAccountId(userAccountId);
int count = requirementsDao.myPublishcount(param);
List<RequirementsInfoDO> requirementsInfoDOS = requirementsDao.selectRequireSonInfo(param);
List<RequirementsInfoVO> collect = requirementsInfoDOS.stream().map(RequirementsInfoDO::buildRequirementsInfoVO).collect(Collectors.toList());
List<IndustryTypeDTO> industryTypeDTOS = listIndustry();
for (RequirementsInfoVO requirementsInfoVO : collect) {
for (IndustryTypeDTO industryTypeDTO : industryTypeDTOS) {
if (requirementsInfoVO.getServiceId() != null && requirementsInfoVO.getServiceId().equals(industryTypeDTO.getId())) {
requirementsInfoVO.setServiceName(industryTypeDTO.getTypeName());
}
}
}
return PageResult.buildPage(pageNo, param.getPageSize(), count, collect);
}
@Override
public ResultBody agreeOrRefusePilot(AgreeOrRefusePilotQO param) {
//判断飞手是否被同意 2就是该抵达现场下一步流程
Boolean agreeOrder = param.getServiceFlowId() == 2;
requirementsDao.insertAgreePilotOrder(param);
Integer requireId = param.getRequireInfoId();
//同意
if (agreeOrder) {
requirementsDao.updateScene(requireId, 2);
requirementsDao.updateInfo(requireId, 2);
} else {
//修改订单所需人数以及订单状态
requirementsDao.updateRequirementsInfoByRefusePilot(requireId);
Integer fatherRequireId = requirementsDao.selectFatherRequireIdBySonId(requireId);
Integer repertory = requirementsDao.selectRepertoryByRequireId(fatherRequireId);
requirementsDao.updateRequirementsInfoRepertory(fatherRequireId, repertory);
requirementsDao.updateRequirementsService(requireId, param.getPilotCertificationUserId());
//TODO 被拒绝后应该退回飞手的押金
}
return ResultBody.success();
}
public UserAccountSimpleDTO feignGetUserSimpleInfo(Integer userAccountId, HttpServletRequest request) { public UserAccountSimpleDTO feignGetUserSimpleInfo(Integer userAccountId, HttpServletRequest request) {
String token = request.getHeader("token"); String token = request.getHeader("token");
......
...@@ -483,7 +483,9 @@ ...@@ -483,7 +483,9 @@
ri.insurance, ri.insurance,
ri.publish, ri.publish,
ri.service_name, ri.service_name,
ri.create_time ri.create_time,
ri.repertory,
ri.require_num
FROM requirements_info ri FROM requirements_info ri
left join requirements_amount ra left join requirements_amount ra
on ra.requirements_info_id = ri.id and ri.user_account_id = ra.user_account_id on ra.requirements_info_id = ri.id and ri.user_account_id = ra.user_account_id
...@@ -492,6 +494,8 @@ ...@@ -492,6 +494,8 @@
AND ri.service_flow = 1 AND ri.service_flow = 1
AND ri.is_deleted = 0 AND ri.is_deleted = 0
AND ri.service_flow_id != 7 AND ri.service_flow_id != 7
AND father_require_id = 0
AND repertory > 0
ORDER BY ri.order_level_amount DESC, ORDER BY ri.order_level_amount DESC,
ri.id DESC ri.id DESC
</select> </select>
...@@ -512,6 +516,9 @@ ...@@ -512,6 +516,9 @@
ri.publish_phone, ri.publish_phone,
ri.publisher_number, ri.publisher_number,
ri.service_id, ri.service_id,
ri.repertory,
ri.require_num,
ri.father_require_id,
ra.total_amount, ra.total_amount,
ri.insurance, ri.insurance,
sf.doing, sf.doing,
...@@ -538,7 +545,7 @@ ...@@ -538,7 +545,7 @@
LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
AND ra.user_account_id = ri.user_account_id AND ra.user_account_id = ri.user_account_id
WHERE ri.id = #{id} WHERE ri.id = #{id} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
<insert id="addPublishService" parameterType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO" <insert id="addPublishService" parameterType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO"
...@@ -547,12 +554,26 @@ ...@@ -547,12 +554,26 @@
require_description, create_time, require_description, create_time,
update_time, task_start_time, task_end_time, task_address, longitude, update_time, task_start_time, task_end_time, task_address, longitude,
latitude, publisher_number, insurance, publish, latitude, publisher_number, insurance, publish,
service_flow_id, adcode, order_level_amount, openid, service_name,province_code,city_code,district_code) service_flow_id, adcode, order_level_amount, openid, service_name,province_code,city_code,district_code,require_num,repertory)
VALUES (#{serviceId}, #{userAccountId}, #{publishName}, #{publishPhone}, VALUES (#{serviceId}, #{userAccountId}, #{publishName}, #{publishPhone},
#{requireDescription}, NOW(), #{requireDescription}, NOW(),
NOW(), #{taskStartTime}, #{taskEndTime}, #{taskAddress}, #{longitude}, NOW(), #{taskStartTime}, #{taskEndTime}, #{taskAddress}, #{longitude},
#{latitude}, #{publisherNumber}, #{insurance}, 1, 1, #{adcode}, #{orderLevelAmount}, #{openid}, #{latitude}, #{publisherNumber}, #{insurance}, 1, 1, #{adcode}, #{orderLevelAmount}, #{openid},
#{serviceName},#{provinceCode},#{cityCode},#{districtCode}); #{serviceName},#{provinceCode},#{cityCode},#{districtCode},#{requireNum},#{repertory});
</insert>
<insert id="addPublishServiceSon" parameterType="com.mmc.csf.release.entity.requirements.ServiceRequirementsSonDO"
keyProperty="id" useGeneratedKeys="true">
INSERT INTO requirements_info(service_id, user_account_id, publish_name, publish_phone,
require_description, create_time,
update_time, task_start_time, task_end_time, task_address, longitude,
latitude, publisher_number, insurance, publish,
service_flow_id, adcode, order_level_amount, openid, service_name,province_code,city_code,district_code,father_require_id)
VALUES (#{serviceId}, #{userAccountId}, #{publishName}, #{publishPhone},
#{requireDescription}, NOW(),
NOW(), #{taskStartTime}, #{taskEndTime}, #{taskAddress}, #{longitude},
#{latitude}, #{publisherNumber}, #{insurance}, 1, 1, #{adcode}, #{orderLevelAmount}, #{openid},
#{serviceName},#{provinceCode},#{cityCode},#{districtCode},#{fatherRequireId});
</insert> </insert>
<insert id="addAmount" parameterType="com.mmc.csf.release.entity.requirements.RequirementsAmountDO" <insert id="addAmount" parameterType="com.mmc.csf.release.entity.requirements.RequirementsAmountDO"
...@@ -600,7 +621,7 @@ ...@@ -600,7 +621,7 @@
<update id="updateGrabTheOrder"> <update id="updateGrabTheOrder">
UPDATE requirements_info UPDATE requirements_info
set repertory=#{repertory}, set repertory=#{repertory},
service_flow_id = 2, service_flow_id = 10,
update_time=NOW() update_time=NOW()
where id = #{requirementsInfoId} where id = #{requirementsInfoId}
</update> </update>
...@@ -613,7 +634,7 @@ ...@@ -613,7 +634,7 @@
wechat_pay_order_number, service_flow_id, preempt_total_amount, openid, wechat_pay_order_number, service_flow_id, preempt_total_amount, openid,
create_time, update_time, preempt_phone) create_time, update_time, preempt_phone)
VALUES (#{requirementsInfoId}, #{pilotCertificationId}, #{pilotCertificationUserId}, VALUES (#{requirementsInfoId}, #{pilotCertificationId}, #{pilotCertificationUserId},
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 2, #{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber},10,
#{preemptTotalAmount}, #{openid}, NOW(), NOW(), #{phoneNum}); #{preemptTotalAmount}, #{openid}, NOW(), NOW(), #{phoneNum});
</insert> </insert>
...@@ -628,14 +649,15 @@ ...@@ -628,14 +649,15 @@
UPDATE requirements_service UPDATE requirements_service
set service_flow_id=#{serviceFlowId}, set service_flow_id=#{serviceFlowId},
update_time=NOW() update_time=NOW()
where requirements_info_id = #{requirementsInfoId} where requirements_info_id = #{requirementsInfoId} and (service_flow_id != 11 or service_flow_id is NULL)
</update> </update>
<update id="updateInfo"> <update id="updateInfo">
UPDATE requirements_info UPDATE requirements_info
set service_flow_id=#{serviceFlowId}, set service_flow_id=#{serviceFlowId},
update_time=NOW() update_time=NOW()
where id = #{requirementsInfoId} where id = #{requirementsInfoId} and service_flow_id != 11
and is_deleted != 1
</update> </update>
<update id="updateFlow"> <update id="updateFlow">
...@@ -698,6 +720,7 @@ ...@@ -698,6 +720,7 @@
#{userAccountId}); #{userAccountId});
</insert> </insert>
<select id="evaluateDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceEvaluateDO"> <select id="evaluateDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceEvaluateDO">
select id, select id,
evaluation_content, evaluation_content,
...@@ -757,7 +780,9 @@ ...@@ -757,7 +780,9 @@
sf.flyer_port, sf.flyer_port,
sf.order_status, sf.order_status,
ri.publish, ri.publish,
rau.update_order_amount ri.require_num,
rau.update_order_amount,
ri.repertory
FROM FROM
requirements_info ri requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
...@@ -765,6 +790,7 @@ ...@@ -765,6 +790,7 @@
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_amount_update rau ON rau.requirements_info_id = ri.id LEFT JOIN requirements_amount_update rau ON rau.requirements_info_id = ri.id
WHERE ri.user_account_id = #{userAccountId} and ri.is_deleted!=1 WHERE ri.user_account_id = #{userAccountId} and ri.is_deleted!=1
and father_require_id = 0
<if test=" requirementsInfoId != null "> <if test=" requirementsInfoId != null ">
and ri.id=#{requirementsInfoId} and ri.id=#{requirementsInfoId}
</if> </if>
...@@ -826,10 +852,13 @@ ...@@ -826,10 +852,13 @@
FROM FROM
requirements_info ri requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id # TODO 可能会有问题 删除的
# LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_amount_update rau ON rau.requirements_info_id = ri.id LEFT JOIN requirements_amount_update rau ON rau.requirements_info_id = ri.id
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
#增加的
LEFT JOIN service_flow sf ON sf.id = rs.service_flow_id
WHERE rs.pilot_certification_user_id = #{userAccountId} AND rs.is_deleted !=1 WHERE rs.pilot_certification_user_id = #{userAccountId} AND rs.is_deleted !=1
<if test=" requirementsInfoId != null "> <if test=" requirementsInfoId != null ">
and ri.id=#{requirementsInfoId} and ri.id=#{requirementsInfoId}
...@@ -930,7 +959,7 @@ ...@@ -930,7 +959,7 @@
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.pilot_certification_user_id = #{userAccountId} WHERE rs.pilot_certification_user_id = #{userAccountId}
AND rs.requirements_info_id = #{requirementsInfoId} AND rs.requirements_info_id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
<select id="customerDroneFlyerCancel" resultType="com.mmc.csf.release.entity.requirements.RequirementsServiceDO"> <select id="customerDroneFlyerCancel" resultType="com.mmc.csf.release.entity.requirements.RequirementsServiceDO">
...@@ -974,7 +1003,7 @@ ...@@ -974,7 +1003,7 @@
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.requirements_info_id = #{requirementsInfoId} WHERE rs.requirements_info_id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
<select id="publisherCancel" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO"> <select id="publisherCancel" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
...@@ -1024,7 +1053,7 @@ ...@@ -1024,7 +1053,7 @@
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id
WHERE ri.user_account_id = #{userAccountId} WHERE ri.user_account_id = #{userAccountId}
AND ri.id = #{requirementsInfoId} AND ri.id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
...@@ -1074,7 +1103,7 @@ ...@@ -1074,7 +1103,7 @@
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id
WHERE ri.id = #{requirementsInfoId} WHERE ri.id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
...@@ -1124,7 +1153,7 @@ ...@@ -1124,7 +1153,7 @@
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id
WHERE ri.id = #{requirementsInfoId} WHERE ri.id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
<select id="publisherCancelFlyer" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO"> <select id="publisherCancelFlyer" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
...@@ -1173,7 +1202,7 @@ ...@@ -1173,7 +1202,7 @@
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id
WHERE ri.id = #{requirementsInfoId} WHERE ri.id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
...@@ -1222,7 +1251,7 @@ ...@@ -1222,7 +1251,7 @@
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id LEFT JOIN requirements_service rs ON rs.requirements_info_id = ri.id
WHERE ri.publisher_number = #{publisherNumber} WHERE ri.publisher_number = #{publisherNumber} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
<select id="flowDictionary" resultType="com.mmc.csf.release.entity.requirements.FlowDictionaryDO"> <select id="flowDictionary" resultType="com.mmc.csf.release.entity.requirements.FlowDictionaryDO">
...@@ -1268,6 +1297,16 @@ ...@@ -1268,6 +1297,16 @@
</collection> </collection>
</resultMap> </resultMap>
<resultMap id="serviceAgreePilotOrderMap" type="com.mmc.csf.infomation.dto.AgreePilotOrderDTO">
<result property="createTime" column="create_time"/>
<result property="requirementsInfoId" column="require_info_id"/>
<result property="serviceFlowId" column="service_flow_id"/>
<collection property="flowDictionaryDTO" ofType="com.mmc.csf.infomation.dto.FlowDictionaryDTO"
select="selectServiceFlow"
column="{serviceFlowId=service_flow_id}">
</collection>
</resultMap>
<resultMap id="settleAccountsMap" type="com.mmc.csf.infomation.dto.ServiceSettleAccountsDTO"> <resultMap id="settleAccountsMap" type="com.mmc.csf.infomation.dto.ServiceSettleAccountsDTO">
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
...@@ -1329,7 +1368,7 @@ ...@@ -1329,7 +1368,7 @@
<select id="requirementsServiceDTO" resultMap="resultMap"> <select id="requirementsServiceDTO" resultMap="resultMap">
select requirements_info_id, create_time, update_time, service_flow select requirements_info_id, create_time, update_time, service_flow
from requirements_service from requirements_service
where requirements_info_id = #{requirementsInfoId} where requirements_info_id = #{requirementsInfoId} and (service_flow_id != 11 or service_flow_id is NULL)
</select> </select>
<select id="serviceArriveSceneDTO" resultMap="resultMapCommon"> <select id="serviceArriveSceneDTO" resultMap="resultMapCommon">
...@@ -1347,6 +1386,11 @@ ...@@ -1347,6 +1386,11 @@
where requirements_info_id = #{requirementsInfoId} where requirements_info_id = #{requirementsInfoId}
</select> </select>
<select id="serviceAgreePilotOrderDTO" resultMap="serviceAgreePilotOrderMap">
select require_info_id,create_time,service_flow_id from agree_pilot_order
where service_flow_id = 2 and require_info_id = #{requirementsInfoId}
</select>
<select id="serviceFulfilATaskDTO" resultMap="serviceFulfilATaskMap"> <select id="serviceFulfilATaskDTO" resultMap="serviceFulfilATaskMap">
SELECT id, SELECT id,
task_describe, task_describe,
...@@ -1510,7 +1554,7 @@ ...@@ -1510,7 +1554,7 @@
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_service rs ON ri.id = rs.requirements_info_id LEFT JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE ri.id = #{requirementsInfoId} WHERE ri.id = #{requirementsInfoId} and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
</select> </select>
<update id="deletePublishService"> <update id="deletePublishService">
...@@ -1523,18 +1567,18 @@ ...@@ -1523,18 +1567,18 @@
SELECT count(*) SELECT count(*)
FROM requirements_service FROM requirements_service
WHERE requirements_info_id = #{requirementsInfoId} WHERE requirements_info_id = #{requirementsInfoId}
AND pilot_certification_user_id = #{userAccountId} AND pilot_certification_user_id = #{userAccountId} and (service_flow_id != 11 or service_flow_id is NULL)
</select> </select>
<update id="deletePreempt"> <update id="deletePreempt">
update requirements_service update requirements_service
set is_deleted=1 set is_deleted=1
where requirements_info_id = #{requirementsInfoId} where requirements_info_id = #{requirementsInfoId} and (service_flow_id != 11 or service_flow_id is NULL)
</update> </update>
<select id="serviceReq" resultType="com.mmc.csf.release.entity.requirements.RequirementsServiceDO"> <select id="serviceReq" resultType="com.mmc.csf.release.entity.requirements.RequirementsServiceDO">
select cash_amount, we_chat, salary_amount, wechat_pay_order_number, preempt_total_amount select cash_amount, we_chat, salary_amount, wechat_pay_order_number, preempt_total_amount
from requirements_service from requirements_service
where requirements_info_id = #{requirementsInfoId} where requirements_info_id = #{requirementsInfoId} and (service_flow_id != 11 or service_flow_id is NULL)
</select> </select>
<update id="updateRepertory"> <update id="updateRepertory">
update requirements_info update requirements_info
...@@ -1559,4 +1603,100 @@ ...@@ -1559,4 +1603,100 @@
INNER JOIN requirements_amount ra ON ri.id = ra.requirements_info_id INNER JOIN requirements_amount ra ON ri.id = ra.requirements_info_id
WHERE ri.service_flow_id <![CDATA[<>]]> 7 WHERE ri.service_flow_id <![CDATA[<>]]> 7
</select> </select>
<select id="getRequirementsSonInfoId" resultType="java.lang.Integer">
select id from requirements_info where father_require_id = #{fatherRequireId} and repertory = 1
limit 1
</select>
<select id="selectBooleanByFatherIdAndUserId" resultType="java.lang.Integer">
select count(ri.id) from requirements_service rs
inner join requirements_info ri on ri.id = rs.requirements_info_id
where ri.father_require_id =#{fatherRequireId}
and rs.pilot_certification_user_id = #{userId} and rs.is_deleted = 0
</select>
<select id="selectRequireSonInfo" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
SELECT
ri.id,
ri.task_title,
ri.task_start_time,
ri.task_end_time,
ri.task_address,
ri.longitude,
ri.latitude,
ri.require_url,
ri.require_description,
ri.requirement_type_id,
ri.user_account_id,
rt.type_name AS requirementTypeName,
ri.publish_phone,
ri.publisher_number,
ri.service_id,
ra.total_amount,
ri.insurance,
ra.order_level,
ra.order_amount,
sf.doing,
sf.waiting,
sf.user_port,
sf.flyer_port,
sf.order_status,
ri.publish,
rau.update_order_amount,
ri.father_require_id,
rs.pilot_certification_id,
rs.pilot_certification_user_id
FROM
requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
LEFT JOIN requirements_amount_update rau ON rau.requirements_info_id = ri.id
left join requirements_service rs on ri.id = rs.requirements_info_id
WHERE ri.user_account_id = #{userAccountId} and ri.is_deleted!=1 and (rs.service_flow_id != 11 or rs.service_flow_id is NULL)
<if test=" requirementsInfoId != null ">
and ri.father_require_id=#{requirementsInfoId}
</if>
ORDER BY ri.id desc
limit #{pageNo}, #{pageSize}
</select>
<select id="selectFatherRequireIdBySonId" resultType="java.lang.Integer">
select father_require_id from requirements_info
where id = #{requireInfoId}
</select>
<select id="selectRepertoryByRequireId" resultType="java.lang.Integer">
select count(id) from requirements_info where father_require_id = #{requireInfoId}
and repertory = 1
</select>
<update id="updateRequirementsInfoRepertory">
update requirements_info set repertory = #{fatherRepertory}
where id = #{fatherRequireId}
</update>
<update id="updateRequirementsInfoByRefusePilot">
update requirements_info
set repertory = 1,service_flow_id = 1
where id=#{requireInfoId}
</update>
<update id="updateRequirementsService">
update requirements_service set service_flow_id = 11
where requirements_info_id = #{requireInfoId} and pilot_certification_user_id = #{pilotUserId}
</update>
<insert id="insertAgreePilotOrder">
insert into agree_pilot_order(require_info_id, service_flow_id, pilot_certification_user_id, create_time)
values(#{requireInfoId},#{serviceFlowId},#{pilotCertificationUserId},NOW())
</insert>
<select id="selectServiceIdByRequireIdAndUserId" resultType="java.lang.Integer">
select service_flow_id from agree_pilot_order
where require_info_id = #{requirementsId} and pilot_certification_user_id = #{userAccountId}
</select>
<select id="selectRequirementsNum" resultType="java.lang.Integer">
select count(id) from requirements_info where father_require_id =#{requirementsId}
</select>
<select id="selectServiceFlowIdByFatherId" resultType="java.lang.Integer">
select count(id) from requirements_info where father_require_id = #{requirementsId} and service_flow_id not in (1,10)
</select>
<select id="selectRequirementsRefuse" resultType="java.lang.Integer">
select count(id) from requirements_service where requirements_info_id = #{requireId} and pilot_certification_user_id = #{userAccountId}
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论