Browse Source

v1.1.0修改稿

lyhzzz 2 năm trước cách đây
mục cha
commit
0e4d1c99ca

+ 28 - 1
README.md

@@ -1 +1,28 @@
-v1.0.0
+#**经销商管理后台**
+
+###**v1.0.0** 
+~~~~
+1.设备管理
+2.场景管理
+3.权益管理
+4.销售统计
+~~~~
+
+###**v1.1.0** 
+~~~~
+1,设备管理新增查询条件
+    1.权益类型
+    2.权益状态
+    3.绑定状态
+2,设备管理列表新增返回值
+    1.权益类型
+    2.权益状态
+3,场景管理添加查询条件
+    1.场景码
+    2.拍摄时间
+4.权益管理
+    1,新增授权修改,授权时间
+5.销售统计
+    1.新增列表返回值
+6.新增权益操作日志
+~~~~

+ 12 - 0
src/main/java/com/fdkankan/agent/common/util/IncrementUtil.java

@@ -0,0 +1,12 @@
+package com.fdkankan.agent.common.util;
+
+public class IncrementUtil {
+
+    public static String getStrIncrementName(Integer validTimeType,String incrementName){
+        switch (validTimeType){
+            case 0 : return  incrementName +"(年)";
+            case 1 : return incrementName +"(月)";
+            default: return incrementName +"(日)";
+        }
+    }
+}

+ 5 - 0
src/main/java/com/fdkankan/agent/entity/AgentNewLog.java

@@ -55,6 +55,11 @@ public class AgentNewLog implements Serializable {
      */
     @TableField("count")
     private Integer count;
+    /**
+     * 授权时间
+     */
+    @TableField("total_time")
+    private Integer totalTime;
 
     @TableField("create_time")
     private String createTime;

+ 3 - 0
src/main/java/com/fdkankan/agent/httpClient/service/LaserService.java

@@ -110,6 +110,9 @@ public class LaserService {
             }
             param.getSnCodes().retainAll(strings);
         }
+        if(StringUtils.isNotBlank(param.getNum())){
+            newParam.setSceneCodes(Arrays.asList(param.getNum()));
+        }
         BeanUtils.copyProperties(param,newParam);
         newParam.setTitle(param.getSceneName());
         return newParam;

+ 3 - 17
src/main/java/com/fdkankan/agent/request/CameraParam.java

@@ -18,23 +18,9 @@ public class CameraParam extends RequestBase {
     private Integer type;                       //设备类型  0旧双目相机,1 四维看看 ,2 四维看看lite,9四维看见,10四维深时
     private Integer agentId;
 
-    private List<String> activatedTime;
-    private String activatedStartTime;          //激活时间
-    private String activatedEndTime;            //激活时间
+    private Integer incrementTypeId;              //权益类型
+    private Integer incrementStatus;            //权益状态  0未绑定权益,1生效中,2已过期
+    private Integer bindStatus;                 //绑定状态  0未绑定,1已绑定
 
 
-
-    public String getActivatedStartTime() {
-        if(activatedTime != null && activatedTime.size() >1){
-            return Dateutils.getStartTime(activatedTime.get(0));
-        }
-        return Dateutils.getStartTime(activatedStartTime);
-    }
-
-    public String getActivatedEndTime() {
-        if(activatedTime != null && activatedTime.size() >1){
-            return Dateutils.getEndTime(activatedTime.get(1));
-        }
-        return Dateutils.getEndTime(activatedEndTime);
-    }
 }

+ 1 - 0
src/main/java/com/fdkankan/agent/request/IncrementParam.java

@@ -11,6 +11,7 @@ public class IncrementParam extends RequestBase {
     private Integer incrementTypeId;
 
     private Integer count;
+    private Integer totalTime;
     private String incrementEndTime;
 
 }

+ 19 - 0
src/main/java/com/fdkankan/agent/request/SceneParam.java

@@ -1,6 +1,7 @@
 package com.fdkankan.agent.request;
 
 import com.fdkankan.agent.common.RequestBase;
