智慧保安后台管理-外网
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.springblade.modules.system.service;
 
import net.sf.json.JSONObject;
import org.springblade.common.utils.HttpClientUtils;
import org.springblade.modules.system.dto.UserDTO;
import org.springblade.modules.system.entity.User;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
 
import java.io.IOException;
 
import static org.springblade.common.config.FtpConfig.qfqkBaseApiUrl;
 
@Service
public class MyAsyncService {
 
    /**
     * 用户新增
     * @param user
     */
    @Async
    public void qfqkUserSave(User user) {
//        System.out.println("进入异步方法----------------------");
//        try {
//            Thread.sleep(30000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        String requestUrl = qfqkBaseApiUrl + "/blade-user/securitySaves";
        UserDTO userDTO = new UserDTO();
        userDTO.setAccount(user.getAccount());
        userDTO.setCardid(user.getCardid());
        userDTO.setPassword(user.getPassword());
        userDTO.setSex(user.getSex());
        userDTO.setStatus(user.getStatus());
        userDTO.setPhone(user.getPhone());
        userDTO.setIsDeleted(user.getIsDeleted());
        userDTO.setRealName(user.getRealName());
        //装换为 json
        JSONObject jsonObject = JSONObject.fromObject(userDTO);
        //发送请求
        try {
            HttpClientUtils.httpPostWithjson(requestUrl,jsonObject.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}