Browse Source

订单以及算出金额

LiRong 4 days ago
parent
commit
24a0fa13bc
24 changed files with 464 additions and 99 deletions
  1. 1 1
      leromro-common/src/main/java/com/leromro/common/utils/GeoUtils.java
  2. 3 1
      leromro-core/src/main/java/com/leromro/core/controller/OrdersController.java
  3. 1 0
      leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java
  4. 21 1
      leromro-core/src/main/java/com/leromro/core/controller/volunteerOrderController.java
  5. 12 0
      leromro-core/src/main/java/com/leromro/core/domain/MainOrders.java
  6. 3 0
      leromro-core/src/main/java/com/leromro/core/domain/OrderRefund.java
  7. 171 0
      leromro-core/src/main/java/com/leromro/core/domain/SecondOrder.java
  8. 12 0
      leromro-core/src/main/java/com/leromro/core/domain/VolunteerInfo.java
  9. 1 1
      leromro-core/src/main/java/com/leromro/core/domain/vo/SettlementOrderListVO.java
  10. 11 0
      leromro-core/src/main/java/com/leromro/core/domain/vo/VolunteerInfoDetailVO.java
  11. 59 0
      leromro-core/src/main/java/com/leromro/core/handler/ListDoubleArrayTypeHandler.java
  12. 0 2
      leromro-core/src/main/java/com/leromro/core/mapper/VolunteerInfoMapper.java
  13. 1 1
      leromro-core/src/main/java/com/leromro/core/service/IMainOrderService.java
  14. 75 13
      leromro-core/src/main/java/com/leromro/core/service/impl/MainOrderServiceImpl.java
  15. 5 4
      leromro-core/src/main/java/com/leromro/core/service/impl/OrderRefundServiceImpl.java
  16. 2 2
      leromro-core/src/main/java/com/leromro/core/service/impl/SecondOrdersServiceImpl.java
  17. 3 1
      leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerInfoServiceImpl.java
  18. 35 13
      leromro-core/src/main/java/com/leromro/core/ttl/Monitor.java
  19. 24 0
      leromro-core/src/main/java/com/leromro/core/utils/JsonParser.java
  20. 4 4
      leromro-core/src/main/resources/mapper/core/MainOrdersMapper.xml
  21. 1 0
      leromro-core/src/main/resources/mapper/core/OrderRefundMapper.xml
  22. 6 1
      leromro-core/src/main/resources/mapper/core/SecondOrdersMapper.xml
  23. 9 54
      leromro-core/src/main/resources/mapper/core/VolunteerInfoMapper.xml
  24. 4 0
      leromro-system/src/main/java/com/leromro/system/service/ISysDeptService.java

+ 1 - 1
leromro-common/src/main/java/com/leromro/common/utils/GeoUtils.java

