lyh
13 小时以前 78aeb8a8c97a884a640d46755e4be706bde48b7d
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
package com.lxzn.webservice.ext;
 
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.lxzn.framework.utils.JsonMapper;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
 
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
 
/**
 * @Description: 允许部分失败返回报文
 * @Author: zhangherong
 * @Date: Created in 2020/12/25 13:03
 * @Version: 1.0
 * @Modified By:
 */
@Data
@NoArgsConstructor
@Slf4j
public class MesResultList implements Serializable {
    @JsonProperty("PasteReturn")
    @JSONField(name = "PasteReturn")
    private List<MesResultModel> Result;
 
    //通用错误信息
    public static String error(String msg) {
        return "";
    }
 
    public static String success(MesResultModel result) {
        JsonMapper mapper = new JsonMapper();
        try {
            return mapper.toJson(result);
        } catch (IOException e) {
            log.error(e.getMessage());
            return jsonError();
        }
    }
 
    public static String jsonError(){
        return "{\"PasteReturn\":[{\"FLAG\":\""+0+"\", \"MSG\":\""+ "" +"\"}]}";
    }
}