ソースを参照

修改了订单列表的返回类型
新增根据日期查询余额变更记录
设置了下单后的开始于结束时间

LiRong 1 週間 前
コミット
9c44a02d46

+ 1 - 1
leromro-admin/src/main/java/com/leromro/web/controller/system/SysUserController.java

@@ -86,7 +86,7 @@ public class SysUserController extends BaseController
     public R<SysUser> userInfo()
     {
         Long userId = SecurityUtils.getUserId();
-        SysUser sysUserInfo = userService.userList(new SysUser(userId)).get(0);
+        SysUser sysUserInfo = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, userId));
         return R.ok(sysUserInfo);
     }
     @ApiOperation("小程序端用户信息修改")

+ 4 - 3
leromro-core/src/main/java/com/leromro/core/controller/ClientAccountChangeController.java

@@ -47,9 +47,10 @@ public class ClientAccountChangeController extends BaseController
 
     @ApiOperation("查询用户自己的账户变更记录 收入或支出字段在字典中 类型为:jlzj_money_change_type 用户变更来源 字典字段为:jlzj_client_source_type ")
     @GetMapping
-    public R<ClientAccountChangeListVO> clientAccountChange(){
-        Long userId = SecurityUtils.getUserId();
-        return R.ok(lClientAccountChangeService.selectAccountChangeByuserId(userId));
+    public R<ClientAccountChangeListVO> clientAccountChange(ClientAccountChange clientAccountChange){
+
+        clientAccountChange.setUserId(SecurityUtils.getUserId());
+        return R.ok(lClientAccountChangeService.selectAccountChangeByuserId(clientAccountChange));
     }
 
 

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

@@ -65,11 +65,11 @@ public class OrdersController extends BaseController {
      */
     @ApiOperation("用户查询订单列表")
     @GetMapping("/mainOrderList")
-    public R<List<MainOrdersVO>> selectOrderList(String[] orderStatus) {
-        startPage();
+    public TableDataInfo<MainOrdersVO> selectOrderList(String[] orderStatus) {
+        //startPage();
         Long userId = SecurityUtils.getUserId();
         List<MainOrdersVO> list = mainOrderService.selectByUserId(orderStatus, userId);
-        return R.ok(list);
+        return getDataTable(list);
     }
 
 

+ 3 - 2
leromro-core/src/main/java/com/leromro/core/domain/MainOrders.java

@@ -1,6 +1,7 @@
 package com.leromro.core.domain;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalTime;
 import java.util.Date;
 
@@ -84,13 +85,13 @@ public class MainOrders extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "预计开始日期", width = 30, dateFormat = "yyyy-MM-dd")
     @ApiModelProperty("预计开始日期")
-    private Date serviceStartDate;
+    private LocalDate serviceStartDate;
 
     /** 预计结束日期 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "预计结束日期", width = 30, dateFormat = "yyyy-MM-dd")
     @ApiModelProperty("预计结束日期")
-    private Date serviceFinishDate;
+    private LocalDate serviceFinishDate;
 
     /** 工作开始时间 */
     @JsonFormat(pattern = "H:mm")

+ 1 - 1
leromro-core/src/main/java/com/leromro/core/mapper/ClientAccountChangeMapper.java

@@ -62,5 +62,5 @@ public interface ClientAccountChangeMapper extends BaseMapper<ClientAccountChang
      */
     public int deleteLClientAccountChangeByClientAccountChangeIds(Long[] clientAccountChangeIds);
 
-    List<ClientAccountChangeVO> selectClientAccountChangebyUserId(Long userId);
+    List<ClientAccountChangeVO> selectClientAccountChangebyUserId(ClientAccountChange clientAccountChange);
 }

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

@@ -61,5 +61,5 @@ public interface IClientAccountChangeService extends IService<ClientAccountChang
      */
     public int deleteLClientAccountChangeByClientAccountChangeId(Long clientAccountChangeId);
 
-    ClientAccountChangeListVO selectAccountChangeByuserId(Long userId);
+    ClientAccountChangeListVO selectAccountChangeByuserId(ClientAccountChange clientAccountChange);
 }

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

