| | |
| | | <groupId>com.fasterxml.jackson.module</groupId> |
| | | <artifactId>jackson-module-kotlin</artifactId> |
| | | </dependency> |
| | | <!--å½å¯ç®æ³å å¯--> |
| | | <dependency> |
| | | <groupId>org.bouncycastle</groupId> |
| | | <artifactId>bcprov-jdk15to18</artifactId> |
| | | <version>1.64</version> |
| | | </dependency> |
| | | <!--æ¥å¿ç³»ç»--> |
| | | <dependency> |
| | | <groupId>org.graylog2</groupId> |
| | | <artifactId>syslog4j</artifactId> |
| | | <version>0.9.60</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //ç»å½äºç»´ç |
| | | filterChainDefinitionMap.put("/sys/getQrcodeToken/**", "anon"); //ç嬿«ç |
| | | filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //æææ¥å£æé¤ |
| | | filterChainDefinitionMap.put("/sys/api/appAuth", "anon"); //ç½é¸è®¤è¯æ¥å£æé¤ |
| | | filterChainDefinitionMap.put("/sys/api/fileUpload", "anon"); //ç½é¸ä¸ä¼ æä»¶æ¥å£æé¤ |
| | | |
| | | |
| | | filterChainDefinitionMap.put("/", "anon"); |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; |
| | | import org.jeecg.modules.mdc.entity.MdcNoplanClose; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentWorkLineService; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; |
| | |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/exportLogXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { |
| | | return equipmentRunningSectionService.exportXls(equipmentRunningSectionVo); |
| | | } |
| | | |
| | | @ApiOperation(value = "è®¾å¤æ¥å¿-å岿¥è¯¢", notes = "è®¾å¤æ¥å¿-å岿¥è¯¢") |
| | | @GetMapping("/logCharts") |
| | | public Result<List<Map<String, Object>>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo){ |
| | |
| | | package org.jeecg.modules.mdc.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | /*åºå·*/ |
| | | private String id; |
| | | |
| | | /*ç¶æ,0:å
³æº,1:弿º,2:å¾
æº,3:å·¥ä½,22:æ¥è¦*/ |
| | | @Excel(name = "ç¶æ", width = 15, replace={"å
³æº_0","弿º_1","å¾
æº_2","å·¥ä½_3","æ¥è¦_22"}) |
| | | private Integer status; |
| | | |
| | | /*å¼å§æ¶é´*/ |
| | | @Excel(name = "å¼å§æ¶é´", width = 24, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | private Date startTime; |
| | | |
| | | /*ç»ææ¶é´*/ |
| | | @Excel(name = "ç»ææ¶é´", width = 24, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date endTime; |
| | | |
| | | /*æç»æ¶é´*/ |
| | | @Excel(name = "æç»æ¶é´", width = 24, exportConvert = true) |
| | | private Long duration; |
| | | |
| | | //ç¨åºå· |
| | | @Excel(name = "ç¨åºå·", width = 20) |
| | | private String sequenceNumber; |
| | | |
| | | /*设å¤*/ |
| | | private String equipmentId; |
| | | /*å¼å§æ¶é´*/ |
| | | private Date startTime; |
| | | /*ç»ææ¶é´*/ |
| | | private Date endTime; |
| | | /*æ¶é¿*/ |
| | | private Long duration; |
| | | /*ç¶æ,0:å
³æº,1:弿º,2:å¾
æº,3:å·¥ä½,22:æ¥è¦*/ |
| | | private Integer status; |
| | | |
| | | /*æ¥è¦*/ |
| | | private String alarm; |
| | | /*ä¼ªå æ¥è¦å
容*/ |
| | | private String alarmContent; |
| | | //ç¨åºå· |
| | | private String sequenceNumber; |
| | | |
| | | public String convertgetDuration(){ |
| | | return DateUtils.secondsToTime(this.duration.intValue()); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/18 14:19 |
| | | */ |
| | | @Data |
| | | @TableName("log_table") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "log_table对象", description = "sqlè®°å½è¡¨") |
| | | public class LogTable implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 953864495681756550L; |
| | | |
| | | /** |
| | | * æä½ç±»åï¼INSERT / UPDATE / DELETEï¼ |
| | | */ |
| | | private String action; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * sqlè®°å½ |
| | | */ |
| | | private String sqlLog; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.mdc.service.ILogTableService; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecg.modules.quartz.entity.SysQuartzLog; |
| | | import org.jeecg.modules.quartz.service.IQuartzJobService; |
| | | import org.jeecg.modules.quartz.service.ISysQuartzLogService; |
| | | import org.jeecg.modules.system.service.ISysAnnouncementService; |
| | | import org.quartz.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 导åºsqlè®°å½å°xmlæä»¶ä»»å¡ |
| | | * @author Lius |
| | | * @date 2024/12/18 14:53 |
| | | */ |
| | | @PersistJobDataAfterExecution |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class ExportToXmlJob implements Job { |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private ILogTableService logTableService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | | SysQuartzLog quartzLog = new SysQuartzLog(); |
| | | quartzLog.setCreateTime(new Date()); |
| | | List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | log.info("宿¶å¯¼åºåæ¥æ°æ®è¡¨sqlä»»å¡ ExportToXmlJob start! æ¶é´:" + DateUtils.now()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | logTableService.exportDataToXml(); |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("宿¶å¯¼åºåæ¥æ°æ®è¡¨sqlä»»å¡", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.mdc.service.ILogTableService; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecg.modules.quartz.entity.SysQuartzLog; |
| | | import org.jeecg.modules.quartz.service.IQuartzJobService; |
| | | import org.jeecg.modules.quartz.service.ISysQuartzLogService; |
| | | import org.jeecg.modules.system.service.ISysAnnouncementService; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/19 16:43 |
| | | */ |
| | | @Slf4j |
| | | public class ImportXmlToDataJob implements Job { |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private ILogTableService logTableService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | | SysQuartzLog quartzLog = new SysQuartzLog(); |
| | | quartzLog.setCreateTime(new Date()); |
| | | List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | log.info("宿¶å¯¼å
¥sqlæ°æ®ä»»å¡ ImportXmlToDataJob start! æ¶é´:" + DateUtils.now()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | logTableService.importXmlToData(); |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("宿¶å¯¼å
¥sqlæ°æ®ä»»å¡", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | } |
| | |
| | | if (StringUtils.isNotBlank(tableName)) { |
| | | String backupTableName = equipmentService.checkTableExists(equipment.getSavetablename() + "_backup"); |
| | | if (StringUtils.isNotBlank(backupTableName)) { |
| | | Integer num = equipmentService.checkTableDataNum(equipment.getSavetablename(), day); |
| | | if (num > 0) { |
| | | equipmentService.insertTableData(backupTableName, tableName, day); |
| | | equipmentService.deleteTableData(tableName, day); |
| | | } |
| | | } else { |
| | | //å¤ä»½è¡¨ä¸åå¨å建å¤ä»½è¡¨å¹¶è¿ç§»æ°æ® |
| | | equipmentService.insertNoTableData(tableName + "_backup", tableName, day); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.entity.LogTable; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/18 14:24 |
| | | */ |
| | | public interface LogTableMapper extends BaseMapper<LogTable> { |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | MdcEquipmentStatisticalInfo findMdcEquipmentStatisticalInfo(@Param("equipmentId") String equipmentId, @Param("data") String data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="org.jeecg.modules.mdc.mapper.LogTableMapper"> |
| | | |
| | | </mapper> |
| | |
| | | mdc_equipment_running_section |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND status <![CDATA[ <> ]]> '22' |
| | | AND (start_long <= #{ endLong } AND end_long >= #{ startLong }) |
| | | ORDER BY |
| | | start_time |
| | |
| | | <select id="selectProcessLong" resultType="java.lang.Integer"> |
| | | SELECT TOP 1 process_long FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate} |
| | | </select> |
| | | |
| | | <select id="findMdcEquipmentStatisticalInfo" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> |
| | | SELECT TOP 1 * FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date = #{data} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.LogTable; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/18 14:29 |
| | | */ |
| | | public interface ILogTableService extends IService<LogTable> { |
| | | |
| | | /** |
| | | * 导åºåæ¥æ°æ®è¡¨sqlå°xmlæä»¶ä¸ä¼ å°ç½é¸æå¡å¨ |
| | | */ |
| | | void exportDataToXml(); |
| | | |
| | | /** |
| | | * 导å
¥åæ¥æ°æ®sqlæ§è¡å°æ°æ®åº |
| | | */ |
| | | void importXmlToData(); |
| | | |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; |
| | | import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | List<Integer> getDataList(String equipmentId, Date date); |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | */ |
| | | ModelAndView exportXls(MdcEquipmentRunningSectionVo equipmentRunningSectionVo); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Integer selectProcessLong(String equipmentId, String validDate); |
| | | |
| | | /** |
| | | * æ ¹æ®è®¾å¤ç¼å·åæ¥ææ¥è¯¢è¿è¡æ°æ® |
| | | * |
| | | * @param equipmentId |
| | | * @param date |
| | | * @return |
| | | */ |
| | | MdcEquipmentStatisticalInfo findMdcEquipmentStatisticalInfo(String equipmentId, String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.core.io.file.FileReader; |
| | | import cn.hutool.core.io.file.FileWriter; |
| | | import cn.hutool.core.net.NetUtil; |
| | | import cn.hutool.crypto.SmUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import me.zhyd.oauth.log.Log; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.modules.mdc.util.SqlExecutor; |
| | | import org.jeecg.modules.system.vo.SysLogTypeObjectDto; |
| | | import org.jeecg.modules.mdc.entity.LogTable; |
| | | import org.jeecg.modules.system.entity.MdcPassLog; |
| | | import org.jeecg.modules.mdc.mapper.LogTableMapper; |
| | | import org.jeecg.modules.mdc.service.ILogTableService; |
| | | import org.jeecg.modules.system.service.IMdcPassLogService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.FileClient; |
| | | import org.jeecg.modules.system.util.FileUtils; |
| | | import org.jeecg.modules.mdc.util.SyslogClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.net.InetAddress; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/18 14:29 |
| | | */ |
| | | @Service |
| | | public class LogTableServiceImpl extends ServiceImpl<LogTableMapper, LogTable> implements ILogTableService { |
| | | |
| | | @Value("${fileService.localFilePath}") |
| | | private String localFilePath; |
| | | |
| | | @Value("${fileService.servicePath}") |
| | | private String servicePath; |
| | | |
| | | @Value("${fileService.host}") |
| | | private String host; |
| | | |
| | | @Value("${fileService.port}") |
| | | private String port; |
| | | |
| | | @Value("${fileService.username}") |
| | | private String username; |
| | | |
| | | @Value("${fileService.pwd}") |
| | | private String pwd; |
| | | |
| | | @Value("${fileService.addressToken}") |
| | | private String addressToken; |
| | | |
| | | @Value("${fileService.addressUploadFile}") |
| | | private String addressUploadFile; |
| | | |
| | | @Value("${fileService.logIp}") |
| | | private String logIp; |
| | | |
| | | @Value("${fileService.logPort}") |
| | | private String logPort; |
| | | |
| | | @Value("${fileService.newFilePath}") |
| | | private String newFilePath; |
| | | |
| | | @Resource |
| | | private IMdcPassLogService mdcPassLogService; |
| | | |
| | | private static final String TYPE = "01"; |
| | | |
| | | @Resource |
| | | private SqlExecutor sqlExecutor; |
| | | |
| | | |
| | | /** |
| | | * 导åºåæ¥æ°æ®è¡¨sqlå°xmlæä»¶ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void exportDataToXml() { |
| | | // step.1 æ¥è¯¢ææ°æ°æ® æ¶é´æ£åºæå |
| | | List<LogTable> logTables = this.baseMapper.selectList(new LambdaQueryWrapper<LogTable>().orderByAsc(LogTable::getCreateTime)); |
| | | if (logTables != null && !logTables.isEmpty()) { |
| | | |
| | | // step.2 å¤çæ°æ® |
| | | List<String> sqlList = logTables.stream().map(LogTable::getSqlLog).collect(Collectors.toList()); |
| | | |
| | | // step.3 åå
¥æä»¶ |
| | | // step.3.1 æä»¶å½å |
| | | String today = DateUtils.format(DateUtils.getNow(), DateUtils.STRDATE); |
| | | MdcPassLog mdcPassLogLast = mdcPassLogService.selectTodayLast(today); |
| | | int sequenceNumber = 1; |
| | | if (mdcPassLogLast != null) { |
| | | sequenceNumber = mdcPassLogLast.getSequenceNumber() + 1; |
| | | } |
| | | |
| | | // æä»¶è·¯å¾ |
| | | String locFilePath = localFilePath + TYPE + today + String.format("%06d", sequenceNumber) + ".xml"; |
| | | FileWriter writer = new FileWriter(locFilePath); |
| | | writer.writeLines(sqlList); |
| | | |
| | | // step.4 æ¨éç½é¸ |
| | | // step.4.1 æµè¯æå¡å¨è¿éæ§ |
| | | boolean ping = NetUtil.ping(host + ":" + port); |
| | | if (!ping) { |
| | | FileUtil.del(locFilePath); |
| | | throw new JeecgBootException("æå¡å¨è¿æ¥ï¼ " + host + ":" + port + " å¼å¸¸ï¼"); |
| | | } |
| | | |
| | | // step.4.2 è·åtoken |
| | | String token = ""; |
| | | try { |
| | | token = FileClient.getToken(host, port, username, pwd, addressToken); |
| | | } catch (Throwable e) { |
| | | throw new JeecgBootException("è·åtoken失败ï¼"); |
| | | } |
| | | |
| | | // step 4.3 è°ç¨æä»¶ä¸ä¼ æ¥å£ |
| | | if (StringUtils.isNotBlank(token)) { |
| | | try { |
| | | File[] files = FileUtil.ls(localFilePath); |
| | | for (File file : files) { |
| | | if (file.isFile()) { |
| | | SysLogTypeObjectDto objectName = new SysLogTypeObjectDto(); |
| | | |
| | | objectName.setDateTime(DateUtils.format(DateUtils.getNow(), DateUtils.STR_DATE_TIME_SMALL)); |
| | | objectName.setFileName(file.getName()); |
| | | objectName.setFileSize(FileUtils.changeFileFormatKb(String.valueOf(new File(localFilePath).length()))); |
| | | objectName.setSourceAddress(localFilePath); |
| | | String sm3 = SmUtil.sm3(file); |
| | | objectName.setAbstract1(sm3); |
| | | //顺åºå· |
| | | String fileName = file.getName(); |
| | | String sequenceOrder = fileName.substring(fileName.length() - 10, fileName.length() - 4); |
| | | String dayTime = fileName.substring(fileName.length() - 18, fileName.length() - 10); |
| | | int sequenceNum = Integer.parseInt(sequenceOrder); |
| | | objectName.setFileNum(Integer.toString(sequenceNum)); |
| | | // æå
¥ä¼ è¾æ¥å¿ |
| | | MdcPassLog mdcPassLog = new MdcPassLog(); |
| | | mdcPassLog.setPassLogFileName(file.getAbsolutePath()); |
| | | mdcPassLog.setPassName(fileName); |
| | | mdcPassLog.setDayTime(dayTime); |
| | | mdcPassLog.setSequenceNumber(sequenceNum); |
| | | mdcPassLog.setSequenceOrder(sequenceOrder); |
| | | mdcPassLogService.save(mdcPassLog); |
| | | |
| | | String ip = InetAddress.getLocalHost().getHostAddress(); |
| | | if (StringUtils.isBlank(ip)) { |
| | | objectName.setSourceAddress("10.118.10.62"); |
| | | objectName.setAddress("10.118.10.62"); |
| | | } else { |
| | | objectName.setSourceAddress(ip); |
| | | objectName.setAddress(ip); |
| | | } |
| | | |
| | | objectName.setDestination(host); |
| | | objectName.setResult("失败"); |
| | | // æ¬å°æä»¶è·¯å¾ |
| | | String loFilePath = localFilePath + "\\" + file.getName(); |
| | | // ç®æ æä»¶è·¯å¾ |
| | | String servicePathName = servicePath + "\\" + file.getName(); |
| | | String result = FileClient.uploadFile(host, port, token, file.getName(), servicePathName, loFilePath, addressUploadFile); |
| | | if ("æå".equals(result)) { |
| | | FileUtil.del(loFilePath); |
| | | objectName.setResult("æå"); |
| | | SyslogClient.sendClient(logIp, Integer.valueOf(logPort), objectName.toString()); |
| | | } else { |
| | | objectName.setResult(result); |
| | | objectName.setTypes("error"); |
| | | SyslogClient.sendClient(logIp, Integer.valueOf(logPort), objectName.toString()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Throwable e) { |
| | | throw new JeecgBootException("è°ç¨æä»¶ä¸ä¼ æ¥å£å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | |
| | | // step.5 å é¤å·²ç»åå
¥æä»¶å¹¶åéè³ç½é¸çæ°æ® |
| | | // step.5.1 å 餿°æ®åºæ°æ® |
| | | this.baseMapper.delete(new LambdaQueryWrapper<LogTable>().le(LogTable::getCreateTime, logTables.get(logTables.size() - 1).getCreateTime())); |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥åæ¥æ°æ®sqlæ§è¡å°æ°æ®åº |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importXmlToData() { |
| | | File[] files = FileUtil.ls(localFilePath); |
| | | for (File file : files) { |
| | | if (file.isFile()) { |
| | | String loFilePath = localFilePath + "\\" + file.getName(); |
| | | FileReader fileReader = new FileReader(loFilePath); |
| | | String sqlList = fileReader.readString(); |
| | | try { |
| | | sqlExecutor.execute(sqlList); |
| | | } catch (Exception e) { |
| | | throw new JeecgBootException("æ§è¡sql失败ï¼"); |
| | | } |
| | | // å¤ä»½ |
| | | FileUtil.move(new File(loFilePath), new File(newFilePath + "\\" + file.getName()), true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @Resource |
| | | private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; |
| | | |
| | | /** |
| | | * å©ç¨çæ¥è¡¨ |
| | | * |
| | |
| | | |
| | | List<MdcUtilizationResultDto> list = new ArrayList<>(); |
| | | for (String date : dateList) { |
| | | Date startTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); |
| | | endTime = DateUtils.addDays(endTime, 1); |
| | | list.add(this.utilizationRate(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); |
| | | list.add(this.utilizationRateTrend(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), date, mdcUtilizationRateList)); |
| | | } |
| | | mdcEfficiencyListDto.setDataList(list); |
| | | listDtos.add(mdcEfficiencyListDto); |
| | |
| | | mdcEfficiencyListDto.setEquipmentType(mdcEquProDto.getEquipmentType()); |
| | | List<MdcUtilizationResultDto> list = new ArrayList<>(); |
| | | for (String date : dateList) { |
| | | Date startTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); |
| | | endTime = DateUtils.addDays(endTime, 1); |
| | | list.add(this.utilizationRate(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); |
| | | list.add(this.utilizationRateTrend(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), date, mdcUtilizationRateList)); |
| | | } |
| | | mdcEfficiencyListDto.setDataList(list); |
| | | listDtos.add(mdcEfficiencyListDto); |
| | |
| | | return result; |
| | | } |
| | | |
| | | private MdcUtilizationResultDto utilizationRateTrend(String equipmentId, String equipmentName, String equipmentType, String date, List<MdcUtilizationRate> mdcUtilizationRateList) { |
| | | MdcUtilizationResultDto dto = new MdcUtilizationResultDto(); |
| | | dto.setEquipmentId(equipmentId); |
| | | dto.setEquipmentName(equipmentName); |
| | | dto.setEquipmentType(equipmentType); |
| | | dto.setTheDate(date); |
| | | MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findMdcEquipmentStatisticalInfo(equipmentId, date); |
| | | if (mdcEquipmentStatisticalInfo != null) { |
| | | dto.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("86400"), 6, RoundingMode.HALF_UP)); |
| | | } else { |
| | | dto.setUtilizationRate(new BigDecimal("0")); |
| | | } |
| | | long rate = dto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | | dto.setColor(mdcUtilizationRate.getRateParameterColor()); |
| | | } |
| | | } |
| | | if (StringUtils.isBlank(dto.getColor())) { |
| | | dto.setColor(mdcUtilizationRateList.get(mdcUtilizationRateList.size() - 1).getRateParameterColor()); |
| | | } |
| | | return dto; |
| | | } |
| | | |
| | | @Override |
| | | public List<BigDecimal> getEfficiencyRate(String equipmentId, String date) { |
| | | return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.dto.MdcAlarmListDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; |
| | |
| | | import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | |
| | | } |
| | | } |
| | | } |
| | | // Set<TmpEquipmentAlarm> set = entity.getTmpEquipmentAlarmSet(); |
| | | // if (entity.getStatus() == 22 && set != null && !set.isEmpty()) { |
| | | // Iterator<TmpEquipmentAlarm> iterator = entity.getTmpEquipmentAlarmSet().iterator(); |
| | | // //è·åæ¥è¦ç¼å·ç¸åçæ¥è¦ä¿¡æ¯ |
| | | // while (iterator.hasNext()) { |
| | | // TmpEquipmentAlarm next = iterator.next(); |
| | | // if (StringUtils.isNotBlank(next.getAlarmNo()) && next.getAlarmNo().equals(entity.getStatus())) { |
| | | // dto.setAlarmContent(next.getAlarmContent()); |
| | | // } |
| | | // } |
| | | // } |
| | | dtos.add(dto); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * æ°æ®åæ¥å¤ç |
| | | * |
| | | * @param list |
| | | * @param errorList |
| | | */ |
| | |
| | | return this.baseMapper.getDataList(equipmentId, date); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | */ |
| | | @Override |
| | | public ModelAndView exportXls(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { |
| | | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
| | | List<MdcEquipmentRunningSectionDto> mdcEquipmentRunningSectionDtos = this.logList(equipmentRunningSectionVo); |
| | | // å¯¼åºæä»¶åç§° |
| | | mv.addObject(NormalExcelConstants.FILE_NAME, "è®¾å¤æ¥å¿"); |
| | | mv.addObject(NormalExcelConstants.CLASS, MdcEquipmentRunningSectionDto.class); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("è®¾å¤æ¥å¿åè¡¨æ°æ®", "导åºäºº:" + user.getRealname(), "è®¾å¤æ¥å¿")); |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentRunningSectionDtos); |
| | | return mv; |
| | | } |
| | | |
| | | private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { |
| | | Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); |
| | | List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcEquipmentStatisticalInfo findMdcEquipmentStatisticalInfo(String equipmentId, String date) { |
| | | return this.baseMapper.findMdcEquipmentStatisticalInfo(equipmentId, date.replaceAll("-", "")); |
| | | } |
| | | |
| | | private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) { |
| | | List<EquipmentStatisticalInfo> result = new ArrayList<>(); |
| | | list.forEach(item -> { |
| | |
| | | |
| | | return dateString; |
| | | } |
| | | |
| | | /** |
| | | * ç§è½¬å为æ¶åç§ |
| | | * |
| | | * @param seconds |
| | | * @return |
| | | */ |
| | | public static String secondsToTime(int seconds) { |
| | | int hours = seconds / 3600; |
| | | int minutes = (seconds % 3600) / 60; |
| | | int sec = seconds % 60; |
| | | |
| | | // å°å°æ¶ãåéåç§è½¬æ¢ä¸ºä¸¤ä½æ°æ ¼å¼ |
| | | String formattedHours = String.format("%02d", hours); |
| | | String formattedMinutes = String.format("%02d", minutes); |
| | | String formattedSeconds = String.format("%02d", sec); |
| | | |
| | | return formattedHours + "å°æ¶" + formattedMinutes + "å" + formattedSeconds + "ç§"; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.util; |
| | | |
| | | import cn.hutool.crypto.SmUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.FileEntity; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.protocol.HTTP; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.jeecg.modules.system.util.SM3Util; |
| | | |
| | | import java.io.File; |
| | | import java.net.URLEncoder; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/14 |
| | | */ |
| | | @Slf4j |
| | | public class FileClient { |
| | | |
| | | public static String getToken(String host, String port, String userName, String pwd,String address) throws Exception, Throwable { |
| | | CloseableHttpClient client = null; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //æé 请æ±åæ°appIdåpassword |
| | | jsonObject.put("appId", userName); |
| | | //å°å¯ç éè¿SM3å å¯ |
| | | jsonObject.put("password", SM3Util.encrypt(pwd)); |
| | | String str = objectMapper.writeValueAsString(jsonObject); |
| | | StringEntity stringEntity = new StringEntity(str); |
| | | //æé httpè¯·æ± |
| | | String url = "http" + "://" + host + ":" + port + "/" + address; |
| | | HttpPost httpPost = new HttpPost(url); |
| | | //设置Content-Type |
| | | httpPost.setHeader(HTTP.CONTENT_TYPE, "application/json"); |
| | | //Content-lengthä¼å¨è¯·æ±èªå¨èªå¨å ä¸ |
| | | //å°æé 好çåæ°æ¾å
¥è¯·æ±ä¸ |
| | | httpPost.setEntity(stringEntity); |
| | | //设置请æ±è¶
æ¶æ¶é´ |
| | | RequestConfig requestConfig = RequestConfig.custom() |
| | | .setConnectTimeout(5000).setConnectionRequestTimeout(5000) |
| | | .setSocketTimeout(5000).build(); |
| | | httpPost.setConfig(requestConfig); |
| | | //åèµ·è¯·æ± |
| | | client = HttpClients.createDefault(); |
| | | response = client.execute(httpPost); |
| | | //è§£æè¯·æ±çresponse |
| | | if (response.getStatusLine().getStatusCode() == 200) { |
| | | HttpEntity entity = response.getEntity(); |
| | | String result = EntityUtils.toString(entity, "UTF-8"); |
| | | JSONObject jobject = JSONObject.parseObject(result); |
| | | int code = jobject.getIntValue("code"); |
| | | String token = jobject.getString("token"); |
| | | String message = jobject.getString("msg"); |
| | | if (200 != code) { |
| | | throw new Exception("appAuth Error,code[" + code + "],message[" + message + "]"); |
| | | } else { |
| | | //è¥è¯·æ±æåï¼è¿åtoken |
| | | return token; |
| | | } |
| | | } else { |
| | | throw new Exception("appAuth Error:" + response.getStatusLine().toString()); |
| | | } |
| | | } catch (Throwable e) { |
| | | throw e; |
| | | } finally { |
| | | if (response != null) { |
| | | try { |
| | | response.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | if (client != null) { |
| | | try { |
| | | client.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //uploadFile() |
| | | |
| | | /** |
| | | * |
| | | * @param host |
| | | * @param port |
| | | * @param token |
| | | * @param remoteFilePath |
| | | * @param localFilePath |
| | | * @param addressUploadFile |
| | | * @return |
| | | * @throws Exception |
| | | * @throws Throwable |
| | | */ |
| | | public static String uploadFile(String host, String port, String token,String fileName, String remoteFilePath, String localFilePath,String addressUploadFile) throws Exception, Throwable { |
| | | CloseableHttpClient client = null; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | //æ¼æ¥è¯·æ±çurl |
| | | String url = "http" + "://" + host + ":" + port + "/" + addressUploadFile; |
| | | //æé è¯·æ± |
| | | HttpPost httpPost = new HttpPost(url); |
| | | //设置Content-Type为æä»¶æµæ ¼å¼ |
| | | httpPost.setHeader(HTTP.CONTENT_TYPE, "application/octet-stream"); |
| | | //设置headerç请æ±åæ° |
| | | httpPost.addHeader("Accept", "*/*"); |
| | | httpPost.addHeader("Accept-Encoding", "UTF-8"); |
| | | httpPost.setHeader("Token", token); |
| | | //FileNameéè¦ç»è¿URLEncoderå ç ï¼é²æ¢ä¸æä¹±ç |
| | | httpPost.setHeader("FileName", URLEncoder.encode(remoteFilePath, "UTF-8")); |
| | | /*æä»¶å¤§å°*/ |
| | | httpPost.setHeader("WenjianqIcaoren", URLEncoder.encode("è°æ¿", "UTF-8")); |
| | | httpPost.setHeader("Shenpiren", URLEncoder.encode("éæµ·æ³¢", "UTF-8")); |
| | | httpPost.setHeader("Miji", URLEncoder.encode("å
é¨", "UTF-8")); |
| | | httpPost.addHeader("Baomiqixian", "10,12,30"); |
| | | httpPost.addHeader("Qianfaren", URLEncoder.encode("éæµ·æ³¢", "UTF-8")); |
| | | File file = new File(localFilePath); |
| | | if (!file.exists()){ |
| | | httpPost.addHeader("Wenjiansanliezhi", "1"); |
| | | } else { |
| | | String sm3 = SmUtil.sm3(file); |
| | | httpPost.addHeader("Wenjiansanliezhi", sm3); |
| | | } |
| | | |
| | | httpPost.addHeader("Beizhu", URLEncoder.encode("æ ", "UTF-8")); |
| | | //å°å¯¹åºä¸ä¼ çæ¬å°æä»¶è§£æææä»¶æµæ¾å
¥body |
| | | httpPost.setEntity(new FileEntity(new File(localFilePath))); |
| | | |
| | | //æ ¹æ®æä»¶å¤§å°è®¾ç½®è¶
æ¶æ¶é´ |
| | | int timeout = (int) ((new File(localFilePath).length() / (1000)) * 2 + 2000); |
| | | //设置è¶
æ¶æ¶é´ |
| | | RequestConfig requestConfig = RequestConfig.custom() |
| | | .setConnectTimeout(5000).setConnectionRequestTimeout(5000) |
| | | .setSocketTimeout(timeout).build(); |
| | | httpPost.setConfig(requestConfig); |
| | | //è¯·æ±æé 宿ï¼åèµ·è¯·æ± |
| | | client = HttpClients.createDefault(); |
| | | response = client.execute(httpPost); |
| | | //è§£æresponse |
| | | if (response.getStatusLine().getStatusCode() == 200) { |
| | | HttpEntity entity = response.getEntity(); |
| | | // log.info(entity); |
| | | String result = EntityUtils.toString(entity, "UTF-8"); |
| | | JSONObject jobject = JSONObject.parseObject(result); |
| | | int code = jobject.getIntValue("code"); |
| | | String message = jobject.getString("msg"); |
| | | if (200 != code) { |
| | | // |
| | | log.info( "code: "+ code +" message: " + message); |
| | | if (response != null) { |
| | | try { |
| | | response.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | if (client != null) { |
| | | try { |
| | | client.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | return "失败"; |
| | | } |
| | | return "æå"; |
| | | } else { |
| | | // |
| | | log.info( response.getStatusLine().toString()); |
| | | if (response != null) { |
| | | try { |
| | | response.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | if (client != null) { |
| | | try { |
| | | client.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | return "失败"; |
| | | } |
| | | } catch (Throwable e) { |
| | | //throw e; |
| | | System.out.println( e.toString()); |
| | | if (response != null) { |
| | | try { |
| | | response.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | if (client != null) { |
| | | try { |
| | | client.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | return "失败"; |
| | | } finally { |
| | | if (response != null) { |
| | | try { |
| | | response.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | if (client != null) { |
| | | try { |
| | | client.close(); |
| | | } catch (Throwable t) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.util; |
| | | |
| | | import org.apache.ibatis.session.SqlSession; |
| | | import org.apache.ibatis.session.SqlSessionFactory; |
| | | import org.apache.ibatis.jdbc.SqlRunner; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2025/1/3 13:26 |
| | | */ |
| | | @Component |
| | | public class SqlExecutor { |
| | | |
| | | @Resource |
| | | private SqlSessionFactory sqlSessionFactory; |
| | | |
| | | public void execute(String sql) { |
| | | try (SqlSession sqlSession = sqlSessionFactory.openSession(true)) { |
| | | SqlRunner runner = new SqlRunner(sqlSession.getConnection()); |
| | | runner.run(sql); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("Error executing SQL: " + sql, e); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.util; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.graylog2.syslog4j.Syslog; |
| | | import org.graylog2.syslog4j.SyslogIF; |
| | | |
| | | import java.net.URLDecoder; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/12/17 |
| | | */ |
| | | @Slf4j |
| | | public class SyslogClient { |
| | | |
| | | private static final String MESSAGE = "charset=utf-8 logType=éç¥ instanceName=å®ä¾1 taskName=ä»»å¡2" + |
| | | " logLevel=åè¦ objectName=对象1 desc=æç»1 result=æå date=2023-10-30 00:21:00"; |
| | | |
| | | public static void send(String ip, Integer port) { |
| | | try { |
| | | // è·åsyslogçæä½ç±»ï¼ä½¿ç¨udpåè®®ãsyslogæ¯æ"udp", "tcp"åè®® |
| | | SyslogIF syslog = Syslog.getInstance("udp"); |
| | | // 设置syslogæå¡å¨ç«¯å°ååç«¯å£ |
| | | syslog.getConfig().setHost(ip); |
| | | syslog.getConfig().setPort(port); |
| | | //åéä¿¡æ¯å°æå¡å¨ï¼2表示æ¥å¿çº§å« èå´ä¸º0~7çæ°åç¼ç ï¼è¡¨ç¤ºäºäºä»¶ç严éç¨åº¦ã0æé«ï¼7æä½ |
| | | syslog.log(0, URLDecoder.decode(MESSAGE, "utf-8")); |
| | | log.info("åéæå"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public static Boolean sendClient(String ip, Integer port, String messageClient) { |
| | | try { |
| | | log.info(messageClient); |
| | | // è·åsyslogçæä½ç±»ï¼ä½¿ç¨udpåè®®ãsyslogæ¯æ"udp", "tcp"åè®® |
| | | SyslogIF syslog = Syslog.getInstance("tcp"); |
| | | // 设置syslogæå¡å¨ç«¯å°ååç«¯å£ |
| | | syslog.getConfig().setHost(ip); |
| | | syslog.getConfig().setPort(port); |
| | | //åéä¿¡æ¯å°æå¡å¨ï¼2表示æ¥å¿çº§å« èå´ä¸º0~7çæ°åç¼ç ï¼è¡¨ç¤ºäºäºä»¶ç严éç¨åº¦ã0æé«ï¼7æä½ |
| | | syslog.log(0, URLDecoder.decode(messageClient, "utf-8")); |
| | | log.info("åéæå"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | package org.lxzn; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.core.io.file.FileReader; |
| | | import cn.hutool.core.io.file.FileWriter; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.system.util.SM3Util; |
| | | import org.junit.Test; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.*; |
| | |
| | | System.out.println(startDate); |
| | | } |
| | | |
| | | @Test |
| | | public void test45() { |
| | | List<Integer> list= new ArrayList<>(); |
| | | list.add(1); |
| | | list.add(2); |
| | | list.add(3); |
| | | list.add(4); |
| | | int i = 2; |
| | | for (Integer integer : list) { |
| | | if (integer == i) { |
| | | continue; |
| | | } |
| | | System.out.println(integer); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void test46() { |
| | | String date = LocalDate.now().minusDays(1).toString(); |
| | | System.out.println(date); |
| | | } |
| | | |
| | | @Test |
| | | public void test47() { |
| | | String date = LocalDate.now().minusDays(1).toString(); |
| | | String replace = date.replace("-", ""); |
| | | System.out.println(replace); |
| | | } |
| | | |
| | | @Test |
| | | public void test48() throws IOException { |
| | | List<String> list = new ArrayList<>(); |
| | | list.add("test1"); |
| | | list.add("test2"); |
| | | FileWriter writer = new FileWriter("D:\\data\\test.xml"); |
| | | writer.writeLines(list); |
| | | } |
| | | |
| | | @Test |
| | | public void test49() { |
| | | String token = ""; |
| | | if (StringUtils.isNotBlank(token)) { |
| | | System.out.println("ä¸ä¸ºç©º"); |
| | | } else { |
| | | System.out.println("为空"); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void test50() { |
| | | String fileName = "0120241224000001.xml"; |
| | | String substring = fileName.substring(fileName.length() - 10, fileName.length() - 4); |
| | | String substring2 = fileName.substring(fileName.length() - 18, fileName.length() - 10); |
| | | System.out.println(substring); |
| | | System.out.println(substring2); |
| | | } |
| | | |
| | | @Test |
| | | public void test51() { |
| | | String pwd = "123"; |
| | | String encrypt = SM3Util.encrypt(pwd); |
| | | System.out.println(encrypt); |
| | | } |
| | | |
| | | @Test |
| | | public void test52() { |
| | | String loFilePath = "D:\\data\\0120241226000001.xml"; |
| | | FileReader fileReader = new FileReader(loFilePath); |
| | | String s1 = fileReader.readString(); |
| | | System.out.println(s1); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.tomcat.util.http.fileupload.IOUtils; |
| | | import org.jeecg.common.api.dto.DataLogDTO; |
| | | import org.jeecg.common.api.dto.OnlineAuthDTO; |
| | | import org.jeecg.common.api.dto.message.*; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.vo.*; |
| | | import org.jeecg.common.util.SqlInjectionUtil; |
| | | import org.jeecg.modules.system.entity.MdcPassLog; |
| | | import org.jeecg.modules.system.security.DictQueryBlackListHandler; |
| | | import org.jeecg.modules.system.service.IMdcPassLogService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.service.impl.SysBaseApiImpl; |
| | | import org.jeecg.modules.system.util.JwTUtil; |
| | | import org.jeecg.modules.system.util.SM3Util; |
| | | import org.jeecg.modules.system.vo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | |
| | | |
| | | /** |
| | | * æå¡å system模å 坹夿¥å£è¯·æ±ç±» |
| | | * |
| | | * @author: jeecg-boot |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/sys/api") |
| | | public class SystemApiController { |
| | | |
| | | @Value("${fileService.username}") |
| | | private String username; |
| | | |
| | | @Value("${fileService.pwd}") |
| | | private String pwd; |
| | | |
| | | @Autowired |
| | | private SysBaseApiImpl sysBaseApi; |
| | |
| | | @Autowired |
| | | private DictQueryBlackListHandler dictQueryBlackListHandler; |
| | | |
| | | @Resource |
| | | private IMdcPassLogService mdcPassLogService; |
| | | |
| | | |
| | | /** |
| | | * åéç³»ç»æ¶æ¯ |
| | | * |
| | | * @param message ä½¿ç¨æé å¨èµå¼åæ° å¦æä¸è®¾ç½®category(æ¶æ¯ç±»å)åé»è®¤ä¸º2 åéç³»ç»æ¶æ¯ |
| | | */ |
| | | @PostMapping("/sendSysAnnouncement") |
| | |
| | | |
| | | /** |
| | | * åéæ¶æ¯ é带ä¸å¡åæ° |
| | | * |
| | | * @param message ä½¿ç¨æé å¨èµå¼åæ° |
| | | */ |
| | | @PostMapping("/sendBusAnnouncement") |
| | |
| | | |
| | | /** |
| | | * éè¿æ¨¡æ¿åéæ¶æ¯ |
| | | * |
| | | * @param message ä½¿ç¨æé å¨èµå¼åæ° |
| | | */ |
| | | @PostMapping("/sendTemplateAnnouncement") |
| | |
| | | |
| | | /** |
| | | * éè¿æ¨¡æ¿åéæ¶æ¯ é带ä¸å¡åæ° |
| | | * |
| | | * @param message ä½¿ç¨æé å¨èµå¼åæ° |
| | | */ |
| | | @PostMapping("/sendBusTemplateAnnouncement") |
| | |
| | | |
| | | /** |
| | | * éè¿æ¶æ¯ä¸å¿æ¨¡æ¿ï¼çææ¨éå
容 |
| | | * |
| | | * @param templateDTO ä½¿ç¨æé å¨èµå¼åæ° |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·è´¦å·æ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idæ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·è´¦å·æ¥è¯¢è§è²éå |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·è´¦å·æ¥è¯¢é¨é¨éå |
| | | * |
| | | * @param username |
| | | * @return é¨é¨ id |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·è´¦å·æ¥è¯¢é¨é¨ name |
| | | * |
| | | * @param username |
| | | * @return é¨é¨ name |
| | | */ |
| | |
| | | |
| | | /** |
| | | * è·åæ°æ®åå
¸ |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * è·åææçæ°æ®åå
¸ |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | /** æ¥è¯¢ææçç¶çº§åå
¸ï¼æç
§create_timeæåº */ |
| | | /** |
| | | * æ¥è¯¢ææçç¶çº§åå
¸ï¼æç
§create_timeæåº |
| | | */ |
| | | @GetMapping("/queryAllDict") |
| | | List<DictModel> queryAllDict(){ |
| | | // try{ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææåç±»åå
¸ |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryAllSysCategory") |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææé¨é¨ ä½ä¸ºåå
¸ä¿¡æ¯ id -->value,departName -->text |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryAllDepartBackDictModel") |
| | |
| | | /** |
| | | * è·åææè§è² 带å |
| | | * roleIds é»è®¤éä¸è§è² |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryAllRole") |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·è´¦å·æ¥è¯¢è§è²Idéå |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿é¨é¨ç¼å·æ¥è¯¢é¨é¨id |
| | | * |
| | | * @param orgCode |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææé¨é¨ |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAllSysDepart") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®é¨é¨Idè·åé¨é¨è´è´£äºº |
| | | * |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥æ¾ç¶çº§é¨é¨ |
| | | * |
| | | * @param departId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ç»æå®ç¨æ·åæ¶æ¯ |
| | | * |
| | | * @param userIds |
| | | * @param cmd |
| | | */ |
| | |
| | | /** |
| | | * æ ¹æ®idè·åææåä¸ç¨æ· |
| | | * userIds |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryAllUserByIds") |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç¨æ· è¿åComboModel |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryAllUserBackCombo") |
| | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç¨æ· è¿åJSONObject |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryAllUser") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * å°ä¼è®®ç¾å°ä¿¡æ¯æ¨å¨å°é¢è§ |
| | | * userIds |
| | | * @return |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @GetMapping("/meetingSignWebsocket") |
| | | public void meetingSignWebsocket(@RequestParam("userId")String userId){ |
| | |
| | | /** |
| | | * æ ¹æ®nameè·åææåä¸ç¨æ· |
| | | * userNames |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryUserByNames") |
| | |
| | | |
| | | /** |
| | | * è·åç¨æ·çè§è²éå |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * è·åç¨æ·çæééå |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 夿æ¯å¦æonline访é®çæé |
| | | * |
| | | * @param onlineAuthDTO |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·è§è²ä¿¡æ¯ |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·æéä¿¡æ¯ |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idæ¥è¯¢ç¨æ·æå±å
¬å¸ä¸ææç¨æ·ids |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°æ®æé |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryPermissionDataRule") |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ®éåå
¸çç¿»è¯ |
| | | * |
| | | * @param code |
| | | * @param key |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * 36æ ¹æ®å¤ä¸ªç¨æ·è´¦å·(éå·åé)ï¼æ¥è¯¢è¿åå¤ä¸ªç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param usernames |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 37æ ¹æ®å¤ä¸ªç¨æ·id(éå·åé)ï¼æ¥è¯¢è¿åå¤ä¸ªç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 38æ ¹æ®å¤ä¸ªé¨é¨ç¼ç (éå·åé)ï¼æ¥è¯¢è¿åå¤ä¸ªé¨é¨ä¿¡æ¯ |
| | | * |
| | | * @param orgCodes |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 39æ ¹æ®å¤ä¸ªé¨é¨ID(éå·åé)ï¼æ¥è¯¢è¿åå¤ä¸ªé¨é¨ä¿¡æ¯ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 40åéé®ä»¶æ¶æ¯ |
| | | * |
| | | * @param email |
| | | * @param title |
| | | * @param content |
| | |
| | | @GetMapping("/sendEmailMsg") |
| | | public void sendEmailMsg(@RequestParam("email")String email,@RequestParam("title")String title,@RequestParam("content")String content){ |
| | | this.sysBaseApi.sendEmailMsg(email,title,content); |
| | | }; |
| | | } |
| | | |
| | | ; |
| | | |
| | | /** |
| | | * 41 è·åå
¬å¸ä¸çº§é¨é¨åå
¬å¸ä¸ææç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param orgCode |
| | | */ |
| | | @GetMapping("/getDeptUserByOrgCode") |
| | |
| | | |
| | | /** |
| | | * 48 æ®éåå
¸çç¿»è¯ï¼æ ¹æ®å¤ä¸ªdictCodeå夿¡æ°æ®ï¼å¤ä¸ªä»¥éå·åå² |
| | | * |
| | | * @param dictCodes |
| | | * @param keys |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * è·åè¡¨æ°æ®åå
¸ ãæ¥å£ç¾åéªè¯ã |
| | | * |
| | | * @param table |
| | | * @param text |
| | | * @param code |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨åå
¸ æ¯æè¿æ»¤æ°æ® ãæ¥å£ç¾åéªè¯ã |
| | | * |
| | | * @param table |
| | | * @param text |
| | | * @param code |
| | |
| | | /** |
| | | * ãæ¥å£ç¾åéªè¯ã |
| | | * æ¥è¯¢æå®tableç text code è·ååå
¸ï¼å
å«textåvalue |
| | | * |
| | | * @param table |
| | | * @param text |
| | | * @param code |
| | |
| | | |
| | | /** |
| | | * åå
¸è¡¨ç ç¿»è¯ãæ¥å£ç¾åéªè¯ã |
| | | * |
| | | * @param table |
| | | * @param text |
| | | * @param code |
| | |
| | | |
| | | /** |
| | | * å鿍¡æ¿ä¿¡æ¯ |
| | | * |
| | | * @param message |
| | | */ |
| | | @PostMapping("/sendTemplateMessage") |
| | |
| | | |
| | | /** |
| | | * è·åæ¶æ¯æ¨¡æ¿å
容 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿åæ°æ®æ¥å¿ |
| | | * |
| | | * @param dataLogDto |
| | | */ |
| | | @PostMapping("/saveDataLog") |
| | |
| | | } |
| | | |
| | | @PostMapping("/addSysFiles") |
| | | public void addSysFiles(@RequestBody SysFilesModel sysFilesModel){this.sysBaseApi.addSysFiles(sysFilesModel);} |
| | | public void addSysFiles(@RequestBody SysFilesModel sysFilesModel) { |
| | | this.sysBaseApi.addSysFiles(sysFilesModel); |
| | | } |
| | | |
| | | @GetMapping("/getFileUrl") |
| | | public String getFileUrl(@RequestParam(name="fileId") String fileId){ |
| | |
| | | |
| | | /** |
| | | * æ´æ°å¤´å |
| | | * |
| | | * @param loginUser |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * åapp端 websocketæ¨éè天巿°æ¶æ¯ |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | |
| | | /** |
| | | * VUEN-2584ãissueãå¹³å°sql注å
¥æ¼æ´å 个é®é¢ |
| | | * é¨åç¹æ®å½æ° å¯ä»¥å°æ¥è¯¢ç»ææ··å¤¹å¨é误信æ¯ä¸ï¼å¯¼è´æ°æ®åºçä¿¡æ¯æ´é² |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | |
| | | return Result.error("æ ¡éªå¤±è´¥ï¼sqlè§£æå¼å¸¸ï¼" + msg); |
| | | } |
| | | |
| | | /** |
| | | * ç½é¸è®¤è¯ |
| | | * |
| | | * @param postParams |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/appAuth") |
| | | public TokenResp getToken(@RequestBody PostParams postParams) { |
| | | //è·å请æ±å¤´ä¸ä¼ å
¥çappIdåpassword |
| | | String appId = postParams.getAppId(); |
| | | String password = postParams.getPassword(); |
| | | |
| | | //ç¨äºæ ¡éªçæ£ç¡®çappIdåpasswordï¼æ ¹æ®ä¸å¡è°æ´ï¼ |
| | | |
| | | //æ ¡éªappIdåpaawordï¼ç±äºæµè¯ç¨çææå¯ç ,SM3Util.verify()å
å°éæå¯ç SM3å å¯ååä¸ä¼ å
¥passwordå¯¹æ¯ |
| | | if (username.equals(appId)) { |
| | | //æ ¡éªéè¿ï¼çætokenç¾å |
| | | if (SM3Util.verify(pwd, password)) { |
| | | String token = JwTUtil.sign(appId, pwd); |
| | | return new TokenResp("200", "è®¤è¯æå", token); |
| | | } else { |
| | | return new TokenResp("", "å¯ç é误", null); |
| | | } |
| | | } else { |
| | | return new TokenResp("", "è´¦å·é误", null); |
| | | } |
| | | } |
| | | |
| | | @PostMapping(value = "/fileUpload") |
| | | public RespData uploadFiles(HttpServletRequest request) { |
| | | |
| | | FileDetail fileDetail = new FileDetail(); |
| | | try { |
| | | request.setCharacterEncoding("UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //è·åFileName |
| | | if (request.getHeader("FileName") != null) { |
| | | try { |
| | | fileDetail.setFileName(URLDecoder.decode(request.getHeader("FileName"), "utf-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //è·åContent-Length |
| | | if (request.getHeader("Content-Length") != null) { |
| | | try { |
| | | fileDetail.setContentLength(URLDecoder.decode(request.getHeader("Content-Length"), "utf-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //è·åæä»¶æµ |
| | | ServletInputStream inputStream = null; |
| | | try { |
| | | inputStream = request.getInputStream(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //æä½æä»¶æµï¼ä¸ä¼ æä»¶ |
| | | FileOutputStream fileOut = null; |
| | | try { |
| | | fileOut = new FileOutputStream(fileDetail.getFileName()); // è¿éå¯ä»¥æ¹è·¯å¾ |
| | | IOUtils.copy(inputStream, fileOut); |
| | | fileOut.flush(); |
| | | //ä¸è®°å½æ°æ®é |
| | | MdcPassLog mdcPassLog = new MdcPassLog(); |
| | | File file = new File(fileDetail.getFileName()); |
| | | String fileName = file.getName(); |
| | | String sequenceOrder = fileName.substring(fileName.length() - 10, fileName.length() - 4); |
| | | String dayTime = fileName.substring(fileName.length() - 18, fileName.length() - 10); |
| | | mdcPassLog.setPassLogFileName(file.getAbsolutePath()); |
| | | int sequenceNum = Integer.parseInt(sequenceOrder); |
| | | mdcPassLog.setPassName(fileName); |
| | | mdcPassLog.setDayTime(dayTime); |
| | | mdcPassLog.setSequenceNumber(sequenceNum); |
| | | mdcPassLog.setSequenceOrder(sequenceOrder); |
| | | mdcPassLogService.save(mdcPassLog); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (fileOut != null) { |
| | | fileOut.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return new RespData("200", "æä»¶ä¸ä¼ æå"); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.Table; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/12/12 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_pass_log") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_pass_log对象", description = "åéæä»¶æ¥å¿è¡¨") |
| | | public class MdcPassLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -9138730240370211497L; |
| | | |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | /** |
| | | * åç§° |
| | | */ |
| | | private String passName; |
| | | /** |
| | | * åºå· |
| | | */ |
| | | private String sequenceOrder; |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | private String dayTime; |
| | | /** |
| | | * ç±»å |
| | | */ |
| | | private String passType; |
| | | /** |
| | | * æä»¶åç§° |
| | | */ |
| | | private String passLogFileName; |
| | | /** |
| | | * 顺åºå· |
| | | */ |
| | | private Integer sequenceNumber; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.system.entity.MdcPassLog; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/23 14:59 |
| | | */ |
| | | public interface MdcPassLogMapper extends BaseMapper<MdcPassLog> { |
| | | |
| | | /** |
| | | * æ¥è¯¢ä»æ¥ææ°ä¸æ¡ä¼ è¾æ¥å¿ |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | MdcPassLog selectTodayLast(@Param("date") String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="org.jeecg.modules.system.mapper.MdcPassLogMapper"> |
| | | |
| | | <select id="selectTodayLast" resultType="org.jeecg.modules.system.entity.MdcPassLog"> |
| | | SELECT TOP 1 * FROM mdc_pass_log WHERE day_time = #{date} ORDER BY create_time DESC |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.system.entity.MdcPassLog; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/23 15:00 |
| | | */ |
| | | public interface IMdcPassLogService extends IService<MdcPassLog> { |
| | | |
| | | /** |
| | | * æ¥è¯¢ä»æ¥ææ°ä¸æ¡ä¼ è¾æ¥å¿ |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | MdcPassLog selectTodayLast(String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.system.entity.MdcPassLog; |
| | | import org.jeecg.modules.system.mapper.MdcPassLogMapper; |
| | | import org.jeecg.modules.system.service.IMdcPassLogService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2024/12/23 15:00 |
| | | */ |
| | | @Service |
| | | public class MdcPassLogServiceImpl extends ServiceImpl<MdcPassLogMapper, MdcPassLog> implements IMdcPassLogService { |
| | | |
| | | /** |
| | | * æ¥è¯¢ä»æ¥ææ°ä¸æ¡ä¼ è¾æ¥å¿ |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MdcPassLog selectTodayLast(String date) { |
| | | return this.baseMapper.selectTodayLast(date); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.util; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStreamWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * Created by YangBin on 2017/9/15. |
| | | */ |
| | | public class FileUtils { |
| | | private static final long MAX_FILE_SIZE = 10 * 1024 * 1024; |
| | | |
| | | /** |
| | | * è·åæå¡å¨ä¸´æ¶è·¯å¾ |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static String serverTempPath(HttpServletRequest request) { |
| | | String fsep = System.getProperty("file.separator"); |
| | | String path = request.getSession().getServletContext().getRealPath(""); |
| | | if (path.lastIndexOf(fsep) == path.length() - 1) { |
| | | path += "upload" + fsep + "voucher" + fsep; |
| | | } else { |
| | | path += fsep + "upload" + fsep + "voucher" + fsep; |
| | | } |
| | | return path; |
| | | } |
| | | |
| | | public static String serverTempPathIntactReg(HttpServletRequest request) { |
| | | String fsep = System.getProperty("file.separator"); |
| | | String path = request.getSession().getServletContext().getRealPath(""); |
| | | if (path.lastIndexOf(fsep) == path.length() - 1) { |
| | | path += "upload" + fsep + "log" + fsep + "error" + fsep; |
| | | } else { |
| | | path += fsep + "upload" + fsep + "log" + fsep + "error" + fsep; |
| | | } |
| | | return path; |
| | | } |
| | | |
| | | public static String serverTempPathProcess(HttpServletRequest request) { |
| | | String fsep = System.getProperty("file.separator"); |
| | | String path = request.getSession().getServletContext().getRealPath(""); |
| | | if (path.lastIndexOf(fsep) == path.length() - 1) { |
| | | path += "upload" + fsep + "process" + fsep; |
| | | } else { |
| | | path += fsep + "upload" + fsep + "process" + fsep; |
| | | } |
| | | return path; |
| | | } |
| | | |
| | | public static String changeFileFormatKb(String flow) { |
| | | BigDecimal flows = new BigDecimal(flow); |
| | | if (flows.compareTo(new BigDecimal(0)) > 0 && flows.compareTo(new BigDecimal(1024)) < 0) {//å°äº1M |
| | | return flows.toString() + "B"; |
| | | } else if (flows.compareTo(new BigDecimal(1024)) >= 0) { |
| | | BigDecimal result = flows.divide(new BigDecimal(1024), 2, BigDecimal.ROUND_HALF_UP); |
| | | return result.toString() + "KB"; |
| | | } else { |
| | | return "0"; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¾å°é¡¹ç®æ ¹ç®å½ä¸çç»å¯¹è·¯å¾ï¼ç£ççç©çè·¯å¾ï¼ |
| | | * |
| | | * @param request |
| | | * @param newPath |
| | | * @return |
| | | */ |
| | | public static String getFilePath(HttpServletRequest request, String newPath) { |
| | | String fsep = System.getProperty("file.separator"); |
| | | String path = request.getSession().getServletContext().getRealPath("/upload"); |
| | | path += fsep + newPath; |
| | | return path; |
| | | } |
| | | |
| | | /** |
| | | * å¾å°é¡¹ç®æ ¹ç®å½ä¸çç¸å¯¹è·¯å¾ ï¼ç¸å¯¹äºé¡¹ç®ä¸ºæ ¹è·¯å¾ï¼ |
| | | * |
| | | * @param newPath |
| | | * @return |
| | | */ |
| | | public static String getRelativePath(String newPath) { |
| | | return "/upload/" + newPath; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¹æ³ä¸:ä½¿ç¨ FileWriter åæä»¶ |
| | | * |
| | | * @param filepath æä»¶ç®å½ |
| | | * @param content å¾
åå
¥å
容 |
| | | * @throws IOException |
| | | */ |
| | | public static void fileWriterSql(String filepath, String content) throws IOException { |
| | | OutputStreamWriter outputStreamWriter = null; |
| | | try { |
| | | File file = new File(filepath); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileOutputStream outputStream = new FileOutputStream(file); |
| | | if (outputStream != null) { |
| | | outputStreamWriter = new OutputStreamWriter(outputStream, "utf-8"); |
| | | outputStreamWriter.write(content); |
| | | outputStreamWriter.flush(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.getMessage(); |
| | | } finally { |
| | | try { |
| | | if (outputStreamWriter != null) { |
| | | outputStreamWriter.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | File file=new File(filepath); |
| | | Writer writer = new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()), "UTF-8"); |
| | | writer.append(content); |
| | | */ |
| | | } |
| | | |
| | | /** |
| | | * æä»¶å¤§å°æºè½è½¬æ¢ |
| | | * ä¼å°æä»¶å¤§å°è½¬æ¢ä¸ºæå¤§æ»¡è¶³åä½ |
| | | * |
| | | * @param sizeï¼æä»¶å¤§å°ï¼åä½ä¸ºBï¼ |
| | | * @return æä»¶å¤§å° |
| | | */ |
| | | public static String formatFileSize(Long size) { |
| | | String sizeName = null; |
| | | if (1024 * 1024 > size && size >= 1024) { |
| | | sizeName = String.format("%.2f", size.doubleValue() / 1024) + "KB"; |
| | | } else if (1024 * 1024 * 1024 > size && size >= 1024 * 1024) { |
| | | sizeName = String.format("%.2f", size.doubleValue() / (1024 * 1024)) + "MB"; |
| | | } else if (size >= 1024 * 1024 * 1024) { |
| | | sizeName = String.format("%.2f", size.doubleValue() / (1024 * 1024 * 1024)) + "GB"; |
| | | } else { |
| | | sizeName = size.toString() + "B"; |
| | | } |
| | | return sizeName; |
| | | } |
| | | |
| | | /** |
| | | * ä¸ä¼ æä»¶å·¥å
·ç±» |
| | | * |
| | | * @param userPic |
| | | * @param path |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean uploadFile(MultipartFile userPic, String path, String fileName) { |
| | | Long fileSize = userPic.getSize(); |
| | | if (fileSize > MAX_FILE_SIZE) { |
| | | return false; |
| | | } |
| | | File targetFile = new File(path, fileName); |
| | | if (!targetFile.exists()) { |
| | | targetFile.mkdirs(); |
| | | } |
| | | try { |
| | | userPic.transferTo(targetFile); |
| | | return true; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éå½åæä»¶å å å
¥æ¶é´æ³ |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String newFileName(String fileName) { |
| | | String suffix = fileName.substring(fileName.lastIndexOf('.')); |
| | | String dateStr = "_" + DateUtil.now(); |
| | | String nameFile = fileName.substring(0, fileName.indexOf(".")); |
| | | //æ°æä»¶å |
| | | return nameFile + dateStr + suffix; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.util; |
| | | |
| | | import com.auth0.jwt.JWT; |
| | | import com.auth0.jwt.algorithms.Algorithm; |
| | | import com.auth0.jwt.exceptions.JWTDecodeException; |
| | | import com.auth0.jwt.interfaces.DecodedJWT; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/23 |
| | | */ |
| | | public class JwTUtil { |
| | | /** |
| | | * ä»tokenä¸è§£å¯åºç¨æ·å |
| | | */ |
| | | public static String getUsername(String token) { |
| | | try { |
| | | DecodedJWT jwt = JWT.decode(token); |
| | | return jwt.getClaim("username").asString(); |
| | | } catch (JWTDecodeException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦è¿æ |
| | | */ |
| | | public static boolean isExpired(String token) { |
| | | DecodedJWT jwt = JWT.decode(token); |
| | | return jwt.getExpiresAt().before(new Date()); |
| | | } |
| | | |
| | | /** |
| | | * çæç¾å |
| | | */ |
| | | public static String sign(String username, String secret) { |
| | | Algorithm algorithm = Algorithm.HMAC256(secret); |
| | | // 30åéåè¿æ |
| | | Date date = new Date(System.currentTimeMillis() + 60 * 60 * 1000); |
| | | // é带usernameä¿¡æ¯ï¼åªè¦ä½ æ¿æï¼å¯ä»¥é带MapãListçï¼ |
| | | return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.util; |
| | | |
| | | import org.bouncycastle.crypto.digests.SM3Digest; |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | import org.bouncycastle.pqc.math.linearalgebra.ByteUtils; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.security.Security; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/23 |
| | | */ |
| | | public class SM3Util { |
| | | /** |
| | | * ç¼ç æ ¼å¼ |
| | | */ |
| | | private static final String ENCODING = "UTF-8"; |
| | | |
| | | static{ |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param paramStr è¦sm3å å¯çå
容 |
| | | * @return sm3å å¯å坿 |
| | | */ |
| | | public static String encrypt(String paramStr){ |
| | | String resultHexString = ""; |
| | | try { |
| | | byte[] srcData = paramStr.getBytes(ENCODING); |
| | | byte[] hash = hash(srcData); |
| | | resultHexString = ByteUtils.toHexString(hash); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return resultHexString; |
| | | } |
| | | |
| | | public static byte[] hash(byte[] srcData){ |
| | | SM3Digest sm3Digest = new SM3Digest(); |
| | | sm3Digest.update(srcData,0,srcData.length); |
| | | byte[] bytes = new byte[sm3Digest.getDigestSize()]; |
| | | sm3Digest.doFinal(bytes,0); |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param str ææ |
| | | * @param hexString 坿 |
| | | * @return ææå¯æå¯¹æ¯ç»æ |
| | | */ |
| | | public static boolean verify(String str,String hexString){ |
| | | boolean flag = false; |
| | | try { |
| | | byte[] srcData = str.getBytes(ENCODING); |
| | | byte[] sm3Hash = ByteUtils.fromHexString(hexString); |
| | | byte[] hash = hash(srcData); |
| | | if (Arrays.equals(hash,sm3Hash)){ |
| | | flag = true; |
| | | } |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/28 |
| | | */ |
| | | @Data |
| | | public class FileDetail { |
| | | private String fileName; |
| | | private String contentLength; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/23 |
| | | */ |
| | | @Data |
| | | public class PostParams { |
| | | |
| | | private String appId; |
| | | private String password; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/28 |
| | | */ |
| | | @Data |
| | | public class RespData { |
| | | private String code; |
| | | private String msg; |
| | | |
| | | public RespData(String code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/12/19 |
| | | */ |
| | | @Data |
| | | public class SysLogTypeObjectDto { |
| | | |
| | | /** |
| | | * ç³»ç»åç§° |
| | | */ |
| | | private String systemName = "MDC"; |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | private String dateTime; |
| | | /** |
| | | * å°ç¹ |
| | | */ |
| | | private String location = "æåå·¥ä¸å"; |
| | | /** |
| | | * ç±»å Info/error |
| | | */ |
| | | private String types = "info"; |
| | | /** |
| | | * æä»¶åºå· |
| | | */ |
| | | private String fileNum; |
| | | /** |
| | | * æä»¶å |
| | | */ |
| | | private String fileName; |
| | | /** |
| | | * æä»¶å¤§å° |
| | | */ |
| | | private String fileSize; |
| | | /** |
| | | * ä¸å¡ç³»ç»ip |
| | | */ |
| | | private String address = "10.118.10.62"; |
| | | /** |
| | | * æä»¶æè¦ |
| | | */ |
| | | private String abstract1; |
| | | /** |
| | | * æºå°å |
| | | */ |
| | | private String sourceAddress; |
| | | /** |
| | | * ç®çå°å |
| | | */ |
| | | private String destination; |
| | | /** |
| | | * ç»æ |
| | | */ |
| | | private String result; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author clown |
| | | * * @date 2023/11/23 |
| | | */ |
| | | @Data |
| | | public class TokenResp { |
| | | private String code; |
| | | private String token; |
| | | private String msg; |
| | | |
| | | public TokenResp(String code, String token, String msg) { |
| | | this.code = code; |
| | | this.token = token; |
| | | this.msg = msg; |
| | | } |
| | | } |