From 90d576d41167dc383b499027c8f5624c7a5c63e0 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 10 十月 2023 17:06:51 +0800
Subject: [PATCH] 骑行时长减免和强制还车

---
 server/platform/src/main/java/com/doumee/api/business/ActionLogController.java           |   15 +++++++
 server/services/src/main/java/com/doumee/service/business/impl/ActionLogServiceImpl.java |   32 +++++++++++++++
 server/services/src/main/java/com/doumee/dao/business/model/ActionLog.java               |   44 +++++++++++-----------
 server/services/src/main/java/com/doumee/service/business/ActionLogService.java          |    2 +
 4 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/server/platform/src/main/java/com/doumee/api/business/ActionLogController.java b/server/platform/src/main/java/com/doumee/api/business/ActionLogController.java
index 3f40b12..2fa0f30 100644
--- a/server/platform/src/main/java/com/doumee/api/business/ActionLogController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/ActionLogController.java
@@ -6,7 +6,9 @@
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.DateUtil;
 import com.doumee.dao.business.model.ActionLog;
+import com.doumee.dao.business.vo.GoodsorderExportVO;
 import com.doumee.service.business.ActionLogService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -73,6 +75,12 @@
     public ApiResponse<PageData<ActionLog>> findPage (@RequestBody PageWrap<ActionLog> pageWrap) {
         return ApiResponse.success(actionLogService.findPage(pageWrap));
     }
+    @ApiOperation("鍒嗛〉鏌ヨ")
+    @PostMapping("/findRidePae")
+    @RequiresPermissions("business:actionlog:query")
+    public ApiResponse<PageData<ActionLog>> findRidePae (@RequestBody PageWrap<ActionLog> pageWrap) {
+        return ApiResponse.success(actionLogService.findRidePae(pageWrap));
+    }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
@@ -80,6 +88,13 @@
     public void exportExcel (@RequestBody PageWrap<ActionLog> pageWrap, HttpServletResponse response) {
         ExcelExporter.build(ActionLog.class).export(actionLogService.findPage(pageWrap).getRecords(), "绯荤粺琛屼负鎿嶄綔璁板綍琛�", response);
     }
+    @ApiOperation("瀵煎嚭璋冩暣璁板綍Excel")
+    @PostMapping("/exportRideExcel")
+    @RequiresPermissions("business:actionlog:exportExcel")
+    public void exportRideExcel (@RequestBody PageWrap<ActionLog> pageWrap, HttpServletResponse response) {
+        ExcelExporter.build(ActionLog.class).exportWithFirstAndEnd(actionLogService.findRidePae(pageWrap).getRecords(), "璋冩暣璁板綍_"+System.currentTimeMillis(),"璋冩暣璁板綍_"+ DateUtil.getPlusTime2(DateUtil.getCurrentDate()),null, response);
+
+    }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/ActionLog.java b/server/services/src/main/java/com/doumee/dao/business/model/ActionLog.java
index 0af2edf..8e2d761 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/ActionLog.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/ActionLog.java
@@ -9,6 +9,8 @@
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+
 import java.util.Date;
 import java.util.List;
 
