瀏覽代碼

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
5 年之前
父節點
當前提交
1014d7bc6f

+ 17 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldController.java

@@ -177,5 +177,22 @@ public class MouldController {
         HttpRespMsg msg = mouldService.scrapMouldList(userVO);
         return msg;
     }
+
+
+    /**
+     * 模具地图概览
+     * token 当前人唯一权限
+     * @return
+     */
+    @ApiOperation("模具地图概览")
+    @RequestMapping("/listMap")
+    @ResponseBody
+    public HttpRespMsg listMap(UserVO userVO, String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User user = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
+        BeanUtils.copyProperties(user,userVO);
+        msg = projectService.getModelListMapByUser(userVO);
+        return msg;
+    }
 }
 

+ 56 - 12
cloud-model/src/main/java/com/hssx/cloudmodel/entity/MouldEquipment.java

@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 import java.io.Serializable;
 
 /**
@@ -16,7 +14,7 @@ import java.io.Serializable;
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-08-02
+ * @since 2019-08-21
  */
 @TableName("tb_mould_equipment")
 public class MouldEquipment extends Model<MouldEquipment> {
@@ -39,14 +37,12 @@ public class MouldEquipment extends Model<MouldEquipment> {
      * 启动时间
      */
     @TableField("start_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime startTime;
 
     /**
      * 结束时间
      */
     @TableField("end_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime endTime;
 
     /**
@@ -78,19 +74,31 @@ public class MouldEquipment extends Model<MouldEquipment> {
      */
     @TableField("hill_number")
     private String hillNumber;
+
+    /**
+     * 经度
+     */
+    @TableField("lng")
+    private Double lng;
+
+    /**
+     * 纬度
+     */
+    @TableField("lat")
+    private Double lat;
+
+    /**
+     * 模盒内温度
+     */
+    @TableField("temperature")
+    private Integer temperature;
+
     /**
      * 代理商
      */
     @TableField("agent")
     private String agent;
 
-    public String getAgent() {
-        return agent;
-    }
-
-    public void setAgent(String agent) {
-        this.agent = agent;
-    }
 
     public Integer getId() {
         return id;
@@ -164,6 +172,38 @@ public class MouldEquipment extends Model<MouldEquipment> {
         this.hillNumber = hillNumber;
     }
 
+    public Double getLng() {
+        return lng;
+    }
+
+    public void setLng(Double lng) {
+        this.lng = lng;
+    }
+
+    public Double getLat() {
+        return lat;
+    }
+
+    public void setLat(Double lat) {
+        this.lat = lat;
+    }
+
+    public Integer getTemperature() {
+        return temperature;
+    }
+
+    public void setTemperature(Integer temperature) {
+        this.temperature = temperature;
+    }
+
+    public String getAgent() {
+        return agent;
+    }
+
+    public void setAgent(String agent) {
+        this.agent = agent;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -181,6 +221,10 @@ public class MouldEquipment extends Model<MouldEquipment> {
         ", equipmentNo=" + equipmentNo +
         ", isUse=" + isUse +
         ", hillNumber=" + hillNumber +
+        ", lng=" + lng +
+        ", lat=" + lat +
+        ", temperature=" + temperature +
+        ", agent=" + agent +
         "}";
     }
 }

+ 2 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/MouldVO.java

@@ -26,4 +26,6 @@ public class MouldVO extends Mould {
     private String produceCompany;
     private String token;
     private Integer managerId;
+    private Double lng;
+    private Double lat;
 }

+ 2 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/ProjectService.java

@@ -39,4 +39,6 @@ public interface ProjectService extends IService<Project> {
     HttpRespMsg getListByUser(String token);
 
     HttpRespMsg getProjectListByUserAndCompany(UserVO userVO);
+
+    HttpRespMsg getModelListMapByUser(UserVO userVO);
 }

+ 1 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -14,14 +14,10 @@ import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.ListUtil;
 import com.hssx.cloudmodel.util.PageUtil;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import sun.plugin.com.event.COMEventHandler;
-
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -65,6 +61,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
             int count = companyMapper.selectCount(qw);
             if (count > 0) {
                 msg.setError("公司已存在,请勿重复添加");
+                return msg;
             } else {
                 if (companyVO.getCompanyType() == 0) {
                     //资产方直接添加

+ 62 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java

@@ -477,7 +477,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     //资产方管理员
                     moulds = mouldMapper.selectListByCondition(userVO);
                 }else if(Constant.PRODUCER_COMPANY == userVO.getSubordinateType()){
-                    moulds = mouldMapper.selectListByCondition(userVO);
+                    set = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>().eq("company_id", userVO.getCompanyId())).stream().map(CustomCompany::getProjectId).collect(Collectors.toList());
+                    moulds = mouldMapper.selectListByConditionByProject(userVO, set);
                 }
             } else {
                 //普通用户或者项目经理
@@ -583,4 +584,64 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         }
         return msg;
     }
+
+    @Override
+    public HttpRespMsg getModelListMapByUser(UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        userVO.setProjectId(-1);
+        List<Integer> set = new ArrayList<>();
+        set.add(-1);
+        List<MouldVO> moulds = new ArrayList<>();
+        if (userVO.getId() != null) {
+            //资产方管理员,获取他公司下的所有模具
+            if (Constant.SYS_PARENT_ID == userVO.getParentId()) {
+                //超级管理员,获取平台所有模具
+                moulds = mouldMapper.selectListByCondition(userVO);
+            } else if (Constant.SYS_ID == userVO.getParentId()) {
+
+                if(Constant.ASSETS_COMPANY == userVO.getSubordinateType()){
+                    //资产方管理员
+                    moulds = mouldMapper.selectListByCondition(userVO);
+                }else if(Constant.PRODUCER_COMPANY == userVO.getSubordinateType()){
+                    set = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>().eq("company_id", userVO.getCompanyId())).stream().map(CustomCompany::getProjectId).collect(Collectors.toList());
+                    moulds = mouldMapper.selectListByConditionByProject(userVO, set);
+                }
+            } else {
+                //普通用户或者项目经理
+                //充当项目经理参与的项目
+                if (userVO.getProjectId() != -1) {
+                    set.add(userVO.getProjectId());
+                    moulds = mouldMapper.selectListByConditionByProject(userVO, set);
+                } else {
+                    QueryWrapper<Project> qw = new QueryWrapper<>();
+                    qw.eq("manager_id", userVO.getId());
+                    List<Project> projects = projectMapper.selectList(qw);
+                    if (projects.size() > 0) {
+                        for (Project project : projects) {
+                            set.add(project.getId());
+                        }
+                    }
+//                //充当普通人员参与的项目
+                    List<ProjectUser> projectUsers = projectUserMapper.selectList(new QueryWrapper<ProjectUser>().eq("user_id", userVO.getId()));
+                    if (projectUsers.size() > 0) {
+                        for (ProjectUser projectUser : projectUsers) {
+                            set.add(projectUser.getProjectId());
+                        }
+                    }
+//                //充当审批人员参与的项目
+                    List<ProjectApprove> projectss = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("approver_id", userVO.getId()));
+                    if (projectss.size() > 0) {
+                        for (ProjectApprove projectUser : projectss) {
+                            set.add(projectUser.getProjectId());
+                        }
+                    }
+                    moulds = mouldMapper.selectListByConditionByProject(userVO, set);
+                }
+            }
+            msg.data = moulds;
+        } else {
+            msg.setError("用户不存在,或者未登录!");
+        }
+        return msg;
+    }
 }

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("tb_mould_file");
+        strategy.setInclude("tb_mould_equipment");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 23 - 20
cloud-model/src/main/resources/mapper/MouldEquipmentMapper.xml

