Przeglądaj źródła

添加姓名搜索

Signed-off-by: XU <2440975820@qq.com>
XU 11 miesięcy temu
rodzic
commit
60b7ffccc3

+ 11 - 3
src/main/java/thyyxxk/webserver/controller/technologyArchives/TechnologyArchivesController.java

@@ -71,6 +71,15 @@ public class TechnologyArchivesController {
     public ResultVo<List<TechnologyArchives1>> selectTechnologyArchives1(){
         return service.selectTechnologyArchives1();
     }
+    @GetMapping("/selectImage1")
+    public ResultVo<Map<String, Object>> selectImage1(@RequestParam("socialNo") String socialNo, @RequestParam("getTime") String getTime){
+        return  service.selectImage1(socialNo, getTime);
+    }
+
+    @GetMapping("/deleteImage1")
+    public ResultVo<Map<String, Object>> deleteImage1(@RequestParam("socialNo") String socialNo, @RequestParam("getTime") String getTime){
+        return  service.deleteImage1(socialNo, getTime);
+    }
 
     @PostMapping("/saveTechnologyArchives1")
     public ResultVo<Map<String, Object>> saveTechnologyArchives1(@RequestBody @Validated TechnologyArchives1 first){
@@ -79,9 +88,8 @@ public class TechnologyArchivesController {
 
     //上传图片
     @PostMapping("/putCertificateImage")
-    public ResultVo<JSONObject> putCertificateImage(@RequestBody MultipartFile file,
-                                                  @RequestParam(value = "socialNo") String socialNo) {
-        return service.putCertificateImage(file, socialNo);
+    public ResultVo<JSONObject> putCertificateImage(@RequestBody MultipartFile file,@RequestParam("getTime") String getTime) {
+        return service.putCertificateImage(file,getTime);
     }
 
     @GetMapping("/delTechnologyArchives1ByCode")

+ 12 - 4
src/main/java/thyyxxk/webserver/dao/his/technologyArchives/TechnologyArchives1Dao.java

@@ -5,11 +5,10 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.multipart.MultipartFile;
 import thyyxxk.webserver.entity.technologyArchives.TechnologyArchives1;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface TechnologyArchives1Dao extends BaseMapper<TechnologyArchives1> {
@@ -54,6 +53,15 @@ public interface TechnologyArchives1Dao extends BaseMapper<TechnologyArchives1>
     @Update(" delete from technology_archives1 where social_no = #{socialNo} and get_time = #{getTime} ")
     int delTechnologyArchives1ByCode(@Param("socialNo") String socialNo, @Param("getTime") String getTime);
 
-    @Update(" update technology_archives1 set image = #{url} where social_no = #{socialNo} ")
-    int updateCertificateImage(String socialNo, String url);
+    @Update(" update technology_archives1 set image = #{url} where get_time = #{getTime} ")
+    int updateCertificateImage(@Param("getTime") String getTime, String url);
+
+    @Select("select getTime from technology_archives1 where image = ${codeRs}  ")
+    String selectgetTimeByCodeRs(String codeRs);
+
+    @Select(" select image  from  technology_archives1 where social_no = #{socialNo} and get_time = #{getTime}")
+    Map<String, Object> selectImage(@Param("socialNo") String socialNo, @Param("getTime") String getTime);
+
+    @Update(" update technology_archives1 set image = null  where social_no = #{socialNo} and get_time = #{getTime}")
+    int deleteImage(@Param("socialNo") String socialNo, @Param("getTime") String getTime);
 }

+ 7 - 1
src/main/java/thyyxxk/webserver/dao/his/technologyArchives/TechnologyArchivesDao.java

@@ -21,10 +21,16 @@ import java.util.Map;
 @Mapper
 public interface TechnologyArchivesDao extends BaseMapper<TechnologyArchivesType> {
 
+//    @Select(" select top 1 rtrim(mi.name) as name, rtrim(mi.sex_code) as sex, rtrim(mi.social_no) as socialNo, " +
+//            "   rtrim(mi.phone_no) as phone, convert(varchar(7), mi.birth_date, 23) as birthday, rtrim(mi.code) as account " +
+//            " from a_employee_mi as mi   " +
+//            " where mi.code = #{text} or mi.code_rs = #{text} or mi.social_no = #{text} ")
+//    TechnologyArchivesMain selectEmployeeInfo(@Param("text") String text);
+
     @Select(" select top 1 rtrim(mi.name) as name, rtrim(mi.sex_code) as sex, rtrim(mi.social_no) as socialNo, " +
             "   rtrim(mi.phone_no) as phone, convert(varchar(7), mi.birth_date, 23) as birthday, rtrim(mi.code) as account " +
             " from a_employee_mi as mi   " +
-            " where mi.code = #{text} or mi.code_rs = #{text} or mi.social_no = #{text} ")
+            " where mi.code = #{text} or mi.code_rs = #{text} or mi.social_no = #{text} or mi.name = #{text} ")
     TechnologyArchivesMain selectEmployeeInfo(@Param("text") String text);
 
     @Select("select rtrim(code) as code, rtrim(name) as name from zd_sex_code with(nolock)")

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/technologyArchives/TechnologyArchivesMainDao.java

@@ -13,7 +13,7 @@ import java.util.Map;
 @Mapper
 public interface TechnologyArchivesMainDao extends BaseMapper<TechnologyArchivesMain> {
 
-    @Select(" select * from technology_archives_main where social_no = #{socialNo} or account = #{socialNo} ")
+    @Select(" select * from technology_archives_main where social_no = #{socialNo} or account = #{socialNo} or name = #{socialNo} ")
     TechnologyArchivesMain selectTechnologyArchivesMainBySocialNo(@Param("socialNo") String socialNo);
 
     @Update("<script>" +

+ 48 - 7
src/main/java/thyyxxk/webserver/service/technologyArchives/TechnologyArchivesService.java

@@ -137,9 +137,9 @@ public class TechnologyArchivesService {
     }
 
     /**
-     * @Description 根据工号或者身份证号查询基本信息
+     * @Description 根据工号或者身份证号或姓名查询基本信息
      * @Author hsh
-     * @param text 工号或者身份证号
+     * @param text 工号或者身份证号或姓名
      * @return TechnologyArchivesMain
      * @Date 2024/7/8 10:51
      */
@@ -162,6 +162,11 @@ public class TechnologyArchivesService {
         if(null != m2){
             return ResultVoUtil.success(m2);
         }
+        //添加姓名搜索
+        TechnologyArchivesMain m3 = mainDao.selectTechnologyArchivesMainBySocialNo(m.getName());
+        if(null != m3){
+            return ResultVoUtil.success(m3);
+        }
         return ResultVoUtil.success(m);
     }
 
@@ -238,6 +243,36 @@ public class TechnologyArchivesService {
         return ResultVoUtil.success(list);
     }
 
+    //查找图片
+    public ResultVo<Map<String,Object>> selectImage1(String socialNo, String getTime) {
+        //为每张图片设置编号
+//        for(int i = 0; i < imagelist.size(); i++){
+//            imagelist.get(i).setImagenum(i+1); //从1开始计数
+//        }
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> imgMap = firstDao.selectImage(socialNo, getTime);
+        map.put("data", imgMap);
+        return ResultVoUtil.success(map);
+    }
+
+    //删除图片
+    public ResultVo<Map<String,Object>> deleteImage1(String socialNo, String getTime) {
+        if (StringUtil.isBlank(socialNo) || StringUtil.isBlank(getTime)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有身份证号或者批准时间,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            int num = firstDao.deleteImage(socialNo, getTime);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除图片失败!");
+            }
+            resultMap.put("cg", "删除图片成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除图片失败!");
+        }
+    }
     /**
      * @Description 更新专业技术职称晋升情况
      * @Author hsh
@@ -278,8 +313,7 @@ public class TechnologyArchivesService {
     //职称证书图片
     @Value("${is-prod}")
     private boolean isProd;
-
-    public ResultVo<JSONObject> putCertificateImage(MultipartFile file, String socialNo) {
+    public ResultVo<JSONObject> putCertificateImage(MultipartFile file,String getTime) {
 
         String uploadDir;
         if (isProd) {
@@ -303,10 +337,11 @@ public class TechnologyArchivesService {
             if (fileName != null) {
                 filePath = uploadPath.resolve(fileName);
             }
+            //
             Files.copy(file.getInputStream(), filePath, StandardCopyOption.REPLACE_EXISTING);
-            log.info("文件:{}, socialNo:{}", file.getName(), socialNo);
+            log.info("文件:{}", fileName);
             String url = "http://172.16.30.8:8077/certificateImage/" + fileName;
-            int num =firstDao.updateCertificateImage(socialNo,url);
+            firstDao.updateCertificateImage(getTime,url);
             js.put("url", url);
             js.put("name", fileName);
             return ResultVoUtil.success(js);
@@ -1624,6 +1659,7 @@ public class TechnologyArchivesService {
         } else {
             // 查询所有的文档
             String sfz = null;
+            String xm = null;
             if(StringUtil.notBlank(vo.getText())){
                 TechnologyArchivesMain mainSelf = mainDao.selectTechnologyArchivesMainBySocialNo(vo.getText());
                 if(null == mainSelf || StringUtil.isBlank(mainSelf.getSocialNo())){
@@ -1637,6 +1673,7 @@ public class TechnologyArchivesService {
                 if(StringUtil.isBlank(sfz)){
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有检索到查询技术档案的身份证信息,请检查!");
                 }
+
             }
             if(t.getTableName().endsWith("main")){
                 if(StringUtil.notBlank(sql)){
@@ -1786,7 +1823,11 @@ public class TechnologyArchivesService {
         List<HeadInfo> sortHeadInfo = headInfoList.stream().sorted(Comparator.comparing(HeadInfo::getSort)).collect(Collectors.toList());
 
         // 导出
-        ExcelUtil.exportExcelReport(response, list, sortHeadInfo, exportName);
+        if(true){
+            ExcelUtil.exportExcelReport(response, list, sortHeadInfo, exportName);
+            return null;
+        }
+
 
         map.put("code", 0);
         map.put("massage", "导出成功!");