+import com.fdkankan.agent.util.Dateutils;
 import lombok.Data;
 
 import java.util.List;
@@ -17,4 +18,22 @@ public class SceneParam extends RequestBase {
     private Integer agentId;
 
     private List<String> snCodes;
+    private List<String> timeList;
+
+    private String startTime;
+    private String endTime;
+
+    public String getStartTime() {
+        if(timeList != null && timeList.size() >1){
+            return Dateutils.getStartTime(timeList.get(0));
+        }
+        return Dateutils.getStartTime(startTime);
+    }
+
+    public String getEndTime() {
+        if(timeList != null && timeList.size() >1){
+            return Dateutils.getEndTime(timeList.get(1));
+        }
+        return Dateutils.getEndTime(endTime);
+    }
 }

+ 5 - 0
src/main/java/com/fdkankan/agent/response/CameraDetailVo.java

@@ -17,5 +17,10 @@ public class CameraDetailVo {
 
     private String orderSn;
 
+    private Integer incrementTypeId;
+    private String incrementTypeName;
+
+    private Integer incrementStatus;
+
 
 }

+ 3 - 0
src/main/java/com/fdkankan/agent/response/LogListVo.java

@@ -35,6 +35,9 @@ public class LogListVo {
     @ExcelProperty("授权数量")
     private Integer count;
 
+    @ExcelProperty("授权总期限(年/月)")
+    private Integer totalTime;
+
 
     public String getTypeStr() {
         if(type == null){

+ 1 - 1
src/main/java/com/fdkankan/agent/service/IAgentNewService.java

@@ -17,5 +17,5 @@ public interface IAgentNewService extends IService<AgentNew> {
 
     AgentNewVo getByUserName(String phoneNum);
 
-    void subNum(AgentNewVo agentNewVo,Long userId, IncrementType incrementType, Integer count,Integer addType);
+    void subNum(AgentNewVo agentNewVo,Long userId, IncrementType incrementType, Integer count,Integer totalTime,Integer addType);
 }

+ 4 - 0
src/main/java/com/fdkankan/agent/service/IIncrementTypeService.java

@@ -3,6 +3,9 @@ package com.fdkankan.agent.service;
 import com.fdkankan.agent.entity.IncrementType;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.HashMap;
+import java.util.Set;
+
 /**
  * <p>
  * 会员权益类型 服务类
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IIncrementTypeService extends IService<IncrementType> {
 
+    HashMap<Integer, IncrementType> getMapByIds(Set<Integer> incrementTypeIds);
 }

+ 1 - 1
src/main/java/com/fdkankan/agent/service/impl/AgentNewLogServiceImpl.java

@@ -74,7 +74,7 @@ public class AgentNewLogServiceImpl extends ServiceImpl<IAgentNewLogMapper, Agen
 
         user.setDownloadNumTotal(user.getDownloadNumTotal() + param.getCount() );
         userService.updateById(user);
-        agentNewService.subNum(agent,user.getId(),null,param.getCount(),0);
+        agentNewService.subNum(agent,user.getId(),null,param.getCount(),param.getTotalTime(),0);
     }
 
     @Override

+ 2 - 1
src/main/java/com/fdkankan/agent/service/impl/AgentNewServiceImpl.java

@@ -54,7 +54,7 @@ public class AgentNewServiceImpl extends ServiceImpl<IAgentNewMapper, AgentNew>
     }
 
     @Override
-    public void subNum(AgentNewVo agentNewVo, Long userId,IncrementType incrementType, Integer count,Integer addType) {
+    public void subNum(AgentNewVo agentNewVo, Long userId,IncrementType incrementType, Integer count,Integer totalTime,Integer addType) {
         if(count == null || count <=0){
             return;
         }
@@ -62,6 +62,7 @@ public class AgentNewServiceImpl extends ServiceImpl<IAgentNewMapper, AgentNew>
         agentNewLog.setAgentId(agentNewVo.getId());
         agentNewLog.setUserId(userId);
         agentNewLog.setCount(count);
+        agentNewLog.setTotalTime(totalTime);
         agentNewLog.setGiveType(addType);
 
         LambdaUpdateWrapper<AgentNew> wrapper = new LambdaUpdateWrapper<>();

+ 20 - 0
src/main/java/com/fdkankan/agent/service/impl/CameraServiceImpl.java

@@ -3,15 +3,22 @@ package com.fdkankan.agent.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.agent.common.PageInfo;
+import com.fdkankan.agent.common.util.IncrementUtil;
 import com.fdkankan.agent.entity.Camera;
+import com.fdkankan.agent.entity.IncrementType;
 import com.fdkankan.agent.mapper.ICameraMapper;
 import com.fdkankan.agent.request.CameraParam;
 import com.fdkankan.agent.response.CameraDetailVo;
 import com.fdkankan.agent.service.ICameraService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.agent.service.IIncrementTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -24,10 +31,23 @@ import java.util.List;
 @Service
 public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implements ICameraService {
 
+    @Autowired
+    IIncrementTypeService incrementTypeService;
 
     @Override
     public Object pageList(CameraParam param) {
         Page<CameraDetailVo> voPage = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+
+        Set<Integer> incrementTypeIds = voPage.getRecords().stream().map(CameraDetailVo::getIncrementTypeId).collect(Collectors.toSet());
+        HashMap<Integer, IncrementType> incrementTypeHashMap = incrementTypeService.getMapByIds(incrementTypeIds);
+
+        for (CameraDetailVo record : voPage.getRecords()) {
+            if(record.getIncrementTypeId() != null){
+                IncrementType incrementType = incrementTypeHashMap.get(record.getIncrementTypeId());
+                String strIncrementName = IncrementUtil.getStrIncrementName(incrementType.getValidTimeType(), incrementType.getName());
+                record.setIncrementTypeName(strIncrementName);
+            }
+        }
         return PageInfo.PageInfo(voPage);
     }
 

+ 13 - 0
src/main/java/com/fdkankan/agent/service/impl/IncrementTypeServiceImpl.java

@@ -6,6 +6,10 @@ import com.fdkankan.agent.service.IIncrementTypeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
 /**
  * <p>
  * 会员权益类型 服务实现类
@@ -17,4 +21,13 @@ import org.springframework.stereotype.Service;
 @Service
 public class IncrementTypeServiceImpl extends ServiceImpl<IIncrementTypeMapper, IncrementType> implements IIncrementTypeService {
 
+    @Override
+    public HashMap<Integer, IncrementType> getMapByIds(Set<Integer> incrementTypeIds) {
+        HashMap<Integer, IncrementType> map = new HashMap<>();
+        if(incrementTypeIds != null && incrementTypeIds.size() >0){
+            List<IncrementType> incrementTypes = this.listByIds(incrementTypeIds);
+            incrementTypes.forEach(entity -> map.put(entity.getId(),entity));
+        }
+        return map;
+    }
 }

+ 0 - 3
src/main/java/com/fdkankan/agent/service/impl/SceneProServiceImpl.java

@@ -76,9 +76,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(param.getType() == 2){  //深时
             return laserService.pageList(param);
         }
-        if(param.getType() == 3){
-            return sceneService.pageList(param);
-        }
         Page<SceneVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
         HashMap<String,SceneCopyLog> map = null;
         if(page.getRecords().size() >0){

+ 6 - 7
src/main/java/com/fdkankan/agent/service/impl/UserIncrementServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.agent.common.PageInfo;
 import com.fdkankan.agent.common.ResultCode;
+import com.fdkankan.agent.common.util.IncrementUtil;
 import com.fdkankan.agent.entity.IncrementType;
 import com.fdkankan.agent.entity.User;
 import com.fdkankan.agent.entity.UserIncrement;
@@ -20,6 +21,7 @@ import com.fdkankan.agent.service.IUserService;
 import com.fdkankan.common.util.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -62,11 +64,8 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
         Page<UserIncrementVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(), param.getPageSize()), param);
 
         for (UserIncrementVo vo :page.getRecords() ) {
-            switch (vo.getValidTimeType()){
-                case 0 : vo.setIncrementTypeName(vo.getIncrementTypeName() +"(年)"); break;
-                case 1 : vo.setIncrementTypeName(vo.getIncrementTypeName() +"(月)"); break;
-                default: vo.setIncrementTypeName(vo.getIncrementTypeName() +"(日)"); break;
-            }
+            String fmName = IncrementUtil.getStrIncrementName(vo.getValidTimeType(), vo.getIncrementTypeName());
+            vo.setIncrementTypeName(fmName);
         }
         return PageInfo.PageInfo(page);
     }
@@ -124,7 +123,7 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
             this.saveBatch(userIncrementList);
             user.setDownloadNumTotal(user.getDownloadNumTotal() + param.getCount() * incrementType.getDownloadNum());
             userService.updateById(user);
-            agentNewService.subNum(agentNewVo,user.getId(),incrementType,param.getCount(),0);
+            agentNewService.subNum(agentNewVo,user.getId(),incrementType,param.getCount(),param.getTotalTime(),0);
 
         }
 
@@ -162,7 +161,7 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
 
         user.setDownloadNumTotal(user.getDownloadNumTotal() +  incrementType.getDownloadNum());
         userService.updateById(user);
-        agentNewService.subNum(agentNewVo,user.getId(),incrementType,1,1);
+        agentNewService.subNum(agentNewVo,user.getId(),incrementType,1,param.getTotalTime(),1);
 
     }
 }

+ 14 - 7
src/main/resources/mapper/agent/CameraMapper.xml

@@ -4,15 +4,15 @@
 
     <select id="pageList" resultType="com.fdkankan.agent.response.CameraDetailVo">
         select c.id ,c.sn_code,c.activated_time ,d.create_time as outTime ,d.type,d.own as outType  ,u.user_name, c.wifi_name,
-        d.order_sn
+        d.order_sn,ui.increment_type_id,ui.is_expired as incrementStatus
         from t_camera c
         left join t_camera_detail d on c.id = d.camera_id
         left join t_user u on d.user_id = u.id
+        left join t_user_increment ui on d.camera_id = ui.camera_id
         where c.rec_status = 'A' and d.agent_id = #{param.agentId}
         <if test="param.userId !=null ">
             and d.user_id = #{param.userId}
         </if>
-
         <if test="param.type !=null ">
             and d.type = #{param.type}
         </if>
@@ -22,12 +22,19 @@
         <if test="param.userName !=null and param.userName != '' ">
             and u.user_name like  concat('%',#{param.userName},'%')
         </if>
-        <if test="param.activatedStartTime !=null and param.activatedStartTime != '' ">
-            and c.activated_time &gt;= #{param.activatedStartTime}
+        <if test="param.incrementTypeId !=null ">
+            and ui.increment_type_id = #{param.incrementTypeId}
+        </if>
+        <if test="param.incrementStatus !=null ">
+            and ui.is_expired = #{param.incrementStatus}
         </if>
-        <if test="param.activatedEndTime !=null and param.activatedEndTime != '' ">
-            and c.activated_time &lt;= #{param.activatedEndTime}
+        <if test="param.bindStatus !=null and param.bindStatus == 0">
+            and d.user_id is null
         </if>
-        order by c.activated_time desc
+        <if test="param.bindStatus !=null and param.bindStatus == 1">
+            and d.user_id is not null
+        </if>
+
+        order by d.out_time desc
     </select>
 </mapper>

+ 9 - 0
src/main/resources/mapper/agent/SceneProMapper.xml

@@ -51,6 +51,15 @@
         <if test="param.agentId !=null ">
             and d.agent_id = #{param.agentId}
         </if>
+        <if test="param.num !=null and param.num !='' ">
+            and s.num like concat ('%',#{param.num},'%')
+        </if>
+        <if test="param.startTime !=null and param.startTime !='' ">
+            and s.create_time &gt;= #{param.startTime}
+        </if>
+        <if test="param.endTime !=null and param.endTime !='' ">
+            and s.create_time &lt;= #{param.endTime}
+        </if>
     </sql>
 
 </mapper>