Commit 98dd23a2 by tangzhaoqian

审批、操作日志

parent 5ad449c7
......@@ -29,6 +29,7 @@ import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessStatus;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.qyzx.QyzxOperLog;
import cn.timer.api.config.enums.HttpMethod;
......@@ -94,11 +95,17 @@ public class LogAspect
// 获取当前的用户
// LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
QyzxEmpLogin eld = (QyzxEmpLogin)session.getAttribute("ui");
if (eld == null && controllerLog.businessType() == BusinessType.SEND_CODE) {
System.out.println(jsonResult);
}
// *========数据库日志=========*//
QyzxOperLog operLog = new QyzxOperLog();
operLog.setOrgCode(eld.getOrgId());
operLog.setEmpNum(eld.getId());
// 请求的地址
String ip = UserIp.getIpAddr(ServletUtils.getRequest());
operLog.setOperIp(ip);
......@@ -109,6 +116,8 @@ public class LogAspect
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
if (eld != null)
{
operLog.setOrgCode(eld.getOrgId());
operLog.setEmpNum(eld.getId());
operLog.setOperName(eld.getYgglMainEmp().getName());
}
......
......@@ -61,4 +61,10 @@ public enum BusinessType
* 清空数据
*/
CLEAN,
/**
* 发送验证码
*/
SEND_CODE,
}
......@@ -78,6 +78,10 @@ public class QyzxEmpLogin extends Model<QyzxEmpLogin> {
@TableField(exist = false)
@ApiModelProperty(value="是否主管",example="0 是 1 否")
private Integer isLeader;
@TableField(exist = false)
@ApiModelProperty(value="用户类型",example="0 超管理员 1 子管理 2 普通员工")
private Integer userType;
@ApiModelProperty(value="权限 ",example="0,1,2")
@TableField(exist = false)
......
......@@ -166,7 +166,7 @@ public class LoginController {
@PostMapping(value = "/sendcode")
@ApiOperation(value = "1.发送验证码", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
@Log(title = "发送验证码", businessType = BusinessType.UPDATE)
@Log(title = "发送验证码", businessType = BusinessType.SEND_CODE)
public Result<String> sendCode(@RequestBody EntRegisterDto entRegisterDto) {
String phone = entRegisterDto.getPhone();
......@@ -593,7 +593,13 @@ public class LoginController {
Integer isLeader = zzglBmgwMMapper.selectCount(new QueryWrapper<ZzglBmgwM>().lambda()
.eq(ZzglBmgwM::getLeader, qyzxEmpLogin1.getId())
.eq(ZzglBmgwM::getOrgCode, qyzxEmpLogin1.getOrgId())) > 0 ? 0 : 1;
QyzxEmpEntAsso eEA = qyzxEmpEntAssoMapper.selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda()
.select(QyzxEmpEntAsso::getUserType)
.eq(QyzxEmpEntAsso::getEmpNum, qyzxEmpLogin1.getId())
.eq(QyzxEmpEntAsso::getOrgCode, qyzxEmpLogin1.getOrgId()));
qyzxEmpLogin1.setIsLeader(isLeader);
qyzxEmpLogin1.setUserType(eEA != null ? eEA.getUserType() : null);
List<QysDto> qys = qyzxEmpLoginMapper.getQys(qyzxEmpLogin1.getId());
if (qys.size() == 0)
......
......@@ -2,7 +2,9 @@ package cn.timer.api.controller.spmk;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
......@@ -43,6 +45,7 @@ import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.bean.spmk.SpmkIcon;
import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.SpmkEnumInterface;
......@@ -455,6 +458,47 @@ public class SpmkController {
return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
}
/**
* 排序-自定义审批
*/
@PutMapping(value = "/test_spmk")
@ApiOperation(value = "16.测试", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16)
public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位
List<ZzglBmgwM> bmgws = ZzglBmgwM.builder().build().selectList(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, 311));
//个人岗位
YgglMainEmp one = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getOrgCode, 311).eq(YgglMainEmp::getEmpNum, 12512));
Integer getId = one != null ? one.getBmgwId() : null;
System.out.println(getId);
Set<Integer> all = getId != null ? empNumupdept2(lanzi, bmgws, getId) : new HashSet<Integer>();
all.add(getId);
System.out.println(all);
return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
}
//遍历
public static Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
for (ZzglBmgwM z : bmgws) {
if (getId.equals(z.getId())) {
lanzi.add(getId);
if (z.getUpId()==null || z.getUpId() == 0) {
return lanzi;
}
getId = z.getUpId();
empNumupdept2(lanzi, bmgws, getId);
}
}
return lanzi;
}
// TODO 审批汇总(发起审批)
/**
* 发起审批
......@@ -498,10 +542,10 @@ public class SpmkController {
listRouter.add(router);
JSONObject jSONObject = spmkApproveSummaryDto.getRequestData()
.set("orgCode", FromData.builder().value(String.valueOf(userBean.getOrgCode())).build())
.set("initiator", FromData.builder().value(ygglMainEmp.getName()).build())
.set("headUrl", FromData.builder().value(ygglMainEmp.getHeadUrl()).build())
.set("id", FromData.builder().value(StrUtil.toString(userBean.getEmpNum())).build());
.set("orgCode", userBean.getOrgCode())
.set("initiator", ygglMainEmp.getName())
.set("headUrl", ygglMainEmp.getHeadUrl())
.set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
......
......@@ -8,6 +8,8 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
import cn.hutool.core.util.StrUtil;
public class DateUtil {
static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
......@@ -68,6 +70,35 @@ public class DateUtil {
todayEnd.set(Calendar.MILLISECOND, 999);
return todayEnd.getTime();
}
/**
* 将String时间转换为时间戳
*
* @param time
* @return
* @throws ParseException
*/
public static long getFormat(String time) throws ParseException {
if (StrUtil.isNotBlank(time)) {
switch (time.length()) {
case 10:
return getStringTime(time, "yyyy-MM-dd");
case 16:
return getStringTime(time, "yyyy-MM-dd HH:mm");
case 19:
return getStringTime(time, "yyyy-MM-dd HH:mm:ss");
default:
break;
}
return 0;
}
return 0;
}
/**
* 将String时间转换为时间戳
......
......@@ -3,15 +3,19 @@ package cn.timer.api.utils.router;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mysql.cj.x.protobuf.MysqlxPrepare.Execute;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.Console;
import cn.hutool.json.JSONObject;
......@@ -67,6 +71,10 @@ public class RouterUtils {
*/
private final static String RELATION_TYPE_DEPARTMENT = "department";
/**
* department 部门类型
*/
private final static String RELATION_TYPE_EXECUTIVE = "executive";
/**
* users 用户类型
*/
private final static String RELATION_TYPE_USERS = "users";
......@@ -98,9 +106,9 @@ public class RouterUtils {
List<User> users = new ArrayList<User>();
User userFirst = User.builder()
.name(obj.get("initiator",FromData.class).getValue())
.id(obj.get("id",FromData.class).getValue())
.headUrl(obj.get("headUrl",FromData.class).getValue())
.name(obj.getStr("initiator"))
.id(obj.getStr("id"))
.headUrl(obj.getStr("headUrl"))
.execute(UNEXECUTED)
.build();
users.add(userFirst);
......@@ -109,7 +117,7 @@ public class RouterUtils {
relations.add(relation);
router.setRelation(relations);
// router.getRelation().get(0).setName(obj.get("initiator",FromData.class).getValue());
// router.getRelation().get(0).setName(obj.getStr("initiator"));
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
......@@ -117,8 +125,34 @@ public class RouterUtils {
Console.log("审批人逻辑");
router.setExecute(EXECUTING);
router.setFlow(true);
List<User> listUser = router.getRelation().get(0).getUsers();
Relation r = CollectionUtil.isNotEmpty(router.getRelation()) ? router.getRelation().get(0) : null;
// if (r != null && RELATION_TYPE_EXECUTIVE.equals(r.getType())) {
// Integer leaderId = selectLeaderEmpNumById(
// obj.getInt("orgCode"),
// obj.getInt("id"),
// r.getUpward());
//
// if (leaderId != null) {
// YgglMainEmp emp = YgglMainEmp.builder().build();
// emp = emp.selectOne(new QueryWrapper<YgglMainEmp>().lambda()
// .select(YgglMainEmp::getName, YgglMainEmp::getEmpNum, YgglMainEmp::getHeadUrl)
// .eq(YgglMainEmp::getEmpNum, leaderId)
// .eq(YgglMainEmp::getOrgCode, obj.getInt("orgCode")));
//
// if (emp != null) {
// User user = User.builder()
// .name(emp.getName())
// .id(Convert.toStr(emp.getEmpNum()))
// .headUrl(emp.getHeadUrl())
// .execute(EXECUTING)
// .build();
//
// router.getRelation().get(0).setUsers(ListUtil.toList(user));
// }
// }
// }
if (r != null && RELATION_TYPE_USERS.equals(r.getType())) {
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
......@@ -133,7 +167,10 @@ public class RouterUtils {
break user;
}
}
}
isAuditNext = true;
NextNode(router.getChildren(), obj , isFirse, isAuditNext);
break;
case COPY:
......@@ -257,7 +294,42 @@ public class RouterUtils {
};
public static Integer selectLeaderEmpNumById(Integer orgCode, Integer id, Integer leave) {
YgglMainEmp mainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getEmpNum, id)
.eq(YgglMainEmp::getOrgCode, orgCode));
Integer gWId = mainEmp != null ? mainEmp.getBmgwId() : null;
// 企业所有部门岗位
List<ZzglBmgwM> listBM = ZzglBmgwM.builder().build()
.selectList(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, orgCode));
// 岗位
ZzglBmgwM gW = CollUtil.getFirst(listBM.stream().filter(bM -> bM.getId().equals(gWId)).collect(Collectors.toList()));
// 岗位id
Integer baseBmgwId = gW != null ? gW.getUpId() : null;
// 指定 主管id
Integer leaderId = null;
Integer bmgwLeaderId;
for (int i = 0,n = leave + 1; i < n; i++) {
ZzglBmgwM bmgwM = getLeaderEmp(listBM, baseBmgwId);
bmgwLeaderId = bmgwM != null ? bmgwM.getLeader() : null;
if (i == n-1) {
leaderId = bmgwLeaderId;
}
}
return leaderId;
}
public static ZzglBmgwM getLeaderEmp(List<ZzglBmgwM> listBM, Integer baseBmgwId) {
ZzglBmgwM zzglBmgwM = baseBmgwId != null ?
CollUtil.getFirst(listBM.stream().filter(bM -> bM.getId().equals(baseBmgwId)).collect(Collectors.toList())) : null;
return zzglBmgwM;
}
public static List<YgglMainEmp> selectOtherlistent(Integer orgCode, Integer id){
ArrayList<Integer> list = new ArrayList<Integer>();
......
......@@ -32,8 +32,6 @@ public class EvectionBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 审批汇总id
String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
......@@ -54,8 +52,8 @@ public class EvectionBusiness extends SpmkAssoBusiness {
.orgcode(orgCode)
.evectionid(Convert.toInt(approveId))
.evectiontype(1)
.starttime(DateUtil.getStringTime(startTime, "yyyy-MM-dd HH:mm:ss"))
.endtime(DateUtil.getStringTime(endTime, "yyyy-MM-dd HH:mm:ss"))
.starttime(DateUtil.getFormat(startTime))
.endtime(DateUtil.getFormat(endTime))
.duration(Convert.toDouble(longTime))
.build();
......
......@@ -30,8 +30,6 @@ public class GoOutBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 审批汇总id
String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
......
......@@ -34,9 +34,6 @@ public class LeaveBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 审批汇总id
String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
......@@ -58,9 +55,9 @@ public class LeaveBusiness extends SpmkAssoBusiness {
.userid(id)
.orgcode(orgCode)
.leaveid(Convert.toInt(approveId))
.leavetype(Convert.toInt(1))
.starttime(DateUtil.getStringTime(startTime, "yyyy-MM-dd HH:mm:ss"))
.endtime(DateUtil.getStringTime(endTime, "yyyy-MM-dd HH:mm:ss"))
.leavetype(Convert.toInt(LeaveType))
.starttime(DateUtil.getFormat(startTime))
.endtime(DateUtil.getFormat(endTime))
.duration(Convert.toDouble(longTime))
.build();
......
......@@ -24,8 +24,6 @@ public class RecruitBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 招聘部门
String RecruitmentDept = ObjectUtil.isNull(jsonObj.get("__RecruitmentDept",FromData.class)) ? null : jsonObj.get("__RecruitmentDept",FromData.class).getValue();
......
......@@ -33,8 +33,6 @@ public class RegularizationBusiness extends SpmkAssoBusiness {
// TODO Auto-generated method stub
// 发起人企业id
// String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人名称
// String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 申请人名称
String applicant = ObjectUtil.isNull(jsonObj.get("__applicant",FromData.class)) ? null : jsonObj.get("__applicant",FromData.class).getValue();
......
......@@ -32,12 +32,10 @@ public class ReissueACardBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 审批汇总id
String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
// 补卡时间
// 补卡时间
String PatchCardTime = ObjectUtil.isNull(jsonObj.get("__PatchCardTime",FromData.class)) ? null : jsonObj.get("__PatchCardTime",FromData.class).getValue();
// 缺卡原因
String cardShortage = ObjectUtil.isNull(jsonObj.get("cardShortage",FromData.class)) ? null : jsonObj.get("cardShortage",FromData.class).getValue();
......@@ -53,8 +51,8 @@ public class ReissueACardBusiness extends SpmkAssoBusiness {
.userid(id)
.orgcode(orgCode)
.repairid(Convert.toInt(approveId))
.cardrepltime(DateUtil.getStringTime(PatchCardTime, "yyyy-MM-dd HH:mm:ss"))
.cardreplperiod(Convert.toInt(cardreplperiod))
.cardrepltime(DateUtil.getFormat(PatchCardTime))
// .cardreplperiod(Convert.toInt(cardreplperiod))
.build();
System.out.println("补卡:"+raD);
......
......@@ -33,8 +33,6 @@ public class ResignationBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 申请人
String applicant = ObjectUtil.isNull(jsonObj.get("__applicant",FromData.class)) ? null : jsonObj.get("__applicant",FromData.class).getValue();
......
......@@ -31,8 +31,6 @@ public class TransferPositionBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 申请人
String applicant = ObjectUtil.isNull(jsonObj.get("__applicant",FromData.class)) ? null : jsonObj.get("__applicant",FromData.class).getValue();
......
......@@ -31,8 +31,6 @@ public class WorkOvertimeBusiness extends SpmkAssoBusiness {
Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
// 发起人id
Integer id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = ObjectUtil.isNull(jsonObj.get("initiator",FromData.class)) ? null : jsonObj.get("initiator",FromData.class).getValue();
// 审批汇总id
String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
......@@ -57,11 +55,11 @@ public class WorkOvertimeBusiness extends SpmkAssoBusiness {
.userid(id)
.orgcode(orgCode)
.overtimeid(Convert.toInt(approveId))
.overtimetype(Convert.toInt(1))
.starttime(DateUtil.getStringTime(startTime, "yyyy-MM-dd HH:mm"))
.endtime(DateUtil.getStringTime(endTime, "yyyy-MM-dd HH:mm"))
.overtimetype(Convert.toInt(workOvertimeType))
.starttime(DateUtil.getFormat(startTime))
.endtime(DateUtil.getFormat(endTime))
.duration(Convert.toDouble(timeLong))
.compensate(Convert.toInt(1))
.compensate(Convert.toInt(compensate))
.build();
System.out.println("加班:"+oaD);
......
......@@ -130,7 +130,6 @@
)
</if>
ORDER BY a.id DESC
</select>
<select id="selectPageByQueryForEmpNum" resultMap="BaseResultMap_As" >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment