Commit 6bed8e5b by 邓实川 Committed by chenzg

定时任务时间管理优化,

省市区贼全字典表实体及树级接口
parent de18710c
/**
* <p>Title: China.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月11日
* @version 1.0
*/
package cn.timer.api.bean.clazz;
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;
/**
* <p>
* Title: China.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年5月11日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("地区字典表(全)")
public class SysRegion extends Model<SysRegion>{
private static final long serialVersionUID = -3184372953004418673L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "区域主键", example = "1")
private Integer keyId;
@ApiModelProperty(value = "区域名称", example = "10")
private String regionName;
@ApiModelProperty(value = "区域编码", example = "1")
private String regionCode;
@ApiModelProperty(value = "地名简称", example = "1")
private String simpleName;
@ApiModelProperty(value = "区域等级", example = "1")
private Integer level;
@ApiModelProperty(value = "城市编码", example = "1")
private String cityCode;
@ApiModelProperty(value = "邮政编码", example = "1")
private String zipCode;
@ApiModelProperty(value = "组合名称", example = "1")
private String merName;
@ApiModelProperty(value = "经度", example = "1")
private Float lng;
@ApiModelProperty(value = "纬度", example = "1")
private Float lat;
@ApiModelProperty(value = "拼音/英文名", example = "1")
private String enName;
}
......@@ -120,27 +120,37 @@ public class OSSController {
* DELETE
*
* @param moudle
* @param fileName
************/
@DeleteMapping(value = "/delSingle")
@ApiOperation(value = "删除单个(谨慎使用)", httpMethod = "DELETE", notes = "接口发布说明")
public Result<String> delSingle(@CurrentUser UserBean userBean, @RequestParam(required = false) String moudle,
@RequestParam(required = false) String fileName) {
try {
String path = "8timer2.0/" + userBean.getOrgCode() + "/" + moudle + "/" + fileName;
oss.delSingleFile(path);
} catch (Exception e) {
e.getStackTrace();
}
return ResultUtil.success("删除成功");
}
@DeleteMapping(value = "/delFiles")
@ApiOperation(value = "删除多个(谨慎使用,谨慎使用)", httpMethod = "DELETE", notes = "接口发布说明")
public Result<List<String>> delFiles(@CurrentUser UserBean userBean, @RequestBody OssDto ossDto) {
List<String> list = null;
List<String> keys = null;
try {
for (String fileName : ossDto.getFileNames()) {
keys = new ArrayList<String>();
String key = "8timer2.0/" + userBean.getOrgCode() + "/" + ossDto.getMoudle() + "/" + fileName;
keys.add(key);
}
List<String> list = oss.delFiles(keys, ossDto.isQuiet());
list = oss.delFiles(keys, ossDto.isQuiet());
} catch (Exception e) {
e.getStackTrace();
}
return ResultUtil.data(list, "删除成功");
}
......
......@@ -11,12 +11,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......@@ -33,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -45,11 +44,14 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglAttaClfjb;
......@@ -71,7 +73,6 @@ import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
......@@ -154,19 +155,18 @@ public class YgglController {
Integer orgCode = userBean.getOrgCode();
LoginInfoDto loginInfo = LoginInfoDto.builder().build();
YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId,
YgglMainEmp::getName,
YgglMainEmp::getRzTime,
YgglMainEmp::getZzTime,
.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getZzTime,
YgglMainEmp::getEmpNum)
.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
if (ygglMainEmp != null) {
Integer gw = ygglMainEmp.getBmgwId();
ZzglBmgwM gwObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId,ZzglBmgwM::getName)
.eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM gwObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.select(ZzglBmgwM::getUpId, ZzglBmgwM::getName).eq(ZzglBmgwM::getId, gw)
.eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM bmObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getId,ZzglBmgwM::getName)
.eq(ZzglBmgwM::getId, gwObj.getUpId()).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM bmObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.select(ZzglBmgwM::getId, ZzglBmgwM::getName).eq(ZzglBmgwM::getId, gwObj.getUpId())
.eq(ZzglBmgwM::getOrgCode, orgCode).one();
loginInfo.setEmpNum(ygglMainEmp.getEmpNum());
loginInfo.setName(ygglMainEmp.getName());
loginInfo.setBmId(bmObj != null ? bmObj.getId() : null);
......@@ -243,7 +243,6 @@ public class YgglController {
return one;
}
/**
* 获取用户头像
*
......@@ -385,7 +384,7 @@ public class YgglController {
ygglMainEmp.insert();
if(addygdaDto.getBmgwId() != null) {
if (addygdaDto.getBmgwId() != null) {
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.set(addygdaDto.getBmgwId() != null, YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
......@@ -425,7 +424,8 @@ public class YgglController {
@PostMapping(value = "/updateygda")
@ApiOperation(value = "修改员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 5)
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp) throws Exception{
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp)
throws Exception {
if (ygglMainEmp.getEmpNum() != null) {
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
......@@ -461,7 +461,6 @@ public class YgglController {
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
ZzglBmgwM.getDepts(bList, b, zzglBmgwMs);
Integer j = ygQueryDto.getJobStatus();
Integer t = ygQueryDto.getJobType();
String q = ygQueryDto.getQuery();
......@@ -470,13 +469,11 @@ public class YgglController {
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.select("name", "emp_num", "bmgw_id", "rz_time", "job_type", "phone", "job_status")
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType())
.eq("org_code", orgCode)
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType()).eq("org_code", orgCode)
.eq(t != null && t > -1, "job_type", t).eq(j != null && j > -1, "job_status", j)
.in(!bList.isEmpty(), "bmgw_id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q));
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
// List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
......@@ -796,7 +793,8 @@ public class YgglController {
// 员工状态(最大优化)
d.setJobStatus(YgEnumInterface.jobStatus.isZhen(jobStatus));
// 入职日期(最大优化)
d.setRzTime(rzTime != null ? YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)) : null);
d.setRzTime(
rzTime != null ? YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)) : null);
// 试用期(最大优化)
d.setSyq(YgEnumInterface.syq.choose(syq));
}
......@@ -807,7 +805,7 @@ public class YgglController {
// 浴池,洗去选填项字节大于100的选项
public boolean takeshower(String[] bathroom) {
for (String b : bathroom) {
if (b!=null&& b.length() > 100) {
if (b != null && b.length() > 100) {
return false;
}
......@@ -1572,10 +1570,10 @@ public class YgglController {
updateWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", empNum);
YgglMainEmp.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.build().update(updateWrapper);
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.sjlzTime(new Date()).build().update(updateWrapper1);
YgglMainEmp.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).build()
.update(updateWrapper);
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
.build().update(updateWrapper1);
// 查询该员工的关联表
QueryWrapper<QyzxEmpEntAsso> queryWrapper1 = new QueryWrapper<QyzxEmpEntAsso>();
queryWrapper1.eq("emp_num", empNum);
......@@ -1584,9 +1582,8 @@ public class YgglController {
qyzxEmpEntAsso.delete(queryWrapper1);
// 初始化 部门主管
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(), new UpdateWrapper<ZzglBmgwM>()
.lambda()
.eq(ZzglBmgwM::getLeader, empNum));
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(),
new UpdateWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getLeader, empNum));
return ResultUtil.success("确认离职员工成功");
}
......@@ -2029,4 +2026,30 @@ public class YgglController {
.delete(new QueryWrapper<YgglAttaSbgjj>().eq("org_code", orgCode).eq("id", id)), "删除员工社保公积金成功");
}
@GetMapping(value = "/sysRegion")
@ApiOperation(value = "省市区字典(贼全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<Tree<String>>> sysRegion() {
List<SysRegion> nodeList = SysRegion.builder().build()
.selectList(new LambdaQueryWrapper<SysRegion>().select(SysRegion::getKeyId, SysRegion::getRegionCode,
SysRegion::getRegionName, SysRegion::getMerName, SysRegion::getLevel));
// 配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// 自定义属性名 都要默认值的
treeNodeConfig.setIdKey("key_id");
treeNodeConfig.setParentIdKey("region_code");
// 最大递归深度
treeNodeConfig.setDeep(4);
List<Tree<String>> treeNodes = TreeUtil.build(nodeList, "0", treeNodeConfig, (treeNode, tree) -> {
tree.setId(treeNode.getKeyId().toString());
tree.setParentId(treeNode.getRegionCode());
tree.setName(treeNode.getRegionName());
// 扩展属性 ...
tree.putExtra("mer_name", treeNode.getMerName());
});
return ResultUtil.data(treeNodes, "获取成功");
}
}
/**
* <p>Title: SysRegionMapper.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月11日
* @version 1.0
*/
package cn.timer.api.dao.clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.clazz.SysRegion;
/**
* <p>
* Title: SysRegionMapper.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年5月11日
* @version 1.0
*/
public interface SysRegionMapper extends BaseMapper<SysRegion> {
}
......@@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.timer.api.bean.sche.ScheduleTask;
public class CronUtil {
// 默认cron 10秒一次
private static String cron = "0/10 * * * * ?";
// 默认cron 30秒一次
private static String cron = "0 0 8 * * ?";
// private static String cron = "0 50 14 * * ?";
// 数据库cron
public static String getCron(String className, String methodName) {
......
......@@ -28,7 +28,7 @@ import cn.timer.api.utils.aliyun.AliyunSMS;
*
*/
@Component
@Lazy(false)
@Lazy
public class RemindUtil implements SchedulingConfigurer {
@Autowired
......
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