Commit ed31c133 authored by 赵啸非's avatar 赵啸非

添加材料数量统计

parent d0c54ff8
...@@ -23,6 +23,16 @@ export const createMatter = (params) => { ...@@ -23,6 +23,16 @@ export const createMatter = (params) => {
}); });
}; };
// 获取基础事项差集列表
export const getMatterSubList = (data) => {
return request({
url: `/sampleform/sheet/matter/sublist`,
method: "post",
data,
});
};
// 查询样表系统事项列表 // 查询样表系统事项列表
export const getWriteMatterList = (data) => { export const getWriteMatterList = (data) => {
return request({ return request({
...@@ -57,4 +67,4 @@ export const recommendMatter = (params) => { ...@@ -57,4 +67,4 @@ export const recommendMatter = (params) => {
method: "get", method: "get",
params, params,
}); });
}; };
\ No newline at end of file
...@@ -2,74 +2,93 @@ ...@@ -2,74 +2,93 @@
<div class="basics-set"> <div class="basics-set">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>样表基础设置</span> <span>填单基础设置</span>
</div> </div>
<div class="header"> <div class="header">
<span class="mr15 title">热门搜索词汇</span> <span class="mr15 title">热门搜索词汇</span>
<span class="tips" <span class="tips"
>点击热门词汇,自动检索。系统默认展示搜索量最多的10个词,每个词展示6个汉字,支持手动修改。</span >点击热门词汇,自动检索。系统默认展示搜索量最多的10个词,每个词展示6个汉字,支持手动修改。</span
> >
</div> </div>
<!-- 标签 --> <!-- 标签 -->
<div class="mt20"> <div class="mt20">
<template v-for="tag in baseSetInfo.hotwords"> <template v-for="item in baseSetInfo.hotwords">
<el-tooltip <el-tooltip
class="item" class="item"
effect="dark" effect="dark"
:key="tag" :key="item.id"
:content="tag" :content="item.hotwords"
v-if="tag.length > 6" v-if="item.hotwords.length > 6"
placement="top-start" placement="top-start"
> >
<el-tag <el-tag
:key="tag" :key="item.id"
size="small" size="small"
closable closable
:disable-transitions="false" :disable-transitions="false"
@close="handleClose(tag)" @close="handleClose(item.hotwords)"
> >
{{ `${tag.slice(0, 6)}...` }} {{ `${item.hotwords.slice(0, 6)}...` }}
</el-tag> </el-tag>
</el-tooltip> </el-tooltip>
<el-tag <el-tag
:key="tag" :key="item.id"
size="small" size="small"
v-else v-else
closable closable
:disable-transitions="false" :disable-transitions="false"
@close="handleClose(tag)" @close="handleClose(item.hotwords)"
> >
{{ tag }} {{ item.hotwords }}
</el-tag> </el-tag>
</template> </template>
<el-input <el-input
class="input-new-tag" class="input-new-tag"
v-if="inputVisible" v-if="inputVisible"
v-model="inputValue" v-model="inputValue"
ref="saveTagInput" ref="saveTagInput"
size="mini" size="mini"
@keyup.enter.native="handleInputConfirm" @keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm" @blur="handleInputConfirm"
> >
</el-input> </el-input>
<el-button v-else class="button-new-tag" size="mini" @click="showInput" <el-button v-else class="button-new-tag" size="mini" @click="showInput"
>+ 添加词汇</el-button >+ 添加词汇
</el-button
> >
</div> </div>
<!-- <div class="mt20"> <div class="mt20">
<p class="title mb20">空白打印材料展示数量</p> <p class="title mb20">空白打印材料展示数量</p>
<el-input <el-input
size="small" size="small"
placeholder="请输入空白打印材料展示数量" placeholder="请输入空白打印材料展示数量"
v-model.number="baseSetInfo.printDisplay" v-model.number="baseSetInfo.printDisplay"
style="width: 250px" style="width: 250px"
> >
<template slot="suffix"></template> <template slot="suffix"></template>
</el-input> </el-input>
</div> --> </div>
<div class="mt20">
<p class="title mb20">新闻来源</p>
<el-radio-group v-model="baseSetInfo.newsSource" size="medium">
<el-radio
v-for='($label, $value) in newSourceEnumData'
:key='$value'
:label="$value"
>{{ $label }}
</el-radio>
</el-radio-group>
</div>
<div class="mt50"> <div class="mt50">
<el-button size="small" type="primary" @click="handleOk" <el-button size="small" type="primary" @click="handleOk"
>确定</el-button >确定
</el-button
> >
<el-button size="small" @click="handleReset">重置</el-button> <el-button size="small" @click="handleReset">重置</el-button>
</div> </div>
...@@ -78,18 +97,22 @@ ...@@ -78,18 +97,22 @@
</template> </template>
<script> <script>
import { getBaseSetInfo, saveBaseSet } from "@/api/baseSet"; import {getBaseSetInfo, saveBaseSet} from "@/api/baseSet";
import local from "@/utils/local"; import local from "@/utils/local";
export default { export default {
data() { data() {
return { return {
siteId: local.getLocal("sampleSiteId") siteId: local.getLocal("writeSiteId")
? local.getLocal("sampleSiteId") ? local.getLocal("writeSiteId")
: "", : "",
inputVisible: false, inputVisible: false,
inputValue: "", inputValue: "",
newSourceEnumData: {},
baseSetInfo: { baseSetInfo: {
hotwords: [], hotwords: [],
newsSource: "1",
printDisplay: "20",
}, },
}; };
}, },
...@@ -102,18 +125,23 @@ export default { ...@@ -102,18 +125,23 @@ export default {
let res = await getBaseSetInfo({ let res = await getBaseSetInfo({
siteId: this.siteId, siteId: this.siteId,
}); });
console.log("res:", res)
console.log("res lens:", res.data.data.data.length)
if (res.data.code === 1) { if (res.data.code === 1) {
this.newSourceEnumData = res.data.dict.newsSource
if (res.data.data.data.length > 0) { if (res.data.data.data.length > 0) {
this.baseSetInfo.hotwords = res.data.data.data[0].hotwords.split(","); this.baseSetInfo.hotwords = res.data.data.data[0].hotwordList;
this.baseSetInfo.printDisplay = res.data.data.data[0].printDisplay; this.baseSetInfo.printDisplay = res.data.data.data[0].printDisplay;
this.baseSetInfo.newsSource = res.data.data.data[0].newsSource + "";
} }
} }
}, },
handleClose(tag) { handleClose(tag) {
this.baseSetInfo.hotwords.splice(
this.baseSetInfo.hotwords.indexOf(tag), //删除当前词汇
1
); this.baseSetInfo.hotwords=this.baseSetInfo.hotwords.filter(i=>i.hotwords!=tag)
}, },
showInput() { showInput() {
...@@ -129,7 +157,17 @@ export default { ...@@ -129,7 +157,17 @@ export default {
handleInputConfirm() { handleInputConfirm() {
let inputValue = this.inputValue; let inputValue = this.inputValue;
if (inputValue) { if (inputValue) {
this.baseSetInfo.hotwords.push(inputValue);
let list = this.baseSetInfo.hotwords.filter(i => i.hotwords === inputValue);
if (list.length == 0) {
let obj = {}
obj.hotwords = inputValue
obj.siteId = this.siteId
obj.searchCount = 0
obj.wordsSource = 1
this.baseSetInfo.hotwords.push(obj);
}
} }
this.inputVisible = false; this.inputVisible = false;
this.inputValue = ""; this.inputValue = "";
...@@ -138,15 +176,18 @@ export default { ...@@ -138,15 +176,18 @@ export default {
async handleOk() { async handleOk() {
let res = await saveBaseSet({ let res = await saveBaseSet({
...this.baseSetInfo, ...this.baseSetInfo,
hotwords: this.baseSetInfo.hotwords.join(","), hotwordList: this.baseSetInfo.hotwords,
siteId: this.siteId, siteId: this.siteId,
}); });
let { code, msg } = res.data; let {code, msg} = res.data;
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
} else { } else {
this.getBaseSetInfo(); this.getBaseSetInfo();
} }
//保存热门词汇
}, },
// 重置 // 重置
handleReset() { handleReset() {
...@@ -161,37 +202,45 @@ export default { ...@@ -161,37 +202,45 @@ export default {
.basics-set { .basics-set {
width: 100%; width: 100%;
height: 100%; height: 100%;
.title { .title {
font-size: 15px; font-size: 15px;
color: #000; color: #000;
} }
} }
/deep/.el-card {
:deep(.el-card) {
height: 100%; height: 100%;
} }
.header { .header {
.tips { .tips {
font-size: 14px; font-size: 14px;
color: #999; color: #999;
} }
} }
.el-tag + .el-tag { .el-tag + .el-tag {
margin-left: 10px; margin-left: 10px;
} }
.button-new-tag { .button-new-tag {
margin-left: 10px; margin-left: 10px;
} }
.input-new-tag { .input-new-tag {
width: 90px; width: 90px;
margin-left: 10px; margin-left: 10px;
vertical-align: bottom; vertical-align: bottom;
} }
.el-tag { .el-tag {
cursor: default; cursor: default;
} }
/deep/.el-input__suffix {
:deep(.el-input__suffix) {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
</style> </style>
\ No newline at end of file
...@@ -331,6 +331,24 @@ export default { ...@@ -331,6 +331,24 @@ export default {
...mapGetters(["deptList"]), ...mapGetters(["deptList"]),
}, },
methods: { methods: {
// 获取一体化事项列表
async getMatterSubList() {
this.loadingRight = true;
let res = await getMatterSubList({
page: this.rightCurrent,
size: this.rightSize,
matterName: `%${this.rightSearch}%`,
deptCode: this.departmentRight,
siteId: this.siteId,
});
this.loadingRight = false;
if (res.data.code === 1) {
let { total, data } = res.data.data;
this.rightTableData = data;
this.rightTotal = total;
this.$refs.rightTable.bodyWrapper.scrollTop = 0;
}
},
// 获取一体化事项列表 // 获取一体化事项列表
async getMatterList() { async getMatterList() {
this.loadingRight = true; this.loadingRight = true;
...@@ -539,4 +557,4 @@ export default { ...@@ -539,4 +557,4 @@ export default {
width: 50%; width: 50%;
height: 100%; height: 100%;
} }
</style> </style>
\ No newline at end of file
This diff is collapsed.
package com.mortals.xhx.module.baseset.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
/**
* 填单服务基础设置Dao
* 填单服务基础设置 DAO接口
*
* @author zxfei
* @date 2022-12-08
*/
public interface BasesetDao extends ICRUDDao<BasesetEntity,Long>{
}
package com.mortals.xhx.module.baseset.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.baseset.dao.BasesetDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import org.springframework.stereotype.Repository;
/**
* 填单服务基础设置DaoImpl DAO接口
*
* @author zxfei
* @date 2022-12-08
*/
@Repository("basesetDao")
public class BasesetDaoImpl extends BaseCRUDDaoMybatis<BasesetEntity,Long> implements BasesetDao {
}
package com.mortals.xhx.module.baseset.model;
import com.mortals.xhx.module.baseset.model.vo.BasesetVo;
/**
* 填单服务基础设置实体对象
*
* @author zxfei
* @date 2022-12-08
*/
public class BasesetEntity extends BasesetVo {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 空白打印材料展示数量
*/
private Integer printDisplay;
/**
* 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
*/
private Integer newsSource;
public BasesetEntity(){}
/**
* 获取 站点ID
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点ID
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 空白打印材料展示数量
* @return Integer
*/
public Integer getPrintDisplay(){
return printDisplay;
}
/**
* 设置 空白打印材料展示数量
* @param printDisplay
*/
public void setPrintDisplay(Integer printDisplay){
this.printDisplay = printDisplay;
}
/**
* 获取 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @return Integer
*/
public Integer getNewsSource(){
return newsSource;
}
/**
* 设置 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSource
*/
public void setNewsSource(Integer newsSource){
this.newsSource = newsSource;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof BasesetEntity) {
BasesetEntity tmp = (BasesetEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",printDisplay:").append(getPrintDisplay());
sb.append(",newsSource:").append(getNewsSource());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.printDisplay = 0;
this.newsSource = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import lombok.Data;
import java.util.List;
/**
* 填单服务基础设置视图对象
*
* @author zxfei
* @date 2022-12-08
*/
@Data
public class BasesetVo extends BaseEntityLong {
private List<HotwordEntity> hotwordList;
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
/**
* BasesetService
*
* 填单服务基础设置 service接口
*
* @author zxfei
* @date 2022-12-08
*/
public interface BasesetService extends ICRUDService<BasesetEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.baseset.dao.BasesetDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.service.BasesetService;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import com.mortals.xhx.module.hotword.service.HotwordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* BasesetService
* 填单服务基础设置 service实现
*
* @author zxfei
* @date 2022-12-08
*/
@Service("basesetService")
public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, BasesetEntity, Long> implements BasesetService {
@Autowired
private HotwordService hotwordService;
@Override
protected void findAfter(BasesetEntity params, PageInfo pageInfo, Context context, List<BasesetEntity> list) throws AppException {
list.forEach(item -> {
List<HotwordEntity> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(item.getSiteId()));
item.setHotwordList(hotwordEntities);
});
super.findAfter(params, pageInfo, context, list);
}
@Override
protected void saveAfter(BasesetEntity entity, Context context) throws AppException {
updateAndSaveHotWords(entity, context);
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(BasesetEntity entity, Context context) throws AppException {
updateAndSaveHotWords(entity, context);
super.updateAfter(entity, context);
}
private void updateAndSaveHotWords(BasesetEntity entity, Context context) {
if(!ObjectUtils.isEmpty(entity.getHotwordList())){
//更新新增热门词汇,差集删除不在列表中的
List<HotwordEntity> allHotWords = hotwordService.find(new HotwordQuery().siteId(entity.getSiteId()));
//求差集 删除
List<HotwordEntity> delList = this.subList(allHotWords, entity.getHotwordList());
if(!ObjectUtils.isEmpty(delList)){
hotwordService.removeList(delList, context);
}
entity.getHotwordList().forEach(item -> {
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(item.getSiteId()).hotwords(item.getHotwords()));
if (!ObjectUtils.isEmpty(hotwordEntity)) {
item.setId(hotwordEntity.getId());
item.setSearchCount(hotwordEntity.getSearchCount());
item.setUpdateTime(new Date());
hotwordService.update(item, context);
}else{
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
hotwordService.save(item, context);
}
});
}
}
public List<HotwordEntity> subList(List<HotwordEntity> firstList, List<HotwordEntity> secondList) {
Set<String> secondSet = secondList.parallelStream().map(e -> e.getHotwords()).collect(Collectors.toSet());
return firstList.parallelStream().filter(item -> !secondSet.contains(item.getHotwords())).collect(Collectors.toList());
}
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.NewsSourceEnum;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.model.BasesetQuery;
import com.mortals.xhx.module.baseset.service.BasesetService;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.Map;
/**
* 填单服务基础设置
*
* @author zxfei
* @date 2022-12-08
*/
@RestController
@RequestMapping("baseset")
public class BasesetController extends BaseCRUDJsonBodyMappingController<BasesetService, BasesetEntity, Long> {
public BasesetController() {
super.setModuleDesc("填单服务基础设置");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "newsSource", NewsSourceEnum.getEnumMap());
super.init(model, context);
}
@Override
protected void saveBefore(BasesetEntity entity, Map<String, Object> model, Context context) throws AppException {
BasesetEntity basesetEntity = this.service.selectOne(new BasesetQuery().siteId(entity.getSiteId()));
if(!ObjectUtils.isEmpty(basesetEntity)){
entity.setId(basesetEntity.getId());
entity.setUpdateTime(new Date());
}
super.saveBefore(entity, model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.hotword.web; package com.mortals.xhx.module.hotword.web;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
...@@ -9,38 +10,43 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -9,38 +10,43 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.hotword.model.HotwordEntity; import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.service.HotwordService; import com.mortals.xhx.module.hotword.service.HotwordService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays; import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
/** /**
* * 热门词汇业务
* 热门词汇业务 *
* * @author zxfei
* @author zxfei * @date 2022-11-17
* @date 2022-11-17 */
*/
@RestController @RestController
@RequestMapping("hotword") @RequestMapping("hotword")
public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService,HotwordEntity,Long> { public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService, HotwordEntity, Long> {
@Autowired
private ParamService paramService;
public HotwordController(){ public HotwordController() {
super.setModuleDesc( "热门词汇业务"); super.setModuleDesc("热门词汇业务");
} }
@Override @Override
...@@ -52,7 +58,7 @@ public class HotwordController extends BaseCRUDJsonBodyMappingController<Hotword ...@@ -52,7 +58,7 @@ public class HotwordController extends BaseCRUDJsonBodyMappingController<Hotword
@Override @Override
protected void saveBefore(HotwordEntity entity, Map<String, Object> model, Context context) throws AppException { protected void saveBefore(HotwordEntity entity, Map<String, Object> model, Context context) throws AppException {
HotwordEntity hotwordEntity = this.service.selectOne(new HotwordQuery().siteId(entity.getSiteId())); HotwordEntity hotwordEntity = this.service.selectOne(new HotwordQuery().siteId(entity.getSiteId()));
if(!ObjectUtils.isEmpty(hotwordEntity)){ if (!ObjectUtils.isEmpty(hotwordEntity)) {
entity.setId(hotwordEntity.getId()); entity.setId(hotwordEntity.getId());
} }
super.saveBefore(entity, model, context); super.saveBefore(entity, model, context);
......
...@@ -70,6 +70,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -70,6 +70,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
} }
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("isRecommend", OrderCol.DESCENDING)); orderColList.add(new OrderCol("isRecommend", OrderCol.DESCENDING));
orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING));
query.setOrderColList(orderColList); query.setOrderColList(orderColList);
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
......
...@@ -58,6 +58,7 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat ...@@ -58,6 +58,7 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
protected void doListBefore(MatterDatumEntity query, Map<String, Object> model, Context context) throws AppException { protected void doListBefore(MatterDatumEntity query, Map<String, Object> model, Context context) throws AppException {
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("isRecommend", OrderCol.DESCENDING)); orderColList.add(new OrderCol("isRecommend", OrderCol.DESCENDING));
orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING));
query.setOrderColList(orderColList); query.setOrderColList(orderColList);
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
......
package com.mortals.xhx.module.sheet.dao; package com.mortals.xhx.module.sheet.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import java.util.List;
/** /**
* 基础事项Dao * 基础事项Dao
* 基础事项 DAO接口 * 基础事项 DAO接口
...@@ -12,5 +14,8 @@ import java.util.List; ...@@ -12,5 +14,8 @@ import java.util.List;
*/ */
public interface SheetMatterDao extends ICRUDDao<SheetMatterEntity,Long>{ public interface SheetMatterDao extends ICRUDDao<SheetMatterEntity,Long>{
String SQLID_SUB_LIST = "getSubList";
String SQLID_SUB_COUNT = "getSubListCount";
Result<SheetMatterEntity> getSubList(SheetMatterEntity matterQuery, PageInfo pageInfo);
} }
package com.mortals.xhx.module.sheet.dao.ibatis; package com.mortals.xhx.module.sheet.dao.ibatis;
import org.springframework.stereotype.Repository; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.sheet.dao.SheetMatterDao; import com.mortals.xhx.module.sheet.dao.SheetMatterDao;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import java.util.Date; import org.apache.ibatis.session.RowBounds;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* 基础事项DaoImpl DAO接口 * 基础事项DaoImpl DAO接口
* *
...@@ -17,5 +23,28 @@ import java.util.List; ...@@ -17,5 +23,28 @@ import java.util.List;
public class SheetMatterDaoImpl extends BaseCRUDDaoMybatis<SheetMatterEntity,Long> implements SheetMatterDao { public class SheetMatterDaoImpl extends BaseCRUDDaoMybatis<SheetMatterEntity,Long> implements SheetMatterDao {
@Override
public Result<SheetMatterEntity> getSubList(SheetMatterEntity matterQuery, PageInfo pageInfo) {
Result<SheetMatterEntity> result = new Result();
ParamDto paramDto = this.getQueryParam(matterQuery);
int count = this.getSubCount(paramDto);
List list = null;
if (count == 0) {
list = new ArrayList();
} else if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId(SQLID_SUB_LIST), paramDto);
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId(SQLID_SUB_LIST), this.cpyQueryParamDto(paramDto), rowBounds);
}
pageInfo.setTotalResult(count);
result.setPageInfo(pageInfo);
result.setList(list);
return result;
}
public int getSubCount(ParamDto paramDto) {
return this.getSqlSession().selectOne(this.getSqlId(SQLID_SUB_COUNT), this.cpyQueryParamDto(paramDto));
}
} }
package com.mortals.xhx.module.sheet.model; package com.mortals.xhx.module.sheet.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sheet.model.vo.SheetMatterVo; import com.mortals.xhx.module.sheet.model.vo.SheetMatterVo;
import java.util.Date;
/** /**
* 基础事项实体对象 * 基础事项实体对象
* *
......
package com.mortals.xhx.module.sheet.model; package com.mortals.xhx.module.sheet.model;
import java.util.Date;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
/** /**
* 基础事项查询对象 * 基础事项查询对象
* *
......
package com.mortals.xhx.module.sheet.model.vo; package com.mortals.xhx.module.sheet.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import java.util.ArrayList;
import java.util.List;
/** /**
* 基础事项视图对象 * 基础事项视图对象
* *
......
package com.mortals.xhx.module.sheet.service; package com.mortals.xhx.module.sheet.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
/** /**
* SheetMatterService * SheetMatterService
* * <p>
* 基础事项 service接口 * 基础事项 service接口
* *
* @author zxfei * @author zxfei
* @date 2022-09-27 * @date 2022-09-27
*/ */
public interface SheetMatterService extends ICRUDService<SheetMatterEntity,Long>{ public interface SheetMatterService extends ICRUDService<SheetMatterEntity, Long> {
Result<SheetMatterEntity> findSubList(SheetMatterEntity matterQuery, PageInfo pageInfo, Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.sheet.service.impl; package com.mortals.xhx.module.sheet.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.sheet.dao.SheetMatterDao; import com.mortals.xhx.module.sheet.dao.SheetMatterDao;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import com.mortals.xhx.module.sheet.service.SheetMatterService; import com.mortals.xhx.module.sheet.service.SheetMatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
/** /**
* SheetMatterService * SheetMatterService
* 基础事项 service实现 * 基础事项 service实现
* *
* @author zxfei * @author zxfei
* @date 2022-09-27 * @date 2022-09-27
*/ */
@Service("sheetMatterService") @Service("sheetMatterService")
public class SheetMatterServiceImpl extends AbstractCRUDServiceImpl<SheetMatterDao, SheetMatterEntity, Long> implements SheetMatterService { public class SheetMatterServiceImpl extends AbstractCRUDServiceImpl<SheetMatterDao, SheetMatterEntity, Long> implements SheetMatterService {
@Autowired
private ISiteFeign siteFeign;
@Override
public Result<SheetMatterEntity> findSubList(SheetMatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException {
Rest<SitePdu> rest = siteFeign.info(matterQuery.getSiteId());
if (rest.getCode() == YesNoEnum.YES.getValue()) {
if (ObjectUtils.isEmpty(matterQuery.getAreaCode())) {
matterQuery.setAreaCode(rest.getData() == null ? null : rest.getData().getAreaCode());
}
} else {
return new Result<>();
}
return this.dao.getSubList(matterQuery, pageInfo);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.sheet.web; package com.mortals.xhx.module.sheet.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import org.checkerframework.checker.units.qual.A; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import com.mortals.xhx.module.sheet.service.SheetMatterService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import com.mortals.xhx.module.sheet.service.SheetMatterService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import static com.mortals.framework.ap.SysConstains.MESSAGE_INFO;
import java.util.Arrays; import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/** /**
* *
* 基础事项 * 基础事项
...@@ -99,4 +96,32 @@ public class SheetMatterController extends BaseCRUDJsonBodyMappingController<She ...@@ -99,4 +96,32 @@ public class SheetMatterController extends BaseCRUDJsonBodyMappingController<She
} }
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
@PostMapping(value = "sublist")
@UnAuth
public Rest<Object> sublist(@RequestBody SheetMatterEntity query) {
Rest<Object> ret = new Rest<>();
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "查询差集" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
try {
PageInfo pageInfo = buildPageInfo(query);
Result<SheetMatterEntity> result = this.getService().findSubList(query, pageInfo, context);
model.put(KEY_RESULT_DATA, result.getList());
model.put(PAGEINFO_KEY, result.getPageInfo());
parsePageInfo(model, result.getPageInfo());
model.put(MESSAGE_INFO, busiDesc + "成功");
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get(MESSAGE_INFO) == null ? "" : model.remove(MESSAGE_INFO).toString());
return ret;
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.sheet.dao.ibatis.SheetMatterDaoImpl">
<select id="getSubListCount" parameterType="paramDto" resultType="int">
SELECT
count( 1 )
FROM
mortals_sys_sheet_matter AS a
LEFT JOIN ( SELECT matterNo FROM mortals_xhx_matter WHERE siteId = #{condition.siteId} ) AS b ON a.matterNo = b.matterNo
<trim suffixOverrides="where" suffix="">
where b.matterNo IS NULL and
<trim prefixOverrides="and" prefix="">
<if test="condition.areaCode!=null and condition.areaCode!=''">
and a.areaCode = #{condition.areaCode,jdbcType=VARCHAR}
</if>
<if test="condition.deptCode!=null and condition.deptCode!=''">
and a.deptCode = #{condition.deptCode,jdbcType=VARCHAR}
</if>
<if test="condition.matterName != null and condition.matterName != ''">
and a.matterName like #{condition.matterName}
</if>
<if test="condition.matterFullName != null and condition.matterFullName != ''">
and a.matterFullName like #{condition.matterFullName}
</if>
</trim>
</trim>
</select>
<!-- 获取事项差集列表列表 -->
<select id="getSubList" parameterType="paramDto" resultMap="SheetMatterEntity-Map">
select
<include refid="_columns"/>
FROM
mortals_sys_sheet_matter AS a
LEFT JOIN ( SELECT matterNo FROM mortals_xhx_matter WHERE siteId = #{condition.siteId} ) AS b ON a.matterNo = b.matterNo
<trim suffixOverrides="where" suffix="">
where b.matterNo IS NULL and
<trim prefixOverrides="and" prefix="">
<if test="condition.areaCode!=null and condition.areaCode!=''">
and a.areaCode = #{condition.areaCode,jdbcType=VARCHAR}
</if>
<if test="condition.deptCode!=null and condition.deptCode!=''">
and a.deptCode = #{condition.deptCode,jdbcType=VARCHAR}
</if>
<if test="condition.matterName != null and condition.matterName != ''">
and a.matterName like #{condition.matterName}
</if>
<if test="condition.matterFullName != null and condition.matterFullName != ''">
and a.matterFullName like #{condition.matterFullName}
</if>
</trim>
</trim>
</select>
</mapper>
\ No newline at end of file
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