Commit 51eff08b authored by 赵啸非's avatar 赵啸非

删除无用的部门和站点

parent a0f1fc1b
Pipeline #2954 canceled with stages
package com.mortals.xhx.common.utils;
import com.google.zxing.*;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.mortals.framework.util.Base64;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Hashtable;
import java.util.Random;
/**
* 二维码工具类
*
*/
public class QRCodeUtil {
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(QRCodeUtil.class);
private static final String CHARSET = "utf-8";
private static final String FORMAT = "JPG";
// 二维码尺寸
private static final int QRCODE_SIZE = 300;
// LOGO宽度
private static final int LOGO_WIDTH = 60;
// LOGO高度
private static final int LOGO_HEIGHT = 60;
private static BufferedImage createImage(String content, String logoPath, boolean needCompress) throws Exception {
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
hints.put(EncodeHintType.MARGIN, 1);
BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
int width = bitMatrix.getWidth();
int height = bitMatrix.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
}
}
if (logoPath == null || "".equals(logoPath)) {
return image;
}
// 插入图片
QRCodeUtil.insertImage(image, logoPath, needCompress);
return image;
}
/**
* 插入LOGO
*
* @param source
* 二维码图片
* @param logoPath
* LOGO图片地址
* @param needCompress
* 是否压缩
* @throws Exception
*/
private static void insertImage(BufferedImage source, String logoPath, boolean needCompress) throws Exception {
File file = new File(logoPath);
if (!file.exists()) {
throw new Exception("logo file not found.");
}
Image src = ImageIO.read(new File(logoPath));
int width = src.getWidth(null);
int height = src.getHeight(null);
if (needCompress) { // 压缩LOGO
if (width > LOGO_WIDTH) {
width = LOGO_WIDTH;
}
if (height > LOGO_HEIGHT) {
height = LOGO_HEIGHT;
}
Image image = src.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = tag.getGraphics();
g.drawImage(image, 0, 0, null); // 绘制缩小后的图
g.dispose();
src = image;
}
// 插入LOGO
Graphics2D graph = source.createGraphics();
int x = (QRCODE_SIZE - width) / 2;
int y = (QRCODE_SIZE - height) / 2;
graph.drawImage(src, x, y, width, height, null);
Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
graph.setStroke(new BasicStroke(3f));
graph.draw(shape);
graph.dispose();
}
/**
* 生成二维码(内嵌LOGO) 二维码文件名随机,文件名可能会有重复
*
* @param content
* 内容
* @param logoPath
* LOGO地址
* @param destPath
* 存放目录
* @param needCompress
* 是否压缩LOGO
* @throws Exception
*/
public static String encode(String content, String logoPath, String destPath, boolean needCompress) throws Exception {
BufferedImage image = QRCodeUtil.createImage(content, logoPath, needCompress);
mkdirs(destPath);
String fileName = new Random().nextInt(99999999) + "." + FORMAT.toLowerCase();
ImageIO.write(image, FORMAT, new File(destPath + "/" + fileName));
return fileName;
}
/**
* 生成二维码(内嵌LOGO) 调用者指定二维码文件名
*
* @param content
* 内容
* @param logoPath
* LOGO地址
* @param destPath
* 存放目录
* @param fileName
* 二维码文件名
* @param needCompress
* 是否压缩LOGO
* @throws Exception
*/
public static String encode(String content, String logoPath, String destPath, String fileName, boolean needCompress) throws Exception {
BufferedImage image = QRCodeUtil.createImage(content, logoPath, needCompress);
mkdirs(destPath);
fileName = fileName.substring(0, fileName.indexOf(".") > 0 ? fileName.indexOf(".") : fileName.length()) + "." + FORMAT.toLowerCase();
ImageIO.write(image, FORMAT, new File(destPath + "/" + fileName));
return fileName;
}
/**
* 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir. (mkdir如果父目录不存在则会抛出异常)
*
* @param destPath
* 存放目录
*/
public static void mkdirs(String destPath) {
File file = new File(destPath);
if (!file.exists() && !file.isDirectory()) {
file.mkdirs();
}
}
/**
* 生成二维码
*
* @param content
* 内容
* @param destPath
* 存储地址
* @throws Exception
*/
public static String encode(String content, String destPath) throws Exception {
return QRCodeUtil.encode(content, null, destPath, false);
}
/**
* 生成二维码(内嵌LOGO)
*
* @param content
* 内容
* @param logoPath
* LOGO地址
* @param output
* 输出流
* @param needCompress
* 是否压缩LOGO
* @throws Exception
*/
public static void encode(String content, String logoPath, OutputStream output, boolean needCompress) throws Exception {
BufferedImage image = QRCodeUtil.createImage(content, logoPath, needCompress);
ImageIO.write(image, FORMAT, output);
}
/**
* 生成二维码
*
* @param content
* 内容
* @param output
* 输出流
* @throws Exception
*/
public static void encode(String content, OutputStream output) throws Exception {
QRCodeUtil.encode(content, null, output, false);
}
/**
* 将二维码转换成base64字符串
*
* @param content
* @param logoPath
* @param needCompress
* @return
* @throws Exception
*/
public static String encode(String content, String logoPath, boolean needCompress) throws Exception {
BufferedImage image = QRCodeUtil.createImage(content, logoPath, needCompress);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ImageIO.write(image, FORMAT, outputStream);
return Base64.encode(outputStream.toByteArray());
}
public static byte[] encodeToBytes(String content, String logoPath, boolean needCompress) throws Exception {
BufferedImage image = QRCodeUtil.createImage(content, logoPath, needCompress);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ImageIO.write(image, FORMAT, outputStream);
return outputStream.toByteArray();
}
/**
* 解析二维码
*
* @param file
* 二维码图片
* @return
* @throws Exception
*/
public static String decode(File file) throws Exception {
BufferedImage image;
image = ImageIO.read(file);
if (image == null) {
return null;
}
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
result = new MultiFormatReader().decode(bitmap, hints);
String resultStr = result.getText();
return resultStr;
}
/**
* 解析二维码
*
* @param path
* 二维码图片地址
* @return
* @throws Exception
*/
public static String decode(String path) throws Exception {
return QRCodeUtil.decode(new File(path));
}
/**
* 解析二维码
*
* @param file
* 二维码图片
* @return
* @throws Exception
*/
public static String decode(InputStream inputStream) throws Exception {
BufferedImage image = ImageIO.read(inputStream);
if (image == null) {
return null;
}
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
result = new MultiFormatReader().decode(bitmap, hints);
String resultStr = result.getText();
return resultStr;
}
public static void main(String[] args) throws Exception {
// String text =
// "https://mp.weixin.qq.com/a/~~qgbFJlgjTPg~wAWUfsCV6ni-VdasDWFqJg~~";
// QRCodeUtil.encode(text, "", "e:\\", "qrcodeTest", true);
// System.out.println(QRCodeUtil.decode("d:\\777.png"));
System.out.println(QRCodeUtil.decode("e:\\4.png"));
// https://mp.weixin.qq.com/a/~~7e4OEtdDP-A~N-WJjuAzvca5sdEzbkQ9hA~~
// https://mp.weixin.qq.com/a/~~hopFMAkydTI~RWT6ZsVRPo0jIZzPgXGVlg~~ 2
// https://mp.weixin.qq.com/a/~~GwiYx6fLcTQ~gglQBO3FfzX6SuWe2z65rg~~ 3
// https://mp.weixin.qq.com/a/~~UjQMf5HyHLM~8SjrWsLXuc-3XtoAgFPEIw~~ 4
// System.out.println(QRCodeUtil.encode(text,null, true).length());
}
}
//package com.mortals.xhx.daemon.task;
//
//import com.mortals.framework.common.Rest;
//import com.mortals.framework.exception.AppException;
//import com.mortals.framework.service.ITask;
//import com.mortals.framework.service.ITaskExcuteService;
//import com.mortals.xhx.common.code.YesNoEnum;
//import com.mortals.xhx.common.pdu.RespData;
//import com.mortals.xhx.common.pdu.site.SiteMatterPdu;
//import com.mortals.xhx.common.pdu.site.SitePdu;
//import com.mortals.xhx.feign.site.ISiteFeign;
//import com.mortals.xhx.feign.site.ISiteMatterFeign;
//import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
//import com.mortals.xhx.module.sheet.model.SheetMatterQuery;
//import com.mortals.xhx.module.sheet.service.SheetMatterService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.ObjectUtils;
//
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 同步事项列表
// */
//@Slf4j
//@Service("SyncSiteMatterTask")
//public class SyncSiteMatterTaskImpl implements ITaskExcuteService {
//
// @Autowired
// private ISiteFeign siteFeign;
// @Autowired
// private ISiteMatterFeign siteMatterFeign;
// @Autowired
// private SheetMatterService sheetMatterService;
//
// @Override
// public void excuteTask(ITask task) throws AppException {
// log.info("开始同步事项列表!");
// SitePdu sitePdu = new SitePdu();
// sitePdu.setId(1L);
// Rest<List<SitePdu>> siteRest = siteFeign.getFlatSitesBySiteId(sitePdu);
// if (siteRest.getCode() == YesNoEnum.YES.getValue()) {
// log.info("站点总数量:{}",siteRest.getData().size());
// siteRest.getData().forEach(site -> {
// sheetMatterService.getDao().delete(new SheetMatterQuery().siteId(site.getId()));
// log.info("删除事项:{}",siteRest.getData().size());
// int page=100;
// int pageNum=100;
// for(int i=1;i<=page;i++){
// SiteMatterPdu siteMatterPdu = new SiteMatterPdu();
// siteMatterPdu.setSiteId(site.getId());
// siteMatterPdu.setPage(i);
// siteMatterPdu.setSize(pageNum);
// log.info("请求页数列表:"+i);
// Rest<RespData<List<SiteMatterPdu>>> siteMatterRest = siteMatterFeign.list(siteMatterPdu);
// if (siteMatterRest.getCode() == YesNoEnum.YES.getValue()) {
// if(siteMatterRest.getData().getData().size()==0){
// log.info("数据没有!跳出循环");
// break;
// }
// //删除后新增
// log.info("返回事项总数量:{}",siteMatterRest.getData().getData().size());
// List<SheetMatterEntity> sheetMatterEntities = siteMatterRest.getData().getData().stream().map(siteMatter -> {
// SheetMatterEntity sheetMatterEntity = new SheetMatterEntity();
// sheetMatterEntity.initAttrValue();
// sheetMatterEntity.setId(siteMatter.getMatterId());
// sheetMatterEntity.setSiteId(siteMatter.getSiteId());
// sheetMatterEntity.setMatterName(siteMatter.getMatterName());
// sheetMatterEntity.setMatterNo(siteMatter.getMatterCode());
// sheetMatterEntity.setDeptCode(siteMatter.getDeptCode());
// sheetMatterEntity.setDeptName(siteMatter.getDeptName());
// sheetMatterEntity.setAreaCode(siteMatter.getAreaCode());
// sheetMatterEntity.setSource(siteMatter.getSource());
// return sheetMatterEntity;
// }).collect(Collectors.toList());
//
// if (!ObjectUtils.isEmpty(sheetMatterEntities)) {
// // sheetMatterService.getDao().delete(new SheetMatterQuery().siteId(site.getId()));
// log.info("新增事项数量:{}",sheetMatterEntities.size());
// sheetMatterService.save(sheetMatterEntities);
// }
// }else{
// log.info("请求错误,code:{} msg:{}",siteMatterRest.getCode(),siteMatterRest.getMsg());
// }
// }
//
// });
// }
// }
// @Override
// public void stopTask(ITask task) throws AppException {
//
// }
//}
package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.base.system.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;
/**
* 同步政务服务3.0用户
*/
@Slf4j
@Service("SyncUserTask")
public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private UserService userService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("同步用户");
//todo 用户来源 php政务系统 密码默认123
// userService.refreshUser();
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
package com.mortals.xhx.module.category.service.impl;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.BeanUtils;
import java.util.Map;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......@@ -17,6 +19,8 @@ import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* CategoryService
......
package com.mortals.xhx.module.declare.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DeclareStatusEnum;
import com.mortals.xhx.module.declare.model.*;
import com.mortals.xhx.module.declare.service.DeclareFinImagesService;
import com.mortals.xhx.module.declare.service.DeclareImagesService;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.declare.service.DeclareService;
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.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.declare.service.DeclareService;
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.*;
import com.mortals.xhx.common.code.*;
/**
* 企业代办申报
......
package com.mortals.xhx.module.dept.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo;
import java.util.List;
/**
* 部门Dao
* 部门 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
String GET_DEPT_LIST_BY_BUSINESS = "getDeptListByBusiness";
String GET_BUSINESS_BY_DEPT = "getBusinessByDept";
String GET_DEPTLIST_BY_EXISTBUSINESS = "getDeptListByExistBusiness";
List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery);
List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery);
}
package com.mortals.xhx.module.dept.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.framework.model.ParamDto;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 部门DaoImpl DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
@Repository("deptDao")
public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity, Long> implements DeptDao {
/**
* @param deptQuery
* @return
*/
@Override
public List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery) {
ParamDto paramDto = this.getQueryParam(deptQuery);
List list = this.getSqlSession().selectList(this.getSqlId(GET_DEPT_LIST_BY_BUSINESS), paramDto);
return list;
}
/**
* @param deptQuery
* @return
*/
@Override
public List<DeptVo> getBusinessByDept(DeptQuery deptQuery) {
ParamDto paramDto = this.getQueryParam(deptQuery);
List list = this.getSqlSession().selectList(this.getSqlId(GET_BUSINESS_BY_DEPT), paramDto);
return list;
}
/**
* @return
*/
@Override
public List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery) {
ParamDto paramDto = this.getQueryParam(deptQuery);
return this.getSqlSession().selectList(this.getSqlId(GET_DEPTLIST_BY_EXISTBUSINESS),paramDto);
}
}
package com.mortals.xhx.module.dept.model;
import com.mortals.xhx.module.dept.model.vo.DeptVo;
import lombok.Data;
/**
* 部门实体对象
*
* @author zxfei
* @date 2024-04-24
*/
@Data
public class DeptEntity extends DeptVo {
private static final long serialVersionUID = 1L;
/**
* 从政务系统来的部门id
*/
private String tid;
/**
* 从政务系统来的部门name
*/
private String tname;
/**
* 部门名称
*/
private String name;
/**
* 从政务系统来的别名
*/
private String simpleName;
/**
* 站点ID
*/
private Long siteId;
/**
* 部门简称
*/
private String deptAbb;
/**
* 部门电话
*/
private String deptTelphone;
/**
* 部门编号
*/
private String deptNumber;
/**
* 填单机展示 (0.否,1.是)
*/
private Integer isAutotable;
/**
* 预约展示 (0.否,1.是)
*/
private Integer isOrder;
/**
* 背靠背展示 (0.否,1.是)
*/
private Integer isBkb;
/**
* 办事指南展示 (0.否,1.是)
*/
private Integer isWorkGuide;
/**
* 是否使用 (0.否,1.是)
*/
private Integer usValid;
/**
* 部门电话是否展示 (0.否,1.是)
*/
private Integer isSecphone;
/**
* 是否展示英文 (0.否,1.是)
*/
private Integer isEnglish;
/**
* 排序
*/
private Integer sort;
/**
* 部门来源
*/
private Integer source;
/**
* 关联事项数量
*/
private Integer total;
/**
* 入驻事项数量
*/
private Integer inNum;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof DeptEntity) {
DeptEntity tmp = (DeptEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.tid = "";
this.tname = "";
this.name = "";
this.simpleName = "";
this.siteId = null;
this.deptAbb = "";
this.deptTelphone = "";
this.deptNumber = "";
this.isAutotable = 1;
this.isOrder = 1;
this.isBkb = 1;
this.isWorkGuide = 1;
this.usValid = 1;
this.isSecphone = 1;
this.isEnglish = 1;
this.sort = 0;
this.source = 0;
this.total = 0;
this.inNum = 0;
}
}
\ No newline at end of file
package com.mortals.xhx.module.dept.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.List;
/**
* 部门视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class DeptVo extends BaseEntityLong {
/**
* 部门名称
*/
private String name;
/**
* 部门编号
*/
private String deptNumber;
/**
* 站点业务ID
*/
private Long siteBusinessId;
private Long windowId;
private String windowName;
/**
* 业务名称
*/
private String businessName;
/** 站点业务ID列表 */
private List <Long> siteBusinessIdList;
/** 部门ID列表 */
private List <Long> idList;
/**
* 是否过滤不存在事项的部门(0.不过滤,1.过滤,默认不过滤)
*/
private Integer filter;
/** 开始 关联事项数量 */
private Integer totalStart;
/**
* 大厅事项入驻(0.否,1.是)
*/
private Integer hallCheckIn;
/** 开始 入驻事项数量 */
private Integer inNumStart;
}
\ No newline at end of file
package com.mortals.xhx.module.dept.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo;
import com.mortals.xhx.module.site.model.SiteEntity;
import java.util.List;
import java.util.Map;
/**
* DeptService
* <p>
* 部门 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
DeptDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.dept.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
/**
* DeptService
* 部门 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("deptService")
public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptEntity, Long> implements DeptService {
@Autowired
private SiteService siteService;
@Autowired
private SiteMatterService siteMatterService;
@Override
protected String getExtKey(DeptEntity data) {
return data.getDeptNumber();
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void saveBefore(DeptEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
//新增校验部门编码是否重复
DeptEntity extCache = this.getExtCache(entity.getDeptNumber());
if (!ObjectUtils.isEmpty(extCache)) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
}
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void updateBefore(DeptEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
DeptEntity beforeEntity = this.get(entity.getId(), context);
if (!beforeEntity.getDeptNumber().equals(entity.getDeptNumber())) {
DeptEntity extCache = this.getExtCache(entity.getDeptNumber());
if (!ObjectUtils.isEmpty(extCache)) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
}
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.dept.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.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 部门
*
* @author zxfei
* @date 2022-01-20
*/
@RestController
@RequestMapping("dept")
public class DeptController extends BaseCRUDJsonBodyMappingController<DeptService, DeptEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private SiteService siteService;
public DeptController() {
super.setModuleDesc("部门");
}
@Override
protected void doListBefore(DeptEntity query, Map<String, Object> model, Context context) throws AppException {
if (ObjectUtils.isEmpty(query.getIdList())) {
if (ObjectUtils.isEmpty(query.getOrderColList())) {
query.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("sort", OrderCol.ASCENDING));
add(new OrderCol("createTime", OrderCol.DESCENDING));
}
});
} else {
query.getOrderColList().add(new OrderCol("createTime", OrderCol.DESCENDING));
}
} else {
}
if (!ObjectUtils.isEmpty(query.getFilter()) && YesNoEnum.YES.getValue() == query.getFilter()) {
//过滤部门事项数据为0的部门
query.setTotalStart(1);
}
if (!ObjectUtils.isEmpty(query.getHallCheckIn()) && YesNoEnum.YES.getValue() == query.getHallCheckIn()) {
//过滤部门事项数据为0的部门
query.setInNumStart(1);
}
super.doListBefore(query, model, context);
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "isAutotable", paramService.getParamBySecondOrganize("Dept", "isAutotable"));
this.addDict(model, "isOrder", paramService.getParamBySecondOrganize("Dept", "isOrder"));
this.addDict(model, "isBkb", paramService.getParamBySecondOrganize("Dept", "isBkb"));
this.addDict(model, "isWorkGuide", paramService.getParamBySecondOrganize("Dept", "isWorkGuide"));
this.addDict(model, "usValid", paramService.getParamBySecondOrganize("Dept", "usValid"));
this.addDict(model, "isSecphone", paramService.getParamBySecondOrganize("Dept", "isSecphone"));
this.addDict(model, "isEnglish", paramService.getParamBySecondOrganize("Dept", "isEnglish"));
super.init(model, context);
}
/**
* @param entity
* @param model
* @param context
* @throws AppException
*/
@Override
protected void saveBefore(DeptEntity entity, Map<String, Object> model, Context context) throws AppException {
if (entity.newEntity()) {
entity.setSource(SourceEnum.自定义.getValue());
}
super.saveBefore(entity, model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.evaluation.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -6,45 +7,53 @@ 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.evaluation.model.EvaluationInfoEntity;
import com.mortals.xhx.module.evaluation.service.EvaluationInfoService;
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.*;
import com.mortals.xhx.common.code.*;
/**
*
* 用户代办帮办评价
*
* @author zxfei
* @date 2025-04-27
*/
* 用户代办帮办评价
*
* @author zxfei
* @date 2025-04-27
*/
@RestController
@RequestMapping("evaluation/info")
public class EvaluationInfoController extends BaseCRUDJsonBodyMappingController<EvaluationInfoService,EvaluationInfoEntity,Long> {
public class EvaluationInfoController extends BaseCRUDJsonBodyMappingController<EvaluationInfoService, EvaluationInfoEntity, Long> {
@Autowired
private ParamService paramService;
public EvaluationInfoController(){
super.setModuleDesc( "用户代办帮办评价");
public EvaluationInfoController() {
super.setModuleDesc("用户代办帮办评价");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "score", ScoreEnum.getEnumMap());
this.addDict(model, "evalStatus", EvalStatusEnum.getEnumMap());
this.addDict(model, "evalStatus", EvalStatusEnum.getEnumMap());
super.init(model, context);
}
......
package com.mortals.xhx.module.site.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.site.model.SiteEntity;
/**
* 站点Dao
* 站点 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteDao extends ICRUDDao<SiteEntity,Long>{
}
package com.mortals.xhx.module.site.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
/**
* 站点事项Dao
* 站点事项 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteMatterDao extends ICRUDDao<SiteMatterEntity,Long>{
}
package com.mortals.xhx.module.site.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import org.springframework.stereotype.Repository;
/**
* 站点DaoImpl DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
@Repository("siteDao")
public class SiteDaoImpl extends BaseCRUDDaoMybatis<SiteEntity,Long> implements SiteDao {
}
package com.mortals.xhx.module.site.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import org.springframework.stereotype.Repository;
/**
* 站点事项DaoImpl DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
@Repository("siteMatterDao")
public class SiteMatterDaoImpl extends BaseCRUDDaoMybatis<SiteMatterEntity,Long> implements SiteMatterDao {
}
package com.mortals.xhx.module.site.model;
import com.mortals.xhx.module.site.model.vo.SiteVo;
import lombok.Data;
import java.util.Date;
/**
* 站点实体对象
*
* @author zxfei
* @date 2024-12-11
*/
@Data
public class SiteEntity extends SiteVo {
private static final long serialVersionUID = 1L;
/**
* 站点名称
*/
private String siteName;
/**
* 站点编号
*/
private String siteCode;
/**
* 区域Id
*/
private String areaID;
/**
* 区域编号
*/
private String areaCode;
/**
* 区域名称
*/
private String areaName;
/**
* 省编码
*/
private String proCode;
/**
* 市编码
*/
private String cityCode;
/**
* 区编码
*/
private String districtCode;
/**
* 站点服务器ip
*/
private String siteIp;
/**
* 站点服务器端口
*/
private String sitePort;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 中心联系电话
*/
private String siteTel;
/**
* 中心详细地址
*/
private String detailAddress;
/**
* 中心介绍
*/
private String siteRemark;
/**
* 上午上班开始时间
*/
private Date amWorkStartTime;
/**
* 上午上班结束时间
*/
private Date amWorkEndTime;
/**
* 下午上班开始时间
*/
private Date pmWorkStartTime;
/**
* 下午上班结束时间
*/
private Date pmWorkEndTime;
/**
* 周一 (1.上班,0.不上)
*/
private Integer workday1;
/**
* 周二 (1.上班,0.不上)
*/
private Integer workday2;
/**
* 周三 (1.上班,0.不上)
*/
private Integer workday3;
/**
* 周四 (1.上班,0.不上)
*/
private Integer workday4;
/**
* 周五 (1.上班,0.不上)
*/
private Integer workday5;
/**
* 周六 (1.上班,0.不上)
*/
private Integer workday6;
/**
* 周日 (1.上班,0.不上)
*/
private Integer workday7;
/**
* 在线取号(0.否,1.是)
*/
private Integer onlineTake;
/**
* 在线取号(0.否,1.是)
*/
private Integer appointment;
/**
* 在线取号(0.否,1.是)
*/
private Integer gowMap;
/**
* 楼层
*/
private Integer level;
/**
* 楼栋
*/
private Integer building;
/**
* logo图片地址
*/
private String logoPath;
/**
* 英文名称
*/
private String englishName;
/**
* 负责人
*/
private String leadingOfficial;
/**
* 联系电话
*/
private String leadingOfficialTelephone;
/**
* 部署模块,逗号分隔
*/
private String modelIds;
/**
* 政务风貌,多个逗号分割
*/
private String govAffairStyle;
/**
* 投诉电话
*/
private String complaintHotline;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SiteEntity) {
SiteEntity tmp = (SiteEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteName = "";
this.siteCode = "";
this.areaID = "";
this.areaCode = "";
this.areaName = "";
this.proCode = "";
this.cityCode = "";
this.districtCode = "";
this.siteIp = "127.0.0.1";
this.sitePort = "80";
this.longitude = "";
this.latitude = "";
this.siteTel = "13808095770";
this.detailAddress = "";
this.siteRemark = "";
this.amWorkStartTime = null;
this.amWorkEndTime = null;
this.pmWorkStartTime = null;
this.pmWorkEndTime = null;
this.workday1 = 1;
this.workday2 = 1;
this.workday3 = 1;
this.workday4 = 1;
this.workday5 = 1;
this.workday6 = 0;
this.workday7 = 0;
this.onlineTake = 1;
this.appointment = 1;
this.gowMap = 1;
this.level = 1;
this.building = 1;
this.logoPath = "";
this.englishName = "";
this.leadingOfficial = "张三";
this.leadingOfficialTelephone = "13808095770";
this.modelIds = "";
this.govAffairStyle = "";
this.complaintHotline = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model;
import com.mortals.xhx.module.site.model.vo.SiteMatterVo;
import lombok.Data;
/**
* 站点事项实体对象
*
* @author zxfei
* @date 2024-03-09
*/
@Data
public class SiteMatterEntity extends SiteMatterVo {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 事项ID
*/
private Long matterId;
/**
* 事项名称
*/
private String matterName;
/**
* 事项编码
*/
private String matterCode;
/**
* 部门ID
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 事项类型
*/
private String eventTypeShow;
/**
* 事项来源
*/
private Integer source;
/**
* 热门(0.否,1.是)
*/
private Integer hot;
/**
* 显示(0.否,1.是)
*/
private Integer display;
/**
* 部门编号
*/
private String deptCode;
/**
* 代办帮办(0.否,1.是)
*/
private Integer agent;
/**
* 代办姓名
*/
private String agentName;
/**
* 代办电话
*/
private String agentPhone;
/**
* 职务
*/
private String agentPost;
/**
* 大厅事项入驻(0.否,1.是)
*/
private Integer hallCheckIn;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SiteMatterEntity) {
SiteMatterEntity tmp = (SiteMatterEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = null;
this.siteName = "";
this.matterId = null;
this.matterName = "";
this.matterCode = "";
this.deptId = null;
this.deptName = "";
this.eventTypeShow = "";
this.source = 0;
this.hot = 0;
this.display = 1;
this.deptCode = "";
this.agent = 0;
this.agentName = "";
this.agentPhone = "";
this.agentPost = "";
this.hallCheckIn = 0;
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.mortals.xhx.module.area.model.AreaEntity;
import lombok.Data;
import org.springframework.util.ObjectUtils;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 区域前端映射树结构实体类
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteTreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 站点编码
*/
private String siteCode;
/**
* 站点详细地址
*/
private String detailAddress;
/**
* 节点名称
*/
private String label;
/**
* 区域编码
*/
private String areaCode;
/**
* 区域名称
*
*/
private String areaName;
/**
* 为区域时 层级
*/
private Integer level;
/**
* 是否叶子节点
*/
private Boolean isLeaf;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 节点类型
*/
private String type;
/**
* 图标
*/
private String icon;
/**
* 子节点
*/
private List<SiteTreeSelect> children;
public SiteTreeSelect() {
}
public SiteTreeSelect(AreaEntity entity) {
//如果是站点,则替换名称和id
this.id = entity.getIid();
this.label = entity.getName();
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
this.children = new ArrayList();
} else {
this.isLeaf = false;
}
this.areaCode = entity.getAreaCode();
this.type = "area";
this.icon = "el-icon-folder";
}
public SiteTreeSelect(AreaEntity entity, Map<String, SiteEntity> siteMap) {
List<SiteEntity> collect = siteMap.entrySet().stream().filter(f -> f.getKey().startsWith(entity.getAreaCode()))
.map(m -> m.getValue())
.collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
this.id = collect.stream().map(item -> item.getId().toString()).collect(Collectors.joining(","));
this.label = collect.stream().map(item -> item.getSiteName()).collect(Collectors.joining(","));
this.siteCode = collect.stream().map(item -> item.getSiteCode()).collect(Collectors.joining(","));
this.type = "site";
this.icon = "el-icon-wind-power";
this.detailAddress=collect.stream().map(item -> item.getDetailAddress()).collect(Collectors.joining(","));
this.areaCode=collect.stream().map(item -> item.getAreaCode()).collect(Collectors.joining(","));
this.areaName=collect.stream().map(item -> item.getAreaName()).collect(Collectors.joining(","));
this.longitude = collect.stream().map(item -> item.getLongitude()).collect(Collectors.joining(","));
this.latitude = collect.stream().map(item -> item.getLatitude()).collect(Collectors.joining(","));
} else {
this.id = entity.getIid();
this.label = entity.getName();
this.type = "area";
this.icon = "el-icon-place";
this.areaCode=entity.getAreaCode();
}
this.level=entity.getAreaLevel();
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
//this.children = new ArrayList();
} else {
this.isLeaf = false;
this.children = entity.getChildren().stream().map(item -> new SiteTreeSelect(item, siteMap)).collect(Collectors.toList());
}
this.areaCode = entity.getAreaCode();
}
// 反序列化器
public static class Deserializer implements ObjectDeserializer {
@Override
public SiteTreeSelect deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
SiteTreeSelect node = new SiteTreeSelect();
JSONObject jsonObject = parser.parseObject();
node.setId(jsonObject.getString("id"));
node.setSiteCode(jsonObject.getString("siteCode"));
node.setLabel(jsonObject.getString("label"));
node.setAreaCode(jsonObject.getString("areaCode"));
node.setAreaName(jsonObject.getString("areaName"));
node.setIsLeaf(jsonObject.getBoolean("isLeaf"));
node.setLongitude(jsonObject.getString("longitude"));
node.setLatitude(jsonObject.getString("latitude"));
node.setType(jsonObject.getString("type"));
node.setIcon(jsonObject.getString("icon"));
JSONArray jsonArray = jsonObject.getJSONArray("children");
List<SiteTreeSelect> children = new ArrayList<>();
if(!ObjectUtils.isEmpty(jsonArray)){
for (int i = 0; i < jsonArray.size(); i++) {
SiteTreeSelect child = JSON.parseObject(jsonArray.getJSONObject(i).toJSONString(), SiteTreeSelect.class);
children.add(child);
}
}
node.setChildren(children);
return node;
}
@Override
public int getFastMatchToken() {
return JSONToken.LBRACE;
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model.vo;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
/**
* 站点完整信息
*/
@Data
public class SitAllInfoVO extends SiteEntity {
}
package com.mortals.xhx.module.site.model.vo;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
import java.util.List;
/**
* 站点区域视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteAreaVo {
private String areaName;
private String areaCode;
private List<SiteEntity> siteList;
}
\ No newline at end of file
package com.mortals.xhx.module.site.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.List;
/**
* 站点事项视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteMatterVo extends BaseEntityLong {
/**
* 所属部门
*/
private String belongDept;
/**
* 窗口到现场次数
*/
private Integer windowToTheSceneNum;
/**
* 网办到现场次数
*/
private Integer onlineToTheSceneNum;
/**
* 区域编码
*/
private String areaCode;
/** 事项类型排除列表 */
private List <String> eventTypeShowNotList;
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.site.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 站点视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteVo extends BaseEntityLong {
private List<Long> idList;
private String logoFullPath;
private Integer areaLevel;
private List<Integer> areaLevelList;
private Integer total = 0;
private List<SiteEntity> subList = new ArrayList<>();
private List<String> modelData;
private Long copySiteId;
private Long targetSiteId;
}
\ No newline at end of file
package com.mortals.xhx.module.site.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
/**
* SiteMatterService
* <p>
* 站点事项 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteMatterService extends ICRUDService<SiteMatterEntity, Long> {
SiteMatterDao getDao();
}
\ No newline at end of file
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.service.ICRUDCacheService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.model.vo.SiteAreaVo;
import java.util.List;
import java.util.Map;
/**
* SiteService
* <p>
* 站点 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
SiteDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.site.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.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* SiteMatterService
* 站点事项 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("siteMatterService")
@Slf4j
public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao, SiteMatterEntity, Long> implements SiteMatterService {
@Autowired
private MatterService matterService;
@Autowired
private SiteService siteService;
@Override
protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException {
if (!ObjectUtils.isEmpty(list)) {
List<Long> matterIdlist = list.stream().map(item -> item.getMatterId()).collect(Collectors.toList());
Map<Long, MatterEntity> matterEntityMap = matterService.find(new MatterQuery().idList(matterIdlist)).parallelStream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
list.forEach(item -> {
if (!ObjectUtils.isEmpty(item.getMatterId())) {
MatterEntity matterEntity = matterEntityMap.get(item.getMatterId());
if (!ObjectUtils.isEmpty(matterEntity)) {
item.setBelongDept(matterEntity.getBelongDept());
item.setWindowToTheSceneNum(matterEntity.getWindowToTheSceneNum());
item.setOnlineToTheSceneNum(matterEntity.getOnlineToTheSceneNum());
item.setDeptCode(matterEntity.getDeptCode());
item.setAreaCode(matterEntity.getAreaCode());
}
}
});
}
super.findAfter(params, pageInfo, context, list);
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void updateBefore(SiteMatterEntity entity, Context context) throws AppException {
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void saveBefore(SiteMatterEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.mortals.framework.ap.GlobalSysInfo;
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.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.AreaLevelEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.utils.AreaMatchCodeUtil;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.model.vo.SiteAreaVo;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_HTTP_URL;
import static com.mortals.xhx.common.key.Constant.USER_SITE_TREE;
/**
* SiteService
* 站点 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("siteService")
@Slf4j
public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteEntity, Long> implements SiteService {
// private List<SiteTreeSelect> siteTreeList;
/**
* 根据用户id 暂存对应站点树 默认0为全站点树
*/
private Map<Long, List<SiteTreeSelect>> siteTreeMap = new HashMap<>();
@Autowired
@Lazy
private AreaService areaService;
@Autowired
@Lazy
private IUserFeign userFeign;
@Autowired
@Lazy
private UserService userService;
@Autowired
private DeptService deptService;
@Autowired
private MatterService matterService;
@Autowired
private SiteMatterService siteMatterService;
private volatile Boolean refresh = false;
@Override
protected String getExtKey(SiteEntity data) {
return data.getSiteCode();
}
@Override
protected void updateBefore(SiteEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
}
@Override
protected void saveBefore(SiteEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
}
@Override
protected void saveAfter(SiteEntity entity, Context context) throws AppException {
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(SiteEntity entity, Context context) throws AppException {
}
public static void main(String[] args) {
String matchCode = "511530000000".replaceAll("(0)+$", "");
System.out.println(matchCode);
matchCode = StrUtil.padAfter(matchCode, 7, "0");
System.out.println(matchCode);
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 站点
*
* @author zxfei
* @date 2022-01-20
*/
@RestController
@RequestMapping("site")
@Slf4j
public class SiteController extends BaseCRUDJsonBodyMappingController<SiteService, SiteEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private ICacheService cacheService;
@Autowired
private SiteService siteService;
@Autowired
private AreaService areaService;
@Autowired
@Lazy
private IUserFeign userFeign;
public SiteController() {
super.setModuleDesc("站点");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("Site", "haveSonArea"));
this.addDict(model, "workday1", paramService.getParamBySecondOrganize("Site", "workday1"));
this.addDict(model, "workday2", paramService.getParamBySecondOrganize("Site", "workday2"));
this.addDict(model, "workday3", paramService.getParamBySecondOrganize("Site", "workday3"));
this.addDict(model, "workday4", paramService.getParamBySecondOrganize("Site", "workday4"));
this.addDict(model, "workday5", paramService.getParamBySecondOrganize("Site", "workday5"));
this.addDict(model, "workday6", paramService.getParamBySecondOrganize("Site", "workday6"));
this.addDict(model, "workday7", paramService.getParamBySecondOrganize("Site", "workday7"));
this.addDict(model, "level", paramService.getParamBySecondOrganize("Site", "level"));
this.addDict(model, "building", paramService.getParamBySecondOrganize("Site", "building"));
this.addDict(model, "isSite", paramService.getParamBySecondOrganize("Site", "isSite"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Site", "status"));
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 站点事项
*
* @author zxfei
* @date 2022-01-20
*/
@RestController
@RequestMapping("site/matter")
public class SiteMatterController extends BaseCRUDJsonBodyMappingController<SiteMatterService, SiteMatterEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private DeptService deptService;
@Autowired
private SiteService siteService;
@Autowired
private SiteMatterService siteMatterService;
public SiteMatterController() {
super.setModuleDesc("站点事项");
}
/**
* @param query
* @param model
* @param context
* @throws AppException
*/
@Override
protected void doListBefore(SiteMatterEntity query, Map<String, Object> model, Context context) throws AppException {
super.doListBefore(query, model, context);
query.setOrderColList(Arrays.asList(new OrderCol("hot", OrderCol.DESCENDING)));
if (ObjectUtils.isEmpty(query.getEventTypeShowNotList())) {
query.setEventTypeShowNotList(Arrays.asList("行政处罚"));
}
}
/**
* @param list
* @param model
* @param context
* @return
* @throws AppException
*/
@Override
protected int batchSaveAfter(List<SiteMatterEntity> list, Map<String, Object> model, Context context) throws AppException {
//统计部门入驻数量
Runnable runnable = new Runnable() {
/**
*
*/
@Override
public void run() {
List<SiteEntity> siteEntities = siteService.find(new SiteQuery());
for (SiteEntity siteEntity : siteEntities) {
DeptQuery query = new DeptQuery();
query.setSiteId(siteEntity.getId());
List<DeptEntity> deptEntities = deptService.find(query);
for (DeptEntity deptEntity : deptEntities) {
DeptEntity deptQuery = new DeptEntity();
deptQuery.setUpdateTime(new Date());
//统计入驻事项
SiteMatterQuery siteMatterQuery = new SiteMatterQuery();
siteMatterQuery.setDeptCode(deptEntity.getDeptNumber());
siteMatterQuery.setSource(SourceEnum.政务网.getValue());
siteMatterQuery.setHallCheckIn(YesNoEnum.YES.getValue());
int incount = siteMatterService.count(siteMatterQuery, null);
deptQuery.setInNum(incount);
DeptEntity condition = new DeptEntity();
condition.setId(deptEntity.getId());
deptService.getDao().update(deptQuery, condition);
}
}
}
};
ThreadPool.getInstance().execute(runnable);
return super.batchSaveAfter(list, model, context);
}
}
\ 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.dept.dao.ibatis.DeptDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="com.mortals.xhx.module.dept.model.vo.DeptVo" id="DeptVo-Map">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="deptNumber" column="deptNumber"/>
<result property="windowId" column="windowId"/>
<result property="windowName" column="windowName"/>
<result property="siteBusinessId" column="siteBusinessId"/>
<result property="businessName" column="businessName"/>
</resultMap>
<!-- 根据业务ids获取部门列表 -->
<select id="getDeptListByBusiness" parameterType="paramDto" resultMap="DeptVo-Map">
SELECT
d.id,d.`name`,d.deptNumber,wb.siteBusinessId,wb.businessName,w.id as windowId,w.`name` as windowName
FROM
mortals_sys_dept d
LEFT JOIN mortals_sys_window w ON d.id = w.deptId
LEFT JOIN mortals_sys_window_business wb ON w.id = wb.windowId
<trim suffixOverrides="where" suffix="">
where wb.windowId is NOT null and
<trim prefixOverrides="and" prefix="">
<if test="condition.containsKey('siteBusinessIdList')">
siteBusinessId in
<foreach collection="condition.siteBusinessIdList" open="(" close=")" index="index"
item="item" separator=",">
#{item}
</foreach>
</if>
</trim>
</trim>
</select>
<!-- 根据部门ids获取业务部门列表 -->
<select id="getBusinessByDept" parameterType="paramDto" resultMap="DeptVo-Map">
SELECT
d.id,d.`name`,d.deptNumber,wb.siteBusinessId,wb.businessName,w.id as windowId,w.`name` as windowName
FROM
mortals_sys_dept d
LEFT JOIN mortals_sys_window w ON d.id = w.deptId
LEFT JOIN mortals_sys_window_business wb ON w.id = wb.windowId
<trim suffixOverrides="where" suffix="">
where wb.windowId is NOT null and
<trim prefixOverrides="and" prefix="">
<if test="condition.containsKey('idList')">
d.id in
<foreach collection="condition.idList" open="(" close=")" index="index"
item="item" separator=",">
#{item}
</foreach>
</if>
</trim>
</trim>
</select>
<!-- 获取所有存在业务的部门列表 -->
<select id="getDeptListByExistBusiness" parameterType="paramDto" resultMap="DeptEntity-Map">
SELECT DISTINCT
<include refid="_columns"/>
FROM
mortals_sys_dept a,
mortals_sys_window t1,
mortals_sys_window_business t2
WHERE
a.id = t1.deptId
AND t1.id = t2.windowId and
<trim prefixOverrides="and" prefix="">
<if test="condition.siteId!=null">
a.siteId = #{condition.siteId}
</if>
</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