@@ -46,7 +46,7 @@ public class GeoUtils {
      *
      * @param pointLat 点纬度
      * @param pointLon 点经度
-     * @param polygon 多边形顶点列表(格式为 [lat1, lon1, lat2, lon2, ...])
+     * @param polygon 多边形顶点列表(格式为 [lat1, lon1, lat2, lon2, ...]) ????应该是:[[lat1, lon1],[lat2, lon2]] 吧
      * @return 是否在多边形内
      */
     public static boolean isInsidePolygon(double pointLat, double pointLon, List<double[]> polygon) {

+ 3 - 1
leromro-core/src/main/java/com/leromro/core/controller/OrdersController.java

@@ -114,7 +114,7 @@ public class OrdersController extends BaseController {
     @ApiOperation("用户创建订单")
     @Log(title = "创建订单", businessType = BusinessType.INSERT)
     @PostMapping("/createOrder")
-    public R<OrderPaymentVO> createOrder(@RequestBody OrderRequestDTO orderRequest) {
+    public R<OrderPaymentVO> createOrder(@RequestBody OrderRequestDTO orderRequest) throws Exception {
 
         return mainOrderService.createOrders(orderRequest);
     }
@@ -239,4 +239,6 @@ public class OrdersController extends BaseController {
         mainOrderService.serviceCentreSettlement(settlementOrderDTO);
         return R.ok();
     }
+
+
 }

+ 1 - 0
leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java

@@ -35,6 +35,7 @@ import java.util.List;
 public class VolunteerInfoController extends BaseController {
     @Autowired
     private IVolunteerInfoService volunteerInfoService;
+
     /**
      * 新增志愿者信息
      * 已测试

+ 21 - 1
leromro-core/src/main/java/com/leromro/core/controller/volunteerOrderController.java

@@ -2,6 +2,7 @@ package com.leromro.core.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.leromro.common.core.controller.BaseController;
 import com.leromro.common.core.domain.AjaxResult;
@@ -10,12 +11,14 @@ import com.leromro.common.core.page.TableDataInfo;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.Address;
 import com.leromro.core.domain.MainOrders;
+import com.leromro.core.domain.PlatformFinance;
 import com.leromro.core.domain.SecondOrder;
 import com.leromro.core.domain.vo.SecondOrderInfoVO;
 import com.leromro.core.domain.vo.VolunteerOrderStatisticsVO;
 import com.leromro.core.domain.vo.VolunteerOrdersVO;
 import com.leromro.core.service.IAddressService;
 import com.leromro.core.service.IMainOrderService;
+import com.leromro.core.service.IPlatformFinanceService;
 import com.leromro.core.service.ISecondOrderService;
 import com.leromro.core.utils.DateTimeUtil;
 import io.swagger.annotations.Api;
@@ -42,13 +45,16 @@ public class volunteerOrderController extends BaseController {
     private IAddressService addressService;
     @Autowired
     private IMainOrderService mainOrderService;
+    @Autowired
+    private IPlatformFinanceService platformFinanceService;
+
     @ApiOperation("志愿者查询小订单列表")
     @GetMapping("/volunteerOrderList")
     public TableDataInfo<VolunteerOrdersVO> selectVolunteerList(Long orderStatus) {
         startPage();
         Long userId = SecurityUtils.getUserId();
         List<VolunteerOrdersVO> list = secondOrderService.selectOrderList(userId, orderStatus);
-        list.forEach(volunteerOrdersVO -> volunteerOrdersVO.setServiceOnePrice(volunteerOrdersVO.getServiceOnePrice().multiply(new BigDecimal("0.85"))));
+        list.forEach(volunteerOrdersVO -> volunteerOrdersVO.setServiceOnePrice(volunteerOrdersVO.getServiceOnePrice().multiply(BigDecimal.valueOf(volunteerOrdersVO.getSingleQuantity())).multiply(new BigDecimal("0.85"))));
         return getDataTable(list);
     }
 
@@ -109,4 +115,18 @@ public class volunteerOrderController extends BaseController {
         return R.ok(vo);
     }
 
+    /**
+     * 分配订单到服务中心,并且在分配后就直接计算金额,
+     */
+    @ApiOperation("分配订单到服务中心,并且直接算出服务中心的抽成金额 传入分配到的服务中心的id 和小订单的id")
+    @PostMapping("allotSCandAmount")
+    public R allotSeconderToServiceCenterAndGetAmount(@RequestBody SecondOrder secondOrder){
+        SecondOrder secondOrder1 = secondOrderService.getById(secondOrder.getSecondOrderId());
+        PlatformFinance platformFinance = platformFinanceService.getOne(new LambdaQueryWrapper<PlatformFinance>().eq(PlatformFinance::getSecondOrderId, secondOrder.getSecondOrderId()));
+        BigDecimal ServiceCentreDistributionAmount = secondOrder1.getServiceCentreDistributionRatio().multiply(platformFinance.getChangeMoney());
+        return R.ok( secondOrderService.update(new LambdaUpdateWrapper<SecondOrder>().eq(SecondOrder::getSecondOrderId, secondOrder.getSecondOrderId()).set(SecondOrder::getServiceCentreDistributionAmount, ServiceCentreDistributionAmount)
+                .set(SecondOrder::getAllotStatus,"20").set(SecondOrder::getServiceCenterId,secondOrder.getServiceCenterId()).set(SecondOrder::getUpdateTime,DateTimeUtil.getNowTime()))
+        );
+    }
+
 }

+ 12 - 0
leromro-core/src/main/java/com/leromro/core/domain/MainOrders.java

@@ -203,6 +203,18 @@ public class MainOrders extends BaseEntity
     @ApiModelProperty("区域抽成金额(元)")
     private BigDecimal areaDistributionAmount;
 
+    /**
+     * 区域抽成金额(元)
+     */
+    @ApiModelProperty("分配状态:10 未分配到服务中心   20已分配到服务中心   30匹配到多个服务中心")
+    private String allotStatus;
+
+    /**
+     * 区域抽成金额(元)
+     */
+    @ApiModelProperty("订单所属的服务中心id")
+    private Long deptId;
+
     /**
      * 区域结算状态 10未结算 20审核中 30审核未通过 40打款中 50已结算
      */

+ 3 - 0
leromro-core/src/main/java/com/leromro/core/domain/OrderRefund.java

@@ -41,18 +41,21 @@ public class OrderRefund extends BaseEntity {
     @TableField("main_order_id")
     @ApiModelProperty("主订单号")
     private Long mainOrderId;
+
     /**
      * 主订单号
      */
     @TableField("user_id")
     @ApiModelProperty("用户id")
     private Long userId;
+
     /**
      * 主订单号
      */
     @TableField("volunteer_id")
     @ApiModelProperty("志愿者id")
     private Long volunteerId;
+
     /**
      * 申请的退款金额
      */

+ 171 - 0
leromro-core/src/main/java/com/leromro/core/domain/SecondOrder.java

@@ -61,6 +61,19 @@ public class SecondOrder extends BaseEntity
     @ApiModelProperty("订单状态 0待支付 1已支付 2支付超时或取消 3进行中 4已完成 5申请退款中 6已退款 7部分退款  ")
     private String orderStatus;
 
+    @Excel(name = "志愿者结算状态10 未结算 20已结算")
+    @ApiModelProperty("志愿者结算状态: 10 未结算 20已结算")
+    private String volunteerSettlementStatus;
+
+    /** 区域公司id */
+    @Excel(name = "区域公司id")
+    @ApiModelProperty("区域公司id")
+    private Long areaDistributionId;
+
+    /** 服务中心id */
+    @Excel(name = "服务中心id")
+    @ApiModelProperty("服务中心id")
+    private Long serviceCenterId;
 
     /** 大类别 */
     @Excel(name = "大类别")
@@ -185,4 +198,162 @@ public class SecondOrder extends BaseEntity
     private String outTradeNo;
 
 
+
+    /**
+     * 区域抽成比例,如0.7
+     */
+    @ApiModelProperty("区域抽成比例")
+    private BigDecimal areaDistributionRatio;
+
+    /**
+     * 区域抽成金额(元)
+     */
+    @ApiModelProperty("区域抽成金额(元)")
+    private BigDecimal areaDistributionAmount;
+
+    /**
+     * 区域抽成金额(元)
+     */
+    @ApiModelProperty("分配状态:10 未分配到服务中心   20已分配到服务中心   30匹配到多个服务中心")
+    private String allotStatus;
+
+    /**
+     * 区域抽成金额(元)
+     */
+/*    @ApiModelProperty("订单所属的服务中心id")
+    private Long deptId;*/
+
+    /**
+     * 区域结算状态 10未结算 20审核中 30审核未通过 40打款中 50已结算
+     */
+    @ApiModelProperty("区域结算状态 10未结算 20审核中 30审核未通过 40打款中 50已结算")
+    private Integer areaSettlementStatus;
+
+    /**
+     * 区域结算时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty("区域结算时间")
+    private Date areaSettlementTime;
+
+    /**
+     * 区域管理结算操作用户id
+     */
+    @ApiModelProperty("区域管理结算操作用户id")
+    private Long areaSettlementUserId;
+
+    /**
+     * 区域管理费用付款方式 1银行卡
+     */
+    @ApiModelProperty("区域管理费用付款方式 1银行卡")
+    private Integer areaPayerMethod;
+
+    /**
+     * 区域管理费用付款账户
+     */
+    @ApiModelProperty("区域管理费用付款账户")
+    private String areaPayerAccount;
+
+    /**
+     * 区域管理费用付款银行名称
+     */
+    @ApiModelProperty("区域管理费用付款银行名称")
+    private String areaPayerAccountBankName;
+
+    /**
+     * 区域收款方式 1银行卡
+     */
+    @ApiModelProperty("区域收款方式 1银行卡")
+    private Integer areaPayeeMethod;
+
+    /**
+     * 区域收款账号
+     */
+    @ApiModelProperty("区域收款账号")
+    private String areaPayeeAccount;
+
+    /**
+     * 区域收款银行名称
+     */
+    @ApiModelProperty("区域收款银行名称")
+    private String areaPayeeBankName;
+
+    /**
+     * 区域收款人姓名
+     */
+    @ApiModelProperty("区域收款人姓名")
+    private String areaPayeeName;
+
+    /**
+     * 服务中心抽成比例
+     */
+    @ApiModelProperty("服务中心抽成比例")
+    private BigDecimal serviceCentreDistributionRatio;
+
+    /**
+     * 服务中心抽成金额(元)
+     */
+    @ApiModelProperty("服务中心抽成金额(元)")
+    private BigDecimal serviceCentreDistributionAmount;
+
+    /**
+     * 服务中心费用结算状态 10未结算 20审核中 30审核未通过 40打款中 50已结算
+     */
+    @ApiModelProperty("服务中心费用结算状态 10未结算 20审核中 30审核未通过 40打款中 50已结算")
+    private Integer serviceCentreSettlementStatus;
+
+    /**
+     * 服务中心费用结算时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty("服务中心费用结算时间")
+    private Date serviceCentreSettlementTime;
+
+    /**
+     * 服务中心结算操作用户id
+     */
+    @ApiModelProperty("服务中心结算操作用户id")
+    private Long serviceCentreSettlementUserId;
+
+    /**
+     * 服务中心费用付款方式 1银行卡
+     */
+    @ApiModelProperty("服务中心费用付款方式 1银行卡")
+    private Integer serviceCentrePayerMethod;
+
+    /**
+     * 服务中心费用付款账户
+     */
+    @ApiModelProperty("服务中心费用付款账户")
+    private String serviceCentrePayerAccount;
+
+    /**
+     * 服务中心费用付款银行名称
+     */
+    @ApiModelProperty("服务中心费用付款银行名称")
+    private String serviceCentrePayerBankName;
+
+    /**
+     * 服务中心收款方式 1银行卡
+     */
+    @ApiModelProperty("服务中心收款方式 1银行卡")
+    private Integer serviceCentrePayeeMethod;
+
+    /**
+     * 服务中心收款账号
+     */
+    @ApiModelProperty("服务中心收款账号")
+    private String serviceCentrePayeeAccount;
+
+    /**
+     * 服务中心收款银行名称
+     */
+    @ApiModelProperty("服务中心收款银行名称")
+    private String serviceCentrePayeeBankName;
+
+    /**
+     * 服务中心收款人姓名
+     */
+    @ApiModelProperty("服务中心收款人姓名")
+    private String serviceCentrePayeeName;
 }

+ 12 - 0
leromro-core/src/main/java/com/leromro/core/domain/VolunteerInfo.java

@@ -122,6 +122,18 @@ public class VolunteerInfo extends BaseEntity {
     @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;

+ 1 - 1
leromro-core/src/main/java/com/leromro/core/domain/vo/SettlementOrderListVO.java

@@ -17,7 +17,7 @@ public class SettlementOrderListVO {
     private Long mainOrderId;
 
     @ApiModelProperty("订单号")
-    private Long outTradeNo;
+    private String outTradeNo;
 
     @ApiModelProperty("单价")
     private BigDecimal serviceOnePrice;

+ 11 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/VolunteerInfoDetailVO.java

@@ -99,4 +99,15 @@ public class VolunteerInfoDetailVO {
 
     @ApiModelProperty("业务层级名称")
     private String businessTierName;
+
+    @ApiModelProperty("商品单位")
+    private String businessUnit;
+
+    @ApiModelProperty("服务描述")
+    private String businessDescribe;
+
+    @ApiModelProperty("最少购买数量")
+    private String minQuantity;
+
+
 }

+ 59 - 0
leromro-core/src/main/java/com/leromro/core/handler/ListDoubleArrayTypeHandler.java

@@ -0,0 +1,59 @@
+package com.leromro.core.handler;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.ibatis.type.BaseTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+public class ListDoubleArrayTypeHandler extends BaseTypeHandler<List<double[]>> {
+
+    private static final ObjectMapper objectMapper = new ObjectMapper();
+
+    @Override
+    public void setNonNullParameter(PreparedStatement ps, int i, List<double[]> parameter, JdbcType jdbcType) throws SQLException {
+        try {
+            String json = objectMapper.writeValueAsString(parameter);
+            ps.setString(i, json);
+        } catch (Exception e) {
+            throw new SQLException("Failed to convert List<double[]> to JSON", e);
+        }
+    }
+
+    @Override
+    public List<double[]> getNullableResult(ResultSet rs, String columnName) throws SQLException {
+        String json = rs.getString(columnName);
+        if (json == null) return null;
+        try {
+            return objectMapper.readValue(json, new TypeReference<List<double[]>>() {});
+        } catch (Exception e) {
+            throw new SQLException("Failed to parse JSON to List<double[]>", e);
+        }
+    }
+
+    @Override
+    public List<double[]> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
+        String json = rs.getString(columnIndex);
+        if (json == null) return null;
+        try {
+            return objectMapper.readValue(json, new TypeReference<List<double[]>>() {});
+        } catch (Exception e) {
+            throw new SQLException("Failed to parse JSON to List<double[]>", e);
+        }
+    }
+
+    @Override
+    public List<double[]> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
+        String json = cs.getString(columnIndex);
+        if (json == null) return null;
+        try {
+            return objectMapper.readValue(json, new TypeReference<List<double[]>>() {});
+        } catch (Exception e) {
+            throw new SQLException("Failed to parse JSON to List<double[]>", e);
+        }
+    }
+}

+ 0 - 2
leromro-core/src/main/java/com/leromro/core/mapper/VolunteerInfoMapper.java

@@ -20,13 +20,11 @@ import java.util.List;
  */
 public interface VolunteerInfoMapper extends BaseMapper<VolunteerInfo> {
 
-    void newVolunteerByUserId(VolunteerInfo volunteerInfo);
 
     List<VolunteerInfo> webList(VolunteerInfoDTO dto);
 
     List<VolunteerInfoVO> selectVolunteerInfoSimple(ListPermission listPermission,@Param("info") VolunteerInfo volunteerInfo);
 
-    VolunteerInfo selectLVolunteerInfoByVolunteerId(@Param("volunteerId") Long volunteerId,@Param("serviceCategory") Long serviceCategory);
 
 
     List<VolunteerInfo> getCurrentOrgVolunteerList(ListPermission listPermission,@Param("dto") HomePageDTO dto);

+ 1 - 1
leromro-core/src/main/java/com/leromro/core/service/IMainOrderService.java

@@ -14,7 +14,7 @@ import java.util.List;
 public interface IMainOrderService extends IService<MainOrders> {
     List<MainOrdersVO> selectByUserId(String[] orderStatus, Long userId);
 
-    R<OrderPaymentVO> createOrders(OrderRequestDTO orderRequest);
+    R<OrderPaymentVO> createOrders(OrderRequestDTO orderRequest) throws Exception;
 
 
     List<webMainOrderListVO> webMainOrderList(MainOrdersVO mainOrdersVO);

+ 75 - 13
leromro-core/src/main/java/com/leromro/core/service/impl/MainOrderServiceImpl.java

@@ -8,10 +8,12 @@ import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
 import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.leromro.common.core.domain.R;
+import com.leromro.common.core.domain.entity.SysDept;
 import com.leromro.common.core.domain.entity.SysUser;
 import com.leromro.common.enums.AreaSettlementStatusEnum;
 import com.leromro.common.enums.ServiceCentreSettlementStatusEnum;
 import com.leromro.common.exception.ServiceException;
+import com.leromro.common.utils.GeoUtils;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.*;
 import com.leromro.core.domain.dto.OrderRequestDTO;
@@ -24,6 +26,7 @@ import com.leromro.core.service.IMainOrderService;
 import com.leromro.core.service.IOrderSettlementApplicationService;
 import com.leromro.core.utils.BigDecimalUtil;
 import com.leromro.core.utils.DateTimeUtil;
+import com.leromro.core.utils.JsonParser;
 import com.leromro.core.utils.NoUtil;
 import com.leromro.system.mapper.SysDeptMapper;
 import lombok.extern.slf4j.Slf4j;
@@ -37,10 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.time.Duration;
 import java.time.LocalTime;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -78,6 +78,9 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
     @Autowired
     private SysDeptMapper sysDeptMapper;
 
+    @Autowired
+    private DeptRegionManagementMapper deptRegionManagementMapper;
+
     /**
      * @param userId
      * @return
@@ -96,12 +99,11 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public R<OrderPaymentVO> createOrders(OrderRequestDTO orderRequest) {
+    public R<OrderPaymentVO> createOrders(OrderRequestDTO orderRequest) throws Exception {
         //响应数据
         OrderPaymentVO vo = new OrderPaymentVO();
         //订单信息
         MainOrders orders = orderRequest.getOrders();
-        List<VolunteerWorkDate> workDateList1 = orderRequest.getWorkDateList();
         //由于前端传过来的不是有序的,所以我们要将工作时间进行排序
         List<VolunteerWorkDate> workDateList = orderRequest.getWorkDateList()
                 .stream()
@@ -123,7 +125,9 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
         BigDecimal serviceOnePrice = info.getBusinessPrice();
         Integer businessDurationMin = info.getBusinessDuration();
         Long totalTimes = orders.getTotalTimes();
-        BigDecimal totalPrice = serviceOnePrice.multiply(BigDecimal.valueOf(totalTimes));
+        Long singleQuantity = orders.getSingleQuantity();
+        //总价 = 服务单词价格*服务次数*单词服务数量
+        BigDecimal totalPrice = serviceOnePrice.multiply(BigDecimal.valueOf(totalTimes)).multiply(BigDecimal.valueOf(singleQuantity));
         orders.setServiceTotalPrice(totalPrice);
         // 判断支付方式,余额扣减余额。 1 余额 2 微信
         String seconderStatus;
@@ -185,6 +189,9 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
         //创建订单主表
         //把地址信息也添加到数据里面
         Address address = addressMapper.selectAddressByAddressId(orders.getAddressId());
+
+
+
         //地址拼接信息+经纬度
         String OrderAddress = String.join("",
                 Objects.toString(address.getProvinceName(), ""),
@@ -222,15 +229,67 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
         List<VolunteerReservationTime> reservationTimes = new ArrayList<>();
 
         //创建小订单模板
-        //
-        SecondOrder secondOrder = SecondOrder.builder().mainOrderId(orderId).volunteerId(orders.getVolunteerId()).
-                serviceCategory(orders.getServiceCategory()).serviceDuration(orders.getServiceDuration()).addressId(orders.getAddressId())
+        SecondOrder secondOrder = SecondOrder.builder().mainOrderId(orderId).volunteerId(orders.getVolunteerId()).singleQuantity(singleQuantity)
+                .serviceCategory(orders.getServiceCategory()).serviceDuration(orders.getServiceDuration()).addressId(orders.getAddressId())
                 .serviceOnePrice(orders.getServiceOnePrice()).volunteerInfoId(orders.getVolunteerInfoId()).orderStatus(seconderStatus)
                 .provinceCode(address.getProvinceCode()).cityCode(address.getCityCode()).districtCode(address.getDistrictCode())
                 .provinceName(address.getProvinceName()).cityName(address.getCityName()).districtName(address.getDistrictName())
                 .outTradeNo(orderNo)
                 .build();
         secondOrder.setRemark(orders.getRemark());
+        //根据下单的收货地址,来设置分账比例 先查这个订单是否在电子围栏中
+        //找到所有的部门的数据,然后把所有的数据遍历,并且统计出来
+        //用的是新版的部门区域  但是获取分账比例还是从老的中获取
+       /* List<DeptRegionManagement> deptRegionManagements = deptRegionManagementMapper.selectList(new LambdaQueryWrapper<DeptRegionManagement>().eq(DeptRegionManagement::getDelFlag, 2));
+        List<Long> deptIdsList = deptRegionManagements.stream().map(DeptRegionManagement::getDeptId).collect(Collectors.toList());*/
+
+        List<SysDept> sysDepts = sysDeptMapper.getAlldept();
+
+        List<Long> deptIdList = new ArrayList<>();
+        /*for (DeptRegionManagement deptRegionManagement : deptRegionManagements) {}*/
+        for (SysDept sysDept : sysDepts) {
+            //判断 服务中心分成比例
+            //真的
+            String pointList = sysDept.getPointList();
+            boolean insidePolygon ;
+            if (pointList != null){
+                List<double[]> doubles = JsonParser.parseCoordinates(pointList);
+                 insidePolygon = GeoUtils.isInsidePolygon(Double.parseDouble(address.getLatitude()) , Double.parseDouble(address.getLongitude()), doubles);
+            }else {
+                insidePolygon = false;
+            }
+            if (insidePolygon){
+                //如果是true  将这个地址的区域id添加到集合中
+                deptIdList.add(sysDept.getDeptId());
+            }//如果false 则什么都不变
+            //区域公司的分成比例 因为没有区域公司,也不会有志愿者,所以这个区域公司一定会匹配上的
+            if (sysDept.getDistrictCode()== null){
+                break;
+            }
+            if (sysDept.getDistrictCode().equals(address.getDistrictCode())){
+                secondOrder.setAreaDistributionRatio(sysDept.getDistributionRatio());
+                secondOrder.setAreaDistributionId(sysDept.getDeptId());
+            }else {
+                throw new RuntimeException("当前地区缺少管理,请联系管理员");
+            }
+        }
+
+        //根据匹配数量,修改数值
+        if (deptIdList.size()==1){
+            //已分配到服务中心
+            secondOrder.setAllotStatus("20");
+            secondOrder.setServiceCenterId(deptIdList.get(0));
+            //设置服务中心的分成比例
+            sysDepts.forEach(sysDept -> {
+                if (sysDept.getDeptId().equals(deptIdList.get(0))) {
+                    secondOrder.setServiceCentreDistributionRatio(sysDept.getDistributionRatio());
+                }
+            });
+
+        } else {
+            secondOrder.setAllotStatus("10");
+        }
+
         List<SecondOrder> secondOrderList = new ArrayList<>();
 
 
@@ -252,11 +311,14 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
             secondOrder1.setWorkEndTime(workDate.getWorkStartTime().plus(Duration.ofMinutes(orders.getServiceDuration())));
             secondOrder1.setWorkNumber(number);
             secondOrder1.setSecondOrderId(secondOrderIdL);
+
+            orders.setOutTradeNo(orderNo+"-"+number);
             secondOrder1.setOutTradeNo(orderNo);
+
             secondOrderList.add(secondOrder1);
 
             //向志愿者预约时间表中添加数据
-            int parts = businessDurationMin/30;
+            int parts = (int) (businessDurationMin * singleQuantity /30);
             if (businessDurationMin % 30!=0){
                 parts++;
             }
@@ -322,8 +384,8 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
     }
 
     public void changePlatformFinance ( List<Long> seconderIdList,MainOrders orders){
-        //创建平台流水模板
-        PlatformFinance platformFinance =  PlatformFinance.builder().changeMoney(orders.getServiceOnePrice()).changeType(1).moneyType(1)
+        //创建平台流水模板  按照小订单,单价*件数 = 小订单价格 = 一条平台流水变动
+        PlatformFinance platformFinance =  PlatformFinance.builder().changeMoney(orders.getServiceOnePrice().multiply(BigDecimal.valueOf(orders.getSingleQuantity()))).changeType(1).moneyType(1)
                 .sourceType(1).volunteerId(orders.getVolunteerId()).build();
         platformFinance.setCreateTime(DateTimeUtil.getNowTime());
         List<PlatformFinance> platformFinanceList = new ArrayList<>();

+ 5 - 4
leromro-core/src/main/java/com/leromro/core/service/impl/OrderRefundServiceImpl.java

@@ -172,7 +172,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
         } else if (mainOrders.getOrderStatus().equals("3")) {
             //订单已开始或者订单已完成
             orderRefund.setStatus("0");
-            orderRefund.setRefundAmount(mainOrders.getServiceOnePrice().multiply(new BigDecimal(mainOrders.getTotalTimes() - mainOrders.getFinishTimes())));
+            orderRefund.setRefundAmount(mainOrders.getServiceOnePrice().multiply(BigDecimal.valueOf(mainOrders.getSingleQuantity())).multiply(new BigDecimal(mainOrders.getTotalTimes() - mainOrders.getFinishTimes())));
             this.save(orderRefund);
             UpdateWrapper<MainOrders> mainOrderUpdateWrapper = new UpdateWrapper<MainOrders>().eq("main_order_id", mainOrderId).set("order_status", "5");
             mainOrdersMapper.update(null, mainOrderUpdateWrapper);
@@ -233,8 +233,9 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
     @Override
     public OrderRefundVO selectOrderRefundByMainOrderId(Long mainOrderId) {
         //根据mainID 取出
+        MainOrders mainOrder = mainOrdersMapper.selectOne(new LambdaQueryWrapper<MainOrders>().eq(MainOrders::getMainOrderId, mainOrderId));
         OrderRefundVO refundVO = lOrderRefundMapper.selectOrderRefundInfoByMainOrderId(mainOrderId);
-        refundVO.setRefundAmount(refundVO.getServiceOnePrice().multiply(new BigDecimal(refundVO.getTotalTimes() - refundVO.getFinishTimes())));
+        refundVO.setRefundAmount(refundVO.getServiceOnePrice().multiply(BigDecimal.valueOf(mainOrder.getSingleQuantity())).multiply(new BigDecimal(refundVO.getTotalTimes() - refundVO.getFinishTimes())));
 
         QueryWrapper<SecondOrder> secondOrderQueryWrapper = new QueryWrapper<SecondOrder>().eq("main_order_id", mainOrderId).eq("order_status", "1");
         List<SecondOrder> secondOrderList = secondOrdersMapper.selectList(secondOrderQueryWrapper);
@@ -357,7 +358,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
         VolunteerReservationTime reservationTime =VolunteerReservationTime.builder().volunteerId(mainOrders.getVolunteerId()).clientId(mainOrders.getUserId()).build();
         List<VolunteerReservationTime> reservationTimes = new ArrayList<>();
         for (SecondOrder secondOrder : secondOrderList) {
-            int parts = secondOrder.getServiceDuration()/30;
+            int parts = (int) (secondOrder.getServiceDuration() * mainOrders.getSingleQuantity() /30);
             if (secondOrder.getServiceDuration() % 30 != 0){
                 parts++;
             }
@@ -404,7 +405,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
         List<PlatformFinance> platformFinanceList = secondOrderList.stream().map(secondOrder -> {
             new PlatformFinance();
             return PlatformFinance.builder()
-                    .changeMoney(secondOrder.getServiceOnePrice()).changeType(changeType).moneyType(moneyType).sourceType(sourceType).secondOrderId(secondOrder.getSecondOrderId()).volunteerId(secondOrder.getVolunteerId())
+                    .changeMoney(secondOrder.getServiceOnePrice().multiply(BigDecimal.valueOf(secondOrder.getSingleQuantity()))).changeType(changeType).moneyType(moneyType).sourceType(sourceType).secondOrderId(secondOrder.getSecondOrderId()).volunteerId(secondOrder.getVolunteerId())
                     .build();
         }).collect(Collectors.toList());
         platformFinanceMapper.insertPlatformFinanceList(platformFinanceList);

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

@@ -60,8 +60,8 @@ public class SecondOrdersServiceImpl extends ServiceImpl<SecondOrdersMapper, Sec
        // SecondOrder secondOrderInfo = secondOrdersMapper.selectById(secondOrderId);
         BigDecimal onePrice = secondOrderInfo.getServiceOnePrice();
         //默认平台佣金以及志愿者到手钱数
-        BigDecimal volunteerMoney = onePrice.multiply(new BigDecimal("0.85"));
-        BigDecimal platformBrokerage = onePrice.subtract(volunteerMoney);
+        BigDecimal volunteerMoney = onePrice.multiply(BigDecimal.valueOf(secondOrderInfo.getSingleQuantity())).multiply(new BigDecimal("0.85"));
+        BigDecimal platformBrokerage = onePrice.multiply(BigDecimal.valueOf(secondOrderInfo.getSingleQuantity())).subtract(volunteerMoney);
         //计算结束冻结时间 默认开始时间+3天
         DateTime frozenStartTime = DateTimeUtil.getNowTime1();
         Date frozenEndTime = DateUtils.addDays(frozenStartTime, 3);

+ 3 - 1
leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerInfoServiceImpl.java

@@ -74,7 +74,9 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
         //把BusinessTierName按照-分割 (后面再改)
         String[] businessTierName = businessManagement.getBusinessTierName().split("-");
         volunteerInfo.setProjectName(businessTierName[0]);
-        volunteerInfo.setProjectTypeName(businessTierName[1]);
+        String s = businessTierName[1];
+
+        volunteerInfo.setProjectTypeName(s);
       /*  switch(Integer.parseInt(String.valueOf(serviceCategory))) {
             case 1:
                 break;

+ 35 - 13
leromro-core/src/main/java/com/leromro/core/ttl/Monitor.java

@@ -7,7 +7,6 @@ import com.leromro.core.domain.*;
 import com.leromro.core.mapper.*;
 import com.leromro.core.utils.DateTimeUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -30,8 +29,6 @@ public class Monitor {
     private VolunteerAccountMapper volunteerAccountMapper;
     @Autowired
     private VolunteerAccountChangeMapper volunteerAccountChangeMapper;
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
 
     /**
      * 定时任务定时调用的任务
@@ -51,13 +48,15 @@ public class Monitor {
         List<Long> seconderOrderIdList = needThawMoneyList.stream().map(OrderFrozenFunds::getSecondOrderId).collect(Collectors.toList());
         List<Long> volunteerIdList = needThawMoneyList.stream().map(OrderFrozenFunds::getVolunteerId).distinct().collect(Collectors.toList());
 
+        //向 有 小订单列表中添加金额,区域公司抽成金额 = 解冻金额中的抽成金额 * 区域公司的抽成比例 服务中心抽成金额 = 解冻金额中的抽成金额 * 服务中心抽成金额的抽成比例
+
+
         //查到旧的志愿者账户表的余额(用来存放志愿者月变更记录)
         //更新表,直接解冻。
         UpdateWrapper<OrderFrozenFunds> updateFrozenWrapper = new UpdateWrapper<OrderFrozenFunds>().in("order_frozen_funds_id", orderFrozenFundsIdList).set("status", 1);
         orderFrozenFundsMapper.update(null, updateFrozenWrapper);
-        //志愿者订单表 2 已完成的订单 更新时间
+        //志愿者订单表  已完成订单 默认评价
         UpdateWrapper<SecondOrder> updateSecondOrderWrapper = new UpdateWrapper<SecondOrder>().eq("order_status", "4").in("second_order_id", seconderOrderIdList).set("score", 1).setSql("remark = CASE WHEN score IS NULL OR score = '' THEN '用户未评价,系统默认一星' ELSE remark END");
-        ;
         secondOrdersMapper.update(null, updateSecondOrderWrapper);
         //解冻后,向平台流水表中添加数据
         // 1.先添加志愿者变更金额
@@ -65,6 +64,26 @@ public class Monitor {
         //platformFinanceMapper.insertPlatformFinanceList(volunteerPlatformList);
         // 2.然后添加平台变更金额
         List<PlatformFinance> platformPlatformList = needThawMoneyList.stream().map(orderFrozenFunds -> new PlatformFinance(null, orderFrozenFunds.getPlatformBrokerage(), 1, 3, 3, orderFrozenFunds.getSecondOrderId(), orderFrozenFunds.getVolunteerId())).collect(Collectors.toList());
+
+        //查出所有已分配服务中心的需要解冻的小订单
+        List<SecondOrder> secondOrderList = secondOrdersMapper.selectList(new LambdaQueryWrapper<SecondOrder>().in(SecondOrder::getSecondOrderId, seconderOrderIdList));
+
+        // 构建map 拿到secondOrderId 和 金额
+        Map<Long, BigDecimal> brokerageMap = platformPlatformList.stream() .collect(Collectors.toMap(PlatformFinance::getSecondOrderId, PlatformFinance::getChangeMoney));
+
+        // 遍历 secondOrderList 更新区域公司的钱并且当平台已分配服务中心时,设置服务中心的分成
+        for (SecondOrder secondOrder : secondOrderList) {
+            BigDecimal platformBrokerage = brokerageMap.get(secondOrder.getSecondOrderId());
+            if (secondOrder.getAllotStatus().equals("20")) {
+                BigDecimal serviceCentreDistributionRatio = secondOrder.getServiceCentreDistributionRatio();
+                BigDecimal distributionAmount1 = platformBrokerage.multiply(serviceCentreDistributionRatio);
+                secondOrder.setServiceCentreDistributionAmount(distributionAmount1);
+            }
+            BigDecimal areaDistributionRatio = secondOrder.getAreaDistributionRatio();
+            BigDecimal distributionAmount2 = platformBrokerage.multiply(areaDistributionRatio);
+            secondOrder.setAreaDistributionAmount(distributionAmount2);
+        }
+
         //platformFinanceMapper.insertPlatformFinanceList(platformPlatformList);
         // 3.然后添加奖金 并且添加备注
         List<PlatformFinance> sourceTypePlatformList = needThawMoneyList.stream().filter(orderFrozenFunds -> orderFrozenFunds.getScoreMoney() != null).map(orderFrozenFunds -> new PlatformFinance(null, orderFrozenFunds.getScoreMoney(), 1, 2, 3, orderFrozenFunds.getSecondOrderId(), orderFrozenFunds.getVolunteerId())).peek(pf -> pf.setRemark("奖金"))
@@ -83,29 +102,32 @@ public class Monitor {
 
 
         //首先将志愿者id和志愿者账户余额封装成map集合
-        Map<Long, List<VolunteerAccount>> volunteerAccountMap = volunteerAccountMapper.selectList(new LambdaQueryWrapper<VolunteerAccount>().in(VolunteerAccount::getVolunteerId,volunteerIdList)).stream().collect(Collectors.groupingBy(VolunteerAccount::getVolunteerId));
+        Map<Long, List<VolunteerAccount>> volunteerAccountMap = volunteerAccountMapper.selectList(new LambdaQueryWrapper<VolunteerAccount>().in(VolunteerAccount::getVolunteerId, volunteerIdList)).stream().collect(Collectors.groupingBy(VolunteerAccount::getVolunteerId));
         //遍历其中一个集合,然后用键来匹配值,进行操作
-        if (volunteerAccountMap.isEmpty()){throw new RuntimeException("志愿者账户异常,该志愿者未创建账户");}
+        if (volunteerAccountMap.isEmpty()) {
+            throw new RuntimeException("志愿者账户异常,该志愿者未创建账户");
+        }
 
         //还是获取map<userId,list<解冻数据>>
         Map<Long, List<OrderFrozenFunds>> volunteerAccountChangeGroupByVId = needThawMoneyList.stream().collect(Collectors.groupingBy(OrderFrozenFunds::getVolunteerId));
         //生成所有的记录
         //List<Object[]> volunteerAccountChanges = new ArrayList<>();
         List<VolunteerAccountChange> volunteerAccountChangeList = new ArrayList<>();
+
         //生成所有的记录对象
         //改!  这里我们根据map的键 去取出余额的集合,
         volunteerAccountChangeGroupByVId.forEach((volunteerId, orderFrozenFunds) -> {
+            //
+
+
             //查看用户当前的余额 其实没必要再循环中写sql了,因为每一个用户都是一次单独的遍历,
            /* BigDecimal oldVolunteerBalance = jdbcTemplate.queryForObject("select balance from l_volunteer_account where volunteer_id = ? ",
                     BigDecimal.class, volunteerId);*/
-
-                BigDecimal oldVolunteerBalance = volunteerAccountMap.get(volunteerId).get(0).getBalance();
-
-
+            BigDecimal oldVolunteerBalance = volunteerAccountMap.get(volunteerId).get(0).getBalance();
             BigDecimal beforeChangeBalance = BigDecimal.valueOf(0);
 
             for (OrderFrozenFunds orderFrozenFund : orderFrozenFunds) {
-                VolunteerAccountChange volunteerAccountChange1 = new VolunteerAccountChange(null, volunteerId, "1", "1", orderFrozenFund.getVolunteerMoney(), beforeChangeBalance.add(oldVolunteerBalance), orderFrozenFund.getVolunteerMoney().add(beforeChangeBalance).add(oldVolunteerBalance),orderFrozenFund.getSecondOrderId());
+                VolunteerAccountChange volunteerAccountChange1 = new VolunteerAccountChange(null, volunteerId, "1", "1", orderFrozenFund.getVolunteerMoney(), beforeChangeBalance.add(oldVolunteerBalance), orderFrozenFund.getVolunteerMoney().add(beforeChangeBalance).add(oldVolunteerBalance), orderFrozenFund.getSecondOrderId());
                 volunteerAccountChange1.setCreateTime(DateTimeUtil.getNowTime());
                 volunteerAccountChangeList.add(volunteerAccountChange1);
                /* volunteerAccountChanges.add(new Object[]{volunteerId,1,1,orderFrozenFund.getVolunteerMoney(),beforeChangeBalance.add(oldVolunteerBalance),orderFrozenFund.getVolunteerMoney().add(beforeChangeBalance).add(oldVolunteerBalance)
@@ -113,7 +135,7 @@ public class Monitor {
                 beforeChangeBalance = beforeChangeBalance.add(orderFrozenFund.getVolunteerMoney());
 
                 if (orderFrozenFund.getScoreMoney() != null && orderFrozenFund.getScoreMoney().compareTo(BigDecimal.ZERO) != 0) {
-                    VolunteerAccountChange volunteerAccountChange2 = new VolunteerAccountChange(null, volunteerId, "1", "2", orderFrozenFund.getScoreMoney(), beforeChangeBalance.add(oldVolunteerBalance), orderFrozenFund.getScoreMoney().add(beforeChangeBalance).add(oldVolunteerBalance),orderFrozenFund.getSecondOrderId());
+                    VolunteerAccountChange volunteerAccountChange2 = new VolunteerAccountChange(null, volunteerId, "1", "2", orderFrozenFund.getScoreMoney(), beforeChangeBalance.add(oldVolunteerBalance), orderFrozenFund.getScoreMoney().add(beforeChangeBalance).add(oldVolunteerBalance), orderFrozenFund.getSecondOrderId());
                     volunteerAccountChange2.setCreateTime(DateTimeUtil.getNowTime());
                     volunteerAccountChangeList.add(volunteerAccountChange2);
                     /*volunteerAccountChanges.add(new Object[]{volunteerId,1,1,orderFrozenFund.getScoreMoney(),beforeChangeBalance.add(oldVolunteerBalance),orderFrozenFund.getScoreMoney().add(beforeChangeBalance).add(oldVolunteerBalance)

+ 24 - 0
leromro-core/src/main/java/com/leromro/core/utils/JsonParser.java

@@ -0,0 +1,24 @@
+package com.leromro.core.utils;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class JsonParser {
+    public static List<double[]> parseCoordinates(String json) throws Exception {
+        ObjectMapper mapper = new ObjectMapper();
+        // 先解析为List<List<Double>>,再转换为List<double[]>
+        List<List<Double>> tempList = mapper.readValue(json,new TypeReference<List<List<Double>>>() {});
+        List<double[]> result = new ArrayList<>();
+        for (List<Double> subList : tempList) {
+            double[] arr = new double[subList.size()];
+            for (int i = 0; i < subList.size(); i++) {
+                arr[i] = subList.get(i); // 自动拆箱为double
+            }
+            result.add(arr);
+        }
+        return result;
+    }
+}

+ 4 - 4
leromro-core/src/main/resources/mapper/core/MainOrdersMapper.xml

@@ -131,18 +131,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 </foreach>
             </if>
             <if test="userId != null">
-                and user_id = #{userId}
+                and lmo.user_id = #{userId}
             </if>
         </where>
-        order by create_time desc
+        order by lmo.create_time desc
     </select>
 
     <select id="webMainOrderList" resultType="com.leromro.core.domain.vo.webMainOrderListVO">
         select lmo.*,lvi.project_name,lvi.business_tier_name,lvi.name,lvi.phonenumber
         from l_main_orders lmo left join l_volunteer_info lvi on lmo.volunteer_info_id = lvi.volunteer_info_id
         <where>
-            <if test="name != null and name !=''">and name = #{name}</if>
-            <if test="clientTelephone != null and clientTelephone != ''">and client_telephone = #{clientTelephone}</if>
+            <if test="name != null and name !=''">and lvi.name = #{name}</if>
+            <if test="clientTelephone != null and clientTelephone != ''">and lmo.client_telephone = #{clientTelephone}</if>
             <if test="phonenumber != null and phonenumber != ''">and lvi.phonenumber = #{phonenumber}</if>
             <if test="businessManagementId != null and businessManagementId != ''">and lvi.business_management_id = #{businessManagementId}</if>
         </where>

+ 1 - 0
leromro-core/src/main/resources/mapper/core/OrderRefundMapper.xml

@@ -86,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from l_order_refund lor
         left join  l_main_orders lmo on lmo.main_order_id = lor.main_order_id
         <where>
+            <if test="orderStatus != null and orderStatus != ''">and lmo.order_status = #{orderStatus}</if>
             <if test="clientName != null and clientName != ''">and lmo.client_name = #{clientName}</if>
             <if test="clientTelephone != null and clientTelephone != ''">and lmo.clien_telephone = #{clientTelephone}</if>
             <if test="businessManagementId != null and businessManagementId != ''">and lmo.business_management_id = #{businessManagementId}</if>

+ 6 - 1
leromro-core/src/main/resources/mapper/core/SecondOrdersMapper.xml

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         service_one_price,
         work_start_time,
         work_number,
+        single_quantity,
         service_duration,
         address_id,
         work_date,
@@ -20,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update_time,
         update_by,
         order_status,
+        volunteer_settlement_status,
         volunteer_info_id,
         remark
         ) VALUES
@@ -33,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 #{secondOrder.serviceOnePrice},
                 #{secondOrder.workStartTime},
                 #{secondOrder.workNumber},
+                 #{secondOrder.singleQuantity},
                 #{secondOrder.serviceDuration},
                 #{secondOrder.addressId},
                 #{secondOrder.workDate},
@@ -41,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 #{secondOrder.updateTime},
                 #{secondOrder.updateBy},
                 #{secondOrder.orderStatus},
+                #{secondOrder.volunteerSettlementStatus},
                  #{secondOrder.volunteerInfoId},
                 #{secondOrder.remark}
                 )
@@ -189,8 +193,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         lso.second_order_id,
         lso.order_status      as orderStatus,
         lso.service_one_price as serviceOnePrice,
+        lso.single_quantity ,
         lmo.user_id,
-        lmo.address           as address,
+        lmo.address         as address,
         lmo.client_name       as name,
         (select avatar from sys_user su where su.user_id = lmo.user_id) as avatar
         from l_second_order lso

+ 9 - 54
leromro-core/src/main/resources/mapper/core/VolunteerInfoMapper.xml

@@ -4,7 +4,7 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.leromro.core.mapper.VolunteerInfoMapper">
 
-    <resultMap type="VolunteerInfo" id="VolunteerInfoResult">
+<!--    <resultMap type="VolunteerInfo" id="VolunteerInfoResult">
         <result property="volunteerInfoId"    column="volunteer_info_id"    />
         <result property="volunteerId"    column="volunteer_id"    />
         <result property="name"    column="name"    />
@@ -23,59 +23,17 @@
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
-    </resultMap>
+    </resultMap>-->
 
+<!--
     <sql id="selectLVolunteerInfoVo">
-        select volunteer_id, name, id_card, score, service_category, skill_describe, phonenumber, sex, status, id_card_picture, certification_picture, volunteer_picture, worked_company, level, is_on_job, city, address, create_time, update_time, remark from l_volunteer_info
+        select volunteer_id, name, id_card, score, service_category, skill_describe, phonenumber, sex, status, id_card_picture,
+               certification_picture, volunteer_picture, worked_company, level, is_on_job, city, address, create_time, update_time, remark from l_volunteer_info
     </sql>
+-->
+
 
 
-    <insert id="newVolunteerByUserId">
-        INSERT INTO l_volunteer_info
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="volunteerId != null">volunteer_id,</if>
-            <if test="name != null">name,</if>
-            <if test="idCard != null">id_card,</if>
-            <if test="idCardPicture != null">id_card_picture,</if>
-            <if test="serviceCategory != null">service_category,</if>
-            <if test="skillDescribe != null">skill_describe,</if>
-            <if test="phonenumber != null">phonenumber,</if>
-            <if test="sex != null">sex,</if>
-            <if test="age != null">age,</if>
-            <if test="status != null">status,</if>
-            <if test="certificationPicture != null">certification_picture,</if>
-            <if test="volunteerPicture != null">volunteer_picture,</if>
-            <if test="city != null">city,</if>
-            <if test="address != null">address,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="remark != null">remark,</if>
-        </trim>
-        VALUES
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="volunteerId != null">#{volunteerId},</if>
-            <if test="name != null">#{name},</if>
-            <if test="idCard != null">#{idCard},</if>
-            <if test="idCardPicture != null">#{idCardPicture},</if>
-            <if test="serviceCategory != null">#{serviceCategory},</if>
-            <if test="skillDescribe != null">#{skillDescribe},</if>
-            <if test="phonenumber != null">#{phonenumber},</if>
-            <if test="sex != null">#{sex},</if>
-            <if test="age != null">#{age},</if>
-            <if test="status != null">#{status},</if>
-            <if test="certificationPicture != null">#{certificationPicture},</if>
-            <if test="volunteerPicture != null">#{volunteerPicture},</if>
-            <if test="city != null">#{city},</if>
-            <if test="address != null">#{address},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="remark != null">#{remark},</if>
-        </trim>
-    </insert>
 
     <select id="webList" resultType="com.leromro.core.domain.VolunteerInfo"
             parameterType="com.leromro.core.domain.VolunteerInfo">
@@ -90,12 +48,9 @@
             <if test="appStatus != null  and appStatus != '' and appStatus == 2"> and app_status = 2</if>
         </where>
     </select>
-    <select id="selectLVolunteerInfoByVolunteerId" resultType="com.leromro.core.domain.VolunteerInfo">
-        select name , service_category , phonenumber,address ,skill_describe , age ,certification_picture ,volunteer_id ,score from l_volunteer_info
-        where volunteer_id = #{volunteerId} and service_category = #{serviceCategory}
-    </select>
+
     <select id="selectVolunteerInfoSimple" resultType="com.leromro.core.domain.vo.VolunteerInfoVO">
-        select volunteer_id, skill_describe,age ,service_category,name,volunteer_picture,score,business_management_id
+        select volunteer_id, skill_describe,age ,service_category,name,volunteer_picture,score,business_management_id ,business_price,business_tier_name , business_unit,business_describe
         from l_volunteer_info lvi
         where app_status = 2
         and lvi.business_management_id in (select lbm.business_management_id from l_business_management lbm

+ 4 - 0
leromro-system/src/main/java/com/leromro/system/service/ISysDeptService.java

@@ -131,4 +131,8 @@ public interface ISysDeptService
      * @param ratio
      */
     void updateDistributionRatio(List<Long> ids, BigDecimal ratio);
+
+    void updateDeptPointList(SysDept sysDept);
+
+    String getPointList(Long deptId);
 }