diff --git a/src/main/java/com/lz/common/aspect/LogAspect.java b/src/main/java/com/lz/common/aspect/LogAspect.java index ded395ab..d524b3b7 100644 --- a/src/main/java/com/lz/common/aspect/LogAspect.java +++ b/src/main/java/com/lz/common/aspect/LogAspect.java @@ -1,19 +1,19 @@ package com.lz.common.aspect; -import cn.hutool.system.UserInfo; import com.alibaba.fastjson.JSON; import com.lz.common.utils.OrderUtil; import com.lz.common.utils.R; import com.lz.common.utils.ServletUtils; import com.lz.common.utils.StringUtil; +import com.lz.modules.sys.entity.SysUserEntity; import org.apache.catalina.connector.ResponseFacade; +import org.apache.shiro.SecurityUtils; 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.slf4j.Logger; import org.slf4j.LoggerFactory; -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; @@ -22,7 +22,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** @@ -60,9 +59,14 @@ public class LogAspect { Object arg = result; String ip = ""; String m = ""; + Object object = SecurityUtils.getSubject().getPrincipal(); + String userName = ""; + if(object !=null){ + SysUserEntity userEntity = (SysUserEntity)object; + userName = userEntity.getUsername(); + } - String userName = ""; - String params = ""; + String params = ""; try { ch.qos.logback.classic.Logger.threadLocalNo.set(logNo); ch.qos.logback.classic.Logger.threadLocalTime.set(start); diff --git a/src/main/java/com/lz/config/ShiroConfig.java b/src/main/java/com/lz/config/ShiroConfig.java index 9b7bb581..0eae9bdf 100644 --- a/src/main/java/com/lz/config/ShiroConfig.java +++ b/src/main/java/com/lz/config/ShiroConfig.java @@ -64,7 +64,6 @@ public class ShiroConfig { filterMap.put("/captcha.jpg", "anon"); filterMap.put("/aaa.txt", "anon"); filterMap.put("/dtlg/login", "anon"); - filterMap.put("/api/**", "anon"); filterMap.put("/dtlg/luck", "anon"); filterMap.put("/dtlg/look", "anon"); filterMap.put("/dtlg/jump", "anon"); diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 7851a998..e781119e 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -262,7 +262,6 @@ public class ResultRecordController extends AbstractController { list.add(comment); } } - String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId()); int fileCount = recordFileService.selectRecordFileCountByRecordId(resultRecord.getId()); return R.ok() @@ -487,10 +486,13 @@ public class ResultRecordController extends AbstractController { BigDecimal checkWeight = NumberUtil.objToBigDecimalDefault(resultDetail.getCheckWeight(), BigDecimal.ZERO); BigDecimal acquireScore = NumberUtil.objToBigDecimalDefault(resultDetail.getAcquireScore(), BigDecimal.ZERO); sum = sum.add(checkWeight.multiply(acquireScore)); + } sum = BigDecimalUtil.setScale(sum, 3); + String scoreLevel = resultDetailService.getScoreLevel(sum.doubleValue()); resultRecord.setLastScore(sum); resultRecord.setAllScore(sum); + resultRecord.setScoreLevel(scoreLevel); resultRecordService.updateResultRecordById(resultRecord); } return R.ok("保存成功").put("recordId", resultRecord.getId()); diff --git a/src/main/java/com/lz/modules/app/service/StaffService.java b/src/main/java/com/lz/modules/app/service/StaffService.java index 4ca790ee..76d08298 100644 --- a/src/main/java/com/lz/modules/app/service/StaffService.java +++ b/src/main/java/com/lz/modules/app/service/StaffService.java @@ -10,6 +10,7 @@ import com.lz.modules.app.dto.StaffStatisticalDto; import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.equipment.entity.model.FindByNameModel; import com.lz.modules.job.model.responseBo.DepartmentStaffBo; +import com.lz.modules.sys.entity.SysUserEntity; import java.util.List; import java.util.Map; @@ -75,5 +76,6 @@ public interface StaffService extends IService { StaffEntity selectStaffByEmployeeId(String employeeId); List selectBySearchName(IPage page, FindByNameModel nameModel); + SysUserEntity getUser(String userName); } diff --git a/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java index e3f111cc..8906ad77 100644 --- a/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java @@ -80,7 +80,11 @@ public class DepartmentsServiceImpl extends ServiceImpl impleme } @Override - public List selectBySearchName(IPage page, FindByNameModel nameModel){ + public List selectBySearchName(IPage page, FindByNameModel nameModel) { return staffDao.selectBySearchName(page, nameModel); } + @Override + public SysUserEntity getUser(String userName) { + SysUserEntity user = null; + StaffEntity staffEntity = staffDao.selectByPhone(userName); + if(staffEntity != null){ + user = new SysUserEntity(); + user.setPassword(staffEntity.getPassword()); + user.setMobile(staffEntity.getMobile()); + user.setUserId(staffEntity.getId()); + user.setEmail(staffEntity.getEmail()); + user.setSalt(staffEntity.getSalt()); + user.setStatus(1); + user.setType(1); + user.setUsername(staffEntity.getMobile()); + user.setRealName(staffEntity.getName()); + user.setUserNo(staffEntity.getMobile()); + return user; + } + return null; + } @Override diff --git a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java index 8b04cf6e..69db429a 100644 --- a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java +++ b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java @@ -250,14 +250,14 @@ public class EquipmentInfoServiceImpl extends ServiceImpl map = departmentsService.selectUserAllDepartmentInFo(departmentsStaffRelateEntity.getDepartmentId()); + if (StringUtil.isNotBlank(map.get("dd2"))) { + StaffEntity staffEntity = getLeader(map.get("dd2")); + if (staffEntity != null) { + return staffEntity.getName(); + } + } + if (StringUtil.isNotBlank(map.get("dd3"))) { + StaffEntity staffEntity = getLeader(map.get("dd3")); + if (staffEntity != null) { + return staffEntity.getName(); + } + } } return ""; } } + public StaffEntity getLeader(String departmentId){ + DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentId); + if(leader !=null && leader.getIsLeader().equals(1)){ + StaffEntity staffEntity = staffService.selectStaffById(leader.getStaffId()); + return staffEntity; + } + return null; + } + } diff --git a/src/main/java/com/lz/modules/sys/controller/SysLoginController.java b/src/main/java/com/lz/modules/sys/controller/SysLoginController.java index 0b74958b..b723c5b9 100644 --- a/src/main/java/com/lz/modules/sys/controller/SysLoginController.java +++ b/src/main/java/com/lz/modules/sys/controller/SysLoginController.java @@ -101,10 +101,15 @@ public class SysLoginController extends AbstractController { } //用户信息 SysUserEntity user = sysUserService.queryByUserName(form.getUserName()); - if (user == null) { - return R.error("账号不存在!"); + if (user == null) { + user = staffService.getUser(form.getUserName()); + if (user == null) { + return R.error("账号不存在!"); + } + } } + //账号不存在、密码错误 if (!user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) { return R.error("密码不正确!"); @@ -200,14 +205,14 @@ public class SysLoginController extends AbstractController { if (user.getStatus() == 0) { return R.error("账号已被停用,请联系管理员"); } - //String verifyCode = form.getVerifyCode(); - // CodeRecordEntity codeRecordEntity = codeRecordService.getOne(new QueryWrapper().eq("send_account", user.getMobile()).eq("verify_code", verifyCode).eq("is_check", 0).ge("gmt_create", DateUtils.addDateMinutes(new Date(), -30))); + String verifyCode = form.getVerifyCode(); + CodeRecordEntity codeRecordEntity = codeRecordService.getOne(new QueryWrapper().eq("send_account", user.getMobile()).eq("verify_code", verifyCode).eq("is_check", 0).ge("gmt_create", DateUtils.addDateMinutes(new Date(), -30))); - /* if (codeRecordEntity == null) { + if (codeRecordEntity == null) { return R.error("短信验证码不正确!"); } codeRecordEntity.setIsCheck(1); - codeRecordService.updateById(codeRecordEntity);*/ + codeRecordService.updateById(codeRecordEntity); //生成token,并保存到数据库 R r = sysUserTokenService.createToken(user); diff --git a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java index b3ba6bba..acc4c94c 100644 --- a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java +++ b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java @@ -11,7 +11,7 @@ import java.util.Date; * 菜单权限表 *

