陈昶聿
昨天 fcb98e4558897945a316d04555923355b8e60605
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package com.smartor.service.impl;
 
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.smartor.domain.ServiceOutPath;
import com.smartor.domain.ServiceTask;
import com.smartor.mapper.ServiceOutPathMapper;
import com.smartor.mapper.ServiceTaskMapper;
import com.smartor.service.IServiceOutPathService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
 
/**
 * 主键Service业务层处理
 *
 * @author lihu
 * @date 2024-11-04
 */
@Service
public class ServiceOutPathServiceImpl implements IServiceOutPathService {
    @Autowired
    private ServiceOutPathMapper serviceOutPathMapper;
    @Autowired
    private ServiceTaskMapper serviceTaskMapper;
    @Value("${localIP}")
    private String localIP;
    @Value("${req_path}")
    private String req_path;
    @Value("${pub_key}")
    private String pub_key;
 
    /**
     * 查询主键
     *
     * @param id 主键主键
     * @return 主键
     */
    @Override
    public ServiceOutPath selectServiceOutPathById(Long id) {
        return serviceOutPathMapper.selectServiceOutPathById(id);
    }
 
    /**
     * 查询主键列表
     *
     * @param serviceOutPath 主键
     * @return 主键
     */
    @Override
    public List<ServiceOutPath> selectServiceOutPathList(ServiceOutPath serviceOutPath) {
        return serviceOutPathMapper.selectServiceOutPathList(serviceOutPath);
    }
 
    /**
     * 新增主键
     *
     * @param serviceOutPath 主键
     * @return 结果
     */
    @Override
    public int insertServiceOutPath(ServiceOutPath serviceOutPath) {
        return serviceOutPathMapper.insertServiceOutPath(serviceOutPath);
    }
 
    /**
     * 新增主键
     *
     * @param serviceOutPath 主键
     * @return 结果
     */
    @Override
    public String addOutPath(ServiceOutPath serviceOutPath) {
        ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(Long.valueOf(serviceOutPath.getParam1()));
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String taskId = rsaPublicKeyExample.encryptedData(serviceOutPath.getParam1().toString(), pub_key);
        String patid= rsaPublicKeyExample.encryptedData(serviceOutPath.getParam2().toString(), pub_key);
        String subid= rsaPublicKeyExample.encryptedData(serviceOutPath.getParam6().toString(), pub_key);
        Date now = DateUtils.getNowDate();
        ServiceOutPath sop = new ServiceOutPath();
        sop.setParam1(taskId);
        sop.setParam2(patid);
        sop.setParam3(serviceTask.getTaskName());
        sop.setParam6(subid);
        sop.setCreateTime(now);
        sop.setUpdateTime(now);
        sop.setOrgid(serviceTask.getOrgid());
        sop.setDeptCode(serviceTask.getDeptcode());
        sop.setWardCode(serviceTask.getLeavehospitaldistrictcode());
        sop.setDeptName(serviceTask.getDeptname());
        sop.setWardName(serviceTask.getLeavehospitaldistrictname());
        serviceOutPathMapper.insertServiceOutPath(sop);
        //转成16进制并回写radix和updateTime
        serviceOutPath.setRadix(String.format("%03X", sop.getId()));
        serviceOutPath.setUrl(localIP + ":" + req_path + "/wt?p=" + sop.getRadix());
        serviceOutPathMapper.updateServiceOutPath(serviceOutPath);
        return serviceOutPath.getUrl();
    }
 
    /**
     * 修改主键
     *
     * @param serviceOutPath 主键
     * @return 结果
     */
    @Override
    public int updateServiceOutPath(ServiceOutPath serviceOutPath) {
        return serviceOutPathMapper.updateServiceOutPath(serviceOutPath);
    }
 
    /**
     * 批量删除主键
     *
     * @param ids 需要删除的主键主键
     * @return 结果
     */
    @Override
    public int deleteServiceOutPathByIds(Long[] ids) {
        return serviceOutPathMapper.deleteServiceOutPathByIds(ids);
    }
 
    /**
     * 删除主键信息
     *
     * @param id 主键主键
     * @return 结果
     */
    @Override
    public int deleteServiceOutPathById(Long id) {
        return serviceOutPathMapper.deleteServiceOutPathById(id);
    }
 
    /**
     * 查询自增ID
     *
     * @return ID
     */
    @Override
    public Integer selectAutoId() {
        return serviceOutPathMapper.selectAutoId();
    }
}