@@ -12,9 +12,17 @@
         <result column="belong_company_id" property="belongCompanyId" />
         <result column="equipment_no" property="equipmentNo" />
         <result column="is_use" property="isUse" />
-        <result column="agent" property="agent" />
         <result column="hill_number" property="hillNumber" />
+        <result column="lng" property="lng" />
+        <result column="lat" property="lat" />
+        <result column="temperature" property="temperature" />
+        <result column="agent" property="agent" />
     </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, equipment_name, start_time, end_time, use_life, belong_company_id, equipment_no, is_use, hill_number, lng, lat, temperature, agent
+    </sql>
     <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.MouldEquipmentVO">
         <id column="id" property="id" />
         <result column="equipment_name" property="equipmentName" />
@@ -31,24 +39,19 @@
         <result column="modelName" property="modelName" />
     </resultMap>
 
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, equipment_name, start_time, end_time, use_life, belong_company_id, equipment_no, is_use, hill_number,agent
-    </sql>
-
     <select id="getListByCompanyId" resultMap="BaseResultMapVO">
         select
-          tbme.id id, tbme.equipment_name equipment_name, tbme.start_time start_time, tbme.end_time end_time,
-          tbme.use_life use_life, tbme.belong_company_id belong_company_id, tbme.equipment_no equipment_no,
-          tbme.is_use, tbme.hill_number,tbc.company_name companyName,tbme.agent
+        tbme.id id, tbme.equipment_name equipment_name, tbme.start_time start_time, tbme.end_time end_time,
+        tbme.use_life use_life, tbme.belong_company_id belong_company_id, tbme.equipment_no equipment_no,
+        tbme.is_use, tbme.hill_number,tbc.company_name companyName,tbme.agent
         from
