十月份大庆客户和人资

master
river 4 years ago
parent f7350de88d
commit 7a5eef0b12
  1. 9
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserServiceImpl.java
  2. 22
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java
  3. 31
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java
  4. 8
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java
  5. 7
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml
  6. 2
      dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java
  7. 6
      dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java
  8. 2
      dq-framework-common/src/main/java/com/daqing/framework/util/Md5Util.java
  9. 4
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeInfoVO.java
  10. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTemplate.java
  11. 1
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java
  12. 3
      dq-govern-gateway/src/main/resources/jwt.properties

@ -130,30 +130,29 @@ public class UserServiceImpl extends ServiceImpl<UserLoginDao, UserEntity> imple
*/
@Override
public Boolean weChatBinding(String code, HttpServletResponse response,String state) {
//String md5Code = Md5Util.md5(code);
String accessTokenUrl = String.format(weChatConfig.getOPEN_ACCESS_TOKEN_URL(),weChatConfig.getOpenAppid(),weChatConfig.getOpenAppsecret(),code);
String accessTokenUrl = String.format(weChatConfig.getOPEN_ACCESS_TOKEN_URL(),weChatConfig.getOpenAppid(),weChatConfig.getOpenAppsecret(),code);
//获取access_token
Map<String,Object> baseMap = HttpUtils.doGet(accessTokenUrl);
if(baseMap == null || baseMap.isEmpty()){
return false;
}
String openId = (String) baseMap.get("openid");
log.info(openId+"--------------------------------------------------------------------------------------------------");
String md5OpenId = Md5Util.md5(openId);
Integer countWeChatId = this.getBaseMapper().countWeChatId(md5OpenId);
String token = this.getBaseMapper().getTokenByUserId(Long.parseLong(state));
if (countWeChatId > 0){
try {
log.info("微信重复了,我走到了这里.............................");
response.sendRedirect("http://www.huorantech.cn/dq/index.html#/workbench-manpower?token="+token+"&message=1");
} catch (IOException e) {
e.printStackTrace();
}
}
}else {
Boolean result = this.getBaseMapper().updateWeChat(Long.parseLong(state), md5OpenId);
log.info("绑定成功---------------------------------------");
if (result){
if (token != null){
try {
log.info("转发成功---------------------------------------");
response.sendRedirect("http://www.huorantech.cn/dq/index.html#/workbench-manpower?token="+token);

@ -266,6 +266,13 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
if (userId == null){
ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_IS_NULL);
}
if (employeeInfoVO.getName().length() == 0
|| employeeInfoVO.getAccount().length() == 0
|| employeeInfoVO.getCompanyMail().length() == 0
|| employeeInfoVO.getJobNumber().length() == 0
|| employeeInfoVO.getPhone().length() == 0){
ExceptionCast.cast(HrmsCode.EMPLOYEE_INFO_NOT_NULL);
}
String account = employeeInfoVO.getAccount();
EmployeeEntity employee = new EmployeeEntity();
BeanUtils.copyProperties(employeeInfoVO, employee);
@ -299,13 +306,16 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
UserEntity user = new UserEntity();
user.setAccount(employeeInfoVO.getAccount());
user.setCreateTime(new Date());
user.setMotifyTime(new Date());
Boolean result1 = this.getBaseMapper().insertUser(user);
EmployeeEntity employee = new EmployeeEntity();
if (result1) {
// 根据新增的user主键id新增初始密码
Boolean result6 = this.getBaseMapper().updatePassword(user.getId(), Md5Util.md5(PromptSuccess.RESET_PASSWORD + user.getId()));
employee.setUserId(user.getId());
BeanUtils.copyProperties(employeeInfoVO, employee);
Boolean result2 = this.getBaseMapper().insertEmployee(employee);
if (result2) {
if (result2 && result6) {
Boolean result3 = this.getBaseMapper().insertDepartment(employee.getId(), employeeInfoVO.getDepartmentIds());
Boolean result4 = this.getBaseMapper().insertPosition(employee.getId(), employeeInfoVO.getPositionIds());
Boolean result5 = this.getBaseMapper().insertRole(user.getId(), employeeInfoVO.getRoleIds());
@ -360,6 +370,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
EmployeeExcelImport employeeExcelImport = new EmployeeExcelImport();
UserEntity user = new UserEntity();
EmployeeEntity employee = new EmployeeEntity();
// 获取所有的部门、职位、角色,excel文件中的数据对比
List<DepartmentVO> listDepartmentIdAndName = deptDao.listDepartmentIdAndName();
List<PositionVO> listPositionIdAndName = positionDao.listPositionIdAndName();
List<RoleVO> listRoleIdAndName = roleDao.listRoleIdAndName();
@ -383,12 +394,15 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
}
user.setAccount(employeeExcelImport.getAccount());
user.setCreateTime(new Date());
user.setMotifyTime(new Date());
this.getBaseMapper().insertUser(user);
// 根据新增的user主键id新增初始密码
this.getBaseMapper().updatePassword(user.getId(),Md5Util.md5(PromptSuccess.RESET_PASSWORD+user.getId()));
BeanUtils.copyProperties(e, employee);
employee.setUserId(user.getId());
this.getBaseMapper().insertEmployee(employee);
// 部门
String[] departmentNames = employeeExcelImport.getDepartmentNameList().split(",");
String[] departmentNames = employeeExcelImport.getDepartmentNameList().split("&");
if (departmentNames.length == 0) {
ExceptionCast.cast(HrmsCode.EMPLOYEE_DEPARTMENT_IS_NULL);
}
@ -404,7 +418,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
}
this.getBaseMapper().insertDepartment(employee.getId(), new ArrayList<>(deptIds));
// 职位
String[] positionNames = employeeExcelImport.getPositionNameList().split(",");
String[] positionNames = employeeExcelImport.getPositionNameList().split("&");
if (positionNames.length == 0) {
ExceptionCast.cast(HrmsCode.EMPLOYEE_POSITION_IS_NULL);
}
@ -420,7 +434,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
}
this.getBaseMapper().insertPosition(employee.getId(), new ArrayList<>(positionIds));
// 角色
String[] roleNames = employeeExcelImport.getRoleNameList().split(",");
String[] roleNames = employeeExcelImport.getRoleNameList().split("&");
if (roleNames.length == 0) {
ExceptionCast.cast(HrmsCode.EMPLOYEE_ROLE_IS_NULL);
}

@ -17,13 +17,17 @@ import com.daqing.framework.domain.hrms.response.HrmsCode;
import com.daqing.framework.domain.hrms.response.PositionResponse;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.util.RedisUtil;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.SnowflakeIdUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -63,11 +67,21 @@ public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity
@Transactional
public boolean savePosition(PositionRequest position) {
//TODO 用户id从当前登录token中获取,不由前端传递
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader("token");
String userId = RedisUtil.get("dq:token:" + token);
if (userId != null){
position.setUserId(Long.parseLong(userId));
}
if (position == null
|| position.getDeptIds() == null
|| position.getName() == null
|| position.getUserId() == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
ExceptionCast.cast(CommonCode.USER_LOGIN_NULL);
}
if (position.getDeptIds() == null
|| position.getDeptIds().length == 0
|| position.getName() == null
|| position.getName().length() == 0){
ExceptionCast.cast(CommonCode.POSITION_DEPT_NOT_NULL);
}
//校验该部门下面有没有重复的职位
List<Long> deptIdList = Arrays.asList(position.getDeptIds());
@ -98,12 +112,15 @@ public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity
@Transactional
public boolean updatePosition(PositionRequest positionRequest) {
if (positionRequest == null
|| positionRequest.getId() == null
|| positionRequest.getDeptIds() == null
|| positionRequest.getName() == null) {
|| positionRequest.getId() == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
if (positionRequest.getDeptIds() == null
|| positionRequest.getDeptIds().length == 0
|| positionRequest.getName() == null
|| positionRequest.getName().length() == 0){
ExceptionCast.cast(CommonCode.POSITION_DEPT_NOT_NULL);
}
//校验该部门下面有没有重复的职位
List<Long> deptIdList = Arrays.asList(positionRequest.getDeptIds());
deptIdList.forEach(deptId -> {

@ -48,6 +48,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
public EmployeeAndUserVO info() {
String userId = this.getUserId();
EmployeeAndUserVO employeeAndUser = employeeDao.getEmployeeByUserId(Long.parseLong(userId));
if (employeeAndUser == null){
return employeeAndUser;
}
if (employeeAndUser.getWechatId() == null || employeeAndUser.getWechatId().length() == 0){
employeeAndUser.setWechatId(PromptSuccess.QR_CODE_FAIL);
}else {
@ -136,13 +139,15 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
}
String substring = filename.substring(filename.lastIndexOf("."));
String filePrefix = UUID.randomUUID().toString();
// 图片上传绝对路径
String filePath = PromptSuccess.UPLOAD_FILE_PATH+filePrefix+substring;
try {
file.transferTo(new File(filePath));
} catch (IOException e) {
ExceptionCast.cast(HrmsCode.USER_FILE_UPLOAD_FAIL);
}
return filePath;
// 图片访问路径
return PromptSuccess.IMAGE_URL_PATH+filePrefix+substring;
}
/**
@ -160,6 +165,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
if (!Objects.equals(affirmNewPassword, newPassword)){
ExceptionCast.cast(HrmsCode.USER_PASSWORD_NO_CONSISTENT);
}
// 旧密码是否正确
String userId = this.getUserId();
if (!Objects.equals(Md5Util.md5(primaryPassword + Long.parseLong(userId)),this.getBaseMapper().getPasswordById(Long.parseLong(userId)))){
ExceptionCast.cast(HrmsCode.USER_PASSWORD_MISTAKE);

@ -424,7 +424,7 @@
</insert>
<insert id="insertUser" keyProperty="id" useGeneratedKeys="true" parameterType="com.daqing.framework.domain.hrms.UserEntity">
INSERT INTO hrms_user (account,create_time) VALUES (#{account},#{createTime})
INSERT INTO hrms_user (account,create_time,motify_time) VALUES (#{account},#{createTime},#{motifyTime})
</insert>
<select id="getEmployeeByUserId" parameterType="long" resultMap="employeeInfoByUserId">
@ -456,7 +456,10 @@
<update id="updateEmployeeAndUser" parameterType="com.daqing.framework.domain.hrms.EmployeeEntity">
UPDATE hrms_employee SET gender = #{gender},office_phone = #{officePhone},phone = #{phone},
company_mail = #{companyMail},spare_mail = #{spareMail},head_portarit_url = #{headPortaritUrl}
company_mail = #{companyMail},spare_mail = #{spareMail}
<if test="headPortaritUrl != null and headPortaritUrl != ''">
,head_portarit_url = #{headPortaritUrl}
</if>
WHERE id = #{id}
</update>

@ -28,6 +28,8 @@ public enum CommonCode implements ResultCode {
UNAUTHORISE(false, 10002, "权限不足,无权操作!"),
INVALID_PARAM(false, 10003, "非法参数!"),
USER_IS_NOT_EXIST(false, 10004, "用户不存在或用户已禁用!"),
USER_LOGIN_NULL(false,10013,"获取当前用户登录信息失败!"),
POSITION_DEPT_NOT_NULL(false,10014,"职位名称或所属部门不能为空!"),
PASSWORD_IS_ERROR(false, 10005, "密码错误!"),
IMPORT_ERROR(false,10008,"导入数据失败!"),
SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!");

@ -26,9 +26,11 @@ public class PromptSuccess {
public static final Long OVERDUE_TIME = 70L; // 过期时间,单位为秒
public static final String QR_CODE_FAIL = "1"; // 没绑定
public static final String QR_CODE_FAIL = "1"; // 微信没绑定
public static final String QR_CODE_BINDING_SUCCESS = "0"; // 已绑定
public static final String QR_CODE_BINDING_SUCCESS = "0"; // 微信已绑定
public static final String UPLOAD_FILE_PATH = "//usr//local//nginx//html//admin//headImg//";
public static final String IMAGE_URL_PATH = "http://www.huorantech.cn/headImg/";
}

@ -29,6 +29,6 @@ public class Md5Util {
//String s = URLEncoder.encode("www.occupationlab.com", "utf-8");
//System.out.println(s);
//System.out.println(md5("1234564"));
System.out.println(md5("Aa12344"));
System.out.println(md5("Aa12341"));
}
}

@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ -43,10 +45,12 @@ public class EmployeeInfoVO implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;
@Pattern(regexp = "^1[3|4|5|7|8][0-9]\\d{4,8}$",message = "手机号码格式错误")
@NotNull(message = "手机号码不能为空")
@ApiModelProperty("手机号码")
private String phone;
@Email(message = "邮箱格式错误")
@NotNull(message = "公司邮箱不能为空")
@ApiModelProperty("公司邮箱")
private String companyMail;

@ -26,13 +26,13 @@ public class EmployeeTemplate extends BaseRowModel implements Serializable {
@ExcelProperty(value = "工号",index = 2)
private String jobNumber;
@ExcelProperty(value = "部门(eg:安全部门,技术部门,请按照格式填写正常且已存在的部门名称)",index = 3)
@ExcelProperty(value = "部门(eg:安全部门&技术部门 请按照格式填写正常且已存在的部门名称)",index = 3)
private List<String> departmentNameList;
@ExcelProperty(value = "职位(eg:总经理,产品经理,请按照格式填写正常且已存在的职位名称)",index = 4)
@ExcelProperty(value = "职位(eg:总经理&董事长 请按照格式填写正常且已存在的职位名称)",index = 4)
private List<String> positionNameList;
@ExcelProperty(value = "角色(eg:管理员,员工,请按照格式填写正常且已存在的角色名称)",index = 5)
@ExcelProperty(value = "角色(eg:超级管理员&普通管理员 请按照格式填写正常且已存在的角色名称)",index = 5)
private List<String> roleNameList;
}

@ -34,6 +34,7 @@ public enum HrmsCode implements ResultCode {
EMPLOYEE_ROLE_NAME_IS_NOT(false,44010,"角色名称重复或不存在,请输入正常的角色名称!"),
EMPLOYEE_DISABLE_TIME_ERROR(false,44011,"禁用失败,当前禁用开始时间可能大于或等于结束时间!"),
EMPLOYEE_USER_IS_NULL(false,44012,"当前员工的用户信息已不存在!"),
EMPLOYEE_INFO_NOT_NULL(false,44013,"姓名、账号、手机号、公司邮箱、工号不能为空,请正确填写!"),
POSITION_NOT_NULL(false,55001,"职位不能为空!"),

@ -7,6 +7,9 @@ jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,\
/api-crms/crms/customer/excelTemplate,\
/api-crms/crms/customer/excelExport,\
/api-crms/crms/customer/excelImport,\
/api-hrms/hrms/employee/excelExport,\
/api-hrms/hrms/employee/excelTemplate,\
/api-hrms/hrms/employee/excelImport,\
/apiHrmsAuth/hrms/auth/userlogin/bindPhoneAndOpenId,\
/apiHrmsAuth/hrms/auth/userlogin/sendCode,\
/apiHrmsAuth/hrms/auth/userlogin/isPhoneExist

Loading…
Cancel
Save