打开盘点记录

This commit is contained in:
wulin 2020-09-15 19:52:31 +08:00
commit 8fb503ee2e
15 changed files with 171 additions and 39 deletions

View File

@ -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);

View File

@ -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");

View File

@ -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());

View File

@ -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> {
StaffEntity selectStaffByEmployeeId(String employeeId);
List<StaffEntity> selectBySearchName(IPage page, FindByNameModel nameModel);
SysUserEntity getUser(String userName);
}

View File

@ -80,7 +80,11 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
@Override
public StaffDepartmentDto selectStaffAllDepartments(String departmentId) {
StaffDepartmentDto staffDepartmentDto = departmentsDao.selectStaffAllDepartments(departmentId);
if(StringUtil.isEmpty(staffDepartmentDto.getDepartment1())){
if (StringUtil.isEmpty(staffDepartmentDto.getDepartment2())){
staffDepartmentDto.setDepartment1(staffDepartmentDto.getDepartment3());
staffDepartmentDto.setDepartment2(staffDepartmentDto.getDepartment4());
staffDepartmentDto.setDepartment3(null);
}else if(StringUtil.isEmpty(staffDepartmentDto.getDepartment1())){
staffDepartmentDto.setDepartment1(staffDepartmentDto.getDepartment2());
staffDepartmentDto.setDepartment2(staffDepartmentDto.getDepartment3());
staffDepartmentDto.setDepartment3(staffDepartmentDto.getDepartment4());

View File

@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
import com.lz.common.utils.DateUtils;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.Query;
import com.lz.common.utils.R;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.dto.StaffBaseInfoDto;
import com.lz.modules.app.dto.StaffDto;
@ -18,6 +19,7 @@ import com.lz.modules.app.entity.*;
import com.lz.modules.app.service.*;
import com.lz.modules.equipment.entity.model.FindByNameModel;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import com.lz.modules.sys.entity.SysUserEntity;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@ -94,9 +96,29 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
}
@Override
public List<StaffEntity> selectBySearchName(IPage page, FindByNameModel nameModel){
public List<StaffEntity> 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

View File

@ -250,14 +250,14 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
//记录日志
private void addRecord(EquipmentInfo info,SysUserEntity infoDto){
/*EquipmentFlowRecord record = new EquipmentFlowRecord();
EquipmentFlowRecord record = new EquipmentFlowRecord();
BeanUtils.copyProperties(info,record);
record.setEquipmentId(info.getId());
record.setChangeType(info.getEquipmentState());
//record.setOriginalUser();
record.setRecordUserId(infoDto.getUserId());
record.setRecordUser(infoDto.getRealName());
equipmentFlowRecordMapper.insertEquipmentFlowRecord(record);*/
equipmentFlowRecordMapper.insertEquipmentFlowRecord(record);
}
@Override

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.NumberUtil;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
@ -49,6 +50,9 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
@Autowired
private DepartmentsService departmentsService;
@Autowired
private DepartmentsDao departmentsDao;
@Override
public RecordAuth selectRecordAuthById(Long id){
return recordAuthMapper.selectRecordAuthById(id);
@ -147,10 +151,33 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
if (leader != null) {
StaffEntity staffEntity = staffService.selectStaffById(leader.getStaffId());
return staffEntity.getName();
} else {
Map<String, String> 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;
}
}

View File

@ -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<CodeRecordEntity>().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<CodeRecordEntity>().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);

View File

@ -11,7 +11,7 @@ import java.util.Date;
* 菜单权限表
* </p>*业绩记录表
* @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
*
* @param departmentId
*/
public void setDepartmentId(String departmentId) {
@ -253,13 +251,11 @@ 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 +
"}";
}
}

View File

@ -61,4 +61,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
String initRole(Long staffId, Long l);
List<Step> getStepList(ResultRecord resultRecord);
String getScoreLevel(double doubleValue);
}

View File

@ -283,4 +283,26 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
return stepList;
}
@Override
public String getScoreLevel(double doubleValue) {
if(doubleValue < 3.375){
return "3.25";
}else if(doubleValue < 3.5 ){
return "3.5-";
}else if (doubleValue < 3.583){
return "3.5";
}else if (doubleValue < 3.667){
return "3.5+";
}else if (doubleValue < 3.75){
return "3.75-";
}else if (doubleValue < 3.875){
return "3.75";
}else if (doubleValue < 4 ){
return "3.75+";
}else if (doubleValue == 4 ){
return "4";
}
return "0";
}
}

