mitao
2025-03-18 aff4d9bea541a179f7bd0c4b318a864c54bd7ca4
bug修改
5个文件已修改
95 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintAuditRecord.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/utils/BaiduMapUtil.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java
@@ -1,6 +1,7 @@
package com.panzhihua.sangeshenbian.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.controller.BaseController;
@@ -110,7 +111,15 @@
    public R<JSONArray> searchLocation(String query, String location) {
        return R.ok(BaiduMapUtil.searchLocation(query, location));
    }
    @GetMapping("/geoconv")
    @ApiOperation("百度地图经纬度转换")
    public R<JSONObject> geoconv(String coords) {
        try {
            return R.ok(BaiduMapUtil.geoconv(coords));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    /**
     * 获取身份信息
     */
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintAuditRecord.java
@@ -116,4 +116,11 @@
    @TableField("sort")
    private Integer sort;
    @ApiModelProperty("审核人")
    @TableField("auditor_name")
    private String auditorName;
    @ApiModelProperty("审核人联系方式")
    @TableField("auditor_phone")
    private String auditorPhone;
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -33,6 +33,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -810,6 +811,8 @@
        if (Objects.isNull(complaintAuditRecord)) {
            throw new ServiceException("上报申请记录不存在");
        }
        complaintAuditRecord.setAuditorName(systemUser.getName());
        complaintAuditRecord.setAuditorPhone(systemUser.getPhone());
        if (complaintReporAuditDTO.getAuditResult().equals(1)) {
            complaintAuditRecord.setAuditStatus(1);
            complaintAuditRecord.setAuditorId(loginUserInfoVO.getUserId());
@@ -1238,8 +1241,8 @@
        response.setContentType("application/octet-stream");
        String fileNameEncode = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
        response.setHeader("Content-disposition", "attachment;filename=\"" + fileNameEncode + ".docx" + "\"");
        String fileTemplateName = FileUtil.getPath() + "template/" + fileName + ".docx";
        XWPFTemplate.compile(fileTemplateName).render(map).writeAndClose(response.getOutputStream());
        ClassPathResource resource = new ClassPathResource("template/" + fileName + ".docx");
        XWPFTemplate.compile(resource.getFile()).render(map).writeAndClose(response.getOutputStream());
    }
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/utils/BaiduMapUtil.java
@@ -20,21 +20,23 @@
@Slf4j
public class BaiduMapUtil {
    public static String URL = "https://api.map.baidu.com/place/v2/search?";
    public static String GEOCONV_URL = "https://api.map.baidu.com/geoconv/v2/?";
    public static String AK = "3mHKIXMArjgIkgADzOlTYp4XssNSNkwr";
    public static void main(String[] args) throws Exception {
        Map params = new LinkedHashMap<String, String>();
        params.put("query", "银行");
        params.put("location", "39.915,116.404");
        params.put("radius", "2000");
        params.put("output", "json");
        params.put("ak", AK);
        requestGetAK(URL, params);
        //Map params = new LinkedHashMap<String, String>();
        //params.put("query", "银行");
        //params.put("location", "39.915,116.404");
        //params.put("radius", "2000");
        //params.put("output", "json");
        //params.put("ak", AK);
        //
        //
        //requestGetAK(URL, params);
        System.out.println(geoconv("116.390838,39.916245").toJSONString());
    }
    /**
@@ -102,4 +104,48 @@
        }
        return jsonArray;
    }
    public static JSONObject requestGetAKObject(String strUrl, Map<String, String> param) throws Exception {
        if (strUrl == null || strUrl.length() <= 0 || param == null || param.size() <= 0) {
            return new JSONObject();
        }
        StringBuffer queryString = new StringBuffer();
        queryString.append(strUrl);
        for (Map.Entry<?, ?> pair : param.entrySet()) {
            queryString.append(pair.getKey() + "=");
            //    第一种方式使用的 jdk 自带的转码方式  第二种方式使用的 spring 的转码方法 两种均可
            //    queryString.append(URLEncoder.encode((String) pair.getValue(), "UTF-8").replace("+", "%20") + "&");
            queryString.append(UriUtils.encode((String) pair.getValue(), "UTF-8") + "&");
        }
        if (queryString.length() > 0) {
            queryString.deleteCharAt(queryString.length() - 1);
        }
        java.net.URL url = new URL(queryString.toString());
        System.out.println(queryString.toString());
        URLConnection httpConnection = (HttpURLConnection) url.openConnection();
        httpConnection.connect();
        InputStreamReader isr = new InputStreamReader(httpConnection.getInputStream());
        BufferedReader reader = new BufferedReader(isr);
        StringBuffer buffer = new StringBuffer();
        String line;
        while ((line = reader.readLine()) != null) {
            buffer.append(line);
        }
        reader.close();
        isr.close();
        return JSONObject.parseObject(buffer.toString());
    }
    public static JSONObject geoconv(String coords) throws Exception {
        Map params = new LinkedHashMap<String, String>();
        params.put("coords", coords);
        params.put("output", "json");
        params.put("model", "2");
        params.put("ak", AK);
        return requestGetAKObject(GEOCONV_URL, params);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -204,12 +204,12 @@
        scar.department_name,
        scar.department_id,
        scar.comment,
        scar.auditor_name,
        scar.auditor_phone,
        ifnull((select a.create_time from sgsb_complaint_audit_record a where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") AS auditTime,
        ifnull((select a.reject_reason from sgsb_complaint_audit_record a where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") as rejectReason,
        su.nick_name,
        su.phone,
        ifnull((select b.nick_name from sgsb_complaint_audit_record a left join sys_user b on (a.create_by = b.user_id) where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") AS auditorName,
        ifnull((select b.phone from sgsb_complaint_audit_record a left join sys_user b on (a.create_by = b.user_id) where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") AS auditorPhone
        su.phone
        FROM sgsb_complaint sc
        LEFT JOIN sys_user su ON su.user_id = sc.create_by
        LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1