提交 | 用户 | age
|
c50077
|
1 |
package com.hx.phip.controller.deduction; |
ce5acf
|
2 |
|
124a87
|
3 |
import com.alibaba.fastjson.JSONArray; |
ccaf53
|
4 |
import com.alibaba.fastjson.JSONObject; |
ce5acf
|
5 |
import com.hx.common.BaseController; |
95d446
|
6 |
import com.hx.exception.TipsException; |
f09b41
|
7 |
import com.hx.mybatisTool.SqlSentence; |
b3afa9
|
8 |
import com.hx.phiappt.common.DeductionSingleConstants; |
071df8
|
9 |
import com.hx.phiappt.constants.tool.PerformanceInfoTool; |
82af02
|
10 |
import com.hx.phiappt.constants.tool.user.UserProjectTool; |
95d446
|
11 |
import com.hx.phiappt.dao.mapper.IntroProjectManualMapper; |
A |
12 |
import com.hx.phiappt.dao.mapper.NotificationLogMapper; |
|
13 |
import com.hx.phiappt.dao.mapper.ProjectMapper; |
a748c2
|
14 |
import com.hx.phiappt.model.*; |
918f50
|
15 |
import com.hx.phiappt.model.deduction.*; |
95d446
|
16 |
import com.hx.phiappt.model.intro.IntroProjectManual; |
071df8
|
17 |
import com.hx.phiappt.model.performance.PerformanceInfo; |
95d446
|
18 |
import com.hx.phiappt.model.project.ProjectGeneral; |
f09b41
|
19 |
import com.hx.phip.config.CustomParameter; |
95d446
|
20 |
import com.hx.phip.dao.mapper.ProjectGeneralMapper; |
a20301
|
21 |
import com.hx.phip.dao.mapper.ShopMapper; |
W |
22 |
import com.hx.phip.dao.mapper.UserMapper; |
918f50
|
23 |
import com.hx.phip.service.ComparePhotoRecordPicturesService; |
A |
24 |
import com.hx.phip.service.ComparePhotoRecordService; |
c50077
|
25 |
import com.hx.phip.service.deduction.*; |
8b3cdb
|
26 |
import com.hx.resultTool.Result; |
f09b41
|
27 |
import com.hx.util.HttpServletRequestUtil; |
ce5acf
|
28 |
import com.hx.util.StringUtils; |
f23452
|
29 |
import com.hx.util.thread.ExecutorServiceTool; |
W |
30 |
import com.hz.his.dto.deduction.DeductionDto; |
ce5acf
|
31 |
import com.platform.constants.LoginConstant; |
A |
32 |
import com.platform.entity.ThirtApplication; |
|
33 |
import com.platform.exception.PlatTipsException; |
|
34 |
import com.platform.resultTool.PlatformCode; |
f09b41
|
35 |
import com.platform.resultTool.PlatformResult; |
A |
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
a20301
|
38 |
import org.springframework.web.bind.annotation.RequestBody; |
W |
39 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
40 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
41 |
import org.springframework.web.bind.annotation.RestController; |
ce5acf
|
42 |
|
A |
43 |
import javax.annotation.Resource; |
|
44 |
import javax.servlet.http.HttpServletRequest; |
f650ee
|
45 |
import java.util.ArrayList; |
918f50
|
46 |
import java.util.HashMap; |
A |
47 |
import java.util.List; |
|
48 |
import java.util.Map; |
ce5acf
|
49 |
|
A |
50 |
/** |
|
51 |
* 执行划扣控制器 |
124a87
|
52 |
* |
ce5acf
|
53 |
* @USER: Andru |
A |
54 |
* @DATE: 2021/12/10 |
|
55 |
*/ |
|
56 |
@RestController |
|
57 |
@RequestMapping("/deduction") |
|
58 |
public class DeductionController extends BaseController { |
|
59 |
|
f09b41
|
60 |
//log4j日志 |
A |
61 |
private static final Logger logger = LoggerFactory.getLogger(DeductionController.class.getName()); |
9561fa
|
62 |
|
bc0ffd
|
63 |
/**固定线程池-改*/ |
8156a9
|
64 |
public static ExecutorServiceTool threadPool = new ExecutorServiceTool(10,200); |
f09b41
|
65 |
|
A |
66 |
@Resource |
|
67 |
private CustomParameter customParameter; |
ce5acf
|
68 |
@Resource |
A |
69 |
private DeductionSingleService deductionSingleService; |
918f50
|
70 |
@Resource |
A |
71 |
private DeductionProjectService deductionProjectService; |
|
72 |
@Resource |
|
73 |
private DeductionJoinService deductionJoinService; |
|
74 |
@Resource |
|
75 |
private DeductionSignService deductionSignService; |
|
76 |
@Resource |
|
77 |
private DeductionDrugsService deductionDrugsService; |
|
78 |
@Resource |
|
79 |
private DeductionDeviceParameterService deductionDeviceParameterService; |
|
80 |
@Resource |
|
81 |
private ComparePhotoRecordService comparePhotoRecordService; |
|
82 |
@Resource |
|
83 |
private ComparePhotoRecordPicturesService comparePhotoRecordPicturesService; |
|
84 |
|
|
85 |
/** |
9a17f1
|
86 |
* 获取划扣清单id |
A |
87 |
* @param param 参数值 |
|
88 |
* @return id |
|
89 |
*/ |
|
90 |
private String getId(String param) { |
|
91 |
JSONObject jsonObject = JSONObject.parseObject(param); |
|
92 |
if (jsonObject == null || !jsonObject.containsKey("deductionSingleId")) { |
|
93 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "参数不能为空不能为空"); |
|
94 |
} |
|
95 |
// 获取接收的对象 |
|
96 |
return jsonObject.getString("deductionSingleId"); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* 校验参数 |
|
101 |
* @param deductionDto 参数对象 |
|
102 |
*/ |
|
103 |
private void checkParam(DeductionDto deductionDto) { |
|
104 |
if (StringUtils.isEmpty(deductionDto.getUserProjectId())) { |
|
105 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "userProjectId不能为空"); |
|
106 |
} |
|
107 |
|
|
108 |
if (deductionDto.getDeductionNum() <= 0) { |
|
109 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "数量/划扣次数需要大于0"); |
|
110 |
} |
|
111 |
|
|
112 |
/* if (deductionDto.getExecuteStartTime() == null) { |
|
113 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "执行开始时间不内为空!"); |
|
114 |
} |
|
115 |
|
|
116 |
if (deductionDto.getExecuteEndTime() == null) { |
|
117 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "执行结束时间不内为空!"); |
|
118 |
} */ |
|
119 |
} |
|
120 |
|
|
121 |
/** |
124a87
|
122 |
* 查看记录 |
918f50
|
123 |
*/ |
ccaf53
|
124 |
@RequestMapping(value = "/see", method = RequestMethod.POST) |
A |
125 |
public Result seeData(HttpServletRequest request, @RequestBody String param) { |
|
126 |
// 获取接收的参数里面的id |
|
127 |
String deductionSingleId = getId(param); |
|
128 |
|
918f50
|
129 |
// 获取用户信息 |
f09b41
|
130 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
124a87
|
131 |
if (thirtApplication == null) { |
75bbef
|
132 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
918f50
|
133 |
} |
A |
134 |
|
124a87
|
135 |
Map<String, Object> mapData = new HashMap<>(); |
918f50
|
136 |
DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(deductionSingleId); |
124a87
|
137 |
if (deductionSingle != null) { |
918f50
|
138 |
// 划扣记录 |
A |
139 |
mapData.put("deductionSingle", deductionSingle); |
|
140 |
// 项目划扣 |
|
141 |
DeductionProject deductionProject = deductionProjectService.selectOneByDeductionSingleId(deductionSingle.getId()); |
|
142 |
mapData.put("deductionProject", deductionProject); |
124a87
|
143 |
if (deductionProject != null) { |
918f50
|
144 |
// 参与人员信息 |
A |
145 |
List<DeductionJoin> deductionJoinList = deductionJoinService.selectListByDeductionSingleId(deductionSingle.getId(), deductionProject.getId()); |
|
146 |
mapData.put("deductionJoinList", deductionJoinList); |
|
147 |
// 消耗物品信息 |
|
148 |
List<DeductionDrugs> deductionDrugsList = deductionDrugsService.selectListByDeductionSingleId(deductionSingle.getId(), deductionProject.getId()); |
|
149 |
mapData.put("deductionDrugsList", deductionDrugsList); |
|
150 |
// 治疗参数(设备)信息 |
|
151 |
List<DeductionDeviceParameter> deductionDeviceParameterList = deductionDeviceParameterService.selectListByDeductionSingleId(deductionSingle.getId(), deductionProject.getId()); |
|
152 |
mapData.put("deductionDeviceParameterList", deductionDeviceParameterList); |
|
153 |
// 客户签名信息 |
|
154 |
List<DeductionSign> deductionSignList = deductionSignService.selectListByDeductionSingleId(deductionSingle.getId(), deductionProject.getId()); |
|
155 |
mapData.put("deductionSignList", deductionSignList); |
|
156 |
// 治疗图片 |
|
157 |
ComparePhotoRecord comparePhotoRecord = comparePhotoRecordService.selectOneByDeductionSingleId(deductionSingle.getId(), deductionProject.getId()); |
124a87
|
158 |
if (comparePhotoRecord != null) { |
918f50
|
159 |
List<ComparePhotoRecordPictures> comparePhotoRecordPicturesList = comparePhotoRecordPicturesService.selectListByComparePhotoRecordId(comparePhotoRecord.getId()); |
A |
160 |
mapData.put("comparePhotoRecordPicturesList", comparePhotoRecordPicturesList); |
124a87
|
161 |
} else { |
918f50
|
162 |
mapData.put("comparePhotoRecordPicturesList", null); |
A |
163 |
} |
|
164 |
} |
|
165 |
} |
|
166 |
return Result.success(mapData); |
|
167 |
} |
ce5acf
|
168 |
|
A |
169 |
/** |
b3afa9
|
170 |
* 新增划扣记录 |
ce5acf
|
171 |
*/ |
733901
|
172 |
@RequestMapping(value = "/add", method = RequestMethod.POST) |
7e73af
|
173 |
public Result addData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
0b5aa8
|
174 |
logger.info("新增划扣记录打印入参数据:"+ JSONObject.toJSONString(deductionDto)); |
ce5acf
|
175 |
// 校验参数 |
A |
176 |
checkParam(deductionDto); |
|
177 |
// 获取用户信息 |
f09b41
|
178 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
124a87
|
179 |
if (thirtApplication == null) { |
75bbef
|
180 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
ce5acf
|
181 |
} |
A |
182 |
// 填充接口登入信息 |
122cde
|
183 |
deductionDto.setAppId(thirtApplication.getAppId()); |
2b3e15
|
184 |
deductionDto.setAppIdCode(thirtApplication.getAppIdCode()); |
A |
185 |
deductionDto.setSourceCode(thirtApplication.getAppId()); |
b3afa9
|
186 |
deductionDto.setSourceName(thirtApplication.getName()); |
ce5acf
|
187 |
|
A |
188 |
// 添加数据 |
f902c4
|
189 |
String id = deductionSingleService.editInfo(deductionDto, BaseEntity.YES); |
9561fa
|
190 |
|
a7ca2d
|
191 |
logger.info("多线程队列数DeductionController-1:{}", threadPool.getThreadPool().getQueue().size()); |
C |
192 |
|
e7191d
|
193 |
// 判断是否发送消息 |
A |
194 |
if (BaseEntity.YES == deductionDto.getIsSentNotice()) { |
16e12d
|
195 |
// 发送公众号确认消息 |
A |
196 |
threadPool.getThreadPool().execute(() -> deductionSingleService.sendConfirmNotice(id)); |
e7191d
|
197 |
// 发送划扣成功调查问卷 |
a7ca2d
|
198 |
threadPool.getThreadPool().execute(() -> deductionSingleService.sendGZHQuestionnaire(id)); |
e7191d
|
199 |
} |
f95c93
|
200 |
// 计算新增划扣业绩信息 |
a7ca2d
|
201 |
threadPool.getThreadPool().execute(() -> this.handlerPerformanceInfoDeduction(id, BaseEntity.YES)); |
386c9d
|
202 |
// 划扣自动打标签处理 |
a7ca2d
|
203 |
threadPool.getThreadPool().execute(() -> deductionSingleService.autoTag(id)); |
f23452
|
204 |
// 处理保妥适俱乐部权益 |
W |
205 |
threadPool.getThreadPool().execute(() -> deductionSingleService.handleBotoxClub(id)); |
9561fa
|
206 |
// 返回id |
f902c4
|
207 |
return Result.success(id); |
ce5acf
|
208 |
} |
A |
209 |
|
|
210 |
/** |
91476b
|
211 |
* 新增划扣记录(Phitab数据划扣) |
A |
212 |
*/ |
|
213 |
@RequestMapping(value = "/add/phitab", method = RequestMethod.POST) |
|
214 |
public Result addPhitabData(@RequestBody DeductionDto deductionDto) { |
|
215 |
logger.info("新增划扣记录(Phitab)打印入参数据:"+ JSONObject.toJSONString(deductionDto)); |
|
216 |
// 校验参数 |
|
217 |
checkParam(deductionDto); |
|
218 |
// 填充接口登入信息 |
|
219 |
deductionDto.setAppId("phitab"); |
|
220 |
deductionDto.setAppIdCode("phitab"); |
|
221 |
deductionDto.setSourceCode("phitab"); |
|
222 |
deductionDto.setSourceName("phitab"); |
|
223 |
// 添加数据 |
|
224 |
String id = deductionSingleService.addInfoPhitab(deductionDto); |
|
225 |
// 返回id |
|
226 |
return Result.success(id); |
|
227 |
} |
|
228 |
|
|
229 |
/** |
a748c2
|
230 |
* 新增划扣记录 直接划扣his系统 |
A |
231 |
*/ |
733901
|
232 |
//@RequestMapping(value = "/add", method = RequestMethod.POST) |
a748c2
|
233 |
public Result addHisData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
A |
234 |
// 获取用户信息 |
|
235 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
236 |
if (thirtApplication == null) { |
|
237 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
|
238 |
} |
|
239 |
// 填充接口登入信息 |
122cde
|
240 |
deductionDto.setAppId(thirtApplication.getAppId()); |
2b3e15
|
241 |
deductionDto.setAppIdCode(thirtApplication.getAppIdCode()); |
A |
242 |
deductionDto.setSourceCode(thirtApplication.getAppId()); |
a748c2
|
243 |
deductionDto.setSourceName(thirtApplication.getName()); |
A |
244 |
|
|
245 |
// 校验参数 |
|
246 |
if (StringUtils.isEmpty(deductionDto.getUserProjectId())) { |
|
247 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "userProjectId不能为空"); |
|
248 |
} |
|
249 |
|
|
250 |
if (StringUtils.isEmpty(deductionDto.getShopId())) { |
|
251 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "userProjectId不能为空"); |
|
252 |
} |
|
253 |
|
|
254 |
if (deductionDto.getDeductionNum() <= 0) { |
|
255 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "数量/划扣次数需要大于0"); |
|
256 |
} |
|
257 |
|
|
258 |
// 划扣成功返回hisId |
2b2a8f
|
259 |
//String id = deductionSingleService.hisDeduction(deductionDto); |
A |
260 |
String id = ""; |
a748c2
|
261 |
return Result.success(id); |
A |
262 |
} |
|
263 |
|
|
264 |
/** |
124a87
|
265 |
* 批量新增划扣记录 |
A |
266 |
*/ |
|
267 |
@RequestMapping(value = "/batch/add", method = RequestMethod.POST) |
7e73af
|
268 |
public Result batchAddData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
0b5aa8
|
269 |
logger.info("批量新增划扣记录打印入参数据:"+ JSONObject.toJSONString(deductionDto)); |
124a87
|
270 |
// 获取用户信息 |
f09b41
|
271 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
124a87
|
272 |
if (thirtApplication == null) { |
75bbef
|
273 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
124a87
|
274 |
} |
A |
275 |
// 填充接口登入信息 |
122cde
|
276 |
deductionDto.setAppId(thirtApplication.getAppId()); |
2b3e15
|
277 |
deductionDto.setAppIdCode(thirtApplication.getAppIdCode()); |
A |
278 |
deductionDto.setSourceCode(thirtApplication.getAppId()); |
124a87
|
279 |
deductionDto.setSourceName(thirtApplication.getName()); |
A |
280 |
|
7e73af
|
281 |
// 判断 批量添加项目id列表 是否为空 |
A |
282 |
if (StringUtils.isEmpty(deductionDto.getUserProjectIds())) { |
|
283 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "批量添加项目id列表不能为空"); |
|
284 |
} |
|
285 |
|
124a87
|
286 |
// 解析批量id |
7e73af
|
287 |
List<String> userProjectIdList = JSONArray.parseArray(deductionDto.getUserProjectIds(), String.class); |
124a87
|
288 |
|
A |
289 |
// 判断是否传值 |
7e73af
|
290 |
if (userProjectIdList == null) { |
124a87
|
291 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户项目id列表不能为空!"); |
A |
292 |
} |
|
293 |
|
|
294 |
// 批量划扣 |
|
295 |
for (String userProjectId : userProjectIdList) { |
|
296 |
deductionDto.setUserProjectId(userProjectId); |
|
297 |
// 添加数据 |
f09b41
|
298 |
String id = deductionSingleService.editInfo(deductionDto, BaseEntity.YES); |
15a3e0
|
299 |
// 切换领建屏蔽代码 date:20230108 |
A |
300 |
/*// 参数构造 |
f19135
|
301 |
DeductionDto paramDeductionDto = new DeductionDto(); |
A |
302 |
paramDeductionDto.setDeductionSingleId(id); |
f09b41
|
303 |
// 同步划扣记录到his系统 |
8b91a7
|
304 |
String returnData; |
f09b41
|
305 |
try { |
8b91a7
|
306 |
returnData = ApiPlatformUtil.syncHisDeduction(customParameter, id); |
A |
307 |
} catch (Exception ex) { |
|
308 |
logger.error("同步划扣数据到his系统失败!", ex); |
|
309 |
// his操作失败删除记录 |
f19135
|
310 |
deductionSingleService.deleteOne(paramDeductionDto, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_CANCEL); |
8b91a7
|
311 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "同步划扣到his系统失败! 返回错误消息:" + ex.getMessage()); |
A |
312 |
} |
|
313 |
// 处理返回消息 |
|
314 |
if (!StringUtils.isEmpty(returnData)) { |
|
315 |
JSONObject jsonObject = JSONObject.parseObject(returnData); |
|
316 |
String code = jsonObject.getString("code"); |
|
317 |
if (!"100".equals(code)) { |
|
318 |
String error = jsonObject.getString("msg"); |
|
319 |
// his操作失败删除记录 |
f19135
|
320 |
deductionSingleService.deleteOne(paramDeductionDto, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_CANCEL); |
8b91a7
|
321 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "同步划扣到his系统失败! 返回错误消息:" + error); |
A |
322 |
} else { |
|
323 |
String hisId = jsonObject.getString("data"); |
|
324 |
if (!StringUtils.isEmpty(hisId)) { |
|
325 |
SqlSentence sqlSentence = new SqlSentence(); |
|
326 |
String sql = String.format(" hisId='%s' WHERE isDel = 0 AND id ='%s'", hisId, id); |
|
327 |
sqlSentence.setSqlSentence(sql); |
|
328 |
deductionSingleService.updateWhere(sqlSentence); |
f09b41
|
329 |
} |
A |
330 |
} |
cac076
|
331 |
} else { |
f19135
|
332 |
deductionSingleService.deleteOne(paramDeductionDto, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_CANCEL); |
b5e175
|
333 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "同步划扣到his系统失败! 返回空消息!"); |
15a3e0
|
334 |
}*/ |
124a87
|
335 |
} |
A |
336 |
return Result.success(); |
|
337 |
} |
|
338 |
|
|
339 |
/** |
24edcd
|
340 |
* 修改划扣记录 注释划扣没有编辑功能 |
b3afa9
|
341 |
*/ |
f19135
|
342 |
@RequestMapping(value = "/update", method = RequestMethod.POST) |
7e73af
|
343 |
public Result updateData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
6e43b8
|
344 |
logger.info("修改划扣记录打印入参数据:"+ JSONObject.toJSONString(deductionDto)); |
b3afa9
|
345 |
// 判断deductionSingleId 是否为空 |
124a87
|
346 |
if (StringUtils.isEmpty(deductionDto.getDeductionSingleId())) { |
A |
347 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空"); |
b3afa9
|
348 |
} |
A |
349 |
// 校验参数 |
|
350 |
checkParam(deductionDto); |
|
351 |
// 获取用户信息 |
f09b41
|
352 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
124a87
|
353 |
if (thirtApplication == null) { |
75bbef
|
354 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
b3afa9
|
355 |
} |
A |
356 |
// 填充接口登入信息 |
122cde
|
357 |
deductionDto.setAppId(thirtApplication.getAppId()); |
2b3e15
|
358 |
deductionDto.setAppIdCode(thirtApplication.getAppIdCode()); |
A |
359 |
deductionDto.setSourceCode(thirtApplication.getAppId()); |
b3afa9
|
360 |
deductionDto.setSourceName(thirtApplication.getName()); |
A |
361 |
|
|
362 |
// 添加数据 |
|
363 |
deductionSingleService.editInfo(deductionDto, BaseEntity.NO); |
|
364 |
|
|
365 |
return Result.success(); |
|
366 |
} |
|
367 |
|
|
368 |
/** |
ab2827
|
369 |
* 删除记录 |
b3afa9
|
370 |
*/ |
A |
371 |
@RequestMapping(value = "/delete", method = RequestMethod.POST) |
f19135
|
372 |
public Result deleteData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
9f7609
|
373 |
logger.info("删除划扣记录接口打印入参数据:"+ JSONObject.toJSONString(deductionDto)); |
f19135
|
374 |
// 判断deductionSingleId 是否为空 |
A |
375 |
if (StringUtils.isEmpty(deductionDto.getDeductionSingleId())) { |
124a87
|
376 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空"); |
f19135
|
377 |
} |
A |
378 |
// 判断操作人id 是否为空 |
|
379 |
if (StringUtils.isEmpty(deductionDto.getOperatorId())) { |
|
380 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "operatorId不能为空"); |
b3afa9
|
381 |
} |
9a17f1
|
382 |
// 验签数据 |
f09b41
|
383 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
124a87
|
384 |
if (thirtApplication == null) { |
75bbef
|
385 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
b3afa9
|
386 |
} |
A |
387 |
// 删除数据 |
9f7609
|
388 |
deductionSingleService.deleteOne(deductionDto, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_CANCEL, BaseEntity.NO); |
a7ca2d
|
389 |
|
C |
390 |
logger.info("多线程队列数DeductionController-2:{}", threadPool.getThreadPool().getQueue().size()); |
9a17f1
|
391 |
// 计算撤销或删除划扣业绩信息 |
a7ca2d
|
392 |
threadPool.getThreadPool().execute(() -> this.handlerPerformanceInfoDeduction(deductionDto.getDeductionSingleId(), BaseEntity.NO)); |
386c9d
|
393 |
// 划扣自动打标签处理 |
a7ca2d
|
394 |
threadPool.getThreadPool().execute(() -> deductionSingleService.autoTag(deductionDto.getDeductionSingleId())); |
9a17f1
|
395 |
// 返回 |
b3afa9
|
396 |
return Result.success(); |
A |
397 |
} |
|
398 |
|
|
399 |
/** |
9e09dd
|
400 |
* 作废记录 |
b3afa9
|
401 |
*/ |
A |
402 |
@RequestMapping(value = "/rescinded", method = RequestMethod.POST) |
f19135
|
403 |
public Result rescindedData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
9f7609
|
404 |
logger.info("撤销划扣记录接口打印入参数据:"+ JSONObject.toJSONString(deductionDto)); |
f19135
|
405 |
// 判断deductionSingleId 是否为空 |
A |
406 |
if (StringUtils.isEmpty(deductionDto.getDeductionSingleId())) { |
124a87
|
407 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空"); |
f19135
|
408 |
} |
A |
409 |
// 判断操作人id 是否为空 |
|
410 |
if (StringUtils.isEmpty(deductionDto.getOperatorId())) { |
|
411 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "operatorId不能为空"); |
b3afa9
|
412 |
} |
6087e8
|
413 |
// 验签数据 |
f09b41
|
414 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
124a87
|
415 |
if (thirtApplication == null) { |
75bbef
|
416 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
b3afa9
|
417 |
} |
A |
418 |
// 删除数据 |
9f7609
|
419 |
deductionSingleService.deleteOne(deductionDto, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_RESCINDED, BaseEntity.NO); |
a7ca2d
|
420 |
logger.info("多线程队列数DeductionController-3:{}", threadPool.getThreadPool().getQueue().size()); |
9f7609
|
421 |
// 计算撤销或删除划扣业绩信息 |
a7ca2d
|
422 |
threadPool.getThreadPool().execute(() -> this.handlerPerformanceInfoDeduction(deductionDto.getDeductionSingleId(), BaseEntity.NO)); |
386c9d
|
423 |
// 划扣自动打标签处理 |
a7ca2d
|
424 |
threadPool.getThreadPool().execute(() -> deductionSingleService.autoTag(deductionDto.getDeductionSingleId())); |
f23452
|
425 |
// 保妥适俱乐部撤回赠送优惠券 |
W |
426 |
threadPool.getThreadPool().execute(() -> deductionSingleService.cancelDeductionSingleCoupon(deductionDto.getDeductionSingleId())); |
386c9d
|
427 |
// 返回 |
9f7609
|
428 |
return Result.success(); |
A |
429 |
} |
|
430 |
|
|
431 |
/** |
|
432 |
* 作废记录(不退回库存) |
|
433 |
*/ |
|
434 |
@RequestMapping(value = "/rescinded/not/stock", method = RequestMethod.POST) |
|
435 |
public Result rescindedNotStockData(HttpServletRequest request, @RequestBody DeductionDto deductionDto) { |
|
436 |
logger.info("撤销划扣记录(不退回库存)接口打印入参数据:" + JSONObject.toJSONString(deductionDto)); |
|
437 |
// 判断deductionSingleId 是否为空 |
|
438 |
if (StringUtils.isEmpty(deductionDto.getDeductionSingleId())) { |
|
439 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空"); |
|
440 |
} |
|
441 |
// 判断操作人id 是否为空 |
|
442 |
if (StringUtils.isEmpty(deductionDto.getOperatorId())) { |
|
443 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "operatorId不能为空"); |
|
444 |
} |
|
445 |
// 验签数据 |
|
446 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
447 |
if (thirtApplication == null) { |
|
448 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
|
449 |
} |
|
450 |
// 删除数据 |
|
451 |
deductionSingleService.deleteOne(deductionDto, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_RESCINDED, BaseEntity.YES); |
a7ca2d
|
452 |
logger.info("多线程队列数DeductionController-4:{}", threadPool.getThreadPool().getQueue().size()); |
C |
453 |
|
6087e8
|
454 |
// 计算撤销或删除划扣业绩信息 |
a7ca2d
|
455 |
threadPool.getThreadPool().execute(() -> this.handlerPerformanceInfoDeduction(deductionDto.getDeductionSingleId(), BaseEntity.NO)); |
b3afa9
|
456 |
return Result.success(); |
A |
457 |
} |
|
458 |
|
|
459 |
/** |
f09b41
|
460 |
* 同步划扣到his系统 |
A |
461 |
*/ |
|
462 |
@RequestMapping(value = "/sync/deduction/his", method = RequestMethod.POST) |
|
463 |
public PlatformResult syncToHis(HttpServletRequest request) { |
|
464 |
// 获取返回参数 |
|
465 |
String bodyData = HttpServletRequestUtil.getBody(request); |
|
466 |
if (StringUtils.isEmpty(bodyData)) { |
|
467 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "数据格式错误"); |
|
468 |
} |
|
469 |
|
|
470 |
// 获取传参 |
|
471 |
JSONObject jsonObject = JSONObject.parseObject(bodyData); |
|
472 |
if (jsonObject == null || !jsonObject.containsKey("deductionSingleId")) { |
|
473 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "参数错误!"); |
|
474 |
} |
|
475 |
|
|
476 |
String deductionSingleId = jsonObject.getString("deductionSingleId"); |
|
477 |
|
|
478 |
if (StringUtils.isEmpty(deductionSingleId)) { |
|
479 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "划扣记录id不能为空!"); |
|
480 |
} |
|
481 |
|
|
482 |
DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(deductionSingleId); |
|
483 |
if (deductionSingle == null) { |
|
484 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "未找到划扣记录!"); |
8b91a7
|
485 |
} else { |
A |
486 |
if (!StringUtils.isEmpty(deductionSingle.getHisId())) { |
f09b41
|
487 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "您的记录已同步,请不要重复同步划扣记录!"); |
A |
488 |
} |
|
489 |
} |
|
490 |
|
15a3e0
|
491 |
// 切换领建屏蔽代码 date:20230108 |
A |
492 |
/*// 同步划扣记录到his系统 |
8b91a7
|
493 |
String returnHisData; |
f09b41
|
494 |
try { |
8b91a7
|
495 |
returnHisData = ApiPlatformUtil.syncHisDeduction(customParameter, deductionSingleId); |
A |
496 |
} catch (Exception ex) { |
|
497 |
logger.error("同步划扣数据到his系统失败!", ex); |
|
498 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "同步划扣到his系统失败! 返回错误消息:" + ex.getMessage()); |
|
499 |
} |
|
500 |
if (!StringUtils.isEmpty(returnHisData)) { |
|
501 |
JSONObject jsonHisObject = JSONObject.parseObject(returnHisData); |
|
502 |
String code = jsonHisObject.getString("code"); |
|
503 |
if (!"100".equals(code)) { |
|
504 |
String error = jsonHisObject.getString("msg"); |
|
505 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "同步划扣到his系统失败! 返回错误消息:" + error); |
|
506 |
} else { |
|
507 |
String hisId = jsonHisObject.getString("data"); |
|
508 |
if (!StringUtils.isEmpty(hisId)) { |
|
509 |
SqlSentence sqlSentence = new SqlSentence(); |
|
510 |
String sql = String.format(" hisId='%s' WHERE isDel = 0 AND id ='%s'", hisId, deductionSingleId); |
|
511 |
sqlSentence.setSqlSentence(sql); |
|
512 |
deductionSingleService.updateWhere(sqlSentence); |
f09b41
|
513 |
} |
A |
514 |
} |
cac076
|
515 |
} else { |
b5e175
|
516 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "同步划扣到his系统失败! 返回空消息!"); |
15a3e0
|
517 |
}*/ |
f09b41
|
518 |
return PlatformResult.success(); |
A |
519 |
} |
|
520 |
|
|
521 |
/** |
d18d20
|
522 |
* 同步修改划扣到his系统 |
A |
523 |
*/ |
|
524 |
@RequestMapping(value = "/sync/edit/deduction/his", method = RequestMethod.POST) |
|
525 |
public PlatformResult syncEditHis(HttpServletRequest request) { |
|
526 |
// 获取返回参数 |
|
527 |
String bodyData = HttpServletRequestUtil.getBody(request); |
|
528 |
if (StringUtils.isEmpty(bodyData)) { |
|
529 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "数据格式错误"); |
|
530 |
} |
|
531 |
|
|
532 |
// 获取传参 |
|
533 |
JSONObject jsonObject = JSONObject.parseObject(bodyData); |
|
534 |
if (jsonObject == null || !jsonObject.containsKey("deductionSingleId")) { |
|
535 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "参数错误!"); |
|
536 |
} |
|
537 |
|
|
538 |
String deductionSingleId = jsonObject.getString("deductionSingleId"); |
|
539 |
|
|
540 |
if (StringUtils.isEmpty(deductionSingleId)) { |
|
541 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "划扣记录id不能为空!"); |
|
542 |
} |
|
543 |
|
|
544 |
DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(deductionSingleId); |
|
545 |
if (deductionSingle == null) { |
|
546 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "未找到划扣记录!"); |
|
547 |
} |
15a3e0
|
548 |
// 切换领建屏蔽代码 date:20230108 |
A |
549 |
/*// 同步操作到领建 |
|
550 |
deductionSingleService.syncEditHisDeduction(deductionSingle.getId());*/ |
d18d20
|
551 |
// 返回 |
A |
552 |
return PlatformResult.success(); |
ce5acf
|
553 |
} |
a03a07
|
554 |
|
Z |
555 |
/** |
|
556 |
* 查看his划扣接口 |
|
557 |
*/ |
|
558 |
@RequestMapping(value = "/sync/executionRecord/get/obtain", method = RequestMethod.POST) |
|
559 |
public PlatformResult syncToHis(HttpServletRequest request,@RequestBody(required = false) DeductionDto dto) { |
|
560 |
if (dto==null) { |
|
561 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "数据格式异常"); |
|
562 |
} |
|
563 |
|
|
564 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
565 |
if (thirtApplication == null) { |
|
566 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败!"); |
|
567 |
} |
|
568 |
if(StringUtils.isEmpty(dto.getUserId())){ |
|
569 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户标识未空"); |
|
570 |
} |
|
571 |
if(StringUtils.isEmpty(dto.getShopId())){ |
|
572 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "门店标识未空"); |
|
573 |
} |
|
574 |
SqlSentence sqlSentence = new SqlSentence(); |
|
575 |
Map<String,Object> map=new HashMap<>(); |
|
576 |
sqlSentence.setM(map); |
|
577 |
map.put("isDel",BaseEntity.NO); |
|
578 |
map.put("userId",dto.getUserId()); |
|
579 |
map.put("shopId",dto.getShopId()); |
|
580 |
User user=commonService.selectOneByKey(UserMapper.class,dto.getUserId()); |
|
581 |
if(user==null){ |
|
582 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "该用户不存在"); |
|
583 |
} |
|
584 |
Shop shop=commonService.selectOneByKey(ShopMapper.class,dto.getShopId()); |
|
585 |
if(shop==null){ |
|
586 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "该门店不存在"); |
|
587 |
} |
15a3e0
|
588 |
// 切换领建屏蔽代码 date:20230108 |
A |
589 |
/*JSONObject param =new JSONObject(); |
a03a07
|
590 |
param.put("clinicId",shop.getApiId()); |
Z |
591 |
param.put("customerId",user.getApiId()); |
|
592 |
param.put("page",dto.getPage()==null?0:dto.getPage()); |
1b8542
|
593 |
param.put("size",dto.getSize()==null?20:dto.getSize()); |
cfe475
|
594 |
param.put("start",dto.getLogStartTime()); |
a03a07
|
595 |
param.put("end",dto.getLogEndTime()); |
Z |
596 |
String returnData = ApiPlatformUtil.executionRecordLog(customParameter, param); |
|
597 |
if(StringUtils.noNull(returnData)){ |
|
598 |
JSONObject jsonObject = JSONObject.parseObject(returnData); |
|
599 |
String code = jsonObject.getString("code"); |
|
600 |
if("100".equals(code)){ |
|
601 |
String data = jsonObject.getString("data"); |
|
602 |
if(StringUtils.isEmpty(data)){ |
|
603 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"同步中心-查看划扣日志操作:返回data没有数据"); |
|
604 |
} |
1b8542
|
605 |
JSONObject contentsObject = JSONObject.parseObject(data); |
Z |
606 |
JSONObject object; |
|
607 |
JSONArray jsonArray=new JSONArray(); |
|
608 |
if(contentsObject!=null){ |
|
609 |
JSONArray contentList = contentsObject.getJSONArray("content"); |
|
610 |
if(contentList!=null || contentList.size()>0){ |
|
611 |
for(int i=0;i<contentList.size();i++){ |
|
612 |
object=new JSONObject(); |
|
613 |
JSONObject datas = contentList.getJSONObject(i); |
|
614 |
|
|
615 |
JSONObject creator = datas.getJSONObject("creator");//创建人 |
|
616 |
JSONObject service = datas.getJSONObject("service");//项目 |
|
617 |
Long executedDate = datas.getLong("executedDate");//执行时间 |
|
618 |
|
7f621c
|
619 |
Project project=null; |
Z |
620 |
if(service != null){ |
|
621 |
map.clear(); |
|
622 |
map.put("apiId",service.getString("id")); |
|
623 |
sqlSentence.setSqlSentence("select * from project where apiId =#{m.apiId} and isDel=0 "); |
|
624 |
project=commonService.selectOne(ProjectMapper.class,sqlSentence); |
|
625 |
} |
|
626 |
Employee employee=null; |
|
627 |
if(creator!=null){ |
|
628 |
map.clear(); |
|
629 |
map.put("apiId",creator.getString("id")); |
|
630 |
sqlSentence.setSqlSentence("select * from employee where apiId =#{m.apiId} and isDel=0 "); |
|
631 |
employee=commonService.selectOne(EmployeeMapper.class,sqlSentence); |
|
632 |
} |
|
633 |
|
1b8542
|
634 |
//执行时间 |
Z |
635 |
object.put("executedDate",executedDate==null?"": DateUtil.timestampToDate(executedDate,"yyyy-MM-dd HH:mm:ss")); |
|
636 |
object.put("executedDate",executedDate==null?"": executedDate); |
|
637 |
//划扣项目 |
|
638 |
object.put("projectName",project==null ?"":project.getName()); |
|
639 |
object.put("projectId",project==null ?"":project.getId()); |
|
640 |
object.put("projectHisId",project==null ?"":project.getApiId()); |
|
641 |
//执行次数 |
|
642 |
object.put("quantity",datas.getInteger("quantity")==null ?0:datas.getInteger("quantity")); |
|
643 |
//创建人 |
|
644 |
object.put("projectName",employee==null ?"":employee.getCnName()); |
|
645 |
object.put("projectId",employee==null ?"":employee.getId()); |
|
646 |
object.put("projectHisId",employee==null ?"":employee.getApiId()); |
|
647 |
|
|
648 |
jsonArray.add(object); |
|
649 |
} |
|
650 |
} |
|
651 |
} |
|
652 |
return PlatformResult.success(jsonArray); |
a03a07
|
653 |
}else{ |
Z |
654 |
//旭爷说除了100 都是失败 |
|
655 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"同步中心-查看划扣日志:同步中心返回的状态:"+code); |
|
656 |
} |
|
657 |
}else{ |
|
658 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"同步中心-查看划扣日志操作解析第三方参数为空"); |
15a3e0
|
659 |
}*/ |
A |
660 |
return PlatformResult.success(); |
a03a07
|
661 |
} |
dc3f28
|
662 |
|
A |
663 |
/** |
4d6a6b
|
664 |
* 发送单条公众号消息 |
A |
665 |
*/ |
|
666 |
@RequestMapping(value = "/send/gzh/notice", method = RequestMethod.POST) |
|
667 |
public PlatformResult sendGZHNotice(HttpServletRequest request, @RequestBody DeductionDto dto) { |
|
668 |
if (dto == null) { |
|
669 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣参数"); |
|
670 |
} |
|
671 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
672 |
if (thirtApplication == null) { |
|
673 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "签名失败,请检查签名!"); |
|
674 |
} |
|
675 |
if (StringUtils.isEmpty(dto.getDeductionSingleId())) { |
|
676 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣id参数"); |
|
677 |
} |
c25b2a
|
678 |
logger.info("打印发送单条公众号消息接口参数:{}", JSONObject.toJSONString(dto)); |
4d6a6b
|
679 |
// 校验参数 |
A |
680 |
DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(dto.getDeductionSingleId()); |
|
681 |
if (deductionSingle == null) { |
|
682 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "划扣记录不存在"); |
|
683 |
} |
|
684 |
// 发送单条公众号消息 |
|
685 |
deductionSingleService.sendGZHNotice(dto.getDeductionSingleId()); |
|
686 |
// 返回 |
|
687 |
return PlatformResult.success(); |
|
688 |
} |
|
689 |
|
|
690 |
/** |
dc3f28
|
691 |
* 划扣客户确认 |
4d6a6b
|
692 |
*/ |
dc3f28
|
693 |
@RequestMapping(value = "/customer/confirm", method = RequestMethod.POST) |
A |
694 |
public PlatformResult customerConfirm(HttpServletRequest request, @RequestBody DeductionDto dto) { |
|
695 |
if (dto == null) { |
|
696 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣参数"); |
|
697 |
} |
|
698 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
699 |
if (thirtApplication == null) { |
|
700 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "签名失败,请检查签名!"); |
|
701 |
} |
|
702 |
if (StringUtils.isEmpty(dto.getDeductionSingleId())) { |
|
703 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣id参数"); |
|
704 |
} |
|
705 |
if (dto.getIsCustomerConfirm() == null) { |
|
706 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传是否客户确认参数"); |
4d6a6b
|
707 |
} else { |
A |
708 |
if (!BaseEntity.YES.equals(dto.getIsCustomerConfirm())) { |
|
709 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传正确的客户确认值"); |
|
710 |
} |
dc3f28
|
711 |
} |
c25b2a
|
712 |
logger.info("打印客户确认划扣参数:{}", JSONObject.toJSONString(dto)); |
dc3f28
|
713 |
// 校验参数 |
A |
714 |
DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(dto.getDeductionSingleId()); |
|
715 |
if (deductionSingle == null) { |
|
716 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "划扣记录不存在"); |
|
717 |
} |
|
718 |
if (deductionSingle.getIsCustomerConfirm() != null) { |
|
719 |
if (BaseEntity.YES.equals(deductionSingle.getIsCustomerConfirm())) { |
|
720 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "划扣记录已确认,请勿重复确认!"); |
|
721 |
} |
|
722 |
} |
|
723 |
// 处理状态 |
|
724 |
deductionSingleService.customerConfirm(dto.getDeductionSingleId(), dto.getIsCustomerConfirm()); |
|
725 |
// 返回 |
|
726 |
return PlatformResult.success(); |
|
727 |
} |
4d6a6b
|
728 |
|
A |
729 |
/** |
|
730 |
* 划扣客户确认所有 |
|
731 |
*/ |
|
732 |
@RequestMapping(value = "/customer/confirm/all", method = RequestMethod.POST) |
|
733 |
public PlatformResult customerConfirmAll(HttpServletRequest request, @RequestBody DeductionDto dto) { |
|
734 |
if (dto == null) { |
|
735 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣参数"); |
|
736 |
} |
|
737 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
738 |
if (thirtApplication == null) { |
|
739 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "签名失败,请检查签名!"); |
|
740 |
} |
|
741 |
if (StringUtils.isEmpty(dto.getUserId())) { |
|
742 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传用户id参数"); |
|
743 |
} |
|
744 |
if (dto.getIsCustomerConfirm() == null) { |
|
745 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传是否客户确认参数"); |
|
746 |
} else { |
|
747 |
if (!BaseEntity.YES.equals(dto.getIsCustomerConfirm())) { |
|
748 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传正确的客户确认值"); |
|
749 |
} |
|
750 |
} |
c25b2a
|
751 |
logger.info("打印客户确认所有划扣参数:{}", JSONObject.toJSONString(dto)); |
4d6a6b
|
752 |
// 校验参数 |
A |
753 |
User user = commonService.selectOneByKey(UserMapper.class, dto.getUserId()); |
|
754 |
if (user == null) { |
|
755 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "划用户不存在"); |
|
756 |
} |
|
757 |
// 处理状态 |
|
758 |
deductionSingleService.customerConfirmAll(dto.getUserId(), dto.getIsCustomerConfirm()); |
|
759 |
// 返回 |
|
760 |
return PlatformResult.success(); |
|
761 |
} |
|
762 |
|
|
763 |
/** |
|
764 |
* 划扣客户确认之前页面 |
|
765 |
*/ |
|
766 |
@RequestMapping(value = "/customer/confirm/before", method = RequestMethod.POST) |
|
767 |
public PlatformResult customerConfirmBefore(HttpServletRequest request, @RequestBody DeductionDto dto) { |
|
768 |
if (dto == null) { |
|
769 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣参数"); |
|
770 |
} |
|
771 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
772 |
if (thirtApplication == null) { |
|
773 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "签名失败,请检查签名!"); |
|
774 |
} |
|
775 |
if (StringUtils.isEmpty(dto.getDeductionSingleId())) { |
|
776 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣id参数"); |
|
777 |
} |
c25b2a
|
778 |
logger.info("打印客户确认划扣之前页面接口参数:{}", JSONObject.toJSONString(dto)); |
4d6a6b
|
779 |
// 校验参数 |
A |
780 |
DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(dto.getDeductionSingleId()); |
|
781 |
if (deductionSingle == null) { |
|
782 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "划扣记录不存在"); |
|
783 |
} |
|
784 |
// 数据查询 |
|
785 |
Map<String, Object> data = deductionSingleService.customerConfirmBefore(dto, deductionSingle); |
|
786 |
// 返回 |
|
787 |
return PlatformResult.success(data); |
|
788 |
} |
9a17f1
|
789 |
|
A |
790 |
/** |
36ca20
|
791 |
* 划扣客户确认之前页面所有未确认数据 |
A |
792 |
*/ |
|
793 |
@RequestMapping(value = "/customer/confirm/all/before", method = RequestMethod.POST) |
|
794 |
public PlatformResult customerConfirmAllBefore(HttpServletRequest request, @RequestBody DeductionDto dto) { |
|
795 |
if (dto == null) { |
|
796 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传划扣参数"); |
|
797 |
} |
|
798 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
799 |
if (thirtApplication == null) { |
|
800 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "签名失败,请检查签名!"); |
|
801 |
} |
|
802 |
if (StringUtils.isEmpty(dto.getUserId())) { |
|
803 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传用户id参数"); |
|
804 |
} |
|
805 |
logger.info("打印客户确认划扣之前页面所有数据接口参数:{}", JSONObject.toJSONString(dto)); |
|
806 |
// 校验参数 |
|
807 |
User user = commonService.selectOneByKey(UserMapper.class, dto.getUserId()); |
|
808 |
if (user == null) { |
|
809 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "划用户不存在"); |
|
810 |
} |
|
811 |
// 返回数据处理 |
|
812 |
List<Map<String, Object>> list = new ArrayList<>(); |
|
813 |
// 获取数据处理 |
|
814 |
SqlSentence sqlSentence = new SqlSentence(); |
|
815 |
Map<String, Object> sqlValues = new HashMap<>(); |
|
816 |
sqlValues.put("isDel", BaseEntity.NO); |
|
817 |
sqlValues.put("userId", dto.getUserId()); |
|
818 |
sqlValues.put("isCustomerConfirm", BaseEntity.NO); |
|
819 |
sqlValues.put("status", DeductionSingleConstants.STATUS_DONE_EXECUTE); |
|
820 |
String sql = "SELECT * FROM deduction_single WHERE userId=#{m.userId} AND status=#{m.status} " + |
|
821 |
"AND isCustomerConfirm=#{m.isCustomerConfirm} AND isDel=#{m.isDel} ORDER BY createTime DESC"; |
|
822 |
sqlSentence.sqlSentence(sql, sqlValues); |
|
823 |
List<DeductionSingle> deductionSingleList = deductionSingleService.selectList(sqlSentence); |
|
824 |
if (deductionSingleList != null && deductionSingleList.size() > 0) { |
|
825 |
for (DeductionSingle deductionSingle : deductionSingleList) { |
|
826 |
// 数据查询 |
|
827 |
Map<String, Object> data = deductionSingleService.customerConfirmBefore(dto, deductionSingle); |
|
828 |
if (data != null && data.size() > 0) { |
|
829 |
list.add(data); |
|
830 |
} |
|
831 |
} |
|
832 |
} |
|
833 |
// 返回 |
|
834 |
return PlatformResult.success(list); |
|
835 |
} |
|
836 |
|
|
837 |
/** |
9a17f1
|
838 |
* 划扣计算业绩信息 |
A |
839 |
* @param deductionSingleId 划扣id |
|
840 |
* @param type 是否 新增划扣 0 否(撤销划扣) 1 是(新增划扣) |
|
841 |
*/ |
|
842 |
private synchronized void handlerPerformanceInfoDeduction(String deductionSingleId, Integer type) { |
|
843 |
try { |
|
844 |
deductionSingleService.handlerPerformanceInfoDeduction(deductionSingleId, type); |
|
845 |
} catch (Exception ex) { |
071df8
|
846 |
// 打印日志 |
9a17f1
|
847 |
logger.error("划扣计算业绩信息出现错误,划扣id:{},错误信息:{}", deductionSingleId, ex); |
071df8
|
848 |
// 添加错误日志 |
A |
849 |
PerformanceInfoTool.addErrorLog(commonService, deductionSingleId, PerformanceInfo.ASSOCIATION_TYPE_DEDUCTION, ex.getMessage()); |
9a17f1
|
850 |
// 企业微信错误提示 |
cc0f6d
|
851 |
deductionSingleService.performanceInfoErrorTips(deductionSingleId, ex.getMessage()); |
9a17f1
|
852 |
} |
A |
853 |
} |
b5ff39
|
854 |
|
A |
855 |
/** |
|
856 |
* 获取用户划扣信息之前医生信息 |
|
857 |
*/ |
|
858 |
@RequestMapping(value = "/project/before/doctor/info", method = RequestMethod.POST) |
|
859 |
public Result projectBeforeDoctorInfo(@RequestBody(required = false) DeductionDto dto) { |
|
860 |
if (dto == null) { |
|
861 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "数据格式错误"); |
|
862 |
} |
|
863 |
if (StringUtils.isEmpty(dto.getUserId())) { |
|
864 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传用户id!"); |
|
865 |
} |
|
866 |
// 判断用户信息 |
|
867 |
User user = commonService.selectOneByKey(UserMapper.class, dto.getUserId()); |
|
868 |
if (user == null) { |
|
869 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到用户!"); |
|
870 |
} |
f650ee
|
871 |
// 项目id数据 |
A |
872 |
if (dto.getProjectIds() == null || dto.getProjectIds().size() < 1) { |
|
873 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传项目id数据!"); |
|
874 |
} |
|
875 |
// 获取数据并返回处理 |
|
876 |
List<Map<String, Object>> list = new ArrayList<>(); |
|
877 |
for (String projectId : dto.getProjectIds()) { |
|
878 |
// 获取数据处理 |
|
879 |
SqlSentence sqlSentence = new SqlSentence(); |
|
880 |
Map<String, Object> sqlValues = new HashMap<>(); |
|
881 |
sqlValues.put("isDel", BaseEntity.NO); |
|
882 |
sqlValues.put("userId", dto.getUserId()); |
|
883 |
sqlValues.put("projectId", projectId); |
|
884 |
sqlValues.put("status", DeductionSingleConstants.STATUS_DONE_EXECUTE); |
|
885 |
String sql = "SELECT dp.projectId,dp.projectName,dp.departmentId,dp.departmentCode,dp.departmentName,dp.primaryDoctorId,dp.primaryDoctorName," + |
|
886 |
"dp.treatmentDoctorId,dp.treatmentDoctorName FROM deduction_single AS ds LEFT JOIN deduction_project AS dp " + |
|
887 |
"ON dp.deductionSingleId=ds.id WHERE ds.userId=#{m.userId} AND ds.status=#{m.status} AND dp.projectId=#{m.projectId} " + |
|
888 |
"AND ds.isDel=#{m.isDel} ORDER BY ds.createTime DESC LIMIT 1"; |
|
889 |
sqlSentence.sqlSentence(sql, sqlValues); |
|
890 |
Map<String, Object> map = deductionProjectService.selectOneMap(sqlSentence); |
|
891 |
if (map != null) { |
|
892 |
list.add(map); |
|
893 |
} |
|
894 |
} |
b5ff39
|
895 |
// 返回数据 |
f650ee
|
896 |
return Result.success(list); |
b5ff39
|
897 |
} |
95d446
|
898 |
|
A |
899 |
/** |
|
900 |
* 划扣术后提示卡通知获取数据 |
|
901 |
*/ |
1d66cc
|
902 |
@RequestMapping(value = "/postoperative/card/info", method = RequestMethod.POST) |
A |
903 |
public PlatformResult postoperativeCardInfo(HttpServletRequest request, @RequestBody DeductionDto dto) { |
95d446
|
904 |
if (dto == null) { |
A |
905 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传参数"); |
|
906 |
} |
|
907 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
908 |
if (thirtApplication == null) { |
|
909 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "签名失败,请检查签名!"); |
|
910 |
} |
|
911 |
if (StringUtils.isEmpty(dto.getCommonId())) { |
|
912 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传id参数"); |
|
913 |
} |
|
914 |
logger.info("打印划扣术后提示卡通知获取数据接口参数:{}", JSONObject.toJSONString(dto)); |
|
915 |
// 校验参数 |
|
916 |
NotificationLog notificationLog = commonService.selectOneByKey(NotificationLogMapper.class, dto.getCommonId()); |
|
917 |
if (notificationLog == null) { |
|
918 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "数据不存在"); |
|
919 |
} |
|
920 |
// 获取项目信息 |
|
921 |
JSONArray projectIdList; |
|
922 |
try { |
|
923 |
projectIdList = JSONArray.parseArray(notificationLog.getOtherInfo()); |
|
924 |
} catch (Exception ex) { |
|
925 |
throw new TipsException("解析项目信息列表出现异常!"); |
|
926 |
} |
|
927 |
// 判断是否有项目信息 |
|
928 |
if (projectIdList.size() <= 0) { |
|
929 |
throw new TipsException("解析项目信息列表不能为空!"); |
|
930 |
} |
|
931 |
// 获取数据并返回处理 |
|
932 |
List<Map<String, Object>> list = new ArrayList<>(); |
|
933 |
// 查询数据 |
|
934 |
SqlSentence sqlSentence = new SqlSentence(); |
|
935 |
Map<String, Object> sqlValues = new HashMap<>(); |
|
936 |
sqlValues.put("isDel", BaseEntity.NO); |
|
937 |
StringBuilder sql = new StringBuilder(); |
|
938 |
// 获取查询数据 |
|
939 |
StringBuilder sqlIn = new StringBuilder(); |
|
940 |
for (int i = 0; i < projectIdList.size(); i++) { |
|
941 |
// 拼接数据 |
|
942 |
String projectId = projectIdList.getString(i); |
|
943 |
if (!StringUtils.isEmpty(projectId)) { |
|
944 |
sqlIn.append("'").append(projectId).append("'"); |
|
945 |
// 添加逗号符号分隔 |
|
946 |
if (i != projectIdList.size() - 1) { |
|
947 |
sqlIn.append(","); |
|
948 |
} |
|
949 |
} |
|
950 |
} |
|
951 |
sql.append(" SELECT * FROM project WHERE id IN (").append(sqlIn).append(") AND isDel=#{m.isDel} ORDER BY createTime ASC"); |
|
952 |
sqlSentence.sqlSentence(sql.toString(), sqlValues); |
|
953 |
List<Project> projectList = commonService.selectList(ProjectMapper.class, sqlSentence); |
|
954 |
if (projectList != null && projectList.size() > 0) { |
|
955 |
for (Project project : projectList) { |
|
956 |
// 返回数据 |
|
957 |
Map<String, Object> data = new HashMap<>(); |
|
958 |
data.put("projectId", project.getId()); |
|
959 |
data.put("projectName", project.getName()); |
|
960 |
data.put("postoperativeCardUrl", ""); |
82af02
|
961 |
// 获取术后提示卡信息 |
A |
962 |
IntroProjectManual introProjectManual = UserProjectTool.getIntroProjectManualByProject(commonService, project); |
95d446
|
963 |
if (introProjectManual != null && !StringUtils.isEmpty(introProjectManual.getContent())) { |
A |
964 |
data.put("postoperativeCardUrl", introProjectManual.getContent()); |
|
965 |
} |
|
966 |
list.add(data); |
|
967 |
} |
|
968 |
} |
|
969 |
// 返回 |
|
970 |
return PlatformResult.success(list); |
|
971 |
} |
ce5acf
|
972 |
} |