|
@@ -3,13 +3,14 @@ package com.ruoyi.zzb.zdcx.controller;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ruoyi.zzb.base.domain.BasePersonInfo;
|
|
|
import com.ruoyi.zzb.common.RspResult;
|
|
|
-import com.ruoyi.zzb.zdcx.domain.Zdcx;
|
|
|
import com.ruoyi.zzb.zdcx.service.ZdcxService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.sql.SQLIntegrityConstraintViolationException;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/zhzg/api/zdcx")
|
|
@@ -25,7 +26,7 @@ public class ZdcxController {
|
|
|
*/
|
|
|
@PostMapping("/query")
|
|
|
public JSONObject query(@RequestBody JSONObject reqBody){
|
|
|
- if(StringUtils.isBlank(reqBody.getString("queryFlag"))){
|
|
|
+ if(null == reqBody.getInteger("queryFlag")){
|
|
|
log.error("【查询标志】参数为空");
|
|
|
return RspResult.error("【查询标志】参数为空");
|
|
|
}
|
|
@@ -37,7 +38,7 @@ public class ZdcxController {
|
|
|
return RspResult.success(zdcxService.getDataByPage(reqBody));
|
|
|
}catch (Exception e){
|
|
|
log.error("根据条件分页查询制度信息发生异常", e);
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
+ return RspResult.error("根据条件分页查询制度信息发生异常 - " + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -54,15 +55,18 @@ public class ZdcxController {
|
|
|
return RspResult.error("【用户警号】参数为空");
|
|
|
}
|
|
|
// 根据警号查询当前登录用户信息,警号为前端传入
|
|
|
- BasePersonInfo basePersonInfo = zdcxService.getDataByParams(policeNo);
|
|
|
- if(basePersonInfo != null){
|
|
|
- boolean flag = zdcxService.insertStandardInfo(reqBody, basePersonInfo);
|
|
|
- if(flag){
|
|
|
- return RspResult.success();
|
|
|
+ try {
|
|
|
+ BasePersonInfo basePersonInfo = zdcxService.getDataByParams(policeNo);
|
|
|
+ if(basePersonInfo != null){
|
|
|
+ if(zdcxService.insertStandardInfo(reqBody, basePersonInfo)){
|
|
|
+ return RspResult.success();
|
|
|
+ }
|
|
|
}
|
|
|
- return RspResult.error("制度规范信息保存失败");
|
|
|
+ return RspResult.error("不存在用户信息,制度规范信息保存失败");
|
|
|
+ } catch (Exception e){
|
|
|
+ log.error("制度规范信息保存失败", e);
|
|
|
+ return RspResult.error("制度规范信息保存失败 - " + e.getMessage());
|
|
|
}
|
|
|
- return RspResult.error("不存在用户信息,制度规范信息保存失败");
|
|
|
}
|
|
|
|
|
|
|