-          tb_mould_equipment tbme
+        tb_mould_equipment tbme
         left join
-          tb_company tbc
+        tb_company tbc
         on
-          tbme.belong_company_id = tbc.id
+        tbme.belong_company_id = tbc.id
         where
-          tbme.belong_company_id = #{belongCompanyId}
+        tbme.belong_company_id = #{belongCompanyId}
         and
         tbme.id not in
         <foreach item="item" index="index" collection="list"
@@ -59,18 +62,18 @@
     </select>
     <select id="getList" resultMap="BaseResultMapVO">
         select
-          tbme.id id, tbme.equipment_name equipment_name, tbme.start_time start_time, tbme.end_time end_time,tbme.agent,
-          tbme.use_life use_life, tbme.belong_company_id belong_company_id, tbme.equipment_no equipment_no,
-          tbme.is_use, tbme.hill_number,tbc.company_name companyName,tbm.model_no modelNo,tbm.model_name modelName
+        tbme.id id, tbme.equipment_name equipment_name, tbme.start_time start_time, tbme.end_time end_time,tbme.agent,
+        tbme.use_life use_life, tbme.belong_company_id belong_company_id, tbme.equipment_no equipment_no,
+        tbme.is_use, tbme.hill_number,tbc.company_name companyName,tbm.model_no modelNo,tbm.model_name modelName
         from
-          tb_mould_equipment tbme
+        tb_mould_equipment tbme
         left join
-          tb_mould tbm
+        tb_mould tbm
         on tbme.id = tbm.equipment_id
         left join
-          tb_company tbc
+        tb_company tbc
         on
-          tbme.belong_company_id = tbc.id
+        tbme.belong_company_id = tbc.id
         <where>
             <if test="companyId != null">
                 and tbme.belong_company_id = #{companyId}

+ 8 - 3
cloud-model/src/main/resources/mapper/MouldMapper.xml

@@ -71,6 +71,8 @@
         <result column="companyName" property="companyName"/>
         <result column="is_maintain" property="isMaintain" />
         <result column="holes" property="holes" />
+        <result column="lng" property="lng" />
+        <result column="lat" property="lat" />
         <result column="pre_update_id" property="preUpdateId" />
     </resultMap>
 
@@ -83,7 +85,8 @@
         tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbm.creator_id creator_id,tbm.equipment_id equipment_id,tbm.is_maintain,tbm.holes,
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbco.company_name produceCompany,tbm.pre_update_id,
         tbp.manager mangerName,tbm.area area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,
-        tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times
+        tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
+        tbmp.lng,tbmp.lat
         from
         tb_mould tbm
         left join
@@ -121,7 +124,8 @@
         tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbp.manager_id managerId,tbm.equipment_id equipment_id,is_maintain,
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.holes,tbm.pre_update_id,
         tbp.manager mangerName,tbm.area area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbm.creator_id creator_id,
-        tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times
+        tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
+        tbmp.lng,tbmp.lat
         from
         tb_mould tbm
         left join
@@ -184,7 +188,8 @@ select
         tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbm.creator_id creator_id,tbm.equipment_id equipment_id,tbm.is_maintain,tbm.holes,
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.pre_update_id,tbm.company_id,tbco.company_name produceCompany,tbm.produce_company_id,
         tbp.manager mangerName,tbm.area area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,
-        tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times
+        tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
+        tbmp.lng,tbmp.lat
         from
         tb_mould tbm
         left join