Преглед изворни кода

开始服务、结束服务时,新增距离(bug修复)

LiRong пре 3 месеци
родитељ
комит
cc8ca47200

+ 3 - 2
leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java

@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.List;
 import java.util.Objects;
 
@@ -47,7 +48,7 @@ public class VolunteerInfoController extends BaseController {
      */
     @ApiOperation( value = "新增志愿者信息",notes = "传入路径参数 大分类,传入对象参数志愿者信息")
     @PostMapping("/newVolunteerInfo/{serviceCategory}")
-    public AjaxResult newVolunteerInfoByuserId(@RequestBody VolunteerInfoDTO dto, @PathVariable Long serviceCategory){
+    public AjaxResult newVolunteerInfoByuserId(@Valid  @RequestBody VolunteerInfoDTO dto, @PathVariable Long serviceCategory){
         volunteerInfoService.newVolunteerInfoByuserId(dto,serviceCategory);
         return AjaxResult.success();
     }
@@ -138,7 +139,7 @@ public class VolunteerInfoController extends BaseController {
         SendSmsUtil.send(info.getPhonenumber(), jsonObject.toString(), ConstantsConfig.SMS_TEMPLATE_TYPE_VOLUNTEER_RESULT.getValue());
         return AjaxResult.success();
     }
-    @ApiOperation("小程序首页志愿者自己的头像")
+    @ApiOperation("小程序志愿者首页获取自己的头像(用于排班管理)")
     @GetMapping("/volunteerPicture")
     public List<String> getVolunteerPicture(){
         return volunteerInfoService.getVolunteerPicture(SecurityUtils.getUserId());

+ 6 - 4
leromro-core/src/main/java/com/leromro/core/controller/volunteerOrderController.java

@@ -82,10 +82,12 @@ public class volunteerOrderController extends BaseController {
         if (secondOrder.getServiceStartLongitude().isEmpty() && secondOrder.getServiceStartLatitude().isEmpty()){
             throw new RuntimeException("获取您当前位置失败,请保持网络通畅并且打开位置权限后重新开始订单");
         }else {
-             v = GeoUtils.calculateDistance( Double.parseDouble(secondOrder.getServiceStartLongitude()),
-                     Double.parseDouble(secondOrder.getServiceStartLatitude()),
-                     Double.parseDouble(secondOrder1.getLongitude()),
-                     Double.parseDouble(secondOrder1.getLatitude()));
+            double v1 = Double.parseDouble(secondOrder.getServiceStartLatitude());
+            v = GeoUtils.calculateDistance(
+                   v1,
+                     Double.parseDouble(secondOrder.getServiceStartLongitude()),
+                     Double.parseDouble(secondOrder1.getLatitude()),
+                     Double.parseDouble(secondOrder1.getLongitude()));
         }
         updateWrapper.eq("second_order_id",secondOrder.getSecondOrderId()).set("order_status","3").set("update_time", DateTimeUtil.getNowTime())
                 .set("service_start_time",DateTimeUtil.getNowTime()).set("start_service_distance",v).set("service_start_longitude",secondOrder.getServiceStartLongitude()).set("service_start_latitude",secondOrder.getServiceStartLatitude());

+ 3 - 1
leromro-core/src/main/java/com/leromro/core/domain/VolunteerInfo.java

@@ -21,6 +21,8 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * <p>
  * 志愿者信息表
@@ -46,7 +48,7 @@ public class VolunteerInfo extends BaseEntity {
 
     @ApiModelProperty(value = "用户id")
     private Long volunteerId;
-
+    @NotNull(message = "志愿者姓名不能为空")
     @ApiModelProperty(value = "志愿者姓名")
     private String name;
 

+ 134 - 2
leromro-core/src/main/java/com/leromro/core/domain/dto/VolunteerInfoDTO.java

@@ -1,20 +1,152 @@
 package com.leromro.core.domain.dto;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.leromro.core.domain.VolunteerInfo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
 import java.time.LocalDate;
 
 @Data
-@EqualsAndHashCode(callSuper = true)
-public class VolunteerInfoDTO extends VolunteerInfo {
+@EqualsAndHashCode
+public class VolunteerInfoDTO  {
 
     @ApiModelProperty(value = "验证码")
     private String code;
 
     @ApiModelProperty(value = "服务中心id")
     private Long serviceCenterId;
+
+    @ApiModelProperty(value = "主键id")
+    @TableId(value = "volunteer_info_id", type = IdType.AUTO)
+    private Long volunteerInfoId;
+
+    @ApiModelProperty(value = "用户id")
+    private Long volunteerId;
+
+    @NotNull(message = "志愿者姓名不能为空")
+    @ApiModelProperty(value = "志愿者姓名")
+    private String name;
+
+    //    @Sensitive(desensitizedType = DesensitizedType.ID_CARD)
+    @ApiModelProperty(value = "身份证号")
+    private String idCard;
+
+    @NotNull(message = "志愿者姓名不能为空")
+    @ApiModelProperty(value = "身份证人像面照片")
+    private String idCardPictureFront;
+
+    @NotNull(message = "志愿者姓名不能为空")
+    @ApiModelProperty(value = "身份证国徽面照片")
+    private String idCardPictureBack;
+
+    @ApiModelProperty(value = "评分")
+    private Double score;
+
+    @ApiModelProperty(value = "大类别")
+    private Long serviceCategory;
+
+
+    @ApiModelProperty(value = "技能描述")
+    private String skillDescribe;
+
+
+    @NotNull(message = "志愿者姓名不能为空")
+    @ApiModelProperty(value = "联系电话")
+    private String phonenumber;
+
+
+    @NotNull(message = "志愿者性别不能为空")
+    @ApiModelProperty(value = "性别 0女 1男")
+    private Integer sex;
+
+    @ApiModelProperty(value = "年龄")
+    private Integer age;
+
+    @ApiModelProperty(value = "状态 0 不接单  1 正在接单")
+    private Integer status;
+
+    @ApiModelProperty(value = "证书图片")
+    private String certificationPicture;
+
+    @ApiModelProperty(value = "志愿者照片")
+    private String volunteerPicture;
+
+
+    @ApiModelProperty(value = "地区")
+    private String city;
+
+    @ApiModelProperty(value = "详细地址")
+    private String address;
+
+    @ApiModelProperty(value = "业务id")
+    private Long businessManagementId;
+
+    @ApiModelProperty(value = "审批状态 1待审批2已通过3已驳回")
+    private String appStatus;
+
+    @ApiModelProperty(value = "驳回原因")
+    private String rejectReason;
+
+    @TableField("project_name")
+    @ApiModelProperty("服务项目名称")
+    private String projectName;
+
+    @TableField("project_type_name")
+    @ApiModelProperty("项目类别名称")
+    private String  projectTypeName;
+
+    @ApiModelProperty("科目名称")
+    private String serviceSubjectName;
+
+    @ApiModelProperty("业务层级名称")
+    private String businessTierName;
+
+    @ApiModelProperty("业务价格")
+    private BigDecimal businessPrice;
+
+    @ApiModelProperty("业务时长(整数分钟)")
+    private Integer businessDuration;
+
+    @TableField("min_quantity")
+    @ApiModelProperty("最少购买数量")
+    private Long minQuantity;
+
+    @TableField("business_unit")
+    @ApiModelProperty("购买单位")
+    private String  businessUnit;
+
+    @TableField("business_describe")
+    @ApiModelProperty("服务描述")
+    private String businessDescribe;
+
+    @TableField("province_code")
+    @ApiModelProperty("省级区划编号")
+    private String provinceCode;
+
+    @TableField("province_name")
+    @ApiModelProperty("省级名称")
+    private String provinceName;
+
+    @TableField("city_code")
+    @ApiModelProperty("市级编号")
+    private String cityCode;
+
+    @TableField("city_name")
+    @ApiModelProperty("市级名称")
+    private String cityName;
+
+    @TableField("district_code")
+    @ApiModelProperty("区级区划编号")
+    private String districtCode;
+
+    @TableField("district_name")
+    @ApiModelProperty("区级名称")
+    private String districtName;
 }

+ 6 - 1
leromro-core/src/main/java/com/leromro/core/service/impl/SecondOrdersServiceImpl.java

@@ -86,7 +86,12 @@ public class SecondOrdersServiceImpl extends ServiceImpl<SecondOrdersMapper, Sec
             throw new RuntimeException("订单已完成,请勿重复完成");
         }
         //计算订单结束时候的距离
-        double v = GeoUtils.calculateDistance(Double.parseDouble(secondOrderInfo.getLongitude()), Double.parseDouble(secondOrderInfo.getLatitude()), Double.parseDouble(secondOrder.getServiceFinishLongitude()), Double.parseDouble(secondOrder.getServiceFinishLatitude()));
+        double v1 = Double.parseDouble(secondOrderInfo.getLatitude());
+        double v = GeoUtils.calculateDistance(
+                v1,
+                Double.parseDouble(secondOrderInfo.getLongitude()),
+                Double.parseDouble(secondOrder.getServiceFinishLatitude()),
+                Double.parseDouble(secondOrder.getServiceFinishLongitude()));
         UpdateWrapper<SecondOrder> updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("second_order_id",secondOrder.getSecondOrderId()).set("order_status",4)
                 .set("volunteer_review",secondOrder.getVolunteerReview()).set("volunteer_picture",secondOrder.getVolunteerPicture())

+ 7 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerInfoServiceImpl.java

@@ -81,6 +81,12 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
      */
     @Override
     public void newVolunteerInfoByuserId(VolunteerInfoDTO dto, Long serviceCategory) {
+        if (dto.getBusinessDuration()==null||dto.getBusinessDuration()<=0){
+            throw new RuntimeException("服务时长不能为空或者为“0”!");
+        }
+        if (dto.getMinQuantity()==null||dto.getMinQuantity()==0){
+            throw new RuntimeException("设置的最少购买数量不能小于0!");
+        }
         VolunteerInfo volunteerInfo = BeanUtil.copyProperties(dto, VolunteerInfo.class);
         Long userId = SecurityUtils.getUserId();
         //查询业务管理信息
@@ -159,6 +165,7 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
         List<VolunteerInfo> infos = volunteerInfoMapper.webList(new ListPermission(VolunteerInfo.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT),dto);
         return infos;
     }
+
     /**     小程序用户志愿者列表
      * @param volunteerInfo
      * @return