diff --git a/evo-admin/pom.xml b/evo-admin/pom.xml index a849f7b..de09efc 100644 --- a/evo-admin/pom.xml +++ b/evo-admin/pom.xml @@ -17,6 +17,16 @@ + + com.baomidou + mybatis-plus-boot-starter + 3.4.3.4 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.1 + org.springframework.boot @@ -95,6 +105,7 @@ com.github.pagehelper pagehelper-spring-boot-starter + true diff --git a/evo-admin/src/main/java/com/evo/EvoApplication.java b/evo-admin/src/main/java/com/evo/EvoApplication.java index 76686d8..26f9690 100644 --- a/evo-admin/src/main/java/com/evo/EvoApplication.java +++ b/evo-admin/src/main/java/com/evo/EvoApplication.java @@ -1,5 +1,6 @@ package com.evo; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @@ -12,6 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; */ @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @EnableScheduling +@MapperScan({"com.evo.**.mapper"}) public class EvoApplication { public static void main(String[] args) diff --git a/evo-admin/src/main/java/com/evo/common/config/WebConfig.java b/evo-admin/src/main/java/com/evo/common/config/WebConfig.java new file mode 100644 index 0000000..54a62b9 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/common/config/WebConfig.java @@ -0,0 +1,28 @@ +package com.evo.common.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * 类 + * + * @ClassName:WebConfig + * @date: 2025年05月20日 13:24 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ + +// 在Spring Boot的配置类中添加CORS配置 +@Configuration +public class WebConfig implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") // 匹配所有接口 + .allowedOrigins("localhost:8090") // 允许的前端域名 + .allowedMethods("GET", "POST", "PUT", "DELETE") // 允许的HTTP方法 + .allowedHeaders("*") // 允许的请求头 + .allowCredentials(true); // 允许携带凭证(如Cookie) + } +} diff --git a/evo-admin/src/main/java/com/evo/common/core/domain/entity/RzUpload.java b/evo-admin/src/main/java/com/evo/common/core/domain/entity/RzUpload.java new file mode 100644 index 0000000..e5c5a23 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/common/core/domain/entity/RzUpload.java @@ -0,0 +1,68 @@ +package com.evo.common.core.domain.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 类 + * + * @ClassName:RzUpload + * @date: 2025年05月20日 15:35 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +@Data +public class RzUpload implements Serializable { + + /*** + * id + */ + Long id; + + /*** + * 类型 + */ + String type; + /*** + * 业务Id + */ + Long businessId; + /*** + * 文件绝对路径 + */ + String url; + + /*** + * 文件相对路径 + */ + String fileName; + /*** + * 上传文件名称 + */ + String newFileName; + + /*** + * 文件原始名称 + */ + String originalFileName; + + /** 上传时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date uploadTime; + + /*** + * 上传ip + */ + String uploadIp; + /*** + * 标识 + * 有效: valid + * 无效: Invalid + */ + String valid="valid"; + +} diff --git a/evo-admin/src/main/java/com/evo/common/utils/file/FileUploadUtils.java b/evo-admin/src/main/java/com/evo/common/utils/file/FileUploadUtils.java index 7cc3b12..36bed47 100644 --- a/evo-admin/src/main/java/com/evo/common/utils/file/FileUploadUtils.java +++ b/evo-admin/src/main/java/com/evo/common/utils/file/FileUploadUtils.java @@ -47,25 +47,6 @@ public class FileUploadUtils return defaultBaseDir; } - /** - * 以默认配置进行文件上传 - * - * @param file 上传的文件 - * @return 文件名称 - * @throws Exception - */ - public static final String upload(MultipartFile file) throws IOException - { - try - { - return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); - } - catch (Exception e) - { - throw new IOException(e.getMessage(), e); - } - } - /** * 根据文件路径上传 * @@ -86,6 +67,25 @@ public class FileUploadUtils } } + /** + * 以默认配置进行文件上传 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String upload(MultipartFile file) throws IOException + { + try + { + return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + /** * 文件上传 * diff --git a/evo-admin/src/main/java/com/evo/common/utils/ip/IpUtils.java b/evo-admin/src/main/java/com/evo/common/utils/ip/IpUtils.java index 9485b86..ee7f156 100644 --- a/evo-admin/src/main/java/com/evo/common/utils/ip/IpUtils.java +++ b/evo-admin/src/main/java/com/evo/common/utils/ip/IpUtils.java @@ -228,6 +228,16 @@ public class IpUtils return "127.0.0.1"; } + /** + * 获取服务的端口号 + * + * @return IP地址 + */ + public static String getServerUrl() + { + return ServletUtils.getRequest().getRequestURL().toString(); + } + /** * 获取主机名 * diff --git a/evo-admin/src/main/java/com/evo/equipment/service/IEqButtonService.java b/evo-admin/src/main/java/com/evo/equipment/service/IEqButtonService.java index de6b582..8361545 100644 --- a/evo-admin/src/main/java/com/evo/equipment/service/IEqButtonService.java +++ b/evo-admin/src/main/java/com/evo/equipment/service/IEqButtonService.java @@ -2,6 +2,7 @@ package com.evo.equipment.service; import com.evo.common.core.domain.AjaxResult; import com.evo.equipment.domain.EqButton; +import com.evo.equipment.domain.EqSnDetail; import java.util.List; @@ -60,4 +61,10 @@ public interface IEqButtonService * @return 按钮信息 */ public EqButton selectEqButtonByName(String name); + + /*** + * 照片下发 + * @param paramEqSnDetail + */ + void sendButton(EqSnDetail paramEqSnDetail); } diff --git a/evo-admin/src/main/java/com/evo/equipment/service/impl/EqButtonServiceImpl.java b/evo-admin/src/main/java/com/evo/equipment/service/impl/EqButtonServiceImpl.java index 5eb4e44..73e5105 100644 --- a/evo-admin/src/main/java/com/evo/equipment/service/impl/EqButtonServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/equipment/service/impl/EqButtonServiceImpl.java @@ -205,4 +205,24 @@ public class EqButtonServiceImpl implements IEqButtonService return eqButtonMapper.selectEqButtonByName(name); } + public void sendButton(EqSnDetail snDetail) { + List bt_list = this.eqButtonMapper.selectEqButtonList(null); + CwButtonVo cbv = new CwButtonVo(); + CwButtonData cbd = new CwButtonData(); + cbv.setCmd("to_device"); + cbv.setForm(""); + cbv.setTo(snDetail.getSn()); + cbd.setCmd("setButtons"); + CwBottonDto cwBottonDto = null; + List list2 = new ArrayList<>(); + for (EqButton button : bt_list) { + cwBottonDto = new CwBottonDto(); + cwBottonDto.setIcon(button.getImage()); + list2.add(cwBottonDto); + } + cbd.setValue(list2); + cbv.setData(cbd); + WebSocketUsers.sendMessageToUsersByText(JSONObject.toJSONString(cbv, new com.alibaba.fastjson2.JSONWriter.Feature[0])); + } + } diff --git a/evo-admin/src/main/java/com/evo/framework/config/MyBatisConfig.java b/evo-admin/src/main/java/com/evo/framework/config/MyBatisConfig.java index db4e168..0162e95 100644 --- a/evo-admin/src/main/java/com/evo/framework/config/MyBatisConfig.java +++ b/evo-admin/src/main/java/com/evo/framework/config/MyBatisConfig.java @@ -1,132 +1,132 @@ -package com.evo.framework.config; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import javax.sql.DataSource; -import org.apache.ibatis.io.VFS; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.util.ClassUtils; -import com.evo.common.utils.StringUtils; - -/** - * Mybatis支持*匹配扫描包 - * - * @author evo - */ -@Configuration -public class MyBatisConfig -{ - @Autowired - private Environment env; - - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; - - public static String setTypeAliasesPackage(String typeAliasesPackage) - { - ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); - List allResult = new ArrayList(); - try - { - for (String aliasesPackage : typeAliasesPackage.split(",")) - { - List result = new ArrayList(); - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; - Resource[] resources = resolver.getResources(aliasesPackage); - if (resources != null && resources.length > 0) - { - MetadataReader metadataReader = null; - for (Resource resource : resources) - { - if (resource.isReadable()) - { - metadataReader = metadataReaderFactory.getMetadataReader(resource); - try - { - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - } - } - } - if (result.size() > 0) - { - HashSet hashResult = new HashSet(result); - allResult.addAll(hashResult); - } - } - if (allResult.size() > 0) - { - typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); - } - else - { - throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); - } - } - catch (IOException e) - { - e.printStackTrace(); - } - return typeAliasesPackage; - } - - public Resource[] resolveMapperLocations(String[] mapperLocations) - { - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); - List resources = new ArrayList(); - if (mapperLocations != null) - { - for (String mapperLocation : mapperLocations) - { - try - { - Resource[] mappers = resourceResolver.getResources(mapperLocation); - resources.addAll(Arrays.asList(mappers)); - } - catch (IOException e) - { - // ignore - } - } - } - return resources.toArray(new Resource[resources.size()]); - } - - @Bean - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception - { - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); - String mapperLocations = env.getProperty("mybatis.mapperLocations"); - String configLocation = env.getProperty("mybatis.configLocation"); - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); - VFS.addImplClass(SpringBootVFS.class); - - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setTypeAliasesPackage(typeAliasesPackage); - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); - return sessionFactory.getObject(); - } -} +//package com.evo.framework.config; +// +//import java.io.IOException; +//import java.util.ArrayList; +//import java.util.Arrays; +//import java.util.HashSet; +//import java.util.List; +//import javax.sql.DataSource; +//import org.apache.ibatis.io.VFS; +//import org.apache.ibatis.session.SqlSessionFactory; +//import org.mybatis.spring.SqlSessionFactoryBean; +//import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.core.env.Environment; +//import org.springframework.core.io.DefaultResourceLoader; +//import org.springframework.core.io.Resource; +//import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +//import org.springframework.core.io.support.ResourcePatternResolver; +//import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +//import org.springframework.core.type.classreading.MetadataReader; +//import org.springframework.core.type.classreading.MetadataReaderFactory; +//import org.springframework.util.ClassUtils; +//import com.evo.common.utils.StringUtils; +// +///** +// * Mybatis支持*匹配扫描包 +// * +// * @author evo +// */ +//@Configuration +//public class MyBatisConfig +//{ +// @Autowired +// private Environment env; +// +// static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; +// +// public static String setTypeAliasesPackage(String typeAliasesPackage) +// { +// ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); +// MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); +// List allResult = new ArrayList(); +// try +// { +// for (String aliasesPackage : typeAliasesPackage.split(",")) +// { +// List result = new ArrayList(); +// aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +// + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; +// Resource[] resources = resolver.getResources(aliasesPackage); +// if (resources != null && resources.length > 0) +// { +// MetadataReader metadataReader = null; +// for (Resource resource : resources) +// { +// if (resource.isReadable()) +// { +// metadataReader = metadataReaderFactory.getMetadataReader(resource); +// try +// { +// result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); +// } +// catch (ClassNotFoundException e) +// { +// e.printStackTrace(); +// } +// } +// } +// } +// if (result.size() > 0) +// { +// HashSet hashResult = new HashSet(result); +// allResult.addAll(hashResult); +// } +// } +// if (allResult.size() > 0) +// { +// typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); +// } +// else +// { +// throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); +// } +// } +// catch (IOException e) +// { +// e.printStackTrace(); +// } +// return typeAliasesPackage; +// } +// +// public Resource[] resolveMapperLocations(String[] mapperLocations) +// { +// ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); +// List resources = new ArrayList(); +// if (mapperLocations != null) +// { +// for (String mapperLocation : mapperLocations) +// { +// try +// { +// Resource[] mappers = resourceResolver.getResources(mapperLocation); +// resources.addAll(Arrays.asList(mappers)); +// } +// catch (IOException e) +// { +// // ignore +// } +// } +// } +// return resources.toArray(new Resource[resources.size()]); +// } +// +// @Bean +// public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception +// { +// String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); +// String mapperLocations = env.getProperty("mybatis.mapperLocations"); +// String configLocation = env.getProperty("mybatis.configLocation"); +// typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); +// VFS.addImplClass(SpringBootVFS.class); +// +// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); +// sessionFactory.setDataSource(dataSource); +// sessionFactory.setTypeAliasesPackage(typeAliasesPackage); +// sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); +// sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); +// return sessionFactory.getObject(); +// } +//} diff --git a/evo-admin/src/main/java/com/evo/framework/websocket/WebSocketServer.java b/evo-admin/src/main/java/com/evo/framework/websocket/WebSocketServer.java index 670f970..c8f7445 100644 --- a/evo-admin/src/main/java/com/evo/framework/websocket/WebSocketServer.java +++ b/evo-admin/src/main/java/com/evo/framework/websocket/WebSocketServer.java @@ -3,6 +3,7 @@ package com.evo.framework.websocket; import com.alibaba.fastjson2.JSONObject; import com.evo.common.constant.Constants; import com.evo.equipment.domain.EqSnDetail; +import com.evo.equipment.service.IEqButtonService; import com.evo.equipment.service.IEqSnDetailService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,6 +27,8 @@ public class WebSocketServer{ private static IEqSnDetailService snDetailService; + private static IEqButtonService qButtonService; + @Autowired public void setBrandService(IEqSnDetailService snDetailService) { WebSocketServer.snDetailService = snDetailService; @@ -112,6 +115,7 @@ public class WebSocketServer{ String s = "{\"cmd\":\"pong\"}"; //单发user 返回 pong WebSocketUsers.sendMessageToUserByText(session,s); + return; } if(null != cmd&&cmd.equals("declare")){ //客户端声明,判断设备信息表中是否有此设备的信息,如果有则修改,如果没有则新增 @@ -158,6 +162,7 @@ public class WebSocketServer{ //添加 snDetailService.insertEqSnDetail(snDetail); } + qButtonService.sendButton(snDetail); }else{ //接受设备端返回的数据,先不做处理 System.out.println("设备返回信息:"+message); diff --git a/evo-admin/src/main/java/com/evo/system/controller/CommonController.java b/evo-admin/src/main/java/com/evo/system/controller/CommonController.java index 917e9ad..f7f1d62 100644 --- a/evo-admin/src/main/java/com/evo/system/controller/CommonController.java +++ b/evo-admin/src/main/java/com/evo/system/controller/CommonController.java @@ -1,17 +1,23 @@ package com.evo.system.controller; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import com.evo.common.annotation.Anonymous; +import com.evo.common.core.domain.entity.RzUpload; +import com.evo.common.utils.ip.IpUtils; +import com.evo.system.service.RzUploadService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.evo.common.config.EvoConfig; import com.evo.common.constant.Constants; @@ -34,6 +40,8 @@ public class CommonController @Autowired private ServerConfig serverConfig; + @Autowired + private RzUploadService rzUploadService; private static final String FILE_DELIMETER = ","; @@ -69,10 +77,45 @@ public class CommonController } } + @PostMapping("/upload/{type}") + @ResponseBody + @Anonymous + public AjaxResult uploadPDF(@PathVariable("type") String type, @RequestParam("file") MultipartFile file){ + try + { + // 上传文件路径 + String filePath = EvoConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + RzUpload upload = new RzUpload(); + upload.setType(type); + upload.setUrl(url); + upload.setFileName(fileName); + upload.setNewFileName(FileUtils.getName(fileName)); + upload.setOriginalFileName(file.getOriginalFilename()); + upload.setValid("valid"); + upload.setUploadIp(IpUtils.getIpAddr()); + rzUploadService.insertUpload(upload); + + AjaxResult ajax = AjaxResult.success(); + ajax.put("fileId", upload.getId()); + ajax.put("url", upload.getUrl()); + ajax.put("fileName", upload.getFileName()); + ajax.put("newFileName", upload.getNewFileName()); + ajax.put("originalFilename", upload.getOriginalFileName()); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } /** * 通用上传请求(单个) */ @PostMapping("/upload") + @Anonymous public AjaxResult uploadFile(MultipartFile file) throws Exception { try diff --git a/evo-admin/src/main/java/com/evo/system/domain/SysStaff.java b/evo-admin/src/main/java/com/evo/system/domain/SysStaff.java index 427c70f..6837f3d 100644 --- a/evo-admin/src/main/java/com/evo/system/domain/SysStaff.java +++ b/evo-admin/src/main/java/com/evo/system/domain/SysStaff.java @@ -2,6 +2,7 @@ package com.evo.system.domain; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.evo.common.annotation.Excel; @@ -13,6 +14,7 @@ import com.evo.common.core.domain.BaseEntity; * @author evo * @date 2024-11-21 */ +@Data public class SysStaff extends BaseEntity { private static final long serialVersionUID = 1L; @@ -168,353 +170,18 @@ public class SysStaff extends BaseEntity private String isLeader; //是领导 - public String getSocialSubsidy() { - return socialSubsidy; - } - - public void setSocialSubsidy(String socialSubsidy) { - this.socialSubsidy = socialSubsidy; - } - - public String getIsLeader() { - return isLeader; - } - - public void setIsLeader(String isLeader) { - this.isLeader = isLeader; - } - - public String getCompanyName() { - return companyName; - } - - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setDeptId(Long deptId) - { - this.deptId = deptId; - } - - public Long getDeptId() - { - return deptId; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setIdCard(String idCard) - { - this.idCard = idCard; - } - - public String getIdCard() - { - return idCard; - } - public void setSex(String sex) - { - this.sex = sex; - } - - public String getSex() - { - return sex; - } - public void setAge(Long age) - { - this.age = age; - } - - public Long getAge() - { - return age; - } - public void setPhone(String phone) - { - this.phone = phone; - } - - public String getPhone() - { - return phone; - } - public void setAddress(String address) - { - this.address = address; - } - - public String getAddress() - { - return address; - } - public void setLevel(String level) - { - this.level = level; - } - - public String getLevel() - { - return level; - } - public void setMajor(String major) - { - this.major = major; - } - - public String getMajor() - { - return major; - } - public void setSchool(String school) - { - this.school = school; - } - - public String getSchool() - { - return school; - } - public void setBankNumber(String bankNumber) - { - this.bankNumber = bankNumber; - } - - public String getBankNumber() - { - return bankNumber; - } - public void setBank(String bank) - { - this.bank = bank; - } - - public String getBank() - { - return bank; - } - public void setEmploymentDate(Date employmentDate) - { - this.employmentDate = employmentDate; - } - - public Date getEmploymentDate() - { - return employmentDate; - } - public void setExperience(String experience) - { - this.experience = experience; - } - - public String getExperience() - { - return experience; - } - public void setWorkerTerm(Long workerTerm) - { - this.workerTerm = workerTerm; - } - - public Long getWorkerTerm() - { - return workerTerm; - } - public void setRegularDate(Date regularDate) - { - this.regularDate = regularDate; - } - - public Date getRegularDate() - { - return regularDate; - } - public void setQuitDate(Date quitDate) - { - this.quitDate = quitDate; - } - - public Date getQuitDate() - { - return quitDate; - } - public void setContractStart(Date contractStart) - { - this.contractStart = contractStart; - } - - public Date getContractStart() - { - return contractStart; - } - public void setContractEnd(Date contractEnd) - { - this.contractEnd = contractEnd; - } - - public Date getContractEnd() - { - return contractEnd; - } - public void setContractType(String contractType) - { - this.contractType = contractType; - } - - public String getContractType() - { - return contractType; - } - public void setSocialType(String socialType) - { - this.socialType = socialType; - } - - public String getSocialType() - { - return socialType; - } - public void setSeniority(Long seniority) - { - this.seniority = seniority; - } - - public Long getSeniority() - { - return seniority; - } - public void setIsOvertimePay(String isOvertimePay) - { - this.isOvertimePay = isOvertimePay; - } - - public String getIsOvertimePay() - { - return isOvertimePay; - } - public void setZsFlag(String zsFlag) - { - this.zsFlag = zsFlag; - } - - public String getZsFlag() - { - return zsFlag; - } - public void setSecrecy(String secrecy) - { - this.secrecy = secrecy; - } - - public String getSecrecy() - { - return secrecy; - } - public void setInjury(String injury) - { - this.injury = injury; - } - - public String getInjury() - { - return injury; - } - public void setInsurance(String insurance) - { - this.insurance = insurance; - } - - public String getInsurance() - { - return insurance; - } - public void setIntroducer(String introducer) - { - this.introducer = introducer; - } - - public String getIntroducer() - { - return introducer; - } - public void setClockIn(String clockIn) - { - this.clockIn = clockIn; - } - - public String getClockIn() - { - return clockIn; - } - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - - public Date getWagesRatioDate() { - return wagesRatioDate; - } - - public void setWagesRatioDate(Date wagesRatioDate) { - this.wagesRatioDate = wagesRatioDate; - } - - public void setRemarks(String remarks) - { - this.remarks = remarks; - } - - public String getRemarks() - { - return remarks; - } - public void setDelFlag(String delFlag) - { - this.delFlag = delFlag; - } - - public String getDelFlag() - { - return delFlag; - } + /*** + * 文件Id + */ + private Long fileId; + /*** + * 文件位置 + */ + private String imageUrl; + /*** + * 打卡位置 + */ + private String timeClock; @Override public String toString() { diff --git a/evo-admin/src/main/java/com/evo/system/mapper/RzUploadMapper.java b/evo-admin/src/main/java/com/evo/system/mapper/RzUploadMapper.java new file mode 100644 index 0000000..869d8f4 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/mapper/RzUploadMapper.java @@ -0,0 +1,38 @@ +package com.evo.system.mapper; + +import com.evo.common.core.domain.entity.RzUpload; +import com.evo.common.core.domain.entity.SysDept; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 部门管理 数据层 + * + * @author evo + */ +public interface RzUploadMapper +{ + /** + * 新增文件信息 + * @return 结果 + */ + public int insertUpload(RzUpload upload); + /** + * 修改文件的业务信息 + * @return 结果 + */ + public int updateUploadBusinessId(RzUpload upload); + /*** + * 修改标识 + * @param upload + * @return + */ + public int updateUploadValidByBusinessId(RzUpload upload); + /*** + * 根据id查询 + * @param id + * @return + */ + public RzUpload selectById(Long id); +} diff --git a/evo-admin/src/main/java/com/evo/system/service/RzUploadService.java b/evo-admin/src/main/java/com/evo/system/service/RzUploadService.java new file mode 100644 index 0000000..8d8f460 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/service/RzUploadService.java @@ -0,0 +1,38 @@ +package com.evo.system.service; + +import com.evo.common.core.domain.TreeSelect; +import com.evo.common.core.domain.entity.RzUpload; +import com.evo.common.core.domain.entity.SysDept; + +import java.util.List; + +/** + * 公共上传 服务层 + * + * @author evo + */ +public interface RzUploadService +{ + + /** + * 查询文件信息 + * + * @return 结果 + */ + public RzUpload selectById(Long id); + + /** + * 新增文件信息 + * + * @return 结果 + */ + public int insertUpload(RzUpload upload); + + /** + * 修改保存文件信息 + * + * @return 结果 + */ + public int updateUploadBusinessId(RzUpload upload); + +} diff --git a/evo-admin/src/main/java/com/evo/system/service/impl/RzUploadServiceImpl.java b/evo-admin/src/main/java/com/evo/system/service/impl/RzUploadServiceImpl.java new file mode 100644 index 0000000..7e506ac --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/service/impl/RzUploadServiceImpl.java @@ -0,0 +1,69 @@ +package com.evo.system.service.impl; + +import com.evo.common.annotation.DataScope; +import com.evo.common.constant.UserConstants; +import com.evo.common.core.domain.TreeSelect; +import com.evo.common.core.domain.entity.RzUpload; +import com.evo.common.core.domain.entity.SysDept; +import com.evo.common.core.domain.entity.SysRole; +import com.evo.common.core.domain.entity.SysUser; +import com.evo.common.core.text.Convert; +import com.evo.common.exception.ServiceException; +import com.evo.common.utils.SecurityUtils; +import com.evo.common.utils.StringUtils; +import com.evo.common.utils.spring.SpringUtils; +import com.evo.system.mapper.RzUploadMapper; +import com.evo.system.mapper.SysDeptMapper; +import com.evo.system.mapper.SysRoleMapper; +import com.evo.system.service.ISysDeptService; +import com.evo.system.service.RzUploadService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 部门管理 服务实现 + * + * @author evo + */ +@Service +public class RzUploadServiceImpl implements RzUploadService +{ + @Resource + private RzUploadMapper rzUploadMapper; + + @Override + public RzUpload selectById(Long id) { + return rzUploadMapper.selectById(id); + } + + /** + * 新增保存上传信息 + * + * @return 结果 + */ + @Override + public int insertUpload(RzUpload upload) + { + return rzUploadMapper.insertUpload(upload); + } + + /** + * 修改保存上传信息 + * + * @return 结果 + */ + @Override + public int updateUploadBusinessId(RzUpload upload) + { + rzUploadMapper.updateUploadBusinessId(upload); + upload.setValid("valid"); + rzUploadMapper.updateUploadValidByBusinessId(upload); + return 1; + } + +} diff --git a/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffServiceImpl.java b/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffServiceImpl.java index d60a6ad..996f816 100644 --- a/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffServiceImpl.java @@ -10,6 +10,8 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; + +import com.alibaba.fastjson2.JSONObject; import com.evo.attendance.domain.RzAttendance; import com.evo.attendance.domain.RzAttendanceStatistical; import com.evo.attendance.mapper.RzAttendanceMapper; @@ -17,12 +19,17 @@ import com.evo.attendance.mapper.RzAttendanceStatisticalMapper; import com.evo.common.annotation.DataScope; import com.evo.common.constant.Constants; import com.evo.common.core.domain.AjaxResult; +import com.evo.common.core.domain.entity.RzUpload; import com.evo.common.core.domain.entity.SysDept; import com.evo.common.core.domain.entity.SysDictData; import com.evo.common.utils.DateUtils; import com.evo.common.utils.SecurityUtils; import com.evo.common.utils.StringUtils; import com.evo.common.utils.bean.BeanUtils; +import com.evo.common.utils.ip.IpUtils; +import com.evo.equipment.domain.vo.StaffData; +import com.evo.equipment.domain.vo.StaffDto; +import com.evo.framework.websocket.WebSocketUsers; import com.evo.personnelMatters.domain.RzHoliday; import com.evo.personnelMatters.domain.RzSubsidy; import com.evo.personnelMatters.mapper.RzHolidayMapper; @@ -37,7 +44,10 @@ import com.evo.system.mapper.SysDictDataMapper; import com.evo.system.mapper.SysStaffDetailMapper; import com.evo.system.mapper.SysStaffMapper; import com.evo.system.service.ISysStaffService; +import com.evo.system.service.RzUploadService; import com.evo.utils.DateUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; @@ -53,6 +63,7 @@ import javax.annotation.Resource; * @author evo * @date 2024-11-21 */ +@Slf4j @Service public class SysStaffServiceImpl implements ISysStaffService { @@ -74,6 +85,8 @@ public class SysStaffServiceImpl implements ISysStaffService private RzHolidayMapper rzHolidayMapper; //假期 @Resource private RzRestaurantStatisticsMapper rzRestaurantStatisticsMapper; //餐饮统计 + @Resource + private RzUploadService rzUploadService; //餐饮统计 /** * 查询员工管理 * @@ -124,18 +137,13 @@ public class SysStaffServiceImpl implements ISysStaffService sysDept.setLeader(sysStaff.getName()); int i = deptMapper.updateDept(sysDept); if(i < 1){ - return AjaxResult.error(); + return AjaxResult.error("更新部门负责人失败"); } } //根据省份证确定性别和年龄 - Long year = Long.parseLong(sysStaff.getIdCard().substring(6,10)); - Long age = Long.parseLong(new SimpleDateFormat("yyyy").format(new Date())) - year; - sysStaff.setAge(age); - if(Integer.parseInt(sysStaff.getIdCard().substring(16,17)) % 2 == 0){ - sysStaff.setSex("1"); - }else{ - sysStaff.setSex("0"); - } + sysStaff.setAge(Long.parseLong(new SimpleDateFormat("yyyy").format(new Date())) - Long.parseLong(sysStaff.getIdCard().substring(6,10))); + //性别 + sysStaff.setSex((Integer.parseInt(sysStaff.getIdCard().substring(16,17)) % 2 == 0) ? "1" : "0"); //员工编码 sysStaff.setCode(getCodeByCompanyName(sysStaff.getCompanyName())); sysStaff.setSeniority(0l); @@ -145,16 +153,71 @@ public class SysStaffServiceImpl implements ISysStaffService sysStaff.setDelFlag(Constants.DELETE_FLAG_0); int i = sysStaffMapper.insertSysStaff(sysStaff); if(i < 1){ - return AjaxResult.error(); + return AjaxResult.error("员工添加失败"); } + //员工详情 createStaffDetail(sysStaff); //打卡统计,打卡详情 createRzAttendance(sysStaff); + //处理餐饮信息 createRestaurantStatistics(sysStaff); - + //处理考勤机相关信息 + initCheckDevice(sysStaff); return AjaxResult.success(); } + + + private void initCheckDevice(SysStaff sysStaff){ + //如果文件Id不为空, 则需要更新打卡设备信息, 完成后, 同步更新图片的业务Id数据 + if(ObjectUtils.isNotEmpty(sysStaff.getFileId())){ + RzUpload upload = null; + try { + upload = rzUploadService.selectById(sysStaff.getFileId()); + upload.setBusinessId(sysStaff.getUserId()); + rzUploadService.updateUploadBusinessId(upload); + } catch (Exception e) { + log.error("处理上传照片信息出现错误", e); + } + /** 上传打卡机 */ + //需要返回的对象 + StaffDto cau = new StaffDto(); + //发送的数据 + StaffData caud = new StaffData(); + //定义公共打卡机 + List dkj_list = new ArrayList(); + dkj_list.add(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE); //食堂 + dkj_list.add(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE); //公共 + dkj_list.add(sysStaff.getTimeClock()); + + for (String s : dkj_list) { + //该接口固定为to_device,发送给设备用于识别对应哪个指令 + cau.setCmd("to_device"); + //无用值,空串 + cau.setForm(""); + //设备号 + cau.setTo(s); + //给服务端预留的补充字段,设备端不处理这个字段内容。设备在响应这条指令时原样返回 + cau.setExtra(""); + //发送的数据 + caud.setCmd("addUser"); + caud.setUser_id(sysStaff.getUserId()+""); + caud.setName(sysStaff.getName()); + caud.setTts_name(""); + caud.setFace_template(IpUtils.getServerUrl()+ upload.getFileName()); + caud.setEffect_time(""); + caud.setId_valid(""); + caud.setIc(""); + caud.setPhone(""); + caud.setMode(0); + cau.setData(caud); + //调用websocket,推送给设备 + WebSocketUsers.sendMessageToUsersByText(JSONObject.toJSONString(cau)); + } + } + } + + /** * 创建员工详情信息 * @param sysStaff @@ -165,34 +228,48 @@ public class SysStaffServiceImpl implements ISysStaffService if(StringUtils.isNull(sysStaffDetail)){ sysStaffDetail = new SysStaffDetail(); } - //查询学历 - List xl_list = sysDictDataMapper.selectDictDataByType(Constants.SYS_LEVEL); + + //合同补助 + BigDecimal contractSubsidies = new BigDecimal(0); //学历补助 - for (SysDictData sysDictData : xl_list) { - if(sysDictData.getDictValue().equals(sysStaff.getLevel())){ - RzSubsidy rzSubsidy = rzSubsidyMapper.selectRzSubsidyByName(sysDictData.getDictLabel()); - if(StringUtils.isNotNull(rzSubsidy)){ - sysStaffDetail.setLevelOfEducationSubsidies(rzSubsidy.getValue()); - } + BigDecimal levelOfEducationSubsidies = new BigDecimal(0); + //新农合补助 + BigDecimal socialSecuritySubsidies = new BigDecimal(0); + //正式员工 + if("1".equals(sysStaff.getStatus())){ + //查询学历 + String dictLabel = sysDictDataMapper.selectDictLabel(Constants.SYS_LEVEL, sysStaff.getLevel()); + //学历补助 + if(org.apache.commons.lang3.StringUtils.isNotEmpty(dictLabel)){ + RzSubsidy rzSubsidy = rzSubsidyMapper.selectRzSubsidyByName(dictLabel); + if(StringUtils.isNotNull(rzSubsidy)){ + levelOfEducationSubsidies= rzSubsidy.getValue(); + } + } + + //合同补助 1年期合同 + if("1".equals(sysStaff.getContractType())){ + contractSubsidies = new BigDecimal(Constants.SYS_CONTRACT_0); + }else if("3".equals(sysStaff.getContractType())){ //3年期合同 + contractSubsidies = new BigDecimal(Constants.SYS_CONTRACT_1); + } + + //社保补助 判断是否是新农合 ,是社保补助400元 + if("新农合".equals(sysStaff.getSocialType()) && "是".equals(sysStaff.getSocialSubsidy())){ + socialSecuritySubsidies = new BigDecimal(Constants.SYS_SOCIAL_SUBSIDIES); } } - //合同补助 1年期合同 - if("1".equals(sysStaff.getContractType())){ - sysStaffDetail.setContractSubsidies(new BigDecimal(Constants.SYS_CONTRACT_0)); - }else if("3".equals(sysStaff.getContractType())){ //3年期合同 - sysStaffDetail.setContractSubsidies(new BigDecimal(Constants.SYS_CONTRACT_1)); - }else { - sysStaffDetail.setContractSubsidies(new BigDecimal("0.00")); - } - //社保补助 判断是否是新农合 ,是社保补助400元 - if("新农合".equals(sysStaff.getSocialType()) && "是".equals(sysStaff.getSocialSubsidy())){ - sysStaffDetail.setSocialSecuritySubsidies(new BigDecimal(Constants.SYS_SOCIAL_SUBSIDIES)); - }else{ - sysStaffDetail.setSocialSecuritySubsidies(new BigDecimal("0.00")); - } + + sysStaffDetail.setLevelOfEducationSubsidies(levelOfEducationSubsidies); + sysStaffDetail.setContractSubsidies(contractSubsidies); + sysStaffDetail.setSocialSecuritySubsidies(socialSecuritySubsidies); + + if(StringUtils.isNull(sysStaffDetail.getStaffId())){ sysStaffDetail.setStaffId(sysStaff.getUserId()); - sysStaffDetail.setSenioritySubsidies(new BigDecimal(Constants.SYS_SENIORITY_SUBSIDIES)); + //sysStaffDetail.setSenioritySubsidies(new BigDecimal(Constants.SYS_SENIORITY_SUBSIDIES)); + //关于工龄补贴, 初始新增员工, 工龄补贴全部为0 + sysStaffDetail.setSenioritySubsidies(new BigDecimal(0)); sysStaffDetail.setCreateBy(SecurityUtils.getUsername()); sysStaffDetail.setCreateTime(DateUtils.getNowDate()); sysStaffDetail.setDelFlag(Constants.DELETE_FLAG_0); @@ -397,21 +474,19 @@ public class SysStaffServiceImpl implements ISysStaffService SysDept oldDept = deptMapper.selectDeptById(old_staff.getDeptId()); //判断原来为领导,现在不是领导则把旧职位部门负责人反写 if("是".equals(old_staff.getIsLeader())){ - oldDept.setPhone(""); - oldDept.setLeader(""); - }else{ oldDept.setPhone(sysStaff.getPhone()); oldDept.setLeader(sysStaff.getName()); + oldDept.setUpdateTime(DateUtils.getNowDate()); + oldDept.setUpdateBy(SecurityUtils.getUsername()); + int i = deptMapper.updateDeptForLeader(oldDept); + if(i < 1){ + return AjaxResult.error(); + } } - oldDept.setUpdateTime(DateUtils.getNowDate()); - oldDept.setUpdateBy(SecurityUtils.getUsername()); - int i = deptMapper.updateDeptForLeader(oldDept); - if(i < 1){ - return AjaxResult.error(); - } + sysStaff.setUpdateTime(DateUtils.getNowDate()); sysStaff.setUpdateBy(SecurityUtils.getUsername()); - i= sysStaffMapper.updateSysStaff(sysStaff); + int i= sysStaffMapper.updateSysStaff(sysStaff); if(i < 1){ return AjaxResult.error(); } diff --git a/evo-admin/src/main/resources/application-dev.yml b/evo-admin/src/main/resources/application-dev.yml new file mode 100644 index 0000000..7602d53 --- /dev/null +++ b/evo-admin/src/main/resources/application-dev.yml @@ -0,0 +1,89 @@ +# 数据源配置 +spring: + # 服务模块 + devtools: + restart: + enabled: false + # 热部署开关 + redis: + # 地址 + host: 192.168.16.128 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: hbyt2025 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://192.168.5.23:3306/dev_evo_cw_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: yite + #username: root + #password: yj.chen@001 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置连接超时时间 + connectTimeout: 30000 + # 配置网络超时时间 + socketTimeout: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: evo + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true \ No newline at end of file diff --git a/evo-admin/src/main/resources/application-druid.yml b/evo-admin/src/main/resources/application-druid.yml index 1bdd017..d23c368 100644 --- a/evo-admin/src/main/resources/application-druid.yml +++ b/evo-admin/src/main/resources/application-druid.yml @@ -1,5 +1,32 @@ # 数据源配置 spring: + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver @@ -60,4 +87,4 @@ spring: merge-sql: true wall: config: - multi-statement-allow: true + multi-statement-allow: true \ No newline at end of file diff --git a/evo-admin/src/main/resources/application.yml b/evo-admin/src/main/resources/application.yml index 81364e4..e1dd7da 100644 --- a/evo-admin/src/main/resources/application.yml +++ b/evo-admin/src/main/resources/application.yml @@ -50,7 +50,7 @@ spring: # 国际化资源文件路径 basename: i18n/messages profiles: - active: druid + active: dev # 文件上传 servlet: multipart: @@ -58,34 +58,9 @@ spring: max-file-size: 20MB # 设置总上传的文件大小 max-request-size: 300MB - # 服务模块 - devtools: - restart: - # 热部署开关 - enabled: true - # redis 配置 - redis: - # 地址 - host: localhost - # 端口,默认为6379 - port: 6379 - # 数据库索引 - database: 0 - # 密码 - password: - # 连接超时时间 - timeout: 10s - lettuce: - pool: - # 连接池中的最小空闲连接 - min-idle: 0 - # 连接池中的最大空闲连接 - max-idle: 8 - # 连接池的最大数据库连接数 - max-active: 8 - # #连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1ms - + mvc: + pathmatch: + matching-strategy: ant_path_matcher # token配置 token: # 令牌自定义标识 @@ -96,13 +71,22 @@ token: expireTime: 480 # MyBatis配置 -mybatis: +mybatis-plus: # 搜索指定包别名 - typeAliasesPackage: com.evo.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml + # configuration: classpath:mybatis/mybatis-config.xml + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + type-aliases-package: com.evo.**.domain + mapper-locations: classpath*:mapper/**/*Mapper.xml + global-config: + db-config: + id-type: auto + logic-delete-value: 1 + logic-not-delete-value: 0 + check-config-location: false # PageHelper分页插件 pagehelper: diff --git a/evo-admin/src/main/resources/mapper/common/UploadMapper.xml b/evo-admin/src/main/resources/mapper/common/UploadMapper.xml new file mode 100644 index 0000000..d68772b --- /dev/null +++ b/evo-admin/src/main/resources/mapper/common/UploadMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + insert into rz_upload( + id, + type, + business_id, + url, + file_name, + new_file_name, + original_file_name, + upload_ip, + valid, + upload_time + )values( + #{id}, + #{type}, + #{businessId}, + #{url}, + #{fileName}, + #{newFileName}, + #{originalFileName}, + #{uploadIp}, + #{valid}, + now() + ) + + + + update rz_upload + + business_id = #{businessId}, + + where id = #{id} and type=#{type} + + + + update rz_upload + + valid = #{valid}, + + where business_id = #{businessId} and type=#{type} and id != #{id} + + + + diff --git a/evo-admin/src/main/resources/mapper/system/SysStaffMapper.xml b/evo-admin/src/main/resources/mapper/system/SysStaffMapper.xml index 2a083a4..b827725 100644 --- a/evo-admin/src/main/resources/mapper/system/SysStaffMapper.xml +++ b/evo-admin/src/main/resources/mapper/system/SysStaffMapper.xml @@ -47,6 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -124,6 +126,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, social_subsidy, + image_url, + time_clock, #{companyName}, @@ -167,6 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{socialSubsidy}, + #{imageUrl}, + #{timeClock}, @@ -214,6 +220,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, social_subsidy = #{socialSubsidy}, + image_url = #{imageUrl}, + time_clock = #{timeClock}, where user_id = #{userId} diff --git a/evo-admin/target/classes/application-druid.yml b/evo-admin/target/classes/application-druid.yml index 1bdd017..d23c368 100644 --- a/evo-admin/target/classes/application-druid.yml +++ b/evo-admin/target/classes/application-druid.yml @@ -1,5 +1,32 @@ # 数据源配置 spring: + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver @@ -60,4 +87,4 @@ spring: merge-sql: true wall: config: - multi-statement-allow: true + multi-statement-allow: true \ No newline at end of file diff --git a/evo-admin/target/classes/application.yml b/evo-admin/target/classes/application.yml index 81364e4..e1dd7da 100644 --- a/evo-admin/target/classes/application.yml +++ b/evo-admin/target/classes/application.yml @@ -50,7 +50,7 @@ spring: # 国际化资源文件路径 basename: i18n/messages profiles: - active: druid + active: dev # 文件上传 servlet: multipart: @@ -58,34 +58,9 @@ spring: max-file-size: 20MB # 设置总上传的文件大小 max-request-size: 300MB - # 服务模块 - devtools: - restart: - # 热部署开关 - enabled: true - # redis 配置 - redis: - # 地址 - host: localhost - # 端口,默认为6379 - port: 6379 - # 数据库索引 - database: 0 - # 密码 - password: - # 连接超时时间 - timeout: 10s - lettuce: - pool: - # 连接池中的最小空闲连接 - min-idle: 0 - # 连接池中的最大空闲连接 - max-idle: 8 - # 连接池的最大数据库连接数 - max-active: 8 - # #连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1ms - + mvc: + pathmatch: + matching-strategy: ant_path_matcher # token配置 token: # 令牌自定义标识 @@ -96,13 +71,22 @@ token: expireTime: 480 # MyBatis配置 -mybatis: +mybatis-plus: # 搜索指定包别名 - typeAliasesPackage: com.evo.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml + # configuration: classpath:mybatis/mybatis-config.xml + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + type-aliases-package: com.evo.**.domain + mapper-locations: classpath*:mapper/**/*Mapper.xml + global-config: + db-config: + id-type: auto + logic-delete-value: 1 + logic-not-delete-value: 0 + check-config-location: false # PageHelper分页插件 pagehelper: