roose %!s(int64=2) %!d(string=hai) anos
pai
achega
d4a0dd2b2e

+ 3 - 3
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/domain/ZnylBjqz.java

@@ -24,7 +24,7 @@ public class ZnylBjqz extends BaseEntity
     /** 监护对象id */
     @ApiModelProperty(value = "监护对象id")
     @Excel(name = "监护对象id")
-    private String wardid;
+    private Long wardid;
 
     /** 分类(B0007) */
     @ApiModelProperty(value = "分类")
@@ -113,12 +113,12 @@ public class ZnylBjqz extends BaseEntity
     {
         return id;
     }
-    public void setWardid(String wardid)
+    public void setWardid(Long wardid)
     {
         this.wardid = wardid;
     }
 
-    public String getWardid()
+    public Long getWardid()
     {
         return wardid;
     }

+ 161 - 0
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/miniapp/ApiExample.java

@@ -0,0 +1,161 @@
+package com.ruoyi.resource.miniapp;
+
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import io.swagger.annotations.Api;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import static com.ruoyi.resource.miniapp.ApiUtils.getTimeOffset;
+import static com.ruoyi.resource.miniapp.ApiUtils.sign;
+
+public class ApiExample {
+    public static void main(String args[]) throws Exception {
+        httpGetExample();
+        httpPostExample();
+    }
+    /**
+     * 电信云平台 -- http GET请求示例
+     */
+    public static void httpGetExample() throws Exception {
+        String secret = "FJDq8agNp5";// 密钥,到控制台->应用管理打开应用可以找到此值
+        String application = "91Ebv1S0HBb";// appKey,到应用管理打开应用可以找到此值
+        String version = "20181031202055";// api版本,到文档中心->使能平台API文档打开要调用的api可以找到此值
+        String MasterKey = "25ce00cc28c1498c833276110ee483f0";// MasterKey,在产品中心打开对应的产品查看此值
+        HttpResponse response = null;
+        CloseableHttpClient httpClient = null;
+        httpClient = HttpClientBuilder.create().build();
+        long offset = getTimeOffset();// 获取时间偏移量,方法见前面
+        // 下面示例以根据产品ID查询产品信息的API为例【具体信息请以使能平台的API文档为准】。
+        // 构造请求的URL,具体参考文档中心->API文档中的请求地址和访问路径
+        URIBuilder uriBuilder = new URIBuilder();
+        uriBuilder.setScheme("https");// 请求用的协议,http或者https
+        uriBuilder.setHost("ag-api.ctwing.cn/aep_product_management");//请求地址
+        uriBuilder.setPath("/product");//访问路径,可以在API文档中对应的API中找到此访问路径
+        // 在请求的URL中添加参数,具体参考文档中心->API文档中“请求参数”说明
+        // (如果有MasterKey,将MasterKey加到head中,不加在此处)
+        uriBuilder.addParameter("productId", "9392");
+        HttpGet httpGet = new HttpGet(uriBuilder.build());//构造get请求
+        long timestamp = System.currentTimeMillis() + offset;// 获取时间戳
+        Date date = new Date(timestamp);
+        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
+        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
+        String dataString = dateFormat.format(date);// 生成格式化的日期字符串
+        // head中添加公共参数,具体参考文档中心->API文档中“公共参数”里的公共请求参数
+        // httpGet.addHeader("MasterKey", MasterKey);// MasterKey加在此处head中
+        httpGet.addHeader("application", application);
+        httpGet.addHeader("timestamp", "" + timestamp);
+        httpGet.addHeader("version", version);
+        httpGet.addHeader("Content-Type", "application/json; charset=UTF-8");
+        httpGet.addHeader("Date", dataString);
+        // 下列注释的head暂时未用到
+        // httpGet.addHeader("sdk", "GIT: a4fb7fca");
+        // httpGet.addHeader("Accept", "gzip,deflate");
+        // httpGet.addHeader("User-Agent", "Telecom API Gateway Java SDK");
+        // 构造签名需要的参数,如果参数中有MasterKey,则添加来参与签名计算,其他参数根据实际API从URL中获取
+        Map<String, String> param = new HashMap<String, String>();
+        // param.put("MasterKey", MasterKey);
+        // 从URL中获取参数加到param中
+        List<NameValuePair> list = uriBuilder.getQueryParams();
+        for (int i = 0; i < list.size(); i++)
+            param.put(list.get(i).getName(), list.get(i).getValue());
+        // 添加签名
+        httpGet.addHeader("signature", sign(param, timestamp, application, secret, null));
+        System.out.println(httpGet.getURI());
+        try {
+            // 发送请求
+            response = httpClient.execute(httpGet);
+            // 从response获取响应结果
+            System.out.println(new String(EntityUtils.toByteArray(response.getEntity())));
+            httpClient.close();
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+    /**
+     * 电信云平台 -- http POST请求示例
+     */
+    public static void httpPostExample() throws Exception {
+//        // CH的
+//        String secret = "3Ee7KJr5pe";
+//        String application = "BSdpzh2hBl3";
+//        String version = "20181031202156";
+//        String MasterKey = "8dd6dbf8035d4a0da6974bf3c48d9daa";
+        String secret = "FJDq8agNp5";//密钥,到控制台->应用管理打开应用可以找到此值
+        String application = "91Ebv1S0HBb";//appKey,到控制台->应用管理打开应用可以找到此值
+        String version = "20181031202117";//api版本,到文档中心->使能平台API文档打开要调用的api可以找到版本值
+        String MasterKey = "25ce00cc28c1498c833276110ee483f0";//MasterKey,在产品中心打开对应的产品查看此值
+        // 下面以增加设备的API为例【具体信息请以使能平台的API文档为准】。
+        //请求BODY,到文档中心->使能平台API文档打开要调用的api中,在“请求BODY”中查看
+        String bodyString = "{\"deviceName\":\"testDevice\",\"deviceSn\":\"\",\"imei\":123456789012345,\"operator\":\"admin\",\"productId\":\"9392\"}";
+        CloseableHttpClient httpClient = null;
+        HttpResponse response = null;
+        httpClient = HttpClientBuilder.create().build();
+        long offset = getTimeOffset();// 获取时间偏移量,方法见前面
+        // 构造请求的URL,具体参考文档中心->使能平台API文档中的请求地址和访问路径
+        URIBuilder uriBuilder = new URIBuilder();
+        uriBuilder.setScheme("https");
+        uriBuilder.setHost("ag-api.ctwing.cn/aep_device_management"); //请求地址
+        uriBuilder.setPath("/device"); //访问路径,可以在API文档中对应API中找到此访问路径
+        // 在请求的URL中添加参数,具体参考文档中心->API文档中请求参数说明
+        // (如果有MasterKey,将MasterKey加到head中,不加在此处)
+        //uriBuilder.addParameter("productId", "9392");//如果没有其他参数,此行不要
+        HttpPost httpPost = new HttpPost(uriBuilder.build());//构造post请求
+        long timestamp = System.currentTimeMillis() + offset;// 获取时间戳
+        Date date = new Date(timestamp);
+        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
+        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
+        String dataString = dateFormat.format(date);// 生成格式化的日期字符串
+        // head中添加公共参数
+        httpPost.addHeader("MasterKey", MasterKey);// MasterKey加在此处head中
+        httpPost.addHeader("application", application);
+        httpPost.addHeader("timestamp", "" + timestamp);
+        httpPost.addHeader("version", version);
+        httpPost.addHeader("Content-Type", "application/json; charset=UTF-8");
+        httpPost.addHeader("Date", dataString);
+        // 下列注释的head暂时未用到
+        // httpPost.addHeader("sdk", "GIT: a4fb7fca");
+        // httpPost.addHeader("Accept", "gzip,deflate");
+        // httpPost.addHeader("User-Agent", "Telecom API Gateway Java SDK");
+        // 构造签名需要的参数,如果参数中有MasterKey,则添加来参与签名计算,
+        // 其他参数根据实际API从URL中获取,如有其他参数,写法参考get示例
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("MasterKey", MasterKey);
+        // 添加签名
+        httpPost.addHeader("signature", sign(param, timestamp, application, secret, bodyString.getBytes()));
+        //请求添加body部分
+        httpPost.setEntity(new StringEntity(bodyString,"utf-8"));
+        try {
+            // 发送请求
+            response = httpClient.execute(httpPost);
+            // 从response获取响应结果
+            System.out.println(new String(EntityUtils.toByteArray(response.getEntity())));
+            httpClient.close();
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+}

+ 95 - 0
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/miniapp/ApiUtils.java

@@ -0,0 +1,95 @@
+package com.ruoyi.resource.miniapp;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeSet;
+
+public class ApiUtils {
+
+    /**
+     * 时间修正
+     * @return
+     */
+    public static long getTimeOffset() {
+        long offset = 0;
+        HttpResponse response = null;
+        //构造httpGet请求
+        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+        HttpGet httpTimeGet = new HttpGet("https://ag-api.ctwing.cn/echo");
+        try {
+            long start = System.currentTimeMillis();
+            response = httpClient.execute(httpTimeGet);
+            long end = System.currentTimeMillis();
+            //时间戳在返回的响应的head的x-ag-timestamp中
+            Header[] headers = response.getHeaders("x-ag-timestamp");
+            if (headers.length > 0) {
+                long serviceTime = Long.parseLong(headers[0].getValue());
+                offset = serviceTime - (start + end) / 2L;
+            }
+            httpClient.close();
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return offset;
+    }
+
+    /**
+     * @param param    api 配置参数表
+     * @param timestamp UNIX格式时间戳
+     * @param application appKey,到应用管理打开应用可以找到此值
+     * @param secret 密钥,到应用管理打开应用可以找到此值
+     * @param body 请求body数据,如果是GET请求,此值写null
+     * @return 签名数据
+     */
+    public static String sign(Map<String, String> param, long timestamp, String application, String secret, byte[] body) throws Exception {
+        // 连接系统参数
+        StringBuffer sb = new StringBuffer();
+        sb.append("application").append(":").append(application).append("\n");
+        sb.append("timestamp").append(":").append(timestamp).append("\n");
+        // 连接请求参数
+        if (param != null) {
+            TreeSet<String> keys = new TreeSet<String>(param.keySet());
+            Iterator<String> i = keys.iterator();
+            while (i.hasNext()) {
+                String s = i.next();
+                String val = param.get(s);
+                sb.append(s).append(":").append(val == null ? "" : val).append("\n");
+            }
+        }
+        //body数据写入需要签名的字符流中
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        baos.write(sb.toString().getBytes("utf-8"));
+        if (body != null && body.length > 0) {
+            baos.write(body);
+            baos.write("\n".getBytes("utf-8"));
+        }
+        // 得到需要签名的字符串
+        String string = baos.toString("utf-8");
+        System.out.println("Sign string: " + string);
+        // hmac-sha1编码
+        byte[] bytes = null;
+        SecretKey secretKey = new SecretKeySpec(secret.getBytes("utf-8"), "HmacSha1");
+        Mac mac = Mac.getInstance(secretKey.getAlgorithm());
+        mac.init(secretKey);
+        bytes = mac.doFinal(string.getBytes("utf-8"));
+        // base64编码
+        String encryptedString = new String(Base64.encodeBase64(bytes));
+        // 得到需要提交的signature签名数据
+        return encryptedString;
+    }
+}

+ 221 - 0
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/miniapp/DeviceController.java

@@ -0,0 +1,221 @@
+package com.ruoyi.resource.miniapp;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.resource.domain.ZnylBjqz;
+import com.ruoyi.resource.domain.ZnylYjzcxx;
+import com.ruoyi.resource.service.impl.ZnylBjqzServiceImpl;
+import com.ruoyi.resource.service.impl.ZnylYjzcxxServiceImpl;
+import io.swagger.annotations.Api;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.util.List;
+
+
+/**
+ * 硬件设备Controller
+ *
+ * @author ruoyi
+ * @date 2022-05-13
+ */
+@Api(description = "硬件设备")
+@RestController
+@RequestMapping("/miniapp/device")
+public class DeviceController extends BaseController{
+
+    @Autowired
+    ZnylBjqzServiceImpl znylBjqzService;
+
+    @Autowired
+    ZnylYjzcxxServiceImpl znylYjzcxxService;
+//    public static void main(String args[]) throws Exception {
+//        getToken("18946560909","123456");
+//        getAlarmEventLsit("866756510181548","20220419","20220519");
+//    }
+
+
+//    推送数据格式
+//    {
+//        "jzw": null,                            // 建筑物
+//            "id": 2306760,
+//            "eventid": "1429538068863520768",   // 报警事件id
+//            "deviceid": "1419934529736544256",  // 报警设备id
+//            "comcode": "100000010002",          // 报警单位编码
+//            "comname": "渠道商田旭",              // 报警单位名称
+//            "userid": null,
+//            "username": null,
+//            "IMEI": "867884040745548",        // 设备IMEI
+//            "addtime": "2021/08/23 04:16:49", // 报警时间
+//            "eventtitle": "信号强度数据上报",    // 事件标题
+//            "eventbody": "信号强度数据上报",     // 事件内容
+//            "eventtype": 0,                   // 事件类型(不同设备有不同的报警事件类型)
+//            "eventtypeZh": "数据上传",          // 事件类型中文描述
+//            "megtext": null,                  // 原始信息
+//            "devicetypezh": "智能温湿度记录仪",  // 设备类型中文信息
+//            "xinghaoname": "RT-TH11-N",       // 型号名称
+//            "azdzh": "未绑定安装点",            // 安装点
+//            "jjlxr": null,                    // 接警联系人
+//            "douserid": null,
+//            "dousername": null,
+//            "dotime": null,
+//            "dostatus": 0,
+//            "alarmtype": 0,                   // 报警类型(0:待处理|1:报警|2:测试)
+//            "d1": null,
+//            "d2": null,
+//            "d3": "",
+//            "d4": null,
+//            "d5": null,
+//            "xinhao": 0,
+//            "dainaya": 0,
+//            "v1": 0,
+//            "v2": 0,
+//            "v3": 0,
+//            "v4": 0,
+//            "v5": 0,
+//            "remark": null
+//    }
+    /**
+     * 智慧物联网云平台 -- 报警事件数据推送
+     */
+    public String getCloudMessage(JSONObject object){
+        JSONObject res = object;
+        String deviceId = res.get("deviceid").toString();
+        // 根据设备id 到设备注册表查询绑定的监护对象id
+        ZnylYjzcxx query = new ZnylYjzcxx();
+        query.setDevicenum(deviceId);
+        List<ZnylYjzcxx> list = znylYjzcxxService.selectZnylYjzcxxList(query);
+        if (list.size()>0) {
+            ZnylYjzcxx yjzcxx = list.get(0);
+            Long accountId = yjzcxx.getAccountid();
+            Long wardId = yjzcxx.getWardid();
+            // 添加报警信息
+            ZnylBjqz znylBjqz = new ZnylBjqz();
+            znylBjqz.setAccountid(accountId);//客户id
+            znylBjqz.setWardid(wardId); // 监护人id
+            znylBjqz.setAlarmtime(DateUtils.parseDate(res.get("addtime")));// 报警时间
+            znylBjqz.setMessage(res.get("eventbody").toString());// 内容
+            znylBjqz.setMsgway(res.get("eventtypeZh").toString());// 分类
+            znylBjqz.setStatus("0");// 处理状态 0:未处理
+            znylBjqzService.insertZnylBjqz(znylBjqz);
+        }
+        return "ok";
+    }
+
+    /**
+     * 智慧物联网云平台 -- 登录令牌获取接口
+     * @return
+     * @throws Exception
+     */
+    public static String getToken(String username,String password) throws Exception {
+        String url = "http://www.bignbiot.com/api/account/login";
+//        String bodyString = "{\"Username\":\"18946560909\",\"Password\":\"123456\"}";
+        JSONObject query = new JSONObject();
+        query.put("Username",username);
+        query.put("Password",password);
+        CloseableHttpClient httpClient = null;
+        HttpResponse response = null;
+        httpClient = HttpClientBuilder.create().build();
+        // 构造请求的URL,具体参考文档中心->使能平台API文档中的请求地址和访问路径
+        URIBuilder uriBuilder = new URIBuilder();
+        uriBuilder.setScheme("http");
+        uriBuilder.setHost("www.bignbiot.com");
+        uriBuilder.setPath("/api/account/login");
+        HttpPost httpPost = new HttpPost(uriBuilder.build());//构造post请求
+        // head中添加公共参数
+        // 内容类型
+        httpPost.addHeader("Content-Type", "application/json; charset=UTF-8");
+        //请求添加body部分
+        httpPost.setEntity(new StringEntity(JSONObject.toJSONString(query),"utf-8"));
+        try {
+            // 发送请求
+            response = httpClient.execute(httpPost);
+//            String res = new String(EntityUtils.toByteArray(response.getEntity()));
+            JSONObject obj = JSONObject.parseObject(new String(EntityUtils.toByteArray(response.getEntity())));
+            System.out.println("==========="+obj.toString());
+            httpClient.close();
+            // "Status": 200
+            if (null != obj.get("Status") && obj.get("Status").toString().equals("200")){
+                JSONObject Data = (JSONObject) obj.get("Data");
+                if (null != Data.get("token")) {
+                    return Data.get("token").toString();
+                }
+            }
+            return response.toString();
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+    /**
+     * 智慧物联网云平台 -- 报警事件数据查询
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("/getAlarmEventLsit")
+    public static AjaxResult getAlarmEventLsit(String imei,String sdate,String edate) throws Exception {
+        String url = "http://www.bignbiot.com/api/device/alarmevent/query?imei=866756510181548&sdate=20220325&edate=20220420";
+//        请求头数据格式: Authorization:Bearer+空格+ 登录令牌获取接口拿到的token
+//        获取token
+        String token = getToken("18946560909","123456");
+        String Authorization = "Bearer "+token;
+        HttpResponse response = null;
+        CloseableHttpClient httpClient = null;
+        httpClient = HttpClientBuilder.create().build();
+        // 构造请求的URL
+        URIBuilder uriBuilder = new URIBuilder();
+        uriBuilder.setScheme("http");// 请求用的协议,http或者https
+        uriBuilder.setHost("www.bignbiot.com");//请求地址
+        uriBuilder.setPath("/api/device/alarmevent/query");//访问路径,可以在API文档中对应的API中找到此访问路径
+        // 在请求的URL中添加参数
+//        备注:sdate(起始日期)与edate(截止日志)格式: yyyyMMdd,日期范围不能查询超过一个月的数据
+        uriBuilder.addParameter("imei", imei);// 设备IMEI号
+        uriBuilder.addParameter("sdate", sdate);
+        uriBuilder.addParameter("edate", edate);
+        HttpGet httpGet = new HttpGet(uriBuilder.build());//构造get请求
+        // head中添加公共参数
+        httpGet.addHeader("Content-Type", "application/json; charset=UTF-8");
+        httpGet.addHeader("Authorization",Authorization);
+        System.out.println(httpGet.getURI());
+        try {
+            // 发送请求
+            response = httpClient.execute(httpGet);
+            // 从response获取响应结果
+//            System.out.println(new String(EntityUtils.toByteArray(response.getEntity())));
+            JSONObject obj = JSONObject.parseObject(new String(EntityUtils.toByteArray(response.getEntity())));
+            System.out.println("==========="+obj.toString());
+            httpClient.close();
+            if (null != obj.get("Status") && obj.get("Status").toString().equals("200")){
+                return AjaxResult.success(obj.get("Data"));
+            }
+
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return AjaxResult.success("暂无数据");
+    }
+
+}

+ 4 - 5
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/miniapp/UserAppController.java

@@ -182,20 +182,19 @@ public class UserAppController extends BaseController
             Long wardid = 0L;
             Long accountid = 0L;
             Long userid = 0L;
-//            String userName = "";
-            StringBuffer userName = new StringBuffer();
+            String userName = "";
             if (StringUtils.isNotNull(type) && type.equals("jhdx")){
                 ZnylJhdx jhdx = znylJhdxService.selectJhdxByOpenid(openId);
                 wardid = jhdx.getId();
                 accountid = jhdx.getAccountid();
                 userid = jhdx.getId();
-                userName.append(jhdx.getName());
+                userName=jhdx.getName();
             } else {
                 List<ZnylJhrxx>  jhrxxList = znylJhrxxService.getJhrxxInfo(null,null,null,openId);
                 wardid = jhrxxList.get(0).getWardid();
                 accountid = jhrxxList.get(0).getAccountid();
                 userid = jhrxxList.get(0).getId();
-                userName.append(jhrxxList.get(0).getName());
+                userName=jhrxxList.get(0).getName();
             }
             for (int i = 0; i < jhrList.size(); i++) {
                 ZnylJhrxx znylJhrxx = jhrList.get(i);
@@ -203,7 +202,7 @@ public class UserAppController extends BaseController
                 znylJhrxx.setWardid(wardid);
                 znylJhrxx.setDatastate("1");
                 znylJhrxx.setCreateTime(DateUtils.getNowDate());
-                znylJhrxx.setCreateBy(userName.toString());
+                znylJhrxx.setCreateBy(userName);
                 znylJhrxx.setCreateUserId(userid);
                 znylJhrxxService.insertAppJhrxx(znylJhrxx);
             }