This commit is contained in:
fumeiai 2020-05-25 15:39:26 +08:00
parent da53eb1c7d
commit e25faebd30
14 changed files with 104 additions and 67 deletions

31
.idea/workspace.xml generated
View File

@ -3,7 +3,15 @@
<component name="ChangeListManager">
<list default="true" id="e4baaf01-a2c2-445d-98a1-9f4c50c148cf" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/mapper/generator/StaffDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/mapper/generator/StaffDao.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/job/business/FeishuBusiness.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/job/business/FeishuBusiness.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/controller/SysLoginController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/controller/SysLoginController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/controller/SysUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/controller/SysUserController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application-dev.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffOccupationDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffOccupationDao.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/application-dev.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/job/business/FeishuBusiness.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/job/business/FeishuBusiness.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/sys/controller/SysLoginController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/sys/controller/SysLoginController.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/sys/controller/SysUserController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/sys/controller/SysUserController.class" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -72,6 +80,19 @@
</option>
</component>
<component name="RunManager" selected="Spring Boot.LinziApplication">
<configuration name="SysUserController" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.lz.modules.sys.controller.SysUserController" />
<module name="lz_management" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.lz.modules.sys.controller.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="FeishuBusiness.getFeishuDepartmentsIntoData" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="lz_management" />
<extension name="coverage">
@ -136,6 +157,7 @@
<recent_temporary>
<list>
<item itemvalue="Spring Boot.LinziApplication" />
<item itemvalue="Application.SysUserController" />
<item itemvalue="JUnit.FumeiaiTest.contextLoads" />
<item itemvalue="JUnit.RedisTest.contextLoads" />
<item itemvalue="JUnit.FeishuBusiness.getFeishuDepartmentsIntoData" />
@ -157,7 +179,7 @@
<workItem from="1588163384182" duration="74761000" />
<workItem from="1588936950753" duration="95758000" />
<workItem from="1590038091791" duration="38394000" />
<workItem from="1590136970394" duration="4023000" />
<workItem from="1590136970394" duration="14639000" />
</task>
<servers />
</component>
@ -185,6 +207,11 @@
<line>233</line>
<option name="timeStamp" value="104" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/com/lz/common/utils/FeishuUtil.java</url>
<line>144</line>
<option name="timeStamp" value="112" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>

View File