@@ -23,98 +25,96 @@
 public class ActionLog {
 
     @ApiModelProperty(value = "缂栫爜")
-    @ExcelColumn(name="缂栫爜")
     private String id;
 
     @ApiModelProperty(value = "鍒涘缓鏃堕棿")
-    @ExcelColumn(name="鍒涘缓鏃堕棿")
-    //@JsonFormat(pattern = "yyyy-MM-dd")
+    @ExcelColumn(name="鍒涘缓鏃堕棿",index = 6,width = 10,align = HorizontalAlignment.CENTER)
     private Date createDate;
 
     @ApiModelProperty(value = "鍒涘缓浜�")
-    @ExcelColumn(name="鍒涘缓浜�")
+    @ExcelColumn(name="鍒涘缓浜�",index = 7,width = 10,align = HorizontalAlignment.CENTER)
     private String creator;
 
     @ApiModelProperty(value = "缂栬緫鏃堕棿")
-    @ExcelColumn(name="缂栬緫鏃堕棿")
     //@JsonFormat(pattern = "yyyy-MM-dd")
     private Date editDate;
 
     @ApiModelProperty(value = "缂栬緫浜�")
-    @ExcelColumn(name="缂栬緫浜�")
     private String editor;
 
     @ApiModelProperty(value = "鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�", example = "1")
-    @ExcelColumn(name="鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�")
     private Integer isdeleted;
 
     @ApiModelProperty(value = "澶囨敞")
-    @ExcelColumn(name="澶囨敞")
     private String info;
 
     @ApiModelProperty(value = "鏍囬")
-    @ExcelColumn(name="鏍囬")
     private String title;
 
     @ApiModelProperty(value = "鍐呭")
-    @ExcelColumn(name="鍐呭")
     private String content;
 
     @ApiModelProperty(value = "绫诲瀷 0寮哄埗杩樿溅 1楠戣鏃堕暱淇敼", example = "1")
-    @ExcelColumn(name="绫诲瀷 ")
+    @ExcelColumn(name="绫诲瀷 " ,valueMapping = "0=寮哄埗杩樿溅;1=楠戣鏃堕暱淇敼;",index = 5,width = 10,align = HorizontalAlignment.CENTER)
     private Integer type;
     @ApiModelProperty(value = "绫诲瀷闆嗗悎", example = "1")
-    @TableField(exist = false)
     private List<Integer> typeList;
 
     @ApiModelProperty(value = "鍏宠仈瀵硅薄缂栫爜")
-    @ExcelColumn(name="鍏宠仈瀵硅薄缂栫爜")
     private String objId;
 
     @ApiModelProperty(value = "鍏宠仈瀵硅薄绫诲瀷  ", example = "1")
-    @ExcelColumn(name="鍏宠仈瀵硅薄绫诲瀷  ")
     private Integer objType;
 
     @ApiModelProperty(value = "鐢ㄦ埛缂栫爜")
-    @ExcelColumn(name="鐢ㄦ埛缂栫爜")
     private String userId;
 
     @ApiModelProperty(value = "鐢ㄦ埛绫诲瀷 0浼氬憳 1绯荤粺鐢ㄦ埛", example = "1")
-    @ExcelColumn(name="鐢ㄦ埛绫诲瀷 0浼氬憳 1绯荤粺鐢ㄦ埛")
     private Integer userType;
 
     @ApiModelProperty(value = "鎿嶄綔鍓嶅唴瀹�")
-    @ExcelColumn(name="鎿嶄綔鍓嶅唴瀹�")
     private String beforeContent;
 
     @ApiModelProperty(value = "鎿嶄綔鍚庡唴瀹�")
-    @ExcelColumn(name="鎿嶄綔鍚庡唴瀹�")
     private String afterContent;
 
     @ApiModelProperty(value = "鍙傛暟1")
-    @ExcelColumn(name="鍙傛暟1")
     private String param;
 
     @ApiModelProperty(value = "鍙傛暟2")
-    @ExcelColumn(name="鍙傛暟2")
     private String param2;
 
     @ApiModelProperty(value = "鍙傛暟3")
-    @ExcelColumn(name="鍙傛暟3")
     private String param3;
 
     @ApiModelProperty(value = "鎿嶄綔缁撴灉 0鎴愬姛 1澶辫触", example = "1")
-    @ExcelColumn(name="鎿嶄綔缁撴灉 0鎴愬姛 1澶辫触")
     private Integer result;
     @ApiModelProperty(value = "鎿嶄綔鍘熷洜")
+    @ExcelColumn(name="鎿嶄綔鍘熷洜",index = 8,width = 10,align = HorizontalAlignment.CENTER)
     private String actReason;
 
     @ApiModelProperty(value = "鎿嶄綔澶囨敞")
+    @ExcelColumn(name="鎿嶄綔澶囨敞",index = 9,width = 10,align = HorizontalAlignment.CENTER)
     private String actInfo;
 
     @ApiModelProperty(value = "楠戣璁板綍瀵硅薄" )
     @TableField(exist = false)
     private MemberRides ridesObj;
+    @ApiModelProperty(value = "杞︾紪鍙�" )
+    @TableField(exist = false)
+    private String bikeCode;
+    @ApiModelProperty(value = "鐢ㄦ埛" )
+    @ExcelColumn(name="鐢ㄦ埛",index = 1,width = 10,align = HorizontalAlignment.CENTER)
+    @TableField(exist = false)
+    private String openid;
+    @ApiModelProperty(value = "鍊熷嚭绔欑偣" )
+    @ExcelColumn(name="鍊熷嚭绔欑偣",index = 3,width = 10,align = HorizontalAlignment.CENTER)
+    @TableField(exist = false)
+    private String rentSiteId;
+    @ApiModelProperty(value = "鍊熷嚭鏃堕棿" )
+    @ExcelColumn(name="鍊熷嚭鏃堕棿",index = 4,width = 10,align = HorizontalAlignment.CENTER)
+    @TableField(exist = false)
+    private Date rentDate;
     @ApiModelProperty(value = "鏌ヨ寮�濮嬫棩鏈燂紙鍖呭惈锛�", example = "2023-10-01 15:12:01")
     @TableField(exist = false)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
diff --git a/server/services/src/main/java/com/doumee/service/business/ActionLogService.java b/server/services/src/main/java/com/doumee/service/business/ActionLogService.java
index a7f8cfb..a89c4a1 100644
--- a/server/services/src/main/java/com/doumee/service/business/ActionLogService.java
+++ b/server/services/src/main/java/com/doumee/service/business/ActionLogService.java
@@ -94,4 +94,6 @@
      * @return long
      */
     long count(ActionLog actionLog);
+
+    PageData<ActionLog>  findRidePae(PageWrap<ActionLog> pageWrap);
 }
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/ActionLogServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/ActionLogServiceImpl.java
index 5515eca..ed45c40 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/ActionLogServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/ActionLogServiceImpl.java
@@ -106,7 +106,6 @@
         Utils.MP.blankToNull(pageWrap.getModel());
         queryWrapper.orderByDesc(ActionLog::getCreateDate);
         queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,ActionLog::getUserId);
