From 30b00beb142df4ac843930c2e3f3aec587933125 Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Tue, 10 Oct 2023 16:40:02 +0800 Subject: [PATCH] bug fix --- .../controller/BAdministrativeController.java | 2 +- .../controller/BPlanEnterpriseController.java | 25 ++++--- .../entity/BKeyEnterprise.java | 6 ++ .../entity/BPlanEnterprise.java | 6 +- .../mapper/BAdministrativeMapper.java | 9 ++- .../mapper/SzEntBasicInfoMapper.java | 9 +++ .../service/IBAdministrativeService.java | 9 ++- .../service/ISzEntBasicInfoService.java | 9 ++- .../impl/BAdministrativeServiceImpl.java | 5 ++ .../impl/BKeyEnterpriseServiceImpl.java | 7 ++ .../impl/SzEntBasicInfoServiceImpl.java | 5 ++ .../controller/system/SysLoginController.java | 5 ++ .../framework/config/SecurityConfig.java | 2 +- .../mapper/yingji/BAdministrativeMapper.xml | 75 +++++++++++++------ .../mapper/yingji/BKeyEnterpriseMapper.xml | 3 + .../mapper/yingji/BPlanEnterpriseMapper.xml | 27 +++---- .../mapper/yingji/SzEntBasicInfoMapper.xml | 10 ++- 17 files changed, 155 insertions(+), 59 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BAdministrativeController.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BAdministrativeController.java index e4b1ae5..823f83b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BAdministrativeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BAdministrativeController.java @@ -98,7 +98,7 @@ public class BAdministrativeController extends BaseController { BAdministrativeTreeRequest parentDto = new BAdministrativeTreeRequest(item1.getCounty(), item1.getSubdistrict(), item1.getInstitutionName()); for (BAdministrativeTreeRequest item2 : listsub) { if (item2.getSubdistrict()!=null && !item2.getSubdistrict().equals("")){ - if (item2.getSubdistrict().substring(0, 10).equals(item1.getCounty().substring(0, 10))) { + if (item2.getSubdistrict().substring(0, 7).equals(item1.getCounty().substring(0, 7))) { BAdministrativeTreeRequest childDto = new BAdministrativeTreeRequest(item2.getCounty(), item2.getSubdistrict(), item2.getInstitutionName()); parentDto.addChild(childDto); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BPlanEnterpriseController.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BPlanEnterpriseController.java index 29f35a7..caffbf1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BPlanEnterpriseController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/controller/BPlanEnterpriseController.java @@ -25,10 +25,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.io.Serializable; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * 计划企业表(BPlanEnterprise)表控制层 @@ -68,12 +65,12 @@ public class BPlanEnterpriseController extends BaseController { @GetMapping("/list") public AjaxResult list(BPlanEnterprise bPlanEnterprise) { List list = bPlanEnterpriseService.selectBPlanEnterpriseList(bPlanEnterprise); - for (BPlanEnterprise a :list){ + for (BPlanEnterprise a : list) { String enterPriseId = String.valueOf(a.getEnterpriseId()); BKeyEnterprise count = bKeyEnterpriseService.getByentCode(enterPriseId); if (count != null) { a.setIsPoint(1); - }else{ + } else { a.setIsPoint(2); } @@ -85,7 +82,7 @@ public class BPlanEnterpriseController extends BaseController { /** * 查询首页 */ - @ApiOperation(value = "查询首页",response =BPlanEnterPriseTreeResponse.class ) + @ApiOperation(value = "查询首页", response = BPlanEnterPriseTreeResponse.class) @GetMapping("/tree") public TableDataInfo tree(BPlanEnterprisePageRequest req) { @@ -96,7 +93,7 @@ public class BPlanEnterpriseController extends BaseController { int checkEnterpriseCountSum = list.stream() .mapToInt(BPlanEnterPriseTreeResponse::getCheckEnterpriseCount) .sum(); - double ptSum = (double) checkEnterpriseCountSum /plannedEnterpriseCountSum; + double ptSum = (double) checkEnterpriseCountSum / plannedEnterpriseCountSum; BPlanEnterPriseTreeResponse resultObject = new BPlanEnterPriseTreeResponse(); resultObject.setInstitutionName("苏州市"); resultObject.setPlannedEnterpriseCount(plannedEnterpriseCountSum); @@ -229,12 +226,20 @@ public class BPlanEnterpriseController extends BaseController { */ @ApiOperation(value = "导出计划管理") @PostMapping("/exportplan") - public void exportplan(HttpServletResponse response, BPlanEnterprise bPlanEnterprise) - { + public void exportplan(HttpServletResponse response, BPlanEnterprise bPlanEnterprise) { List list = bPlanEnterpriseService.selectBPlanEnterpriseList(bPlanEnterprise); + for (BPlanEnterprise a : list) { + String district = a.getDistrict(); + String county = district.substring(0, 7); + String paddedString = String.format("%s%s", county, "000000000"); + List countyList= bAdministrativeService.getBydistinct(district,paddedString); + String formattedData = String.join("-", countyList); + a.setDistrict(formattedData); + } ExcelUtil util = new ExcelUtil(BPlanEnterprise.class); - util.exportExcel(response, list, "计划管理数据"); + util.exportExcel(response,list, "计划管理数据"); } + /** * 查看计划明细 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BKeyEnterprise.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BKeyEnterprise.java index 1c3e5b8..5c28ff0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BKeyEnterprise.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BKeyEnterprise.java @@ -110,6 +110,12 @@ public class BKeyEnterprise implements Serializable { @Excel(name = "企业名称") private String enterpriseName; + /** + * 行政区划 + */ + @ApiModelProperty(value = "行政区划") + @Excel(name = "行政区划") + private String district; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BPlanEnterprise.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BPlanEnterprise.java index df99226..730a733 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BPlanEnterprise.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/entity/BPlanEnterprise.java @@ -54,9 +54,9 @@ public class BPlanEnterprise implements Serializable { /** * 创建时间 */ - @Excel(name = "年份", dateFormat = "yyyy/MM/dd HH:mm:ss") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "年份", dateFormat = "yyyy-MM-dd") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd ", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "创建时间") private Date createTime; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BAdministrativeMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BAdministrativeMapper.java index 5053d64..e02f80f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BAdministrativeMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BAdministrativeMapper.java @@ -82,5 +82,12 @@ public interface BAdministrativeMapper { List selectBPlanEnterPriseTreeRequestRequestList(@Param("req") BPlanEnterprisePageRequest req); - + /** + * 根据乡村,市区查询数据 + * + * @param district 乡村 + * @param paddedString 市区 + * @return + */ + List getBydistinct(@Param("district") String district, @Param("paddedString") String paddedString); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/SzEntBasicInfoMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/SzEntBasicInfoMapper.java index b262158..01f81dc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/SzEntBasicInfoMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/SzEntBasicInfoMapper.java @@ -70,4 +70,13 @@ public interface SzEntBasicInfoMapper extends BaseMapper { */ List page(@Param("req") SzEntBasicInfoPageRequest req); + + + /** + * 根据entcode获取行政区划代码 + * @param entCode 企业信用代码 + * @return + */ + String getDistrict(@Param("entCode") String entCode); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/IBAdministrativeService.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/IBAdministrativeService.java index bc23a59..e2a8744 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/IBAdministrativeService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/IBAdministrativeService.java @@ -82,5 +82,12 @@ public interface IBAdministrativeService { */ List selectcascadingSelectDataList(); - + /** + * 根据乡村,市区查询数据 + * + * @param district 乡村 + * @param paddedString 市区 + * @return + */ + List getBydistinct(String district, String paddedString); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/ISzEntBasicInfoService.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/ISzEntBasicInfoService.java index 61eb400..a639b7f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/ISzEntBasicInfoService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/ISzEntBasicInfoService.java @@ -1,9 +1,7 @@ package com.ruoyi.programManagement.service; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.programManagement.entity.SzEntBasicInfo; import com.ruoyi.programManagement.entity.request.SzEntBasicInfoPageRequest; -import com.ruoyi.programManagement.entity.response.SzEntBasicInfoPageResponse; import java.util.List; import java.util.Map; @@ -70,4 +68,11 @@ public interface ISzEntBasicInfoService { * @Parm req 请求类 */ Map page(SzEntBasicInfoPageRequest req); + + /** + * 根据entcode获取行政区划代码 + * @param entCode 企业信用代码 + * @return + */ + String getDistrict(String entCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BAdministrativeServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BAdministrativeServiceImpl.java index 3cd6647..223b870 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BAdministrativeServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BAdministrativeServiceImpl.java @@ -104,5 +104,10 @@ public class BAdministrativeServiceImpl implements IBAdministrativeService { return bAdministrativeMapper.selectcascadingSelectDataList(); } + @Override + public List getBydistinct(String district, String paddedString) { + return bAdministrativeMapper.getBydistinct(district,paddedString); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BKeyEnterpriseServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BKeyEnterpriseServiceImpl.java index 542b6ff..97f42fc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BKeyEnterpriseServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BKeyEnterpriseServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.programManagement.entity.BKeyEnterprise; import com.ruoyi.programManagement.entity.request.BKeyEnterprisePageRequest; import com.ruoyi.programManagement.mapper.BKeyEnterpriseMapper; import com.ruoyi.programManagement.service.BKeyEnterpriseService; +import com.ruoyi.programManagement.service.ISzEntBasicInfoService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -25,11 +26,17 @@ public class BKeyEnterpriseServiceImpl extends ServiceImpl bKeyEnterpriseList) { StringBuilder successMsg = new StringBuilder(); if (!bKeyEnterpriseList.isEmpty()) { for (BKeyEnterprise bKeyEnterprise : bKeyEnterpriseList) { + //根据entcode获取行政区划代码 + String entCode = bKeyEnterprise.getEntCode(); + bKeyEnterprise.setDistrict(iSzEntBasicInfoService.getDistrict(entCode)); baseMapper.bKeyEnterpriseAdd(bKeyEnterprise); } successMsg.append("导入成功"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/SzEntBasicInfoServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/SzEntBasicInfoServiceImpl.java index 048b7ef..339cac0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/SzEntBasicInfoServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/SzEntBasicInfoServiceImpl.java @@ -112,5 +112,10 @@ public class SzEntBasicInfoServiceImpl implements ISzEntBasicInfoService return result; } + @Override + public String getDistrict(String entCode) { + return szEntBasicInfoMapper.getDistrict(entCode); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index cefebbd..864f43b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -2,6 +2,9 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.Set; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -23,6 +26,7 @@ import com.ruoyi.system.service.ISysMenuService; * @author ruoyi */ @RestController +@Api("登录验证") public class SysLoginController { @Autowired @@ -57,6 +61,7 @@ public class SysLoginController * @param loginBody 登录信息 * @return 结果 */ + @ApiOperation("不带校验码登录方法") @PostMapping("/loginNoCaptcha") public AjaxResult loginNoCaptcha(@RequestBody LoginBody loginBody) { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index b06a6cb..2709e34 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").permitAll() + .antMatchers("/login", "/register", "/captchaImage","/loginNoCaptcha").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/pharmaceuticals/**/**").permitAll() diff --git a/ruoyi-system/src/main/resources/mapper/yingji/BAdministrativeMapper.xml b/ruoyi-system/src/main/resources/mapper/yingji/BAdministrativeMapper.xml index 96c5ace..8fb552d 100644 --- a/ruoyi-system/src/main/resources/mapper/yingji/BAdministrativeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/yingji/BAdministrativeMapper.xml @@ -52,32 +52,65 @@ + diff --git a/ruoyi-system/src/main/resources/mapper/yingji/BKeyEnterpriseMapper.xml b/ruoyi-system/src/main/resources/mapper/yingji/BKeyEnterpriseMapper.xml index e9799d3..c0e8967 100644 --- a/ruoyi-system/src/main/resources/mapper/yingji/BKeyEnterpriseMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/yingji/BKeyEnterpriseMapper.xml @@ -39,6 +39,9 @@ + + + diff --git a/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml b/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml index 8c6b0a1..41177e6 100644 --- a/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml @@ -73,7 +73,7 @@ END AS is_point FROM (SELECT b.*, a.plan_id FROM b_plan_enterprise a - LEFT JOIN sz_ent_basic_info b ON a.enterprise_id = b.USC_CODE) s + LEFT JOIN sz_ent_basic_info_new b ON a.enterprise_id = b.USC_CODE) s LEFT JOIN b_key_enterprise c ON s.USC_CODE = c.ent_code WHERE s.plan_id = #{planId} GROUP BY s.ENTPR_ID @@ -86,28 +86,22 @@ ( SELECT a.*, - d.ENTPR_NAME AS entprName, a.planned_year AS plannedYear, b.id AS longId, b.EXAMINE_START_TIME, b.EXAMINE_END_TIME, + b.ENTPR_NAME as entprName, CASE - WHEN b.USC_CODE IS NOT NULL THEN 1 + WHEN b.USC_CODE IS NOT NULL + AND SUBSTRING( a.planned_year, 1, 7 ) = SUBSTRING( b.EXAMINE_START_TIME, 1, 7 ) + THEN 1 ELSE 2 END AS checkStatus FROM b_plan_enterprise a LEFT JOIN sz_enfor_examine b ON a.enterprise_id = b.USC_CODE - LEFT JOIN sz_ent_basic_info d ON a.enterprise_id = d.USC_CODE - where ( - SUBSTRING(a.planned_year, 1, 4) >= EXTRACT(YEAR FROM b.EXAMINE_START_TIME) - AND SUBSTRING(a.planned_year, 6, 2) >= EXTRACT(MONTH FROM b.EXAMINE_START_TIME) - ) - AND - ( - SUBSTRING(a.planned_year, 1, 4) <= EXTRACT(YEAR FROM b.EXAMINE_END_TIME) - AND SUBSTRING(a.planned_year, 6, 2) <= EXTRACT(MONTH FROM b.EXAMINE_END_TIME) - ) + WHERE + b.USC_CODE IS NOT NULL ) s @@ -122,6 +116,7 @@ + diff --git a/ruoyi-system/src/main/resources/mapper/yingji/SzEntBasicInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/yingji/SzEntBasicInfoMapper.xml index 97609b8..a1ba8bf 100644 --- a/ruoyi-system/src/main/resources/mapper/yingji/SzEntBasicInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/yingji/SzEntBasicInfoMapper.xml @@ -322,10 +322,9 @@ a.*, CASE WHEN b.ent_code IS NOT NULL THEN 1 ELSE 2 END AS is_point FROM - sz_ent_basic_info a + sz_ent_basic_info_new a LEFT JOIN - b_key_enterprise b ON a.USC_CODE = b.ent_code where a.SUBDISTRICT like '%013205%' or a.SUBDISTRICT like - '%13205%')s + b_key_enterprise b ON a.USC_CODE = b.ent_code )s and s.USC_CODE=#{req.uscCode} and s.ENTPRCOLOR=#{req.entprColor} @@ -345,6 +344,11 @@ order by is_point asc + insert into sz_ent_basic_info