@ -144,7 +144,7 @@ public class FeishuUtil {
JSONObject dataObj = JSON.parseObject(result);
List childDepartmentIds = new ArrayList();
List departmentInfos = JSONArray.parseArray(dataObj.getJSONObject("data").getString("department_infos"), String.class);
for (int i = 0; i < departmentInfos.size() - 1; i++) {
for (int i = 0; i <= departmentInfos.size() - 1; i++) {
childDepartmentIds.add(JSON.parseObject(departmentInfos.get(i).toString()).getString("id"));
}
return childDepartmentIds;

View File

@ -81,9 +81,9 @@ public class FeishuBusiness {
for (DepartmentInfosBo departmentInfo : departmentInfosBos) {
//获取部门用户详情
List<DepartmentStaffBo> staffs = feishuUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
System.out.println("=============================" + departmentInfo.getName() + "================================");
for (DepartmentStaffBo staff : staffs)
System.out.println(staff.getName());
logger.info("=============================" + departmentInfo.getName() + "================================");
// for (DepartmentStaffBo staff : staffs)
// logger.info(staff.getName());
//循环录入到员工信息表中
List<Long> staffIds = staffService.updateStaffsInfo(staffs);
@ -94,8 +94,6 @@ public class FeishuBusiness {
}
System.out.println(departmentInfosBos.size());
}
public void enterStaffOccupationInfos(List<DepartmentStaffBo> staffs) {

View File

@ -1,8 +1,8 @@
/**
* Copyright (c) 2020 fumeiai All rights reserved.
*
*
*
* <p>
* <p>
* <p>
* 版权所有侵权必究
*/
@ -36,65 +36,67 @@ import java.util.Map;
*/
@RestController
public class SysLoginController extends AbstractController {
@Autowired
private SysUserService sysUserService;
@Autowired
private SysUserTokenService sysUserTokenService;
@Autowired
private SysCaptchaService sysCaptchaService;
@Autowired
private SysUserService sysUserService;
@Autowired
private SysUserTokenService sysUserTokenService;
@Autowired
private SysCaptchaService sysCaptchaService;
/**
* 验证码
*/
@GetMapping("captcha.jpg")
public void captcha(HttpServletResponse response, String uuid)throws IOException {
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
/**
* 验证码
*/
@GetMapping("captcha.jpg")
public void captcha(HttpServletResponse response, String uuid) throws IOException {
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
//获取图片验证码
BufferedImage image = sysCaptchaService.getCaptcha(uuid);
//获取图片验证码
BufferedImage image = sysCaptchaService.getCaptcha(uuid);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
IOUtils.closeQuietly(out);
}
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
IOUtils.closeQuietly(out);
}
/**
* 登录
*/
@PostMapping("/sys/login")
public Map<String, Object> login(@RequestBody SysLoginForm form)throws IOException {
boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
if(!captcha){
return R.error("验证码不正确");
}
/**
* 登录
*/
@PostMapping("/sys/login")
public Map<String, Object> login(@RequestBody SysLoginForm form) throws IOException {
boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
if (!captcha) {
return R.error("验证码不正确");
}
//用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername());
//用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername());
if (user == null) {
return R.error("账号不存在");
}
//账号不存在密码错误
if (!user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
return R.error("密码不正确");
}
//账号不存在密码错误
if(user == null || !user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
return R.error("账号或密码不正确");
}
//账号锁定
if (user.getStatus() == 0) {
return R.error("账号已被停用,请联系管理员");
}
//账号锁定
if(user.getStatus() == 0){
return R.error("账号已被锁定,请联系管理员");
}
//生成token并保存到数据库
R r = sysUserTokenService.createToken(user.getUserId());
return r;
}
//生成token并保存到数据库
R r = sysUserTokenService.createToken(user.getUserId());
return r;
}
/**
* 退出
*/
@PostMapping("/sys/logout")
public R logout() {
sysUserTokenService.logout(getUserId());
return R.ok();
}
/**
* 退出
*/
@PostMapping("/sys/logout")
public R logout() {
sysUserTokenService.logout(getUserId());
return R.ok();
}
}

View File

@ -88,6 +88,10 @@ public class SysUserController extends AbstractController {
return R.ok();
}
public static void main(String[] args) {
String newPassword = new Sha256Hash("Linzi!@#123", "YzcmCZNvbXocrsz9dm8e").toHex();
System.out.println(newPassword);
}
/**
* 用户信息
*/

View File

@ -3,7 +3,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://101.37.106.150:3306/lz_management?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://172.16.157.238:3306/lz_management?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: ldd_biz
password: Hello1234
initial-size: 10

View File

@ -31,8 +31,11 @@
<select id="getStaffOccupationByStaffId" resultType="com.lz.modules.app.entity.StaffOccupationEntity">
select * from lz_staff_occupation where is_delete=0 and staff_id = #{staffId}
</select>
<select id="getOccupationByStaffId" resultType="com.lz.modules.app.Dto.StaffOccupationInfoDto">
select employee_no staff_no,position,entry_time,staff_status,resignation_time,resignation_reasons,company_seniority,signing_company,job_begin_time,work_experience,resume_url
select employee_no staff_no,position,entry_time,staff_status,resignation_time,resignation_reasons,
concat(floor(TIMESTAMPDIFF(day,entry_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))/360),'年',TIMESTAMPDIFF(day,entry_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) mod 360 div 30,'个月',TIMESTAMPDIFF(day,entry_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) mod 360 mod 30,'天') company_seniority,
signing_company,job_begin_time,work_experience,resume_url
from lz_staff_occupation where is_delete=0 and staff_id=#{staffId}
</select>

View File

@ -3,7 +3,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://101.37.106.150:3306/lz_management?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://172.16.157.238:3306/lz_management?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: ldd_biz
password: Hello1234
initial-size: 10

View File

@ -8,7 +8,7 @@
<springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO" />
<logger name="com.lz.modules.app.dao" level="DEBUG" />
<!-- <logger name="com.lz.modules.app.dao" level="DEBUG" />-->
<logger name="io.lz" level="DEBUG" />
</springProfile>

View File

@ -31,8 +31,11 @@
<select id="getStaffOccupationByStaffId" resultType="com.lz.modules.app.entity.StaffOccupationEntity">
select * from lz_staff_occupation where is_delete=0 and staff_id = #{staffId}
</select>
<select id="getOccupationByStaffId" resultType="com.lz.modules.app.Dto.StaffOccupationInfoDto">
select employee_no staff_no,position,entry_time,staff_status,resignation_time,resignation_reasons,company_seniority,signing_company,job_begin_time,work_experience,resume_url
select employee_no staff_no,position,entry_time,staff_status,resignation_time,resignation_reasons,
concat(floor(TIMESTAMPDIFF(day,entry_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))/360),'年',TIMESTAMPDIFF(day,entry_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) mod 360 div 30,'个月',TIMESTAMPDIFF(day,entry_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) mod 360 mod 30,'天') company_seniority,
signing_company,job_begin_time,work_experience,resume_url
from lz_staff_occupation where is_delete=0 and staff_id=#{staffId}
</select>