xinyb
2024-06-18 4c9e286973bed3bea00280a999500d2bb1cb8817
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
package com.yc.sdk.weixincp3rd.service;
 
import com.yc.action.grid.GridUtils;
import com.yc.sdk.weixincp3rd.entity.AfterSalesEntity;
import com.yc.sdk.weixincp3rd.entity.AfterSalesParameters;
import com.yc.service.BaseService;
import com.yc.service.upload.AttachmentIfc;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
 
/**
 * @BelongsProject: eCoWorksV3
 * @BelongsPackage: com.yc.sdk.weixincp3rd.service
 * @author: xinyb
 * @CreateTime: 2024-04-30  09:12
 * @Description: 售后对接api
 */
@Service
public class AfterSalesImpl extends BaseService implements AfterSalesIfc {
    @Autowired
    private AttachmentIfc attachmentIfc;
 
    @Override
    public void saveUpkeep(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50) = '',@cltName varchar(100) = ''," +
                    "@companyId varchar(10),@companyName varchar(100),@seq int =" + param.getSeq() + "," +
                    "@ccCode varchar(50),@ccName varchar(50),"+
                    "@Longitude varchar(50),@Latitude varchar(50),@FullAddressName varchar(200)," +
                    "@FullAddress varchar(300),@Street varchar(200)\n";
            if (StringUtils.isNotBlank(param.getOpenId())) {
                sql += "select @cltCode=cltCode,@cltName=cltName,@ccCode=ccCode,@ccName=ccName," +
                        "@companyId=companyId,@companyName=companyName from t110203 where MiniAppOpenId=" + GridUtils.prossSqlParm(param.getOpenId()) + "\n";
                sql += " if isnull(@cltCode,'') = ''  \n " +
                        " begin \n" +
                        "  raiserror('系统未绑定微信用户ID,请绑定后再执行',16,1) \n" +
                        " return \n" +
                        " end \n";
            }
            sql += "select @Longitude = Longitude,@Latitude=Latitude,@FullAddressName=FullAddressName," +
                    "@FullAddress=isnull(FullAddress,'')+''+isnull(FullAddressName,'')+''+isnull(Street,'')," +
                    "@Street=Street from t110209 " +
                    "where seq=@seq";
            sql += " exec sp_newdoccode 640210,'SYSTEM',@docCode output\n";
            sql += "insert into t640210H(docCode,formId,docDate,periodID,ccCode,ccName,DocStatus,LastDocStatus,PostCode,PostName,companyId,companyName,AcceptSource,cltCode,cltName,tel," +
                    "PropertyAddress,PreSendDate,Memo,enterDate,UploadFiles,seq,Longitude,Latitude,FullAddressName,Street)" +
                    " values (@docCode," + param.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),@ccCode,@ccName,0,0,'system','小程序端',@companyId,@companyName,'报修',@cltCode," +
                    GridUtils.prossSqlParm(param.getCltName()) + "," + GridUtils.prossSqlParm(param.getTel()) + ",@FullAddress," +
                    GridUtils.prossSqlParm(param.getPreSendDate()) + "," +
                    GridUtils.prossSqlParm(param.getMemo()) + ",getdate()," + GridUtils.prossSqlParm(param.getUploadFiles()) + "," +
                    "@seq,@Longitude,@Latitude,@FullAddressName,@Street) \n";
            sql+=" exec dbo.p640210post 'SYSTEM','系统管理员',@docCode,640210,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public List<Map<String, Object>> getUpkeepList(Integer docStatus, String openId) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.acceptSource,a.docCode,a.enterDate,a.preSendDate,a.cltCode,a.cltName," +
                    "(case when isnull(a.DocStatus,0) <100 then 1\n" +
                    " when isnull(a.DocStatus,0)=100 and isnull(a.WanGongStatus,'未完工') = '未完工' then 2 \n" +
                    " when isnull(a.DocStatus,0)=100 and isnull(a.WanGongStatus,'未完工') = '已完工' then 3 \n" +
                    " else 1 end) docStatus,isnull(a.lastDocStatus,0) lastDocStatus,a.memo \n" +
                    "from t640210H a join t110203 b on a.CltCode=b.CltCode and b.MiniAppOpenId=" + GridUtils.prossSqlParm(openId) + "\n" +
                    "where a.AcceptSource='报修' ";
            if (docStatus > 0 ){
                if (docStatus == 1) {
                    sql += "  and isnull(a.DocStatus,0) < 100";
                } else if (docStatus ==2) {
                    sql += "  and isnull(a.DocStatus,0) = 100 and isnull(a.WanGongStatus,'未完工') = '未完工'";
                }else if(docStatus == 3){
                    sql += "  and isnull(a.DocStatus,0) = 100 and isnull(a.WanGongStatus,'未完工') = '已完工'";
                }
            }
            sql+=" order by a.enterDate desc";
            return jdbcTemplate.queryForList(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public AfterSalesEntity getUpkeepInfo(String docCode) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.topic,a.id,a.inserttime,a.curStatus,a.ActionCode,a.ActionName,a.ActionTel,\n" +
                    "b.acceptSource,b.docCode,b.formId,b.PaiGongDocCode,b.PaiGongFormId,b.enterDate,b.preSendDate,b.uploadFiles,b.cltCode,b.cltName,b.tel," +
                    "isnull(b.propertyAddress,'') as propertyAddress," +
                    "isnull(b.docStatus,0) docStatus,isnull(b.LastDocStatus,0) lastDocStatus,b.memo,b.longitude,b.latitude,b.fullAddressName \n" +
                    "from t640210D2 a right join t640210h b on a.SODocCode=b.docCode where b.docCode= " + GridUtils.prossSqlParm(docCode) + " order by id desc";
            return AfterSalesEntity.setAfterSalesEntity(jdbcTemplate.queryForList(sql));
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public void saveComplain(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
 
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50)='',@cltName varchar(200)='',@tel varchar(50)=''," +
                    "@ccCode varchar(50),@ccName varchar(50),"+
                    "@propertyAddress varchar(200),@companyId varchar(10),@companyName varchar(100)\n";
            if (StringUtils.isNotBlank(param.getOpenId())) {
                sql += "select @cltCode=cltCode,@cltName=cltName,@ccCode=ccCode,@ccName=ccName,@tel=tel," +
                        "@propertyAddress=PropertyAddress,@companyId=companyId,@companyName=companyName from t110203 where MiniAppOpenId=" + GridUtils.prossSqlParm(param.getOpenId()) + "\n";
                sql+=" if isnull(@cltCode,'') = ''  \n " +
                        " begin \n" +
                        "  raiserror('系统未绑定微信用户ID,请绑定后再执行',16,1) \n" +
                        " return \n" +
                        " end \n";
            }
            sql += " exec sp_newdoccode 640210,'SYSTEM',@docCode output\n";
            sql += "insert into t640210H(docCode,formId,ccCode,ccName,DocStatus,LastDocStatus,PostCode,PostName,docDate,periodID,companyId,companyName,AcceptSource,cltCode,cltName,tel,PropertyAddress,Memo,enterDate,UploadFiles)" +
                    " values (@docCode," + param.getFormId() + ",@ccCode,@ccName,0,0,'system','小程序端',convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),@companyId,@companyName,'投诉',@cltCode,@cltName,@tel,@propertyAddress," +
                    GridUtils.prossSqlParm(param.getMemo()) + ",getdate()," + GridUtils.prossSqlParm(param.getUploadFiles()) + ") \n";
            sql+=" exec dbo.p640210post 'SYSTEM','系统管理员',@docCode,640210,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public List<Map<String, Object>> getComplainList(Integer docStatus, String openId) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.acceptSource,a.docCode,a.enterDate,a.preSendDate,a.cltCode,a.cltName," +
                    "(case when isnull(a.DocStatus,0) <100 then 1\n" +
                    " when isnull(a.DocStatus,0)=100 and isnull(a.WanGongStatus,'未完工') = '未完工' then 2 \n" +
                    " when isnull(a.DocStatus,0)=100 and isnull(a.WanGongStatus,'未完工') = '已完工' then 3 \n" +
                    " else 1 end) docStatus,isnull(a.lastDocStatus,0) lastDocStatus,a.memo \n" +
                    "from t640210H a join t110203 b on a.CltCode=b.CltCode and b.MiniAppOpenId=" + GridUtils.prossSqlParm(openId) + "\n" +
                    "where a.AcceptSource='投诉' ";
            if (docStatus > 0 ){
                if (docStatus == 1) {
                    sql += "  and isnull(a.DocStatus,0) < 100";
                } else if (docStatus ==2) {
                    sql += "  and isnull(a.DocStatus,0) = 100 and isnull(a.WanGongStatus,'未完工') = '未完工'";
                }else if(docStatus == 3){
                    sql += "  and isnull(a.DocStatus,0) = 100 and isnull(a.WanGongStatus,'未完工') = '已完工'";
                }
            }
            sql+=" order by a.enterDate desc";
            return jdbcTemplate.queryForList(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public AfterSalesEntity getComplainInfo(String docCode) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.topic,a.id,a.inserttime,a.curStatus,a.ActionCode,a.ActionName,a.ActionTel,\n" +
                    "b.acceptSource,b.docCode,b.formId,b.PaiGongDocCode,b.PaiGongFormId,b.enterDate,b.preSendDate,b.UploadFiles,b.cltCode,b.cltName,b.tel," +
                    "isnull(b.propertyAddress,'') as propertyAddress," +
                    "isnull(b.docStatus,0) docStatus,isnull(b.lastDocStatus,0) lastDocStatus,b.memo\n" +
                    "from t640210D2 a right join t640210h b on a.SODocCode=b.docCode where b.docCode= " + GridUtils.prossSqlParm(docCode) + " order by id desc";
            return AfterSalesEntity.setAfterSalesEntity(jdbcTemplate.queryForList(sql));
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public void saveSatisfaction(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50)='',@cltName varchar(200)='',@tel varchar(20)=''," +
                    "@propertyAddress varchar(200),@companyId varchar(10),@companyName varchar(100)," +
                    "@PaiGongDocCode varchar(50),@PaiGongFormId int,@PaiGongFormType int ,@periodID varchar(20)," +
                    "@postCode varchar(50),@postName varchar(50),@ccCode varchar(50),@ccName varchar(50)\n";
            sql += "select @cltCode=cltCode,@cltName=cltName,@tel=tel,@propertyAddress=propertyAddress,@postCode=postCode," +
                    "@postName=postName,@companyId=companyId,@companyName=companyName,@ccCode=ccCode,@ccName=ccName," +
                    "@PaiGongDocCode=PaiGongDocCode,@PaiGongFormId=PaiGongFormId,@PaiGongFormType=PaiGongFormType,@periodID=periodID " +
                    "from t640210H where docCode=" + GridUtils.prossSqlParm(param.getRefCode())+"\n";
            sql += " if @@ROWCOUNT = 0  \n " +
                    " begin \n" +
                    "  raiserror('未找到提交单号,请检测是否已经提交',16,1) \n" +
                    " return \n" +
                    " end \n";
            sql += " exec sp_newdoccode 640402,'SYSTEM',@docCode output\n";
            sql += "insert into t640402H(docCode,formId,refCode,refFormId,refFormType,postCode,postName,PaiGongDocCode,PaiGongFormId,PaiGongFormType,periodID," +
                    "DocStatus,companyId,companyName,docDate,cltCode,cltName,tel,EnterDate,OverallEvaluationScore,InstallEvaluationScore,AfterSalesEvaluationScore," +
                    "DeliveryEvaluationScore,HDMemo,UploadFiles,propertyAddress,ccCode,ccName)" +
                    " values (@docCode,640402," + GridUtils.prossSqlParm(param.getRefCode()) + "," + param.getRefFormId() + ",496,@postCode,@postName,@PaiGongDocCode,@PaiGongFormId,@PaiGongFormType,@periodID," +
                    "0,@companyId,@companyName,convert(varchar(10),getdate(),120),@cltCode,@cltName,@tel,getdate()," +
                    GridUtils.prossSqlParm(param.getOverallEvaluationScore()) + "," + GridUtils.prossSqlParm(param.getInstallEvaluationScore()) + "," +
                    GridUtils.prossSqlParm(param.getAfterSalesEvaluationScore()) + "," + GridUtils.prossSqlParm(param.getDeliveryEvaluationScore()) + "," +
                    GridUtils.prossSqlParm(param.getHDMemo()) + "," + GridUtils.prossSqlParm(param.getUploadFiles()) + ",@propertyAddress,@ccCode,@ccName) \n";
            sql += "exec dbo.p640402post 'SYSTEM','系统管理员',@doccode,640402,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public void savePreInstallation(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50) = '',@cltName varchar(100) = ''," +
                    "@companyId varchar(10),@companyName varchar(100),@seq int =" + param.getSeq() + "," +
                    "@ccCode varchar(50),@ccName varchar(50),"+
                    "@Longitude varchar(50),@Latitude varchar(50),@FullAddressName varchar(200)," +
                    "@FullAddress varchar(300),@Street varchar(200)\n";
            if (StringUtils.isNotBlank(param.getOpenId())) {
                sql += "select @cltCode=cltCode,@cltName=cltName,@ccCode=ccCode,@ccName=ccName," +
                        "@companyId=companyId,@companyName=companyName from t110203 where MiniAppOpenId=" + GridUtils.prossSqlParm(param.getOpenId()) + "\n";
                sql += " if isnull(@cltCode,'') = ''  \n " +
                        " begin \n" +
                        "  raiserror('系统未绑定微信用户ID,请绑定后再执行',16,1) \n" +
                        " return \n" +
                        " end \n";
            }
            sql += "select @cltCode=cltCode,@cltName=cltName,@Longitude = Longitude,@Latitude=Latitude,@FullAddressName=FullAddressName," +
                    "@FullAddress=isnull(FullAddress,'')+''+isnull(FullAddressName,'')+''+isnull(Street,'')," +
                    "@Street=Street from t110209 " +
                    "where seq=@seq";
            sql += " exec sp_newdoccode 640210,'SYSTEM',@docCode output\n";
            sql += "insert into t640210H(docCode,formId,docDate,periodID,ccCode,ccName,DocStatus,LastDocStatus,PostCode,PostName,companyId,companyName,AcceptSource,cltCode,cltName,tel," +
                    "PropertyAddress,PreSendDate,Memo,enterDate,UploadFiles,seq,Longitude,Latitude,FullAddressName,Street)" +
                    " values (@docCode," + param.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),@ccCode,@ccName,0,0,'system','小程序端',@companyId,@companyName,'预约',@cltCode," +
                    "@cltName," + GridUtils.prossSqlParm(param.getTel()) + ",@FullAddress," +
                    GridUtils.prossSqlParm(param.getPreSendDate()) + "," +
                    GridUtils.prossSqlParm(param.getMemo()) + ",getdate()," + GridUtils.prossSqlParm(param.getUploadFiles()) + "," +
                    "@seq,@Longitude,@Latitude,@FullAddressName,@Street) \n";
            sql+=" exec dbo.p640210post 'SYSTEM','系统管理员',@docCode,640210,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public List<Map<String, Object>> getPreInstallation(Integer docStatus, String openId) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.acceptSource,a.docCode,a.enterDate,a.preSendDate,a.cltCode,a.cltName," +
                    "(case when isnull(a.DocStatus,0) <100 then 1\n" +
                    " when isnull(a.DocStatus,0)=100 then 3 \n" +
                    " else 1 end) docStatus,isnull(a.lastDocStatus,0) lastDocStatus,a.memo \n" +
                    "from t640210H a join t110203 b on a.CltCode=b.CltCode and b.MiniAppOpenId=" + GridUtils.prossSqlParm(openId) + "\n" +
                    "where a.AcceptSource='预约' ";
            if (docStatus == 1) {
                sql += "  and isnull(a.DocStatus,0) < 100";
            } else if (docStatus == 3) {
                sql += "  and isnull(a.DocStatus,0) = 100";
            }
            sql += " order by a.enterDate desc";
            return jdbcTemplate.queryForList(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public AfterSalesEntity getPreInstallationInfo(String docCode) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.topic,a.id,a.inserttime,a.curStatus,a.ActionCode,a.ActionName,a.ActionTel,\n" +
                    "b.acceptSource,b.docCode,b.formId,b.PaiGongDocCode,b.PaiGongFormId,b.enterDate,b.preSendDate,b.uploadFiles,b.cltCode,b.cltName,b.tel," +
                    "isnull(b.propertyAddress,'') as propertyAddress," +
                    "isnull(b.docStatus,0) docStatus,isnull(b.LastDocStatus,0) lastDocStatus,b.memo,b.longitude,b.latitude,b.fullAddressName \n" +
                    "from t640210D2 a right join t640210h b on a.SODocCode=b.docCode where b.docCode= " + GridUtils.prossSqlParm(docCode) + " order by id desc";
            return AfterSalesEntity.setAfterSalesEntity(jdbcTemplate.queryForList(sql));
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public void saveRenewal(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50) = '',@cltName varchar(100) = ''," +
                    "@companyId varchar(10),@companyName varchar(100),@seq int =" + param.getSeq() + "," +
                    "@ccCode varchar(50),@ccName varchar(50),"+
                    "@Longitude varchar(50),@Latitude varchar(50),@FullAddressName varchar(200)," +
                    "@FullAddress varchar(300),@Street varchar(200)\n";
            if (StringUtils.isNotBlank(param.getOpenId())) {
                sql += "select @cltCode=cltCode,@cltName=cltName,@ccCode=ccCode,@ccName=ccName," +
                        "@companyId=companyId,@companyName=companyName from t110203 where MiniAppOpenId=" + GridUtils.prossSqlParm(param.getOpenId()) + "\n";
                sql += " if isnull(@cltCode,'') = ''  \n " +
                        " begin \n" +
                        "  raiserror('系统未绑定微信用户ID,请绑定后再执行',16,1) \n" +
                        " return \n" +
                        " end \n";
            }
            sql += "select @Longitude = Longitude,@Latitude=Latitude,@FullAddressName=FullAddressName," +
                    "@FullAddress=isnull(FullAddress,'')+''+isnull(FullAddressName,'')+''+isnull(Street,'')," +
                    "@Street=Street from t110209 " +
                    "where seq=@seq";
            sql += " exec sp_newdoccode 640210,'SYSTEM',@docCode output\n";
            sql += "insert into t640210H(docCode,formId,docDate,periodID,ccCode,ccName,DocStatus,LastDocStatus,PostCode,PostName,companyId,companyName,AcceptSource,cltCode,cltName,tel," +
                    "PropertyAddress,PreSendDate,Memo,enterDate,UploadFiles,seq,Longitude,Latitude,FullAddressName,Street)" +
                    " values (@docCode," + param.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),@ccCode,@ccName,0,0,'system','小程序端',@companyId,@companyName,'换新',@cltCode," +
                    GridUtils.prossSqlParm(param.getCltName()) + "," + GridUtils.prossSqlParm(param.getTel()) + ",@FullAddress," +
                    GridUtils.prossSqlParm(param.getPreSendDate()) + "," +
                    GridUtils.prossSqlParm(param.getMemo()) + ",getdate()," + GridUtils.prossSqlParm(param.getUploadFiles()) + "," +
                    "@seq,@Longitude,@Latitude,@FullAddressName,@Street) \n";
            sql+=" exec dbo.p640210post 'SYSTEM','系统管理员',@docCode,640210,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
 
    @Override
    public Integer deleteFile(String unId, Integer seq) {
        String sql = "set nocount on\n";
        try {
            sql += "declare @unid varchar(100) =" + GridUtils.prossSqlParm(unId) + " ,@seq int =" + seq + "\n";
            sql += "delete from _sys_Attachment where unid = @unid and seq = @seq\n";
            sql += " select @@rowcount \n";
            Integer ret = this.jdbcTemplate.queryForObject(sql, Integer.class);
            return ret;
        } catch (DataAccessException e) {
            if (e instanceof EmptyResultDataAccessException) {
                return null;
            } else {
                e.printStackTrace();
                throw e;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
}