Commit 0f6e089a by tangzhaoqian Committed by chenzg

清理多余类、代码优化

parent de7da654
package cn.timer.api.config.page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
public class SimplePageBuilder {
/**
* 以常量的形式存储,在实际的运用中应该从properties文件中取得,思路都一样
*/
public static final int size = 10;
@SuppressWarnings("deprecation")
public static Pageable generate(int page, int size, Sort sort) {
if (sort == null)
return new PageRequest(page, size);
return new PageRequest(page, size, sort);
}
public static Pageable generate(int page) {
return generate(page, size, null);
}
public static Pageable generate(int page, Sort sort) {
return generate(page, size, sort);
}
}
package cn.timer.api.config.sort;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
public class SimpleSortBuilder {
/**
* 调用的时候使用SimpleSortBuilder.generateSort("name","xh_d");表示先以name升序,之后以xh降序
*/
@SuppressWarnings("deprecation")
public static Sort generateSort(String... fields) {
List<Order> orders = new ArrayList<Order>();
for(String f:fields) {
orders.add(generateOrder(f));
}
return new Sort(orders);
}
@SuppressWarnings("deprecation")
private static Order generateOrder(String f) {
Order order = null;
String[] ff = f.split("_");
if(ff.length>=2) {
if(ff[1].equals("d")) {
order = new Order(Direction.DESC,ff[0]);
} else {
order = new Order(Direction.ASC,ff[0]);
}
return order;
}
order = new Order(f);
return order;
}
}
......@@ -439,13 +439,7 @@ public class LoginController {
@ApiOperationSupport(order = 6)
@Log(title = "企业注册", businessType = BusinessType.INSERT)
public Result<String> register(@RequestBody EntRegisterDto entRegisterDto) throws Exception{
// 事务回滚
/*
* DefaultTransactionDefinition def = new DefaultTransactionDefinition();
* def.setName("register");
* def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
* TransactionStatus status = transactionManager.getTransaction(def);
*/
try {
String phone = entRegisterDto.getPhone();
String username = entRegisterDto.getUsername();
......
......@@ -94,6 +94,7 @@ public class SpmkController {
private SpmkService spmkService;
@Autowired
private ZzglBmgwMService zzglBmgwMService;
@Autowired
private SpmkApprovalTemplateGMapper spmkApprovalTemplateGMapper;
@Autowired
......@@ -115,8 +116,6 @@ public class SpmkController {
private boolean ISFIRST = true; // 第一次启动审批流程
//TODO 审批模板组
/**
* 新增或编辑-审批模板组
......@@ -280,7 +279,7 @@ public class SpmkController {
}
spmkApprovalG.setOrgCode(userBean.getOrgCode());
return spmkApprovalG.insertOrUpdate() ? ResultUtil.data(spmkApprovalG, "操作成功!") : ResultUtil.error();
return spmkApprovalG.insertOrUpdate() ? ResultUtil.data(spmkApprovalG) : ResultUtil.error();
}
......@@ -293,7 +292,7 @@ public class SpmkController {
public Result<Object> deleteAgById(@PathVariable int id){
if (spmkCustomApprovalMapper.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)) > 0 )
return ResultUtil.error("审批组存在 自定义审批不可直接删除!");
return ResultUtil.error("审批组存在 自定义审批,不可直接删除!");
return SpmkApprovalG.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象");
......@@ -309,7 +308,7 @@ public class SpmkController {
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
System.out.println(depts);
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts),"操作成功!");
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts));
}
......@@ -321,7 +320,7 @@ public class SpmkController {
@ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){
return ResultUtil.data(spmkService.selectListAg(userBean) ,"操作成功!");
return ResultUtil.data(spmkService.selectListAg(userBean));
}
/**
......@@ -332,7 +331,7 @@ public class SpmkController {
@ApiOperationSupport(order = 12)
public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list){
if (list == null || (list != null && list.size() <= 0)) {
if (list == null || list.size() <= 0) {
return ResultUtil.success();
}
......@@ -398,7 +397,7 @@ public class SpmkController {
// 清空前端不需要的字段再返回,节省流量
ca.setFroms(null);
ca.setRouter(null);
return ResultUtil.data(ca, "操作成功!");
return ResultUtil.data(ca);
}
......@@ -435,7 +434,7 @@ public class SpmkController {
.build();
BeanUtil.copyProperties(ca, caD,"froms","router");
caD.setInitiatorConfigs(listIc);
return ResultUtil.data(caD,"操作成功!");
return ResultUtil.data(caD);
}
/**
......@@ -544,7 +543,7 @@ public class SpmkController {
List<YgglMainEmp> listYgglMainEmp = RouterUtils.selectOtherlistent(userBean.getOrgCode(), deptId);
if (deptId != null && (listYgglMainEmp == null || listYgglMainEmp.size() == 0)) {
return ResultUtil.data(new ArrayList<SpmkApproveSummary>(), "操作成功!");
return ResultUtil.data(new ArrayList<SpmkApproveSummary>());
}
List<Integer> empNums = new ArrayList<Integer>();
......@@ -558,7 +557,7 @@ public class SpmkController {
List<SpmkApproveSummary> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
return ResultUtil.data(pageAs, listAs);
}
//TODO 审批详情
......@@ -573,7 +572,7 @@ public class SpmkController {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
return ResultUtil.data(adD, "操作成功!");
return ResultUtil.data(adD);
}
//TODO 审批人审批
......@@ -682,7 +681,7 @@ public class SpmkController {
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveSummary> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
return ResultUtil.data(pageAs, listAs);
}
//TODO 撤销审批
......@@ -770,6 +769,6 @@ public class SpmkController {
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"获取图标列表成功");
return ResultUtil.data(spmkIcons,"生成 审批组 和 自定义审批成功");
}
}
......@@ -48,6 +48,7 @@ import cn.hutool.core.io.IoUtil;
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.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
......@@ -156,7 +157,7 @@ public class YgglController {
if (rz != null) {
ygglMainEmp.setWorkTime(DateUtil.formatBetween(rz, new Date(), Level.DAY));
}
return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
return ResultUtil.data(ygglMainEmp);
}
// 获取员工档案
......@@ -172,7 +173,7 @@ public class YgglController {
if (rz != null) {
ygglMainEmp.setWorkTime(DateUtil.formatBetween(ygglMainEmp.getRzTime(), new Date(), Level.DAY));
}
return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
return ResultUtil.data(ygglMainEmp);
}
/**
......@@ -186,7 +187,7 @@ public class YgglController {
@ApiOperationSupport(order = 3)
public Result<String> selectbmgw(@CurrentUser UserBean userBean, @PathVariable Integer gwid) {
if (gwid == null || gwid == 0) {
return ResultUtil.data("无岗位", "获取员工档案部门岗位名称成功");
return ResultUtil.data("岗位不存在");
}
Integer orgCode = userBean.getOrgCode();
ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().lambda()
......@@ -207,7 +208,7 @@ public class YgglController {
bm = z.getName();
}
String bmgw = bm + "/" + gw;
return ResultUtil.data(bmgw, "获取员工档案部门岗位名称成功");
return ResultUtil.data(bmgw);
}
/**
......@@ -229,13 +230,14 @@ public class YgglController {
boolean isvalid = true;
switch (zjType) {
case 0:
isvalid = ReUtil.isMatch(Regular.IDCARD, zjNum);
isvalid = IdcardUtil.isValidCard15(zjNum) || IdcardUtil.isValidCard18(zjNum);
break;
case 1:
isvalid = ReUtil.isMatch(Regular.HKMAKAO, zjNum);
String[] strs = IdcardUtil.isValidCard10(zjNum);
isvalid = "澳门/香港".contains(strs[0]) && "true".equals(strs[2]);
break;
case 2:
isvalid = ReUtil.isMatch(Regular.TAIWAN1, zjNum) || ReUtil.isMatch(Regular.TAIWAN2, zjNum);
isvalid = IdcardUtil.isValidTWCard(zjNum);
break;
case 3:
isvalid = ReUtil.isMatch(Regular.PASSPORT1, zjNum) || ReUtil.isMatch(Regular.PASSPORT2, zjNum);
......@@ -351,7 +353,7 @@ public class YgglController {
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
// List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
return ResultUtil.data(ygglMainEmpPage, "员工搜索成功");
return ResultUtil.data(ygglMainEmpPage);
// return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功");
}
......@@ -405,13 +407,14 @@ public class YgglController {
boolean isvalid = true;
switch (zjType) {
case 0:
isvalid = ReUtil.isMatch(Regular.IDCARD, zjNum);
isvalid = IdcardUtil.isValidCard15(zjNum) || IdcardUtil.isValidCard18(zjNum);
break;
case 1:
isvalid = ReUtil.isMatch(Regular.HKMAKAO, zjNum);
String[] strs = IdcardUtil.isValidCard10(zjNum);
isvalid = "澳门/香港".contains(strs[0]) && "true".equals(strs[2]);
break;
case 2:
isvalid = ReUtil.isMatch(Regular.TAIWAN1, zjNum) || ReUtil.isMatch(Regular.TAIWAN2, zjNum);
isvalid = IdcardUtil.isValidTWCard(zjNum);
break;
case 3:
isvalid = ReUtil.isMatch(Regular.PASSPORT1, zjNum) || ReUtil.isMatch(Regular.PASSPORT2, zjNum);
......@@ -557,7 +560,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJyjlb::getEmpNum,userBean.getEmpNum()));
return ResultUtil.data(ygglAttaJyjlbss, "获取员工教育经历表成功");
return ResultUtil.data(ygglAttaJyjlbss);
}
// 获取员工教育经历表
......@@ -569,7 +572,7 @@ public class YgglController {
new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJyjlb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaJyjlbs, "获取员工教育经历表成功");
return ResultUtil.data(ygglAttaJyjlbs);
}
/**
......@@ -585,7 +588,7 @@ public class YgglController {
ygglAttaJyjlb.setEmpNum(ygglAttaJyjlb.getEmpNum());
ygglAttaJyjlb.setOrgCode(userBean.getOrgCode());
ygglAttaJyjlb.insertOrUpdate();
return ResultUtil.data(ygglAttaJyjlb, "添加/修改员工教育经历表成功");
return ResultUtil.data(ygglAttaJyjlb, "修改员工教育经历表成功");
}
/**
......@@ -619,7 +622,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaPxjlxxb>().lambda()
.eq(YgglAttaPxjlxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaPxjlxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaPxjlxxbs, "获取员工培训经历信息表成功");
return ResultUtil.data(ygglAttaPxjlxxbs);
}
// 获取员工培训经历信息表
......@@ -631,7 +634,7 @@ public class YgglController {
new QueryWrapper<YgglAttaPxjlxxb>().lambda()
.eq(YgglAttaPxjlxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaPxjlxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaPxjlxxbs, "获取员工培训经历信息表成功");
return ResultUtil.data(ygglAttaPxjlxxbs);
}
/**
......@@ -648,7 +651,7 @@ public class YgglController {
ygglAttaPxjlxxb.setEmpNum(ygglAttaPxjlxxb.getEmpNum());
ygglAttaPxjlxxb.setOrgCode(userBean.getOrgCode());
ygglAttaPxjlxxb.insertOrUpdate();
return ResultUtil.data(ygglAttaPxjlxxb, "添加/修改员工培训经历信息表成功");
return ResultUtil.data(ygglAttaPxjlxxb, "修改员工培训经历信息表成功");
}
/**
......@@ -682,7 +685,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzjlb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaGzjlbs, "获取员工工作经历表成功");
return ResultUtil.data(ygglAttaGzjlbs);
}
// 获取员工工作经历表
......@@ -694,7 +697,7 @@ public class YgglController {
new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzjlb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaGzjlbs, "获取员工工作经历表成功");
return ResultUtil.data(ygglAttaGzjlbs);
}
/**
......@@ -710,7 +713,7 @@ public class YgglController {
ygglAttaGzjlb.setEmpNum(ygglAttaGzjlb.getEmpNum());
ygglAttaGzjlb.setOrgCode(userBean.getOrgCode());
ygglAttaGzjlb.insertOrUpdate();
return ResultUtil.data(ygglAttaGzjlb, "添加/修改员工工作经历表成功");
return ResultUtil.data(ygglAttaGzjlb, "修改员工工作经历表成功");
}
/**
......@@ -744,7 +747,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZcxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaZcxxbs, "获取员工职称信息表成功");
return ResultUtil.data(ygglAttaZcxxbs);
}
// 获取员工职称信息表
......@@ -756,7 +759,7 @@ public class YgglController {
new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZcxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaZcxxbs, "获取员工职称信息表成功");
return ResultUtil.data(ygglAttaZcxxbs);
}
/**
......@@ -772,7 +775,7 @@ public class YgglController {
ygglAttaZcxxb.setEmpNum(ygglAttaZcxxb.getEmpNum());
ygglAttaZcxxb.setOrgCode(userBean.getOrgCode());
ygglAttaZcxxb.insertOrUpdate();
return ResultUtil.data(ygglAttaZcxxb, "添加/修改员工职称信息表成功");
return ResultUtil.data(ygglAttaZcxxb, "修改员工职称信息表成功");
}
/**
......@@ -806,7 +809,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZszjb::getEmpNum,userBean.getEmpNum()));
return ResultUtil.data(ygglAttaZszjbs, "获取员工证书证件表成功");
return ResultUtil.data(ygglAttaZszjbs);
}
// 获取员工证书证件表
......@@ -818,7 +821,7 @@ public class YgglController {
new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZszjb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaZszjbs, "获取员工证书证件表成功");
return ResultUtil.data(ygglAttaZszjbs);
}
/**
......@@ -834,7 +837,7 @@ public class YgglController {
ygglAttaZszjb.setEmpNum(ygglAttaZszjb.getEmpNum());
ygglAttaZszjb.setOrgCode(userBean.getOrgCode());
ygglAttaZszjb.insertOrUpdate();
return ResultUtil.data(ygglAttaZszjb, "添加/修改员工证书证件表成功");
return ResultUtil.data(ygglAttaZszjb, "修改员工证书证件表成功");
}
/**
......@@ -868,7 +871,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaLxxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaLxxxbs, "获取员工联系信息表成功");
return ResultUtil.data(ygglAttaLxxxbs);
}
// 获取员工联系信息表
......@@ -880,7 +883,7 @@ public class YgglController {
new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaLxxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaLxxxbs, "获取员工联系信息表成功");
return ResultUtil.data(ygglAttaLxxxbs);
}
/**
......@@ -896,7 +899,7 @@ public class YgglController {
ygglAttaLxxxb.setEmpNum(ygglAttaLxxxb.getEmpNum());
ygglAttaLxxxb.setOrgCode(userBean.getOrgCode());
ygglAttaLxxxb.insertOrUpdate();
return ResultUtil.data(ygglAttaLxxxb, "添加/修改员工联系信息表成功");
return ResultUtil.data(ygglAttaLxxxb, "修改员工联系信息表成功");
}
/**
......@@ -930,7 +933,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJjlxr::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaJjlxrs, "获取员工紧急联系人表成功");
return ResultUtil.data(ygglAttaJjlxrs);
}
// 获取员工紧急联系人表
......@@ -942,7 +945,7 @@ public class YgglController {
new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJjlxr::getEmpNum, empNum));
return ResultUtil.data(ygglAttaJjlxrs, "获取员工紧急联系人表成功");
return ResultUtil.data(ygglAttaJjlxrs);
}
/**
......@@ -958,7 +961,7 @@ public class YgglController {
ygglAttaJjlxr.setEmpNum(ygglAttaJjlxr.getEmpNum());
ygglAttaJjlxr.setOrgCode(userBean.getOrgCode());
ygglAttaJjlxr.insertOrUpdate();
return ResultUtil.data(ygglAttaJjlxr, "添加/修改员工紧急联系人表成功");
return ResultUtil.data(ygglAttaJjlxr, "修改员工紧急联系人表成功");
}
/**
......@@ -993,7 +996,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaGzk>().lambda()
.eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzk::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaGzks, "获取工资卡信息成功");
return ResultUtil.data(ygglAttaGzks);
}
// 获取工资卡信息
......@@ -1005,7 +1008,7 @@ public class YgglController {
new QueryWrapper<YgglAttaGzk>().lambda()
.eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzk::getEmpNum, empNum));
return ResultUtil.data(ygglAttaGzks, "获取工资卡信息成功");
return ResultUtil.data(ygglAttaGzks);
}
/**
......@@ -1021,7 +1024,7 @@ public class YgglController {
ygglAttaGzk.setEmpNum(ygglAttaGzk.getEmpNum());
ygglAttaGzk.setOrgCode(userBean.getOrgCode());
ygglAttaGzk.insertOrUpdate();
return ResultUtil.data(ygglAttaGzk, "添加/修改工资卡信息成功");
return ResultUtil.data(ygglAttaGzk, "修改工资卡信息成功");
}
/**
......@@ -1055,7 +1058,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaHtxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaHtxxbs, "获取员工合同信息表成功");
return ResultUtil.data(ygglAttaHtxxbs);
}
// 获取员工合同信息表
......@@ -1067,7 +1070,7 @@ public class YgglController {
new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaHtxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaHtxxbs, "获取员工合同信息表成功");
return ResultUtil.data(ygglAttaHtxxbs);
}
/**
......@@ -1083,7 +1086,7 @@ public class YgglController {
ygglAttaHtxxb.setEmpNum(ygglAttaHtxxb.getEmpNum());
ygglAttaHtxxb.setOrgCode(userBean.getOrgCode());
ygglAttaHtxxb.insertOrUpdate();
return ResultUtil.data(ygglAttaHtxxb, "添加/修改员工合同信息表成功");
return ResultUtil.data(ygglAttaHtxxb, "修改员工合同信息表成功");
}
/**
......@@ -1117,7 +1120,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaClfjb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaClfjbs, "获取员工材料附件表成功");
return ResultUtil.data(ygglAttaClfjbs);
}
// 获取员工材料附件表
......@@ -1129,7 +1132,7 @@ public class YgglController {
new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaClfjb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaClfjbs, "获取员工材料附件表成功");
return ResultUtil.data(ygglAttaClfjbs);
}
/**
......@@ -1145,7 +1148,7 @@ public class YgglController {
ygglAttaClfjb.setOrgCode(userBean.getOrgCode());
ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum());
ygglAttaClfjb.insertOrUpdate();
return ResultUtil.data(ygglAttaClfjb, "添加/修改员工材料附件表成功");
return ResultUtil.data(ygglAttaClfjb, "修改员工材料附件表成功");
}
/**
......@@ -1179,7 +1182,7 @@ public class YgglController {
.selectList(new QueryWrapper<YgglAttaCzjlb>().lambda()
.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaCzjlb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaCzjlbs, "获取成长记录表成功");
return ResultUtil.data(ygglAttaCzjlbs);
}
// 获取成长记录表
......@@ -1191,7 +1194,7 @@ public class YgglController {
new QueryWrapper<YgglAttaCzjlb>().lambda()
.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaCzjlb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaCzjlbs, "获取员工成长记录表成功");
return ResultUtil.data(ygglAttaCzjlbs);
}
/**
......@@ -1207,7 +1210,7 @@ public class YgglController {
ygglAttaCzjlb.setEmpNum(ygglAttaCzjlb.getEmpNum());
ygglAttaCzjlb.setOrgCode(userBean.getOrgCode());
ygglAttaCzjlb.insertOrUpdate();
return ResultUtil.data(ygglAttaCzjlb, "添加/修改成长记录表成功");
return ResultUtil.data(ygglAttaCzjlb, "修改成长记录表成功");
}
/**
......@@ -1222,7 +1225,7 @@ public class YgglController {
public Result<YgglMainLzb> selectlzb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
YgglMainLzb lzyg = new LambdaQueryChainWrapper<YgglMainLzb>(ygglMainLzbMapper)
.eq(YgglMainLzb::getOrgCode, userBean.getOrgCode()).eq(YgglMainLzb::getEmpNum, empNum).one();
return ResultUtil.data(lzyg, "获取单个离职员工信息(管)成功");
return ResultUtil.data(lzyg);
}
/**
......@@ -1239,7 +1242,7 @@ public class YgglController {
YgglMainEmp.builder().jobStatus(jobStatus.ZHENSHI.getType()).zzTime(ygzzDto.getZzTime()).sjzzTime(new Date())
.zzRemark(ygzzDto.getZzRemark()).build().update(new UpdateWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getEmpNum, ygzzDto.getEmpNum()));
return ResultUtil.success("转正成功");
return ResultUtil.success("转正成功!");
}
/**
......@@ -1339,7 +1342,7 @@ public class YgglController {
.eq(YgglMainLzb::getEmpNum, ygglMainLzb.getEmpNum()));
return ResultUtil.data(ygglMainLzb, "修改成功");
}
return ResultUtil.error("请确认该员工是否存在");
return ResultUtil.error("请确认该员工是否存在!");
}
......@@ -1395,7 +1398,7 @@ public class YgglController {
public Result<List<CommonArea>> selectNativePlace() {
List<CommonArea> listCommonArea = commonAreaMapper.AllAreaForTree();
return ResultUtil.data(listCommonArea, "操作成功!");
return ResultUtil.data(listCommonArea);
}
......@@ -1415,7 +1418,7 @@ public class YgglController {
yg.setHeadUrl("");
}
}
return ResultUtil.data(ygQueryDto, "查询成功");
return ResultUtil.data(ygQueryDto);
}
/*************** 统计图 ***************/
......@@ -1459,7 +1462,7 @@ public class YgglController {
map.put("nativeplace", ygglCartogramDto10);
map.put("workingAge", ygglCartogramDto11);
return ResultUtil.data(map, "查询成功");
return ResultUtil.data(map);
}
/**
......@@ -1473,15 +1476,7 @@ public class YgglController {
public Result<YgCartogramDto> ygCartogram(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<YgbintuDto> bintu = ygglMainEmpMapper.rsybp(orgCode);
/*
* bintu.stream().filter(bean ->{ if (bean.getAge() == null) { bean.setAge(0); }
* if (bean.getBm() == null) { bean.setBm("未分配"); } if (bean.getGw() == null) {
* bean.setGw("未分配"); } if (bean.getProname() == null) { bean.setProname("未分配");
* } if (bean.getEduname() == null) { bean.setEduname("未分配"); } if
* (bean.getJobStatus() == null) { bean.setJobStatus(-1); } if
* (bean.getWorkage() == null) { bean.setWorkage(-1); } return true;
* }).collect(Collectors.toList());
*/
Map<String, Long> gw = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getGw, Collectors.counting()));
List<YgKVDto> gwList = new ArrayList<YgKVDto>();
for (Map.Entry<String, Long> entry : gw.entrySet()) {
......@@ -1492,8 +1487,6 @@ public class YgglController {
for (Map.Entry<String, Long> entry : bm.entrySet()) {
bmList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
}
// Map<String, Map<String, Long>> bmgw =
// bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm,Collectors.groupingBy(YgbintuDto::getGw,Collectors.counting())));
Map<String, Long> edu = bintu.stream()
.collect(Collectors.groupingBy(YgbintuDto::getEduname, Collectors.counting()));
List<YgKVDto> eduList = new ArrayList<YgKVDto>();
......@@ -1547,7 +1540,7 @@ public class YgglController {
ybp.setProname(pronameList);
ybp.setWorkage(workageList);
ybp.setAge(ageList);
return ResultUtil.data(ybp, "获取员工管理统计图信息成功!");
return ResultUtil.data(ybp);
}
/**
......@@ -1563,7 +1556,7 @@ public class YgglController {
List<YgglAttaSbgjj> ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectList(new QueryWrapper<YgglAttaSbgjj>().lambda()
.eq(YgglAttaSbgjj::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaSbgjj::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功");
return ResultUtil.data(ygglAttaSbgjj);
}
/**
......@@ -1580,7 +1573,7 @@ public class YgglController {
YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build()
.selectOne(new QueryWrapper<YgglAttaSbgjj>().lambda().eq(YgglAttaSbgjj::getEmpNum, empNum));
return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功");
return ResultUtil.data(ygglAttaSbgjj);
}
/**
......@@ -1605,7 +1598,7 @@ public class YgglController {
ygglAttaSbgjj.insert();
}
return ResultUtil.data(ygglAttaSbgjj, "添加/修改员工社保公积金成功");
return ResultUtil.data(ygglAttaSbgjj);
}
/**
......@@ -1622,7 +1615,7 @@ public class YgglController {
return ResultUtil.data(YgglAttaSbgjj.builder().build()
.delete(new QueryWrapper<YgglAttaSbgjj>().lambda()
.eq(YgglAttaSbgjj::getOrgCode, orgCode)
.eq(YgglAttaSbgjj::getId, id)), "删除员工社保公积金成功");
.eq(YgglAttaSbgjj::getId, id)));
}
@GetMapping(value = "/sysRegion")
......@@ -1648,7 +1641,7 @@ public class YgglController {
tree.putExtra("mer_name", treeNode.getMerName());
});
return ResultUtil.data(treeNodes, "获取成功");
return ResultUtil.data(treeNodes);
}
/**
......@@ -1690,7 +1683,7 @@ public class YgglController {
loginInfo.setEntryTime(ygglMainEmp.getRzTime());
loginInfo.setRegularTime(ygglMainEmp.getRzTime());
}
return ResultUtil.data(loginInfo, "操作成功!");
return ResultUtil.data(loginInfo);
}
/**
......@@ -1729,7 +1722,7 @@ public class YgglController {
loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(), m.getName(), m.getHeadUrl()));
}
Collections.reverse(loginerChargeDtos);
return ResultUtil.data(loginerChargeDtos, "获取上级部门的部门id");
return ResultUtil.data(loginerChargeDtos);
}
// 根据传来的empNum获取该人员信息,没有则传全部
......@@ -1779,7 +1772,7 @@ public class YgglController {
yg.setHeadUrl(CommonEnum.NULL_STR.getDesc());
}
}
return ResultUtil.data(yglList, "获取用户头像组成功");
return ResultUtil.data(yglList);
}
}
......@@ -24,10 +24,8 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.StrUtil;
......@@ -107,10 +105,10 @@ public class ZzglController {
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
// 构建node列表
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
zzglBmgwMs.forEach(z -> {
nodeList.add(new TreeNode<>(Convert.toStr(z.getId()), Convert.toStr(z.getUpId()), z.getName(), 0));
});
// List<TreeNode<String>> nodeList = CollUtil.newArrayList();
// zzglBmgwMs.forEach(z -> {
// nodeList.add(new TreeNode<>(Convert.toStr(z.getId()), Convert.toStr(z.getUpId()), z.getName(), 0));
// });
//配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
......@@ -277,10 +275,11 @@ public class ZzglController {
@Log(title = "删除岗位", businessType = BusinessType.DELETE)
public Result<Integer> deldepts(@CurrentUser UserBean userBean, @RequestBody List<Integer> ids) {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.set("bmgw_id", null).in("bmgw_id", ids);
zzglLogDgjlMapper.insertbydeldept(ids, userBean.getEmpNum());
ygglMainEmp.update(updateWrapper);
ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
.set(YgglMainEmp::getBmgwId, null)
.in(YgglMainEmp::getBmgwId, ids));
zzglBmgwMMapper.deleteBatchIds(ids);
return ResultUtil.success();
......@@ -298,13 +297,12 @@ public class ZzglController {
Integer dpetId = upEmpDeptDto.getDpetId();
List<Integer> empNums = upEmpDeptDto.getEmpNum();
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
// zzglLogDgjlMapper
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.set("bmgw_id", dpetId).eq("org_code", userBean.getOrgCode()).in("emp_num", empNums);
zzglLogDgjlMapper.insertbyaddemp(empNums, userBean.getEmpNum(), dpetId, userBean.getOrgCode(),
dpetId == null || dpetId == 0 ? "岗位删除员工" : upEmpDeptDto.getIsdg() == null ? "岗位添加员工" : "员工调岗");
ygglMainEmp.update(updateWrapper);
// zzglLogDgjlMapper.insert
ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
.set(YgglMainEmp::getBmgwId, dpetId)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getEmpNum, empNums));
return ResultUtil.success();
}
......@@ -315,11 +313,12 @@ public class ZzglController {
empNums.add(empNum);
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.set("bmgw_id", dpetId).eq("org_code", orgCode).in("emp_num", empNum);
zzglLogDgjlMapper.insertbyaddemp(empNums, empNum, dpetId, orgCode,
dpetId == null || dpetId == 0 ? "岗位删除员工" : upEmpDeptDto.getIsdg() == null ? "岗位添加员工" : "员工调岗");
ygglMainEmp.update(updateWrapper);
ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
.set(YgglMainEmp::getBmgwId, dpetId)
.eq(YgglMainEmp::getOrgCode, orgCode)
.in(YgglMainEmp::getEmpNum, empNum));
}
/**
......@@ -458,7 +457,6 @@ public class ZzglController {
@ApiOperation(value = "删除-菜单权限", httpMethod = "DELETE", notes = "接口发布说明")
public Result<List<ZzglMenu>> deletePostMenus(@Validated @RequestBody Integer id) {
return zzglMenuMapper.deleteById(id) > 0 ? ResultUtil.success() : ResultUtil.error();
}
......
......@@ -2,10 +2,6 @@ package cn.timer.api.manager.factory;
import java.util.TimerTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.hutool.extra.spring.SpringUtil;
import cn.timer.api.bean.qyzx.QyzxOperLog;
import cn.timer.api.controller.qyzx.service.QyzxOperLogService;
import cn.timer.api.utils.AddressUtils;
......
......@@ -511,36 +511,7 @@ public class DateFormatUtils {
}
public static void main(String[] args) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd EE");
System.out.println(df.format(new Date()));
//System.out.println(DateFormatUtils.getWeekNowDay());
/*
* System.out.println(getSystemDateByYYYYMMDDHHMMSSSSS());
* System.out.println(getSystemYY()); System.out.println(getSystemMM());
* System.out.println(getSystemDateByyymmdd());
*/
/*
* Long day = countAge("2015-10-20"); System.out.println(day.toString());
*/
/*
* Date date = getSystemDate(); System.out.println(date.toString());
*/
String s1 = "2008-01-25 09:12:11";
String s2 = "2008-01-25 09:12:09";
/*
* java.text.DateFormat df=new
* java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Calendar
* c1=java.util.Calendar.getInstance(); java.util.Calendar
* c2=java.util.Calendar.getInstance(); try { c1.setTime(df.parse(s1));
* c2.setTime(df.parse(s2)); }catch(java.text.ParseException e){
* System.err.println("格式不正确"); } int result=c1.compareTo(c2); if(result==0)
* System.out.println("c1相等c2"); else if(result<0) System.out.println("c1小于c2");
* else System.out.println("c1大于c2");
*/
Date d1 = convertToDate(s2, "yyyy-MM-dd HH:mm:ss");
Date d2 = convertToDate(s1, "yyyy-MM-dd HH:mm:ss");
System.out.println(DateDifferentExample(d1, d2));
}
}
\ No newline at end of file
package cn.timer.api.utils;
import javax.servlet.http.HttpSession;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSONObject;
/**
* @author Eangaie
* @date 2018/10/12 0012 下午 14:53 网络请求,RestTemplate工具类
*/
@Component
public class RestTemplateUtil {
@Autowired
private RestTemplate restTemplate;
@Autowired
private HttpSession session;
/**
* 发送GET请求
*
* @param url
* @param param
* @return
*/
public JSONObject GetData(String url, T param) {
// 请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交
HttpHeaders headers = new HttpHeaders();
headers.add("appid", "4438775940");
headers.add("grantType", "refresh_token");
headers.add("refreshToken", "8b58973c290cc848b67ff0017cd424ff");
session.setAttribute("Content-Type", "application/json");
session.setAttribute("X-Tsign-Open-App-Id", "4438775940");
session.setAttribute("X-Tsign-Open-Token", "token");
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
@SuppressWarnings("unused")
HttpEntity<T> httpEntity = new HttpEntity<T>(param, headers);
return restTemplate.getForEntity(url, JSONObject.class, param).getBody();
}
/**
* 发送POST-JSON请求
*
* @param url
* @param param
* @return
*/
public String PostJsonData(String url, JSONObject param) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
@SuppressWarnings("unused")
HttpEntity<JSONObject> requestEntity = new HttpEntity<JSONObject>(param, headers);
return restTemplate.postForEntity(url, param, String.class).getBody();
}
/**
* 发送POST 表单请求
*
* @param url
* @param param
* @return
*/
public String PostFormData(String url, MultiValueMap<String, String> param) {
// 请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
return restTemplate.postForEntity(url, param, String.class).getBody();
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
import lombok.Data;
/**
* @author Exrickx
* @author Tang
* 前后端交互数据标准
*/
@Service("result")
......
......@@ -94,6 +94,19 @@ public class ResultUtil<T> {
this.result.setMessage(msg);
return this.result;
}
@SuppressWarnings("rawtypes")
public Result<T> setData(T t1, T t2) {
this.result.setCurrent(((IPage) t1).getCurrent());
this.result.setPages(((IPage) t1).getPages());
this.result.setSize(((IPage) t1).getSize());
this.result.setTotal(((IPage) t1).getTotal());
this.result.setData(t2);
this.result.setCode(STATUS_CODE_SUCCESS);
this.result.setMessage(MESSAGE_SUCCESS);
return this.result;
}
@SuppressWarnings("rawtypes")
public Result<T> setData2(T t1, T t2, String msg) {
......@@ -140,8 +153,13 @@ public class ResultUtil<T> {
return new ResultUtil<T>().setData(t);
}
public static <T> Result<T> data(T t1, T t2, String msg) {
public static <T> Result<T> data(T t1, T t2) {
return new ResultUtil<T>().setData(t1, t2);
}
public static <T> Result<T> data(T t1, T t2, String msg) {
return new ResultUtil<T>().setData(t1, t2, msg);
}
......
package cn.timer.api.utils;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.util.List;
/**
* 反序列化
*
* @author Administrator
*/
public class SerializationUtils {
@SuppressWarnings("unchecked")
public static List<Object> toSerialization(byte[] object) {
try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(object);
ObjectInputStream in;
in = new ObjectInputStream(byteArrayInputStream);
List<Object> objectlist = (List<Object>) in.readObject();
in.close();
return objectlist;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Object toSerializationObject(byte[] object) {
try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(object);
ObjectInputStream in;
in = new ObjectInputStream(byteArrayInputStream);
Object objectlist = (Object) in.readObject();
in.close();
return objectlist;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 数据库驱动-->
<classPathEntry location="C:\Users\Administrator\.m2\repository\mysql\mysql-connector-java\5.1.37\mysql-connector-java-5.1.37.jar"/>
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://120.24.172.51:3306/youlingrc-8timer201" userId="tang1" password="Tang123456!"/>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.eighttimer.service.bean" targetProject="D:\Tang\com.8timer.www\src">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="mapping" targetProject="D:\Tang\com.8timer.www\src">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.eighttimer.service.dao" targetProject="D:\Tang\com.8timer.www\src">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="test" domainObjectName="Test" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
\ 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