Browse Source

sz 台账 添加五个位置地址

xiao547607 5 năm trước cách đây
mục cha
commit
1a7252ac73

+ 1 - 0
common/src/main/java/com/jpsoft/smart/modules/base/dao/CompanyPositionDAO.java

@@ -13,6 +13,7 @@ public interface CompanyPositionDAO {
 	int exist(String id);
 	int exist(String id);
 	CompanyPosition get(String id);
 	CompanyPosition get(String id);
 	int delete(String id);
 	int delete(String id);
+	List<CompanyPosition> findByCompanyId(String companyId);
 	List<CompanyPosition> list();
 	List<CompanyPosition> list();
 	List<CompanyPosition> search(Map<String, Object> searchParams, List<Sort> sortList);
 	List<CompanyPosition> search(Map<String, Object> searchParams, List<Sort> sortList);
 }
 }

+ 1 - 0
common/src/main/java/com/jpsoft/smart/modules/base/service/CompanyPositionService.java

@@ -12,6 +12,7 @@ public interface CompanyPositionService {
 	int insert(CompanyPosition model);
 	int insert(CompanyPosition model);
 	int update(CompanyPosition model);
 	int update(CompanyPosition model);
 	int delete(String id);
 	int delete(String id);
+	List<CompanyPosition> findByCompanyId(String companyId);
 	List<CompanyPosition> list();
 	List<CompanyPosition> list();
 	Page<CompanyPosition> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
 	Page<CompanyPosition> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
 }
 }

+ 5 - 0
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/CompanyPositionServiceImpl.java

@@ -52,6 +52,11 @@ public class CompanyPositionServiceImpl implements CompanyPositionService {
 		
 		
 		return count > 0 ? true : false;
 		return count > 0 ? true : false;
 	}
 	}
