Commit 8ce8533c by 邓实川
parents b6bb94b4 816c5a9f
package cn.timer.api.bean.zzgl;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2020-05-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("菜单权限表")
public class ZzglMenu extends Model<ZzglMenu> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="菜单ID",example="101")
private Integer menuId;
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
@ApiModelProperty(value="菜单名称 ",example="菜单名称")
private String menuName;
@ApiModelProperty(value="父菜单ID",example="7777")
@NotNull(message = "父菜单ID不能为空")
private Integer parentId;
@NotBlank(message = "显示顺序不能为空")
@ApiModelProperty(value="显示顺序",example="1")
private Integer orderNum;
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
@ApiModelProperty(value="路由地址 ",example="user/ppt")
private String path;
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
@ApiModelProperty(value="组件路径 ",example="123456")
private String component;
@ApiModelProperty(value="是否为外链(0是 1否)",example="101")
private Integer isFrame;
@NotBlank(message = "菜单类型不能为空")
@ApiModelProperty(value="菜单类型(M目录 C菜单 F按钮)",example="F")
private String menuType;
@ApiModelProperty(value="菜单状态(0显示 1隐藏)",example="0")
private String visible;
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
@ApiModelProperty(value="权限标识 ",example="user:gen:code")
private String perms;
@ApiModelProperty(value="菜单图标 ",example="#")
private String icon;
@ApiModelProperty(value="创建者 ",example="创建者")
private String createBy;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value="创建时间 ",example="创建时间")
private Date createTime;
@ApiModelProperty(value="更新者 ",example="更新者")
private String updateBy;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value="更新时间 ",example="更新时间")
private Date updateTime;
@ApiModelProperty(value="备注 ",example="备注")
private String remark;
}
\ No newline at end of file
package cn.timer.api.bean.zzgl;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2020-05-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("岗位和菜单关联表")
public class ZzglPostMenu extends Model<ZzglPostMenu> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="部门岗位ID 部门岗位ID",example="101")
private Integer bmgwId;
@ApiModelProperty(value="菜单ID 菜单ID",example="101")
private Integer menuId;
}
\ No newline at end of file
...@@ -104,25 +104,26 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -104,25 +104,26 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
*/ */
// @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次 // @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次
public String AttendanceTask() throws ParseException { public String AttendanceTask() throws ParseException {
boolean implement = false; boolean implement = false;
// int sockid = 0; int sockid = 0;
// KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask")); KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask"));
// if(sock == null) { if(sock == null) {
// KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build(); KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
// sock1.insert(); sock1.insert();
// sockid = sock1.getId(); sockid = sock1.getId();
// implement = true; implement = true;
// }else { }else {
// sockid = sock.getId(); sockid = sock.getId();
// if(sock.getExecutionStatus() == 0) { if(sock.getExecutionStatus() == 0) {
// KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById(); KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById();
// implement = true; implement = true;
// } }
// } }
//逻辑 //逻辑
if(implement) { if(implement) {
System.err.println("时间:" + dateFormat.format(new Date())); System.err.println("当前时间:" + dateFormat.format(new Date()));
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0); c.add(Calendar.MONTH, 0);
...@@ -137,7 +138,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -137,7 +138,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();// String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();// String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(",");
int year = Calendar.getInstance().get(Calendar.YEAR); int year = Calendar.getInstance().get(Calendar.YEAR);
int month = Calendar.getInstance().get(Calendar.MONTH) + 1; int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
...@@ -196,7 +198,6 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -196,7 +198,6 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//休息天数,应出勤天数,实际出勤 //休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
int zjgzts = 0;//目前为止应该出勤的天数 int zjgzts = 0;//目前为止应该出勤的天数
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数 //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0; double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
// 迟到次数 迟到时长 早退次数 早退时长 // 迟到次数 迟到时长 早退次数 早退时长
...@@ -268,7 +269,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -268,7 +269,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//目前为止应出勤天数 //目前为止应出勤天数
int w = 0,x=0; int w = 0,x=0;
for(String num : range) { for(String num : range) {
if(Arrays.binarySearch(needfig, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
ycqts[w] = num; ycqts[w] = num;
w++; w++;
zjgzts++; zjgzts++;
...@@ -280,8 +281,10 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -280,8 +281,10 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
ycqts[w] = num; ycqts[w] = num;
w++; w++;
zjgzts++; zjgzts++;
if(user.getEmpnum() == 257) {
ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除 ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除
} }
}
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中 if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除 ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
zjgzts = zjgzts - 1; zjgzts = zjgzts - 1;
...@@ -345,7 +348,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -345,7 +348,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//目前为止应出勤天数 //目前为止应出勤天数
int g = 0,x=0; int g = 0,x=0;
for(String num : range) { for(String num : range) {
if(Arrays.binarySearch(ziyoupb, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(ziyoupb, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
ycqts[g] = num; ycqts[g] = num;
zjgzts++; zjgzts++;
}else { }else {
...@@ -436,7 +439,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -436,7 +439,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//排查请假是否在最后一次打卡范围内 //排查请假是否在最后一次打卡范围内
List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr); List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr);
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次 KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
String beginTime = sdf1.format(new Date()); String beginTime = sdf1.format(new Date());
// List<String> rowData = new ArrayList<String>(); // List<String> rowData = new ArrayList<String>();
//遍历目前为止所有日期 结合该用户发起的审批进行结合 //遍历目前为止所有日期 结合该用户发起的审批进行结合
...@@ -449,7 +453,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -449,7 +453,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
}else { }else {
if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(cards), num) < 0) { if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(cards), num) < 0) {
rowData.add("旷工"); rowData.add("旷工");
}else if(sdf1.parse(beginTime).getTime() <= sdf1.parse(num).getTime()) { }else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期"); rowData.add("未到班期");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) >= 0) {//请假 }else if(Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) >= 0) {//请假
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2)); KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2));
...@@ -546,19 +550,28 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -546,19 +550,28 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//获取该员工最新班次 //获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId()) KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several)); .eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb!=null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else { }else {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid()));
} }
//获取该员工最新班次 //获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId()) KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several)); .eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb != null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else if(attgro.getPbfs() == 2){ }else if(attgro.getPbfs() == 2){
KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId())); KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId()));
if(pbmxx != null && pbmxx.getBcid() != 0) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid()));
} }
}
if(shif != null && shif.getSxbcs() != null) {
System.out.println(shif.getSxbcs());
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数 //未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间 //最后一次应打卡时间
...@@ -577,6 +590,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -577,6 +590,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
} }
} }
} }
}
}else { }else {
for (String num2 : range) { for (String num2 : range) {
if (Arrays.binarySearch(dkjtts, num2) >= 0) { if (Arrays.binarySearch(dkjtts, num2) >= 0) {
......
...@@ -6,10 +6,12 @@ import java.util.List; ...@@ -6,10 +6,12 @@ import java.util.List;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -34,15 +36,21 @@ import cn.timer.api.aspect.lang.enums.BusinessType; ...@@ -34,15 +36,21 @@ import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglAuth; import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.bean.zzgl.ZzglPostMenu;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface; import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper; import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper; import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
import cn.timer.api.dao.zzgl.ZzglMenuMapper;
import cn.timer.api.dao.zzgl.ZzglPostMenuMapper;
import cn.timer.api.dto.zzgl.LogDgjlsDto; import cn.timer.api.dto.zzgl.LogDgjlsDto;
import cn.timer.api.dto.zzgl.LogDgjlsQueryDto; import cn.timer.api.dto.zzgl.LogDgjlsQueryDto;
import cn.timer.api.dto.zzgl.UpEmpDeptDto; import cn.timer.api.dto.zzgl.UpEmpDeptDto;
import cn.timer.api.dto.zzgl.ZzglPostMenuDto;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -55,9 +63,15 @@ import io.swagger.annotations.ApiOperation; ...@@ -55,9 +63,15 @@ import io.swagger.annotations.ApiOperation;
public class ZzglController { public class ZzglController {
@Autowired @Autowired
ZzglBmgwMService zzglBmgwMService;
@Autowired
ZzglBmgwMMapper zzglBmgwMMapper; ZzglBmgwMMapper zzglBmgwMMapper;
@Autowired @Autowired
ZzglPostMenuMapper zzglPostMenuMapper;
@Autowired
ZzglLogDgjlMapper zzglLogDgjlMapper; ZzglLogDgjlMapper zzglLogDgjlMapper;
@Autowired @Autowired
...@@ -355,4 +369,140 @@ public class ZzglController { ...@@ -355,4 +369,140 @@ public class ZzglController {
}); });
return ResultUtil.success(); return ResultUtil.success();
} }
@Autowired
private ZzglMenuMapper zzglMenuMapper;
/**
* 获取-菜单权限列表
*
* @return
*/
@GetMapping(value = "/menu")
@ApiOperation(value = "获取-菜单权限列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<ZzglMenu>> selectMenu(@CurrentUser UserBean userBean) {
List<ZzglMenu> list = zzglMenuMapper.selectList(null);
return ResultUtil.data(list);
}
/**
* 获取-菜单权限-搜索
*
* @return
*/
// @PostMapping(value = "/querymenu")
// @ApiOperation(value = "获取-菜单权限-搜索", httpMethod = "POST", notes = "接口发布说明")
// public Result<List<Tree<String>>> queryMenu(@CurrentUser UserBean userBean,@RequestBody ZzglMenuQueryDto zzglMenuQueryDto) {
//
// List<ZzglMenu> list = zzglMenuMapper.queryList(zzglMenuQueryDto);
//
// //配置
// TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// // 自定义属性名 都要默认值的
//// treeNodeConfig.setIdKey("id");
//// treeNodeConfig.setParentIdKey("upId");
// treeNodeConfig.setNameKey("menuName");
// // 最大递归深度
//// treeNodeConfig.setDeep(10);
//
// //转换器
// List<Tree<String>> treeNodes = TreeUtil.build(list, "0", treeNodeConfig,
// (treeNode, tree) -> {
// tree.setId(Convert.toStr(treeNode.getMenuId()));
// tree.setParentId(Convert.toStr(treeNode.getParentId()));
//// tree.setWeight(treeNode.getWeight());
// tree.setName(treeNode.getMenuName());
// // 扩展属性 ...
// tree.putExtra("icon", treeNode.getIcon());
// tree.putExtra("isFrame", treeNode.getIsFrame());
// tree.putExtra("menuType", treeNode.getMenuType());
// tree.putExtra("orderNum", treeNode.getOrderNum());
// tree.putExtra("path", treeNode.getPath());
// tree.putExtra("perms", treeNode.getPerms());
// tree.putExtra("remark", treeNode.getRemark());
// tree.putExtra("visible", treeNode.getVisible());
//// tree.putExtra("other", new Object());
// });
//
// return ResultUtil.data(treeNodes);
// }
/**
* 新增-菜单权限
*
* @param 部门岗位id
* @return
*/
@PostMapping(value = "/menu")
@ApiOperation(value = "新增-菜单权限", httpMethod = "POST", notes = "接口发布说明")
public Result<List<ZzglMenu>> insertPostMenus(@Validated @RequestBody ZzglMenu zzglMenu) {
Integer conut = zzglMenuMapper.selectCount(new QueryWrapper<ZzglMenu>().lambda()
.eq(ZzglMenu::getMenuId, zzglMenu.getParentId()));
if (conut <= 0) {
return ResultUtil.error("上级权限不存在!");
}
return zzglMenu.insert() ? ResultUtil.success() : ResultUtil.error();
}
/**
* 删除-菜单权限
*
* @param 部门岗位id
* @return
*/
@DeleteMapping(value = "/menu/{id}")
@ApiOperation(value = "删除-菜单权限", httpMethod = "DELETE", notes = "接口发布说明")
public Result<List<ZzglMenu>> deletePostMenus(@Validated @RequestBody Integer id) {
return zzglMenuMapper.deleteById(id) > 0 ? ResultUtil.success() : ResultUtil.error();
}
/**
* 修改-菜单权限
*
* @param 部门岗位id
* @return
*/
@PutMapping(value = "/menu/{id}")
@ApiOperation(value = "修改-菜单权限", httpMethod = "PUT", notes = "接口发布说明")
public Result<List<ZzglMenu>> updatePostMenus(@Validated @RequestBody ZzglMenu zzglMenu) {
return zzglMenu.updateById() ? ResultUtil.success() : ResultUtil.error();
}
/**
* 获取-该岗位的菜单权限
*
* @param 部门岗位id
* @return
*/
@GetMapping(value = "/menu/{id}")
@ApiOperation(value = "获取-该岗位的菜单权限", httpMethod = "GET", notes = "接口发布说明")
public Result<List<Integer>> selectMenuByPostId(@CurrentUser UserBean userBean,@PathVariable Integer id) {
return ResultUtil.data(zzglBmgwMService.selectMenuByPostId(id));
}
/**
* 修改-该岗位的菜单权限
*
* @param 部门岗位id
* @return
*/
@PutMapping(value = "/post_menu")
@ApiOperation(value = "修改-该岗位的菜单权限", httpMethod = "PUT", notes = "接口发布说明")
public Result<List<ZzglMenu>> updatePostMenus(@CurrentUser UserBean userBean,@RequestBody ZzglPostMenuDto zzglPostMenuDto) {
Integer delCount = zzglPostMenuMapper.delete(new QueryWrapper<ZzglPostMenu>().lambda()
.eq(ZzglPostMenu::getBmgwId, zzglPostMenuDto.getId()));
Integer updateCount = zzglPostMenuMapper.insertPostMenus(zzglPostMenuDto.getId(),zzglPostMenuDto.getMenus());
return ResultUtil.success();
}
} }
...@@ -15,4 +15,6 @@ public interface ZzglBmgwMService { ...@@ -15,4 +15,6 @@ public interface ZzglBmgwMService {
void applicationTransferPosition(Integer empNum,Integer orgCode,UpEmpDeptDto upEmpDeptDto); void applicationTransferPosition(Integer empNum,Integer orgCode,UpEmpDeptDto upEmpDeptDto);
List<Integer> selectMenuByPostId(Integer id);
} }
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,9 +15,11 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp ...@@ -14,9 +15,11 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper; import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper; import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
import cn.timer.api.dao.zzgl.ZzglMenuMapper;
import cn.timer.api.dto.zzgl.UpEmpDeptDto; import cn.timer.api.dto.zzgl.UpEmpDeptDto;
/** /**
...@@ -31,6 +34,9 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService { ...@@ -31,6 +34,9 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
private ZzglBmgwMMapper zzglBmgwMMapper; private ZzglBmgwMMapper zzglBmgwMMapper;
@Autowired @Autowired
private ZzglMenuMapper zzglMenuMapper;
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper; private YgglMainEmpMapper ygglMainEmpMapper;
@Autowired @Autowired
...@@ -86,4 +92,13 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService { ...@@ -86,4 +92,13 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
ygglMainEmp.update(updateWrapper); ygglMainEmp.update(updateWrapper);
} }
@Override
public List<Integer> selectMenuByPostId(Integer id) {
List<ZzglMenu> list = zzglMenuMapper.selectMenuByPostId(id);
List<Integer> menuList = list.stream().map(ZzglMenu::getMenuId).collect(Collectors.toList());
return menuList;
}
} }
package cn.timer.api.dao.zzgl;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.dto.zzgl.ZzglMenuQueryDto;
/**
* 菜单权限表
* @author Tang 2020-05-22
*/
@Repository
public interface ZzglMenuMapper extends BaseMapper<ZzglMenu> {
List<ZzglMenu> selectMenuByPostId(Integer id);
List<ZzglMenu> queryList(@Param("obj") ZzglMenuQueryDto zzglMenuQueryDto);
}
package cn.timer.api.dao.zzgl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.zzgl.ZzglPostMenu;
/**
* 岗位和菜单关联表
* @author Tang 2020-05-22
*/
@Repository
public interface ZzglPostMenuMapper extends BaseMapper<ZzglPostMenu> {
Integer insertPostMenus(Integer id,@Param("menus") Integer[] menus);
}
package cn.timer.api.dto.zzgl;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ZzglMenuQueryDto {
private String menuName;
private String visible;
}
package cn.timer.api.dto.zzgl;
import java.util.Date;
import cn.timer.api.bean.zzgl.ZzglMenu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ZzglPostMenuDto {
@ApiModelProperty(value="岗位ID",example="岗位ID")
private Integer id;
@ApiModelProperty(value="菜单ID数组",example="菜单ID数组")
private Integer[] menus;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.zzgl.ZzglMenuMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.zzgl.ZzglMenu" >
<result column="menu_id" property="menuId" />
<result column="menu_name" property="menuName" />
<result column="parent_id" property="parentId" />
<result column="order_num" property="orderNum" />
<result column="path" property="path" />
<result column="component" property="component" />
<result column="is_frame" property="isFrame" />
<result column="menu_type" property="menuType" />
<result column="visible" property="visible" />
<result column="perms" property="perms" />
<result column="icon" property="icon" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="remark" property="remark" />
</resultMap>
<sql id="Base_Column_List">
menu_id,
menu_name,
parent_id,
order_num,
path,
component,
is_frame,
menu_type,
visible,
perms,
icon,
create_by,
create_time,
update_by,
update_time,
remark
</sql>
<sql id="Base_Column_List_A">
a.menu_id,
a.menu_name,
a.parent_id,
a.order_num,
a.path,
a.component,
a.is_frame,
a.menu_type,
a.visible,
a.perms,
a.icon,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark
</sql>
<sql id="Base_Column_List_Alias">
menu_id ZzglMenu_menu_id,
menu_name ZzglMenu_menu_name,
parent_id ZzglMenu_parent_id,
order_num ZzglMenu_order_num,
path ZzglMenu_path,
component ZzglMenu_component,
is_frame ZzglMenu_is_frame,
menu_type ZzglMenu_menu_type,
visible ZzglMenu_visible,
perms ZzglMenu_perms,
icon ZzglMenu_icon,
create_by ZzglMenu_create_by,
create_time ZzglMenu_create_time,
update_by ZzglMenu_update_by,
update_time ZzglMenu_update_time,
remark ZzglMenu_remark
</sql>
<select id="selectMenuByPostId" resultMap="BaseResultMap">
SELECT a.menu_id
FROM zzgl_menu a
LEFT JOIN zzgl_post_menu b ON a.menu_id = b.menu_id
WHERE b.bmgw_id = #{id}
</select>
<select id="queryList" resultMap="BaseResultMap" parameterType="cn.timer.api.dto.zzgl.ZzglMenuQueryDto">
SELECT <include refid="Base_Column_List" />
FROM zzgl_menu
<where>
<if test ="null != obj.menuName and '' != obj.menuName">
and menu_name like CONCAT('%',#{obj.menuName},'%')
</if>
<if test ="null != obj.visible and '' != obj.visible">
and visible = #{obj.visible},
</if>
</where>
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.zzgl.ZzglMenu">
INSERT INTO zzgl_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != menuId'>
menu_id,
</if>
<if test ='null != menuName'>
menu_name,
</if>
<if test ='null != parentId'>
parent_id,
</if>
<if test ='null != orderNum'>
order_num,
</if>
<if test ='null != path'>
path,
</if>
<if test ='null != component'>
component,
</if>
<if test ='null != isFrame'>
is_frame,
</if>
<if test ='null != menuType'>
menu_type,
</if>
<if test ='null != visible'>
visible,
</if>
<if test ='null != perms'>
perms,
</if>
<if test ='null != icon'>
icon,
</if>
<if test ='null != createBy'>
create_by,
</if>
<if test ='null != createTime'>
create_time,
</if>
<if test ='null != updateBy'>
update_by,
</if>
<if test ='null != updateTime'>
update_time,
</if>
<if test ='null != remark'>
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != menuId'>
#{menuId},
</if>
<if test ='null != menuName'>
#{menuName},
</if>
<if test ='null != parentId'>
#{parentId},
</if>
<if test ='null != orderNum'>
#{orderNum},
</if>
<if test ='null != path'>
#{path},
</if>
<if test ='null != component'>
#{component},
</if>
<if test ='null != isFrame'>
#{isFrame},
</if>
<if test ='null != menuType'>
#{menuType},
</if>
<if test ='null != visible'>
#{visible},
</if>
<if test ='null != perms'>
#{perms},
</if>
<if test ='null != icon'>
#{icon},
</if>
<if test ='null != createBy'>
#{createBy},
</if>
<if test ='null != createTime'>
#{createTime},
</if>
<if test ='null != updateBy'>
#{updateBy},
</if>
<if test ='null != updateTime'>
#{updateTime},
</if>
<if test ='null != remark'>
#{remark}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM zzgl_menu
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.zzgl.ZzglMenu">
UPDATE zzgl_menu
<set>
<if test ='null != menuId'>menu_id = #{menuId},</if>
<if test ='null != menuName'>menu_name = #{menuName},</if>
<if test ='null != parentId'>parent_id = #{parentId},</if>
<if test ='null != orderNum'>order_num = #{orderNum},</if>
<if test ='null != path'>path = #{path},</if>
<if test ='null != component'>component = #{component},</if>
<if test ='null != isFrame'>is_frame = #{isFrame},</if>
<if test ='null != menuType'>menu_type = #{menuType},</if>
<if test ='null != visible'>visible = #{visible},</if>
<if test ='null != perms'>perms = #{perms},</if>
<if test ='null != icon'>icon = #{icon},</if>
<if test ='null != createBy'>create_by = #{createBy},</if>
<if test ='null != createTime'>create_time = #{createTime},</if>
<if test ='null != updateBy'>update_by = #{updateBy},</if>
<if test ='null != updateTime'>update_time = #{updateTime},</if>
<if test ='null != remark'>remark = #{remark}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_menu
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_menu
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM zzgl_menu
</select>
-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.zzgl.ZzglPostMenuMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.zzgl.ZzglPostMenu" >
<result column="bmgw_id" property="bmgwId" />
<result column="menu_id" property="menuId" />
</resultMap>
<sql id="Base_Column_List">
bmgw_id,
menu_id
</sql>
<sql id="Base_Column_List_Alias">
bmgw_id ZzglPostMenu_bmgw_id,
menu_id ZzglPostMenu_menu_id
</sql>
<insert id="insertPostMenus" useGeneratedKeys="true" keyColumn="id">
INSERT INTO zzgl_post_menu
(bmgw_id,menu_id)
values
<foreach item="item" index="index" collection="menus" open="" separator="," close="">
(
#{id},#{item}
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.zzgl.ZzglPostMenu">
INSERT INTO zzgl_post_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != bmgwId'>
bmgw_id,
</if>
<if test ='null != menuId'>
menu_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != bmgwId'>
#{bmgwId},
</if>
<if test ='null != menuId'>
#{menuId}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM zzgl_post_menu
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.zzgl.ZzglPostMenu">
UPDATE zzgl_post_menu
<set>
<if test ='null != bmgwId'>bmgw_id = #{bmgwId},</if>
<if test ='null != menuId'>menu_id = #{menuId}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_post_menu
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_post_menu
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM zzgl_post_menu
</select>
-->
</mapper>
\ No newline at end of file
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