新增根据行政区划代码查询项目列表接口。
This commit is contained in:
		| @@ -4,7 +4,6 @@ import cn.hutool.http.HttpRequest; | ||||
| import cn.hutool.http.HttpUtil; | ||||
| import cn.hutool.json.JSONObject; | ||||
| import cn.hutool.json.JSONUtil; | ||||
| import com.fastbee.common.exception.ServiceException; | ||||
| import com.google.zxing.BarcodeFormat; | ||||
| import com.google.zxing.EncodeHintType; | ||||
| import com.google.zxing.MultiFormatWriter; | ||||
|   | ||||
| @@ -133,7 +133,6 @@ public class ProjectController extends BaseController | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 查询项目管理机构的当前管理的行政区划树状列表 | ||||
|      */ | ||||
| @@ -150,4 +149,13 @@ public class ProjectController extends BaseController | ||||
|     public AjaxResult getProjectAreaTreeTop(@Param("projectId") Long deptId,@Param("startLevel") Integer startLevel){ | ||||
|         return success(projectService.getProjectAreaTreeAll(deptId, startLevel)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据行政区划信息查询项目列表 | ||||
|      */ | ||||
|     @GetMapping("/projectListByArea") | ||||
|     @ApiOperation("根据行政区划信息查询项目列表") | ||||
|     public AjaxResult getProjectListByArea(@Param("areaCode") Long areaCode){ | ||||
|         return success(projectService.getProjectListByArea(areaCode)); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import com.fastbee.common.core.domain.BaseEntity; | ||||
|  * 设备上电审核前上报的基础信息对象 iot_device_report_info | ||||
|  * | ||||
|  * @author kerwincui | ||||
|  * @date 2024-12-10 | ||||
|  * @date 2024-12-11 | ||||
|  */ | ||||
| @ApiModel(value = "DeviceReportInfo",description = "设备上电审核前上报的基础信息 iot_device_report_info") | ||||
| @Data | ||||
| @@ -110,4 +110,19 @@ public class DeviceReportInfo extends BaseEntity | ||||
|     @ApiModelProperty("设备名称") | ||||
|     private String name; | ||||
|  | ||||
|     /** lcd厂家名称 */ | ||||
|     @Excel(name = "lcd厂家名称") | ||||
|     @ApiModelProperty("lcd厂家名称") | ||||
|     private String lcdManufacturerName; | ||||
|  | ||||
|     /** 语音厂家名称 */ | ||||
|     @Excel(name = "语音厂家名称") | ||||
|     @ApiModelProperty("语音厂家名称") | ||||
|     private String voiceManufacturerName; | ||||
|  | ||||
|     /** 代工厂家名称 */ | ||||
|     @Excel(name = "代工厂家名称") | ||||
|     @ApiModelProperty("代工厂家名称") | ||||
|     private String replaceManufacturerName; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -23,10 +23,13 @@ | ||||
|         <result property="serialNumber"    column="serial_number"    /> | ||||
|         <result property="qrCode"    column="qr_code"    /> | ||||
|         <result property="name"    column="name"    /> | ||||
|         <result property="lcdManufacturerName"    column="lcd_manufacturer_name"    /> | ||||
|         <result property="voiceManufacturerName"    column="voice_manufacturer_name"    /> | ||||
|         <result property="replaceManufacturerName"    column="replace_manufacturer_name"    /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectDeviceReportInfoVo"> | ||||
|         select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name from iot_device_report_info | ||||
|         select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name from iot_device_report_info | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult"> | ||||
| @@ -49,6 +52,9 @@ | ||||
|             <if test="serialNumber != null  and serialNumber != ''"> and serial_number = #{serialNumber}</if> | ||||
|             <if test="qrCode != null  and qrCode != ''"> and qr_code = #{qrCode}</if> | ||||
|             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> | ||||
|             <if test="lcdManufacturerName != null  and lcdManufacturerName != ''"> and lcd_manufacturer_name like concat('%', #{lcdManufacturerName}, '%')</if> | ||||
|             <if test="voiceManufacturerName != null  and voiceManufacturerName != ''"> and voice_manufacturer_name like concat('%', #{voiceManufacturerName}, '%')</if> | ||||
|             <if test="replaceManufacturerName != null  and replaceManufacturerName != ''"> and replace_manufacturer_name like concat('%', #{replaceManufacturerName}, '%')</if> | ||||
|         </where> | ||||
|     </select> | ||||
|  | ||||
| @@ -77,6 +83,9 @@ | ||||
|             <if test="serialNumber != null">serial_number,</if> | ||||
|             <if test="qrCode != null">qr_code,</if> | ||||
|             <if test="name != null">name,</if> | ||||
|             <if test="lcdManufacturerName != null">lcd_manufacturer_name,</if> | ||||
|             <if test="voiceManufacturerName != null">voice_manufacturer_name,</if> | ||||
|             <if test="replaceManufacturerName != null">replace_manufacturer_name,</if> | ||||
|         </trim> | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|             <if test="imei != null and imei != ''">#{imei},</if> | ||||
| @@ -96,6 +105,9 @@ | ||||
|             <if test="serialNumber != null">#{serialNumber},</if> | ||||
|             <if test="qrCode != null">#{qrCode},</if> | ||||
|             <if test="name != null">#{name},</if> | ||||
|             <if test="lcdManufacturerName != null">#{lcdManufacturerName},</if> | ||||
|             <if test="voiceManufacturerName != null">#{voiceManufacturerName},</if> | ||||
|             <if test="replaceManufacturerName != null">#{replaceManufacturerName},</if> | ||||
|         </trim> | ||||
|     </insert> | ||||
|  | ||||
| @@ -119,6 +131,9 @@ | ||||
|             <if test="serialNumber != null">serial_number = #{serialNumber},</if> | ||||
|             <if test="qrCode != null">qr_code = #{qrCode},</if> | ||||
|             <if test="name != null">name = #{name},</if> | ||||
|             <if test="lcdManufacturerName != null">lcd_manufacturer_name = #{lcdManufacturerName},</if> | ||||
|             <if test="voiceManufacturerName != null">voice_manufacturer_name = #{voiceManufacturerName},</if> | ||||
|             <if test="replaceManufacturerName != null">replace_manufacturer_name = #{replaceManufacturerName},</if> | ||||
|         </trim> | ||||
|         where id = #{id} | ||||
|     </update> | ||||
|   | ||||
| @@ -78,4 +78,10 @@ public interface IProjectService | ||||
|  | ||||
|     List<SysDistrict>  getProjectAreaTreeAll(Long deptId, Integer startLevel); | ||||
|  | ||||
|     /** | ||||
|      * 根据行政区划代码获取项目列表 | ||||
|      * @param areaCode | ||||
|      * @return | ||||
|      */ | ||||
|     List<Project> getProjectListByArea(Long areaCode); | ||||
| } | ||||
|   | ||||
| @@ -34,6 +34,7 @@ import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.*; | ||||
| import java.util.concurrent.atomic.AtomicBoolean; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| /** | ||||
| @@ -178,7 +179,6 @@ public class ProjectServiceImpl implements IProjectService | ||||
|                                 .toArray(Long[]::new); | ||||
|                         //根据项目类型过滤菜单 | ||||
|  | ||||
|  | ||||
|                         if (Objects.equals(project.getType(),ProjectTypeConstant.WATER)) { | ||||
|                               List<Long> menuList=Arrays.asList(menuIdList); | ||||
|                               menuIdList = menuList.stream().filter(this::waterMenuFilter).toArray(Long[]::new); | ||||
| @@ -257,8 +257,6 @@ public class ProjectServiceImpl implements IProjectService | ||||
|        } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|         /** | ||||
|          * 解析项目行政区划信息 | ||||
|          * @param project 项目 | ||||
| @@ -309,9 +307,7 @@ public class ProjectServiceImpl implements IProjectService | ||||
|                                  //保存项目村代码列表 | ||||
|                                  villageCodeList.add(administrativeArea.get(4).toString()); | ||||
|                          } | ||||
|  | ||||
|                 }); | ||||
|  | ||||
|                 //设置项目省、市、县、镇、村行政区划代码列表 | ||||
|                 project.setProvinceCode(JSONUtil.toJsonStr(provincialCodeList)); | ||||
|                 project.setCityCode(JSONUtil.toJsonStr(cityCodeList)); | ||||
| @@ -640,6 +636,35 @@ public class ProjectServiceImpl implements IProjectService | ||||
|                 return Collections.singletonList(sysDistricts.get(0)); | ||||
|         } | ||||
|  | ||||
|         @Override | ||||
|         public List<Project> getProjectListByArea(Long areaCode) { | ||||
|                 //查询全部项目列表 | ||||
|                 List<Project> projectAllList = new LambdaQueryChainWrapper<>(projectMapper) | ||||
|                         .select(Project::getId, Project::getProjectName, Project::getAdministrativeAreaCode) | ||||
|                         .list(); | ||||
|                 //根据行政区划过滤 | ||||
|                 System.err.println("项目行政区划代码列表:"+projectAllList.size()); | ||||
|                 //过滤后项目列表 | ||||
|                 List<Project> projectFilterList =new ArrayList<>(); | ||||
|                 for (Project project : projectAllList) { | ||||
|                         String administrativeAreaCode = project.getAdministrativeAreaCode(); | ||||
|                         if(StringUtils.isNotBlank(administrativeAreaCode)){ | ||||
|                                 JSONArray areaCodeArrays = JSONUtil.parseArray(administrativeAreaCode); | ||||
|                                 if(!areaCodeArrays.isEmpty()){ | ||||
|                                         JSONArray areaCodeArray = JSONUtil.parseArray(areaCodeArrays.get(0)); | ||||
|                                         for (Object o : areaCodeArray) { | ||||
|                                                 if(o.equals(areaCode)){ | ||||
|                                                         projectFilterList.add(project); | ||||
|                                                 } | ||||
|                                         } | ||||
|                                 } | ||||
|  | ||||
|                         } | ||||
|  | ||||
|                 } | ||||
|  | ||||
|                 return projectFilterList; | ||||
|         } | ||||
|  | ||||
|  | ||||
|         /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 mi9688
					mi9688