diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 83e6c5394262f335a78c4f549a3b68caf6d17689..3e58c17b48016b4158dca84f7a3f3d56e1dd4336 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -8,5 +8,6 @@ + \ No newline at end of file diff --git a/wsf-system/pom.xml b/wsf-system/pom.xml index 825a19234756dca4d197ab2f7662917a7257c902..3d34b5ad7dbd9e85473217a82160847980bb260d 100644 --- a/wsf-system/pom.xml +++ b/wsf-system/pom.xml @@ -14,6 +14,29 @@ 2.7.6 + + org.springframework.boot + spring-boot-starter-websocket + + + org.springframework.boot + spring-boot-starter-aop + + + + + + + + pro.fessional + kaptcha + 2.3.3 + + + cn.hutool + hutool-all + 5.8.27 + com.alibaba.fastjson2 fastjson2 @@ -76,6 +99,11 @@ spring-boot-starter-test test + + com.aliyun + alibabacloud-dysmsapi20170525 + 3.0.0 + diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java deleted file mode 100644 index 07309fb3fe526d0e96e8459a10bfbb013e2422cb..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.tedu.wsf.area.mapper; - -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface AreaMapper { - List queryProvince(); - List queryCity(Long parentId); - List queryCounty(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java deleted file mode 100644 index f7b5bf4e388592bc0511d5ab15e8e46683f52b45..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class City { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省id") - private Long parentId; - @ApiModelProperty(value = "市名") - private String cityName; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java deleted file mode 100644 index e91b85c2e3d28cbe52d5c4a2cf25e1a81e111d8c..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class County { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "市id") - private Long parentId; - @ApiModelProperty(value = "县名") - private String countyeName; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java deleted file mode 100644 index cbfb530b914fa4cab94fae296ee7cd9b9ca29272..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.tedu.wsf.area.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class Province { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省名") - private String provinceName; - @ApiModelProperty(value = "状态") - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java deleted file mode 100644 index b08089d724c19b19f6557eb461853e0153c227c9..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class CityVo { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省id") - private Long parentId; - @ApiModelProperty(value = "市名") - private String cityname; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java deleted file mode 100644 index 42d20ba449483f950e9d31738abbe5dee82b0e17..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class CountyVo { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "市id") - private Long parentId; - @ApiModelProperty(value = "县名") - private String countyname; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java deleted file mode 100644 index c68dabd6798b7fe98e89fab10eec23061476a65c..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.tedu.wsf.area.pojo.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class ProvinceVo { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省名") - private String provincename; - @ApiModelProperty(value = "状态") - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java b/wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java deleted file mode 100644 index 0f89cfdccc45c9d099f42c791e707d3b11a97f9f..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.tedu.wsf.area.service; - -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; - -import java.util.List; - -public interface AreaService { - List queryProvince(); - List queryCity(Long parentId); - List queryCounty(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java deleted file mode 100644 index af4bef4c9903167de5a8b1098eae92f4e48eb42e..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.tedu.wsf.area.service.impl; - -import cn.tedu.wsf.area.mapper.AreaMapper; -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; -import cn.tedu.wsf.area.service.AreaService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -@Service -public class AreaServiceImpl implements AreaService { - @Autowired - AreaMapper areaMapper; - @Override - public List queryProvince() { - List provinceVos = areaMapper.queryProvince(); - return provinceVos; - } - - @Override - public List queryCity(Long parentId) { - List cityVos = areaMapper.queryCity(parentId); - return cityVos; - } - - @Override - public List queryCounty(Long parentId) { - List countyVos = areaMapper.queryCounty(parentId); - return countyVos; - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d1a64b6baceb94eb787a6600047125cffdb4ebd4 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java @@ -0,0 +1,80 @@ +package cn.tedu.wsf.base.config; + +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + +import static com.google.code.kaptcha.Constants.*; + +@Configuration +public class CaptchaConfig +{ + @Bean(name = "captchaProducer") + public DefaultKaptcha getKaptchaBean() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } + + @Bean(name = "captchaProducerMath") + public DefaultKaptcha getKaptchaBeanMath() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 边框颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); + // 验证码文本生成器 + properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "cn.tedu.wsf.base.config.KaptchaTextCreator"); + // 验证码文本字符间距 默认为2 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 验证码噪点颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); + // 干扰实现类 + properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java new file mode 100644 index 0000000000000000000000000000000000000000..011361ff08802f20c159b1f3cce3afeb36e7a29e --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java @@ -0,0 +1,67 @@ +package cn.tedu.wsf.base.config; + +import com.google.code.kaptcha.text.impl.DefaultTextCreator; + +import java.util.Random; + +/** + * 验证码文本生成器 + */ +public class KaptchaTextCreator extends DefaultTextCreator +{ + private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); + + @Override + public String getText() + { + Integer result = 0; + Random random = new Random(); + int x = random.nextInt(10); + int y = random.nextInt(10); + StringBuilder suChinese = new StringBuilder(); + int randomoperands = random.nextInt(3); + if (randomoperands == 0) + { + result = x * y; + suChinese.append(CNUMBERS[x]); + suChinese.append("*"); + suChinese.append(CNUMBERS[y]); + } + else if (randomoperands == 1) + { + if ((x != 0) && y % x == 0) + { + result = y / x; + suChinese.append(CNUMBERS[y]); + suChinese.append("/"); + suChinese.append(CNUMBERS[x]); + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + } + else + { + if (x >= y) + { + result = x - y; + suChinese.append(CNUMBERS[x]); + suChinese.append("-"); + suChinese.append(CNUMBERS[y]); + } + else + { + result = y - x; + suChinese.append(CNUMBERS[y]); + suChinese.append("-"); + suChinese.append(CNUMBERS[x]); + } + } + suChinese.append("=?@" + result); + return suChinese.toString(); + } +} \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java index 740e3264fb8c04f0adc0d71e6e2cab24b7c56885..b557a65478214403b21dc7805e6f8f7b29794e88 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java @@ -34,9 +34,9 @@ public class Knife4jConfig { private ApiInfo apiInfo() { return new ApiInfoBuilder() // 文档标题 - .title("王师傅家具服务平台") + .title("王师傅上门服务平台") // 文档描述信息 - .description("王师傅家具服务平台在线API文档") + .description("王师傅上门服务平台在线API文档") // 文档版本号 .version("1.0") .build(); diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java index f401a9250a4bee1239d0f3cd33502e550565428e..f9a99bd92ff2079317fc4d65beee6fd15d9fe159 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java @@ -12,15 +12,6 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration public class RedisConfig { -// @Bean -// public RedisTemplate redisTemplate(RedisConnectionFactory redisFactory) -// { -// RedisTemplate redisTemplate = new RedisTemplate(); -// redisTemplate.setConnectionFactory(redisFactory); -// redisTemplate.setKeySerializer(RedisSerializer.string()); -// redisTemplate.setValueSerializer(RedisSerializer.json()); -// return redisTemplate; -// } @Bean @SuppressWarnings(value = { "unchecked", "rawtypes" }) public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java index 87541a2b65e39b847ce27a98f0cfd99f695a5f71..16d004ee145a941ec089aa6726d80df0d40391dd 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java @@ -1,22 +1,21 @@ package cn.tedu.wsf.base.config; import cn.tedu.wsf.base.service.impl.AuthenticationEntryPointImpl; -import cn.tedu.wsf.filter.JwtAuthenticationFilter; +import cn.tedu.wsf.base.filter.JwtAuthenticationFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.filter.CorsFilter; + @EnableWebSecurity @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @@ -24,6 +23,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { private JwtAuthenticationFilter jwtAuthenticationFilter; @Autowired private AuthenticationEntryPointImpl authenticationEntryPoint; + @Autowired + CorsFilter corsFilter; @Bean public PasswordEncoder passwordEncoder(){ @@ -40,17 +41,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .csrf().disable(); http .authorizeRequests() - .antMatchers("/wsf/user/login").anonymous() - .antMatchers("/wsf/user/register").permitAll() + .antMatchers("/wsf/user/login","/wsf/notice","/captchaImage","/wsf/user/messagelogin").anonymous() + .antMatchers("/wsf/user/register","/wsf/file/upload").permitAll() + .antMatchers("/wsf/user/send").anonymous() .anyRequest().authenticated(); // 其他路径需要认证' http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.addFilterBefore(jwtAuthenticationFilter,UsernamePasswordAuthenticationFilter.class); http.exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint); + http.addFilterBefore(corsFilter, JwtAuthenticationFilter.class); } @Override public void configure(WebSecurity web) throws Exception { - web.ignoring().antMatchers("/*.html","/v2/**","/swagger-ui.html","/doc.html","/swagger-resources/**", "/webjars/**"); + web.ignoring().antMatchers("/*.html","/v2/**","/swagger-ui.html","/doc.html","/swagger-resources/**", "/webjars/**","/swagger-resources/**"); } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..7bf4574525a9db2b3fe63b222c38bbe67cbb88a6 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java @@ -0,0 +1,117 @@ +package cn.tedu.wsf.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "wsf") +public class SystemConfig +{ + /** 项目名称 */ + private String name; + + /** 版本 */ + private String version; + + /** 版权年份 */ + private String copyrightYear; + + /** 上传路径 */ + private static String profile; + + /** 获取地址开关 */ + private static boolean addressEnabled; + + /** 验证码类型 */ + private static String captchaType; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getCopyrightYear() + { + return copyrightYear; + } + + public void setCopyrightYear(String copyrightYear) + { + this.copyrightYear = copyrightYear; + } + + public static String getProfile() + { + return profile; + } + + public void setProfile(String profile) + { + SystemConfig.profile = profile; + } + + public static boolean isAddressEnabled() + { + return addressEnabled; + } + + public void setAddressEnabled(boolean addressEnabled) + { + SystemConfig.addressEnabled = addressEnabled; + } + + public static String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + SystemConfig.captchaType = captchaType; + } + + /** + * 获取导入上传路径 + */ + public static String getImportPath() + { + return getProfile() + "/import"; + } + + /** + * 获取头像上传路径 + */ + public static String getAvatarPath() + { + return getProfile() + "/avatar"; + } + + /** + * 获取下载路径 + */ + public static String getDownloadPath() + { + return getProfile() + "/download/"; + } + + /** + * 获取上传路径 + */ + public static String getUploadPath() + { + return getProfile() + "/upload"; + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java index e3a513261ab842bf3393e99f45e42e3bf3da2fd1..6efec429b9e2c5e60e7b90a50dd0cfe6cfde7c40 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java @@ -1,24 +1,38 @@ package cn.tedu.wsf.base.config; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.servlet.http.HttpServletResponse; //1.添加注解 @Configuration -public class WebConfig implements WebMvcConfigurer{//2.implements WebMvcConfigurer - //3.输入addCors,看到提示后回车补全代码 - @Override - public void addCorsMappings(CorsRegistry registry) { - //4.去掉方法体里原有的内容,编写自己的请求策略 - registry.addMapping("/**")// /** 表示在后端允许匹配客户端发过来的任意请求 - .allowedHeaders("*")//请求带任意头都可以 - .allowedMethods("*")//任意请求方式都可以 get/post/put... - .allowedOriginPatterns("*")//任意域都可以(任意请求地址或端口号) - .allowCredentials(true)//请求可以携带会话相关信息(cookie/session) - .maxAge(3600);//同一请求一小时内不再检测 直接放行 +public class WebConfig { + @Bean + public CorsFilter corsFilter() + { + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOriginPattern("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 有效期 1800秒 + config.setMaxAge(1800L); + // 添加映射路径,拦截一切请求 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); + // 返回新的CorsFilter + return new CorsFilter(source); } + } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d4feaed04b066d5751aaa78496e9075dad0d197a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java @@ -0,0 +1,19 @@ +package cn.tedu.wsf.base.config; + + +import cn.tedu.wsf.base.handler.MyWebSocketHandler; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.config.annotation.WebSocketConfigurer; +import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; + +@Configuration +@EnableWebSocket +public class WebSocketConfig implements WebSocketConfigurer { + + @Override + public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { + registry.addHandler(new MyWebSocketHandler(), "/wsf/notice").setAllowedOrigins("*"); + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..c73ab7460c48efbdc74ccebdc5f8a3ebf44a0822 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java @@ -0,0 +1,49 @@ +//package cn.tedu.wsf.base.config; +// +//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.beans.factory.annotation.Value; +// +//@Configuration +//@Slf4j +//public class XxlJobConfig { +// +// @Value("${xxl.job.admin.addresses}") +// private String adminAddresses; +// +// @Value("${xxl.job.executor.appname}") +// private String appName; +// +// /*@Value("${xxl.job.executor.ip}") +// private String ip;*/ +// +// @Value("${xxl.job.executor.port}") +// private int port; +// +// @Value("${xxl.job.accessToken}") +// private String accessToken; +// +// @Value("${xxl.job.executor.logpath}") +// private String logPath; +// +// @Value("${xxl.job.executor.logretentiondays}") +// private int logRetentionDays; +// +// +// @Bean +// public XxlJobSpringExecutor xxlJobExecutor() { +// log.info(">>>>>>>>>>> xxl-job config init."); +// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); +// xxlJobSpringExecutor.setAdminAddresses(adminAddresses); +// xxlJobSpringExecutor.setAppname(appName); +// xxlJobSpringExecutor.setPort(port); +// xxlJobSpringExecutor.setAccessToken(accessToken); +// xxlJobSpringExecutor.setLogPath(logPath); +// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); +// +// return xxlJobSpringExecutor; +// } +// +//} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java b/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java index 386120991a9de92b70d8c77ecbdab0a3df4f68ee..99e8bcc60a133bc57c48491e8bcd2bce1755548a 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java @@ -35,7 +35,7 @@ public class CacheConstants * 验证码 redis key */ public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; - + public static final String PHONE_CODE_KEY = "phone_codes:"; /** * 参数管理 cache key */ diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java deleted file mode 100644 index d694a6aa0c67d355b79de2cb704918f4f98a1ba7..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.tedu.wsf.base.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/*车辆申请单状态枚举*/ -@Getter -@AllArgsConstructor -public enum ApplicationStatusEnum { - PENDING("10","已发起"), - CANCEL("20","撤销"), - AUDIT("30","审核中"), - REJECT("40","驳回"), - AUDITED("50","已审核"), - ALLOCATION("60","已分配用车"), - END("70","工单结束"); - - private String code; - private String msg; -} - - - - - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java deleted file mode 100644 index 592b1aa1f19aaa724225003fe08d11d32e487bab..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.base.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/*车辆审核状态枚举*/ -@Getter -@AllArgsConstructor -public enum AuditStatusEnum { - MY_PENDING("10","待我审核"), - PENDING("20","待他人审核"), - AUDITED("30","已审核"), - REJECT("40","驳回"); - - private String code; - private String msg; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java index bde1701e8f6991722e7356b0c126fee72acb27ac..41beabae5b52cce9d59778c2bae691e373391f3f 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java @@ -11,12 +11,13 @@ public enum StatusCode { SUCCESS(2000, "OK"), LOGIN_SUCCESS(2001, "登录成功"), OPERATION_SUCCESS(2002, "操作成功"), - - + CAPTCHA_ERROR(4001, "验证码错误或过时"), + PHONE_ERROR(4005, "手机验证码错误或过时"), + USER_NOT_EXISTS(4000, "用户不存在"), NOT_LOGIN(4000, "未登录"), PASSWORD_ERROR(4002, "用户名错误"), USERNAME_ERROR(4003, "密码错误"), - + PHONE_CODE_EXIST(4004, "已发送,请等待"), OPERATION_FAILED(5001, "操作失败"), VALIDATE_ERROR(5002, "请求参数错误"), USERNAME_ALREADY_EXISTS(5003, "用户名被占用"), diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/UploadController.java b/wsf-system/src/main/java/cn/tedu/wsf/base/file/UploadController.java similarity index 95% rename from wsf-system/src/main/java/cn/tedu/wsf/base/handler/UploadController.java rename to wsf-system/src/main/java/cn/tedu/wsf/base/file/UploadController.java index baea453726bd8e6916e0e5d048fb10ce589e9c78..5b4282aeb4da5997ac272b625835f9cd01ed4ad6 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/UploadController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/file/UploadController.java @@ -1,5 +1,6 @@ -package cn.tedu.wsf.base.handler; +package cn.tedu.wsf.base.file; +import cn.tedu.wsf.base.handler.JsonResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -17,13 +18,13 @@ import java.util.UUID; @Api("文件上传") @Slf4j @RestController -@RequestMapping("/v1/file") +@RequestMapping("/wsf/file") public class UploadController { /* * 定义方法处理图片上传功能 */ @ApiOperation("上传文件") - @PostMapping("upload") + @PostMapping("/upload") @ApiImplicitParam(name = "file",value="文件路径",required = true) //MultipartFile用来接收上传图片文件的对象 //注意:形参file必须与前端upload上传组件的name一致! @@ -53,7 +54,6 @@ public class UploadController { //10.将图片保存在指定的文件夹中 file.transferTo(new File(filePath)); System.out.println(filePath); - System.out.println("lll"); //11.把日期路径+图片名 响应给前端,前端拿到这个数据后再回显图片 return JsonResult.ok(datePath+fileName); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/filter/JwtAuthenticationFilter.java b/wsf-system/src/main/java/cn/tedu/wsf/base/filter/JwtAuthenticationFilter.java similarity index 90% rename from wsf-system/src/main/java/cn/tedu/wsf/filter/JwtAuthenticationFilter.java rename to wsf-system/src/main/java/cn/tedu/wsf/base/filter/JwtAuthenticationFilter.java index 953c2bcd86b8039382005d247d230c46e61a9578..fa615267498af658a7a757612b440c068a4e6f47 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/filter/JwtAuthenticationFilter.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/filter/JwtAuthenticationFilter.java @@ -1,4 +1,4 @@ -package cn.tedu.wsf.filter; +package cn.tedu.wsf.base.filter; import cn.tedu.wsf.base.service.impl.LoginUser; import cn.tedu.wsf.base.utils.JwtUtils; @@ -17,6 +17,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Enumeration; import java.util.Objects; @Slf4j @Component @@ -27,8 +28,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { RedisUtils redisUtils; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - String token = request.getHeader("token"); - System.out.println("token:"+token); + Enumeration headerNames = request.getHeaderNames(); + String token = request.getHeader("Authorization"); if (!StringUtils.hasText(token)){ filterChain.doFilter(request,response); return; @@ -39,9 +40,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { } String userid = claims.getSubject(); - System.out.println(userid); LoginUser loginUser = (LoginUser) redisUtils.get("login:" + userid); - System.out.println("loginUser"+loginUser); if (Objects.isNull(loginUser)){ throw new RuntimeException("请重新登录"); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java index 00591d410901a607f0fae9a81af2534a60fddaa2..852538425df089751bbd041ee44e696e53756a54 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java @@ -80,7 +80,6 @@ public class GlobalExceptionHandler { */ @ExceptionHandler public JsonResult doHandleMethodArgumentNotValidException(MethodArgumentNotValidException ex) { - //Validation中,验证POJO类型参数获取提示消息使用: ex.getFieldError().getDefaultMessage() 方法. String message = ex.getFieldError().getDefaultMessage(); log.error("MethodArgumentNotValidException: " + message); @@ -95,7 +94,6 @@ public class GlobalExceptionHandler { */ @ExceptionHandler public JsonResult doHandleConstraintViolationException(ConstraintViolationException ex) { - // selectById.id: 微博ID必须在200-500之间 ----> 微博ID必须在200-500之间 String message = ex.getMessage().split(":")[1].trim(); log.error("ConstraintViolationException: " + message); diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..beb3b13c8d53e027d6bfc974926324d518d8f5e3 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java @@ -0,0 +1,57 @@ +package cn.tedu.wsf.base.handler; + +import cn.tedu.wsf.base.utils.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.web.socket.CloseStatus; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +public class MyWebSocketHandler extends TextWebSocketHandler { + @Autowired + RedisUtils redisUtils; + private static final Map sessions = new ConcurrentHashMap<>(); + @Override + public void afterConnectionEstablished(WebSocketSession session) throws Exception { + // 从URL参数中获取userId + String userId = session.getUri().getQuery().split("=")[1]; + if (userId == null) { + throw new IllegalArgumentException("UserId is required"); + } +// redisUtils.set(userId,session); + sessions.put(userId, session); + System.out.println("WebSocket connection established for user: " + sessions); + } + + @Override + public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { + String userId = session.getUri().getQuery().split("=")[1]; +// redisUtils.delete(userId); + System.out.println("WebSocket connection closed for user: " + userId); + } + + // 发送通知的方法 + public void sendNotification(String userId, String notice){ +// WebSocketSession session = (WebSocketSession) redisUtils.get(userId); + WebSocketSession session = sessions.get(userId); + System.out.println("sessions: " + sessions); + if (session != null && session.isOpen()) { + try { + System.out.println("Sending notification to user: " + notice); + session.sendMessage(new TextMessage(notice)); + System.out.println("Sent notification to user: " + userId); + } catch (IOException e) { + // 处理发送失败的情况 + e.printStackTrace(); + } + } + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java index 62ada2824bec04ef5d7d5b4fc5ec30fa58006297..f0749c150b5b1a41db3ed9a24ef5f30d455e89f1 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java @@ -1,58 +1,58 @@ -//package cn.tedu.wsf.base.listener; -// -//import cn.tedu.wsf.base.utils.AddressUtils; -//import cn.tedu.wsf.base.utils.IpUtils; -//import cn.tedu.wsf.base.utils.LoggerUtil; -//import cn.tedu.wsf.base.utils.WebUtil; -//import cn.tedu.wsf.log.pojo.entity.LoginInfor; -//import cn.tedu.wsf.log.service.LoginInforService; -//import lombok.extern.slf4j.Slf4j; -//import nl.bitwalker.useragentutils.Browser; -//import nl.bitwalker.useragentutils.OperatingSystem; -//import nl.bitwalker.useragentutils.UserAgent; -//import org.slf4j.Logger; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.context.ApplicationListener; -//import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; -//import org.springframework.security.core.userdetails.UserDetails; -//import org.springframework.stereotype.Component; -// -//import javax.servlet.http.HttpServletRequest; -//import java.util.Date; -// -//@Slf4j -//@Component -//public class AuthenticationFailureListener implements ApplicationListener { -// @Autowired -// LoginInforService loginInforService; -// private final Logger logger = LoggerUtil.getLogger(AuthenticationFailureListener.class); -// @Override -// public void onApplicationEvent(AbstractAuthenticationFailureEvent event) { -// String username = event.getAuthentication().getName(); -// saveLoginInfor(username); -// } -// private void saveLoginInfor(String username){ -// HttpServletRequest request = WebUtil.getRequest(); -// UserAgent userAgent = -// UserAgent.parseUserAgentString(request.getHeader("User-Agent")); -// // 获取客户端操作系统 -// String os = userAgent.getOperatingSystem().getName(); -// // 获取客户端浏览器 -// String browser = userAgent.getBrowser().getName(); -// System.out.println("os="+os+"browser="+browser); -// //获取ip地址以及位置 -// request.getRemoteAddr(); -// String ip = IpUtils.getIpAddress(request); -// String region= AddressUtils.getIpRegion(ip); -// LoginInfor loginInfor=new LoginInfor(); -// loginInfor.setLoginName(username); -// loginInfor.setBrowser(browser); -// loginInfor.setOs(os); -// loginInfor.setIpaddr(ip); -// loginInfor.setLoginLocation(region); -// loginInfor.setStatus("1"); -// loginInfor.setLoginTime(new Date()); -// loginInfor.setMsg("login error"); -// loginInforService.insert(loginInfor); -// } -//} +package cn.tedu.wsf.base.listener; + +import cn.tedu.wsf.base.utils.AddressUtils; +import cn.tedu.wsf.base.utils.IpUtils; +import cn.tedu.wsf.base.utils.LoggerUtil; +import cn.tedu.wsf.base.utils.WebUtil; +import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.service.LoginInforService; +import lombok.extern.slf4j.Slf4j; +import nl.bitwalker.useragentutils.Browser; +import nl.bitwalker.useragentutils.OperatingSystem; +import nl.bitwalker.useragentutils.UserAgent; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; + +@Slf4j +@Component +public class AuthenticationFailureListener implements ApplicationListener { + @Autowired + LoginInforService loginInforService; + private final Logger logger = LoggerUtil.getLogger(AuthenticationFailureListener.class); + @Override + public void onApplicationEvent(AbstractAuthenticationFailureEvent event) { + String username = event.getAuthentication().getName(); + saveLoginInfor(username); + } + private void saveLoginInfor(String username){ + HttpServletRequest request = WebUtil.getRequest(); + UserAgent userAgent = + UserAgent.parseUserAgentString(request.getHeader("User-Agent")); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + System.out.println("os="+os+"browser="+browser); + //获取ip地址以及位置 + request.getRemoteAddr(); + String ip = IpUtils.getIpAddress(request); + String region= AddressUtils.getIpRegion(ip); + LoginInfor loginInfor=new LoginInfor(); + loginInfor.setUserName(username); + loginInfor.setBrowser(browser); + loginInfor.setOs(os); + loginInfor.setIpaddr(ip); + loginInfor.setLoginLocation(region); + loginInfor.setStatus("1"); + loginInfor.setLoginTime(new Date()); + loginInfor.setMsg("login error"); + loginInforService.insert(loginInfor); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java index 16b023df3bcde6fa6be244784803383be232c7ff..80db461b159c8bdfb2c1850efaa736fcf1fbb7a0 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java @@ -1,60 +1,61 @@ -//package cn.tedu.wsf.base.listener; -// -//import cn.tedu.wsf.base.utils.AddressUtils; -//import cn.tedu.wsf.base.utils.IpUtils; -//import cn.tedu.wsf.base.utils.LoggerUtil; -//import cn.tedu.wsf.base.utils.WebUtil; -//import cn.tedu.wsf.log.pojo.entity.LoginInfor; -//import cn.tedu.wsf.log.service.LoginInforService; -//import lombok.extern.slf4j.Slf4j; -//import nl.bitwalker.useragentutils.UserAgent; -//import org.slf4j.Logger; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.context.ApplicationListener; -//import org.springframework.security.authentication.event.AuthenticationSuccessEvent; -//import org.springframework.security.core.userdetails.UserDetails; -//import org.springframework.stereotype.Component; -// -//import javax.servlet.http.HttpServletRequest; -//import java.util.Date; -// -//@Slf4j -//@Component -//public class AuthenticationSuccessListener implements ApplicationListener { -// -// private final Logger logger = LoggerUtil.getLogger(AuthenticationSuccessListener.class); -// @Autowired -// LoginInforService loginInforService; -// @Override -// public void onApplicationEvent(AuthenticationSuccessEvent event) { -// Object principal = event.getAuthentication().getPrincipal(); -// if(principal instanceof UserDetails){ -// String username=((UserDetails)principal).getUsername(); -// saveLoginInfor(username); -// } -// } -// private void saveLoginInfor(String username){ -// HttpServletRequest request = WebUtil.getRequest(); -// UserAgent userAgent = -// UserAgent.parseUserAgentString(request.getHeader("User-Agent")); -// // 获取客户端操作系统 -// String os = userAgent.getOperatingSystem().getName(); -// // 获取客户端浏览器 -// String browser = userAgent.getBrowser().getName(); -// System.out.println("os="+os+"browser="+browser); -// //获取ip地址以及位置 -// request.getRemoteAddr(); -// String ip = IpUtils.getIpAddress(request); -// String region= AddressUtils.getIpRegion(ip); -// LoginInfor loginInfor=new LoginInfor(); -// loginInfor.setLoginName(username); -// loginInfor.setBrowser(browser); -// loginInfor.setOs(os); -// loginInfor.setIpaddr(ip); -// loginInfor.setLoginLocation(region); -// loginInfor.setStatus("0"); -// loginInfor.setLoginTime(new Date()); -// loginInfor.setMsg("login ok"); -// loginInforService.insert(loginInfor); -// } -//} +package cn.tedu.wsf.base.listener; + +import cn.tedu.wsf.base.utils.AddressUtils; +import cn.tedu.wsf.base.utils.IpUtils; +import cn.tedu.wsf.base.utils.LoggerUtil; +import cn.tedu.wsf.base.utils.WebUtil; +import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.service.LoginInforService; +import lombok.extern.slf4j.Slf4j; +import nl.bitwalker.useragentutils.UserAgent; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.event.AuthenticationSuccessEvent; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; + +@Slf4j +@Component +public class AuthenticationSuccessListener implements ApplicationListener { + + private final Logger logger = LoggerUtil.getLogger(AuthenticationSuccessListener.class); + @Autowired + LoginInforService loginInforService; + @Override + public void onApplicationEvent(AuthenticationSuccessEvent event) { + Object principal = event.getAuthentication().getPrincipal(); + if(principal instanceof UserDetails){ + String username=((UserDetails)principal).getUsername(); + saveLoginInfor(username); + } + } + private void saveLoginInfor(String username){ + HttpServletRequest request = WebUtil.getRequest(); + UserAgent userAgent = + UserAgent.parseUserAgentString(request.getHeader("User-Agent")); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + System.out.println("os="+os+"browser="+browser); + //获取ip地址以及位置 + request.getRemoteAddr(); + String ip = IpUtils.getIpAddress(request); + String region= AddressUtils.getIpRegion(ip); + System.out.println(region+"........................."); + LoginInfor loginInfor=new LoginInfor(); + loginInfor.setUserName(username); + loginInfor.setBrowser(browser); + loginInfor.setOs(os); + loginInfor.setIpaddr(ip); + loginInfor.setLoginLocation(region); + loginInfor.setStatus("0"); + loginInfor.setLoginTime(new Date()); + loginInfor.setMsg("login ok"); + loginInforService.insert(loginInfor); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java b/wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java new file mode 100644 index 0000000000000000000000000000000000000000..91f88b21388cc129dc4cc93d9bd4aa37d4f1c784 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java @@ -0,0 +1,9 @@ +package cn.tedu.wsf.base.pojo.vo; + +import lombok.Data; + +@Data +public class CaptchaVO { + private String uuid; + private String img; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..1f42294553efaf47d5896d9db1449e173e402da7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java @@ -0,0 +1,49 @@ +package cn.tedu.wsf.base.utils; + +import cn.hutool.core.lang.UUID; + +/** + * ID生成器工具类 + */ +public class IdUtils +{ + /** + * 获取随机UUID + * + * @return 随机UUID + */ + public static String randomUUID() + { + return UUID.randomUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线 + * + * @return 简化的UUID,去掉了横线 + */ + public static String simpleUUID() + { + return UUID.randomUUID().toString(true); + } + + /** + * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 随机UUID + */ + public static String fastUUID() + { + return UUID.fastUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 简化的UUID,去掉了横线 + */ + public static String fastSimpleUUID() + { + return UUID.fastUUID().toString(true); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..18d9265120167b769b1bfe0a60ebdb19b77a88d2 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java @@ -0,0 +1,54 @@ +package cn.tedu.wsf.base.utils; + +import cn.tedu.wsf.base.constant.CacheConstants; +import cn.tedu.wsf.base.constant.Constants; +import com.aliyun.auth.credentials.Credential; +import com.aliyun.auth.credentials.provider.StaticCredentialProvider; +import com.aliyun.sdk.service.dysmsapi20170525.AsyncClient; +import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsRequest; +import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponse; +import com.google.gson.Gson; +import darabonba.core.client.ClientOverrideConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Random; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +@Component +public class PhoneMessageUtils { + public int code; + @Autowired + RedisUtils redisUtils; + public void sendVerification(String phone) throws Exception{ + + StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() + .accessKeyId("LTAI5tLJQprLUNVGNBYwqkP5") + .accessKeySecret("PDLk0i2bGeCfTWsUIZlx4quTuq9eSS") + .build()); + AsyncClient client = AsyncClient.builder() + .credentialsProvider(provider) + .overrideConfiguration( + ClientOverrideConfiguration.create() + .setEndpointOverride("dysmsapi.aliyuncs.com") + ) + .build(); + + Random random = new Random(); + code=random.nextInt(9000) + 1000; + redisUtils.setCacheObject(CacheConstants.PHONE_CODE_KEY+phone,code , Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + SendSmsRequest sendSmsRequest = SendSmsRequest.builder() + .phoneNumbers(phone) + .signName("lichangcheng") + .templateCode("SMS_471250283") + .templateParam("{\"code\":\""+code+"\"}") + //.templateParam("{\"code\":\"123456\"}") + .build(); + CompletableFuture response = client.sendSms(sendSmsRequest); + SendSmsResponse resp = response.get(); + System.out.println(new Gson().toJson(resp)); + client.close(); + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java index bac9c54c4d58fad761c298fb9febe0cec53656b1..477d63c059a3b4b91345ebb8965a18d2652bca5d 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java @@ -4,6 +4,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + @Component public class RedisUtils { @Autowired @@ -18,4 +20,12 @@ public class RedisUtils { public void delete(String key) { redisTemplate.delete(key); } + public void setCacheObject(final String key, final String value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } + public void setCacheObject(final String key, final int value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/controller/AreaController.java b/wsf-system/src/main/java/cn/tedu/wsf/category/controller/CategoryController.java similarity index 31% rename from wsf-system/src/main/java/cn/tedu/wsf/area/controller/AreaController.java rename to wsf-system/src/main/java/cn/tedu/wsf/category/controller/CategoryController.java index 165ee6a86e2e826788d0f127954ad302f41cea96..efb40d496026d8a82543f86a49b3964eca980afb 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/controller/AreaController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/controller/CategoryController.java @@ -1,10 +1,8 @@ -package cn.tedu.wsf.area.controller; +package cn.tedu.wsf.category.controller; -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; -import cn.tedu.wsf.area.service.AreaService; import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.service.CategoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -13,31 +11,28 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - -@RestController @Slf4j -@RequestMapping("/wsf/area") -@Api("地区模块") -public class AreaController { +@RestController +@Api("品类模块") +@RequestMapping("/wsf/category") +public class CategoryController { @Autowired - AreaService areaService; - @ApiOperation("查询省份") - @GetMapping("queryprovince") - public JsonResult queryProvince(){ - List provinceVos = areaService.queryProvince(); - return JsonResult.ok(provinceVos); + CategoryService categoryService; + @ApiOperation("加载一级品类") + @GetMapping("/type") + public JsonResult loadType(){ + log.info("加载一级品类"); + Category category=new Category(); + category.setDepth(1); + return JsonResult.ok(categoryService.selectByQueryParam(category)); } - @ApiOperation("查询城市") - @GetMapping("querycity") - public JsonResult queryCity(Long provinceid){ - List cityVos = areaService.queryCity(provinceid); - return JsonResult.ok(cityVos); - } - @ApiOperation("查询县") - @GetMapping("querycounty") - public JsonResult queryCounty(Long cityid){ - List countyVos = areaService.queryCounty(cityid); - return JsonResult.ok(countyVos); + @ApiOperation("加载二级品类") + @GetMapping("/category") + public JsonResult loadCategory(Long categoryId){ + log.info("加载二级品类"); + Category category=new Category(); + category.setParentId(categoryId); + return JsonResult.ok(categoryService.selectByQueryParam(category)); } + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..00378263b6e15fc374871d0d0565cf0783290b97 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java @@ -0,0 +1,18 @@ +package cn.tedu.wsf.category.mapper; + + +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface CategoryMapper { + List selectByQueryParam(Category category); + int deleteWorkerCategory(Long workerId); + int insertWorkerCategory(@Param("workerId") Long workerId, @Param("categoryIds") Long[] categoryIds); + int insertCategory(Category category); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Category.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/dto/CategoryQueryParam.java similarity index 35% rename from wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Category.java rename to wsf-system/src/main/java/cn/tedu/wsf/category/pojo/dto/CategoryQueryParam.java index 5cdb29f050bf24845e3b3fbc2fc8060c63e0bcc4..bffc102b6b454eebc392dcc69b6aa8eb37d980a3 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Category.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/dto/CategoryQueryParam.java @@ -1,17 +1,21 @@ -package cn.tedu.wsf.server.pojo.entity; +package cn.tedu.wsf.category.pojo.dto; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data -public class Category { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "服务id") - private Long parentId; - @ApiModelProperty(value = "技能名") +public class CategoryQueryParam { + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "分类名称") private String categoryName; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "分类级别") + private Integer depth; + @ApiModelProperty(value = "删除标记") + private String delFlag; @ApiModelProperty(value = "状态") private String status; + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java new file mode 100644 index 0000000000000000000000000000000000000000..34def54ce345c265ab78a4959c6f6eb9abd44b83 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java @@ -0,0 +1,32 @@ +package cn.tedu.wsf.category.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Category { + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "分类名称") + private String categoryName; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "分类级别") + private Integer depth; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java new file mode 100644 index 0000000000000000000000000000000000000000..4d8cd7a2f6f0963106e7d6a541b6a9fc60af8167 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.category.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerCategory { + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "师傅ID") + private Long workerId; + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java new file mode 100644 index 0000000000000000000000000000000000000000..8da55e835a25260920bda66f6692e3b84363a8e7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java @@ -0,0 +1,32 @@ +package cn.tedu.wsf.category.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CategoryVo { + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "分类名称") + private String categoryName; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "分类级别") + private Integer depth; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java b/wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java new file mode 100644 index 0000000000000000000000000000000000000000..575272f0187ef7476cd16d6bfa9e24f9407b1f72 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java @@ -0,0 +1,12 @@ +package cn.tedu.wsf.category.service; + + +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; + +import java.util.List; + +public interface CategoryService { + List selectByQueryParam(Category category); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d02e6f4f1206c9f3a578f837e1a0e9e781fe896a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java @@ -0,0 +1,23 @@ +package cn.tedu.wsf.category.service.impl; + +import cn.tedu.wsf.category.mapper.CategoryMapper; +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; +import cn.tedu.wsf.category.service.CategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class CategoryServiceImpl implements CategoryService { + @Autowired + CategoryMapper categoryMapper; + + + @Override + public List selectByQueryParam(Category category) { + return categoryMapper.selectByQueryParam(category); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java b/wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java new file mode 100644 index 0000000000000000000000000000000000000000..b4d01c93c2a50425cf2ac47940d28b011d6d38a7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java @@ -0,0 +1,44 @@ +package cn.tedu.wsf.city.controller; + + +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.city.pojo.dto.CityQueryParam; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import cn.tedu.wsf.city.service.CityService; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@Slf4j +@RequestMapping("/wsf/city") +@Api("地区模块") +public class CityController { + + @Autowired + CityService cityService; + @GetMapping("/query") + public JsonResult queryCityList(CityQueryParam cityQueryParam){ + List cityVOS = cityService.queryCityList(cityQueryParam); + return JsonResult.ok(cityVOS); + } + @GetMapping("/province") + public JsonResult loadProvince(){ + CityQueryParam cityQueryParam=new CityQueryParam(); + cityQueryParam.setDepth(1); + List cityVOS = cityService.queryCityList(cityQueryParam); + return JsonResult.ok(cityVOS); + } + @GetMapping("/city") + public JsonResult loadCity(Long cityId){ + CityQueryParam cityQueryParam=new CityQueryParam(); + cityQueryParam.setParentId(cityId); + List cityVOS = cityService.queryCityList(cityQueryParam); + return JsonResult.ok(cityVOS); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..aee39711e2a11ec7d2cfa20509839e159fadee02 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.city.mapper; + + +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface CityMapper { + List queryCityList(City city); + int deleteWorkerCity(Long workerId); + int insertWorkerCity(@Param("workerId") Long workerId, @Param("cityIds") Long[] cityIds); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..8544ad1ac0e2cd9396df391feed7f0c027379975 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java @@ -0,0 +1,24 @@ +package cn.tedu.wsf.city.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CityQueryParam { + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "城市名称") + private String cityName; + @ApiModelProperty(value = "地址编码") + private String code; + @ApiModelProperty(value = "城市级别") + private Integer depth; + @ApiModelProperty(value = "城市编码") + private String cityCode; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "是否是直辖市") + private Integer isMunicipality; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java new file mode 100644 index 0000000000000000000000000000000000000000..7b59f2a32dcf30f95a905ea0c703a07ddc812858 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java @@ -0,0 +1,37 @@ +package cn.tedu.wsf.city.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class City { + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "城市名称") + private String cityName; + @ApiModelProperty(value = "地址编码") + private String code; + @ApiModelProperty(value = "城市级别") + private Integer depth; + @ApiModelProperty(value = "城市编码") + private String cityCode; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "是否是直辖市") + private Integer isMunicipality; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java new file mode 100644 index 0000000000000000000000000000000000000000..28bced45863509559b000b6191b840e649b10eb7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.city.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerCity { + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "师傅ID") + private Long workerId; + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java new file mode 100644 index 0000000000000000000000000000000000000000..def15c0b74e35b461fed0885cef1100dac86484a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java @@ -0,0 +1,36 @@ +package cn.tedu.wsf.city.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CityVO { + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "城市名称") + private String cityName; + @ApiModelProperty(value = "地址编码") + private String code; + @ApiModelProperty(value = "城市级别") + private Integer depth; + @ApiModelProperty(value = "城市编码") + private String cityCode; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "是否是直辖市") + private Integer isMunicipality; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java b/wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java new file mode 100644 index 0000000000000000000000000000000000000000..e9e0709bcb95352dc8babf3e1296c4cf36307845 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java @@ -0,0 +1,13 @@ +package cn.tedu.wsf.city.service; + + +import cn.tedu.wsf.city.pojo.dto.CityQueryParam; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.city.pojo.vo.CityVO; + +import java.util.List; + +public interface CityService { + List queryCityList(CityQueryParam cityQueryParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..898aa4fcc66e490e3e7a676895eb174d046c103a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java @@ -0,0 +1,31 @@ +package cn.tedu.wsf.city.service.impl; + + +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.dto.CityQueryParam; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import cn.tedu.wsf.city.service.CityService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +@Transactional +@Service +public class CityServiceImpl implements CityService { + @Autowired + CityMapper cityMapper; + + @Override + public List queryCityList(CityQueryParam cityQueryParam) { + + City city=new City(); + BeanUtils.copyProperties(cityQueryParam,city); + List cityVOS = cityMapper.queryCityList(city); + return cityVOS; + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java b/wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java new file mode 100644 index 0000000000000000000000000000000000000000..87ddb1bdc80969940534b4a3581199e9bff47f0d --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java @@ -0,0 +1,12 @@ +package cn.tedu.wsf.log.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface RequiredLog { + String operation() default ""; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java b/wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..a38e0ed361deae31fc5088a0d482c74b807a7922 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java @@ -0,0 +1,120 @@ +package cn.tedu.wsf.log.aspect; + + +import cn.tedu.wsf.base.service.impl.LoginUser; +import cn.tedu.wsf.base.utils.JwtUtils; +import cn.tedu.wsf.base.utils.RedisUtils; +import cn.tedu.wsf.log.annotation.RequiredLog; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.service.OperationLogService; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.jsonwebtoken.Claims; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.util.Date; + +@Slf4j +@Aspect +@Component +public class OperationLogAspect { + + @Autowired + private OperationLogService operationLogService; + @Autowired + JwtUtils jwtUtils; + @Autowired + RedisUtils redisUtils; + + /** + * 通过@Pointcut定义切入点,@annotation是切入点表达式的一种写法, + * 这里表示基于@RequriedLog注解描述的方法为切入点方法。 + */ + @Pointcut("@annotation(cn.tedu.wsf.log.annotation.RequiredLog)") + public void doLog(){}//这个方法内部不用写任何代码,此方法只负责承载注解的定义。 + + /** + * 通过@Around注解描述功能拓展方法,表示我们在此方法内部可以为目标业务方法进行 + * 功能拓展,可以在目标业务执行之前,也可以在目标业务执行之后,添加拓展业务逻辑 + * @param joinPoint + */ + @Around("doLog()") + public Object doLogAround(ProceedingJoinPoint joinPoint)throws Throwable{ + int status=1;//初始状态 + String error="无";//初始错误信息 + long time=0l;//耗时 + long t1=System.currentTimeMillis(); + try{ + Object result=joinPoint.proceed();//调用目标业务执行链(可能会有其它切面的拓展业务+目标方法业务) + //System.out.println("@Around.After"); + long t2=System.currentTimeMillis(); + time=t2-t1; + return result; + }catch (Throwable e){ + long t3=System.currentTimeMillis(); + log.info("@Around.Exception {}",t3); + time=t3-t1; + status=0;//表示出错了 + error=e.getMessage(); + throw e; + }finally{ + //异步记录日志,要思考为什么要异步记录?使用tomcat的线程去记录不可以吗? + saveLog(joinPoint,time,status,error); + } + } + private void saveLog(ProceedingJoinPoint joinPoint,long time,int status,String error) + throws NoSuchMethodException, JsonProcessingException { + //1.获取用户行为日志 + //1.1获取ip地址 + ServletRequestAttributes requestAttributes= + (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = requestAttributes.getRequest(); + String ip=request.getRemoteAddr(); + //1.2获取登陆用户 + String token = request.getHeader("Authorization"); + Claims claims = jwtUtils.parseToken(token); + String userid = claims.getSubject(); + LoginUser loginUser = (LoginUser) redisUtils.get("login:" + userid); + String username=loginUser.getUsername(); + //1.3获取操作名 + //1.3.1获取类的字节码对象 + Class targetCls=joinPoint.getTarget().getClass(); + //1.3.2获取方法签名对象 + MethodSignature ms=(MethodSignature) joinPoint.getSignature(); + //1.3.3获取目标方法对象 + Method targetMethod = + targetCls.getDeclaredMethod( + ms.getName(),//方法名 + ms.getParameterTypes());//参数列表类型 + //1.3.4获取方法上的注解 + RequiredLog requiredLog = targetMethod.getAnnotation(RequiredLog.class); + //1.3.5获取操作名 + String operation=requiredLog.operation(); + //1.4获取目标方法名(类全名+方法名) + String method=targetCls.getName()+"."+targetMethod.getName(); + String param=new ObjectMapper().writeValueAsString(joinPoint.getArgs()); + //2.封装用户行为日志 + OperationLog userLog=new OperationLog(); + userLog.setIp(ip); + userLog.setUsername(username); + userLog.setCreateTime(new Date()); + userLog.setOperation(operation); + userLog.setMethod(method); + userLog.setParams(param); + userLog.setStatus(status); + userLog.setError(error); + userLog.setTime(time); + operationLogService.insertOperationLog(userLog); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java b/wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java new file mode 100644 index 0000000000000000000000000000000000000000..22f17ebc7765162d8f98e916eed643e044ea02e9 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java @@ -0,0 +1,43 @@ +package cn.tedu.wsf.log.controller; + +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.log.pojo.dto.LogQueryParam; +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; +import cn.tedu.wsf.log.service.LoginInforService; +import cn.tedu.wsf.log.service.OperationLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +@Slf4j +@Api(tags = "日志管理") +@RestController +@RequestMapping("/wsf/log") +public class LogController { + @Autowired + LoginInforService loginInforService; + @Autowired + OperationLogService operationLogService; + @ApiOperation("登录日志查询") + @GetMapping("/queryLoginList") + public JsonResult selectLogList(LogQueryParam logQueryParam){ + log.debug("logQueryParam:{}",logQueryParam); + List loginInforVOS = loginInforService.selectLoginList(logQueryParam); + return JsonResult.ok(loginInforVOS); + } + @ApiOperation("操作日志查询") + @GetMapping("/queryOperationLogList") + public JsonResult selectOperationLogList(OperationQueryParam operationQueryParam){ + log.debug("operationQueryParam:{}",operationQueryParam); + List operationLogVOS = operationLogService.selectOperationLogList(operationQueryParam); + return JsonResult.ok(operationLogVOS); + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java index 2401104ccec7b0c593a87bf22c6611a606a30264..a3002ecde6052eb75e14a3d90571b9c76733feb2 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java @@ -1,9 +1,13 @@ package cn.tedu.wsf.log.mapper; import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface LoginInforMapper { void insert(LoginInfor loginInfor); + List selectLoginList(LoginInfor loginInfor); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..72766b40738f0765efef9f91f8a2813d39f56fcc --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.log.mapper; + + +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface OperationLogMapper { + + int insert(OperationLog operationLog); + + List selectList(OperationQueryParam operationQueryParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..8d04f7e2a60a946dc89ca8198db55b9c8eed7e48 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java @@ -0,0 +1,24 @@ +package cn.tedu.wsf.log.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class LogQueryParam { + @ApiModelProperty(value = "用户名") + private String usernName; + @ApiModelProperty(value = "登录时间") + private String loginTime; + @ApiModelProperty(value = "登录状态") + private String status; + @ApiModelProperty(value = "登录ip") + private String ipaddr; + @ApiModelProperty(value = "登录地点") + private String loginLocation; + @ApiModelProperty(value = "登录浏览器") + private String browser; + @ApiModelProperty(value = "登录操作系统") + private String os; + @ApiModelProperty(value = "登录信息") + private String msg; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..7399197290e7e2f6bdc4c2ae3e0bba728ac95c93 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.log.pojo.dto; + +import lombok.Data; + +import java.util.Date; + +@Data +public class OperationQueryParam { + + private String username; + + private String operation; + + private Integer status; + + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java index 0fecceb0f4d811c94fe856df049297546ef06e6c..4c90679752d345b2608382c07582f8a898d090c9 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java @@ -1,18 +1,29 @@ package cn.tedu.wsf.log.pojo.entity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @Data public class LoginInfor { + @ApiModelProperty(value = "id") private Long infoId; - private String loginName; + @ApiModelProperty(value = "用户名") + private String userName; + @ApiModelProperty(value = "ip地址") private String ipaddr; + @ApiModelProperty(value = "登录地点") private String loginLocation; + @ApiModelProperty(value = "浏览器") private String browser; + @ApiModelProperty(value = "操作系统") private String os; + @ApiModelProperty(value = "登录状态 0:成功 1:失败") private String status; + @ApiModelProperty(value = "登录信息") private String msg; + @ApiModelProperty(value = "登录时间") private Date loginTime; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java new file mode 100644 index 0000000000000000000000000000000000000000..e17a1a7210faa95e330cf972dc650e120ae3ac2f --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.log.pojo.entity; + +import lombok.Data; + +import java.util.Date; +@Data +public class OperationLog { + private Long id; + /**用户ip*/ + private String ip; + /**用户名*/ + private String username; + /**访问时间*/ + private Date createTime; + /**具体操作*/ + private String operation; + /**访问的方法*/ + private String method; + /**传递的参数*/ + private String params; + /**耗时*/ + private Long time; + /**操作状态*/ + private Integer status; + /**错误信息*/ + private String error; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java new file mode 100644 index 0000000000000000000000000000000000000000..3d398a47cf0e94e8f1391906306d528ec70e4384 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.log.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +@Data +public class LoginInforVO { + @ApiModelProperty(value = "id") + private Long infoId; + @ApiModelProperty(value = "用户名") + private String userName; + @ApiModelProperty(value = "ip地址") + private String ipaddr; + @ApiModelProperty(value = "登录地点") + private String loginLocation; + @ApiModelProperty(value = "浏览器") + private String browser; + @ApiModelProperty(value = "操作系统") + private String os; + @ApiModelProperty(value = "登录状态 0:成功 1:失败") + private String status; + @ApiModelProperty(value = "登录信息") + private String msg; + @ApiModelProperty(value = "登录时间") + private Date loginTime; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java new file mode 100644 index 0000000000000000000000000000000000000000..de2cf6e4a58b70a46363673a9f3eb6087d46b6aa --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java @@ -0,0 +1,27 @@ +package cn.tedu.wsf.log.pojo.vo; + +import lombok.Data; + +import java.util.Date; +@Data +public class OperationLogVO { + private Long id; + /**用户ip*/ + private String ip; + /**用户名*/ + private String username; + /**访问时间*/ + private Date createTime; + /**具体操作*/ + private String operation; + /**访问的方法*/ + private String method; + /**传递的参数*/ + private String params; + /**耗时*/ + private Long time; + /**操作状态*/ + private Integer status; + /**错误信息*/ + private String error; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java index ee8d0f06c42677e114de85eb2319a2d0c0864942..bd433a54f335156860153835d8caca5a88e46b8e 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java @@ -1,7 +1,12 @@ package cn.tedu.wsf.log.service; +import cn.tedu.wsf.log.pojo.dto.LogQueryParam; import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; + +import java.util.List; public interface LoginInforService { void insert(LoginInfor loginInfor); + List selectLoginList(LogQueryParam logQueryParam); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..bc3c837279a4069e6bc4e23baa63eb2483b3fc64 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java @@ -0,0 +1,13 @@ +package cn.tedu.wsf.log.service; + + +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; + +import java.util.List; + +public interface OperationLogService { + void insertOperationLog(OperationLog operationLog); + List selectOperationLogList(OperationQueryParam operationQueryParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java index 6287f4c9d876202b45072512829c02c343e99e4f..bef6aa8391497102d88b478d4c92b332d89bb030 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java @@ -1,12 +1,17 @@ package cn.tedu.wsf.log.service.impl; import cn.tedu.wsf.log.mapper.LoginInforMapper; +import cn.tedu.wsf.log.pojo.dto.LogQueryParam; import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; import cn.tedu.wsf.log.service.LoginInforService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class LoginInforServiceImpl implements LoginInforService { @Autowired @@ -16,4 +21,11 @@ public class LoginInforServiceImpl implements LoginInforService { public void insert(LoginInfor loginInfor) { loginInforMapper.insert(loginInfor); } + + @Override + public List selectLoginList(LogQueryParam logQueryParam) { + LoginInfor loginInfor = new LoginInfor(); + BeanUtils.copyProperties(logQueryParam,loginInfor); + return loginInforMapper.selectLoginList(loginInfor); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..584b1ba64c50a37af5c52ad49c163591ae077a82 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java @@ -0,0 +1,29 @@ +package cn.tedu.wsf.log.service.impl; + + +import cn.tedu.wsf.log.mapper.OperationLogMapper; +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; +import cn.tedu.wsf.log.service.OperationLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class OperationLogServiceImpl implements OperationLogService { + @Autowired + OperationLogMapper operationLogMapper; + @Async + @Override + public void insertOperationLog(OperationLog operationLog) { + operationLogMapper.insert(operationLog); + } + + @Override + public List selectOperationLogList(OperationQueryParam operationQueryParam) { + return operationLogMapper.selectList(operationQueryParam); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java b/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java index 6260e8734c2b44af0803ad30da7e33fabba1b361..f7ef3cf151ad42ec2885b2529512b5af43b0b7b1 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java @@ -1,13 +1,19 @@ package cn.tedu.wsf.order.controller; import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; +import cn.tedu.wsf.order.pojo.dto.GrabOrderParam; +import cn.tedu.wsf.order.pojo.dto.OrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.ReqOrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.SaveOrderParam; +import cn.tedu.wsf.order.pojo.entity.Order; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import cn.tedu.wsf.order.service.OrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +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; @@ -22,10 +28,42 @@ public class OrderController { @Autowired OrderService orderService; @ApiOperation("任务查询") - @PostMapping("/selectOrder") - public JsonResult selectOrder(ResOrderQueryParams resOrderQueryParams){ - log.info("resOrderQueryParams:{}",resOrderQueryParams); - List requestOrderVos = orderService.selectOrder(resOrderQueryParams); + @GetMapping("/selectReqOrder") + public JsonResult selectOrder(ReqOrderQueryParam resOrderQueryParams){ + List requestOrderVos = orderService.selectReqOrderList(resOrderQueryParams); return JsonResult.ok(requestOrderVos); } + + @ApiOperation("任务修改") + @PostMapping("/updateReqOrder") + public JsonResult updateReqOrder(ReqOrderQueryParam resOrderQueryParams){ + orderService.updateReqOrder(resOrderQueryParams); + return JsonResult.ok(); + } + @ApiOperation("任务新增") + @PostMapping("/insertReqOrder") + public JsonResult insertReqOrder(ReqOrderQueryParam resOrderQueryParams){ + orderService.insertReqOrder(resOrderQueryParams); + return JsonResult.ok(); + } + @ApiOperation("任务抢单") + @PostMapping("/grabOrder") + public JsonResult grabOrder(GrabOrderParam grabOrderParam){ + log.info("grabOrderParam:{}",grabOrderParam); + orderService.grabOrder(grabOrderParam); + return JsonResult.ok(); + } + @ApiOperation("订单查询") + @GetMapping("/selectOrderList") + public JsonResult selectOrderList(OrderQueryParam orderQueryParam){ + List orderVOS = orderService.selectOrderList(orderQueryParam); + log.info("orderVOS:{}",orderVOS); + return JsonResult.ok(orderVOS); + } + @ApiOperation("订单更新") + @PostMapping("/updateOrder") + public JsonResult updateOrder(SaveOrderParam saveOrderParam){ + orderService.updateOrder(saveOrderParam); + return JsonResult.ok(); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java index 474f564a9bf02ce9ab868fa18be53669d37c5b58..7428b136089c14c419cf33c7932383ace9d58a37 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java @@ -1,12 +1,21 @@ package cn.tedu.wsf.order.mapper; +import cn.tedu.wsf.order.pojo.entity.Order; import cn.tedu.wsf.order.pojo.entity.RequestOrder; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface OrderMapper { - List selectOrder(RequestOrder requestOrder); + List selectReqOrderList(RequestOrder requestOrder); + int insertReqOrder(RequestOrder requestOrder); + int updateReqOrder(RequestOrder requestOrder); + int updateReqOrderGrabStatus(@Param("id") Long id,@Param("grabStatus") Integer grabStatus); + int insertOrder(Order order); + List selectOrderList(Order order); + int updateOrder(Order order); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java new file mode 100644 index 0000000000000000000000000000000000000000..73254b85a8ad5fc5126c7a2f13cfe1f947e9d0ab --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java @@ -0,0 +1,16 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +@Data +public class GrabOrderParam { + + @ApiModelProperty("需求单id") + private Long id; + @ApiModelProperty("用户id") + private Long userId; + @ApiModelProperty("师傅手机号") + private String phone; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..88f816118c8c76e78b5dc728dbbc9a12558309ef --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java @@ -0,0 +1,46 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class OrderQueryParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String orderNo; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "需求订单号") + private String requestOrderNo; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "分润比例") + private double profitScale; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..c973d5a5cb1d51cb8765b285465995c1b257a261 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java @@ -0,0 +1,41 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class ReqOrderQueryParam { + + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String requestOrderNo; + @ApiModelProperty(value = "订单名称") + private String orderName; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double orderAmount; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "地址Id") + private Long areaId; + @ApiModelProperty(value = "用户地址") + private String address; + @ApiModelProperty(value = "详细地址") + private String detailAddress; + @ApiModelProperty(value = "预约时间") + private String serviceTime; + @ApiModelProperty(value = "订单状态") + private String grabStatus; + @ApiModelProperty(value = "订单状态") + private String status; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java deleted file mode 100644 index fd62dc331f45ef430e1963983c7fde511ffc98f9..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.tedu.wsf.order.pojo.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -@Data -public class ResOrderQueryParams { - - @ApiModelProperty(value = "服务名称") - private String orderServerName; - @ApiModelProperty(value = "子技能名称") - private String orderCategoryName; - @ApiModelProperty(value = "用户地址") - private String address; - @ApiModelProperty(value = "起始时间") - private Date startTime; - @ApiModelProperty(value = "结束时间") - private Date endTime; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java new file mode 100644 index 0000000000000000000000000000000000000000..33a6cf5433b6a04ec87288594df00ac12ccc274b --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java @@ -0,0 +1,40 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SaveOrderParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java new file mode 100644 index 0000000000000000000000000000000000000000..38a79e5240574e268a440d38612246c212d85089 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java @@ -0,0 +1,46 @@ +package cn.tedu.wsf.order.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Order { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String orderNo; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "需求订单号") + private String requestOrderNo; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "分润比例") + private double profitScale; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java index 95649e3c2a7805af3d5fc8fd5c7d2cc3ecbab0e6..a66749f25518cd346707e78d4177767486f7f3b6 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java @@ -13,36 +13,34 @@ public class RequestOrder { private String requestOrderNo; @ApiModelProperty(value = "订单名称") private String orderName; - @ApiModelProperty(value = "服务id") - private Long orderServerId; - @ApiModelProperty(value = "服务名称") - private String orderServerName; - @ApiModelProperty(value = "子服务id") + @ApiModelProperty(value = "品类id") private Long orderCategoryId; - @ApiModelProperty(value = "子服务名称") + @ApiModelProperty(value = "品类名称") private String orderCategoryName; @ApiModelProperty(value = "订单金额") - private Long orderAmount; + private double orderAmount; @ApiModelProperty(value = "用户名称") private String userName; @ApiModelProperty(value = "用户手机号") private String userPhone; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "订单状态") + private String status; @ApiModelProperty(value = "地址Id") private Long areaId; @ApiModelProperty(value = "用户地址") private String address; + @ApiModelProperty(value = "详细地址") + private String detailAddress; @ApiModelProperty(value = "预约时间") - private Date serviceTime; - @ApiModelProperty(value = "用户id") - private Long userId; + private String serviceTime; @ApiModelProperty(value = "订单状态") - private int grabStatus; + private String grabStatus; @ApiModelProperty(value = "修改次数") private int version; @ApiModelProperty(value = "创建时间") - private Date gmtCreate; + private String gmtCreate; @ApiModelProperty(value = "修改时间") - private Date gmtModified; - @ApiModelProperty(value = "详细地址") - private String detailAddress; + private String gmtModified; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java new file mode 100644 index 0000000000000000000000000000000000000000..debe8d26fdf0389d88023857258ac512d00bbdd7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java @@ -0,0 +1,46 @@ +package cn.tedu.wsf.order.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class OrderVO { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String orderNo; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "需求订单号") + private String requestOrderNo; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "分润比例") + private double profitScale; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java index 58291abb77a6d1df547099ba27bf4fb2941c3d2f..03b90273af2bab748bce3e64d34b14449d3e402d 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java @@ -13,34 +13,34 @@ public class RequestOrderVo { private String requestOrderNo; @ApiModelProperty(value = "订单名称") private String orderName; - @ApiModelProperty(value = "服务id") - private Long orderServerId; - @ApiModelProperty(value = "服务名称") - private String orderServerName; - @ApiModelProperty(value = "子服务id") + @ApiModelProperty(value = "品类id") private Long orderCategoryId; - @ApiModelProperty(value = "子服务名称") + @ApiModelProperty(value = "品类名称") private String orderCategoryName; @ApiModelProperty(value = "订单金额") - private Long orderAmount; + private double orderAmount; @ApiModelProperty(value = "用户名称") private String userName; + @ApiModelProperty(value = "用户id") + private Long userId; @ApiModelProperty(value = "用户手机号") private String userPhone; @ApiModelProperty(value = "地址Id") private Long areaId; @ApiModelProperty(value = "用户地址") private String address; + @ApiModelProperty(value = "详细地址") + private String detailAddress; @ApiModelProperty(value = "预约时间") - private Date serviceTime; - @ApiModelProperty(value = "用户id") - private Long userId; + private String serviceTime; @ApiModelProperty(value = "订单状态") - private String status; - @ApiModelProperty(value = "抢单状态") - private int grabStatus; + private String grabStatus; + @ApiModelProperty(value = "修改次数") + private int version; @ApiModelProperty(value = "创建时间") - private Date gmtCreate; + private String gmtCreate; @ApiModelProperty(value = "修改时间") - private Date gmtModified; + private String gmtModified; + @ApiModelProperty(value = "订单状态") + private String status; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java b/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java index f0fef813c4d97eda4bf217c7cd74d752dcdd257f..1e6935c9f5b604ec9e6a86a6f3d2eb4f1cea5808 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java @@ -1,10 +1,22 @@ package cn.tedu.wsf.order.service; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; +import cn.tedu.wsf.order.pojo.dto.GrabOrderParam; +import cn.tedu.wsf.order.pojo.dto.OrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.ReqOrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.SaveOrderParam; +import cn.tedu.wsf.order.pojo.entity.Order; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import java.util.List; public interface OrderService { - List selectOrder(ResOrderQueryParams resOrderQueryParams); + List selectReqOrderList(ReqOrderQueryParam resOrderQueryParams); + void insertReqOrder(ReqOrderQueryParam reqOrderQueryParam); + void updateReqOrder(ReqOrderQueryParam reqOrderQueryParam); + + void grabOrder(GrabOrderParam grabOrderParam); + List selectOrderList(OrderQueryParam orderQueryParam); + + void updateOrder(SaveOrderParam saveOrderParam); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java index 1974d5afc3743f61a5ffb1ec17779a5b420d0a72..ff2c79be827ba55d91d39b46d502fd38da0ddd39 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java @@ -1,25 +1,121 @@ package cn.tedu.wsf.order.service.impl; +import cn.tedu.wsf.base.handler.MyWebSocketHandler; +import cn.tedu.wsf.category.mapper.CategoryMapper; +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import cn.tedu.wsf.log.annotation.RequiredLog; import cn.tedu.wsf.order.mapper.OrderMapper; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; +import cn.tedu.wsf.order.pojo.dto.GrabOrderParam; +import cn.tedu.wsf.order.pojo.dto.OrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.ReqOrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.SaveOrderParam; +import cn.tedu.wsf.order.pojo.entity.Order; import cn.tedu.wsf.order.pojo.entity.RequestOrder; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import cn.tedu.wsf.order.service.OrderService; +import cn.tedu.wsf.pay.mapper.AccountMapper; +import cn.tedu.wsf.pay.pojo.entity.Account; +import cn.tedu.wsf.user.mapper.UserMapper; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.UUID; +@Transactional @Service public class OrderServiceImpl implements OrderService { @Autowired OrderMapper orderMapper; + @Autowired + CityMapper cityMapper; + @Autowired + CategoryMapper categoryMapper; + @Autowired + WorkerMapper workerMapper; + @Autowired + AccountMapper accountMapper; + @Autowired + MyWebSocketHandler myWebSocketHandler; @Override - public List selectOrder(ResOrderQueryParams resOrderQueryParams) { + public List selectReqOrderList(ReqOrderQueryParam resOrderQueryParams) { RequestOrder requestOrder=new RequestOrder(); BeanUtils.copyProperties(resOrderQueryParams,requestOrder); - List requestOrderVos = orderMapper.selectOrder(requestOrder); + List requestOrderVos = orderMapper.selectReqOrderList(requestOrder); return requestOrderVos; } + @RequiredLog(operation = "insertReqOrder") + @Override + public void insertReqOrder(ReqOrderQueryParam reqOrderQueryParam) { + RequestOrder requestOrder=new RequestOrder(); + BeanUtils.copyProperties(reqOrderQueryParam,requestOrder); + City city=new City(); + Category category=new Category(); + city.setCityId(reqOrderQueryParam.getAreaId()); + List cityVOS = cityMapper.queryCityList(city); + requestOrder.setAddress(cityVOS.get(0).getCityName()); + category.setCategoryId(reqOrderQueryParam.getOrderCategoryId()); + List categoryVos = categoryMapper.selectByQueryParam(category); + requestOrder.setOrderCategoryName(categoryVos.get(0).getCategoryName()); + if (reqOrderQueryParam.getId()==null){ + UUID uuid = UUID.randomUUID(); + requestOrder.setRequestOrderNo(uuid.toString().replace("-", "")); + orderMapper.insertReqOrder(requestOrder); + }else { + orderMapper.updateReqOrder(requestOrder); + } + } + @RequiredLog(operation = "updateReqOrder") + @Override + public void updateReqOrder(ReqOrderQueryParam reqOrderQueryParam) { + RequestOrder requestOrder=new RequestOrder(); + BeanUtils.copyProperties(reqOrderQueryParam,requestOrder); + orderMapper.updateReqOrder(requestOrder); + } + @RequiredLog(operation = "grabOrder") + @Override + public void grabOrder(GrabOrderParam grabOrderParam) { + RequestOrder requestOrder=new RequestOrder(); + requestOrder.setId(grabOrderParam.getId()); + List requestOrderVos = orderMapper.selectReqOrderList(requestOrder); + Order order=new Order(); + BeanUtils.copyProperties(requestOrderVos.get(0),order); + order.setWorkerPhone(grabOrderParam.getPhone()); + WorkerVO workerVO = workerMapper.selectByUserId(grabOrderParam.getUserId()); + order.setWorkerName(workerVO.getRealName()); + order.setRequestOrderRawPrice(requestOrderVos.get(0).getOrderAmount()); + order.setRequestOrderPrice(requestOrderVos.get(0).getOrderAmount()*0.8); + Account account=new Account(); + UUID uuid = UUID.randomUUID(); + order.setOrderNo(uuid.toString().replace("-", "")); + order.setUserAddress(requestOrderVos.get(0).getAddress()+requestOrderVos.get(0).getDetailAddress()); + account.setUserId(grabOrderParam.getUserId()); + account.setSettlingAmount(requestOrderVos.get(0).getOrderAmount()*0.8); + accountMapper.update(account); + orderMapper.updateReqOrderGrabStatus(grabOrderParam.getId(),1); + orderMapper.insertOrder(order); + } + @Override + public List selectOrderList(OrderQueryParam orderQueryParam) { + Order order=new Order(); + BeanUtils.copyProperties(orderQueryParam,order); + return orderMapper.selectOrderList(order); + } + @RequiredLog(operation = "updateOrder") + @Override + public void updateOrder(SaveOrderParam saveOrderParam) { + Order order=new Order(); + myWebSocketHandler.sendNotification("10", "你好,我是测试消息"); + BeanUtils.copyProperties(saveOrderParam,order); + orderMapper.updateOrder(order); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ce7f6e314d85562c7158bba1d4f2a1fd7ae30ade --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java @@ -0,0 +1,10 @@ +package cn.tedu.wsf.pay.mapper; + +import cn.tedu.wsf.pay.pojo.entity.Account; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AccountMapper { + int insert(Account account); + int update(Account account); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java new file mode 100644 index 0000000000000000000000000000000000000000..eb4aed4d66868358db7895d56e87099f6dde46b7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java @@ -0,0 +1,23 @@ +package cn.tedu.wsf.pay.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Account { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty("待结算金额") + private Double settlingAmount; + @ApiModelProperty("总金额") + private Double totalAmount; + @ApiModelProperty(value = "账户状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java new file mode 100644 index 0000000000000000000000000000000000000000..20532fe17197dac0d3215f2f118c33e5ea9eaf4f --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java @@ -0,0 +1,7 @@ +package cn.tedu.wsf.pay.service; + +import cn.tedu.wsf.pay.pojo.entity.Account; + +public interface AccountService { + int insertAccount(Account account); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..273d0ccb0f5ebb29fc6c18ffb1dffbc4ec3edcfd --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java @@ -0,0 +1,18 @@ +package cn.tedu.wsf.pay.service.impl; + +import cn.tedu.wsf.pay.mapper.AccountMapper; +import cn.tedu.wsf.pay.pojo.entity.Account; +import cn.tedu.wsf.pay.service.AccountService; + +public class AccountServiceImpl implements AccountService { + + private AccountMapper accountMapper; + + public AccountServiceImpl(AccountMapper accountMapper){ + this.accountMapper=accountMapper; + } + @Override + public int insertAccount(Account account) { + return accountMapper.insert(account); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..44d7553384e0d9a64d739e6b6bfe66f962afb932 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java @@ -0,0 +1,11 @@ +package cn.tedu.wsf.role.mapper; + +import cn.tedu.wsf.role.pojo.entity.Role; +import cn.tedu.wsf.role.pojo.entity.UserRole; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RoleMapper { + int insert(UserRole userRole); + int update(UserRole userRole); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java new file mode 100644 index 0000000000000000000000000000000000000000..dfa9edfc04d757036a693a2086eb9f7030dc53ed --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java @@ -0,0 +1,22 @@ +package cn.tedu.wsf.role.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Role { + @ApiModelProperty("角色id") + private Long roleId; + @ApiModelProperty("角色名称") + private String roleName; + @ApiModelProperty("角色状态") + private Integer status; + @ApiModelProperty("删除标识") + private Integer delFlag; + @ApiModelProperty("创建时间") + private String createTime; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("创建人") + private String createBy; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java new file mode 100644 index 0000000000000000000000000000000000000000..539313786b7c8229f74a158c82418f07bfe15492 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java @@ -0,0 +1,12 @@ +package cn.tedu.wsf.role.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class UserRole { + @ApiModelProperty(value = "用户id") + Long userId; + @ApiModelProperty(value = "角色id") + Long roleId; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java b/wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java deleted file mode 100644 index 1e536c5e8b2d367b79f7a98f48e0c86db11353e8..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.tedu.wsf.server.controller; - -import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; -import cn.tedu.wsf.server.service.TypeService; -import io.swagger.annotations.Api; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@Slf4j -@RestController -@Api("服务模块") -@RequestMapping("/wsf/server") -public class TypeController { - @Autowired - TypeService typeService; - @GetMapping("/queryCategory") - public JsonResult queryCategory(Long serverid) { - System.out.println("categoryid:"+serverid); - List categoryVos = typeService.queryCategory(serverid); - return JsonResult.ok(categoryVos); - } - - @GetMapping("/queryType") - public JsonResult queryType() { - List typeVos = typeService.queryType(); - return JsonResult.ok(typeVos); - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java deleted file mode 100644 index b9b47c2c3dba0b0e5ce58042d238088dffcf34b7..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.server.mapper; - -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; - -import java.util.List; - -public interface TypeMapper { - List queryType(); - List queryCategory(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java b/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java deleted file mode 100644 index 7d756a16fa67b11c83bbecdb52351f9e9ce66d81..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.tedu.wsf.server.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class Type { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "服务名") - private String typeName; - @ApiModelProperty(value = "状态") - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java b/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java deleted file mode 100644 index 9a400797d37f2b63edc644845dfecac0b1c2de3f..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.server.pojo.vo; - -import lombok.Data; - -@Data -public class CategoryVo { - private Long id; - private Long parentid; - private String categoryname; - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java b/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java deleted file mode 100644 index 669648f9ace849da97f7ca692a3b47882188c9f7..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.tedu.wsf.server.pojo.vo; - -import lombok.Data; - -@Data -public class TypeVo { - private Long id; - private String typename; - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java b/wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java deleted file mode 100644 index e40633cd3f0d345dc99dcd47340a29767b55600b..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.server.service; - -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; - -import java.util.List; - -public interface TypeService { - List queryType(); - List queryCategory(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java deleted file mode 100644 index ea1502011d3911cace4189b6309fba4f85e784f4..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.tedu.wsf.server.service.impl; - -import cn.tedu.wsf.server.mapper.TypeMapper; -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; -import cn.tedu.wsf.server.service.TypeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -@Service -public class TypeServiceImpl implements TypeService { - @Autowired - TypeMapper typeMapper; - @Override - public List queryType() { - List typeVos = typeMapper.queryType(); - return typeVos; - } - - @Override - public List queryCategory(Long parentId) { - List categoryVos = typeMapper.queryCategory(parentId); - return categoryVos; - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java b/wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java new file mode 100644 index 0000000000000000000000000000000000000000..eb9e9faf2b2f99c09735bc91b4173441d57c632b --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java @@ -0,0 +1,25 @@ +//package cn.tedu.wsf.test; +// +//import com.xxl.job.core.biz.model.ReturnT; +//import com.xxl.job.core.context.XxlJobHelper; +//import com.xxl.job.core.handler.annotation.XxlJob; +//import org.springframework.stereotype.Component; +// +//@Component +//public class XxlJobTest { +// @XxlJob("testXxlJob") +// ReturnT testXxlJob(){ +// String jobParam = XxlJobHelper.getJobParam(); +// XxlJobHelper.log("测试开始"); +// System.out.println(); +// System.out.println(); +// System.out.println(); +// System.out.println(jobParam); +// System.out.println("测试完成!!!"); +// System.out.println(); +// System.out.println(); +// System.out.println(); +// XxlJobHelper.log("测试结束!!!"); +// return ReturnT.SUCCESS; +// } +//} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java new file mode 100644 index 0000000000000000000000000000000000000000..4aab4fefdeff9eab609fe620ed29bea55452d20a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java @@ -0,0 +1,76 @@ +package cn.tedu.wsf.user.controller; + +import cn.hutool.core.codec.Base64; +import cn.tedu.wsf.base.config.SystemConfig; +import cn.tedu.wsf.base.constant.CacheConstants; +import cn.tedu.wsf.base.constant.Constants; +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.base.pojo.vo.CaptchaVO; +import cn.tedu.wsf.base.utils.IdUtils; +import cn.tedu.wsf.base.utils.RedisUtils; +import com.google.code.kaptcha.Producer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Autowired + private RedisUtils redisUtils; + + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public JsonResult getCode(HttpServletResponse response) { + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + String capStr = null, code = null; + BufferedImage image = null; + // 生成验证码 + String captchaType = SystemConfig.getCaptchaType(); + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + redisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try + { + ImageIO.write(image, "jpg", os); + } + catch (IOException e) + { + return new JsonResult(e.getMessage()); + } + CaptchaVO captchaVO=new CaptchaVO(); + captchaVO.setUuid(uuid); + captchaVO.setImg(Base64.encode(os.toByteArray())); + return JsonResult.ok(captchaVO); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java index ef97d99f8ad1075a34c7bf56b1f3b00d01a8bfbe..36a7c602ed0196eb8843400714390fa73150b060 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java @@ -1,11 +1,13 @@ package cn.tedu.wsf.user.controller; +import cn.tedu.wsf.base.constant.CacheConstants; import cn.tedu.wsf.base.enums.StatusCode; +import cn.tedu.wsf.base.exception.ServiceException; import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.user.pojo.dto.UserLoginParam; -import cn.tedu.wsf.user.pojo.dto.UserQueryParam; -import cn.tedu.wsf.user.pojo.dto.UserRegisterParam; -import cn.tedu.wsf.user.pojo.dto.UserSavaParam; +import cn.tedu.wsf.base.utils.PhoneMessageUtils; +import cn.tedu.wsf.base.utils.RedisUtils; +import cn.tedu.wsf.user.pojo.dto.*; +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; import cn.tedu.wsf.user.pojo.vo.UserVO; import cn.tedu.wsf.user.service.UserService; import io.swagger.annotations.Api; @@ -16,7 +18,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; @Api("用户模块") @Slf4j @@ -25,12 +29,18 @@ import java.util.List; public class UserController { @Autowired UserService userService; + @Autowired + RedisUtils redisUtils; + @ApiOperation("用户登录") @PostMapping("/login") public JsonResult login(@RequestBody UserLoginParam userLoginParam){ log.debug("用户登录:userLoginParam={}",userLoginParam); UserVO userVO = userService.login(userLoginParam); + if (userVO==null){ + return new JsonResult(2002,"验证码错误或过时"); + } return JsonResult.ok(StatusCode.LOGIN_SUCCESS,userVO); } @ApiOperation("用户注册") @@ -49,8 +59,8 @@ public class UserController { } @PostMapping("/delete/{userId}") public JsonResult deleteUser(@PathVariable Long userId){ - log.debug("删除用户:userId={}",userId); - userService.deleteById(userId); +// log.debug("删除用户:userId={}",userId); +// userService.deleteById(userId); return JsonResult.ok(); } @PostMapping("/save") @@ -64,4 +74,23 @@ public class UserController { userService.logout(); return JsonResult.ok(); } + + @PostMapping("/messagelogin") + public JsonResult messageLogin(@RequestBody UserMessageParam userMessageParam){ + log.debug("短信验证码登录:userMessageParam={}",userMessageParam); + UserVO userVO = userService.messageLogin(userMessageParam); + return JsonResult.ok(StatusCode.LOGIN_SUCCESS,userVO); + } + @GetMapping("/send") + public JsonResult sendMessage(String phone){ + log.debug("获取手机验证码"+phone); + userService.sendMessage(phone); + return new JsonResult(2001,"发送成功"); + } + @GetMapping("/becomeWorker") + public JsonResult becomeWorker(Long userId){ + log.debug("成为师傅:userId={}",userId); + userService.becomeWorker(userId); + return JsonResult.ok(); + } } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java index 9855deb5e06dd3a3523dd4b1bf41eed9f9ceb8d5..d968b5b343b264e3641c405908a9520f11073c9a 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java @@ -15,4 +15,6 @@ public interface UserMapper { List selectByQueryParam(User user); int deleteById(Long id); int save(User user); + UserVO selectByPhone(String phone); + UserVO selectById(Long id); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java index ed11421d22e42fadd30b97970a3001163fd8c5db..6e3460bef1e90f8dd893f16e946e289a8cc07c62 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java @@ -9,4 +9,8 @@ public class UserLoginParam { private String username; @ApiModelProperty(value="密码") private String password; + @ApiModelProperty(value = "uuid") + private String uuid; + @ApiModelProperty(value = "验证码") + private String code; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..5a2a93b90122092b0e25b402b0ac31ca6a7a70cf --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java @@ -0,0 +1,16 @@ +package cn.tedu.wsf.user.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class UserMessageParam { + @ApiModelProperty("短信验证码") + private String messageCode; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty(value = "uuid") + private String uuid; + @ApiModelProperty(value = "验证码") + private String code; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java index be8bf3177c01a197ffd06ea4dd6e504e12d787ec..0652eba46a8f8f5333c12e16bf8875ea3b009421 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java @@ -8,13 +8,14 @@ import java.util.Date; @Data public class UserQueryParam { @ApiModelProperty(value = "用户id") - private Long id; + private Long userId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "昵称") private String nickname; @ApiModelProperty(value = "1正常,0删除") - private String isDelete; + private String delFlag; @ApiModelProperty(value = "1启用,0禁用") - private String enable; + private String status; + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java index 6a1e1ae69093dc056bed61ab6b84103ecfce362e..984e6457cf655ecc6297252826b6d886a29f3fdb 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java @@ -10,7 +10,11 @@ public class UserRegisterParam { @ApiModelProperty(value = "密码") private String password; @ApiModelProperty(value = "昵称") - private String email; + private String nickname; @ApiModelProperty(value = "手机号") private String phone; + @ApiModelProperty(value = "uuid") + private String uuid; + @ApiModelProperty(value = "验证码") + private String code; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java index 60c4ba8471e58320c3556ff18396e5c34cca7b38..5061243f42ade2474364db98f108be245817c72e 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java @@ -3,24 +3,23 @@ package cn.tedu.wsf.user.pojo.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; @Data public class UserSavaParam { @ApiModelProperty(value = "用户id") - private Long id; - @ApiModelProperty(value = "用户名") - private String username; + private Long userId; @ApiModelProperty(value = "密码") private String password; - @ApiModelProperty(value = "用户描述") - private String avator; + @ApiModelProperty(value = "头像地址") + private String avatar; @ApiModelProperty(value = "昵称") private String nickname; @ApiModelProperty(value = "手机号") private String phone; @ApiModelProperty(value = "1正常,0删除") - private String isDelete; + private String delFlag; @ApiModelProperty(value = "1启用,0禁用") - private String enable; + private String status; + @ApiModelProperty(value = "性别") + private String sex; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java index 6251b839c1c577efe869f67f4e66644f9fe2397b..339eec57b44ee1dc06703574158c70b0773d44e2 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java @@ -9,21 +9,23 @@ import java.util.Date; @Data public class User implements Serializable { @ApiModelProperty(value = "用户id") - private Long id; + private Long userId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "密码") private String password; - @ApiModelProperty(value = "用户描述") - private String avator; + @ApiModelProperty(value = "用户头像地址") + private String avatar; @ApiModelProperty(value = "昵称") private String nickname; + @ApiModelProperty(value = "性别") + private String sex; @ApiModelProperty(value = "手机号") private String phone; @ApiModelProperty(value = "1正常,0删除") - private String isDelete; + private String delFlag; @ApiModelProperty(value = "1启用,0禁用") - private String enable; + private String status; @ApiModelProperty(value = "创建时间") private Date gmtCreate; @ApiModelProperty(value = "更新时间") diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..226b5bb5f86795df534c43cf8e25f36c0f055dc1 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java @@ -0,0 +1,9 @@ +package cn.tedu.wsf.user.pojo.vo; + +import lombok.Data; + +@Data +public class CaptchaVo { + private String imgurl; + private String captcha; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java index 2bc0d14b35dcd03e2cb9e585b2043a8d9a199ca3..265d2077e9a22ae7ee913f0ef3ab00539c13c903 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java @@ -10,27 +10,27 @@ import java.util.Date; @Data public class UserVO implements Serializable { @ApiModelProperty(value = "用户id") - private Long id; + private Long userId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "密码") private String password; - @ApiModelProperty(value = "用户描述") - private String avator; + @ApiModelProperty(value = "用户头像地址") + private String avatar; @ApiModelProperty(value = "昵称") private String nickname; - @ApiModelProperty(value = "邮箱") - private String email; + @ApiModelProperty(value = "性别") + private String sex; @ApiModelProperty(value = "手机号") private String phone; - @ApiModelProperty(value = "1正常,0删除") - private String isDelete; - @ApiModelProperty(value = "1启用,0禁用") - private String enable; @ApiModelProperty(value = "创建时间") private Date gmtCreate; - @ApiModelProperty(value = "更新时间") - private Date gmtModified; + @ApiModelProperty(value = "1正常,0删除") + private String delFlag; + @ApiModelProperty(value = "1启用,0禁用") + private String status; @ApiModelProperty(value = "token") private String token; + @ApiModelProperty(value = "角色名称") + private String roleName; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java b/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java index 527473ade7d0a53e1666e83f4d9f699280ed3cff..4a1b6764ff75c2bf743264cc30b0c47595a0b4b5 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java @@ -1,10 +1,8 @@ package cn.tedu.wsf.user.service; -import cn.tedu.wsf.user.pojo.dto.UserLoginParam; -import cn.tedu.wsf.user.pojo.dto.UserQueryParam; -import cn.tedu.wsf.user.pojo.dto.UserRegisterParam; -import cn.tedu.wsf.user.pojo.dto.UserSavaParam; +import cn.tedu.wsf.user.pojo.dto.*; +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; import cn.tedu.wsf.user.pojo.vo.UserVO; import java.util.List; @@ -18,4 +16,7 @@ public interface UserService { void deleteById(Long id); void save(UserSavaParam userSavaParam); void logout(); + UserVO messageLogin(UserMessageParam userMessageParam); + void sendMessage(String phone); + void becomeWorker(Long userId); } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java index a95b286c5503e4f183d0be23f6a00aae0825c9c6..5577b6a9ee8e7d57469278bc768ed436a4bd2d58 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java @@ -1,54 +1,77 @@ package cn.tedu.wsf.user.service.impl; +import cn.tedu.wsf.base.constant.CacheConstants; import cn.tedu.wsf.base.enums.StatusCode; import cn.tedu.wsf.base.exception.ServiceException; +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.base.handler.MyWebSocketHandler; import cn.tedu.wsf.base.service.impl.LoginUser; import cn.tedu.wsf.base.utils.JwtUtils; +import cn.tedu.wsf.base.utils.PhoneMessageUtils; import cn.tedu.wsf.base.utils.RedisUtils; +import cn.tedu.wsf.log.annotation.RequiredLog; +import cn.tedu.wsf.role.mapper.RoleMapper; +import cn.tedu.wsf.role.pojo.entity.UserRole; import cn.tedu.wsf.user.mapper.UserMapper; -import cn.tedu.wsf.user.pojo.dto.UserLoginParam; -import cn.tedu.wsf.user.pojo.dto.UserQueryParam; -import cn.tedu.wsf.user.pojo.dto.UserRegisterParam; -import cn.tedu.wsf.user.pojo.dto.UserSavaParam; +import cn.tedu.wsf.user.pojo.dto.*; import cn.tedu.wsf.user.pojo.entity.User; +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; import cn.tedu.wsf.user.pojo.vo.UserVO; import cn.tedu.wsf.user.service.UserService; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.entity.Worker; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.io.IOException; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; - +@Slf4j +@Transactional @Service public class UserServiceImpl implements UserService { @Autowired UserMapper userMapper; @Autowired + WorkerMapper workerMapper; + @Autowired AuthenticationManager authenticationManager; @Autowired RedisUtils redisUtils; @Autowired JwtUtils jwtUtils; - + @Autowired + PasswordEncoder passwordEncoder; + @Autowired + PhoneMessageUtils phoneMessageUtils; + @Autowired + RoleMapper roleMapper; + @Async + @RequiredLog(operation = "save") @Override public void save(UserSavaParam userSavaParam) { User user = new User(); BeanUtils.copyProperties(userSavaParam,user); userMapper.save(user); } - + @RequiredLog(operation = "save") @Override public void deleteById(Long id) { - userMapper.deleteById(id); +// userMapper.deleteById(id); } - @Override public List selectByQueryParam(UserQueryParam userQueryParam) { User user = new User(); @@ -56,24 +79,32 @@ public class UserServiceImpl implements UserService { List userVOS = userMapper.selectByQueryParam(user); return userVOS; } - @Override public void register(UserRegisterParam userRegisterParam) { System.out.println("userRegisterParam="+userRegisterParam); UserVO userVO = userMapper.selectByUsername(userRegisterParam.getUsername()); - System.out.println("userVO="+userVO); + UserRole userRole=new UserRole(); + userRole.setRoleId(1L); if (userVO==null){ User user = new User(); BeanUtils.copyProperties(userRegisterParam,user); + BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); + String encode = encoder.encode(userRegisterParam.getPassword()); + user.setPassword(encode); userMapper.register(user); + userRole.setUserId(user.getUserId()); + roleMapper.insert(userRole); }else { throw new ServiceException(StatusCode.USERNAME_ALREADY_EXISTS); } - } - @Override public UserVO login(UserLoginParam userLoginParam) { + String uuid = userLoginParam.getUuid(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + if (!userLoginParam.getCode().equals(redisUtils.get(verifyKey))){ + return null; + } UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userLoginParam.getUsername(), userLoginParam.getPassword()); Authentication authenticate = authenticationManager.authenticate(authentication); @@ -81,9 +112,8 @@ public class UserServiceImpl implements UserService { throw new RuntimeException("登录失败"); } LoginUser loginUser= (LoginUser) authenticate.getPrincipal(); - System.out.println(loginUser); User user = loginUser.getUser(); - String userid=user.getId().toString(); + String userid=user.getUserId().toString(); String token = jwtUtils.createToken(userid); redisUtils.set("login:"+userid,loginUser); UserVO userVO = new UserVO(); @@ -91,12 +121,72 @@ public class UserServiceImpl implements UserService { userVO.setToken(token); return userVO; } - + @RequiredLog(operation = "logout") @Override public void logout() { UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); - String userid = loginUser.getUser().getId().toString(); + String userid = loginUser.getUser().getUserId().toString(); redisUtils.delete("login:"+userid); } + + @Override + public UserVO messageLogin(UserMessageParam userMessageParam) { + String uuid = userMessageParam.getUuid(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + if (!userMessageParam.getCode().equals(redisUtils.get(verifyKey))){ + throw new ServiceException(StatusCode.CAPTCHA_ERROR); + } + System.out.println("验证码通过"); + UserVO userVO = userMapper.selectByPhone(userMessageParam.getPhone()); + if (userVO==null){ + throw new ServiceException(StatusCode.USER_NOT_EXISTS); + } + System.out.println("手机号通过"); + String messageKey= CacheConstants.PHONE_CODE_KEY+userMessageParam.getPhone(); + if (!userMessageParam.getMessageCode().equals(redisUtils.get(messageKey)+"")){ + System.out.println(redisUtils.get(messageKey)+""); + throw new ServiceException(StatusCode.PHONE_ERROR); + } + System.out.println("手机短信通过"); + LoginUser loginUser= new LoginUser(); + User user = new User(); + BeanUtils.copyProperties(userVO,user); + loginUser.setUser(user); + String userid=userVO.getUserId().toString(); + String token = jwtUtils.createToken(userid); + redisUtils.set("login:"+userid,loginUser); + userVO.setToken(token); + return userVO; + + } + + @Override + public void sendMessage(String phone) { + UserVO userVO = userMapper.selectByPhone(phone); + System.out.println(userVO==null); + if (userVO==null){ + throw new ServiceException(StatusCode.USER_NOT_EXISTS); + } + Object o = redisUtils.get(CacheConstants.PHONE_CODE_KEY + phone); + if (!Objects.isNull(o)){ + throw new ServiceException(StatusCode.PHONE_CODE_EXIST); + } + try { + phoneMessageUtils.sendVerification(phone); + } catch (Exception e) { + throw new ServiceException("发送短信失败"); + } + } + @RequiredLog(operation = "becomeWorker") + @Override + public void becomeWorker(Long userId) { + UserRole userRole=new UserRole(); + userRole.setUserId(userId); + userRole.setRoleId(2L); + roleMapper.update(userRole); + Worker worker=new Worker(); + worker.setUserId(userId); + workerMapper.insertWorker(worker); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java index eb86d6acfbed0bcc19c0144fbd9961b60e734625..50d482e551b516bbe98b84fc64c5cd000a55ad1a 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java @@ -1,14 +1,19 @@ package cn.tedu.wsf.worker.controller; + import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; -import cn.tedu.wsf.worker.server.WorkerService; +import cn.tedu.wsf.worker.pojo.dto.MoveInSaveParam; +import cn.tedu.wsf.worker.pojo.dto.WorkerAuditQueryParam; +import cn.tedu.wsf.worker.pojo.dto.WorkerQueryParam; +import cn.tedu.wsf.worker.pojo.dto.WorkerSaveParam; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; +import cn.tedu.wsf.worker.service.WorkerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +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; @@ -22,11 +27,42 @@ import java.util.List; public class WorkerController { @Autowired WorkerService workerService; - @ApiOperation("变成师傅") - @PostMapping("/register") - public JsonResult becomeWorker(WorkerRegisterParam workerRegisterParam){ - log.info("workerRegisterParam:{}",workerRegisterParam); - workerService.becomeWorker(workerRegisterParam); + @ApiOperation("师傅查询") + @GetMapping("/query") + public JsonResult selectByQueryParams(WorkerQueryParam WorkerQueryParam){ + log.debug("查询用户:WorkerQueryParam={}",WorkerQueryParam); + List workerVOS = workerService.selectByQueryParam(WorkerQueryParam); + System.out.println("workerVOS:"+workerVOS); + return JsonResult.ok(workerVOS); + } + @ApiOperation("师傅更新") + @PostMapping("/save") + public JsonResult saveWorker(WorkerSaveParam workerSaveParam){ + log.debug("保存师傅:workerSaveParam={}",workerSaveParam); + workerService.saveWorker(workerSaveParam); return JsonResult.ok(); } + @ApiOperation("师傅入驻") + @PostMapping("/moveIn") + public JsonResult moveInWorker(MoveInSaveParam moveInSaveParam){ + log.debug("入驻师傅:moveInSaveParam={}",moveInSaveParam); + workerService.insertWorkerAudit(moveInSaveParam); + return JsonResult.ok(); + } + + @ApiOperation("审核列表") + @GetMapping("/auditList") + public JsonResult selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam){ + System.out.println("workerAuditQueryParam:"+workerAuditQueryParam); + List workerAuditVOS = workerService.selectWorkerAuditList(workerAuditQueryParam); + return JsonResult.ok(workerAuditVOS); + } + @ApiOperation("审核更新") + @PostMapping("/auditupdate") + public JsonResult updateWorkerAudit(MoveInSaveParam moveInSaveParam){ + log.debug("MoveInSaveParam审核参数"+moveInSaveParam); + workerService.WorkerAudit(moveInSaveParam); + return JsonResult.ok(); + } + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java index b84085cb09eace5369c69b2f67f8339727ac75c1..1da94ee7e6096bb043ab7b88858dab3fa0eb71fa 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java @@ -1,16 +1,22 @@ package cn.tedu.wsf.worker.mapper; -import cn.tedu.wsf.order.pojo.entity.RequestOrder; +import cn.tedu.wsf.worker.pojo.dto.WorkerAuditQueryParam; import cn.tedu.wsf.worker.pojo.entity.Worker; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; +import cn.tedu.wsf.worker.pojo.entity.WorkerAudit; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface WorkerMapper { int insertWorker(Worker worker); - int insertArea(@Param("workerId") Long workerId,@Param("areaIds") Long[] areaIds); - int insertCategory(@Param("workerId") Long workerId,@Param("categoryIds")Long[] categoryIds); + void save(Worker worker); + List selectByQueryParam(Worker worker); + int insertWorkerAudit(WorkerAudit workerAudit); + List selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam); + int updateWorkerAudit(WorkerAudit workerAudit); + WorkerVO selectByUserId(Long userId); + WorkerVO selectByWorkerId(Long workerId); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java new file mode 100644 index 0000000000000000000000000000000000000000..57995d0aa0c706e5f48b6f64b61bcf237dc58b35 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java @@ -0,0 +1,24 @@ +package cn.tedu.wsf.worker.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class MoveInSaveParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "拒绝原因") + private String rejectReason; + @ApiModelProperty(value = "证明材料") + private String passport; + @ApiModelProperty(value = "城市ids") + private Long[] countyIds; + @ApiModelProperty(value = "品类ids") + private Long[] categoryIds; + @ApiModelProperty(value = "审核状态") + private String auditStatus; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..eb4616bdc41694f0a1b141aee68f60e182f07d94 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java @@ -0,0 +1,25 @@ +package cn.tedu.wsf.worker.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +@Data +public class WorkerAuditQueryParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty("userId") + private Long userId; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "审核人id") + private Long auditId; + @ApiModelProperty(value = "师傅姓名") + private String realName; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(value = "联系电话") + private String phone; + @ApiModelProperty(value = "审核状态 0:未审核,1已通过 2,驳回") + private Integer auditStatus; + @ApiModelProperty(value = "审核时间") + private Data auditTime; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerArea.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerQueryParam.java similarity index 47% rename from wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerArea.java rename to wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerQueryParam.java index 73a64c7d64468022f0958943d4b3615840b1ed00..42857b7ee7be4acf403399d22c1014783e4d98c3 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerArea.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerQueryParam.java @@ -1,16 +1,18 @@ -package cn.tedu.wsf.worker.pojo.entity; +package cn.tedu.wsf.worker.pojo.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data -public class WorkerArea { - @ApiModelProperty(value = "id") - private Long id; +public class WorkerQueryParam { @ApiModelProperty(value = "师傅id") private Long workerId; - @ApiModelProperty(value = "地区名字") - private String areaName; + @ApiModelProperty(value = "真实姓名") + private String realName; @ApiModelProperty(value = "1启用,0禁用") private String status; + @ApiModelProperty(value = "认证状态") + private String certState; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerRegisterParam.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerSaveParam.java similarity index 42% rename from wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerRegisterParam.java rename to wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerSaveParam.java index 648eded245b6b146d7ef2cddbdd767294cf5876b..c119e4df528214d74c9ca2dcff615148da6efd01 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerRegisterParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerSaveParam.java @@ -4,23 +4,25 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; -import java.util.List; @Data -public class WorkerRegisterParam { - +public class WorkerSaveParam { + @ApiModelProperty(value = "workerId") + private Long workerId; @ApiModelProperty(value = "用户id") private Long userId; - @ApiModelProperty(value = "出生日期") - private Date birthday; - @ApiModelProperty(value = "手机号") - private String phone; @ApiModelProperty(value = "真实姓名") private String realName; @ApiModelProperty(value = "身份证号") private String idCard; - @ApiModelProperty(value = "技能ids[]") - Long[] categoryIds; - @ApiModelProperty(value = "地区ids[]") - Long[] areaIds; + @ApiModelProperty(value = "1启用,0禁用") + private String status; + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + @ApiModelProperty(value = "修改时间") + private Date gmtModified; + @ApiModelProperty(value = "认证状态") + private String certStatus; + @ApiModelProperty(value = "审核状态") + private String auditStatus; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java index f52473fa0513da3a0607d19431236135ebae0ccd..df9e0298a199a970e397f826a0e8acb90a6f77d3 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java @@ -7,14 +7,10 @@ import java.util.Date; @Data public class Worker { - @ApiModelProperty(value = "id") - private Long id; + @ApiModelProperty(value = "workerId") + private Long workerId; @ApiModelProperty(value = "用户id") private Long userId; - @ApiModelProperty(value = "出生日期") - private Date birthday; - @ApiModelProperty(value = "手机号") - private String phone; @ApiModelProperty(value = "真实姓名") private String realName; @ApiModelProperty(value = "身份证号") @@ -25,10 +21,8 @@ public class Worker { private Date gmtCreate; @ApiModelProperty(value = "修改时间") private Date gmtModified; - @ApiModelProperty(value = "分成比例") - private Double workerProportion; @ApiModelProperty(value = "认证状态") - private String certState; + private String certStatus; @ApiModelProperty(value = "审核状态") - private String auditState; + private String auditStatus; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java new file mode 100644 index 0000000000000000000000000000000000000000..05982e7256d5d20d51184f502254b52724cda955 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java @@ -0,0 +1,26 @@ +package cn.tedu.wsf.worker.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerAudit { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "审核人id") + private Long auditId; + @ApiModelProperty(value = "审核人姓名") + private String userName; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "审核状态 0:待审核,1已通过 2,驳回") + private String auditStatus; + @ApiModelProperty(value = "审核时间") + private Data auditTime; + @ApiModelProperty(value = "拒绝原因") + private String rejectReason; + @ApiModelProperty(value = "证明材料") + private String passport; + @ApiModelProperty(value = "创建时间") + private Data createTime; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java deleted file mode 100644 index d6c74a54524576627cc456772382ddbc1d3de64e..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.worker.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class WorkerCategory { - @ApiModelProperty(value = "id") - private Long id; - @ApiModelProperty(value = "子服务id") - private Long workerId; - @ApiModelProperty(value = "技能id") - private String categoryId; - @ApiModelProperty(value = "1启用,0禁用") - private String status; - -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java new file mode 100644 index 0000000000000000000000000000000000000000..1f5fb8b7755b675d20d9786e5aecc60b567bdd36 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java @@ -0,0 +1,29 @@ +package cn.tedu.wsf.worker.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerAuditVO { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "师傅姓名") + private String realName; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(value = "联系电话") + private String phone; + @ApiModelProperty(value = "审核状态 0:未审核,1已通过 2,驳回") + private Integer auditStatus; + @ApiModelProperty(value = "审核时间") + private Data auditTime; + @ApiModelProperty(value = "拒绝原因") + private String rejectReason; + @ApiModelProperty(value = "证明材料") + private String passport; + @ApiModelProperty(value = "申请时间") + private Data createTime; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java new file mode 100644 index 0000000000000000000000000000000000000000..5460c0661eb222da2db0cc8c8c5ec955ce6988e7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java @@ -0,0 +1,31 @@ +package cn.tedu.wsf.worker.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class WorkerVO { + + @ApiModelProperty(value = "workerId") + private Long workerId; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "真实姓名") + private String realName; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(value = "1启用,0禁用") + private String status; + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + @ApiModelProperty(value = "修改时间") + private Date gmtModified; + @ApiModelProperty(value = "认证状态") + private String certStatus; + @ApiModelProperty(value = "审核状态") + private String auditStatus; + + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java deleted file mode 100644 index e6e3517a2339844682bc572c0e45c82b1ccc30c0..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.worker.server; - -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; - -import java.util.List; - -public interface WorkerService { - void becomeWorker(WorkerRegisterParam workerRegisterParam); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java deleted file mode 100644 index 48c3412caa659f8c5a88c7c20418ff930054bf18..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.tedu.wsf.worker.server.impl; - -import cn.tedu.wsf.worker.mapper.WorkerMapper; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.order.pojo.entity.RequestOrder; -import cn.tedu.wsf.worker.pojo.entity.Worker; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; -import cn.tedu.wsf.worker.server.WorkerService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Service -public class WorkerServiceImpl implements WorkerService { - @Autowired - WorkerMapper workerMapper; - - @Transactional - @Override - public void becomeWorker(WorkerRegisterParam workerRegisterParam) { - Worker worker = new Worker(); - BeanUtils.copyProperties(workerRegisterParam,worker); - workerMapper.insertWorker(worker); - workerMapper.insertArea(worker.getId(),workerRegisterParam.getAreaIds()); - workerMapper.insertCategory(worker.getId(),workerRegisterParam.getCategoryIds()); - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java new file mode 100644 index 0000000000000000000000000000000000000000..c0cc0892c762a1d47feb739bd44b694be0420dfa --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.worker.service; + +import cn.tedu.wsf.worker.pojo.dto.*; +import cn.tedu.wsf.worker.pojo.entity.WorkerAudit; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; + +import java.util.List; + +public interface WorkerService { + + List selectByQueryParam(WorkerQueryParam workerQueryParam); + void saveWorker(WorkerSaveParam workerSaveParam); + void insertWorkerAudit(MoveInSaveParam moveInSaveParam); + List selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam); + void WorkerAudit(MoveInSaveParam moveInSaveParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fff0f5a3752a22977b7e46245714d49c02214c89 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java @@ -0,0 +1,90 @@ +package cn.tedu.wsf.worker.service.impl; + + +import cn.tedu.wsf.category.mapper.CategoryMapper; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.log.annotation.RequiredLog; +import cn.tedu.wsf.pay.mapper.AccountMapper; +import cn.tedu.wsf.pay.pojo.entity.Account; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.dto.*; +import cn.tedu.wsf.worker.pojo.entity.Worker; +import cn.tedu.wsf.worker.pojo.entity.WorkerAudit; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; +import cn.tedu.wsf.worker.service.WorkerService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +@Transactional +@Service +public class WorkerServiceImpl implements WorkerService { + @Autowired + WorkerMapper workerMapper; + @Autowired + CityMapper cityMapper; + @Autowired + CategoryMapper categoryMapper; + @Autowired + AccountMapper accountMapper; + @Override + public List selectByQueryParam(WorkerQueryParam workerQueryParam) { + Worker worker=new Worker(); + BeanUtils.copyProperties(workerQueryParam,worker); + List workerVOS = workerMapper.selectByQueryParam(worker); + System.out.println("service=>workerVOS"+workerVOS); + return workerVOS; + } + @RequiredLog(operation = "saveWorker") + @Override + public void saveWorker(WorkerSaveParam workerSaveParam) { + + Worker worker=new Worker(); + BeanUtils.copyProperties(workerSaveParam,worker); + worker.setCertStatus("1"); + workerMapper.save(worker); + } + @RequiredLog(operation = "insertWorkerAudit") + @Override + public void insertWorkerAudit(MoveInSaveParam moveInSaveParam) { + WorkerAudit workerAudit=new WorkerAudit(); + BeanUtils.copyProperties(moveInSaveParam,workerAudit); + workerAudit.setAuditStatus("0"); + workerMapper.insertWorkerAudit(workerAudit); + cityMapper.insertWorkerCity(moveInSaveParam.getWorkerId(),moveInSaveParam.getCountyIds()); + categoryMapper.insertWorkerCategory(moveInSaveParam.getWorkerId(),moveInSaveParam.getCategoryIds()); + Worker worker=new Worker(); + worker.setAuditStatus("0"); + worker.setWorkerId(moveInSaveParam.getWorkerId()); + workerMapper.save(worker); + } + + @Override + public List selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam) { + return workerMapper.selectWorkerAuditList(workerAuditQueryParam); + } + @RequiredLog(operation = "WorkerAudit") + @Override + public void WorkerAudit(MoveInSaveParam moveInSaveParam) { + Worker worker=new Worker(); + WorkerAudit workerAudit=new WorkerAudit(); + BeanUtils.copyProperties(moveInSaveParam,worker); + BeanUtils.copyProperties(moveInSaveParam,workerAudit); + workerMapper.updateWorkerAudit(workerAudit); + workerMapper.save(worker); + if ("2".equals(moveInSaveParam.getAuditStatus())){ + cityMapper.deleteWorkerCity(moveInSaveParam.getWorkerId()); + categoryMapper.deleteWorkerCategory(moveInSaveParam.getWorkerId()); + }else { + Account account=new Account(); + WorkerVO workerVO = workerMapper.selectByWorkerId(moveInSaveParam.getWorkerId()); + account.setUserId(workerVO.getUserId()); + accountMapper.insert(account); + } + } +} diff --git a/wsf-system/src/main/resources/application.properties b/wsf-system/src/main/resources/application.properties index fcb90e4df649bd19712cf4b3bed1a5b21e9a682f..0389f1c19e7c3eb565fb8a6b202ceb3d311c36ae 100644 --- a/wsf-system/src/main/resources/application.properties +++ b/wsf-system/src/main/resources/application.properties @@ -1,14 +1,29 @@ server.port=8080 +#mysql ?? spring.datasource.url=jdbc:mysql://localhost:3306/db_wsf?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true spring.datasource.username=root spring.datasource.password=root mybatis.mapper-locations=classpath:mappers/*.xml mybatis.configuration.map-underscore-to-camel-case=true +#???? logging.level.root=WARN logging.level.cn.tedu.wsf=DEBUG +#knife4j?? knife4j.enable=true -spring.web.resources.static-locations=classpath:static - +#?????? +spring.web.resources.static-locations=classpath:static,file:${file.path}, +file.path=c:/pic +#redis ?? spring.redis.host=192.168.8.100 spring.redis.port=6379 -spring.redis.password=123456 \ No newline at end of file +spring.redis.password=123456 +#??? +wsf.captchaType=math +#xxl-job?? +xxl.job.admin.addresses=http://localhost:8090/xxl-job-admin +xxl.job.executor.appname=wsf-job +xxl.job.executor.port=9999 +xxl.job.executor.logpath=/xxljob/xxl-job/xxl-job-admin.log +xxl.job.executor.logretentiondays=30 +xxl.job.accessToken= + diff --git a/wsf-system/src/main/resources/http/userhttp.http b/wsf-system/src/main/resources/http/userhttp.http index aa591634ff3db47048264d9080a33d1e4d7fce75..8502730d883b774fe83418380c5f86a8d23f51ad 100644 --- a/wsf-system/src/main/resources/http/userhttp.http +++ b/wsf-system/src/main/resources/http/userhttp.http @@ -9,12 +9,14 @@ Content-Type: application/json # @no-cookie-jar POST http://localhost:8080/v1/file/upload Content-Type: multipart/form-data; boundary=WebAppBoundary -token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzI1MjY3MDQ0LCJleHAiOjE3MjU4NzE4NDR9.fz353Wsgzi80nRLPj4ZT6MZPY9U1m24Se69ufiK2e5pmw7bRwJ8rYH5CMbK70iCkvjoNffya6sr50cBj0mjlwQ +Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzI1Mjc3MjYwLCJleHAiOjE3MjU4ODIwNjB9.YSmnUNCu0ORygZduPgxcGNRh7bSGiI2ycVrdSC4NGFYQmmAkl-gGRrIDKovoyMOjIXUvLBpzY0bREyeKHG6tow --WebAppBoundary Content-Disposition: form-data; name="file"; filename="1.png" < C:/pic/1.png --WebAppBoundary-- +### +GET http://localhost:8080/wsf/user/code diff --git a/wsf-system/src/main/resources/mappers/AccountMapper.xml b/wsf-system/src/main/resources/mappers/AccountMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..1a2aaf37556df7a316432da7c4c4107d5c36ca94 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/AccountMapper.xml @@ -0,0 +1,23 @@ + + + + + insert into tb_account(user_id,gmt_create) + values(#{userId},now()) + + + update tb_account + + + settling_amount=#{settlingAmount}, + + + total_amount=#{totalAmount}, + + gmt_modified=#{gmtModified} + + where user_id=#{userId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/AreaMapper.xml b/wsf-system/src/main/resources/mappers/AreaMapper.xml deleted file mode 100644 index c217f4017b9278efcfe3d11f7d6d737297e3ae0d..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/resources/mappers/AreaMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/CategoryMapper.xml b/wsf-system/src/main/resources/mappers/CategoryMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..e1d253bc4bf62f0e1ac3d81daec730eba54ae7c8 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/CategoryMapper.xml @@ -0,0 +1,43 @@ + + + + + + insert into tb_worker_category(worker_id, category_id) values + + #{workerId}, #{item} + + + + delete from tb_worker_category where worker_id=#{workerId} + + + insert into tb_category(category_name, parent_id, depth, status) values + (#{categoryName}, #{parentId}, #{depth}, #{status}) + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/CityMapper.xml b/wsf-system/src/main/resources/mappers/CityMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4d83d02150c0f01d9da3d3966a71cce58205c824 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/CityMapper.xml @@ -0,0 +1,45 @@ + + + + + + insert into tb_worker_city(worker_id,city_id) values + + (#{workerId},#{item}) + + + + delete from tb_worker_city where worker_id=#{workerId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/LoginInforMapper.xml b/wsf-system/src/main/resources/mappers/LoginInforMapper.xml index 9bf3abca0e6acc7863427c110ca1c167e808a9f9..70d5200bdc37d9361286746b40141d6f3a3f1f8a 100644 --- a/wsf-system/src/main/resources/mappers/LoginInforMapper.xml +++ b/wsf-system/src/main/resources/mappers/LoginInforMapper.xml @@ -4,7 +4,33 @@ "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - insert into tb_logininfor(login_name,status,msg,login_time,ipaddr,login_location,browser,os) - values(#{loginName},#{status},#{msg},#{loginTime},#{ipaddr},#{loginLocation},#{browser},#{os}) + insert into tb_logininfor(user_name,status,msg,login_time,ipaddr,login_location,browser,os) + values(#{userName},#{status},#{msg},#{loginTime},#{ipaddr},#{loginLocation},#{browser},#{os}) + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/OperationLogMapper.xml b/wsf-system/src/main/resources/mappers/OperationLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c44cb34a3dc97a7b4879ed77d992bd7fa75df498 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/OperationLogMapper.xml @@ -0,0 +1,28 @@ + + + + + insert into tb_operation_log + (ip,username,create_time,operation,method,params,time,status,error) + values + (#{ip},#{username},now(),#{operation},#{method},#{params},#{time},#{status},#{error}) + + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/OrderMapper.xml b/wsf-system/src/main/resources/mappers/OrderMapper.xml index c62057eb1872665aaa873186b8bdd9e3411dac35..ff01e21cf06a69628faa38e1937387b8b2f84591 100644 --- a/wsf-system/src/main/resources/mappers/OrderMapper.xml +++ b/wsf-system/src/main/resources/mappers/OrderMapper.xml @@ -4,26 +4,161 @@ "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + select * from tb_request_order - - order_server_name like CONCAT('%',#{orderServerName},'%') - - - and order_category_name like CONCAT('%',#{orderCategoryName},'%') - - - and address like CONCAT('%',#{address},'%') - - and status='1' - and grab_status='0' - - - - - - + + id=#{id} + + + and request_order_no=#{requestOrderNo} + + + and order_name=#{orderName} + + + and order_category_id=#{orderCategoryId} + + + and order_category_name=#{orderCategoryName} + + + and order_amount=#{orderAmount} + + + and user_id=#{userId} + + + and user_name=#{userName} + + + and user_phone=#{userPhone} + + + and area_id=#{areaId} + + + and address=#{address} + + + and detail_address=#{detailAddress} + + + and service_time=#{serviceTime} + + + and status=#{status} + + + and grab_status=#{grabStatus} + + + insert into tb_request_order(request_order_no,user_id,order_name,order_category_id,order_category_name,order_amount,user_name,user_phone,area_id,address,detail_address,service_time,gmt_create) + values(#{requestOrderNo},#{userId},#{orderName},#{orderCategoryId},#{orderCategoryName},#{orderAmount},#{userName},#{userPhone},#{areaId},#{address},#{detailAddress},#{serviceTime},now()) + + + update tb_request_order + set grab_status=#{grabStatus} + where id=#{id} + + + update tb_request_order + + + order_name=#{orderName}, + + + order_category_id=#{orderCategoryId}, + + + order_category_name=#{orderCategoryName}, + + + order_amount=#{orderAmount}, + + + user_name=#{userName}, + + + user_phone=#{userPhone}, + + + area_id=#{areaId}, + + + address=#{address}, + + + detail_address=#{detailAddress}, + + + service_time=#{serviceTime}, + + + status=#{status}, + + version=version+1 + + where id=#{id} + + + insert into tb_order(order_no,user_id,user_name,user_phone,user_address,worker_name,worker_phone,request_order_no,order_category_id,order_category_name,request_order_price,request_order_raw_price,profit_scale,service_time,gmt_create) + values(#{orderNo},#{userId},#{userName},#{userPhone},#{userAddress},#{workerName},#{workerPhone},#{requestOrderNo},#{orderCategoryId},#{orderCategoryName},#{requestOrderPrice},#{requestOrderRawPrice},#{profitScale},#{serviceTime},now()) + + + + update tb_order + + + operate_name=#{operateName}, + + + status=#{status}, + + gmt_modified=#{gmtModified} + + where id=#{id} + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/RoleMapper.xml b/wsf-system/src/main/resources/mappers/RoleMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f3a129a0fbf0f8efbe704fad1b2b8ec1ac14cd8 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/RoleMapper.xml @@ -0,0 +1,15 @@ + + + + + insert into tb_user_role(user_id,role_id) values(#{userId},#{roleId}) + + + update tb_user_role set role_id=#{roleId} where user_id=#{userId} + + + delete from tb_user_role where user_id=#{userId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/TypeMapper.xml b/wsf-system/src/main/resources/mappers/TypeMapper.xml deleted file mode 100644 index 1b48b6bf8cebaa6c0c99efe4d514f1aa0eb72bb2..0000000000000000000000000000000000000000 --- a/wsf-system/src/main/resources/mappers/TypeMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/UserMapper.xml b/wsf-system/src/main/resources/mappers/UserMapper.xml index 659d647c4d6e174d3a6d32bfe84dd444eee65afc..b6c987f80ad6441206df777c729baa5eb0851d2f 100644 --- a/wsf-system/src/main/resources/mappers/UserMapper.xml +++ b/wsf-system/src/main/resources/mappers/UserMapper.xml @@ -3,14 +3,14 @@ - + INSERT INTO tb_users(username,password,nickname,phone,gmt_create,gmt_modified) VALUES(#{username},#{password},#{nickname},#{phone},now(),now()) - + SELECT user.* , role.role_name FROM tb_users user,tb_user_role urole,tb_role role username like CONCAT('%',#{username},'%') @@ -18,23 +18,21 @@ and nickname like CONCAT('%',#{nickname},'%') - - and enable=#{enable} + + and user.status=#{status} - - and is_delete=#{isDelete} - - - and id=#{id} + + and user.user_id=#{userId} - and is_delete=0 + and user.del_flag=0 + and urole.user_id=user.user_id and urole.role_id=role.role_id order by gmt_modified desc - UPDATE tb_users SET is_delete=1 WHERE id=#{id} + UPDATE tb_users SET del_flag=1 WHERE user_id=#{userId} UPDATE tb_users SET @@ -50,10 +48,22 @@ phone=#{phone}, - - enable=#{enable}, + + status=#{status}, + + + sex=#{sex}, + + + avatar=#{avatar}, - gmt_modified=now() - WHERE id=#{id} + gmt_modified=now() + WHERE user_id=#{userId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/WorkerMapper.xml b/wsf-system/src/main/resources/mappers/WorkerMapper.xml index 2eeea00547798e094869a80e5017dae3a5e6372a..ee8108f8c2f6ec2d2bc4a93d8b95bd13f7d11dfd 100644 --- a/wsf-system/src/main/resources/mappers/WorkerMapper.xml +++ b/wsf-system/src/main/resources/mappers/WorkerMapper.xml @@ -3,20 +3,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - insert into tb_workers(user_id,birthday,phone,real_name,id_card - ) values(#{userId},#{birthday},#{phone},#{realName},#{idCard}) + + insert into tb_worker(user_id,gmt_create) values(#{userId},now()) - - insert into tb_worker_area(worker_id,area_id) values - - (#{workerId},#{areaId}) - - - - insert into tb_worker_categorys(worker_id,category_id) values - - (#{workerId},#{categoryId}) - + + update tb_worker set + + real_name=#{realName}, + + + id_card=#{idCard}, + + + cert_status=#{certStatus}, + + + audit_status=#{auditStatus}, + + + status=#{status}, + + gmt_modified=now() + + + worker_id=#{workerId} + + + + + + insert into tb_worker_audit(worker_id,passport,create_time,audit_status) + values(#{workerId},#{passport},now(),#{auditStatus}) + + + update tb_worker_audit set + + audit_status=#{auditStatus}, + + + reject_reason=#{rejectReason}, + + audit_time=now() + where id=#{id} + + + \ No newline at end of file diff --git a/wsf-system/src/test/java/cn/tedu/wsf/CityTest.java b/wsf-system/src/test/java/cn/tedu/wsf/CityTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ee52d674807e76bf0f95678553d6683cb95211e8 --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/CityTest.java @@ -0,0 +1,25 @@ +package cn.tedu.wsf; + +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.List; + +@SpringBootTest +public class CityTest { + @Autowired + CityMapper cityMapper; + + @Test + void testQuery(){ + City city=new City(); +// city.setDepth(1); + city.setParentId(1801L); + List cityVOS = cityMapper.queryCityList(city); + cityVOS.forEach(System.out::println); + } +} diff --git a/wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java b/wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5406fee66adcc4b85f0f9cd4744a5f9eaf864bf7 --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf; + +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; +import cn.tedu.wsf.user.service.UserService; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class ImageTest { + @Autowired + UserService userService; + @Test + public void testImage(){ + + } +} diff --git a/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java b/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java index c85294ac39db27e5f872ded663e37db47ebd5075..5bb8567d8fc048a77cd54c796a2b5473a7110191 100644 --- a/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java +++ b/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java @@ -1,6 +1,7 @@ package cn.tedu.wsf; import cn.tedu.wsf.base.service.impl.LoginUser; +import cn.tedu.wsf.base.utils.PhoneMessageUtils; import cn.tedu.wsf.base.utils.RedisUtils; import cn.tedu.wsf.user.mapper.UserMapper; import cn.tedu.wsf.user.pojo.entity.User; @@ -18,6 +19,8 @@ public class LoginTest { PasswordEncoder passwordEncoder; @Autowired RedisUtils redisUtils; + @Autowired + PhoneMessageUtils phoneMessageUtils; @Test void testLogin(){ // String encode = passwordEncoder.encode("123456"); @@ -35,4 +38,12 @@ public class LoginTest { System.out.println(o instanceof LoginUser); System.out.println(o instanceof UserDetails); } + @Test + void testSend(){ + try { + phoneMessageUtils.sendVerification("15939466965"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } } diff --git a/wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java b/wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7631eebf94fd6614a5edb095064f75e51e2c1218 --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java @@ -0,0 +1,16 @@ +package cn.tedu.wsf; + +import cn.tedu.wsf.base.handler.MyWebSocketHandler; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class WebSocketTest { + @Autowired + MyWebSocketHandler myWebSocketHandler; + @Test + public void testConnect() { + myWebSocketHandler.sendNotification("10", "你好,我是测试消息"); + } +} diff --git a/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java b/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java index 4060440151bb5aebabd16dd5e8ac07693da9b6df..37aa5402d1587392a29b24f98aba498def2a2a22 100644 --- a/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java +++ b/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java @@ -1,28 +1,35 @@ package cn.tedu.wsf; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.worker.server.impl.WorkerServiceImpl; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.dto.WorkerAuditQueryParam; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.service.impl.WorkerServiceImpl; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import java.util.Date; +import java.util.List; @SpringBootTest public class WorkerTest { @Autowired WorkerServiceImpl workerService; + @Autowired + WorkerMapper workerMapper; @Test public void testBecomeWorker(){ - WorkerRegisterParam workerRegisterParam = new WorkerRegisterParam(); - workerRegisterParam.setUserId(1L); - workerRegisterParam.setRealName("张三"); - workerRegisterParam.setPhone("12345678901"); - workerRegisterParam.setIdCard("123456789012345678"); - workerRegisterParam.setBirthday(new Date()); - workerRegisterParam.setCategoryIds(new Long[]{1L,2L}); - workerRegisterParam.setAreaIds(new Long[]{1L,2L}); - System.out.println("workerRegisterParam="+workerRegisterParam); - workerService.becomeWorker(workerRegisterParam); +// WorkerRegisterParam workerRegisterParam = new WorkerRegisterParam(); +// workerRegisterParam.setUserId(1L); +// workerRegisterParam.setRealName("张三"); +// workerRegisterParam.setPhone("12345678901"); +// workerRegisterParam.setIdCard("123456789012345678"); +// workerRegisterParam.setBirthday(new Date()); +// workerRegisterParam.setCategoryIds(new Long[]{1L,2L}); +// workerRegisterParam.setAreaIds(new Long[]{1L,2L}); +// System.out.println("workerRegisterParam="+workerRegisterParam); +// workerService.becomeWorker(workerRegisterParam); + WorkerAuditQueryParam workerAuditQueryParam=new WorkerAuditQueryParam(); + List workerAuditVOS = workerMapper.selectWorkerAuditList(workerAuditQueryParam); + System.out.println(workerAuditVOS); } } diff --git a/wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java b/wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7e6e26208cec5919780beaa454858c1cc4dd3b55 --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java @@ -0,0 +1,12 @@ +//package cn.tedu.wsf; +// +//import com.xxl.job.core.biz.model.ReturnT; +//import com.xxl.job.core.context.XxlJobHelper; +//import org.junit.jupiter.api.Test; +//import org.springframework.boot.test.context.SpringBootTest; +// +//@SpringBootTest +//public class XxlJobTest { +// +// +//} diff --git a/wsf-ui/src/router/index.js b/wsf-ui/src/router/index.js index 88aeb9684d2ec053e1425426a73e07559423b974..64a1e200f6ffbf5d2e3cd460193af7f165925189 100644 --- a/wsf-ui/src/router/index.js +++ b/wsf-ui/src/router/index.js @@ -10,13 +10,18 @@ const routes = [ children:[ {path: '/user', component: () => import('../views/user/UserView.vue')}, {path: '/worker', component: () => import('../views/worker/WorkerView.vue')}, + {path: '/reqorder', component: () => import('../views/order/ReqOrderView.vue')}, {path: '/order', component: () => import('../views/order/OrderView.vue')}, + {path: '/workerOrder', component: () => import('../views/order/WorkerOrderView.vue')}, {path: '/loginlog', component: () => import('../views/log/LoginLogView.vue')}, - {path: '/operationlog', component: () => import('../views/log/OperationLogView.vue')} + {path: '/operationlog', component: () => import('../views/log/OperationLogView.vue')}, + {path: '/adminAudit', component: () => import('../views/worker/AdminAudit.vue')}, + {path: '/workerAudit', component: () => import('../views/worker/WorkerAudit.vue')}, ] }, {path: '/login', component: () => import('../views/LoginView')}, {path: '/register', component: () => import('../views/RegisterView.vue')}, + {path: '/message', component: () => import('../views/MessageLogin.vue')}, ] const router = createRouter({ diff --git a/wsf-ui/src/views/HomeView.vue b/wsf-ui/src/views/HomeView.vue index 08fb3d8630f1db4027720c6b3cdce721e0fa8a28..dfdf720982cf6afba59e023f8f41965bdf32676e 100644 --- a/wsf-ui/src/views/HomeView.vue +++ b/wsf-ui/src/views/HomeView.vue @@ -1,11 +1,7 @@ 基本信息 + 师傅审核 + 师傅审核查看 + 平台审核查看 - 订单信息 + 已入驻供应商 + 供应商审核 + 需求单列表 + + 用户工单 + 工单调度列表 + 师傅工单 + + + + 品类管理 + 区域管理 + + \ No newline at end of file diff --git a/wsf-ui/src/views/RegisterView.vue b/wsf-ui/src/views/RegisterView.vue index 37cb7d59862f2c67db1c7c1f6c19775a3f17f707..764cfa8041951e6ffa213df3d40073f233a88c9d 100644 --- a/wsf-ui/src/views/RegisterView.vue +++ b/wsf-ui/src/views/RegisterView.vue @@ -1,18 +1,11 @@