Browse Source

用户行为优化

huangzhiguo 1 year ago
parent
commit
0d56af8849

+ 1 - 3
src/main/java/com/caimei365/manager/controller/caimei/user/CmClubRemarksApi.java

@@ -63,9 +63,7 @@ public class CmClubRemarksApi {
     public ResponseJson<PaginationVo<CmClubRemarks>> registList(CmClubRemarks cmClubRemarks,
                                                  @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                  @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
-        if (null == cmClubRemarks)  {
-            return ResponseJson.error(-1, "参数为空", null);
-        }
+
         return cmClubRemarksService.findRegistList(cmClubRemarks, pageNum, pageSize);
     }
 

+ 2 - 2
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmClubRemarks.java

@@ -82,10 +82,10 @@ public class CmClubRemarks {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date addTime;
 
-    private String startAddTime;
+    private String startTime;
 
 
-    private String endAddTime;
+    private String endTime;
     /**
      * 咨询人
      */

+ 14 - 7
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmClubRemarksServiceImpl.java

@@ -64,8 +64,8 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
             try {
                 Date startDate = dateFormat.parse(startTime);
                 Date endDate = dateFormat.parse(endTime);
-                startTime = dateFormat.format(startDate) + "00:00:00";
-                endTime = dateFormat.format(endDate) + "23:59:59";
+                startTime = dateFormat.format(startDate) + " 00:00:00";
+                endTime = dateFormat.format(endDate) + " 23:59:59";
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -110,7 +110,18 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
      */
     @Override
     public ResponseJson<PaginationVo<CmClubRemarks>> findRegistList(CmClubRemarks cmClubRemarks, Integer pageNum, Integer pageSize) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        // 格式时间
+        if (StringUtils.isNotBlank(cmClubRemarks.getStartTime()) && StringUtils.isNotBlank(cmClubRemarks.getEndTime())) {
+            try {
+                Date startDate = dateFormat.parse(cmClubRemarks.getStartTime());
+                Date endDate = dateFormat.parse(cmClubRemarks.getEndTime());
+                cmClubRemarks.setStartTime(dateFormat.format(startDate) + " 00:00:00");
+                cmClubRemarks.setEndTime(dateFormat.format(endDate) + " 23:59:59");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
         PageHelper.startPage(pageNum, pageSize);
         List<CmClubRemarks> remarksList = cmClubRemarksDao.findRegistList(cmClubRemarks);
         remarksList.forEach(remarks -> {
@@ -179,10 +190,6 @@ public class CmClubRemarksServiceImpl implements CmClubRemarksService {
             if (null != remarks.getReportId()) {
                 remarks.setReports(cmClubRemarksDao.getReportById(remarks.getReportId()));
             }
-            // 处理时间
-            if (null != remarks.getAddTime()) {
-                remarks.setDivisionTime(dateFormat.format(remarks.getAddTime()));
-            }
         });
         PaginationVo<CmClubRemarks> page = new PaginationVo<>(remarksList);
         return ResponseJson.success(page);

+ 11 - 11
src/main/resources/mapper/user/CmClubRemarksDao.xml

@@ -41,7 +41,7 @@
                         and ADDTIME <![CDATA[ >= ]]> #{startTime}
                     </if>
                     <if test="endTime != null and endTime != ''">
-                        AND ADDTIME <![CDATA[ <= ]]> #{endTime})
+                        AND ADDTIME <![CDATA[ <= ]]> #{endTime}
                     </if>
             )
     </select>
@@ -104,13 +104,13 @@
                 and ccr.serviceProviderId = #{serviceProviderId}
             </if>
             <if test="consult != null">
-                and ccr.consultType like concat('%',#{consult},'%')
+                and (ccr.consultType LIKE concat('%,',#{consult},'%') OR ccr.consultType LIKE concat('',#{consult},',%') OR ccr.consultType =  #{consult})
             </if>
-            <if test="startAddTime != '' and startAddTime != null">
-                and ccr.addTime <![CDATA[  >=  ]]> #{startAddTime}
+            <if test="startTime != '' and startTime != null">
+                and ccr.addTime <![CDATA[  >=  ]]> #{startTime}
             </if>
-            <if test="endAddTime != '' and endAddTime != null">
-                and ccr.addTime <![CDATA[  <=  ]]> #{endAddTime}
+            <if test="endTime != '' and endTime != null">
+                and ccr.addTime <![CDATA[  <=  ]]> #{endTime}
             </if>
             <if test="newDeal !=null">
                 and c.newDeal=#{newDeal}
@@ -166,13 +166,13 @@
                 and ccr.serviceProviderId = #{serviceProviderId}
             </if>
             <if test="consult != null">
-                and ccr.consultType like concat('%',#{consult},'%')
+                and (ccr.consultType LIKE concat('%,',#{consult},'%') OR ccr.consultType LIKE concat('',#{consult},',%') OR ccr.consultType =  #{consult})
             </if>
-            <if test="startAddTime != '' and startAddTime != null">
-                and ccr.addTime <![CDATA[  >=  ]]> #{startAddTime}
+            <if test="startTime != '' and startTime != null">
+                and ccr.addTime <![CDATA[  >=  ]]> #{startTime}
             </if>
-            <if test="endAddTime != '' and endAddTime != null">
-                and ccr.addTime <![CDATA[  <=  ]]> #{endAddTime}
+            <if test="endTime != '' and endTime != null">
+                and ccr.addTime <![CDATA[  <=  ]]> #{endTime}
             </if>
             <if test="newDeal !=null">
                 and c.newDeal=#{newDeal}