feat: 系统基础设置修改为低代码

This commit is contained in:
weizhiqiang 2024-10-04 10:09:30 +08:00
parent adc03261d4
commit 9ef80c28ba
7 changed files with 24 additions and 213 deletions

View file

@ -5,9 +5,11 @@
package com.skyeye.eve.controller;
import com.skyeye.annotation.api.Api;
import com.skyeye.annotation.api.ApiImplicitParams;
import com.skyeye.annotation.api.ApiOperation;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.eve.entity.SystemFoundationSettings;
import com.skyeye.eve.service.SystemFoundationSettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -28,27 +30,17 @@ public class SystemFoundationSettingsController {
@Autowired
private SystemFoundationSettingsService systemFoundationSettingsService;
/**
* 获取系统基础设置
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "sysfdsettings001", value = "获取系统基础设置", method = "GET", allUse = "2")
@RequestMapping("/post/SystemFoundationSettingsController/querySystemFoundationSettingsList")
public void querySystemFoundationSettingsList(InputObject inputObject, OutputObject outputObject) {
systemFoundationSettingsService.querySystemFoundationSettingsList(inputObject, outputObject);
}
/**
* 编辑系统基础设置
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "sysfdsettings002", value = "编辑系统基础设置", method = "PUT", allUse = "1")
@ApiImplicitParams(classBean = SystemFoundationSettings.class)
@RequestMapping("/post/SystemFoundationSettingsController/editSystemFoundationSettings")
public void editSystemFoundationSettings(InputObject inputObject, OutputObject outputObject) {
systemFoundationSettingsService.editSystemFoundationSettings(inputObject, outputObject);
systemFoundationSettingsService.updateEntity(inputObject, outputObject);
}
}

View file

@ -6,8 +6,6 @@ package com.skyeye.eve.dao;
import com.skyeye.eve.entity.SystemFoundationSettings;
import java.util.Map;
/**
* @ClassName: SystemFoundationSettingsDao
* @Description: 系统基础设置数据交互类
@ -18,10 +16,4 @@ import java.util.Map;
*/
public interface SystemFoundationSettingsDao extends SkyeyeBaseMapper<SystemFoundationSettings> {
Map<String, Object> querySystemFoundationSettingsList();
int insertSystemFoundationSettings(Map<String, Object> map);
int editSystemFoundationSettings(Map<String, Object> map);
}

View file

@ -37,47 +37,47 @@ public class SystemFoundationSettings extends CommonInfo {
private String id;
@TableField("email_type")
@ApiModelProperty(value = "邮箱类型")
@ApiModelProperty(value = "邮箱类型", required = "required")
private String emailType;
@TableField("email_receipt_server")
@ApiModelProperty(value = "收件服务器")
@ApiModelProperty(value = "收件服务器", required = "required")
private String emailReceiptServer;
@TableField("email_receipt_server_port")
@ApiModelProperty(value = "收件服务器ssl端口")
@ApiModelProperty(value = "收件服务器ssl端口", required = "required")
private String emailReceiptServerPort;
@TableField("email_send_server")
@ApiModelProperty(value = "发件服务器")
@ApiModelProperty(value = "发件服务器", required = "required")
private String emailSendServer;
@TableField("email_send_server_port")
@ApiModelProperty(value = "发件服务器ssl端口")
@ApiModelProperty(value = "发件服务器ssl端口", required = "required")
private String emailSendServerPort;
@TableField("no_documentary_day_num")
@ApiModelProperty(value = "未跟单天数N天未跟单自动进入公海")
@ApiModelProperty(value = "未跟单天数N天未跟单自动进入公海", required = "num")
private Integer noDocumentaryDayNum;
@TableField("no_charge_id")
@ApiModelProperty(value = "未指定负责人,未指定责任人自动进入公海")
@ApiModelProperty(value = "未指定负责人,未指定责任人自动进入公海", required = "num")
private Integer noChargeId;
@TableField(value = "holidays_type_json", typeHandler = JacksonTypeHandler.class)
@ApiModelProperty(value = "企业假期类型以及扣薪信息")
@ApiModelProperty(value = "企业假期类型以及扣薪信息", required = "required,json")
private List<Map<String, Object>> holidaysTypeJson;
@TableField(value = "year_holidays_mation", typeHandler = JacksonTypeHandler.class)
@ApiModelProperty(value = "年假信息")
@ApiModelProperty(value = "年假信息", required = "required,json")
private List<Map<String, Object>> yearHolidaysMation;
@TableField(value = "abnormal_mation", typeHandler = JacksonTypeHandler.class)
@ApiModelProperty(value = "异常考勤制度管理信息")
@ApiModelProperty(value = "异常考勤制度管理信息", required = "required,json")
private List<Map<String, Object>> abnormalMation;
@TableField(value = "sys_order_basic_design", typeHandler = JacksonTypeHandler.class)
@ApiModelProperty(value = "系统单据是否需要审核的设置")
@ApiModelProperty(value = "系统单据是否需要审核的设置", required = "required,json")
private List<Map<String, Object>> sysOrderBasicDesign;
}

View file

@ -21,27 +21,6 @@ import java.util.Map;
*/
public interface SystemFoundationSettingsService extends SkyeyeBusinessService<SystemFoundationSettings> {
/**
* 查询系统基础信息
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
void querySystemFoundationSettingsList(InputObject inputObject, OutputObject outputObject);
/**
* 修改系统配置信息
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
void editSystemFoundationSettings(InputObject inputObject, OutputObject outputObject);
/**
* 获取系统配置信息
*
* @return 系统配置信息
*/
Map<String, Object> getSystemFoundationSettings();
}

View file

@ -4,27 +4,17 @@
package com.skyeye.eve.service.impl;
import cn.hutool.json.JSONUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skyeye.annotation.service.SkyeyeService;
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
import com.skyeye.common.constans.CommonNumConstants;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.MapUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.SystemFoundationSettingsDao;
import com.skyeye.eve.entity.SystemFoundationSettings;
import com.skyeye.eve.service.SystemFoundationSettingsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: SystemFoundationSettingsServiceImpl
@ -38,92 +28,15 @@ import java.util.Map;
@SkyeyeService(name = "系统基础设置", groupName = "系统基础设置")
public class SystemFoundationSettingsServiceImpl extends SkyeyeBusinessServiceImpl<SystemFoundationSettingsDao, SystemFoundationSettings> implements SystemFoundationSettingsService {
private static final Logger LOGGER = LoggerFactory.getLogger(SystemFoundationSettingsServiceImpl.class);
@Autowired
private SystemFoundationSettingsDao systemFoundationSettingsDao;
/**
* 获取系统基础设置
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@Override
public void querySystemFoundationSettingsList(InputObject inputObject, OutputObject outputObject) {
Map<String, Object> bean = this.getSystemFoundationSettings();
outputObject.setBean(bean);
QueryWrapper<SystemFoundationSettings> queryWrapper = new QueryWrapper<>();
SystemFoundationSettings systemFoundationSettings = getOne(queryWrapper, false);
if (ObjectUtil.isEmpty(systemFoundationSettings)) {
throw new RuntimeException("系统基础设置不存在,请先添加!");
}
outputObject.setBean(systemFoundationSettings);
outputObject.settotal(CommonNumConstants.NUM_ONE);
}
/**
* 编辑系统基础设置
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@Override
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void editSystemFoundationSettings(InputObject inputObject, OutputObject outputObject) {
Map<String, Object> map = inputObject.getParams();
systemFoundationSettingsDao.editSystemFoundationSettings(map);
}
/**
* 获取系统配置信息
*
* @return 系统配置信息
*/
@Override
public Map<String, Object> getSystemFoundationSettings() {
Map<String, Object> map = systemFoundationSettingsDao.querySystemFoundationSettingsList();
if (CollectionUtils.isEmpty(map)) {
map = getBaseSettings();
systemFoundationSettingsDao.insertSystemFoundationSettings(map);
}
judgeAndInitDefault(map);
LOGGER.info("email server mation is: {}.", JSONUtil.toJsonStr(map));
return map;
}
private Map<String, Object> getBaseSettings() {
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("emailType", "imap");
bean.put("emailReceiptServer", "imap.qq.com");
bean.put("emailReceiptServerPort", "995");
bean.put("emailSendServer", "smtp.qq.com");
bean.put("emailSendServerPort", "25");
bean.put("noDocumentaryDayNum", "30");
bean.put("noChargeId", "2");
bean.put("holidaysTypeJson", new ArrayList<>());
bean.put("yearHolidaysMation", new ArrayList<>());
bean.put("abnormalMation", new ArrayList<>());
return bean;
}
/**
* 为其中的一些字段设置默认值
*
* @param map
*/
private void judgeAndInitDefault(Map<String, Object> map) {
// 企业假期类型以及扣薪信息
if (MapUtil.checkKeyIsNull(map, "holidaysTypeJson")) {
map.put("holidaysTypeJson", new ArrayList<>());
}
// 年假信息
if (MapUtil.checkKeyIsNull(map, "yearHolidaysMation")) {
map.put("yearHolidaysMation", new ArrayList<>());
}
// 异常考勤制度管理信息
if (MapUtil.checkKeyIsNull(map, "abnormalMation")) {
map.put("abnormalMation", new ArrayList<>());
}
// 系统单据审核的一些设置
if (MapUtil.checkKeyIsNull(map, "sysOrderBasicDesign")) {
map.put("sysOrderBasicDesign", new ArrayList<>());
}
}
}

View file

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.eve.dao.SystemFoundationSettingsDao">
<insert id="insertSystemFoundationSettings" parameterType="java.util.Map">
INSERT into system_foundation_settings
(id, email_type, email_receipt_server, email_receipt_server_port, email_send_server, email_send_server_port,
no_documentary_day_num, no_charge_id, holidays_type_json, year_holidays_mation, abnormal_mation, sys_order_basic_design)
VALUES
(#{id}, #{emailType}, #{emailReceiptServer}, #{emailReceiptServerPort}, #{emailSendServer}, #{emailSendServerPort},
#{noDocumentaryDayNum}, #{noChargeId}, #{holidaysTypeJson}, #{yearHolidaysMation}, #{abnormalMation}, #{sysOrderBasicDesign})
</insert>
<select id="querySystemFoundationSettingsList" resultType="java.util.Map">
SELECT
id,
email_type emailType,
email_receipt_server emailReceiptServer,
email_receipt_server_port emailReceiptServerPort,
email_send_server emailSendServer,
email_send_server_port emailSendServerPort,
no_documentary_day_num noDocumentaryDayNum,
no_charge_id noChargeId,
holidays_type_json holidaysTypeJson,
year_holidays_mation yearHolidaysMation,
abnormal_mation abnormalMation,
sys_order_basic_design sysOrderBasicDesign
FROM
system_foundation_settings
</select>
<update id="editSystemFoundationSettings" parameterType="java.util.Map">
update system_foundation_settings
<set>
email_type = #{emailType},
email_receipt_server = #{emailReceiptServer},
email_receipt_server_port = #{emailReceiptServerPort},
email_send_server = #{emailSendServer},
email_send_server_port = #{emailSendServerPort},
no_documentary_day_num = #{noDocumentaryDayNum},
no_charge_id = #{noChargeId},
holidays_type_json = #{holidaysTypeJson},
year_holidays_mation = #{yearHolidaysMation},
abnormal_mation = #{abnormalMation},
sys_order_basic_design = #{sysOrderBasicDesign}
</set>
</update>
</mapper>

View file

@ -4,22 +4,6 @@
- allUse 是否需要登录才能使用 1是 0否 2需要登陆才能访问但无需授权 默认为否
-->
<!-- 系统基础设置开始 -->
<url id="sysfdsettings002" path="/post/SystemFoundationSettingsController/editSystemFoundationSettings" val="编辑" allUse="1" method="PUT" groupName="系统基础设置">
<property id="emailType" name="emailType" ref="required" var="邮箱类型"/>
<property id="emailReceiptServer" name="emailReceiptServer" ref="required" var="收件服务器"/>
<property id="emailReceiptServerPort" name="emailReceiptServerPort" ref="required" var="收件服务器ssl端口"/>
<property id="emailSendServer" name="emailSendServer" ref="required" var="发件服务器"/>
<property id="emailSendServerPort" name="emailSendServerPort" ref="required" var="发件服务器ssl端口"/>
<property id="noDocumentaryDayNum" name="noDocumentaryDayNum" ref="num" var="未跟单天数N天未跟单自动进入公海"/>
<property id="noChargeId" name="noChargeId" ref="num" var="未指定负责人,未指定责任人自动进入公海"/>
<property id="holidaysTypeJson" name="holidaysTypeJson" ref="required,json" var="企业假期类型以及扣薪信息"/>
<property id="yearHolidaysMation" name="yearHolidaysMation" ref="required,json" var="年假信息"/>
<property id="abnormalMation" name="abnormalMation" ref="required,json" var="异常考勤制度管理信息"/>
<property id="sysOrderBasicDesign" name="sysOrderBasicDesign" ref="required,json" var="系统单据审核的一些设置"/>
</url>
<!-- 系统基础设置结束 -->
<!-- 系统模板分类开始 -->
<url id="sysevemodeltype001" path="/post/SysEveModelTypeController/querySysEveModelTypeList" method="POST" val="获取系统模板分类列表" allUse="1" groupName="系统模板分类">
<property id="typeName" name="typeName" ref="" var="分类名称"/>