Commit 5af35130 by Administrator

Merge branch 'tzq' into 'develop'

员工导出、导入,审批请假、补卡、加班、出差、外出对接,审批逻辑优化

See merge request 8timerv2/8timerapiv200!105
parents 7f508266 6896cb94
......@@ -57,6 +57,10 @@ public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> {
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "操作时间 ", example = "操作时间")
private Date updateTime;
private List<SpmkExecutor> spmkExecutors;
......
......@@ -64,5 +64,9 @@ public class SpmkExecutor extends Model<SpmkExecutor> {
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date updateTime;
}
\ No newline at end of file
......@@ -18,10 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.druid.sql.visitor.functions.Nil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
......@@ -50,7 +48,6 @@ import cn.timer.api.config.enuminterface.SpmkEnumInterface;
import cn.timer.api.config.enuminterface.SpmkEnumInterface.ApproveSummarySts;
import cn.timer.api.config.enuminterface.SpmkEnumInterface.ExecutorSts;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.config.validation.Insert;
import cn.timer.api.config.validation.Ranks;
import cn.timer.api.config.validation.ValidList;
import cn.timer.api.controller.spmk.service.SpmkServiceImpl;
......@@ -88,10 +85,8 @@ import io.swagger.annotations.ApiOperation;
@Transactional
@RequestMapping(value = "/spmk",
produces = { "application/json","multipart/form-data" })
//@BindingResultCtrol(title = "发起审批")
public class SpmkController {
@Autowired
private SpmkApprovalTemplateGMapper spmkApprovalTemplateGMapper;
@Autowired
......@@ -127,7 +122,7 @@ public class SpmkController {
public Result<Object> saveAtg(@RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
if (spmkApprovalTemplateG.selectCount(new QueryWrapper<SpmkApprovalTemplateG>().lambda()
.ne(SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.ne(spmkApprovalTemplateG.getId() != null,SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) {
return ResultUtil.error("审批模板组名重复!");
}
......@@ -198,7 +193,7 @@ public class SpmkController {
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
if (at.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda()
.ne(SpmkApprovalTemplate::getId, at.getId())
.ne(at.getId() != null, SpmkApprovalTemplate::getId, at.getId())
.eq(SpmkApprovalTemplate::getName, at.getName())) > 0) {
return ResultUtil.error("审批模板名重复!");
}
......@@ -266,7 +261,7 @@ public class SpmkController {
public Result<Object> saveAg(@CurrentUser UserBean userBean, @RequestBody SpmkApprovalG spmkApprovalG){
if (spmkApprovalG.selectCount(new QueryWrapper<SpmkApprovalG>().lambda()
.ne(SpmkApprovalG::getId, spmkApprovalG.getId())
.ne(spmkApprovalG.getId() != null, SpmkApprovalG::getId, spmkApprovalG.getId())
.eq(SpmkApprovalG::getName, spmkApprovalG.getName())
.eq(SpmkApprovalG::getOrgCode, userBean.getOrgCode())) > 0) {
return ResultUtil.error("审批组名重复!");
......@@ -315,7 +310,6 @@ public class SpmkController {
public Result<Object> selectListAg(@CurrentUser UserBean userBean){
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
System.out.println(depts);
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts),"操作成功!");
}
......@@ -349,7 +343,7 @@ public class SpmkController {
BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs");
if (ca.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda()
.ne(SpmkCustomApproval::getId, ca.getId())
.ne(ca.getId() != null, SpmkCustomApproval::getId, ca.getId())
.eq(SpmkCustomApproval::getName, ca.getName())
.eq(SpmkCustomApproval::getOrgCode, userBean.getOrgCode())) > 0) {
return ResultUtil.error("自定义审批名重复!");
......@@ -649,10 +643,12 @@ public class SpmkController {
if (aSummary.getSts() != SpmkEnumInterface.ApproveSummarySts.REFUSE.ordinal()) {
SpmkApproveSummary.builder().id(approvingDto.getAsId()).currentApprover("").endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
JSONObject jSONObject = ObjectUtil.deserialize(ad.getRequestData());
jSONObject.set("approveId", approvingDto.getAsId());
//审批完成后 业务
SpmkAssoBusiness sab = SpmkAssoBusinessFactory.createSpmkAssoType(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null)
sab.handleApprove(ObjectUtil.deserialize(ad.getRequestData()));
sab.handleApprove(jSONObject);
}
}
......
......@@ -53,6 +53,7 @@ import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion;
......@@ -78,6 +79,7 @@ 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.config.exception.Regular;
import cn.timer.api.config.validation.ValidList;
import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgMzDtoMapper;
......@@ -344,10 +346,9 @@ public class YgglController {
* @return
*/
@PostMapping(value = "/addygda")
@ApiOperation(value = "添加员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperation(value = "4.添加员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 4)
public Result<Object> addygda(@CurrentUser UserBean userBean, @Validated @RequestBody AddygdaDto addygdaDto)
throws Exception {
public Result<Object> addygda(@CurrentUser UserBean userBean, @Validated @RequestBody AddygdaDto addygdaDto) throws Exception {
Integer orgCode = userBean.getOrgCode();
String name = addygdaDto.getName();
String phone = addygdaDto.getPhone();
......@@ -377,23 +378,19 @@ public class YgglController {
}
Integer jobType = addygdaDto.getJobType();
Date rzTime = null;
if (addygdaDto.getRzTime() == null)
rzTime = new Date();
else
rzTime = addygdaDto.getRzTime();
Date rzTime = addygdaDto.getRzTime() == null ? new Date() : addygdaDto.getRzTime();
Integer syq = addygdaDto.getSyq();
Integer sex = addygdaDto.getSex();
Integer bmgwId = addygdaDto.getBmgwId();
if (StrUtil.hasBlank(phone) || StrUtil.hasBlank(name) || StrUtil.hasBlank(zjNum)) {
return ResultUtil.error("请输入员工姓名,手机号和身份证号");
}
if (!ObjectUtil.isAllNotEmpty(name, phone, zjType, zjNum, jobType, rzTime, syq, bmgwId, sex)) {
return ResultUtil.error("请完善员工信息!");
}
if (!IdcardUtil.isValidCard(zjNum)) {
return ResultUtil.error("请输入有效的证件信息!");
}
// if (StrUtil.hasBlank(phone) || StrUtil.hasBlank(name) || StrUtil.hasBlank(zjNum)) {
// return ResultUtil.error("请输入员工姓名,手机号和身份证号");
// }
// if (!ObjectUtil.isAllNotEmpty(name, phone, zjType, zjNum, jobType, rzTime, syq, bmgwId, sex)) {
// return ResultUtil.error("请完善员工信息!");
// }
// if (!IdcardUtil.isValidCard(zjNum)) {
// return ResultUtil.error("请输入有效的证件信息!");
// }
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
......@@ -412,7 +409,7 @@ public class YgglController {
.userType(CommonEnum.U_TYPE_EMP.getType()).status(1).build().insert();// usertype2普通员工 status1正常
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum)
.jobType(jobType).jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime).syq(syq)
.sex(sex).empNum(qyzxEmpLogin.getId()).orgCode(orgCode).build();
.sex(sex).empNum(qyzxEmpLogin.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
ygglMainEmp.insert();
if (addygdaDto.getBmgwId() != null) {
......@@ -435,7 +432,7 @@ public class YgglController {
// status1正常
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum)
.jobType(jobType).jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime).syq(syq)
.sex(sex).empNum(login.getId()).orgCode(orgCode).build();
.sex(sex).empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
ygglMainEmp.insert();
if (addygdaDto.getBmgwId() != null) {
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
......@@ -519,29 +516,111 @@ public class YgglController {
* 导入员工档案
*/
@PostMapping(value = "/import_emp_record")
@ApiOperation(value = "导入员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperation(value = "7.导入员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 7)
public Result<List<YgDrjqbDto>> importEmpRecord(
@CurrentUser UserBean userBean/* ,@Validated @RequestBody List<AddygdaDto> listAddygdaDto */) {
List<QyzxEmpLogin> listEl = qyzxEmpLoginMapper
.selectList(new QueryWrapper<QyzxEmpLogin>().lambda().select(QyzxEmpLogin::getPhone));
listEl = listEl != null ? listEl.stream()
public Result<JSONObject> importEmpRecord(
@CurrentUser UserBean userBean ,@Validated @RequestBody ValidList<AddygdaDto> listAddygdaDto ) throws Exception {
Integer orgCode = userBean.getOrgCode();
// 查询所有员工手机号
// List<QyzxEmpLogin> listEl = qyzxEmpLoginMapper
// .selectList(new QueryWrapper<QyzxEmpLogin>().lambda()
// .select(QyzxEmpLogin::getPhone));
List<YgglMainEmp> listMe = ygglMainEmpMapper
.selectList(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode)
.select(YgglMainEmp::getPhone,YgglMainEmp::getZjNum));
listMe = listMe != null ? listMe.stream()
.filter(o -> o != null && o.getPhone() != null).collect(Collectors.toList()) : null;
System.out.println(JSONUtil.parseObj(listEl));
// listEl.stream().filter(predicate)
// listEl.stream().filter(item -> objId.equals(item.getUpId())).forEach(zzglBmgwM -> {
// list.add(zzglBmgwM.getId());
// getDepts(list, zzglBmgwM.getId(), objs);
// });
// 抽取 登录表 的phone的集合
List<String> listPhone = listEl.stream().map(QyzxEmpLogin::getPhone).collect(Collectors.toList());
List<String> listPhone = listMe.stream().map(YgglMainEmp::getPhone).collect(Collectors.toList());
// 抽取 登录表 的zjNum的集合
List<String> listzjNum = listMe.stream().map(YgglMainEmp::getZjNum).collect(Collectors.toList());
System.out.println(listPhone);
System.out.println(listzjNum);
List<YgglMainEmp> listYmp = new ArrayList<YgglMainEmp>();
List<AddygdaDto> list = listAddygdaDto.stream()
.filter(o -> o != null && !listPhone.contains(o.getPhone()) && !listzjNum.contains(o.getZjNum())).collect(Collectors.toList());
List<AddygdaDto> phoneRepetitions = listAddygdaDto.stream()
.filter(o -> o != null && listPhone.contains(o.getPhone())).collect(Collectors.toList());
List<AddygdaDto> IDCardRepetitions = listAddygdaDto.stream()
.filter(o -> o != null && listzjNum.contains(o.getZjNum())).collect(Collectors.toList());
System.out.println("list:"+list);
System.out.println("phoneRepetitions:"+phoneRepetitions);
System.out.println("IDCardRepetitions:"+IDCardRepetitions);
YgglMainEmp yme;
for (AddygdaDto ad : list) {
String name = ad.getName();
String phone = ad.getPhone();
Integer zjType = ad.getZjType();
String zjNum = ad.getZjNum();
boolean isvalid = true;
switch (zjType) {
case 0:
isvalid = ReUtil.isMatch(Regular.IDCARD, zjNum);
break;
case 1:
isvalid = ReUtil.isMatch(Regular.HKMAKAO, zjNum);
break;
case 2:
isvalid = ReUtil.isMatch(Regular.TAIWAN1, zjNum) || ReUtil.isMatch(Regular.TAIWAN2, zjNum);
break;
case 3:
isvalid = ReUtil.isMatch(Regular.PASSPORT1, zjNum) || ReUtil.isMatch(Regular.PASSPORT2, zjNum);
break;
default:
break;
}
if (!isvalid) {
return ResultUtil.error("证件格式不对!");
}
Integer jobType = ad.getJobType();
Date rzTime = ad.getRzTime() == null ? new Date() : ad.getRzTime();
Integer syq = ad.getSyq();
Integer sex = ad.getSex();
Integer bmgwId = ad.getBmgwId();
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
if (login == null) {
// 初始化密码 pwd
login = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd))
.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(name).build();
if (!login.insert()) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultUtil.error("添加员工登录表失败,请检查输入信息");
}
}
System.out.println(JSONUtil.parseObj(listPhone));
listEl.stream().filter(i -> i != null).collect(Collectors.<QyzxEmpLogin>toList());
return null;
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode)
.userType(CommonEnum.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType()).build().insert();// usertype2普通员工 status1正常
yme = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum)
.jobType(jobType).jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime).syq(syq)
.sex(sex).empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
if (yme.insert()) {
listYmp.add(yme);
}
}
JSONObject obj = JSONUtil.createObj();
obj.set("empList", listYmp);
obj.set("phoneRepetitions", phoneRepetitions);
obj.set("IDCardRepetitions", IDCardRepetitions);
//listEl.stream().filter(i -> i != null).collect(Collectors.<QyzxEmpLogin>toList());
return ResultUtil.data(obj, "导入员工档案成功!");
}
/**
......@@ -932,9 +1011,8 @@ public class YgglController {
@ApiOperation(value = "导出", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 8)
public Result<List<YgglMainEmp>> selectygdas(@CurrentUser UserBean userBean) {
int[] jList = { 1, 2, 3 };
List<YgglMainEmp> list = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getJobStatus, jList).list();
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getJobStatus, 1,2,3).list();
return ResultUtil.data(list, "导出员工成功");
}
......
......@@ -55,7 +55,7 @@ public class AddygdaDto extends Page implements Serializable{
@ApiModelProperty(value="工作性质 0全职、1实习生、2兼职、3劳务派遣、4劳务、5派遣、6外包、7退休返聘",example="0")
private Integer jobType;
@NotNull(message = ValidationMsg.NOTNULL)
// @NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="入职日期 ",example="客户注册后的时间为入职时间")
private Date rzTime;
......
......@@ -541,17 +541,18 @@ public class RouterUtils {
for (Relation relation : listRelation) {
List<User> listUser2 = relation.getUsers();
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build();
executor.insert();
if (listUser2 != null) {
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build();
executor.insert();
}
}
}
......
package cn.timer.api.utils.router.business;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttEvectionApprovalDto;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.DateUtil;
import lombok.Builder;
/**
......@@ -14,8 +21,11 @@ import lombok.Builder;
@Builder
public class EvectionBusiness extends SpmkAssoBusiness {
@Autowired
private KqglService kqglService;
@Override
public void handleApprove(JSONObject jsonObj) {
public void handleApprove(JSONObject jsonObj) throws ParseException {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = ObjectUtil.isNull(jsonObj.get("orgCode",FromData.class)) ? null : jsonObj.get("orgCode",FromData.class).getValue();
......@@ -23,6 +33,9 @@ public class EvectionBusiness extends SpmkAssoBusiness {
String id = ObjectUtil.isNull(jsonObj.get("id",FromData.class)) ? null : 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 startTime = ObjectUtil.isNull(jsonObj.get("__startTime",FromData.class)) ? null : jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
......@@ -34,8 +47,17 @@ public class EvectionBusiness extends SpmkAssoBusiness {
// 上传文件
String UploadAttachment = ObjectUtil.isNull(jsonObj.get("UploadAttachment",FromData.class)) ? null : jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
AttEvectionApprovalDto eaD = AttEvectionApprovalDto
.builder()
.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"))
.duration(Convert.toDouble(longTime)*60D)
.build();
// 调 考勤管理 业务-出差
kqglService.attevectionapproval(eaD);
}
}
package cn.timer.api.utils.router.business;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttEvectionApprovalDto;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.DateUtil;
import lombok.Builder;
/**
* 外出
* 外出-业务
* @author Tang
*
*/
@Builder
public class GoOutBusiness extends SpmkAssoBusiness {
@Autowired
private KqglService kqglService;
@Override
public void handleApprove(JSONObject jsonObj) throws Exception {
// TODO Auto-generated method stub
......@@ -19,6 +31,9 @@ public class GoOutBusiness extends SpmkAssoBusiness {
String id = 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();
// 开始时间
String startTime = jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
......@@ -30,8 +45,17 @@ public class GoOutBusiness extends SpmkAssoBusiness {
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
AttEvectionApprovalDto eaD = AttEvectionApprovalDto
.builder()
.evectionid(Convert.toInt(approveId))
.evectiontype(2)
.starttime(DateUtil.getStringTime(startTime, "yyyy-MM-dd HH:mm:ss"))
.endtime(DateUtil.getStringTime(endTime, "yyyy-MM-dd HH:mm:ss"))
.duration(Convert.toDouble(longTime)*60D)
.build();
// 调 考勤管理 业务-外出
kqglService.attevectionapproval(eaD);
}
}
package cn.timer.api.utils.router.business;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttEvectionApprovalDto;
import cn.timer.api.dto.kqmk.AttLeaveApprovalDto;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.DateUtil;
import lombok.Builder;
/**
......@@ -14,8 +23,11 @@ import lombok.Builder;
@Builder
public class LeaveBusiness extends SpmkAssoBusiness {
@Autowired
private KqglService kqglService;
@Override
public void handleApprove(JSONObject jsonObj) {
public void handleApprove(JSONObject jsonObj) throws ParseException {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = ObjectUtil.isNull(jsonObj.get("orgCode",FromData.class)) ? null : jsonObj.get("orgCode",FromData.class).getValue();
......@@ -24,6 +36,9 @@ public class LeaveBusiness extends SpmkAssoBusiness {
// 发起人名称
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 LeaveType = ObjectUtil.isNull(jsonObj.get("__LeaveType",FromData.class)) ? null : jsonObj.get("__LeaveType",FromData.class).getValue();
// 开始时间
......@@ -37,7 +52,17 @@ public class LeaveBusiness extends SpmkAssoBusiness {
// 上传文件
String UploadAttachment = ObjectUtil.isNull(jsonObj.get("UploadAttachment",FromData.class)) ? null : jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
AttLeaveApprovalDto laD = AttLeaveApprovalDto
.builder()
.leaveid(Convert.toInt(approveId))
.leavetype(Convert.toInt(LeaveType))
.starttime(DateUtil.getStringTime(startTime, "yyyy-MM-dd HH:mm:ss"))
.endtime(DateUtil.getStringTime(endTime, "yyyy-MM-dd HH:mm:ss"))
.duration(Convert.toDouble(longTime)*60D)
.build();
// 调 考勤管理 业务-请假
kqglService.attleaveapproval(laD);
}
}
package cn.timer.api.utils.router.business;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttRepairApprovalDto;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.DateUtil;
import lombok.Builder;
/**
......@@ -13,8 +21,11 @@ import lombok.Builder;
@Builder
public class ReissueACardBusiness extends SpmkAssoBusiness {
@Autowired
private KqglService kqglService;
@Override
public void handleApprove(JSONObject jsonObj) {
public void handleApprove(JSONObject jsonObj) throws ParseException {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = ObjectUtil.isNull(jsonObj.get("orgCode",FromData.class)) ? null : jsonObj.get("orgCode",FromData.class).getValue();
......@@ -23,14 +34,28 @@ public class ReissueACardBusiness extends SpmkAssoBusiness {
// 发起人名称
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();
// 缺卡时段-上班、下班-前端未改
// String cardreplperiod = ObjectUtil.isNull(jsonObj.get("cardreplperiod",FromData.class)) ? null : jsonObj.get("cardreplperiod",FromData.class).getValue();
// 上传文件
String UploadAttachment = ObjectUtil.isNull(jsonObj.get("UploadAttachment",FromData.class)) ? null : jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
AttRepairApprovalDto raD = AttRepairApprovalDto
.builder()
.repairid(Convert.toInt(approveId))
.cardrepltime(DateUtil.getStringTime(PatchCardTime, "yyyy-MM-dd HH:mm:ss"))
// .cardreplperiod(Convert.toInt(cardreplperiod))
.build();
// 调 考勤管理 业务-补卡
kqglService.attrepairapproval(raD);
}
}
......@@ -35,6 +35,9 @@ public class SpmkAssoBusinessFactory {
case EVECTION:
sat = EvectionBusiness.builder().build();
break;
case GO_OUT:
sat = GoOutBusiness.builder().build();
break;
case REISSUE_A_CARD:
sat = ReissueACardBusiness.builder().build();
break;
......
package cn.timer.api.utils.router.business;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttOvertimeApprovalDto;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.DateUtil;
import lombok.Builder;
/**
......@@ -13,8 +21,11 @@ import lombok.Builder;
@Builder
public class WorkOvertimeBusiness extends SpmkAssoBusiness {
@Autowired
private KqglService kqglService;
@Override
public void handleApprove(JSONObject jsonObj) {
public void handleApprove(JSONObject jsonObj) throws ParseException {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = ObjectUtil.isNull(jsonObj.get("orgCode",FromData.class)) ? null : jsonObj.get("orgCode",FromData.class).getValue();
......@@ -23,6 +34,9 @@ public class WorkOvertimeBusiness extends SpmkAssoBusiness {
// 发起人名称
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 startTime = ObjectUtil.isNull(jsonObj.get("__startTime",FromData.class)) ? null : jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
......@@ -33,10 +47,24 @@ public class WorkOvertimeBusiness extends SpmkAssoBusiness {
String compensate = ObjectUtil.isNull(jsonObj.get("__compensate",FromData.class)) ? null : jsonObj.get("__compensate",FromData.class).getValue();
// 加班原因
String OvertimeReason = ObjectUtil.isNull(jsonObj.get("__OvertimeReason",FromData.class)) ? null : jsonObj.get("__OvertimeReason",FromData.class).getValue();
// 加班类型-前端未给
String overtimetype = ObjectUtil.isNull(jsonObj.get("__overtimetype",FromData.class)) ? null : jsonObj.get("__overtimetype",FromData.class).getValue();
// 上传文件
String UploadAttachment = ObjectUtil.isNull(jsonObj.get("UploadAttachment",FromData.class)) ? null : jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
AttOvertimeApprovalDto oaD = AttOvertimeApprovalDto
.builder()
.overtimeid(Convert.toInt(approveId))
.overtimetype(Convert.toInt(overtimetype))
.starttime(DateUtil.getStringTime(startTime, "yyyy-MM-dd HH:mm:ss"))
.endtime(DateUtil.getStringTime(endTime, "yyyy-MM-dd HH:mm:ss"))
.duration(Convert.toDouble(timeLong)*60D)
.compensate(Convert.toInt(compensate))
.build();
// 调 考勤管理 业务-加班
kqglService.attovertimeapproval(oaD);
}
}
......@@ -2,9 +2,9 @@ package cn.timer.api.utils.router.enums;
public enum ApproveEnum {
DEFAULT(0, "默认", 1), REGULARIZATION(1, "转正", 1), RESIGNATION(2, "离职", 1), TRANSFER_POSITION(3, "调岗", 1),
RECRUIT(4, "招聘", 1), WORK_OVERTIME(5, "加班", 2), LEAVE(6, "请假", 2), EVECTION(7, "出差", 2), REISSUE_A_CARD(8, "补卡", 2),
WAGE_ADJUSTMENT(9, "调薪", 3),;
DEFAULT(0, "默认", 1), REGULARIZATION(1, "转正", 1), RESIGNATION(2, "离职", 1), TRANSFER_POSITION(3, "调岗", 1),RECRUIT(4, "招聘", 1),
WORK_OVERTIME(5, "加班", 2), LEAVE(6, "请假", 2), EVECTION(7, "出差", 2), GO_OUT(8, "外出", 2),REISSUE_A_CARD(9, "补卡", 2),
WAGE_ADJUSTMENT(10, "调薪", 3);
private Integer type;
......
......@@ -10,6 +10,7 @@
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="BaseResultMapDto" type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord" >
......@@ -19,6 +20,7 @@
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<collection column="SpmkExecutor_id" property="spmkExecutors" ofType="cn.timer.api.bean.spmk.SpmkExecutor"
resultMap="cn.timer.api.dao.spmk.SpmkExecutorMapper.BaseResultMap" columnPrefix="SpmkExecutor_">
</collection>
......@@ -30,7 +32,8 @@
name,
type,
sts,
create_time
create_time,
update_time
</sql>
<sql id="Base_Column_List_a">
......@@ -39,7 +42,8 @@
a.name,
a.type,
a.sts,
a.create_time
a.create_time,
a.update_time
</sql>
<sql id="Base_Column_List_Alias_b">
......@@ -50,7 +54,8 @@
b.operator_header_url SpmkExecutor_operator_header_url,
b.opinion SpmkExecutor_opinion,
b.sts SpmkExecutor_sts,
b.create_time SpmkExecutor_create_time
b.create_time SpmkExecutor_create_time,
b.update_time SpmkExecutor_update_time
</sql>
<sql id="Base_Column_List_Alias">
......@@ -59,7 +64,8 @@
name SpmkApproveExecuteRecord_name,
type SpmkApproveExecuteRecord_type,
sts SpmkApproveExecuteRecord_sts,
create_time SpmkApproveExecuteRecord_create_time
create_time SpmkApproveExecuteRecord_create_time,
update_time SpmkApproveExecuteRecord_update_time
</sql>
......@@ -93,7 +99,10 @@
sts,
</if>
<if test ='null != createTime'>
create_time
create_time,
</if>
<if test ='null != updateTime'>
update_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -111,6 +120,9 @@
</if>
<if test ='null != createTime'>
#{createTime}
</if>,
<if test ='null != updateTime'>
#{updateTime}
</if>
</trim>
</insert>
......@@ -127,7 +139,8 @@
<if test ='null != name'>name = #{name},</if>
<if test ='null != type'>type = #{type},</if>
<if test ='null != sts'>sts = #{sts},</if>
<if test ='null != createTime'>create_time = #{createTime}</if>
<if test ='null != createTime'>create_time = #{createTime},</if>
<if test ='null != updateTime'>update_time = #{updateTime}</if>
</set>
WHERE id = #{id}
</update>
......
......@@ -12,6 +12,7 @@
<result column="opinion" property="opinion" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
......@@ -22,7 +23,8 @@
operator_header_url,
opinion,
sts,
create_time
create_time,
update_time
</sql>
<sql id="Base_Column_List_Alias">
......@@ -33,7 +35,8 @@
operator_header_url SpmkExecutor_operator_header_url,
opinion SpmkExecutor_opinion,
sts SpmkExecutor_sts,
create_time SpmkExecutor_create_time
create_time SpmkExecutor_create_time,
update_time SpmkExecutor_update_time
</sql>
<!--
......@@ -60,7 +63,10 @@
sts,
</if>
<if test ='null != createTime'>
create_time
create_time,
</if>
<if test ='null != updateTime'>
update_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -83,7 +89,10 @@
#{sts},
</if>
<if test ='null != createTime'>
#{createTime}
#{createTime},
</if>
<if test ='null != updateTime'>
#{updateTime}
</if>
</trim>
</insert>
......@@ -102,7 +111,8 @@
<if test ='null != operatorHeaderUrl'>operator_header_url = #{operatorHeaderUrl},</if>
<if test ='null != opinion'>opinion = #{opinion},</if>
<if test ='null != sts'>sts = #{sts},</if>
<if test ='null != createTime'>create_time = #{createTime}</if>
<if test ='null != createTime'>create_time = #{createTime},</if>
<if test ='null != updateTime'>update_time = #{updateTime}</if>
</set>
WHERE id = #{id}
</update>
......
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