@@ -96,13 +96,13 @@ public class ClientAccountChangeServiceImpl extends ServiceImpl<ClientAccountCha
     }
 
     /**
-     * @param userId
+     * @param clientAccountChange
      * @return
      */
     @Override
-    public ClientAccountChangeListVO selectAccountChangeByuserId(Long userId) {
+    public ClientAccountChangeListVO selectAccountChangeByuserId(ClientAccountChange clientAccountChange) {
         ClientAccountChangeListVO clientAccountChangeListVO = new ClientAccountChangeListVO();
-        List<ClientAccountChangeVO> list = clientAccountChangeMapper.selectClientAccountChangebyUserId(userId);
+        List<ClientAccountChangeVO> list = clientAccountChangeMapper.selectClientAccountChangebyUserId(clientAccountChange);
         clientAccountChangeListVO.setClientAccountChangeVOlist(list);
         //算出总收入以及总支出
         BigDecimal totalEarning = list.stream()

+ 12 - 1
leromro-core/src/main/java/com/leromro/core/service/impl/MainOrderServiceImpl.java

@@ -23,8 +23,10 @@ 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.stream.Collectors;
 
 @Service
 public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrders> implements IMainOrderService{
@@ -72,7 +74,12 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
         OrderPaymentVO vo = new OrderPaymentVO();
         //订单信息
         MainOrders orders = orderRequest.getOrders();
-        List<VolunteerWorkDate> workDateList = orderRequest.getWorkDateList();
+        List<VolunteerWorkDate> workDateList1 = orderRequest.getWorkDateList();
+        //由于前端传过来的不是有序的,所以我们要将工作时间进行排序
+        List<VolunteerWorkDate> workDateList = orderRequest.getWorkDateList()
+                .stream()
+                .sorted(Comparator.comparing(VolunteerWorkDate::getWorkDate))
+                .collect(Collectors.toList());
         Long userId = SecurityUtils.getUserId();
         long orderId = snowflake.nextId();
         vo.setMainOrderId(orderId);
@@ -144,6 +151,10 @@ public class MainOrderServiceImpl extends ServiceImpl<MainOrdersMapper, MainOrde
         orders.setCreateTime(DateTimeUtil.getNowTime());
         orders.setServiceOnePrice(serviceOnePrice);
         orders.setServiceDuration(businessDurationMin);
+        //设置服务的开始与结束日期 以及开始与结束时间
+        orders.setStartTime(workDateList.get(0).getWorkStartTime());
+        orders.setServiceStartDate(workDateList.get(0).getWorkDate());
+        orders.setServiceFinishDate(workDateList.get(workDateList.size()-1).getWorkDate());
         this.save(orders);
 
         //修改志愿者预约时间表

+ 8 - 1
leromro-core/src/main/resources/mapper/core/ClientAccountChangeMapper.xml

@@ -38,7 +38,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from l_client_account_change lcac
                  left join l_main_orders lmo
                            on lcac.main_order_id = lmo.main_order_id
-        where lcac.user_id = #{userId}
+        <where>
+            <if test="userId != null and userId != ''">and lcac.user_id = #{userId}</if>
+            <if test="createTime != null ">
+                AND lcac.create_time &gt;= #{createTime}
+                AND lcac.create_time &lt; DATE_ADD(#{createTime}, INTERVAL 1 DAY)
+            </if>
+        </where>
+        order by create_time desc
 
     </select>
 

+ 1 - 0
leromro-system/src/main/java/com/leromro/system/service/impl/SysUserServiceImpl.java

@@ -558,6 +558,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
     @Override
     public List<SysUser> userList(SysUser user) {
+
         return baseMapper.userList(user);
     }
 }