Commit 37deba36 authored by 赵啸非's avatar 赵啸非

添加公共庫

parent 139805e5
......@@ -35,4 +35,13 @@ export const recommendMaterials = (params) => {
method: "get",
params,
});
};
\ No newline at end of file
};
// 加入公共材料
export const addPubdatum = (params) => {
return request({
url: `/sampleform/matter/datum/addPubdatum`,
method: "get",
params,
});
};
......@@ -3,7 +3,7 @@
<el-dialog title="从公共库中选择" :visible.sync="Visible" width="50%">
<TableHeader>
<div slot="right" class="flex">
<el-select
<!-- <el-select
v-model="department"
class="autoWidth"
size="small"
......@@ -19,7 +19,7 @@
:value="item.id"
>
</el-option>
</el-select>
</el-select>-->
<el-input
size="small"
style="width: 200px"
......@@ -56,20 +56,20 @@
</el-table-column>
<el-table-column
show-overflow-tooltip
label="部门"
label="部门编号"
align="center"
prop="department"
prop="deptCode"
width="80"
>
</el-table-column>
<el-table-column prop="name" show-overflow-tooltip label="材料名称">
<template slot-scope="scope">
<p class="short">{{ scope.row.name }}</p>
<p class="full-name">材料全称:{{ scope.row.name2 }}</p>
<p class="short">{{ scope.row.materialName }}</p>
<p class="full-name">材料全称:{{ scope.row.materiaFullName }}</p>
</template>
</el-table-column>
<el-table-column
prop="time"
prop="createTime"
label="加入时间"
align="center"
width="140"
......@@ -102,7 +102,8 @@
<script>
import TableHeader from "@/components/TableHeader.vue";
import { mapGetters } from "vuex";
import { getPubdatumList } from "@/api/libray";
import {createMatter} from "@/api/matter";
export default {
components: {
TableHeader,
......@@ -121,34 +122,19 @@ export default {
},
},
},
created() {
this.getPbuList();
},
data() {
return {
department: "",
searchVal: "",
tableData: [
{
id: 1,
department: "县公安局",
name: "机动车登记证、行使证核发",
name2: "机动车登记证、行驶证审查、办理、核发",
count: 50,
top: 1,
time: "2022-12-12 12:00:00",
},
{
id: 2,
department: "县公安局",
name: "机动车登记证、行使证核发",
name2: "机动车登记证、行驶证审查、办理、核发",
count: 50,
top: 0,
time: "2022-12-12 12:00:00",
},
],
tableData: [],
pageSizes: [10, 20, 30, 40, 50, 100, 200],
current: 1,
total: 10,
size: 10,
selectedRowKeys :[],
};
},
computed: {
......@@ -160,17 +146,44 @@ export default {
this.$emit("update:libVisible", val);
},
},
...mapGetters(["deptList"]),
// ...mapGetters(["deptList"]),
},
methods: {
handleOk() {
// 系统事项列表
async getPbuList() {
this.loading = true;
let res = await getPubdatumList({
page: this.current,
size: this.size,
materialName:this.searchVal
});
this.loading = false;
if (res.data.code === 1) {
let { data, total } = res.data.data;
this.tableData = data;
this.total = total;
}
},
async handleOk() {
console.log("select",this.selectedRowKeys)
let res = await addMatter({ ids: this.selectedRowKeys, siteId: this.siteId });
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.rightSelectedRowKeys = [];
this.$refs.rightTable.clearSelection();
this.getWriteMatterList();
}
console.log(11);
},
handleSarch() {
console.log(11);
this.current=1
this.getPbuList()
},
resetSearch() {
this.department = "";
this.searchVal = "";
},
changePagination(cur) {
......@@ -180,7 +193,8 @@ export default {
this.size = size;
},
handleSelectionChange(select) {
console.log(select);
this.selectedRowKeys=select.map(i => i.id);
// console.log(select);
},
},
};
......
......@@ -15,6 +15,7 @@ import com.mortals.xhx.module.matter.model.MatterDatumEntity;
*/
public interface MatterDatumService extends ICRUDService<MatterDatumEntity, Long> {
Rest<String> addPubdatum(Long[] pubIds,Long matterId,Long siteId, Context context);
/**
* 推荐or取消推荐
......
......@@ -24,6 +24,7 @@ import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.code.MatterSourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.formdesign.*;
import com.mortals.xhx.common.key.ParamKey;
......@@ -38,6 +39,7 @@ import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.pubdatum.model.PubdatumEntity;
import com.mortals.xhx.module.pubdatum.service.PubdatumService;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.http.entity.ContentType;
......@@ -157,6 +159,52 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
}
@Override
public Rest<String> addPubdatum(Long[] pubIds, Long matterId, Long siteId, Context context) {
if (ObjectUtils.isEmpty(pubIds)) {
throw new AppException("公共材料库ids is null");
}
int success = 0;
int fail = 0;
List<PubdatumEntity> pubdatumEntityList = pubdatumService.get(pubIds, context);
for (PubdatumEntity pubdatumEntity : pubdatumEntityList) {
Boolean bool = updateOrSave(pubdatumEntity, matterId, siteId, context);
if (bool) {
success++;
} else {
fail++;
}
}
String msg = "当前加入材料已存在!";
if (pubIds.length == 1) {
if (success > 0) {
msg = "加入材料成功!";
}
} else if (pubIds.length > 1) {
if (success > 0 && fail == 0) {
msg = String.format("加入材料成功%d条!", success);
} else if (success > 0 && fail > 0) {
msg = String.format("加入材料成功%d条,重复加入材料%d条!", success, fail);
} else if (success == 0 && fail > 0) {
msg = String.format("重复加入材料%d条!", fail);
}
}
return Rest.ok(msg);
}
private Boolean updateOrSave(PubdatumEntity pubdatumEntity, Long matterId, Long siteId, Context context) {
MatterDatumEntity matterDatumEntity = this.selectOne(new MatterDatumQuery().siteId(siteId).matterId(matterId).materialName(pubdatumEntity.getMaterialName()));
if (ObjectUtils.isEmpty(matterDatumEntity)) {
MatterDatumEntity entity = new MatterDatumEntity();
BeanUtils.copyProperties(pubdatumEntity, entity, new String[]{"id", "matterId"});
entity.setSiteId(siteId);
entity.setMatterId(matterId);
this.save(entity, context);
return true;
}
return false;
}
@Override
public Rest<String> recommend(Long id, Long siteId, Context context) {
MatterDatumEntity matterDatumEntity = this.get(id, context);
......
package com.mortals.xhx.module.matter.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.MatterSourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.matter.dao.MatterDao;
import com.mortals.xhx.module.matter.model.MatterDatumEntity;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.sheet.dao.SheetMatterDao;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import com.mortals.xhx.module.sheet.model.SheetMatterQuery;
import com.mortals.xhx.module.sheet.service.SheetMatterService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.matter.dao.MatterDao;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.Date;
import java.util.List;
/**
* MatterService
......@@ -36,43 +32,12 @@ import java.util.*;
*/
@Service("matterService")
public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, MatterEntity, Long> implements MatterService {
private static int RECOMMEND_COUNT = 5;
@Autowired
private ParamService paramService;
@Autowired
private SheetMatterService sheetMatterService;
@Autowired
private MatterDatumService matterDatumService;
@Override
protected MatterEntity findBefore(MatterEntity params, PageInfo pageInfo, Context context) throws AppException {
if (StringUtils.isNotEmpty(params.getMatterName())) {
params.setMatterName("%".concat(params.getMatterName()).concat("%"));
}
return params;
}
// @Override
// protected void updateBefore(MatterEntity entity, Context context) throws AppException {
// entity.setIsRecommend(null);
// this.validData(entity, context);
// }
// @Override
// protected void removeBefore(Long[] ids, Context context) throws AppException {
// List<MatterEntity> queryList = this.get(ids, context);
// if (CollectionUtils.isNotEmpty(queryList)) {
// int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_RECOMMEND_COUNT);
// for (MatterEntity matterEntity : queryList) {
// if (matterEntity.getIsRecommend() == 1) {
// recommendCount--;
// }
// }
// paramService.setValueByKey(ParamKey.MATTER_RECOMMEND_COUNT, String.valueOf(recommendCount));
// }
// }
@Override
protected void findAfter(MatterEntity entity, PageInfo pageInfo, Context context, List<MatterEntity> list) throws AppException {
if (CollectionUtils.isNotEmpty(list)) {
......
......@@ -9,6 +9,7 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.MatterSourceEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -21,7 +22,6 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
......@@ -56,6 +56,10 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@Override
protected void doListBefore(MatterEntity query, Map<String, Object> model, Context context) throws AppException {
if (StringUtils.isNotEmpty(query.getMatterName())) {
query.setMatterName("%".concat(query.getMatterName()).concat("%"));
}
List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("isRecommend",OrderCol.DESCENDING));
query.setOrderColList(orderColList);
......@@ -71,11 +75,9 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@RequestMapping(value = {"createMatter"},method = {RequestMethod.POST, RequestMethod.GET})
public String createMatter(Long[] ids,Long siteId) {
// public String createMatter(Long[] ids) {
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "站点事项转事项";
try {
Rest<String> rest = this.service.createMatterbBySheetMatter(ids, siteId, getContext());
model.put("message_info", rest.getMsg());
......
......@@ -62,11 +62,33 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
super.doListBefore(query, model, context);
}
@Override
/* @Override
protected int doListAfter(MatterDatumEntity query, Map<String, Object> model, Context context) throws AppException {
int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_DATUM_RECOMMEND_COUNT);
model.put("recommendCount", recommendCount);
return 1;
}*/
@RequestMapping(value = {"addPubdatum"}, method = {RequestMethod.POST, RequestMethod.GET})
public String addPubdatum(Long[] ids, Long matterId, Long siteId) {
Map<String, Object> model = new HashMap();
int code = VALUE_RESULT_SUCCESS;
String busiDesc = "添加公共库";
try {
Rest<String> rest = this.service.addPubdatum(ids, matterId, siteId, getContext());
model.put(MESSAGE_INFO, rest.getMsg());
this.recordSysLog(this.request, rest.getMsg());
} catch (Exception var7) {
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove(MESSAGE_INFO));
ret.put("data", model);
return ret.toJSONString();
}
@RequestMapping(value = {"recommend"}, method = {RequestMethod.POST, RequestMethod.GET})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment