Commit a7276f5a authored by 廖旭伟's avatar 廖旭伟

移植基础平台代码

parent a9b136f9
This diff is collapsed.
package com.mortals.xhx.module.library.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.library.model.PublicLibraryEntity;
import java.util.List;
/**
* 材料公共库Dao
* 材料公共库 DAO接口
*
* @author zxfei
* @date 2023-03-01
*/
public interface PublicLibraryDao extends ICRUDDao<PublicLibraryEntity,Long>{
}
package com.mortals.xhx.module.library.model;
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.library.model.vo.PublicLibraryVo;
/**
* 材料公共库实体对象
*
* @author zxfei
* @date 2023-03-01
*/
public class PublicLibraryEntity extends PublicLibraryVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 材料简称
*/
private String simpleName;
/**
* 材料全称
*/
private String fullName;
/**
* 文件地址
*/
private String fileUrl;
/**
* 文件预览地址
*/
private String previewUrl;
public PublicLibraryEntity(){}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 材料简称
* @return String
*/
public String getSimpleName(){
return simpleName;
}
/**
* 设置 材料简称
* @param simpleName
*/
public void setSimpleName(String simpleName){
this.simpleName = simpleName;
}
/**
* 获取 材料全称
* @return String
*/
public String getFullName(){
return fullName;
}
/**
* 设置 材料全称
* @param fullName
*/
public void setFullName(String fullName){
this.fullName = fullName;
}
/**
* 获取 文件地址
* @return String
*/
public String getFileUrl(){
return fileUrl;
}
/**
* 设置 文件地址
* @param fileUrl
*/
public void setFileUrl(String fileUrl){
this.fileUrl = fileUrl;
}
/**
* 获取 文件预览地址
* @return String
*/
public String getPreviewUrl(){
return previewUrl;
}
/**
* 设置 文件预览地址
* @param previewUrl
*/
public void setPreviewUrl(String previewUrl){
this.previewUrl = previewUrl;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof PublicLibraryEntity) {
PublicLibraryEntity tmp = (PublicLibraryEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",simpleName:").append(getSimpleName());
sb.append(",fullName:").append(getFullName());
sb.append(",fileUrl:").append(getFileUrl());
sb.append(",previewUrl:").append(getPreviewUrl());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.simpleName = "";
this.fullName = "";
this.fileUrl = "";
this.previewUrl = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.library.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.library.model.PublicLibraryEntity;
/**
* PublicLibraryService
*
* 材料公共库 service接口
*
* @author zxfei
* @date 2023-03-01
*/
public interface PublicLibraryService extends ICRUDService<PublicLibraryEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.matter.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.matter.model.MatterDutyerEntity;
import java.util.List;
/**
* 事项负责人Dao
* 事项负责人 DAO接口
*
* @author zxfei
* @date 2023-03-21
*/
public interface MatterDutyerDao extends ICRUDDao<MatterDutyerEntity,Long>{
}
package com.mortals.xhx.module.library.dao.ibatis; package com.mortals.xhx.module.matter.dao.ibatis;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.library.dao.PublicLibraryDao; import com.mortals.xhx.module.matter.dao.MatterDutyerDao;
import com.mortals.xhx.module.library.model.PublicLibraryEntity; import com.mortals.xhx.module.matter.model.MatterDutyerEntity;
import java.util.Date; import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List; import java.util.List;
/** /**
* 材料公共库DaoImpl DAO接口 * 事项负责人DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2023-03-01 * @date 2023-03-21
*/ */
@Repository("publicLibraryDao") @Repository("matterDutyerDao")
public class PublicLibraryDaoImpl extends BaseCRUDDaoMybatis<PublicLibraryEntity,Long> implements PublicLibraryDao { public class MatterDutyerDaoImpl extends BaseCRUDDaoMybatis<MatterDutyerEntity,Long> implements MatterDutyerDao {
......
package com.mortals.xhx.module.matter.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.matter.model.vo.MatterDutyerVo;
/**
* 事项负责人实体对象
*
* @author zxfei
* @date 2023-03-21
*/
public class MatterDutyerEntity extends MatterDutyerVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 工作人员姓名
*/
private String fullName;
/**
* 联系电话
*/
private String phoneNumber;
/**
* 登录用户名
*/
private String loginName;
/**
* 登录密码
*/
private String loginPwd;
/**
* 所属部门
*/
private Long deptId;
/**
* 所属部门名称
*/
private String deptName;
/**
* 所属股室
*/
private Long officeId;
/**
* 所属股室名称
*/
private String officeName;
/**
* 性别1男2女
*/
private Integer sexual;
/**
* 邮箱
*/
private String email;
/**
* 职位
*/
private String position;
/**
* 人员类型:1窗口工作人员2事项负责人
*/
private Integer personType;
/**
* 最后一次登录时间
*/
private Date lastLoginTime;
public MatterDutyerEntity(){}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 工作人员姓名
* @return String
*/
public String getFullName(){
return fullName;
}
/**
* 设置 工作人员姓名
* @param fullName
*/
public void setFullName(String fullName){
this.fullName = fullName;
}
/**
* 获取 联系电话
* @return String
*/
public String getPhoneNumber(){
return phoneNumber;
}
/**
* 设置 联系电话
* @param phoneNumber
*/
public void setPhoneNumber(String phoneNumber){
this.phoneNumber = phoneNumber;
}
/**
* 获取 登录用户名
* @return String
*/
public String getLoginName(){
return loginName;
}
/**
* 设置 登录用户名
* @param loginName
*/
public void setLoginName(String loginName){
this.loginName = loginName;
}
/**
* 获取 登录密码
* @return String
*/
public String getLoginPwd(){
return loginPwd;
}
/**
* 设置 登录密码
* @param loginPwd
*/
public void setLoginPwd(String loginPwd){
this.loginPwd = loginPwd;
}
/**
* 获取 所属部门
* @return Long
*/
public Long getDeptId(){
return deptId;
}
/**
* 设置 所属部门
* @param deptId
*/
public void setDeptId(Long deptId){
this.deptId = deptId;
}
/**
* 获取 所属部门名称
* @return String
*/
public String getDeptName(){
return deptName;
}
/**
* 设置 所属部门名称
* @param deptName
*/
public void setDeptName(String deptName){
this.deptName = deptName;
}
/**
* 获取 所属股室
* @return Long
*/
public Long getOfficeId(){
return officeId;
}
/**
* 设置 所属股室
* @param officeId
*/
public void setOfficeId(Long officeId){
this.officeId = officeId;
}
/**
* 获取 所属股室名称
* @return String
*/
public String getOfficeName(){
return officeName;
}
/**
* 设置 所属股室名称
* @param officeName
*/
public void setOfficeName(String officeName){
this.officeName = officeName;
}
/**
* 获取 性别1男2女
* @return Integer
*/
public Integer getSexual(){
return sexual;
}
/**
* 设置 性别1男2女
* @param sexual
*/
public void setSexual(Integer sexual){
this.sexual = sexual;
}
/**
* 获取 邮箱
* @return String
*/
public String getEmail(){
return email;
}
/**
* 设置 邮箱
* @param email
*/
public void setEmail(String email){
this.email = email;
}
/**
* 获取 职位
* @return String
*/
public String getPosition(){
return position;
}
/**
* 设置 职位
* @param position
*/
public void setPosition(String position){
this.position = position;
}
/**
* 获取 人员类型:1窗口工作人员2事项负责人
* @return Integer
*/
public Integer getPersonType(){
return personType;
}
/**
* 设置 人员类型:1窗口工作人员2事项负责人
* @param personType
*/
public void setPersonType(Integer personType){
this.personType = personType;
}
/**
* 获取 最后一次登录时间
* @return Date
*/
public Date getLastLoginTime(){
return lastLoginTime;
}
/**
* 设置 最后一次登录时间
* @param lastLoginTime
*/
public void setLastLoginTime(Date lastLoginTime){
this.lastLoginTime = lastLoginTime;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof MatterDutyerEntity) {
MatterDutyerEntity tmp = (MatterDutyerEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",fullName:").append(getFullName());
sb.append(",phoneNumber:").append(getPhoneNumber());
sb.append(",loginName:").append(getLoginName());
sb.append(",loginPwd:").append(getLoginPwd());
sb.append(",deptId:").append(getDeptId());
sb.append(",deptName:").append(getDeptName());
sb.append(",officeId:").append(getOfficeId());
sb.append(",officeName:").append(getOfficeName());
sb.append(",sexual:").append(getSexual());
sb.append(",email:").append(getEmail());
sb.append(",position:").append(getPosition());
sb.append(",personType:").append(getPersonType());
sb.append(",lastLoginTime:").append(getLastLoginTime());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.fullName = "";
this.phoneNumber = "";
this.loginName = "";
this.loginPwd = "";
this.deptId = null;
this.deptName = "";
this.officeId = null;
this.officeName = "";
this.sexual = 1;
this.email = "";
this.position = "";
this.personType = 1;
this.lastLoginTime = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.library.model.vo; package com.mortals.xhx.module.matter.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.library.model.PublicLibraryEntity; import com.mortals.xhx.module.matter.model.MatterDutyerEntity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* 材料公共库视图对象 * 事项负责人视图对象
* *
* @author zxfei * @author zxfei
* @date 2023-03-01 * @date 2023-03-21
*/ */
public class PublicLibraryVo extends BaseEntityLong { public class MatterDutyerVo extends BaseEntityLong {
} }
\ No newline at end of file
package com.mortals.xhx.module.matter.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.matter.model.MatterDutyerEntity;
/**
* MatterDutyerService
*
* 事项负责人 service接口
*
* @author zxfei
* @date 2023-03-21
*/
public interface MatterDutyerService extends ICRUDService<MatterDutyerEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.library.service.impl; package com.mortals.xhx.module.matter.service.impl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
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.xhx.module.library.dao.PublicLibraryDao; import com.mortals.xhx.module.matter.dao.MatterDutyerDao;
import com.mortals.xhx.module.library.model.PublicLibraryEntity; import com.mortals.xhx.module.matter.model.MatterDutyerEntity;
import com.mortals.xhx.module.library.service.PublicLibraryService; import com.mortals.xhx.module.matter.service.MatterDutyerService;
/** /**
* PublicLibraryService * MatterDutyerService
* 材料公共库 service实现 * 事项负责人 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-03-01 * @date 2023-03-21
*/ */
@Service("publicLibraryService") @Service("matterDutyerService")
public class PublicLibraryServiceImpl extends AbstractCRUDServiceImpl<PublicLibraryDao, PublicLibraryEntity, Long> implements PublicLibraryService { public class MatterDutyerServiceImpl extends AbstractCRUDServiceImpl<MatterDutyerDao, MatterDutyerEntity, Long> implements MatterDutyerService {
} }
\ No newline at end of file
package com.mortals.xhx.module.library.web; package com.mortals.xhx.module.matter.web;
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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -9,8 +9,8 @@ import com.mortals.framework.model.Context; ...@@ -9,8 +9,8 @@ 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.library.model.PublicLibraryEntity; import com.mortals.xhx.module.matter.model.MatterDutyerEntity;
import com.mortals.xhx.module.library.service.PublicLibraryService; import com.mortals.xhx.module.matter.service.MatterDutyerService;
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;
...@@ -24,24 +24,26 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -24,24 +24,26 @@ 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 2023-03-01 * @date 2023-03-21
*/ */
@RestController @RestController
@RequestMapping("public/library") @RequestMapping("matter/dutyer")
public class PublicLibraryController extends BaseCRUDJsonBodyMappingController<PublicLibraryService,PublicLibraryEntity,Long> { public class MatterDutyerController extends BaseCRUDJsonBodyMappingController<MatterDutyerService,MatterDutyerEntity,Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
public PublicLibraryController(){ public MatterDutyerController(){
super.setModuleDesc( "材料公共库"); super.setModuleDesc( "事项负责人");
} }
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "sexual", paramService.getParamBySecondOrganize("MatterDutyer","sexual"));
this.addDict(model, "personType", paramService.getParamBySecondOrganize("MatterDutyer","personType"));
super.init(model, context); super.init(model, context);
} }
......
package com.mortals.xhx.module.site.dao; package com.mortals.xhx.module.site.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.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import java.util.List; import java.util.List;
/** /**
...@@ -13,5 +15,8 @@ import java.util.List; ...@@ -13,5 +15,8 @@ import java.util.List;
public interface SiteMatterDao extends ICRUDDao<SiteMatterEntity,Long>{ public interface SiteMatterDao extends ICRUDDao<SiteMatterEntity,Long>{
String SQLID_SUB_LIST = "getSubList";
String SQLID_SUB_COUNT = "getSubListCount";
Result<SiteMatterEntity> getSubList(SiteMatterEntity matterQuery, PageInfo pageInfo);
} }
package com.mortals.xhx.module.site.dao.ibatis; package com.mortals.xhx.module.site.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.site.dao.SiteMatterDao; import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List; import java.util.List;
...@@ -16,6 +22,27 @@ import java.util.List; ...@@ -16,6 +22,27 @@ import java.util.List;
@Repository("siteMatterDao") @Repository("siteMatterDao")
public class SiteMatterDaoImpl extends BaseCRUDDaoMybatis<SiteMatterEntity,Long> implements SiteMatterDao { public class SiteMatterDaoImpl extends BaseCRUDDaoMybatis<SiteMatterEntity,Long> implements SiteMatterDao {
@Override
public Result<SiteMatterEntity> getSubList(SiteMatterEntity matterQuery, PageInfo pageInfo) {
Result<SiteMatterEntity> 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));
}
} }
...@@ -20,4 +20,7 @@ public class SiteMatterVo extends BaseEntityLong { ...@@ -20,4 +20,7 @@ public class SiteMatterVo extends BaseEntityLong {
/** 是否已添加收藏 */ /** 是否已添加收藏 */
private Integer isCollect = 0; private Integer isCollect = 0;
/** 事项类型排除列表 */
private List <String> eventTypeShowNotList;
} }
\ No newline at end of file
package com.mortals.xhx.module.site.service; package com.mortals.xhx.module.site.service;
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.framework.model.Result;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
/** /**
...@@ -16,4 +21,22 @@ public interface SiteMatterService extends ICRUDService<SiteMatterEntity,Long>{ ...@@ -16,4 +21,22 @@ public interface SiteMatterService extends ICRUDService<SiteMatterEntity,Long>{
* @param id * @param id
*/ */
void addViewsCount(Long id); void addViewsCount(Long id);
/**
* 添加事项到单事项
*
* @param matterIds
* @param context
*/
Rest<String> addToAssist(String matterIds, Context context);
/**
* 查找差集子项
* @param matterQuery
* @param pageInfo
* @param context
* @return
* @throws AppException
*/
Result<SiteMatterEntity> findSubList(SiteMatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException;
} }
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl; package com.mortals.xhx.module.site.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.matter.model.MatterDatumEntity; import com.mortals.xhx.module.matter.model.MatterDatumEntity;
import com.mortals.xhx.module.matter.model.MatterDatumFileEntity; import com.mortals.xhx.module.matter.model.MatterDatumFileEntity;
import com.mortals.xhx.module.matter.model.MatterDatumFileQuery; import com.mortals.xhx.module.matter.model.MatterDatumFileQuery;
import com.mortals.xhx.module.matter.model.MatterDatumQuery; import com.mortals.xhx.module.matter.model.MatterDatumQuery;
import com.mortals.xhx.module.matter.service.MatterDatumService; import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.site.model.SiteMatterAssistEntity;
import com.mortals.xhx.module.site.model.SiteMatterAssistQuery;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterAssistService;
import com.mortals.xhx.module.user.model.UserCollectEntity; import com.mortals.xhx.module.user.model.UserCollectEntity;
import com.mortals.xhx.module.user.model.UserCollectQuery; import com.mortals.xhx.module.user.model.UserCollectQuery;
import com.mortals.xhx.module.user.service.UserCollectService; import com.mortals.xhx.module.user.service.UserCollectService;
...@@ -18,10 +25,10 @@ import com.mortals.framework.model.Context; ...@@ -18,10 +25,10 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.site.dao.SiteMatterDao; import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import org.springframework.util.ObjectUtils;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
/** /**
* SiteMatterService * SiteMatterService
...@@ -37,6 +44,8 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao ...@@ -37,6 +44,8 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
private MatterDatumService matterDatumService; private MatterDatumService matterDatumService;
@Autowired @Autowired
private UserCollectService userCollectService; private UserCollectService userCollectService;
@Autowired
private SiteMatterAssistService siteMatterAssistService;
@Override @Override
protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException { protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException {
...@@ -106,4 +115,65 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao ...@@ -106,4 +115,65 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
condition.put("id",id); condition.put("id",id);
dao.update(data,condition); dao.update(data,condition);
} }
@Override
public Rest<String> addToAssist(String siteMatterIds, Context context) {
List<Long> matterIdList = Arrays.asList(siteMatterIds.split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
SiteMatterQuery matterQuery = new SiteMatterQuery();
matterQuery.setIdList(matterIdList);
List<SiteMatterEntity> matterEntities = this.find(matterQuery);
int success = 0;
int fail = 0;
List<SiteMatterAssistEntity> singelMatterEntities = new ArrayList<>();
for (SiteMatterEntity matterEntity : matterEntities) {
SiteMatterAssistEntity singelMatterEntity = updateOrSave(matterEntity, context);
if (!ObjectUtils.isEmpty(singelMatterEntity)) {
singelMatterEntities.add(singelMatterEntity);
success++;
} else {
fail++;
}
}
if (!ObjectUtils.isEmpty(singelMatterEntities)) {
siteMatterAssistService.save(singelMatterEntities, context);
}
String msg = "当前加入事项已存在!";
if (matterIdList.size() == 1) {
if (success > 0) {
msg = "加入事项成功!";
}
} else if (matterIdList.size() > 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 SiteMatterAssistEntity updateOrSave(SiteMatterEntity item, Context context) {
SiteMatterAssistEntity singleMatterEntity = siteMatterAssistService.selectOne(new SiteMatterAssistQuery().siteMatterId(item.getId()));
if (ObjectUtils.isEmpty(singleMatterEntity)) {
SiteMatterAssistEntity singleEntity = BeanUtil.covert(item,SiteMatterAssistEntity.class);
singleEntity.setCreateTime(new Date());
if(context!=null&&context.getUser()!=null) {
singleEntity.setCreateUserId(context.getUser().getId());
}
singleEntity.setSiteMatterId(item.getId());
singleEntity.setGovUrl(item.getUrl());
return singleEntity;
}else {
return null;
}
}
@Override
public Result<SiteMatterEntity> findSubList(SiteMatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException {
return this.dao.getSubList(matterQuery, pageInfo);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.site.web; package com.mortals.xhx.module.site.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
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.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.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery; import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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 java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.mortals.framework.ap.SysConstains.MESSAGE_INFO;
import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
/** /**
* *
* 站点事项 * 站点事项
...@@ -50,4 +63,59 @@ public class SiteMatterController extends BaseCRUDJsonBodyMappingController<Site ...@@ -50,4 +63,59 @@ public class SiteMatterController extends BaseCRUDJsonBodyMappingController<Site
this.service.addViewsCount(id); this.service.addViewsCount(id);
return 1; return 1;
} }
/**
* 添加事项到辅助事项
*/
@PostMapping(value = "addToAssist")
public String addToAssist(@RequestBody Map<String, Object> map) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<String, Object>();
String siteMatterIds = (String) map.get("siteMatterIds");
try {
Rest<String> rest = this.service.addToAssist(siteMatterIds, getContext());
jsonObject.put(KEY_RESULT_MSG, rest.getMsg());
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
this.recordSysLog(this.request, rest.getMsg());
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
@PostMapping(value = "sublist")
@UnAuth
public Rest<Object> sublist(@RequestBody SiteMatterEntity 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);
if(ObjectUtils.isEmpty(query.getEventTypeShowNotList())){
ArrayList<String> notList = new ArrayList<>();
notList.add("行政处罚");
query.setEventTypeShowNotList(notList);
}
Result<SiteMatterEntity> 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.site.dao.ibatis.SiteMatterDaoImpl">
<!-- 获取列表 -->
<select id="getSubList" parameterType="paramDto" resultMap="SiteMatterEntity-Map">
select <include refid="_columns"/>
from (SELECT m.* FROM mortals_sys_site_matter as m WHERE m.id NOT in(SELECT siteMatterId FROM mortals_sys_site_matter_assist)) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getSubListCount" parameterType="paramDto" resultType="int">
select count(1)
from (SELECT m.* FROM mortals_sys_site_matter as m WHERE m.id NOT in(SELECT siteMatterId FROM mortals_sys_site_matter_assist)) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
</mapper>
\ No newline at end of file
...@@ -522,25 +522,6 @@ CREATE TABLE `mortals_iot_matters_usertype` ( ...@@ -522,25 +522,6 @@ CREATE TABLE `mortals_iot_matters_usertype` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='服务类型表'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='服务类型表';
-- ----------------------------
-- 材料公共库表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_public_library`;
CREATE TABLE mortals_xhx_public_library(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`siteId` bigint(20) COMMENT '站点id',
`simpleName` varchar(128) NOT NULL COMMENT '材料简称',
`fullName` varchar(128) NOT NULL COMMENT '材料全称',
`fileUrl` varchar(128) COMMENT '文件地址',
`previewUrl` varchar(128) COMMENT '文件预览地址',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='材料公共库';
-- ---------------------------- -- ----------------------------
-- 纠错管理表 -- 纠错管理表
-- ---------------------------- -- ----------------------------
......
...@@ -93,9 +93,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -93,9 +93,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
Claims claims = parseToken(token); Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY); String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid); String userKey = getTokenKey(uuid);
cacheService.select(portalDb); //cacheService.select(portalDb);
String userStr = cacheService.get(userKey); String userStr = cacheService.get(userKey);
cacheService.select(db); //cacheService.select(db);
// Rest<String> rest = userFeign.getToken(userKey); // Rest<String> rest = userFeign.getToken(userKey);
// String userStr = rest.getData(); // String userStr = rest.getData();
......
...@@ -73,7 +73,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -73,7 +73,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (ObjectUtils.isEmpty(loginUser)) { if (ObjectUtils.isEmpty(loginUser)) {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT))); ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)));
return false; return false;
} else if (loginUser.isAdmin() || loginUser.getUserType() == 1) { } else if (loginUser.isAdmin() || loginUser.getUserType() == 1 || loginUser.getUserType() == 2) {
return super.preHandle(request, response, handler); return super.preHandle(request, response, handler);
} else { } else {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_USER_OPERATION, ERROR_USER_OPERATION_CONTENT))); ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_USER_OPERATION, ERROR_USER_OPERATION_CONTENT)));
......
package com.mortals.xhx.module.single.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.single.model.SingleMatterEntity;
import java.util.List;
/**
* 单事项Dao
* 单事项 DAO接口
*
* @author zxfei
* @date 2023-03-21
*/
public interface SingleMatterDao extends ICRUDDao<SingleMatterEntity,Long>{
}
package com.mortals.xhx.module.single.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.single.dao.SingleMatterDao;
import com.mortals.xhx.module.single.model.SingleMatterEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 单事项DaoImpl DAO接口
*
* @author zxfei
* @date 2023-03-21
*/
@Repository("singleMatterDao")
public class SingleMatterDaoImpl extends BaseCRUDDaoMybatis<SingleMatterEntity,Long> implements SingleMatterDao {
}
package com.mortals.xhx.module.single.model;
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.single.model.vo.SingleMatterVo;
/**
* 单事项实体对象
*
* @author zxfei
* @date 2023-03-21
*/
public class SingleMatterEntity extends SingleMatterVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 站点事项id
*/
private Long siteMatterId;
/**
* 基础事项ID
*/
private Long matterId;
/**
* 事项名称
*/
private String matterName;
/**
* 事项编码
*/
private String matterCode;
/**
* 部门ID
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 部门编码
*/
private String deptCode;
/**
* 事项来源
*/
private Integer source;
/**
* 事项类型
*/
private String eventTypeShow;
/**
* 浏览次数
*/
private Long viewsCount;
/**
* 是否生成本地附件
*/
private Integer isConvert;
/**
* 事项详情链接
*/
private String url;
public SingleMatterEntity(){}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 站点名称
* @return String
*/
public String getSiteName(){
return siteName;
}
/**
* 设置 站点名称
* @param siteName
*/
public void setSiteName(String siteName){
this.siteName = siteName;
}
/**
* 获取 站点事项id
* @return Long
*/
public Long getSiteMatterId(){
return siteMatterId;
}
/**
* 设置 站点事项id
* @param siteMatterId
*/
public void setSiteMatterId(Long siteMatterId){
this.siteMatterId = siteMatterId;
}
/**
* 获取 基础事项ID
* @return Long
*/
public Long getMatterId(){
return matterId;
}
/**
* 设置 基础事项ID
* @param matterId
*/
public void setMatterId(Long matterId){
this.matterId = matterId;
}
/**
* 获取 事项名称
* @return String
*/
public String getMatterName(){
return matterName;
}
/**
* 设置 事项名称
* @param matterName
*/
public void setMatterName(String matterName){
this.matterName = matterName;
}
/**
* 获取 事项编码
* @return String
*/
public String getMatterCode(){
return matterCode;
}
/**
* 设置 事项编码
* @param matterCode
*/
public void setMatterCode(String matterCode){
this.matterCode = matterCode;
}
/**
* 获取 部门ID
* @return Long
*/
public Long getDeptId(){
return deptId;
}
/**
* 设置 部门ID
* @param deptId
*/
public void setDeptId(Long deptId){
this.deptId = deptId;
}
/**
* 获取 部门名称
* @return String
*/
public String getDeptName(){
return deptName;
}
/**
* 设置 部门名称
* @param deptName
*/
public void setDeptName(String deptName){
this.deptName = deptName;
}
/**
* 获取 部门编码
* @return String
*/
public String getDeptCode(){
return deptCode;
}
/**
* 设置 部门编码
* @param deptCode
*/
public void setDeptCode(String deptCode){
this.deptCode = deptCode;
}
/**
* 获取 事项来源
* @return Integer
*/
public Integer getSource(){
return source;
}
/**
* 设置 事项来源
* @param source
*/
public void setSource(Integer source){
this.source = source;
}
/**
* 获取 事项类型
* @return String
*/
public String getEventTypeShow(){
return eventTypeShow;
}
/**
* 设置 事项类型
* @param eventTypeShow
*/
public void setEventTypeShow(String eventTypeShow){
this.eventTypeShow = eventTypeShow;
}
/**
* 获取 浏览次数
* @return Long
*/
public Long getViewsCount(){
return viewsCount;
}
/**
* 设置 浏览次数
* @param viewsCount
*/
public void setViewsCount(Long viewsCount){
this.viewsCount = viewsCount;
}
/**
* 获取 是否生成本地附件
* @return Integer
*/
public Integer getIsConvert(){
return isConvert;
}
/**
* 设置 是否生成本地附件
* @param isConvert
*/
public void setIsConvert(Integer isConvert){
this.isConvert = isConvert;
}
/**
* 获取 事项详情链接
* @return String
*/
public String getUrl(){
return url;
}
/**
* 设置 事项详情链接
* @param url
*/
public void setUrl(String url){
this.url = url;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SingleMatterEntity) {
SingleMatterEntity tmp = (SingleMatterEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",siteName:").append(getSiteName());
sb.append(",siteMatterId:").append(getSiteMatterId());
sb.append(",matterId:").append(getMatterId());
sb.append(",matterName:").append(getMatterName());
sb.append(",matterCode:").append(getMatterCode());
sb.append(",deptId:").append(getDeptId());
sb.append(",deptName:").append(getDeptName());
sb.append(",deptCode:").append(getDeptCode());
sb.append(",source:").append(getSource());
sb.append(",eventTypeShow:").append(getEventTypeShow());
sb.append(",viewsCount:").append(getViewsCount());
sb.append(",isConvert:").append(getIsConvert());
sb.append(",url:").append(getUrl());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.siteName = "";
this.siteMatterId = null;
this.matterId = null;
this.matterName = "";
this.matterCode = "";
this.deptId = null;
this.deptName = "";
this.deptCode = "";
this.source = null;
this.eventTypeShow = "";
this.viewsCount = 0L;
this.isConvert = 0;
this.url = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.single.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.single.model.SingleMatterEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 单事项视图对象
*
* @author zxfei
* @date 2023-03-21
*/
public class SingleMatterVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.single.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.single.model.SingleMatterEntity;
/**
* SingleMatterService
*
* 单事项 service接口
*
* @author zxfei
* @date 2023-03-21
*/
public interface SingleMatterService extends ICRUDService<SingleMatterEntity,Long>{
/**
* 增加浏览次数
* @param id
*/
void addViewsCount(Long id);
}
\ No newline at end of file
package com.mortals.xhx.module.single.service.impl;
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.single.dao.SingleMatterDao;
import com.mortals.xhx.module.single.model.SingleMatterEntity;
import com.mortals.xhx.module.single.service.SingleMatterService;
import java.util.HashMap;
import java.util.Map;
/**
* SingleMatterService
* 单事项 service实现
*
* @author zxfei
* @date 2023-03-21
*/
@Service("singleMatterService")
public class SingleMatterServiceImpl extends AbstractCRUDServiceImpl<SingleMatterDao, SingleMatterEntity, Long> implements SingleMatterService {
@Override
public void addViewsCount(Long id) {
Map<String,Object> data = new HashMap<>();
data.put("viewsCountIncrement",1);
Map<String,Object> condition = new HashMap<>();
condition.put("id",id);
dao.update(data,condition);
}
}
\ No newline at end of file
package com.mortals.xhx.module.single.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
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.single.model.SingleMatterEntity;
import com.mortals.xhx.module.single.service.SingleMatterService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 单事项
*
* @author zxfei
* @date 2023-03-21
*/
@RestController
@RequestMapping("single/matter")
public class SingleMatterController extends BaseCRUDJsonBodyMappingController<SingleMatterService,SingleMatterEntity,Long> {
@Autowired
private ParamService paramService;
public SingleMatterController(){
super.setModuleDesc( "单事项");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "source", paramService.getParamBySecondOrganize("SingleMatter","source"));
this.addDict(model, "isConvert", paramService.getParamBySecondOrganize("SingleMatter","isConvert"));
super.init(model, context);
}
@Override
protected int viewAfter(Long id, Map<String, Object> model, SingleMatterEntity entity, Context context) throws AppException {
this.service.addViewsCount(id);
return 1;
}
@Override
protected void doListBefore(SingleMatterEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderMap = new HashMap<>();
orderMap.put("viewsCount","DESC");
query.setOrderCols(orderMap);
super.doListBefore(query,model,context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.dao; package com.mortals.xhx.module.site.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.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import java.util.List;
/** /**
* 站点事项Dao * 站点事项Dao
* 站点事项 DAO接口 * 站点事项 DAO接口
...@@ -12,6 +13,9 @@ import java.util.List; ...@@ -12,6 +13,9 @@ import java.util.List;
*/ */
public interface SiteMatterDao extends ICRUDDao<SiteMatterEntity,Long>{ public interface SiteMatterDao extends ICRUDDao<SiteMatterEntity,Long>{
String SQLID_SUB_LIST = "getSubList";
String SQLID_SUB_COUNT = "getSubListCount";
Result<SiteMatterEntity> getSubList(SiteMatterEntity matterQuery, PageInfo pageInfo);
} }
package com.mortals.xhx.module.site.dao.ibatis; package com.mortals.xhx.module.site.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.site.dao.SiteMatterDao; import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
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 +22,27 @@ import java.util.List; ...@@ -17,5 +22,27 @@ import java.util.List;
public class SiteMatterDaoImpl extends BaseCRUDDaoMybatis<SiteMatterEntity,Long> implements SiteMatterDao { public class SiteMatterDaoImpl extends BaseCRUDDaoMybatis<SiteMatterEntity,Long> implements SiteMatterDao {
@Override
public Result<SiteMatterEntity> getSubList(SiteMatterEntity matterQuery, PageInfo pageInfo) {
Result<SiteMatterEntity> 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.site.service; package com.mortals.xhx.module.site.service;
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.framework.model.Result;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.site.dao.SiteMatterDao; import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
...@@ -18,4 +24,23 @@ public interface SiteMatterService extends ICRUDService<SiteMatterEntity,Long>{ ...@@ -18,4 +24,23 @@ public interface SiteMatterService extends ICRUDService<SiteMatterEntity,Long>{
* @param id * @param id
*/ */
void addViewsCount(Long id); void addViewsCount(Long id);
/**
* 添加事项到单事项
*
* @param matterIds
* @param context
*/
Rest<String> addToSingle(String matterIds, Context context);
/**
* 查找差集子项
* @param matterQuery
* @param pageInfo
* @param context
* @return
* @throws AppException
*/
Result<SiteMatterEntity> findSubList(SiteMatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException;
} }
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl; package com.mortals.xhx.module.site.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.matter.model.MatterDatumEntity; import com.mortals.framework.model.Result;
import com.mortals.xhx.module.matter.model.MatterDatumFileEntity; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.matter.model.MatterDatumFileQuery; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.matter.model.MatterDatumQuery; import com.mortals.xhx.module.matter.model.*;
import com.mortals.xhx.module.matter.service.MatterDatumService; import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.single.model.SingleMatterEntity;
import com.mortals.xhx.module.single.model.SingleMatterQuery;
import com.mortals.xhx.module.single.service.SingleMatterService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,10 +20,10 @@ import com.mortals.framework.model.Context; ...@@ -14,10 +20,10 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.site.dao.SiteMatterDao; import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import org.springframework.util.ObjectUtils;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
/** /**
* SiteMatterService * SiteMatterService
...@@ -31,6 +37,8 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao ...@@ -31,6 +37,8 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
@Autowired @Autowired
private MatterDatumService matterDatumService; private MatterDatumService matterDatumService;
@Autowired
private SingleMatterService singleMatterService;
@Override @Override
protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException { protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException {
...@@ -66,4 +74,66 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao ...@@ -66,4 +74,66 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
condition.put("id",id); condition.put("id",id);
dao.update(data,condition); dao.update(data,condition);
} }
@Override
public Rest<String> addToSingle(String siteMatterIds, Context context) {
List<Long> matterIdList = Arrays.asList(siteMatterIds.split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
SiteMatterQuery matterQuery = new SiteMatterQuery();
matterQuery.setIdList(matterIdList);
List<SiteMatterEntity> matterEntities = this.find(matterQuery);
int success = 0;
int fail = 0;
List<SingleMatterEntity> singelMatterEntities = new ArrayList<>();
for (SiteMatterEntity matterEntity : matterEntities) {
SingleMatterEntity singelMatterEntity = updateOrSave(matterEntity, context);
if (!ObjectUtils.isEmpty(singelMatterEntity)) {
singelMatterEntities.add(singelMatterEntity);
success++;
} else {
fail++;
}
}
if (!ObjectUtils.isEmpty(singelMatterEntities)) {
singleMatterService.save(singelMatterEntities, context);
}
String msg = "当前加入事项已存在!";
if (matterIdList.size() == 1) {
if (success > 0) {
msg = "加入事项成功!";
}
} else if (matterIdList.size() > 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 SingleMatterEntity updateOrSave(SiteMatterEntity item, Context context) {
SingleMatterEntity singleMatterEntity = singleMatterService.selectOne(new SingleMatterQuery().siteMatterId(item.getId()));
if (ObjectUtils.isEmpty(singleMatterEntity)) {
SingleMatterEntity singleEntity = BeanUtil.covert(item,SingleMatterEntity.class);
singleEntity.setCreateTime(new Date());
if(context!=null&&context.getUser()!=null) {
singleEntity.setCreateUserId(context.getUser().getId());
}
singleEntity.setSiteMatterId(item.getId());
singleEntity.setViewsCount(0l);
singleEntity.setIsConvert(0);
return singleEntity;
}else {
return null;
}
}
@Override
public Result<SiteMatterEntity> findSubList(SiteMatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException {
return this.dao.getSubList(matterQuery, pageInfo);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.site.web; package com.mortals.xhx.module.site.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
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.util.DataUtil;
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.module.matter.model.MatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery; import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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 java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.mortals.framework.ap.SysConstains.MESSAGE_INFO;
import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
/** /**
* *
* 站点事项 * 站点事项
...@@ -50,4 +65,59 @@ public class SiteMatterController extends BaseCRUDJsonBodyMappingController<Site ...@@ -50,4 +65,59 @@ public class SiteMatterController extends BaseCRUDJsonBodyMappingController<Site
this.service.addViewsCount(id); this.service.addViewsCount(id);
return 1; return 1;
} }
/**
* 添加事项到单事项
*/
@PostMapping(value = "addToSingle")
public String addToSingle(@RequestBody Map<String, Object> map) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<String, Object>();
String siteMatterIds = (String) map.get("siteMatterIds");
try {
Rest<String> rest = this.service.addToSingle(siteMatterIds, getContext());
jsonObject.put(KEY_RESULT_MSG, rest.getMsg());
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
this.recordSysLog(this.request, rest.getMsg());
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
@PostMapping(value = "sublist")
@UnAuth
public Rest<Object> sublist(@RequestBody SiteMatterEntity 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);
if(ObjectUtils.isEmpty(query.getEventTypeShowNotList())){
ArrayList<String> notList = new ArrayList<>();
notList.add("行政处罚");
query.setEventTypeShowNotList(notList);
}
Result<SiteMatterEntity> 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.site.dao.ibatis.SiteMatterDaoImpl">
<!-- 获取列表 -->
<select id="getSubList" parameterType="paramDto" resultMap="SiteMatterEntity-Map">
select <include refid="_columns"/>
from (SELECT m.* FROM mortals_sys_site_matter as m WHERE m.id NOT in(SELECT siteMatterId FROM mortals_sys_single_matter)) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getSubListCount" parameterType="paramDto" resultType="int">
select count(1)
from (SELECT m.* FROM mortals_sys_site_matter as m WHERE m.id NOT in(SELECT siteMatterId FROM mortals_sys_single_matter)) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</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