*业绩记录表 * @author quyixiao -* @since 2020-08-20 +* @since 2020-09-15 */ @Data @@ -48,12 +48,12 @@ public class ResultRecord implements java.io.Serializable { private String departmentName; //员工姓名 private String staffName; - //当前审批的员工 id private Long currentApprovalStaffId; //当前审批的员工名,以逗号隔开 private String currentApprovalStaffName; - + //等级 + private String scoreLevel; /** * * @return @@ -130,14 +130,14 @@ public class ResultRecord implements java.io.Serializable { } /** - * 0.新建,1 提交审批中,2 拒绝 + * 0.新建,1 提交审批中,2 拒绝, 3 侍提交 ,4 审批通过,5 驳回 * @return */ public Integer getStatus() { return status; } /** - * 0.新建,1 提交审批中,2 拒绝 + * 0.新建,1 提交审批中,2 拒绝, 3 侍提交 ,4 审批通过,5 驳回 * @param status */ public void setStatus(Integer status) { @@ -241,10 +241,8 @@ public class ResultRecord implements java.io.Serializable { public String getDepartmentId() { return departmentId; } - /** - * 员工所在部门 id - * + * 员工所在部门 id * @param departmentId */ public void setDepartmentId(String departmentId) { @@ -252,14 +250,12 @@ public class ResultRecord implements java.io.Serializable { } /** - * 员工所在部门名称 - * + * 员工所在部门名称 * @return */ public String getDepartmentName() { return departmentName; } - /** * 员工所在部门名称 * @param departmentName @@ -283,22 +279,51 @@ public class ResultRecord implements java.io.Serializable { this.staffName = staffName; } + /** + * 当前审批的员工 id + * @return + */ public Long getCurrentApprovalStaffId() { return currentApprovalStaffId; } - + /** + * 当前审批的员工 id + * @param currentApprovalStaffId + */ public void setCurrentApprovalStaffId(Long currentApprovalStaffId) { this.currentApprovalStaffId = currentApprovalStaffId; } + /** + * 当前审批的员工名,以逗号隔开 + * @return + */ public String getCurrentApprovalStaffName() { return currentApprovalStaffName; } - + /** + * 当前审批的员工名,以逗号隔开 + * @param currentApprovalStaffName + */ public void setCurrentApprovalStaffName(String currentApprovalStaffName) { this.currentApprovalStaffName = currentApprovalStaffName; } + /** + * 等级 + * @return + */ + public String getScoreLevel() { + return scoreLevel; + } + /** + * 等级 + * @param scoreLevel + */ + public void setScoreLevel(String scoreLevel) { + this.scoreLevel = scoreLevel; + } + @Override public String toString() { return "ResultRecord{" + @@ -317,9 +342,9 @@ public class ResultRecord implements java.io.Serializable { ",departmentId=" + departmentId + ",departmentName=" + departmentName + ",staffName=" + staffName + + ",currentApprovalStaffId=" + currentApprovalStaffId + + ",currentApprovalStaffName=" + currentApprovalStaffName + + ",scoreLevel=" + scoreLevel + "}"; } - - - } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java b/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java index ee4afdd6..2bc7186a 100644 --- a/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java +++ b/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java @@ -61,4 +61,6 @@ public interface ResultDetailService extends IService { String initRole(Long staffId, Long l); List getStepList(ResultRecord resultRecord); + + String getScoreLevel(double doubleValue); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java index b13a1f74..d5ad5576 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java @@ -283,4 +283,26 @@ public class ResultDetailServiceImpl extends ServiceImpl map = departmentsService.selectUserAllDepartmentInFo(departmentsStaffRelateEntity.getDepartmentId()); + if (StringUtil.isNotBlank(map.get("dd2"))) { + leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd2")); + if(leader ==null && StringUtil.isNotBlank(map.get("dd3"))){ + leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd3")); + } + } + } flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId()); flowId = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, type);//表示是部门下的普通员工 list.add(flowDepartment); @@ -431,15 +440,17 @@ public class ResultRecordServiceImpl extends ServiceImpl + - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, flow_staff_id_role AS flowStaffIdRole, department_id AS departmentId, department_name AS departmentName, staff_name AS staffName, current_approval_staff_id AS currentApprovalStaffId, current_approval_staff_name AS currentApprovalStaffName + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, flow_staff_id_role AS flowStaffIdRole, department_id AS departmentId, department_name AS departmentName, staff_name AS staffName, current_approval_staff_id AS currentApprovalStaffId, current_approval_staff_name AS currentApprovalStaffName, score_level AS scoreLevel @@ -52,6 +53,7 @@ staff_name, current_approval_staff_id, current_approval_staff_name, + score_level, is_delete, gmt_create, gmt_modified @@ -69,6 +71,7 @@ #{ staffName}, #{ currentApprovalStaffId}, #{ currentApprovalStaffName}, + #{ scoreLevel}, 0, now(), now() @@ -94,7 +97,8 @@ department_name = #{departmentName}, staff_name = #{staffName}, current_approval_staff_id = #{currentApprovalStaffId}, - current_approval_staff_name = #{currentApprovalStaffName} + current_approval_staff_name = #{currentApprovalStaffName}, + score_level = #{scoreLevel} ,gmt_modified = now() where id = #{id} @@ -119,7 +123,8 @@ department_name = #{departmentName}, staff_name = #{staffName}, current_approval_staff_id = #{currentApprovalStaffId}, - current_approval_staff_name = #{currentApprovalStaffName} + current_approval_staff_name = #{currentApprovalStaffName}, + score_level = #{scoreLevel} ,gmt_modified = now() where id = #{id} @@ -131,6 +136,7 @@ +