diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/controller/SystemFoundationSettingsController.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/controller/SystemFoundationSettingsController.java index 2df1a6bb..ec7bd279 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/controller/SystemFoundationSettingsController.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/controller/SystemFoundationSettingsController.java @@ -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); } } diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/dao/SystemFoundationSettingsDao.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/dao/SystemFoundationSettingsDao.java index d7c06318..4b0e7e1e 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/dao/SystemFoundationSettingsDao.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/dao/SystemFoundationSettingsDao.java @@ -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 { - Map querySystemFoundationSettingsList(); - - int insertSystemFoundationSettings(Map map); - - int editSystemFoundationSettings(Map map); - } diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/entity/SystemFoundationSettings.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/entity/SystemFoundationSettings.java index 36e458d1..aed690d8 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/entity/SystemFoundationSettings.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/entity/SystemFoundationSettings.java @@ -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> holidaysTypeJson; @TableField(value = "year_holidays_mation", typeHandler = JacksonTypeHandler.class) - @ApiModelProperty(value = "年假信息") + @ApiModelProperty(value = "年假信息", required = "required,json") private List> yearHolidaysMation; @TableField(value = "abnormal_mation", typeHandler = JacksonTypeHandler.class) - @ApiModelProperty(value = "异常考勤制度管理信息") + @ApiModelProperty(value = "异常考勤制度管理信息", required = "required,json") private List> abnormalMation; @TableField(value = "sys_order_basic_design", typeHandler = JacksonTypeHandler.class) - @ApiModelProperty(value = "系统单据是否需要审核的设置") + @ApiModelProperty(value = "系统单据是否需要审核的设置", required = "required,json") private List> sysOrderBasicDesign; } diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/SystemFoundationSettingsService.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/SystemFoundationSettingsService.java index c1c60bc7..5e28f5ba 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/SystemFoundationSettingsService.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/SystemFoundationSettingsService.java @@ -21,27 +21,6 @@ import java.util.Map; */ public interface SystemFoundationSettingsService extends SkyeyeBusinessService { - /** - * 查询系统基础信息 - * - * @param inputObject 入参以及用户信息等获取对象 - * @param outputObject 出参以及提示信息的返回值对象 - */ void querySystemFoundationSettingsList(InputObject inputObject, OutputObject outputObject); - /** - * 修改系统配置信息 - * - * @param inputObject 入参以及用户信息等获取对象 - * @param outputObject 出参以及提示信息的返回值对象 - */ - void editSystemFoundationSettings(InputObject inputObject, OutputObject outputObject); - - /** - * 获取系统配置信息 - * - * @return 系统配置信息 - */ - Map getSystemFoundationSettings(); - } diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SystemFoundationSettingsServiceImpl.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SystemFoundationSettingsServiceImpl.java index ee7d71e3..fe915215 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SystemFoundationSettingsServiceImpl.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SystemFoundationSettingsServiceImpl.java @@ -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 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 bean = this.getSystemFoundationSettings(); - outputObject.setBean(bean); + QueryWrapper 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 map = inputObject.getParams(); - systemFoundationSettingsDao.editSystemFoundationSettings(map); - } - - /** - * 获取系统配置信息 - * - * @return 系统配置信息 - */ - @Override - public Map getSystemFoundationSettings() { - Map 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 getBaseSettings() { - Map 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 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<>()); - } - } - } diff --git a/skyeye-promote/skyeye-common/src/main/resources/mapper/common/SystemFoundationSettingsMapper.xml b/skyeye-promote/skyeye-common/src/main/resources/mapper/common/SystemFoundationSettingsMapper.xml deleted file mode 100644 index c9e269cc..00000000 --- a/skyeye-promote/skyeye-common/src/main/resources/mapper/common/SystemFoundationSettingsMapper.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - 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}) - - - - - - update system_foundation_settings - - 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} - - - - \ No newline at end of file diff --git a/skyeye-promote/skyeye-common/src/main/resources/reqmapping/mapping/common.xml b/skyeye-promote/skyeye-common/src/main/resources/reqmapping/mapping/common.xml index 3856a638..309098e1 100644 --- a/skyeye-promote/skyeye-common/src/main/resources/reqmapping/mapping/common.xml +++ b/skyeye-promote/skyeye-common/src/main/resources/reqmapping/mapping/common.xml @@ -4,22 +4,6 @@ - allUse 是否需要登录才能使用 1是 0否 2需要登陆才能访问,但无需授权 默认为否 --> - - - - - - - - - - - - - - - -