+
+	@Override
+	public List<CompanyPosition> findByCompanyId(String companyId){
+		return companyPositionDAO.findByCompanyId(companyId);
+	}
 	
 	
 	@Override
 	@Override
 	public List<CompanyPosition> list() {
 	public List<CompanyPosition> list() {

+ 8 - 4
common/src/main/resources/mapper/base/CompanyPosition.xml

@@ -86,20 +86,20 @@
 	where id_=#{id}
 	where id_=#{id}
 	</update>
 	</update>
 	<select id="get" parameterType="string" resultMap="CompanyPositionMap">
 	<select id="get" parameterType="string" resultMap="CompanyPositionMap">
-		select 
-id_,company_id,position1_name,position2_name,position3_name,position4_name,position5_name,create_by,create_time,update_by,update_time,del_flag		from base_company_position where id_=#{0}
+		select * from base_company_position where id_=#{0} and del_flag = 0
 	</select>
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
 	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from base_company_position where id_=#{0}
+		select count(*) from base_company_position where id_=#{0} and del_flag = 0
 	</select>
 	</select>
 	<select id="list" resultMap="CompanyPositionMap">
 	<select id="list" resultMap="CompanyPositionMap">
-		select * from base_company_position
+		select * from base_company_position and del_flag = 0
 	</select>
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="CompanyPositionMap">
 	<select id="search" parameterType="hashmap" resultMap="CompanyPositionMap">
 		<![CDATA[
 		<![CDATA[
 			select * from base_company_position
 			select * from base_company_position
 		]]>
 		]]>
 		<where>
 		<where>
+			del_flag = 0
 			<if test="searchParams.companyId != null">
 			<if test="searchParams.companyId != null">
 				and company_id like #{searchParams.companyId}
 				and company_id like #{searchParams.companyId}
 			</if>
 			</if>
@@ -108,4 +108,8 @@ id_,company_id,position1_name,position2_name,position3_name,position4_name,posit
 	        ${sort.name} ${sort.order}
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	 	</foreach>
 	</select>
 	</select>
+
+	<select id="findByCompanyId" parameterType="string" resultMap="CompanyPositionMap">
+		select * from base_company_position where company_id=#{companyId} and del_flag = 0
+	</select>
 </mapper>
 </mapper>

+ 51 - 7
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceLogController.java

@@ -1,11 +1,13 @@
 package com.jpsoft.smart.modules.base.controller;
 package com.jpsoft.smart.modules.base.controller;
 
 
 
 
+import com.alipay.api.domain.Person;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.util.StringUtil;
 import com.github.pagehelper.util.StringUtil;
 import com.jpsoft.smart.config.OSSConfig;
 import com.jpsoft.smart.config.OSSConfig;
-import com.jpsoft.smart.modules.base.entity.DeviceInfo;
-import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
+import com.jpsoft.smart.modules.base.entity.*;
+import com.jpsoft.smart.modules.base.service.CompanyInfoService;
+import com.jpsoft.smart.modules.base.service.CompanyPositionService;
 import com.jpsoft.smart.modules.base.service.DeviceInfoService;
 import com.jpsoft.smart.modules.base.service.DeviceInfoService;
 import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
 import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
@@ -55,6 +57,13 @@ public class PersonDeviceLogController {
     @Autowired
     @Autowired
     private DeviceInfoService deviceInfoService;
     private DeviceInfoService deviceInfoService;
 
 
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
+    @Autowired
+    private CompanyPositionService companyPositionService;
+
+
     @ApiOperation(value="列表")
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     @ApiImplicitParams({
     @ApiImplicitParams({
@@ -178,13 +187,14 @@ public class PersonDeviceLogController {
                                 String timeRanges,String temperatureRanges,
                                 String timeRanges,String temperatureRanges,
                                 @RequestAttribute String subject) {
                                 @RequestAttribute String subject) {
         MessageResult<String> msgResult = new MessageResult<>();
         MessageResult<String> msgResult = new MessageResult<>();
-
         try {
         try {
+            User user = userService.get(subject);
+            String companyId = user.getCompanyId();
+
             HSSFWorkbook workbook = new HSSFWorkbook();
             HSSFWorkbook workbook = new HSSFWorkbook();
             HSSFSheet sheet = workbook.createSheet();
             HSSFSheet sheet = workbook.createSheet();
             //表头
             //表头
             HSSFRow rowTitle = sheet.createRow(0);
             HSSFRow rowTitle = sheet.createRow(0);
-
             HSSFCell cellTitle1 = rowTitle.createCell(0);
             HSSFCell cellTitle1 = rowTitle.createCell(0);
             cellTitle1.setCellValue("序号");
             cellTitle1.setCellValue("序号");
             HSSFCell cellTitle2 = rowTitle.createCell(1);
             HSSFCell cellTitle2 = rowTitle.createCell(1);
@@ -201,6 +211,27 @@ public class PersonDeviceLogController {
             cellTitle7.setCellValue("拍照图片");
             cellTitle7.setCellValue("拍照图片");
 
 
 
 
+            //获取公司
+            //五级位置
+            //CompanyInfo companyInfo = companyInfoService.get(companyId);
+            List<CompanyPosition> companyPositionList = companyPositionService.findByCompanyId(companyId);
+            CompanyPosition companyPosition = null;
+            if(companyPositionList.size() > 0){
+                companyPosition = companyPositionList.get(0);
+                HSSFCell cellTitle8 = rowTitle.createCell(7);
+                cellTitle8.setCellValue(companyPosition.getPosition1Name());
+                HSSFCell cellTitle9 = rowTitle.createCell(8);
+                cellTitle9.setCellValue(companyPosition.getPosition2Name());
+                HSSFCell cellTitle10 = rowTitle.createCell(9);
+                cellTitle10.setCellValue(companyPosition.getPosition3Name());
+                HSSFCell cellTitle11 = rowTitle.createCell(10);
+                cellTitle11.setCellValue(companyPosition.getPosition4Name());
+                HSSFCell cellTitle12 = rowTitle.createCell(11);
+                cellTitle12.setCellValue(companyPosition.getPosition5Name());
+            }
+
+
+
             //表内容
             //表内容
             Map<String,Object> searchParams = new HashMap<>();
             Map<String,Object> searchParams = new HashMap<>();
 
 
@@ -210,9 +241,6 @@ public class PersonDeviceLogController {
             //为公司管理员
             //为公司管理员
             boolean is_admin = userService.hasRole(subject,"ADMIN");
             boolean is_admin = userService.hasRole(subject,"ADMIN");
             if(is_admin){
             if(is_admin){
-                User user = userService.get(subject);
-                String companyId = user.getCompanyId();
-
                 List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
                 List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
                 List<String> deviceIdList = new ArrayList<String>();
                 List<String> deviceIdList = new ArrayList<String>();
                 if(deviceInfoList.size() > 0) {
                 if(deviceInfoList.size() > 0) {
@@ -308,6 +336,22 @@ public class PersonDeviceLogController {
                 HSSFCell cellContent7 = rowContent.createCell(6);
                 HSSFCell cellContent7 = rowContent.createCell(6);
                 cellContent7.setCellValue(personDeviceLog.getFaceImage());
                 cellContent7.setCellValue(personDeviceLog.getFaceImage());
 
 
+                //五级位置
+                //判断 如果公司没有五级位置 就不做展示
+                if(companyPositionList.size() > 0) {
+                    PersonInfo person = personDeviceLog.getPerson();
+                    HSSFCell cellContent8 = rowContent.createCell(7);
+                    cellContent8.setCellValue(person.getPosition1());
+                    HSSFCell cellContent9 = rowContent.createCell(8);
+                    cellContent9.setCellValue(person.getPosition2());
+                    HSSFCell cellContent10 = rowContent.createCell(9);
+                    cellContent10.setCellValue(person.getPosition3());
+                    HSSFCell cellContent11 = rowContent.createCell(10);
+                    cellContent11.setCellValue(person.getPosition4());
+                    HSSFCell cellContent12 = rowContent.createCell(11);
+                    cellContent12.setCellValue(person.getPosition5());
+                }
+
                 sheet.autoSizeColumn(i);
                 sheet.autoSizeColumn(i);
             }
             }