提交 a25f0ccf 作者: 张小凤

OrderAndService(add)

上级 80602e01
......@@ -12,6 +12,7 @@
<packaging>jar</packaging>
<dependencies>
<!-- apache 提供的一些工具类 -->
<dependency>
<groupId>commons-codec</groupId>
......
package com.mmc.csf.infomation.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/19 16:11
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetOrderNumberDTO implements Serializable {
@ApiModelProperty(hidden = true)
@JsonIgnore
private Integer id;
private static final long serialVersionUID = 75097833899496576L;
@ApiModelProperty(value = "支付订单编号", example = "dadasdas")
private String paymentOrderNumber;
@ApiModelProperty(value = "微信需要支付金额", example = "100")
private BigDecimal weChatPay;
@JsonIgnore
@ApiModelProperty(value = "用户id", example = "100", hidden = true)
private Integer userAccountId;
}
package com.mmc.csf.infomation.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/19 10:18
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PayWalletDTO implements Serializable {
private static final long serialVersionUID = 75097833899496576L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "用户ID")
private Integer userAccountId;
@ApiModelProperty(value = "用户姓名")
private String userName;
@ApiModelProperty(value = "云享金余额")
private BigDecimal cashAmt;
@ApiModelProperty(value = "已消耗云享金")
private BigDecimal cashPaid;
@ApiModelProperty(value = "云享金总金额")
private BigDecimal totalCash;
@ApiModelProperty(value = "已冻结云享金")
private BigDecimal cashFreeze;
@ApiModelProperty(value = "佣金余额")
private BigDecimal salaryAmt;
@ApiModelProperty(value = "已消耗佣金")
private BigDecimal salaryPaid;
@ApiModelProperty(value = "已冻结佣金")
private BigDecimal salaryFreeze;
@ApiModelProperty(value = "佣金总额度")
private BigDecimal totalSalary;
@ApiModelProperty(value = "已提现的金额")
private BigDecimal rebateWdl;
@ApiModelProperty(value = "冻结总额")
private BigDecimal totalFreeze;
@ApiModelProperty(value = "总金额")
private BigDecimal totalAmount;
public void mathTotal() {
// 总冻结余额
this.totalFreeze = BigDecimal.ZERO;
if (this.cashFreeze != null) {
this.totalFreeze = this.totalFreeze.add(this.cashFreeze);
}
if (this.salaryFreeze != null) {
this.totalFreeze = this.totalFreeze.add(this.salaryFreeze);
}
// 总云享金余额
this.totalCash = BigDecimal.ZERO;
if (this.cashAmt != null) {
this.totalCash = this.totalCash.add(this.cashAmt);
}
if (this.cashFreeze != null) {
this.totalCash = this.totalCash.add(this.cashFreeze);
}
// 总佣金余额
this.totalSalary = BigDecimal.ZERO;
if (this.salaryAmt != null) {
this.totalSalary = this.totalSalary.add(this.salaryAmt);
}
if (this.salaryFreeze != null) {
this.totalSalary = this.totalSalary.add(this.salaryFreeze);
}
// 总金额
this.totalAmount = BigDecimal.ZERO;
this.totalAmount = this.totalAmount.add(this.totalCash);
this.totalAmount = this.totalAmount.add(this.totalSalary);
}
}
package com.mmc.csf.infomation.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/8/18 14:29
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PilotCertificationInteriorDTO {
@ApiModelProperty(value = "飞手执照id", example = "1")
@NotNull(message = "飞手执照id不能为空")
private Integer id;
@ApiModelProperty(value = "申请飞手用户的id", example = "1")
private Integer userAccountId;
}
package com.mmc.csf.infomation.dto;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/8/18 19:56
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServiceArriveSceneDTO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "id")
private Double longitude;
@ApiModelProperty(value = "id")
private Double latitude;
@ApiModelProperty(value = "现场地址")
private String sceneAddress;
@ApiModelProperty(value = "现场地址的url", required = true)
private String sceneUrl;
@ApiModelProperty(value = "现场用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "服务需求id", required = true)
private Integer requirementsInfoId;
}
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 small
* @Date 2023/8/18 22:06
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceEvaluateDTO {
@ApiModelProperty(value = "id", example = "1")
private Integer id;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "评价内容", example = "1")
private String evaluationContent;
@ApiModelProperty(value = "星级", example = "星")
private String starLevel;
@ApiModelProperty(value = "评价图片", example = "星")
private String evaluationUrl;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
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 small
* @Date 2023/8/18 20:46
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServiceFulfilATaskDTO {
private Integer id;
@ApiModelProperty(value = "完成任务描述", example = "完成任务描述一下")
private String taskDescribe;
@ApiModelProperty(value = "完成任务图片", example = "http://")
private String taskUrl;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
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.math.BigDecimal;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/18 21:22
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServiceSettleAccountsDTO {
private Integer id;
@ApiModelProperty(value = "订单金额", example = "100")
private BigDecimal orderAmount;
@ApiModelProperty(value = "备注", example = "项目延期")
private String remark;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "结算的用户id", example = "1", hidden = true)
private Integer userAccountId;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
package com.mmc.csf.infomation.qo;
import com.mmc.csf.release.model.group.Freeze;
import com.mmc.csf.release.model.group.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author small
* @Date 2023/8/21 16:02
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class IndustryTypeQO implements Serializable {
private static final long serialVersionUID = 1983281419136483277L;
private Integer id;
@ApiModelProperty(value = "行业类型名称")
private String typeName;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.csf.infomation.vo;
import com.mmc.csf.release.model.group.Insert;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/19 15:57
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GetOrderNumberVO {
@ApiModelProperty(value = "订单金额", example = "100", required = true)
@NotNull(message = "订单金额", groups = {Insert.class})
private BigDecimal orderAmount;
@ApiModelProperty(value = "订单级别 todo:前端传英文,后台自己获取金额 订单级别(REGULAR_ORDER,RUSH_ORDER,TOP_ORDER)", example = "REGULAR_ORDER", required = true)
@NotNull(message = "订单级别", groups = {Insert.class})
private OrderLevelEnum orderLevelEnum;
@ApiModelProperty(value = "云享金", example = "10", hidden = true)
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10", hidden = true)
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信金额", example = "10", hidden = true)
private BigDecimal weChatPay;
@ApiModelProperty(value = "用户id", example = "10", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "支付方式,云享金:1,佣金:2,微信支付:3", example = "1,2,3", required = true)
private String paymentType;
@ApiModelProperty(value = "订单方式 发布订单:1 ,抢单:2", example = "1", required = true)
private Integer orderMode;
}
package com.mmc.csf.infomation.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/19 22:26
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GrabTheOrderVO {
private static final long serialVersionUID = -447951390213113317L;
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "云享金", example = "10", hidden = true)
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10", hidden = true)
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信支付订单编号", example = "R202308191657303116170")
private String wechatPayOrderNumber;
@ApiModelProperty(value = "微信金额", example = "10", hidden = true)
private BigDecimal weChat;
@ApiModelProperty(value = "发布者任务编号", example = "R202308192201279509820")
private String publisherNumber;
@JsonIgnore
private Integer userAccountId;
@ApiModelProperty(value = "支付方式,云享金:1,佣金:2,微信支付:3", example = "1,2,3")
private String paymentType;
}
package com.mmc.csf.infomation.vo;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/17 10:22
* @Version 1.0
*/
public enum OrderLevelEnum {
//普通订单
REGULAR_ORDER("REGULAR_ORDER", new BigDecimal(0)),
//紧急订单
RUSH_ORDER("RUSH_ORDER", new BigDecimal(100)),
//置顶订单
TOP_ORDER("TOP_ORDER", new BigDecimal(300));
private String key;
private BigDecimal value;
private OrderLevelEnum(String key, BigDecimal value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public BigDecimal getValue() {
return value;
}
public void setValue(BigDecimal value) {
this.value = value;
}
public static OrderLevelEnum match(String key) {
OrderLevelEnum result = null;
for (OrderLevelEnum s : values()) {
if (s.getKey() == key) {
result = s;
break;
}
}
return result;
}
public static OrderLevelEnum catchMessage(BigDecimal value) {
OrderLevelEnum result = null;
for (OrderLevelEnum s : values()) {
if (s.getValue().equals(value)) {
result = s;
break;
}
}
return result;
}
}
package com.mmc.csf.infomation.vo;
import com.mmc.csf.release.model.group.Create;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
* @Author small
* @Date 2023/8/18 14:30
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PilotAbilityVO {
private Integer id;
@ApiModelProperty(value = "能力id不能为空", example = "5", required = true)
@NotBlank(message = "能力id不能为空", groups = {Create.class, Update.class})
private Integer abilityId;
@ApiModelProperty(value = "能力不能为空", example = "道路检测", required = true)
@NotBlank(message = "能力名称不能为空", groups = {Create.class, Update.class})
private String abilityName;
@ApiModelProperty(value = "飞手认证id", hidden = true)
private Integer pilotCertificationId;
}
......@@ -27,7 +27,7 @@ import java.util.Date;
@Builder
public class RequirementsInfoVO implements Serializable {
private static final long serialVersionUID = -447951390213113317L;
@ApiModelProperty(value = "id")
@ApiModelProperty(value = "id", hidden = true)
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
......@@ -92,7 +92,8 @@ public class RequirementsInfoVO implements Serializable {
//@NotNull(message = "用户id不能为空", groups = {Insert.class})
private Integer userAccountId;
@ApiModelProperty(value = "发布者支付总金额", example = "发布者支付总金额")
private BigDecimal totalAmount;
@ApiModelProperty(value = "省份编码", required = false)
//@NotNull(message = "省份编码不能为空", groups = {Insert.class})
private Integer provinceCode;
......@@ -122,4 +123,32 @@ public class RequirementsInfoVO implements Serializable {
@ApiModelProperty(value = "发布者订单编号")
private String publisherNumber;
@ApiModelProperty(value = "订单级别", example = "订单级别", required = true)
@NotNull(message = "订单级别", groups = {Insert.class})
private String orderLevelEnum;
@ApiModelProperty(value = "服务id", example = "服务id", required = true)
private Integer serviceId;
@ApiModelProperty(value = "服务名称", example = "服务名称")
private String serviceName;
@ApiModelProperty(value = "飞手保险 1飞手保险 2三者保险 3机身保险", example = "飞手保险 1飞手保险 2三者保险 3机身保险")
private String insurance;
@ApiModelProperty(value = "当前状态", example = "已发布")
private String doing;
@ApiModelProperty(value = "等待状态", example = "等待抢单")
private String waiting;
@ApiModelProperty(value = "发布者状态", example = "等待抢单")
private String userPort;
@ApiModelProperty(value = "飞手状态", example = "等待抵达现场")
private String flyerPort;
@ApiModelProperty(value = "状态编码", example = "状态编码")
private String orderStatus;
@ApiModelProperty(value = "0需求信息 1是服务需求", example = "0需求信息 1是服务需求")
private Integer publish;
@ApiModelProperty(value = "抢单者已支付的总金额", example = "抢单者已支付的总金额")
private BigDecimal preemptTotalAmount;
}
package com.mmc.csf.infomation.vo;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/8/18 18:28
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceArriveSceneVO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "id", example = "23.344324")
private Double longitude;
@ApiModelProperty(value = "id", example = "44.344324")
private Double latitude;
@ApiModelProperty(value = "现场地址", example = "广东省深圳市")
private String sceneAddress;
@ApiModelProperty(value = "现场地址的url", required = true, example = "http://")
private String sceneUrl;
@ApiModelProperty(value = "现场用户id", hidden = true, example = "173")
private Integer userAccountId;
@ApiModelProperty(value = "服务需求id", required = true, example = "83")
private Integer requirementsInfoId;
}
package com.mmc.csf.infomation.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author small
* @Date 2023/8/18 21:58
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceEvaluateVO {
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "评价内容", example = "1")
private String evaluationContent;
@ApiModelProperty(value = "星级", example = "星")
private String starLevel;
@ApiModelProperty(value = "评价图片", example = "星")
private String evaluationUrl;
}
package com.mmc.csf.infomation.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author small
* @Date 2023/8/18 20:34
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceFulfilATaskVO {
private Integer id;
@ApiModelProperty(value = "完成任务描述", example = "完成任务描述一下")
private String taskDescribe;
@ApiModelProperty(value = "完成任务图片", example = "http://")
private String taskUrl;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
}
package com.mmc.csf.infomation.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
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.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/17 10:14
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceRequirementsVO implements Serializable {
private static final long serialVersionUID = -447951390213113317L;
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "id", example = "1")
@NotBlank(message = "服务类型名称不能为空", groups = {Insert.class, Update.class})
private String 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", required = true)
@NotNull(message = "任务经度不能为空", groups = {Insert.class, Update.class})
private Double longitude;
@ApiModelProperty(value = "飞行位置——任务纬度", example = "44.344324", required = true)
@NotNull(message = "任务纬度不能为空", groups = {Insert.class, Update.class})
private Double latitude;
@ApiModelProperty(value = "任务需求描述", example = "描述一下", required = true)
@NotNull(message = "任务需求描述不能为空", groups = {Insert.class})
@Length(max = 300, message = "字符过长")
private String requireDescription;
@ApiModelProperty(value = "订单金额", example = "100", required = true)
@NotNull(message = "订单金额", groups = {Insert.class})
private BigDecimal orderAmount;
@ApiModelProperty(value = "飞手保险1飞手保险 2三者保险 3机身保险", example = "1,2,3", required = true)
@NotNull(message = "飞手保险", groups = {Insert.class})
private String insurance;
@ApiModelProperty(value = "订单级别 todo:前端传英文,后台自己获取金额 订单级别(REGULAR_ORDER,RUSH_ORDER,TOP_ORDER)", example = "REGULAR_ORDER", 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 = "云享金", example = "10", hidden = true)
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10", hidden = true)
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信支付订单编号", example = "R202308191657303116170")
private String wechatPayOrderNumber;
@ApiModelProperty(value = "支付方式,云享金:1,佣金:2,微信支付:3", example = "1,2,3")
private String paymentType;
@ApiModelProperty(value = "微信金额", example = "10", hidden = true)
private BigDecimal weChat;
}
package com.mmc.csf.infomation.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/18 21:19
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceSettleAccountsVO implements Serializable {
private Integer id;
@ApiModelProperty(value = "订单金额", example = "100")
private BigDecimal orderAmount;
@ApiModelProperty(value = "备注", example = "项目延期")
private String remark;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
}
package com.mmc.csf.infomation.vo;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/19 10:24
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WalletFlowVO {
@ApiModelProperty(value = "用户ID")
private Integer userAccountId;
@ApiModelProperty(value = "支付方式 200结算(完成) 300冻结 100订单取消")
private Integer modeOfPayment;
@ApiModelProperty(value = "云享金")
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金")
private BigDecimal salaryAmount;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private String timeOfPayment;
@ApiModelProperty(value = "操作者用户ID")
private Integer operateUserAccountId;
@ApiModelProperty(value = "微信金额")
private BigDecimal weChat;
}
package com.mmc.csf.release.industry;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author small
* @Date 2023/8/18 13:40
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInspectionDTO implements Serializable {
private static final long serialVersionUID = -7994243059824987869L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "单位id")
private Integer companyInfoId;
@ApiModelProperty(value = "服务范围")
private String serviceArea;
@ApiModelProperty(value = "服务id")
private Integer inspectionId;
@ApiModelProperty(value = "服务标签")
private Integer inspectionTagId;
@ApiModelProperty(value = "报价")
private BigDecimal price;
@ApiModelProperty(value = "报价说明")
private String priceRemark;
@ApiModelProperty(value = "价格单位")
private Integer inspectionPriceUnitId;
@ApiModelProperty(value = "详情页")
private String detailPage;
@ApiModelProperty(value = "销售状态,0停售,1在售")
private Integer saleState;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "服务主图")
private String inspectionFirstImg;
@ApiModelProperty(value = "作业团队")
private String CompanyName;
@ApiModelProperty(value = "行业")
private IndustryTypeDTO industryTypeDTO;
@ApiModelProperty(value = "服务")
private InspectionDTO inspectionDTO;
@ApiModelProperty(value = "团队服务标签")
private InspectionTagDTO inspectionTagDTO;
@ApiModelProperty(value = "团队服务图片/视频")
private List<CompanyInspectionFileDTO> inspectionFileDTOS;
}
package com.mmc.csf.release.industry;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author small
* @Date 2023/8/18 13:40
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInspectionFileDTO implements Serializable {
private static final long serialVersionUID = -542881175952018418L;
private Integer id;
private Integer fileType;
private Integer first;
private Integer companyInspectionId;
private String fileUrl;
}
package com.mmc.csf.release.industry;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small
* @Date 2023/8/18 13:39
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IndustryTypeDTO implements Serializable {
private static final long serialVersionUID = -5832618357203415274L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "行业类型名称")
private String typeName;
@ApiModelProperty(value = "行业图标")
private String typeImg;
@ApiModelProperty(value = "行业描述")
private String description;
@ApiModelProperty(value = "售卖状态,0停售,1在售")
private Integer saleState;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "服务列表")
private List<InspectionDTO> inspectionDTOS;
}
package com.mmc.csf.release.industry;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small
* @Date 2023/8/18 13:39
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InspectionDTO implements Serializable {
private static final long serialVersionUID = 8316723266007785996L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "服务编号")
private String inspectionNo;
@ApiModelProperty(value = "服务名称")
private String inspectionName;
@ApiModelProperty(value = "行业类型id")
private Integer industryTypeId;
@ApiModelProperty(value = "服务图标")
private String inspectionImg;
@ApiModelProperty(value = "服务描述")
private String inspectionDescription;
@ApiModelProperty(value = "销售状态,0停售,1在售")
private Integer saleState;
@ApiModelProperty(value = "案例图")
private String caseImg;
@ApiModelProperty(value = "案例视频")
private String caseVideo;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "团队服务列表")
List<CompanyInspectionDTO> companyInspectionDTOS;
}
package com.mmc.csf.release.industry;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author small
* @Date 2023/8/18 13:40
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InspectionTagDTO implements Serializable {
private static final long serialVersionUID = -2590417413375903686L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "标签名称")
private String tagName;
@ApiModelProperty(value = "服务id")
private Integer inspectionId;
}
......@@ -407,7 +407,15 @@ public enum ResultEnum implements BaseErrorInfoInterface {
YOU_CANNOT_MODIFY_REQUIREMENTS_PUBLISHED_BY_OTHERS("60003", "不能修改他(她)人发布的需求"),
YOU_CANNOT_DELETE_REQUIREMENTS_POSTED_BY_OTHERS("60004", "不能删除他(她)人发布的需求"),
THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED("60005", "第三方接口在更新请联系开发人员"),
THREE_FIELDS_CAN_BE_REPEATED("60002", "机型、等级、类型存在重复");
THREE_FIELDS_CAN_BE_REPEATED("60002", "机型、等级、类型存在重复"),
FALL_OUTSIDE_OF("60003", "不在打卡范围之内"),
OVER_THE_TOTAL("60004", "总金额大于云享金剩余的金额,发布失败"),
SALARY_PAYMENT_FAILURE("60005", "总金额大于佣金剩余的金额,发布失败"),
CASH_SALARY_PAYMENT_FAILURE("60006", "总金额大于佣金剩余的金额加上云享金剩余的金额,发布失败"),
PLEASE_SELECT_PAYMENT("60007", "请选择支付方式,发布失败"),
CASH_IS_ENOUGH("60008", "云享金额已足够,无需微信支付"),
SALARY_IS_ENOUGH("60009", "佣金剩余金额已足够,无需微信支付"),
;
/**
* 错误码
......
......@@ -69,6 +69,11 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.15.6</version>
</dependency>
<!-- mybatis驱动&Druid数据源-end -->
<dependency>
......@@ -89,6 +94,15 @@
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- 定位打卡-->
<!--用于计算两点之间的距离-->
<dependency>
<groupId>org.gavaghan</groupId>
<artifactId>geodesy</artifactId>
<version>1.1.3</version>
</dependency>
<!-- &lt;!&ndash; RabbitMQ &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
......
package com.mmc.csf.release.commit;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Author small
* @Date 2023/8/18 11:04
* @Version 1.0
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface NotRepeatSubmit {
long value();
}
package com.mmc.csf.release.commit;
import com.mmc.csf.release.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.TimeUnit;
/**
* @Author small
* @Date 2023/8/18 11:05
* @Version 1.0
*/
@Slf4j
@Component
@Aspect
public class NotRepeatSubmitConfig extends BaseController {
@Autowired
private RedissonClient redissonClient;
@Pointcut("@within(notRepeatSubmit)||@annotation(notRepeatSubmit)")
public void pointcut(NotRepeatSubmit notRepeatSubmit) {
}
@Around(value = "pointcut(notRepeatSubmit)")
public Object around(ProceedingJoinPoint proceedingJoinPoint, NotRepeatSubmit notRepeatSubmit) throws Throwable {
log.info("提交之前---");
Object result = null;
long leaseTime = notRepeatSubmit.value();
log.info("leaseTime:" + leaseTime);
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
String accountUriLockKey = userAccountId + "-" + request.getServletPath();
// 设置锁定资源名称,accountUriLock改为userid+uri作为标识,作为测试写死
// String accountUriLockKey = "accountUriLock";
RLock accountUriLock = redissonClient.getLock(accountUriLockKey);
boolean tryLock;
//尝试获取分布式锁
//-1为永久 leaseTime 最多等待几秒 上锁以后leaseTime秒自动解锁
tryLock = accountUriLock.tryLock(-1, leaseTime, TimeUnit.MILLISECONDS);
log.info("tryLock:" + tryLock);
if (tryLock) {
try {
// 查询订单库存判断是否大于0
// 大于0表示还有库存可以更新订单库存将库存数字减一更新到数据库中
// 不大于0表示没有库存了本次请求就终止
log.info("正常提交:");
result = proceedingJoinPoint.proceed();
} catch (Exception e) {
log.info("主程序异常:" + e);
throw new Exception(e);
}
} else {
log.info("重复提交:" + accountUriLockKey);
}
log.info("提交之后---");
return result;
}
}
package com.mmc.csf.release.config;
import com.alibaba.fastjson.JSONObject;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.common.util.web.ResultEnum;
import com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO;
import com.sun.org.glassfish.gmbal.NameValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
/**
* @Author small
* @Date 2023/8/18 10:35
* @Version 1.0
*/
public class RestTemplateConfig {
@Autowired
private RestTemplate restTemplate;
@Value("${iuav.pmsapp.url}")
@NameValue()
private String pmsApp;
@Value("${iuav.userapp.url}")
private String userApp;
public ResultBody releaseOrder(Integer id, HttpServletRequest request) {
String token = request.getHeader("token");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(id), headers);
ResponseEntity<Object> exchange = null;
try {
exchange = restTemplate.exchange(pmsApp + "/pms/industry/getIndustryTypeById?id=" + id, HttpMethod.GET, entity, Object.class);
} catch (RestClientException e) {
return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
return ResultBody.success();
}
public PilotCertificationInteriorDTO feignInteriorDetailPilot(Integer userAccountId, HttpServletRequest request) {
String token = request.getHeader("token");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(userAccountId), headers);
ResponseEntity<Object> exchange = null;
System.out.println(userApp);
try {
ResponseEntity<PilotCertificationInteriorDTO> exchange1 = restTemplate.exchange("http://localhost:35150" + "/userapp/pilot/interiorDetailPilot?userAccountId=" + userAccountId, HttpMethod.GET, entity, PilotCertificationInteriorDTO.class);
PilotCertificationInteriorDTO body = exchange1.getBody();
System.out.println(body);
} catch (RestClientException e) {
// return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
// return ResultBody.success();
return null;
}
}
package com.mmc.csf.release.controller;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.vo.RequirementsInfoVO;
import com.mmc.csf.infomation.vo.RequirementsTypeVO;
import com.mmc.csf.infomation.vo.*;
import com.mmc.csf.release.commit.NotRepeatSubmit;
import com.mmc.csf.release.model.group.Insert;
import com.mmc.csf.release.model.group.Page;
import com.mmc.csf.release.model.group.Update;
......@@ -34,7 +35,7 @@ public class RequirementsController extends BaseController {
return requirementsService.listType(id);
}
@ApiOperation(value = "小程序——需求发布")
@ApiOperation(value = "小程序——发布需求信息")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("publish")
public ResultBody publish(@RequestBody @Validated(value = {Insert.class}) RequirementsInfoVO requirementsInfoVO, HttpServletRequest request) {
......@@ -42,6 +43,34 @@ public class RequirementsController extends BaseController {
return requirementsService.publish(requirementsInfoVO, request);
}
@ApiOperation(value = "new——小程序发布服务-——抢单")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@NotRepeatSubmit(value = 3000L)
@PostMapping("grabTheOrder")
public ResultBody grabTheOrder(@RequestBody GrabTheOrderVO grabTheOrderVO, HttpServletRequest request) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
grabTheOrderVO.setUserAccountId(userAccountId);
return requirementsService.grabTheOrder(grabTheOrderVO, request);
}
@ApiOperation(value = "小程序——发布服务需求")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("publishService")
public ResultBody publishService(@RequestBody @Validated(value = {Insert.class}) ServiceRequirementsVO serviceRequirementsVO, HttpServletRequest request) {
serviceRequirementsVO.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return requirementsService.publishService(serviceRequirementsVO, request);
}
@ApiOperation(value = "小程序——发布服务需求订单编号单独接口")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("publisherNumber")
public ResultBody<GetOrderNumberDTO> publisherNumber(@RequestBody GetOrderNumberVO getOrderNumberVO, HttpServletRequest request) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
getOrderNumberVO.setUserAccountId(userAccountId);
return requirementsService.publisherNumber(getOrderNumberVO, request);
}
@ApiOperation(value = "小程序-编辑——需求发布")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("updatePublish")
......@@ -64,6 +93,7 @@ public class RequirementsController extends BaseController {
return requirementsService.appPublishList();
}
@ApiOperation(value = "小程序-详情——需求发布")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("detailPublish")
......@@ -71,6 +101,94 @@ public class RequirementsController extends BaseController {
return requirementsService.detailPublish(id, request, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "new——小程序-—服务订单--我的发布")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("myPublish")
public ResultBody<RequirementsInfoVO> myPublish(HttpServletRequest request) {
return requirementsService.myPublish(this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "new——小程序-—服务订单--我的抢单")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("myPreempt")
public ResultBody<RequirementsInfoVO> myPreempt(HttpServletRequest request) {
return requirementsService.myPreempt(this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "new——小程序-—飞手端--抵达现场")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("arriveAtTheScene")
public ResultBody arriveAtTheScene(HttpServletRequest request, @RequestBody @Validated(value = {Insert.class}) ServiceArriveSceneVO serviceArriveSceneVO) {
serviceArriveSceneVO.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return requirementsService.arriveAtTheScene(serviceArriveSceneVO);
}
@ApiOperation(value = "new——小程序-—飞手端--抵达现场详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("arriveAtTheSceneDetails")
public ResultBody<ServiceArriveSceneDTO> arriveAtTheSceneDetails(HttpServletRequest request, @ApiParam(value = "发布服务需求id", required = true) @RequestParam Integer requirementsInfoId) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
return requirementsService.arriveAtTheSceneDetails(requirementsInfoId, userAccountId);
}
@ApiOperation(value = "new——小程序-—飞手端--完成任务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("fulfilATask")
public ResultBody fulfilATask(HttpServletRequest request, @RequestBody @Validated(value = {Insert.class}) ServiceFulfilATaskVO fulfilATaskVO) {
fulfilATaskVO.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return requirementsService.fulfilATask(fulfilATaskVO);
}
@ApiOperation(value = "new——小程序-—飞手端--完成任务详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("fulfilATaskDetails")
public ResultBody<ServiceFulfilATaskDTO> fulfilATaskDetails(HttpServletRequest request, @ApiParam(value = "发布服务需求id", required = true) @RequestParam Integer requirementsInfoId) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
return requirementsService.fulfilATaskDetails(requirementsInfoId, userAccountId);
}
@ApiOperation(value = "new——小程序-—发布者--订单结算")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("settleAccounts")
public ResultBody settleAccounts(HttpServletRequest request, @RequestBody @Validated(value = {Insert.class}) ServiceSettleAccountsVO settleAccountsVO) {
settleAccountsVO.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return requirementsService.settleAccounts(settleAccountsVO);
}
@ApiOperation(value = "new——小程序-—发布者--订单结算详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("settleAccountsDetails")
public ResultBody<ServiceSettleAccountsDTO> settleAccountsDetails(HttpServletRequest request, @ApiParam(value = "发布服务需求id", required = true) @RequestParam Integer requirementsInfoId) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
return requirementsService.settleAccountsDetails(requirementsInfoId, userAccountId);
}
@ApiOperation(value = "new——小程序-—发布者对飞手--评价")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("evaluate")
public ResultBody evaluate(HttpServletRequest request, @RequestBody @Validated(value = {Insert.class}) ServiceEvaluateVO evaluateVO) {
evaluateVO.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return requirementsService.evaluate(evaluateVO);
}
@ApiOperation(value = "new——小程序-—发布者对飞手--评价详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("evaluateDetails")
public ResultBody<ServiceEvaluateDTO> evaluateDetails(HttpServletRequest request, @ApiParam(value = "发布服务需求id", required = true) @RequestParam Integer requirementsInfoId) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
return requirementsService.evaluateDetails(requirementsInfoId, userAccountId);
}
@ApiOperation(value = "后台管理-详情——需求发布")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("backDetailPublish")
......
package com.mmc.csf.release.dao;
import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.release.entity.requirements.RequirementsInfoDO;
import com.mmc.csf.release.entity.requirements.RequirementsTypeDO;
import com.mmc.csf.release.entity.requirements.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -77,4 +76,40 @@ public interface RequirementsDao {
List<RequirementsInfoDO> appPublishList();
RequirementsInfoDO detailPublish(Integer id);
void addPublishService(ServiceRequirementsDO requirementsInfoDO);
ServiceRequirementsDO grabTheOrder(String publisherNumber);
void updateGrabTheOrder(String publisherNumber, Integer repertory);
void insertService(RequirementsServiceDO requirementsServiceDO);
void arriveAtTheScene(ServiceArriveSceneDO serviceArriveSceneDO);
void updateScene(Integer requirementsInfoId);
ServiceArriveSceneDO arriveAtTheSceneDetails(Integer requirementsInfoId, Integer userAccountId);
void fulfilATask(ServiceFulfilATaskDO serviceFulfilATaskDO);
void updateFulfilATask(Integer requirementsInfoId);
ServiceFulfilATaskDO fulfilATaskDetails(Integer requirementsInfoId, Integer userAccountId);
void settleAccounts(ServiceSettleAccountsDO settleAccountsDO);
void updatesettleAccounts(Integer requirementsInfoId);
ServiceSettleAccountsDO settleAccountsDetails(Integer requirementsInfoId, Integer userAccountId);
void evaluate(ServiceEvaluateDO serviceEvaluateDO);
void updateEvaluate(Integer requirementsInfoId);
ServiceEvaluateDO evaluateDetails(Integer requirementsInfoId, Integer userAccountId);
List<RequirementsInfoDO> myPublish(Integer userAccountId);
List<RequirementsInfoDO> myPreempt(Integer userAccountId);
}
......@@ -13,6 +13,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
......@@ -77,6 +78,34 @@ public class RequirementsInfoDO implements Serializable {
@ApiModelProperty(value = "发布者订单编号")
private String publisherNumber;
@ApiModelProperty(value = "订单级别", example = "订单级别", required = true)
@NotNull(message = "订单级别", groups = {Insert.class})
private String orderLevel;
@ApiModelProperty(value = "服务id", example = "服务id", required = true)
private Integer serviceId;
@ApiModelProperty(value = "服务名称", example = "服务名称")
private String serviceName;
@ApiModelProperty(value = "发布者支付总金额", example = "发布者支付总金额")
private BigDecimal totalAmount;
@ApiModelProperty(value = "允许几人抢单", example = "允许几人抢单")
private Integer repertory;
private String insurance;
private String doing;
private String waiting;
private String userPort;
private String flyerPort;
private String orderStatus;
private Integer publish;
private BigDecimal preemptTotalAmount;
public RequirementsInfoVO buildRequirementsInfoVO() {
return RequirementsInfoVO.builder().id(this.id).requirementTypeId(this.requirementTypeId).userAccountId(this.userAccountId).publishName(this.publishName)
......@@ -87,7 +116,21 @@ public class RequirementsInfoDO implements Serializable {
.latitude(this.latitude)
.requirementTypeName(this.requirementTypeName)
.publisherNumber(this.publisherNumber)
.requireUrl(this.requireUrl).build();
.requireUrl(this.requireUrl)
.orderLevelEnum(this.orderLevel)
.serviceId(this.serviceId)
.serviceName(this.serviceName)
.totalAmount(this.totalAmount)
.insurance(this.insurance)
.doing(this.doing)
.waiting(this.waiting)
.userPort(this.userPort)
.flyerPort(this.flyerPort)
.orderStatus(this.orderStatus)
.publish(this.publish)
.preemptTotalAmount(this.preemptTotalAmount)
.build();
}
public RequirementsInfoDO(RequirementsInfoVO requirementsInfoVO) {
......
package com.mmc.csf.release.entity.requirements;
import com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small
* @Date 2023/8/18 17:23
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RequirementsServiceDO implements Serializable {
private static final long serialVersionUID = -1811974173256250060L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "服务需求id")
private Integer requirementsInfoId;
@ApiModelProperty(value = "字典id")
private Integer serviceDictionaryId;
@ApiModelProperty(value = "抢单飞手id")
private Integer pilotCertificationId;
@ApiModelProperty(value = "抢单飞手用户id")
private Integer pilotCertificationUserId;
@ApiModelProperty(value = "抢单飞手团队id")
private Integer teamId;
@ApiModelProperty(value = "抢单飞手团队用户id")
private Integer teamUserId;
@ApiModelProperty(value = "云享金", example = "10")
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10")
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信金额", example = "10")
private BigDecimal weChat;
@ApiModelProperty(value = "微信支付订单编号", example = "R202308191657303116170")
private String wechatPayOrderNumber;
@ApiModelProperty(value = "抢单支付的总金额", example = "抢单支付的总金额")
private BigDecimal preemptTotalAmount;
public RequirementsServiceDO(PilotCertificationInteriorDTO pilot, ServiceRequirementsDO requirementsInfoDO) {
this.pilotCertificationId = pilot.getId();
this.pilotCertificationUserId = pilot.getUserAccountId();
this.requirementsInfoId = requirementsInfoDO.getId();
this.serviceDictionaryId = 2;
}
}
package com.mmc.csf.release.entity.requirements;
import com.mmc.csf.infomation.dto.ServiceArriveSceneDTO;
import com.mmc.csf.infomation.vo.ServiceArriveSceneVO;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/8/18 19:29
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceArriveSceneDO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "id")
private Double longitude;
@ApiModelProperty(value = "id")
private Double latitude;
@ApiModelProperty(value = "现场地址")
private String sceneAddress;
@ApiModelProperty(value = "现场地址的url", required = true)
private String sceneUrl;
@ApiModelProperty(value = "现场用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "服务需求id", required = true)
private Integer requirementsInfoId;
public ServiceArriveSceneDO(ServiceArriveSceneVO serviceArriveSceneVO) {
this.longitude = serviceArriveSceneVO.getLongitude();
this.latitude = serviceArriveSceneVO.getLatitude();
this.sceneAddress = serviceArriveSceneVO.getSceneAddress();
this.sceneUrl = serviceArriveSceneVO.getSceneUrl();
this.userAccountId = serviceArriveSceneVO.getUserAccountId();
this.requirementsInfoId = serviceArriveSceneVO.getRequirementsInfoId();
}
public ServiceArriveSceneDTO buildServiceArriveSceneDTO() {
return ServiceArriveSceneDTO
.builder()
.longitude(this.longitude)
.latitude(this.latitude)
.sceneAddress(this.sceneAddress)
.sceneUrl(this.sceneUrl)
.userAccountId(this.userAccountId)
.requirementsInfoId(this.requirementsInfoId)
.build();
}
}
package com.mmc.csf.release.entity.requirements;
import com.alibaba.fastjson.annotation.JSONField;
import com.mmc.csf.infomation.dto.ServiceEvaluateDTO;
import com.mmc.csf.infomation.vo.ServiceEvaluateVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/18 22:08
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceEvaluateDO {
@ApiModelProperty(value = "id", example = "1")
private Integer id;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "评价内容", example = "1")
private String evaluationContent;
@ApiModelProperty(value = "星级", example = "星")
private String starLevel;
@ApiModelProperty(value = "评价图片", example = "星")
private String evaluationUrl;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public ServiceEvaluateDO(ServiceEvaluateVO evaluateVO) {
this.requirementsInfoId = evaluateVO.getRequirementsInfoId();
this.userAccountId = evaluateVO.getUserAccountId();
this.evaluationContent = evaluateVO.getEvaluationContent();
this.starLevel = evaluateVO.getStarLevel();
this.evaluationUrl = evaluateVO.getEvaluationUrl();
}
public ServiceEvaluateDTO buildServiceEvaluateDTO() {
return ServiceEvaluateDTO.builder()
.id(this.id)
.requirementsInfoId(this.requirementsInfoId)
.userAccountId(this.userAccountId)
.starLevel(this.starLevel)
.evaluationContent(this.evaluationContent)
.evaluationUrl(this.evaluationUrl)
.createTime(this.createTime)
.updateTime(this.updateTime)
.build();
}
}
package com.mmc.csf.release.entity.requirements;
import com.alibaba.fastjson.annotation.JSONField;
import com.mmc.csf.infomation.dto.ServiceFulfilATaskDTO;
import com.mmc.csf.infomation.vo.ServiceFulfilATaskVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/18 20:40
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceFulfilATaskDO {
private Integer id;
@ApiModelProperty(value = "完成任务描述", example = "完成任务描述一下")
private String taskDescribe;
@ApiModelProperty(value = "完成任务图片", example = "http://")
private String taskUrl;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "完成任务的用户", example = "1", hidden = true)
private Integer userAccountId;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public ServiceFulfilATaskDO(ServiceFulfilATaskVO serviceFulfilATaskVO) {
this.taskDescribe = serviceFulfilATaskVO.getTaskDescribe();
this.taskUrl = serviceFulfilATaskVO.getTaskUrl();
this.requirementsInfoId = serviceFulfilATaskVO.getRequirementsInfoId();
this.userAccountId = serviceFulfilATaskVO.getUserAccountId();
}
public ServiceFulfilATaskDTO buildServiceFulfilATaskDTO() {
return ServiceFulfilATaskDTO.builder()
.id(this.id)
.taskDescribe(this.taskDescribe)
.taskUrl(this.taskUrl)
.requirementsInfoId(this.requirementsInfoId)
.userAccountId(this.userAccountId)
.createTime(this.createTime)
.updateTime(this.updateTime)
.build();
}
}
package com.mmc.csf.release.entity.requirements;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mmc.csf.infomation.vo.OrderLevelEnum;
import com.mmc.csf.infomation.vo.ServiceRequirementsVO;
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.util.Date;
/**
* @Author small
* @Date 2023/8/17 10:54
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServiceRequirementsDO {
private static final long serialVersionUID = -447951390213113317L;
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "id")
@NotBlank(message = "服务类型id不能为空", groups = {Insert.class, Update.class})
private String 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", required = true)
@NotNull(message = "任务经度不能为空", groups = {Insert.class, Update.class})
private Double longitude;
@ApiModelProperty(value = "飞行位置——任务纬度", example = "44.344324", required = true)
@NotNull(message = "任务纬度不能为空", groups = {Insert.class, Update.class})
private Double latitude;
@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})
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置顶")
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})
private BigDecimal totalAmount;
@ApiModelProperty(value = "云享金", example = "10")
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10")
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信金额", example = "10")
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;
public ServiceRequirementsDO(ServiceRequirementsVO serviceRequirementsVO) {
this.id = serviceRequirementsVO.getId();
this.userAccountId = serviceRequirementsVO.getUserAccountId();
this.publishName = serviceRequirementsVO.getPublishName();
this.publishPhone = serviceRequirementsVO.getPublishPhone();
this.requireDescription = serviceRequirementsVO.getRequireDescription();
this.taskStartTime = serviceRequirementsVO.getTaskStartTime();
this.taskEndTime = serviceRequirementsVO.getTaskEndTime();
this.taskAddress = serviceRequirementsVO.getTaskAddress();
this.longitude = serviceRequirementsVO.getLongitude();
this.latitude = serviceRequirementsVO.getLatitude();
this.orderLevelAmount = OrderLevelEnum.match(serviceRequirementsVO.getOrderLevelEnum().getKey()).getValue();
this.orderLevel = serviceRequirementsVO.getOrderLevelEnum().getKey();
this.totalAmount = serviceRequirementsVO.getOrderAmount().add(OrderLevelEnum.match(serviceRequirementsVO.getOrderLevelEnum().getKey()).getValue());
this.serviceId = serviceRequirementsVO.getServiceId();
this.orderAmount = serviceRequirementsVO.getOrderAmount();
this.insurance = serviceRequirementsVO.getInsurance();
this.cashAmount = serviceRequirementsVO.getCashAmount();
this.salaryAmount = serviceRequirementsVO.getSalaryAmount();
this.wechatPayOrderNumber = serviceRequirementsVO.getWechatPayOrderNumber();
this.weChat = serviceRequirementsVO.getWeChat();
this.paymentType = serviceRequirementsVO.getPaymentType();
}
}
package com.mmc.csf.release.entity.requirements;
import com.alibaba.fastjson.annotation.JSONField;
import com.mmc.csf.infomation.dto.ServiceSettleAccountsDTO;
import com.mmc.csf.infomation.vo.ServiceSettleAccountsVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/18 21:24
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ServiceSettleAccountsDO implements Serializable {
private static final long serialVersionUID = -447951390213113317L;
private Integer id;
@ApiModelProperty(value = "订单金额", example = "100")
private BigDecimal orderAmount;
@ApiModelProperty(value = "备注", example = "项目延期")
private String remark;
@ApiModelProperty(value = "需求id", example = "83")
private Integer requirementsInfoId;
@ApiModelProperty(value = "结算的用户id", example = "1", hidden = true)
private Integer userAccountId;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public ServiceSettleAccountsDO(ServiceSettleAccountsVO accountsVO) {
this.id = accountsVO.getId();
this.orderAmount = accountsVO.getOrderAmount();
this.remark = accountsVO.getRemark();
this.requirementsInfoId = accountsVO.getRequirementsInfoId();
this.userAccountId = accountsVO.getUserAccountId();
}
public ServiceSettleAccountsDTO buildServiceSettleAccountsDTO() {
return ServiceSettleAccountsDTO.builder()
.id(this.id)
.orderAmount(this.orderAmount)
.remark(this.remark)
.requirementsInfoId(this.requirementsInfoId)
.userAccountId(this.userAccountId)
.createTime(this.createTime)
.updateTime(this.updateTime)
.build();
}
}
......@@ -2,6 +2,7 @@ package com.mmc.csf.release.feign;
import com.mmc.csf.release.feign.hystrix.PmsAppApHystrix;
import com.mmc.csf.release.flyer.dto.AllCategoryDTO;
import com.mmc.csf.release.industry.IndustryTypeDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -17,4 +18,9 @@ import java.util.List;
public interface PmsAppApi {
@RequestMapping(value = "/pms/classify/feignQqueryCategoryInfoByType", method = RequestMethod.GET)
public List<AllCategoryDTO> feignQqueryCategoryInfoByType(@RequestParam Integer type);
@RequestMapping(value = "/pms/industry/getIndustryTypeById", method = RequestMethod.GET)
public IndustryTypeDTO feignQquerygetIndustryTypeById(@RequestParam Integer id);
}
package com.mmc.csf.release.feign;
import com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO;
import com.mmc.csf.infomation.dto.UserAccountSimpleDTO;
import com.mmc.csf.release.auth.qo.BUserAccountQO;
import com.mmc.csf.release.auth.qo.UserAccountQO;
......@@ -19,6 +21,7 @@ import java.util.List;
public interface UserAppApi {
/**
* 根据用户id获取基本信息
*
* @param userAccountId
* @return
*/
......@@ -27,6 +30,7 @@ public interface UserAppApi {
/**
* 根据地区信息查询用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
......@@ -48,10 +52,22 @@ public interface UserAppApi {
/**
* 获取小程序用户集合列表页面
*
* @param userAccountQO
* @param token
* @return
*/
@PostMapping("/userapp/user-account/feignListAppUserAccount")
List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO, @RequestHeader("token") String token);
/**
* 根据用户id获取基本信息
*
* @param userAccountId
* @return
*/
@GetMapping(value = "/userapp/pilot/interiorDetailPilot")
public PilotCertificationInteriorDTO feignInteriorDetailPilot(@RequestParam(required = true) Integer userAccountId);
}
......@@ -2,6 +2,7 @@ package com.mmc.csf.release.feign.hystrix;
import com.mmc.csf.release.feign.PmsAppApi;
import com.mmc.csf.release.flyer.dto.AllCategoryDTO;
import com.mmc.csf.release.industry.IndustryTypeDTO;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
......@@ -17,4 +18,10 @@ public class PmsAppApHystrix implements PmsAppApi {
log.info("熔断--feignQqueryCategoryInfoByType:" + type);
return null;
}
@Override
public IndustryTypeDTO feignQquerygetIndustryTypeById(Integer id) {
log.info("熔断--feignQquerygetIndustryTypeById:" + id);
return null;
}
}
package com.mmc.csf.release.feign.hystrix;
import com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO;
import com.mmc.csf.infomation.dto.UserAccountSimpleDTO;
import com.mmc.csf.release.auth.qo.BUserAccountQO;
import com.mmc.csf.release.auth.qo.UserAccountQO;
......@@ -37,4 +38,10 @@ public class UserAppApiHystrix implements UserAppApi {
log.error("熔断:feignListAppUserAccount:{}", userAccountQO);
return null;
}
@Override
public PilotCertificationInteriorDTO feignInteriorDetailPilot(Integer userAccountId) {
log.error("熔断:feignInteriorDetailPilot:{}", userAccountId);
return null;
}
}
package com.mmc.csf.release.service;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.infomation.dto.ServiceArriveSceneDTO;
import com.mmc.csf.infomation.dto.ServiceEvaluateDTO;
import com.mmc.csf.infomation.dto.ServiceFulfilATaskDTO;
import com.mmc.csf.infomation.dto.ServiceSettleAccountsDTO;
import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.vo.RequirementsInfoVO;
import com.mmc.csf.infomation.vo.*;
import javax.servlet.http.HttpServletRequest;
......@@ -63,4 +67,31 @@ public interface RequirementsService {
ResultBody detailPublish(Integer id, HttpServletRequest request, Integer userAccountId);
ResultBody backDetailPublish(Integer id, HttpServletRequest request, Integer userAccountId);
ResultBody publishService(ServiceRequirementsVO serviceRequirementsVO, HttpServletRequest request);
ResultBody<RequirementsInfoVO> myPublish(Integer userAccountId);
ResultBody<RequirementsInfoVO> grabTheOrder(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request);
ResultBody arriveAtTheScene(ServiceArriveSceneVO serviceArriveSceneVO);
ResultBody<ServiceArriveSceneDTO> arriveAtTheSceneDetails(Integer requirementsInfoId, Integer userAccountId);
ResultBody fulfilATask(ServiceFulfilATaskVO fulfilATaskVO);
ResultBody<ServiceFulfilATaskDTO> fulfilATaskDetails(Integer requirementsInfoId, Integer userAccountId);
ResultBody settleAccounts(ServiceSettleAccountsVO settleAccountsVO);
ResultBody<ServiceSettleAccountsDTO> settleAccountsDetails(Integer requirementsInfoId, Integer userAccountId);
ResultBody evaluate(ServiceEvaluateVO evaluateVO);
ResultBody<ServiceEvaluateDTO> evaluateDetails(Integer requirementsInfoId, Integer userAccountId);
ResultBody publisherNumber(GetOrderNumberVO getOrderNumberVO, HttpServletRequest request);
ResultBody<RequirementsInfoVO> myPreempt(Integer userAccountId);
}
......@@ -2,34 +2,38 @@ package com.mmc.csf.release.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mmc.csf.common.util.json.JsonUtil;
import com.mmc.csf.common.util.page.PageResult;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.common.util.web.ResultEnum;
import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.vo.RequirementsInfoVO;
import com.mmc.csf.infomation.vo.RequirementsTypeVO;
import com.mmc.csf.infomation.vo.*;
import com.mmc.csf.release.dao.RequirementsDao;
import com.mmc.csf.release.entity.requirements.RequirementsInfoDO;
import com.mmc.csf.release.entity.requirements.RequirementsTypeDO;
import com.mmc.csf.release.entity.requirements.*;
import com.mmc.csf.release.feign.PmsAppApi;
import com.mmc.csf.release.feign.UserAppApi;
import com.mmc.csf.release.industry.IndustryTypeDTO;
import com.mmc.csf.release.service.RequirementsService;
import com.mmc.csf.release.util.RestTemplateUtil;
import lombok.extern.slf4j.Slf4j;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -55,6 +59,15 @@ public class RequirementsServiceImpl implements RequirementsService {
private String omsApp;
@Autowired
private PmsAppApi pmsAppApi;
@Value("${iuav.userapp.url}")
private String userApp;
@Value("${iuav.pmsapp.url}")
private String pmsApp;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Override
......@@ -139,7 +152,16 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override
public ResultBody appPublishList() {
List<RequirementsInfoDO> requirementsInfoDOS = requirementsDao.appPublishList();
//远程调用服务一级分类
List<IndustryTypeDTO> industryTypeDTOS = listIndustry();
List<RequirementsInfoVO> collect = requirementsInfoDOS.stream().map(RequirementsInfoDO::buildRequirementsInfoVO).collect(Collectors.toList());
for (RequirementsInfoVO requirementsInfoVO : collect) {
for (IndustryTypeDTO industryTypeDTO : industryTypeDTOS) {
if (requirementsInfoVO.getServiceId() != null && requirementsInfoVO.getServiceId().equals(industryTypeDTO.getId())) {
requirementsInfoVO.setServiceName(industryTypeDTO.getTypeName());
}
}
}
return ResultBody.success(collect);
}
......@@ -155,7 +177,8 @@ public class RequirementsServiceImpl implements RequirementsService {
requirementsInfoVO.setOrderNumber(randomOrderCode());
requirementsInfoVO.setPublishAccountId(requirementsInfoDO.getUserAccountId());
requirementsInfoVO.setRequirementsInfoId(requirementsInfoDO.getId());
IndustryTypeDTO industryTypeDTO = pmsAppApi.feignQquerygetIndustryTypeById(requirementsInfoVO.getServiceId());
requirementsInfoVO.setServiceName(industryTypeDTO.getTypeName());
//已经支付
String s = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getId().toString());
RequirementsInfoVO orderVO = JSON.parseObject(s, RequirementsInfoVO.class);
......@@ -167,13 +190,14 @@ public class RequirementsServiceImpl implements RequirementsService {
return ResultBody.success(requirementsInfoVO);
}
}
//生成
ResultBody resultBody = releaseOrder(requirementsInfoVO, request.getHeader("token"));
if (resultBody.getCode().equals(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED.getResultCode())) {
return resultBody;
}
if (requirementsInfoVO.getPublish() == 0) {
requirementsInfoVO.setPublishPhone("");
}
return ResultBody.success(requirementsInfoVO);
}
......@@ -212,6 +236,857 @@ public class RequirementsServiceImpl implements RequirementsService {
return ResultBody.success(requirementsInfoVO);
}
@Override
public ResultBody<GetOrderNumberDTO> publisherNumber(GetOrderNumberVO getOrderNumberVO, HttpServletRequest request) {
//用户钱包信息接口
ResultBody resultBody = getCurrentUserPayWalletInfo(request);
GetOrderNumberDTO orderNumberDTO = new GetOrderNumberDTO();
orderNumberDTO.setUserAccountId(getOrderNumberVO.getUserAccountId());
PayWalletDTO payWalletDTO = (PayWalletDTO) resultBody.getResult();
//用户云享金+用户佣金>总金额
//剩余后台云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//剩余佣金
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
//用户云享金加上佣金的总金额
BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
//需要支付的总金额
BigDecimal totalAmount = getOrderNumberVO.getOrderAmount().add(OrderLevelEnum.match(getOrderNumberVO.getOrderLevelEnum().getKey()).getValue());
if (getOrderNumberVO.getOrderMode() == 2) {
BigDecimal bigDecimal = new BigDecimal(0.3);
totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
}
//需要冻结的金额
WalletFlowVO walletFlowVO = new WalletFlowVO();
BigDecimal tempTotalAmount = totalAmount;
String paymentType = getOrderNumberVO.getPaymentType();
String[] split = paymentType.split(",");
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
TreeSet<String> objects = new TreeSet<>(collect);
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt);
}
}
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
default:
break;
}
}
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
if (orderNumberDTO.getWeChatPay() != null) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
}
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败");
}
/* //用户剩余总金额大于需要支付的总金额
if (cashAndSalary.compareTo(totalAmount) == 1) {
//优先扣除云享金
//如果用户选择了云享金没有选择佣金及微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//如果云享金足够
if (cashAmt.compareTo(totalAmount) == 1) {
//冻结需要支付的金额
walletFlowVO.setCashAmount(totalAmount);
BigDecimal cashAmount = walletFlowVO.getCashAmount();
}
//云享金不够
if (cashAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,云享金余额不足");
}
}
//选择了佣金 未选择微信支付,云享金
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//佣金足够
if (salaryAmt.compareTo(totalAmount) == 1) {
walletFlowVO.setSalaryAmount(totalAmount);
BigDecimal salaryAmount = walletFlowVO.getSalaryAmount();
}
//佣金不够
if (salaryAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,佣金余额不足");
}
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额无需使用微信支付");
}
//选择了 云享金及佣金支付 没有选择微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//如果云享金大于总金额
if (cashAmt.compareTo(totalAmount) == 1) {
//云享金就冻结
walletFlowVO.setCashAmount(totalAmount.negate());
System.out.println(walletFlowVO.getCashAmount());
}
//如果云享金不够就扣除佣金
if (cashAmt.compareTo(totalAmount) == -1) {
//总金额减去云享金剩余未扣除的钱
BigDecimal subtract = totalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(subtract.negate());
}
return ResultBody.success("用户剩余总金额足够,需要微信支付");
}
//前提是云享金加上佣金大于总金额 选择了云享金 +微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额无需使用微信支付");
}
//前提是云享金加上佣金大于总金额 选择了佣金+选择了微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额无需使用微信支付");
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额,请取消微信支付");
}
}
//用户剩余总金额小于需要支付的总金额
if (cashAndSalary.compareTo(totalAmount) == -1) {
//用户剩余的总金额小于需要支付的总金额 只选择了云享金支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//云享金不够
if (cashAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,云享金余额不足");
}
}
//用户剩余的总金额小于需要支付的总金额 选择了佣金 未选择微信支付,云享金
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//佣金不够
if (salaryAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,佣金余额不足");
}
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
//微信实际需要全部支付
orderNumberDTO.setWeChatPay(totalAmount);
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
//用户剩余的总金额小于需要支付的总金额 云享金及佣金支付 没有选择微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
return ResultBody.error("云享金加上佣金小于需要总金额,需要加上微信支付");
}
//用户剩余的总金额小于需要支付的总金额 选择了云享金 +微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal weChat = totalAmount.subtract(cashAmt);
//微信实际需要全部支付
//云享金需要冻结的金额
walletFlowVO.setCashAmount(cashAmt);
orderNumberDTO.setWeChatPay(weChat);
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
//用户剩余的总金额小于需要支付的总金额 选择了佣金+选择了微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal weChat = totalAmount.subtract(salaryAmt);
//需要冻结的佣金是
walletFlowVO.setSalaryAmount(salaryAmt);
//微信需要支付的金额
orderNumberDTO.setWeChatPay(weChat);
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
//优先扣除云享金
BigDecimal totalSubtract = totalAmount.subtract(cashAmt);
BigDecimal salarySubtract = totalSubtract.subtract(salaryAmt);
walletFlowVO.setWeChat(salarySubtract);
orderNumberDTO.setWeChatPay(salarySubtract);
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
}
*/
/* //云享金
BigDecimal cashAmount = getOrderNumberVO.getCashAmount();
//佣金
BigDecimal salaryAmount = getOrderNumberVO.getSalaryAmount();
//微信金额
BigDecimal weChat = getOrderNumberVO.getWeChatPay();
String randomOrder = randomOrderCode();
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
return ResultBody.error(ResultEnum.PLEASE_SELECT_PAYMENT);
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == 1) {
return ResultBody.error(ResultEnum.OVER_THE_TOTAL);
}
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于佣金剩余的金额
if (totalAmount.compareTo(salaryAmt) == 1) {
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
}
}
//单独微信微信 可以进行支付
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
orderNumberDTO.setWeChatPay(totalAmount);
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
BigDecimal add = cashAmt.add(salaryAmt);
if (totalAmount.compareTo(add) == 1) {
return ResultBody.error(ResultEnum.CASH_SALARY_PAYMENT_FAILURE);
}
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal subtract = totalAmount.subtract(cashAmt);
orderNumberDTO.setWeChatPay(subtract);
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal subtract = totalAmount.subtract(salaryAmt);
orderNumberDTO.setWeChatPay(subtract);
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
BigDecimal cash = totalAmount.subtract(cashAmt);
if (cash.compareTo(BigDecimal.ZERO) == 0) {
return ResultBody.error(ResultEnum.CASH_IS_ENOUGH);
}
BigDecimal salary = cash.subtract(salaryAmt);
if (salary.compareTo(BigDecimal.ZERO) == 0) {
return ResultBody.error(ResultEnum.SALARY_IS_ENOUGH);
}
return ResultBody.success(orderNumberDTO);
}*/
}
@Override
public ResultBody<RequirementsInfoVO> myPreempt(Integer userAccountId) {
List<RequirementsInfoDO> requirementsInfoDOS = requirementsDao.myPreempt(userAccountId);
List<RequirementsInfoVO> collect = requirementsInfoDOS.stream().map(RequirementsInfoDO::buildRequirementsInfoVO).collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody publishService(ServiceRequirementsVO serviceRequirementsVO, HttpServletRequest request) {
//需要冻结的金额
WalletFlowVO walletFlowVO = new WalletFlowVO();
ServiceRequirementsDO requirementsInfoDO = new ServiceRequirementsDO(serviceRequirementsVO);
requirementsInfoDO.setPublisherNumber(randomOrderCode());
//获取用户钱包
ResultBody resultBody = getCurrentUserPayWalletInfo(request);
PayWalletDTO payWalletDTO = (PayWalletDTO) resultBody.getResult();
//需要支付的总金额
BigDecimal totalAmount = requirementsInfoDO.getTotalAmount();
//云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//佣金
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
String json = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getWechatPayOrderNumber() + requirementsInfoDO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
BigDecimal tempTotalAmount = totalAmount;
String paymentType = requirementsInfoDO.getPaymentType();
String[] split = paymentType.split(",");
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
TreeSet<String> objects = new TreeSet<>(collect);
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt);
}
}
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
default:
break;
}
}
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
//orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
/*if (orderNumberDTO.getWeChatPay() != null) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
}*/
requirementsInfoDO.setCashAmount(walletFlowVO.getCashAmount());
requirementsInfoDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
requirementsInfoDO.setWeChat(walletFlowVO.getWeChat());
if (orderNumberDTO != null) {
requirementsInfoDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber());
} else if (orderNumberDTO == null) {
requirementsInfoDO.setWechatPayOrderNumber(null);
}
requirementsDao.addPublishService(requirementsInfoDO);
return ResultBody.success();
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败");
}
/* if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
return ResultBody.error(ResultEnum.PLEASE_SELECT_PAYMENT);
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == 1) {
return ResultBody.error(ResultEnum.OVER_THE_TOTAL);
}
//总金额小于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == -1) {
walletFlowVO.setCashAmount(totalAmount);
}
walletFlowVO.setCashAmount(totalAmount.negate());
//冻结云享金
extracted(walletFlowVO, requirementsInfoDO);
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于佣金剩余的金额
if (totalAmount.compareTo(salaryAmt) == 1) {
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
}
//总金额小于佣金剩余的金额
if (totalAmount.compareTo(salaryAmount) == -1) {
walletFlowVO.setSalaryAmount(totalAmount);
}
walletFlowVO.setSalaryAmount(totalAmount.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//单独微信制度 可以进行支付
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay().negate();
walletFlowVO.setWeChat(weChatPay);
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金与佣金剩余金额足够及不足够
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
BigDecimal add = cashAmt.add(salaryAmt);
if (totalAmount.compareTo(add) == 1) {
return ResultBody.error(ResultEnum.CASH_SALARY_PAYMENT_FAILURE);
}
//云享金不足佣金可以补上
if (totalAmount.compareTo(add) == -1) {
BigDecimal cash = cashAmt.subtract(totalAmount);
if (cash.compareTo(BigDecimal.ZERO) <= 0) {
BigDecimal salary = salaryAmt.subtract(cash.negate());
System.out.println(salary);
//云享金
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cashAmt.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金足够 不扣除佣金剩余的金额
if (cash.compareTo(BigDecimal.ZERO) > 0) {
walletFlowVO.setCashAmount(cash.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
}
}
//选择佣金或者微信支付
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal salary = salaryAmt.subtract(totalAmount);
if (salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setSalaryAmount(totalAmount);
extracted(walletFlowVO, requirementsInfoDO);
}
if (salary.compareTo(BigDecimal.ZERO) < 0) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay();
walletFlowVO.setSalaryAmount(salary);
walletFlowVO.setWeChat(weChatPay.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
return ResultBody.success(orderNumberDTO);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal cash = cashAmt.subtract(totalAmount);
BigDecimal salary = salaryAmt.subtract(cash.negate());
// 如果云享金充足
if (cash.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(totalAmount);
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cash);
extracted(walletFlowVO, requirementsInfoDO);
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) < 0) {
walletFlowVO.setCashAmount(cashAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
walletFlowVO.setWeChat(orderNumberDTO.getWeChatPay());
}
}
*/
}
private void extracted(WalletFlowVO walletFlowVO, ServiceRequirementsDO requirementsInfoDO) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式
walletFlowVO.setWeChat(walletFlowVO.getWeChat());
walletFlowVO.setModeOfPayment(300);
walletFlowVO.setTimeOfPayment(df.format(new Date()));
walletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId());
walletFlowVO.setOperateUserAccountId(requirementsInfoDO.getUserAccountId());
walletFlowVO.setCashAmount(walletFlowVO.getCashAmount());
walletFlowVO.setSalaryAmount(walletFlowVO.getSalaryAmount());
System.out.println(walletFlowVO);
}
/**
* 获取用户钱包信息
*
* @param
* @param request
* @return
*/
public ResultBody getCurrentUserPayWalletInfo(HttpServletRequest request) {
String token = request.getHeader("token");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
ResponseEntity<String> exchange = null;
try {
exchange = restTemplate.exchange(userApp + "/userapp/pay/getCurrentUserPayWalletInfo", HttpMethod.GET, formEntity, String.class);
} catch (RestClientException e) {
return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
Object body = exchange.getBody();
JSONObject jsonObject = JSONObject.parseObject((String) body);
JSONObject result1 = (JSONObject) jsonObject.get("result");
PayWalletDTO payWalletDTO = JSON.parseObject(result1.toJSONString(), PayWalletDTO.class);
return ResultBody.success(payWalletDTO);
}
@Override
public ResultBody<RequirementsInfoVO> myPublish(Integer userAccountId) {
List<RequirementsInfoDO> requirementsInfoDOS = requirementsDao.myPublish(userAccountId);
List<RequirementsInfoVO> collect = requirementsInfoDOS.stream().map(RequirementsInfoDO::buildRequirementsInfoVO).collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody grabTheOrder(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request) {
ServiceRequirementsDO requirementsInfoDO = requirementsDao.grabTheOrder(grabTheOrderVO.getPublisherNumber());
if (grabTheOrderVO.getPublisherNumber().equals(requirementsInfoDO.getPublisherNumber()) && grabTheOrderVO.getUserAccountId().equals(requirementsInfoDO.getUserAccountId())) {
return ResultBody.error("自己不能抢自己发布的需求");
}
//飞手
PilotCertificationInteriorDTO pilot = feignInteriorDetailPilot(grabTheOrderVO.getUserAccountId(), request);
if (pilot == null) {
return ResultBody.error("只能飞手或者飞手团队抢单");
}
Integer repertory = requirementsInfoDO.getRepertory();
if (repertory <= 0) {
return ResultBody.error("需求已被其他人抢走");
}
// requirementsInfoDO.setPublisherNumber(randomOrderCode());
ResultBody resultBody = getCurrentUserPayWalletInfo(request);
PayWalletDTO payWalletDTO = (PayWalletDTO) resultBody.getResult();
//用户云享金+用户佣金>总金额
//剩余后台云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//剩余佣金
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
//用户云享金加上佣金的总金额
BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
//需要支付的总金额
BigDecimal totalAmount = requirementsInfoDO.getTotalAmount();
BigDecimal bigDecimal = new BigDecimal(0.3);
totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
String json = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getWechatPayOrderNumber() + requirementsInfoDO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
//需要冻结的金额
WalletFlowVO walletFlowVO = new WalletFlowVO();
BigDecimal tempTotalAmount = totalAmount;
String paymentType = grabTheOrderVO.getPaymentType();
String[] split = paymentType.split(",");
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
TreeSet<String> objects = new TreeSet<>(collect);
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt);
}
}
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
default:
break;
}
}
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
/* orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
if (orderNumberDTO.getWeChatPay() != null) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
}*/
// return ResultBody.success(orderNumberDTO);
/* //云享金
BigDecimal cashAmount = requirementsInfoDO.getCashAmount();
//佣金
BigDecimal salaryAmount = requirementsInfoDO.getSalaryAmount();
//微信金额
BigDecimal weChat = requirementsInfoDO.getWeChat();
//需要支付的总金额
BigDecimal totalAmount = requirementsInfoDO.getTotalAmount();
System.out.println(totalAmount);
totalAmount = totalAmount.multiply(new BigDecimal(0.3));
//云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//佣金
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
String json = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getWechatPayOrderNumber() + requirementsInfoDO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
return ResultBody.error(ResultEnum.PLEASE_SELECT_PAYMENT);
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == 1) {
return ResultBody.error(ResultEnum.OVER_THE_TOTAL);
}
//总金额小于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == -1) {
walletFlowVO.setCashAmount(totalAmount);
}
walletFlowVO.setCashAmount(totalAmount.negate());
//冻结云享金
extracted(walletFlowVO, requirementsInfoDO);
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于佣金剩余的金额
if (totalAmount.compareTo(salaryAmt) == 1) {
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
}
//总金额小于佣金剩余的金额
if (totalAmount.compareTo(salaryAmount) == -1) {
walletFlowVO.setSalaryAmount(totalAmount);
}
walletFlowVO.setSalaryAmount(totalAmount.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//单独微信制度 可以进行支付
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay().negate();
walletFlowVO.setWeChat(weChatPay);
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金与佣金剩余金额足够及不足够
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
BigDecimal add = cashAmt.add(salaryAmt);
if (totalAmount.compareTo(add) == 1) {
return ResultBody.error(ResultEnum.CASH_SALARY_PAYMENT_FAILURE);
}
//云享金不足佣金可以补上
if (totalAmount.compareTo(add) == -1) {
BigDecimal cash = cashAmt.subtract(totalAmount);
if (cash.compareTo(BigDecimal.ZERO) <= 0) {
BigDecimal salary = salaryAmt.subtract(cash.negate());
System.out.println(salary);
//云享金
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cashAmt.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金足够 不扣除佣金剩余的金额
if (cash.compareTo(BigDecimal.ZERO) > 0) {
walletFlowVO.setCashAmount(cash.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
}
}
//选择佣金或者微信支付
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal salary = salaryAmt.subtract(totalAmount);
if (salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setSalaryAmount(totalAmount);
extracted(walletFlowVO, requirementsInfoDO);
}
if (salary.compareTo(BigDecimal.ZERO) < 0) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay();
walletFlowVO.setSalaryAmount(salary);
walletFlowVO.setWeChat(weChatPay.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
return ResultBody.success(orderNumberDTO);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal cash = cashAmt.subtract(totalAmount);
BigDecimal salary = salaryAmt.subtract(cash.negate());
// 如果云享金充足
if (cash.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(totalAmount);
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cash);
extracted(walletFlowVO, requirementsInfoDO);
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) < 0) {
walletFlowVO.setCashAmount(cashAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
walletFlowVO.setWeChat(orderNumberDTO.getWeChatPay());
}
}*/
RequirementsServiceDO requirementsServiceDO = new RequirementsServiceDO(pilot, requirementsInfoDO);
requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
requirementsServiceDO.setWeChat(orderNumberDTO.getWeChatPay());
requirementsServiceDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber());
BigDecimal cashAndSalaryAmount = walletFlowVO.getCashAmount().add(walletFlowVO.getSalaryAmount());
BigDecimal preemptTotalAmount = cashAndSalaryAmount.add(orderNumberDTO.getWeChatPay());
requirementsServiceDO.setPreemptTotalAmount(preemptTotalAmount);
requirementsDao.insertService(requirementsServiceDO);
requirementsInfoDO.setRepertory(repertory - 1);
requirementsDao.updateGrabTheOrder(grabTheOrderVO.getPublisherNumber(), requirementsInfoDO.getRepertory());
return ResultBody.success();
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("抢单失败");
}
}
@Override
public ResultBody arriveAtTheScene(ServiceArriveSceneVO serviceArriveSceneVO) {
ServiceArriveSceneDO serviceArriveSceneDO = new ServiceArriveSceneDO(serviceArriveSceneVO);
RequirementsInfoDO requirementsInfoDO = requirementsDao.detailPublish(serviceArriveSceneDO.getRequirementsInfoId());
GlobalCoordinates source = new GlobalCoordinates(Double.parseDouble(String.valueOf(requirementsInfoDO.getLatitude())), Double.parseDouble(String.valueOf(requirementsInfoDO.getLongitude())));
GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(String.valueOf(serviceArriveSceneDO.getLatitude())), Double.parseDouble(String.valueOf(serviceArriveSceneDO.getLongitude())));
double geoCurve = getDistanceMeter(source, target, Ellipsoid.Sphere);
//100米
if (geoCurve > 100) {
return ResultBody.error(ResultEnum.FALL_OUTSIDE_OF);
} else {
requirementsDao.arriveAtTheScene(serviceArriveSceneDO);
requirementsDao.updateScene(serviceArriveSceneDO.getRequirementsInfoId());
}
return ResultBody.success();
}
/* 经纬度计算工具类*/
public static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid) {
//创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离
GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo);
return geoCurve.getEllipsoidalDistance();
}
@Override
public ResultBody<ServiceArriveSceneDTO> arriveAtTheSceneDetails(Integer requirementsInfoId, Integer userAccountId) {
ServiceArriveSceneDO serviceArriveSceneDO = requirementsDao.arriveAtTheSceneDetails(requirementsInfoId, userAccountId);
ServiceArriveSceneDTO serviceArriveSceneDTO = serviceArriveSceneDO.buildServiceArriveSceneDTO();
return ResultBody.success(serviceArriveSceneDTO);
}
@Override
public ResultBody fulfilATask(ServiceFulfilATaskVO fulfilATaskVO) {
ServiceFulfilATaskDO serviceFulfilATaskDO = new ServiceFulfilATaskDO(fulfilATaskVO);
requirementsDao.fulfilATask(serviceFulfilATaskDO);
requirementsDao.updateFulfilATask(fulfilATaskVO.getRequirementsInfoId());
return ResultBody.success();
}
@Override
public ResultBody<ServiceFulfilATaskDTO> fulfilATaskDetails(Integer requirementsInfoId, Integer userAccountId) {
ServiceFulfilATaskDO serviceFulfilATaskDO = requirementsDao.fulfilATaskDetails(requirementsInfoId, userAccountId);
ServiceFulfilATaskDTO serviceFulfilATaskDTO = serviceFulfilATaskDO.buildServiceFulfilATaskDTO();
return ResultBody.success(serviceFulfilATaskDTO);
}
@Override
public ResultBody settleAccounts(ServiceSettleAccountsVO settleAccountsVO) {
ServiceSettleAccountsDO settleAccountsDO = new ServiceSettleAccountsDO(settleAccountsVO);
requirementsDao.settleAccounts(settleAccountsDO);
requirementsDao.updatesettleAccounts(settleAccountsVO.getRequirementsInfoId());
return ResultBody.success();
}
@Override
public ResultBody<ServiceSettleAccountsDTO> settleAccountsDetails(Integer requirementsInfoId, Integer userAccountId) {
ServiceSettleAccountsDO settleAccountsDO = requirementsDao.settleAccountsDetails(requirementsInfoId, userAccountId);
ServiceSettleAccountsDTO settleAccountsDTO = settleAccountsDO.buildServiceSettleAccountsDTO();
return ResultBody.success(settleAccountsDTO);
}
@Override
public ResultBody evaluate(ServiceEvaluateVO evaluateVO) {
ServiceEvaluateDO serviceEvaluateDO = new ServiceEvaluateDO(evaluateVO);
requirementsDao.evaluate(serviceEvaluateDO);
requirementsDao.updateEvaluate(evaluateVO.getRequirementsInfoId());
return ResultBody.success();
}
@Override
public ResultBody<ServiceEvaluateDTO> evaluateDetails(Integer requirementsInfoId, Integer userAccountId) {
ServiceEvaluateDO serviceEvaluateDO = requirementsDao.evaluateDetails(requirementsInfoId, userAccountId);
ServiceEvaluateDTO serviceEvaluateDTO = serviceEvaluateDO.buildServiceEvaluateDTO();
return ResultBody.success(serviceEvaluateDTO);
}
public PilotCertificationInteriorDTO feignInteriorDetailPilot(Integer userAccountId, HttpServletRequest request) {
String token = request.getHeader("token");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(userAccountId), headers);
ResponseEntity<PilotCertificationInteriorDTO> exchange1 = restTemplate.exchange(userApp + "/userapp/pilot/interiorDetailPilot?userAccountId=" + userAccountId, HttpMethod.GET, entity, PilotCertificationInteriorDTO.class);
PilotCertificationInteriorDTO body = exchange1.getBody();
return body;
}
public ResultBody releaseOrder(RequirementsInfoVO requirementsInfoVO, String token) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
......@@ -227,6 +1102,21 @@ public class RequirementsServiceImpl implements RequirementsService {
}
public List<IndustryTypeDTO> listIndustry() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(null, headers);
ResponseEntity<List> exchange = restTemplate.exchange(pmsApp + "/pms/industry/listIndustry", HttpMethod.GET, entity, List.class);
List<IndustryTypeDTO> body = (List<IndustryTypeDTO>) exchange.getBody();
String s = JSON.toJSONString(body);
List<IndustryTypeDTO> industryTypeDTOS = JSONObject.parseArray(s, IndustryTypeDTO.class);
ArrayList<IndustryTypeDTO> list = new ArrayList<>();
for (IndustryTypeDTO industryTypeDTO : industryTypeDTOS) {
list.add(industryTypeDTO);
}
return list;
}
public String randomOrderCode() {
SimpleDateFormat dmDate = new SimpleDateFormat("yyyyMMddHHmmss");
String ranData = getRandom(6);
......
......@@ -222,22 +222,221 @@
</delete>
<select id="appPublishList" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
SELECT id,
task_title,
task_start_time,
task_end_time,
task_address,
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,
ri.order_level,
ri.service_id,
ri.total_amount,
ri.insurance
FROM requirements_info ri
WHERE NOT EXISTS(
SELECT rs.requirements_info_id FROM requirements_service rs WHERE ri.id = rs.requirements_info_id)
ORDER BY ri.order_level_amount DESC,
ri.id DESC
</select>
<select id="detailPublish" 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,
ri.total_amount,
ri.insurance,
sf.doing,
sf.waiting,
sf.user_port,
sf.flyer_port,
sf.order_status,
ri.publish
FROM requirements_info ri
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
WHERE ri.id = #{id}
</select>
<insert id="addPublishService" parameterType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO"
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, order_amount, insurance, total_amount, publish,
order_level_amount, order_level, cash_amount, we_chat, salary_amount,
wechat_pay_order_number, service_flow_id)
VALUES (#{serviceId}, #{userAccountId}, #{publishName}, #{publishPhone},
#{requireDescription}, NOW(),
NOW(), #{taskStartTime}, #{taskEndTime}, #{taskAddress}, #{longitude},
#{latitude}, #{publisherNumber}, #{orderAmount}, #{insurance}, #{totalAmount}, 1,
#{orderLevelAmount}, #{orderLevel}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber},
100);
</insert>
<select id="grabTheOrder" resultType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO">
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,
ri.total_amount,
ri.repertory,
ri.order_level,
ri.cash_amount,
ri.we_chat,
ri.salary_amount,
ri.wechat_pay_order_number
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
WHERE ri.publisher_number = #{publisherNumber}
</select>
<update id="updateGrabTheOrder">
UPDATE requirements_info
set repertory=#{repertory},
update_time=NOW()
where publisher_number = #{publisherNumber}
</update>
<insert id="insertService" parameterType="com.mmc.csf.release.entity.requirements.RequirementsServiceDO"
keyProperty="id" useGeneratedKeys="true">
INSERT INTO requirements_service(requirements_info_id, service_dictionary_id, pilot_certification_id,
pilot_certification_user_id, team_id, team_user_id, cash_amount, we_chat,
salary_amount,
wechat_pay_order_number, service_flow_id, preempt_total_amount)
VALUES (#{requirementsInfoId}, #{serviceDictionaryId}, #{pilotCertificationId}, #{pilotCertificationUserId},
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 200,
preemptTotalAmount);
</insert>
<insert id="arriveAtTheScene" parameterType="com.mmc.csf.release.entity.requirements.ServiceArriveSceneDO"
keyProperty="id" useGeneratedKeys="true">
INSERT INTO service_arrive_scene(longitude, latitude, scene_address, scene_url, user_account_id, create_time,
requirements_info_id, update_time)
VALUES (#{longitude}, #{latitude}, #{sceneAddress}, #{sceneUrl}, #{userAccountId}, NOW(),
#{requirementsInfoId}, NOW());
</insert>
<update id="updateScene">
UPDATE requirements_service
set service_dictionary_id=5,
service_flow_id=1,
update_time=NOW()
where requirements_info_id = #{requirementsInfoId}
</update>
<select id="arriveAtTheSceneDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceArriveSceneDO">
select id,
longitude,
latitude,
require_url,
require_description,
requirement_type_id,
scene_address,
scene_url,
user_account_id,
create_time,
update_time,
requirements_info_id
from service_arrive_scene
where requirements_info_id = #{requirementsInfoId}
and user_account_id = #{userAccountId}
</select>
<insert id="fulfilATask" parameterType="com.mmc.csf.release.entity.requirements.ServiceFulfilATaskDO"
keyProperty="id" useGeneratedKeys="true">
INSERT INTO service_fulfil_a_task(task_describe, task_url, create_time, update_time, user_account_id,
requirements_info_id)
VALUES (#{taskDescribe}, #{taskUrl}, NOW(), NOW(), #{userAccountId},
#{requirementsInfoId});
</insert>
<update id="updateFulfilATask">
UPDATE requirements_service
set service_dictionary_id=5,
service_flow_id=2,
update_time=NOW()
where requirements_info_id = #{requirementsInfoId}
</update>
<select id="fulfilATaskDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceFulfilATaskDO">
select id, task_describe, task_url, create_time, update_time, requirements_info_id, user_account_id
from service_fulfil_a_task
where requirements_info_id = #{requirementsInfoId}
and user_account_id = #{userAccountId}
</select>
<insert id="settleAccounts" parameterType="com.mmc.csf.release.entity.requirements.ServiceSettleAccountsDO"
keyProperty="id" useGeneratedKeys="true">
INSERT INTO service_settle_accounts(order_amount, requirements_info_id, remark, create_time, update_time)
VALUES (#{orderAmount}, #{requirementsInfoId}, #{remark}, NOW(), NOW());
</insert>
<update id="updatesettleAccounts">
UPDATE requirements_service
set service_dictionary_id=4,
service_flow_id=3,
update_time=NOW()
where requirements_info_id = #{requirementsInfoId}
</update>
<select id="settleAccountsDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceSettleAccountsDO">
select id, order_amount, requirements_info_id, remark, create_time, update_time
from service_settle_accounts
where requirements_info_id = #{requirementsInfoId}
and user_account_id = #{userAccountId}
</select>
<insert id="evaluate" parameterType="com.mmc.csf.release.entity.requirements.ServiceEvaluateDO"
keyProperty="id" useGeneratedKeys="true">
INSERT INTO service_evaluate(evaluation_content, star_level, evaluation_url, create_time, update_time,
requirements_info_id, user_account_id)
VALUES (#{evaluationContent}, #{starLevel}, #{evaluationUrl}, NOW(), NOW(), #{requirementsInfoId},
#{userAccountId});
</insert>
<update id="updateEvaluate">
UPDATE requirements_service
set service_dictionary_id=4,
service_flow_id= 4,
update_time=NOW()
where requirements_info_id = #{requirementsInfoId}
</update>
<select id="evaluateDetails" resultType="com.mmc.csf.release.entity.requirements.ServiceEvaluateDO">
select id,
evaluation_content,
star_level,
evaluation_url,
create_time,
update_time,
requirements_info_id,
user_account_id
FROM requirements_info
order by create_time desc
from service_evaluate
where requirements_info_id = #{requirementsInfoId}
and user_account_id = #{userAccountId}
</select>
<select id="detailPublish" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
<select id="myPublish" resultType="com.mmc.csf.release.entity.requirements.RequirementsInfoDO">
SELECT ri.id,
ri.task_title,
ri.task_start_time,
......@@ -251,10 +450,56 @@
ri.user_account_id,
rt.type_name AS requirementTypeName,
ri.publish_phone,
ri.publisher_number
ri.publisher_number,
ri.service_id,
ri.total_amount,
ri.insurance,
sf.doing,
sf.waiting,
sf.user_port,
sf.flyer_port,
sf.order_status,
ri.publish
FROM requirements_info ri
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
WHERE ri.id = #{id}
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
WHERE ri.user_account_id = #{userAccountId}
ORDER BY ri.order_level_amount desc,
ri.id desc
</select>
<select id="myPreempt" 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,
ri.total_amount,
ri.insurance,
sf.doing,
sf.waiting,
sf.user_port,
sf.flyer_port,
sf.order_status,
ri.publish,
rs.preempt_total_amount
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.pilot_certification_user_id = #{userAccountId}
ORDER BY ri.order_level_amount desc,
rs.id desc
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论