View File

@ -182,7 +182,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
params.setStatusList(listx);
}
}
if("1,2,5".equals(params.getStatusStr())){
if("1,2,5".equals(params.getStatusStr()) || "3".equals(params.getStatusStr())){
params.setApprovalStaffId(user.getUserId());
}
@ -271,6 +271,15 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
if (flowDepartment == null) {
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
if(leader == null){
Map<String, String> 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<ResultRecordMapper, Res
flowRecord.setFlowStaffIdRole(staffRoles);
flowRecord.setStatusName(FlowRecordEnum.APPROVALING.getName());
FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(resultRecordId);
FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(resultRecordId);
// 如果上一步是开始则不进行修改如果上一步是确认中改成提交如果上一点是审批中将上一步改成通过
if (lastFlowRecordNoStatus != null) {
if (!StringUtil.equals(lastFlowRecordNoStatus.getStatusName(), FlowRecordEnum.START.getName())
&& !StringUtil.equals(lastFlowRecordNoStatus.getStatusName(), FlowRecordEnum.CONFIRM.getName())) {
lastFlowRecordNoStatus.setStatusName(FlowRecordEnum.APPROVAL.getName());
lastFlowRecordNoStatus.setGmtCreate(new Date());
} else if (StringUtil.equals(lastFlowRecordNoStatus.getStatusName(), FlowRecordEnum.CONFIRM.getName())) {
lastFlowRecordNoStatus.setStatusName(FlowRecordEnum.COMMIT.getName());
lastFlowRecordNoStatus.setGmtCreate(new Date());
}
flowRecordService.updateFlowRecordById(lastFlowRecordNoStatus);
}
@ -544,6 +555,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(req.getRecordResultId());
lastFlowRecordNoStatus.setStatusName(FlowRecordEnum.REJECT.getName());
lastFlowRecordNoStatus.setGmtCreate(new Date()); //更新驳回时间
flowRecordService.updateFlowRecordById(lastFlowRecordNoStatus);
// 可能会被删除

View File

@ -21,12 +21,13 @@
<result column="staff_name" property="staffName"/>
<result column="current_approval_staff_id" property="currentApprovalStaffId"/>
<result column="current_approval_staff_name" property="currentApprovalStaffName"/>
<result column="score_level" property="scoreLevel"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
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
</sql>
@ -52,6 +53,7 @@
<if test="staffName != null">staff_name, </if>
<if test="currentApprovalStaffId != null">current_approval_staff_id, </if>
<if test="currentApprovalStaffName != null">current_approval_staff_name, </if>
<if test="scoreLevel != null">score_level, </if>
is_delete,
gmt_create,
gmt_modified
@ -69,6 +71,7 @@
<if test="staffName != null">#{ staffName}, </if>
<if test="currentApprovalStaffId != null">#{ currentApprovalStaffId}, </if>
<if test="currentApprovalStaffName != null">#{ currentApprovalStaffName}, </if>
<if test="scoreLevel != null">#{ scoreLevel}, </if>
0,
now(),
now()
@ -94,7 +97,8 @@
<if test="departmentName != null">department_name = #{departmentName},</if>
<if test="staffName != null">staff_name = #{staffName},</if>
<if test="currentApprovalStaffId != null">current_approval_staff_id = #{currentApprovalStaffId},</if>
<if test="currentApprovalStaffName != null">current_approval_staff_name = #{currentApprovalStaffName}</if>
<if test="currentApprovalStaffName != null">current_approval_staff_name = #{currentApprovalStaffName},</if>
<if test="scoreLevel != null">score_level = #{scoreLevel}</if>
</trim>
,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}
</update>
@ -131,6 +136,7 @@
<select id="selectByCondition" resultType="com.lz.modules.sys.entity.app.ResultRecord">
select * from lz_result_record where is_delete = 0
<if test="req.monthBeginDate != null and req.monthBeginDate != '' ">

View File

@ -63,7 +63,7 @@ public class MysqlMain {
}
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_flow_record"));
list.add(new TablesBean("lz_result_record"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();