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

重构部分功能模块

parent bb9181e3
Pipeline #2320 canceled with stages
......@@ -8,8 +8,8 @@ import java.util.Map;
public enum MatterSourceEnum implements IBaseEnum {
MANUAL(0, "手动添加", SysConstains.STYLE_DEFAULT),
AUTO(1, "站点事项", SysConstains.STYLE_DEFAULT);
MANUAL(1, "手动添加", SysConstains.STYLE_DEFAULT),
AUTO(0, "站点事项", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
......
package com.mortals.xhx.module.home.web;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
......@@ -16,8 +17,13 @@ import com.mortals.xhx.feign.base.pdu.DeptPdu;
import com.mortals.xhx.feign.base.pdu.SitePdu;
import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.module.home.pdu.HomeQueryPdu;
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 com.mortals.xhx.module.matter.model.MatterDatumEntity;
import com.mortals.xhx.module.matter.model.MatterDatumQuery;
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.matter.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("home")
......@@ -39,7 +46,7 @@ public class HomeController extends BaseJsonBodyController {
@Autowired
private MatterService matterService;
@Autowired
private ParamService paramService;
private HotwordService hotwordService;
@PostMapping({"site/list"})
public Rest<Object> list() {
......@@ -99,10 +106,8 @@ public class HomeController extends BaseJsonBodyController {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询站点部门列表" ;
int code=1;
try {
if(queryPdu.getSiteId()!=null){
DeptPdu deptPdu = new DeptPdu();
deptPdu.setSiteId(queryPdu.getSiteId());
......@@ -163,36 +168,41 @@ public class HomeController extends BaseJsonBodyController {
@PostMapping({"info"})
@UnAuth
public Rest<Object> homePageInfo() {
public Rest<Object> homePageInfo(@RequestBody HomeQueryPdu homeQueryPdu) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "获取首页数据" ;
int code=1;
String busiDesc = "获取首页数据";
int code = VALUE_RESULT_SUCCESS;
try {
model.put("hotWords", paramService.getHotWords());
MatterEntity matterQuery = new MatterEntity();
int matterCont = matterService.count(matterQuery,this.getContext());
matterQuery.setIsRecommend(1);
List<MatterEntity> matterList = matterService.find(matterQuery,this.getContext());
model.put("matterList",matterList); //热门事项
model.put("matterCont",matterCont); //入驻事项数量
MatterDatumEntity matterDatumQuery = new MatterDatumEntity();
int datumCont = matterDatumService.count(matterDatumQuery,this.getContext());
matterDatumQuery.setIsRecommend(1);
List<MatterDatumEntity> datumList = matterDatumService.find(matterDatumQuery,this.getContext());
model.put("datumList",datumList); //热门表单
model.put("datumCont",datumCont); //入驻表单数量
model.put("localPrint",20); //本地打印数量
model.put("onlineSubmit",20); //在线提交数量
model.put("dayThrift",66); //今日节约
model.put("totalThrift",996); //累计节约
List<String> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(homeQueryPdu.getSiteId())).stream()
.map(HotwordEntity::getHotwords)
.flatMap(item-> StrUtil.split(item,",".charAt(0)).stream())
.collect(Collectors.toList());
model.put("hotWords", hotwordEntities);
MatterQuery matterQuery = new MatterQuery();
matterQuery.setSiteId(homeQueryPdu.getSiteId());
int matterCont = matterService.count(matterQuery, this.getContext());
matterQuery.setIsRecommend(YesNoEnum.YES.getValue());
List<MatterEntity> matterList = matterService.find(matterQuery, this.getContext());
model.put("matterList", matterList); //热门事项
model.put("matterCont", matterCont); //入驻事项数量
MatterDatumQuery matterDatumQuery = new MatterDatumQuery();
matterDatumQuery.setSiteId(homeQueryPdu.getSiteId());
int datumCont = matterDatumService.count(matterDatumQuery, this.getContext());
matterDatumQuery.setIsRecommend(YesNoEnum.YES.getValue());
List<MatterDatumEntity> datumList = matterDatumService.find(matterDatumQuery, this.getContext());
model.put("datumList", datumList); //热门表单
model.put("datumCont", datumCont); //入驻表单数量
model.put("localPrint", 20); //本地打印数量
model.put("onlineSubmit", 20); //在线提交数量
model.put("dayThrift", 66); //今日节约
model.put("totalThrift", 996); //累计节约
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, var9);
}
......
package com.mortals.xhx.module.matter.model;
import java.util.List;
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.matter.model.vo.MatterVo;
import com.mortals.xhx.module.matter.model.MatterDatumEntity;
/**
* 事项申请材料业务实体对象
*
......@@ -81,227 +84,289 @@ public class MatterEntity extends MatterVo {
/**
* 事项申请材料业务信息
*/
private List<MatterDatumEntity> matterDatumList=new ArrayList<>();;
private List<MatterDatumEntity> matterDatumList = new ArrayList<>();
;
public MatterEntity(){}
public MatterEntity() {
}
/**
* 获取 站点ID
*
* @return Long
*/
public Long getSiteId(){
public Long getSiteId() {
return siteId;
}
/**
* 设置 站点ID
*
* @param siteId
*/
public void setSiteId(Long siteId){
public void setSiteId(Long siteId) {
this.siteId = siteId;
}
/**
* 获取 从政务系统来的事项id
*
* @return String
*/
public String getTid(){
public String getTid() {
return tid;
}
/**
* 设置 从政务系统来的事项id
*
* @param tid
*/
public void setTid(String tid){
public void setTid(String tid) {
this.tid = tid;
}
/**
* 获取 从政务系统来的事项code
*
* @return String
*/
public String getTcode(){
public String getTcode() {
return tcode;
}
/**
* 设置 从政务系统来的事项code
*
* @param tcode
*/
public void setTcode(String tcode){
public void setTcode(String tcode) {
this.tcode = tcode;
}
/**
* 获取 从政务系统来的事项name
*
* @return String
*/
public String getTname(){
public String getTname() {
return tname;
}
/**
* 设置 从政务系统来的事项name
*
* @param tname
*/
public void setTname(String tname){
public void setTname(String tname) {
this.tname = tname;
}
/**
* 获取 事项名称
*
* @return String
*/
public String getMatterName(){
public String getMatterName() {
return matterName;
}
/**
* 设置 事项名称
*
* @param matterName
*/
public void setMatterName(String matterName){
public void setMatterName(String matterName) {
this.matterName = matterName;
}
/**
* 获取 英语事项名
*
* @return String
*/
public String getEnglishName(){
public String getEnglishName() {
return englishName;
}
/**
* 设置 英语事项名
*
* @param englishName
*/
public void setEnglishName(String englishName){
public void setEnglishName(String englishName) {
this.englishName = englishName;
}
/**
* 获取 事项编号
*
* @return String
*/
public String getMatterNo(){
public String getMatterNo() {
return matterNo;
}
/**
* 设置 事项编号
*
* @param matterNo
*/
public void setMatterNo(String matterNo){
public void setMatterNo(String matterNo) {
this.matterNo = matterNo;
}
/**
* 获取 事项全称
*
* @return String
*/
public String getMatterFullName(){
public String getMatterFullName() {
return matterFullName;
}
/**
* 设置 事项全称
*
* @param matterFullName
*/
public void setMatterFullName(String matterFullName){
public void setMatterFullName(String matterFullName) {
this.matterFullName = matterFullName;
}
/**
* 获取 部门ID
*
* @return Long
*/
public Long getDeptId(){
public Long getDeptId() {
return deptId;
}
/**
* 设置 部门ID
*
* @param deptId
*/
public void setDeptId(Long deptId){
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
/**
* 获取 部门编号
*
* @return String
*/
public String getDeptCode(){
public String getDeptCode() {
return deptCode;
}
/**
* 设置 部门编号
*
* @param deptCode
*/
public void setDeptCode(String deptCode){
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
/**
* 获取 部门名称
*
* @return String
*/
public String getDeptName(){
public String getDeptName() {
return deptName;
}
/**
* 设置 部门名称
*
* @param deptName
*/
public void setDeptName(String deptName){
public void setDeptName(String deptName) {
this.deptName = deptName;
}
/**
* 获取 填单次数
*
* @return Integer
*/
public Integer getTotal(){
public Integer getTotal() {
return total;
}
/**
* 设置 填单次数
*
* @param total
*/
public void setTotal(Integer total){
public void setTotal(Integer total) {
this.total = total;
}
/**
* 获取 排序
*
* @return Integer
*/
public Integer getSort(){
public Integer getSort() {
return sort;
}
/**
* 设置 排序
*
* @param sort
*/
public void setSort(Integer sort){
public void setSort(Integer sort) {
this.sort = sort;
}
/**
* 获取 是否推荐(0.未推荐,1.推荐)
*
* @return Integer
*/
public Integer getIsRecommend(){
public Integer getIsRecommend() {
return isRecommend;
}
/**
* 设置 是否推荐(0.未推荐,1.推荐)
*
* @param isRecommend
*/
public void setIsRecommend(Integer isRecommend){
public void setIsRecommend(Integer isRecommend) {
this.isRecommend = isRecommend;
}
/**
* 获取 事项来源(0.手动添加,1.站点事项)
*
* @return Integer
*/
public Integer getSource(){
public Integer getSource() {
return source;
}
/**
* 设置 事项来源(0.手动添加,1.站点事项)
*
* @param source
*/
public void setSource(Integer source){
public void setSource(Integer source) {
this.source = source;
}
public List<MatterDatumEntity> getMatterDatumList(){
public List<MatterDatumEntity> getMatterDatumList() {
return matterDatumList;
}
public void setMatterDatumList(List<MatterDatumEntity> matterDatumList){
public void setMatterDatumList(List<MatterDatumEntity> matterDatumList) {
this.matterDatumList = matterDatumList;
}
......@@ -310,6 +375,7 @@ public class MatterEntity extends MatterVo {
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
......@@ -322,7 +388,7 @@ public class MatterEntity extends MatterVo {
return false;
}
public String toString(){
public String toString() {
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",tid:").append(getTid());
......@@ -342,7 +408,7 @@ public class MatterEntity extends MatterVo {
return sb.toString();
}
public void initAttrValue(){
public void initAttrValue() {
this.siteId = null;
......
......@@ -16,4 +16,10 @@ public class MatterVo extends BaseEntityLong {
/** 材料数量 */
private Integer datumCount;
/**
* 是否终端访问,默认否
*/
private Integer isTerminal = 0;
}
\ No newline at end of file
......@@ -92,33 +92,22 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
return params;
}
@Override
protected void findAfter(MatterDatumEntity params, PageInfo pageInfo, Context context, List<MatterDatumEntity> list) throws AppException {
if (CollectionUtils.isNotEmpty(list)) {
for (MatterDatumEntity entity : list) {
MatterEntity matter = matterService.get(entity.getMatterId());
if (matter != null) {
entity.setMatterName(matter.getMatterName());
entity.setMatterNo(matter.getMatterNo());
entity.setDeptName(matter.getDeptName());
}
}
}
}
@Override
protected void saveAfter(MatterDatumEntity entity, Context context) throws AppException {
int count = this.count(new MatterDatumQuery().matterId(entity.getMatterId()), context);
MatterEntity matterEntity = matterService.get(entity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count);
matterService.update(matterEntity, context);
}
statDatumCount(entity,context);
addPubdatum(entity, context);
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(MatterDatumEntity entity, Context context) throws AppException {
addPubdatum(entity, context);
super.updateAfter(entity, context);
}
private void addPubdatum(MatterDatumEntity entity, Context context) {
if (!ObjectUtils.isEmpty(entity.getPub()) && entity.getPub() == YesNoEnum.YES.getValue()) {
//添加到公共库
......@@ -131,6 +120,15 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
}
}
private void statDatumCount( MatterDatumEntity matterDatumEntity,Context context) {
int count = this.count(new MatterDatumQuery().matterId(matterDatumEntity.getMatterId()), context);
MatterEntity matterEntity = matterService.get(matterDatumEntity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count);
matterService.update(matterEntity, context);
}
}
@Override
protected void saveBefore(MatterDatumEntity entity, Context context) throws AppException {
if (StringUtils.isEmpty(entity.getFileUrl())) {
......@@ -171,30 +169,20 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
MatterDatumEntity matterDatumEntity = this.get(id, context);
int iRet = this.dao.delete(id);
this.removeAfter(id, context, iRet);
statDatumCount(context, matterDatumEntity);
statDatumCount(matterDatumEntity,context);
return iRet;
}
@Override
public int remove(Long[] ids, Context context) throws AppException {
this.removeBefore(ids, context);
if (ids == null || ids.length == 0) return 0;
if(ids==null||ids.length==0) return 0;
MatterDatumEntity matterDatumEntity = this.get(ids[0], context);
int iRet = this.dao.delete(ids);
this.removeAfter(ids, context, iRet);
statDatumCount(context, matterDatumEntity);
statDatumCount(matterDatumEntity,context);
return iRet;
}
private void statDatumCount(Context context, MatterDatumEntity matterDatumEntity) {
int count = this.count(new MatterDatumQuery().matterId(matterDatumEntity.getMatterId()), context);
MatterEntity matterEntity = matterService.get(matterDatumEntity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count);
matterService.update(matterEntity, context);
}
}
private void parseDocxToJson(MatterDatumEntity entity) {
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filepath = rootPath + entity.getTemplatePath();
......
package com.mortals.xhx.module.matter.service.impl;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -47,6 +48,16 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
protected void findAfter(MatterEntity entity, PageInfo pageInfo, Context context, List<MatterEntity> list) throws AppException {
for (MatterEntity matterEntity : list) {
matterEntity.setDatumCount(matterEntity.getMatterDatumList().size());
if (entity.getIsTerminal() == YesNoEnum.YES.getValue()) {
String searchMatterName = StrUtil.subBetween(entity.getMatterName(), "%");
if(!ObjectUtils.isEmpty(searchMatterName)){
//终端访问,标红查询参数
String str = "<span style=\"color:red;font-weight:bold\">%s</span>";
String replaceStr = StrUtil.replace(matterEntity.getMatterName(), searchMatterName, String.format(str, searchMatterName));
matterEntity.setMatterName(replaceStr);
}
}
}
}
......
......@@ -10,6 +10,8 @@ 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 com.mortals.xhx.module.matter.model.MatterDatumQuery;
import com.mortals.xhx.module.matter.service.MatterDatumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -43,6 +45,9 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@Autowired
private ParamService paramService;
@Autowired
private MatterDatumService matterDatumService;
public MatterController(){
super.setModuleDesc( "事项");
}
......@@ -67,15 +72,23 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@Override
protected int doListAfter(MatterEntity query, Map<String, Object> model, Context context) throws AppException {
int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_RECOMMEND_COUNT);
model.put("recommendCount", recommendCount);
return 1;
//统计材料数量
int count = 0;
List<Long> matterIdList = this.service.find(query, context).stream().map(MatterEntity::getId).collect(Collectors.toList());
MatterDatumQuery matterDatumQuery = new MatterDatumQuery();
if (!ObjectUtils.isEmpty(matterIdList)) {
count = matterDatumService.count(matterDatumQuery.siteId(query.getSiteId()), getContext());
} else {
matterDatumQuery.setMatterIdList(matterIdList);
}
model.put("matterDatumTotal", count);
return super.doListAfter(query, model, context);
}
@RequestMapping(value = {"createMatter"},method = {RequestMethod.POST, RequestMethod.GET})
public String createMatter(Long[] ids,Long siteId) {
Map<String, Object> model = new HashMap();
int code = 1;
int code = VALUE_RESULT_SUCCESS;
String busiDesc = "站点事项转事项";
try {
......@@ -83,7 +96,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
model.put("message_info", rest.getMsg());
this.recordSysLog(this.request, rest.getMsg());
} catch (Exception var7) {
code = -1;
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, var7);
}
......
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