|
@@ -2,6 +2,8 @@ package com.ruoyi.zzb.zdcx.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.annotation.DataSource;
|
|
|
import com.ruoyi.common.enums.DataSourceType;
|
|
|
import com.ruoyi.zzb.study.domain.BasePersonInfo;
|
|
@@ -9,6 +11,7 @@ import com.ruoyi.zzb.study.mapper.BasePersonInfoMapper;
|
|
|
import com.ruoyi.zzb.zdcx.domain.Zdcx;
|
|
|
import com.ruoyi.zzb.zdcx.mapper.ZdcxMapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -24,16 +27,22 @@ public class ZdcxService {
|
|
|
@Autowired
|
|
|
private BasePersonInfoMapper basePersonInfoMapper;
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据条件分页查询制度信息
|
|
|
+ * @param zdcx
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public Map<String, Object> getDataByPage(Zdcx zdcx){
|
|
|
Map<String, Object> rspMap = new HashMap<>();
|
|
|
- /*String docId = reqBody.getString("docId");
|
|
|
- String title = reqBody.getString("title");
|
|
|
- String zhidingDept = reqBody.getString("zhidingDept");
|
|
|
- String createTime = reqBody.getString("createTime");
|
|
|
- String content = reqBody.getString("content");
|
|
|
- Integer queryFlag = reqBody.getInteger("queryFlag");
|
|
|
- Integer pageNo = reqBody.getInteger("pageNo");
|
|
|
- Integer pageSize = reqBody.getInteger("pageSize");
|
|
|
+ String docId = zdcx.getDocId();
|
|
|
+ String title = zdcx.getTitle();
|
|
|
+ String publishDept = zdcx.getPublishDept();
|
|
|
+ String createTime = zdcx.getCreateTime();
|
|
|
+ String content = zdcx.getContent();
|
|
|
+ // 查询标志位 0:and,1:or
|
|
|
+ Integer queryFlag = zdcx.getQueryFlag();
|
|
|
+ Integer pageNo = zdcx.getPageNo();
|
|
|
+ Integer pageSize = zdcx.getPageSize();
|
|
|
|
|
|
QueryWrapper<Zdcx> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("FLAG", 1);
|
|
@@ -44,19 +53,19 @@ public class ZdcxService {
|
|
|
queryWrapper.eq("DOC_ID", docId);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(title)){
|
|
|
- if (queryFlag != 0){ // or
|
|
|
+ if (queryFlag != 0){
|
|
|
queryWrapper.or();
|
|
|
}
|
|
|
queryWrapper.eq("TITLE", title);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(zhidingDept)){
|
|
|
- if (queryFlag != 0){ // or
|
|
|
+ if(StringUtils.isNotBlank(publishDept)){
|
|
|
+ if (queryFlag != 0){
|
|
|
queryWrapper.or();
|
|
|
}
|
|
|
- queryWrapper.eq("ZHIDINGDEPT", zhidingDept);
|
|
|
+ queryWrapper.eq("PUBLISH_DEPT", publishDept);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(content)){
|
|
|
- if (queryFlag != 0){ // or
|
|
|
+ if (queryFlag != 0){
|
|
|
queryWrapper.or();
|
|
|
}
|
|
|
queryWrapper.like("CONTENT", content);
|
|
@@ -64,30 +73,53 @@ public class ZdcxService {
|
|
|
Page<Zdcx> page = new Page<>(pageNo, pageSize);
|
|
|
IPage<Zdcx> zdcxPage = zdcxMapper.selectPage(page, queryWrapper);
|
|
|
rspMap.put("list", zdcxPage.getRecords());
|
|
|
- rspMap.put("count", zdcxPage.getTotal());*/
|
|
|
+ rspMap.put("count", zdcxPage.getTotal());
|
|
|
|
|
|
- List<Zdcx> dataList = zdcxMapper.getDataByPage(zdcx);
|
|
|
+ /*List<Zdcx> dataList = zdcxMapper.getDataByPage(zdcx);
|
|
|
Long count = zdcxMapper.getDataCount(zdcx);
|
|
|
rspMap.put("list", dataList);
|
|
|
- rspMap.put("count", count);
|
|
|
+ rspMap.put("count", count);*/
|
|
|
return rspMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据警号查询当前用户信息
|
|
|
+ * @param policeNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public BasePersonInfo getDataByParams(String policeNo){
|
|
|
QueryWrapper<BasePersonInfo> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("POLICE_NO", policeNo);
|
|
|
return basePersonInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
- public boolean insert(JSONObject reqBody, BasePersonInfo basePersonInfo){
|
|
|
+ /**
|
|
|
+ * 根据参数保存一条制度规范信息
|
|
|
+ * @param reqBody
|
|
|
+ * @param basePersonInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean insertStandardInfo(JSONObject reqBody, BasePersonInfo basePersonInfo){
|
|
|
Zdcx zdcx = new Zdcx();
|
|
|
+ // 制度信息
|
|
|
zdcx.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ zdcx.setDocId(reqBody.getString("docId"));
|
|
|
+ zdcx.setTitle(reqBody.getString("title"));
|
|
|
+ zdcx.setPublishDept(reqBody.getString("publishDept"));
|
|
|
+ zdcx.setContent(reqBody.getString("content"));
|
|
|
zdcx.setIsDelete(0);
|
|
|
zdcx.setFlag(1);
|
|
|
- // ......
|
|
|
+ // 录入人信息
|
|
|
+ zdcx.setCreateUserId(basePersonInfo.getUserId());
|
|
|
+ zdcx.setCreateUserName(basePersonInfo.getName());
|
|
|
+ zdcx.setCreateUserPoliceNo(basePersonInfo.getPoliceNo());
|
|
|
+ zdcx.setCreateDeptName(basePersonInfo.getDeptName());
|
|
|
+ zdcx.setCreateDeptCode(basePersonInfo.getDeptCode());
|
|
|
+ zdcx.setCreateParentDeptName(basePersonInfo.getParentDeptName());
|
|
|
+ zdcx.setCreateParentDeptCode(basePersonInfo.getParentDeptCode());
|
|
|
try {
|
|
|
- int rows = zdcxMapper.insert(zdcx);
|
|
|
- if (rows > 0) {
|
|
|
+ if (zdcxMapper.insert(zdcx) > 0) {
|
|
|
+ log.info("制度规范信息保存成功");
|
|
|
return true;
|
|
|
}
|
|
|
}catch (Exception e){
|