-        queryWrapper.leftJoin(BaseParam.class,BaseParam::getId,MemberRides::getParamId);
         queryWrapper.eq(ActionLog::getIsdeleted, Constants.ZERO);
         queryWrapper.ge(pageWrap.getModel().getStartDate()!=null, ActionLog::getCreateDate,pageWrap.getModel().getStartDate());
         queryWrapper.le(pageWrap.getModel().getEndDate()!=null, ActionLog::getCreateDate,pageWrap.getModel().getEndDate());
@@ -117,6 +116,37 @@
 
         IPage<ActionLog> result = actionLogJoinMapper.selectJoinPage(page, ActionLog.class, queryWrapper);
 
+
+
+        return PageData.from(result);
+    }
+    @Override
+    public     PageData<ActionLog>  findRidePae(PageWrap<ActionLog> pageWrap){
+
+        IPage<MemberRides> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+
+        MPJLambdaWrapper<ActionLog> queryWrapper = new MPJLambdaWrapper<>();
+        Utils.MP.blankToNull(pageWrap.getModel());
+        queryWrapper.orderByDesc(ActionLog::getCreateDate);
+        queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,ActionLog::getUserId);
+        queryWrapper.leftJoin(MemberRides.class,MemberRides::getMemberId,ActionLog::getObjId);
+        queryWrapper.leftJoin(Member.class,Member::getId,MemberRides::getMemberId);
+        queryWrapper.eq(ActionLog::getIsdeleted, Constants.ZERO);
+        queryWrapper.ge(pageWrap.getModel().getStartDate()!=null, ActionLog::getCreateDate,pageWrap.getModel().getStartDate());
+        queryWrapper.le(pageWrap.getModel().getEndDate()!=null, ActionLog::getCreateDate,pageWrap.getModel().getEndDate());
+        queryWrapper.eq(pageWrap.getModel().getCreator()!=null, ActionLog::getCreator,pageWrap.getModel().getCreator());
+        queryWrapper.in(pageWrap.getModel().getTypeList()!=null && pageWrap.getModel().getTypeList().size()>0, ActionLog::getType,pageWrap.getModel().getTypeList());
+        queryWrapper.selectAs(ActionLog::getCreateDate,ActionLog::getCreateDate)
+                .selectAs(ActionLog::getActInfo,ActionLog::getActInfo)
+                .selectAs(ActionLog::getActReason,ActionLog::getActReason)
+                .selectAs(SystemUser::getNickname,ActionLog::getCreator)
+                .selectAs(Member::getOpenid,ActionLog::getOpenid)
+                .selectAs(MemberRides::getBikeCode,ActionLog::getBikeCode)
+                .selectAs(MemberRides::getRentSiteId,ActionLog::getRentSiteId)
+                .selectAs(MemberRides::getRentDate,ActionLog::getRentDate);
+
+        IPage<ActionLog> result = actionLogJoinMapper.selectJoinPage(page, ActionLog.class, queryWrapper);
+
         if(result !=null && result.getRecords()!=null){
             for (int i = 0; i < result.getRecords().size(); i++) {
                 ActionLog log = result.getRecords().get(i);

--
Gitblit v1.9.3