Commit e7ff8e04 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents df85fb78 dc8707c7
......@@ -24,8 +24,13 @@ export default {
delete this.query.year;
}
if (this.query.createTimeMonth == undefined) {
delete this.query.createTimeStart;
delete this.query.createTimeEnd;
if (this.query.createTimeStart1 || this.query.createTimeEnd1) {
this.query.createTimeEnd = this.query.createTimeEnd1;
this.query.createTimeStart = this.query.createTimeStart1;
} else {
delete this.query.createTimeStart;
delete this.query.createTimeEnd;
}
}
this.getData();
},
......@@ -80,7 +85,7 @@ export default {
return;
}
this.tableData.loading = true;
console.log(this.query);
this.$post(this.pageInfo.list, this.query, {
cancelToken: this.source.token,
})
......
......@@ -111,7 +111,7 @@
v-if="item.type === 'date' && !item.valueFormat"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
:placeholder="item.label ? item.label : '选择日期'"
>
</el-date-picker>
......@@ -120,7 +120,7 @@
v-if="item.type === 'date' && item.valueFormat"
type="date"
:value-format="item.valueFormat"
placeholder="选择日期"
:placeholder="item.label ? item.label : '选择日期'"
>
</el-date-picker>
......@@ -352,6 +352,9 @@ export default {
if (this.form.createTimeMonth) {
this.form.createTimeStart = this.form.createTimeMonth + "-01";
this.form.createTimeEnd = this.form.createTimeMonth + "-31";
} else if (this.form.createTimeStart1 || this.form.createTimeEnd1) {
this.form.createTimeStart = this.form.createTimeStart1;
this.form.createTimeEnd = this.form.createTimeEnd1;
} else {
this.form.createTimeStart = undefined;
this.form.createTimeEnd = undefined;
......@@ -397,18 +400,24 @@ export default {
let data = this.decode(params);
// Object.assign({}, query, data)
console.log({
...query,
...data,
});
if (!query.yearmonth) {
query.year = undefined;
query.month = undefined;
}
if (!query.createTimeMonth) {
query.createTimeEnd = undefined;
query.createTimeStart = undefined;
if (query.createTimeStart1 || query.createTimeEnd1) {
query.createTimeEnd = query.createTimeEnd1;
query.createTimeStart = query.createTimeStart1;
} else {
query.createTimeEnd = undefined;
query.createTimeStart = undefined;
}
}
console.log({
...query,
...data,
});
this.$router.push({
path: path,
query: {
......
......@@ -94,13 +94,13 @@ export default {
label: "请假类型",
},
{
name: "createTimeStart",
name: "createTimeStart1",
type: "date",
label: "开始时间",
fuzzy: false,
},
{
name: "createTimeEnd",
name: "createTimeEnd1",
type: "date",
label: "结束时间",
fuzzy: false,
......
......@@ -121,6 +121,12 @@
</div>
</div>
</el-drawer>
<div class="mask" v-if="progress">
<el-progress
:stroke-width="26"
:percentage="percent"
></el-progress>
</div>
</div>
</template>
......@@ -220,25 +226,26 @@ export default {
},
/** 导出Excel */
doExport() {
if(this.isExport==true) {
this.$message.info("考勤数据正在导出中,请勿重复点击!")
if (this.isExport == true) {
this.$message.info("考勤数据正在导出中,请勿重复点击!");
return false;
}
this.isExport = true;
this.progress = true;
let params = {};
for (let value of this.config.search) {
if (this.query[value.name]) {
params[value.name] = this.query[value.name];
}
}
this.percent = 75;
if (this.selection.length > 0) {
params["idList"] = this.selection;
}
let that=this;
let that = this;
this.$download(
"/attendance/record/hik/exportExcel",
{
......@@ -247,10 +254,13 @@ export default {
{ type: "excel" }
)
.then(() => {
console.log("isExport222:",this.isExport)
that.isExport = false})
this.percent = 100;
this.progress = false;
that.isExport = false;
})
.catch((error) => {
this.isExport = false;
this.progress = false;
this.$message.error(error.message);
});
},
......@@ -273,7 +283,9 @@ export default {
data() {
return {
showBtn: false,
isExport:false,
progress: false,
isExport: false,
percent: 0,
upload: {
headers: {
Authorization: window.sessionStorage.getItem("token") || "",
......@@ -373,6 +385,21 @@ export default {
};
</script>
<style scoped lang="scss">
.mask {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 99;
padding: 0 30%;
padding-top: 20%;
background: rgba(0, 0, 0, 0.6);
}
::v-deep .el-progress__text {
color: #409eff;
font-weight: 600;
}
.hisList {
padding: 15px;
.list {
......
......@@ -179,6 +179,12 @@
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<div class="mask" v-if="progress">
<el-progress
:stroke-width="26"
:percentage="percent"
></el-progress>
</div>
</div>
</template>
......@@ -333,6 +339,7 @@ export default {
/** 导出Excel */
doExport() {
this.isExport = true;
this.progress = true;
let params = {};
for (let value of this.config.search) {
if (this.query[value.name]) {
......@@ -342,6 +349,7 @@ export default {
if (this.selection.length > 0) {
params["idList"] = this.selection;
}
this.percent = 70;
if (this.checkList.length > 0) {
params["properties"] = this.checkList;
}
......@@ -353,10 +361,14 @@ export default {
{ type: "excel" }
)
.then(() => {
this.percent = 100;
this.progress = false;
this.isExport = false;
this.checkList = [];
})
.catch((error) => {
this.progress = false;
this.isExport = false;
this.$message.error(error.message);
});
......@@ -407,6 +419,8 @@ export default {
},
data() {
return {
progress: false,
percent: 0,
upload: {
// 是否显示弹出层(员工关怀信息导入)
open: false,
......@@ -578,6 +592,21 @@ export default {
};
</script>
<style scoped lang="less">
.mask {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 99;
padding: 0 30%;
padding-top: 20%;
background: rgba(0, 0, 0, 0.6);
}
::v-deep .el-progress__text {
color: #409eff;
font-weight: 600;
}
.totalNum {
background: rgba(64, 158, 255, 0.2);
padding: 15px;
......
......@@ -13,6 +13,9 @@
</LayoutTable>
<dialog-show ref="dialogform" @ok="getData" />
<div class="mask" v-if="progress">
<el-progress :stroke-width="26" :percentage="percent"></el-progress>
</div>
</div>
</template>
......@@ -27,10 +30,12 @@ export default {
},
mixins: [table],
created() {},
methods: {
/** 导出Excel */
doExport() {
this.progress = true;
this.percent = 75;
this.isExport = true;
this.$download(
"/staff/perform/summary/exportExcel",
......@@ -40,9 +45,14 @@ export default {
},
{ type: "excel" }
)
.then(() => (this.isExport = false))
.then(() => {
this.percent = 100;
this.progress = false;
this.isExport = false;
})
.catch((error) => {
this.isExport = false;
this.progress = false;
this.$message.error(error.message);
});
},
......@@ -62,6 +72,8 @@ export default {
data() {
return {
isExport: false,
progress: false,
percent: 0,
config: {
isshowTabPane: true,
search: [
......@@ -167,3 +179,20 @@ export default {
},
};
</script>
<style lang="less" scoped>
.mask {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 99;
padding: 0 30%;
padding-top: 20%;
background: rgba(0, 0, 0, 0.6);
}
::v-deep .el-progress__text {
color: #409eff;
font-weight: 600;
}
</style>
......@@ -43,7 +43,7 @@
<profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret>
<profiles.dingtalk.aesKey>1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd</profiles.dingtalk.token>
<profiles.dingtalk.opUserId>manager8325</profiles.dingtalk.opUserId>
<profiles.dingtalk.opUserId>254868153920685466</profiles.dingtalk.opUserId>
<profiles.webUrl>http://8.136.255.30:11039/attendance</profiles.webUrl>
<package.environment>serve</package.environment>
<skipUi>false</skipUi>
......@@ -78,7 +78,7 @@
<profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret>
<profiles.dingtalk.aesKey>1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd</profiles.dingtalk.token>
<profiles.dingtalk.opUserId>manager8325</profiles.dingtalk.opUserId>
<profiles.dingtalk.opUserId>254868153920685466</profiles.dingtalk.opUserId>
<profiles.webUrl>http://8.136.255.30:11039/attendance</profiles.webUrl>
<package.environment>test</package.environment>
<skipUi>false</skipUi>
......@@ -111,7 +111,7 @@
<profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret>
<profiles.dingtalk.aesKey>1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd</profiles.dingtalk.token>
<profiles.dingtalk.opUserId>manager8325</profiles.dingtalk.opUserId>
<profiles.dingtalk.opUserId>254868153920685466</profiles.dingtalk.opUserId>
<profiles.webUrl>http://8.136.255.30:21039/attendance</profiles.webUrl>
<package.environment>build</package.environment>
<skipUi>false</skipUi>
......@@ -143,7 +143,7 @@
<profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret>
<profiles.dingtalk.aesKey>1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd</profiles.dingtalk.token>
<profiles.dingtalk.opUserId>manager8325</profiles.dingtalk.opUserId>
<profiles.dingtalk.opUserId>254868153920685466</profiles.dingtalk.opUserId>
<profiles.webUrl>https://ybswxxcx.zwfwhfgjjfzj.yibin.gov.cn/performance-h5</profiles.webUrl>
<package.environment>build</package.environment>
<skipUi>false</skipUi>
......
......@@ -123,22 +123,24 @@ public class DingMessageController {
if(rest.getCode() == Rest.SUCCESS){
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResult result = rest.getData();
log.info("审批详情:"+JSONObject.toJSONString(result) );
AttendanceLeaveRecordEntity leaveRecordEntity = new AttendanceLeaveRecordEntity();
leaveRecordEntity.initAttrValue();
leaveRecordEntity.setRemark(processInstanceId); //将钉钉的事物id作为备注填入数据库
if(result.getTitle().contains("请假")){ //只处理请假的审批单
AttendanceLeaveRecordEntity leaveRecordEntity = new AttendanceLeaveRecordEntity();
Rest<String> mobileRest = dingPersonService.getPersonById(result.getOriginatorUserId());
if(mobileRest.getCode() == Rest.SUCCESS) {
String mobile = mobileRest.getData();
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(mobile));
if(!ObjectUtils.isEmpty(staffEntity)){
leaveRecordEntity.initAttrValue();
leaveRecordEntity.setRemark(processInstanceId); //将钉钉的事物id作为备注填入数据库
leaveRecordEntity.setLeavePersonId(staffEntity.getId());
leaveRecordEntity.setLeavePerson(staffEntity.getName());
leaveRecordEntity.setDeptId(staffEntity.getDeptId());
leaveRecordEntity.setDeptName(staffEntity.getDeptName());
leaveRecordEntity.setPhoneNumber(staffEntity.getPhoneNumber());
Rest<String> mobileRest = dingPersonService.getPersonById(result.getOriginatorUserId());
if(mobileRest.getCode() == Rest.SUCCESS) {
String mobile = mobileRest.getData();
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(mobile));
if(!ObjectUtils.isEmpty(staffEntity)){
leaveRecordEntity.setLeavePersonId(staffEntity.getId());
leaveRecordEntity.setLeavePerson(staffEntity.getName());
leaveRecordEntity.setDeptId(staffEntity.getDeptId());
leaveRecordEntity.setDeptName(staffEntity.getDeptName());
leaveRecordEntity.setPhoneNumber(staffEntity.getPhoneNumber());
......@@ -153,137 +155,137 @@ public class DingMessageController {
// }
// }
String leave_code = LeaveRulesEnum.事假.getLeave_code();
String leave_name = "事假";
if(result.getFormComponentValues().size() > 0 ){
JSONArray jsonArray = JSONArray.parseArray(result.getFormComponentValues().get(0).getValue());
if(jsonArray!= null && jsonArray.size() > 0){
Date startTime1 = dateFormat(jsonArray.get(0).toString(),"yyyy-MM-dd HH:mm",true);
leaveRecordEntity.setStartTime(startTime1);
}
if(jsonArray!= null && jsonArray.size() > 1){
Date endTime1 = dateFormat(jsonArray.get(1).toString(),"yyyy-MM-dd HH:mm",false);
leaveRecordEntity.setEndTime(endTime1);
}
if(jsonArray!= null && jsonArray.size() > 2){
if(jsonArray.size() > 3){
switch (jsonArray.get(3).toString()){
case "halfDay":
case "day":
leaveRecordEntity.setDuration((int) (Float.parseFloat(jsonArray.get(2).toString())*60*60*8)); //天转换成秒 一天工作时间9小时
leaveRecordEntity.setSourceDingTime(jsonArray.get(2).toString()+"天");
break;
default: //除了按天和半天计算的假期 其余都是按小时返回
leaveRecordEntity.setDuration((int) (Float.parseFloat(jsonArray.get(2).toString())*60*60)); //小时转换成秒
leaveRecordEntity.setSourceDingTime(jsonArray.get(2).toString()+"小时");
break;
String leave_code = LeaveRulesEnum.事假.getLeave_code();
String leave_name = "事假";
if(result.getFormComponentValues().size() > 0 ){
JSONArray jsonArray = JSONArray.parseArray(result.getFormComponentValues().get(0).getValue());
if(jsonArray!= null && jsonArray.size() > 0){
Date startTime1 = dateFormat(jsonArray.get(0).toString(),"yyyy-MM-dd HH:mm",true);
leaveRecordEntity.setStartTime(startTime1);
}
if(jsonArray!= null && jsonArray.size() > 1){
Date endTime1 = dateFormat(jsonArray.get(1).toString(),"yyyy-MM-dd HH:mm",false);
leaveRecordEntity.setEndTime(endTime1);
}
if(jsonArray!= null && jsonArray.size() > 2){
if(jsonArray.size() > 3){
switch (jsonArray.get(3).toString()){
case "halfDay":
case "day":
leaveRecordEntity.setDuration((int) (Float.parseFloat(jsonArray.get(2).toString())*60*60*8)); //天转换成秒 一天工作时间9小时
leaveRecordEntity.setSourceDingTime(jsonArray.get(2).toString()+"天");
break;
default: //除了按天和半天计算的假期 其余都是按小时返回
leaveRecordEntity.setDuration((int) (Float.parseFloat(jsonArray.get(2).toString())*60*60)); //小时转换成秒
leaveRecordEntity.setSourceDingTime(jsonArray.get(2).toString()+"小时");
break;
}
}
}
if(jsonArray!= null && jsonArray.size() > 4){
leave_name = jsonArray.get(4).toString();
switch (leave_name){
case "调休":
leaveRecordEntity.setLeaveType(2);
leave_code = LeaveRulesEnum.调休.getLeave_code();
break;
case "病假":
leaveRecordEntity.setLeaveType(3);
leave_code = LeaveRulesEnum.病假.getLeave_code();
break;
case "年假":
leaveRecordEntity.setLeaveType(4);
leave_code = LeaveRulesEnum.年假.getLeave_code();
break;
case "产假":
leaveRecordEntity.setLeaveType(5);
leave_code = LeaveRulesEnum.产假.getLeave_code();
break;
case "陪产假":
leaveRecordEntity.setLeaveType(6);
leave_code = LeaveRulesEnum.陪产假.getLeave_code();
break;
case "婚假":
leaveRecordEntity.setLeaveType(7);
leave_code = LeaveRulesEnum.婚假.getLeave_code();
break;
case "例假":
leaveRecordEntity.setLeaveType(8);
leave_code = LeaveRulesEnum.例假.getLeave_code();
break;
case "哺乳假":
leaveRecordEntity.setLeaveType(9);
leave_code = LeaveRulesEnum.哺乳假.getLeave_code();
break;
case "丧假":
leaveRecordEntity.setLeaveType(10);
leave_code = LeaveRulesEnum.丧假.getLeave_code();
break;
case "回单位":
leaveRecordEntity.setLeaveType(11);
break;
case "因公请假":
leaveRecordEntity.setLeaveType(12);
break;
case "外出勘验":
leaveRecordEntity.setLeaveType(13);
break;
case "值班补班":
leaveRecordEntity.setLeaveType(14);
break;
case "体检":
leaveRecordEntity.setLeaveType(15);
break;
case "隔离":
leaveRecordEntity.setLeaveType(16);
break;
case "因公外出":
leaveRecordEntity.setLeaveType(17);
break;
case "公休":
leaveRecordEntity.setLeaveType(18);
break;
case "育儿假":
leaveRecordEntity.setLeaveType(19);
break;
case "调回单位":
leaveRecordEntity.setLeaveType(20);
break;
case "探亲假":
leaveRecordEntity.setLeaveType(21);
leave_code = LeaveRulesEnum.探亲假.getLeave_code();
break;
default:
leaveRecordEntity.setLeaveType(1); //默认事假
leave_code = LeaveRulesEnum.事假.getLeave_code();
break;
}
if(jsonArray!= null && jsonArray.size() > 4){
leave_name = jsonArray.get(4).toString();
switch (leave_name){
case "调休":
leaveRecordEntity.setLeaveType(2);
leave_code = LeaveRulesEnum.调休.getLeave_code();
break;
case "病假":
leaveRecordEntity.setLeaveType(3);
leave_code = LeaveRulesEnum.病假.getLeave_code();
break;
case "年假":
leaveRecordEntity.setLeaveType(4);
leave_code = LeaveRulesEnum.年假.getLeave_code();
break;
case "产假":
leaveRecordEntity.setLeaveType(5);
leave_code = LeaveRulesEnum.产假.getLeave_code();
break;
case "陪产假":
leaveRecordEntity.setLeaveType(6);
leave_code = LeaveRulesEnum.陪产假.getLeave_code();
break;
case "婚假":
leaveRecordEntity.setLeaveType(7);
leave_code = LeaveRulesEnum.婚假.getLeave_code();
break;
case "例假":
leaveRecordEntity.setLeaveType(8);
leave_code = LeaveRulesEnum.例假.getLeave_code();
break;
case "哺乳假":
leaveRecordEntity.setLeaveType(9);
leave_code = LeaveRulesEnum.哺乳假.getLeave_code();
break;
case "丧假":
leaveRecordEntity.setLeaveType(10);
leave_code = LeaveRulesEnum.丧假.getLeave_code();
break;
case "回单位":
leaveRecordEntity.setLeaveType(11);
break;
case "因公请假":
leaveRecordEntity.setLeaveType(12);
break;
case "外出勘验":
leaveRecordEntity.setLeaveType(13);
break;
case "值班补班":
leaveRecordEntity.setLeaveType(14);
break;
case "体检":
leaveRecordEntity.setLeaveType(15);
break;
case "隔离":
leaveRecordEntity.setLeaveType(16);
break;
case "因公外出":
leaveRecordEntity.setLeaveType(17);
break;
case "公休":
leaveRecordEntity.setLeaveType(18);
break;
case "育儿假":
leaveRecordEntity.setLeaveType(19);
break;
case "调回单位":
leaveRecordEntity.setLeaveType(20);
break;
case "探亲假":
leaveRecordEntity.setLeaveType(21);
leave_code = LeaveRulesEnum.探亲假.getLeave_code();
break;
default:
leaveRecordEntity.setLeaveType(1); //默认事假
leave_code = LeaveRulesEnum.事假.getLeave_code();
break;
}
}
} else if (result.getFormComponentValues().size() > 1) { //请假理由
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultFormComponentValues resonEntity = result.getFormComponentValues().get(1);
leaveRecordEntity.setReason(resonEntity.getValue());
}else if (result.getFormComponentValues().size() > 2) { //上传的附件
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultFormComponentValues picEntity = result.getFormComponentValues().get(2);
if(picEntity.getName().equals("图片") && picEntity.getValue() != null){
leaveRecordEntity.setAttachmentPath(picEntity.getValue());
}
}
} else if (result.getFormComponentValues().size() > 1) { //请假理由
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultFormComponentValues resonEntity = result.getFormComponentValues().get(1);
leaveRecordEntity.setReason(resonEntity.getValue());
}else if (result.getFormComponentValues().size() > 2) { //上传的附件
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultFormComponentValues picEntity = result.getFormComponentValues().get(2);
if(picEntity.getName().equals("图片") && picEntity.getValue() != null){
leaveRecordEntity.setAttachmentPath(picEntity.getValue());
}
}
if(result.getStatus().compareToIgnoreCase("NEW") == 0 || result.getStatus().compareToIgnoreCase("RUNNING") == 0){
leaveRecordEntity.setProcessStatus(1);
}else if(result.getStatus().compareToIgnoreCase("COMPLETED") == 0 || result.getStatus().compareToIgnoreCase("CANCELED") == 0
|| result.getStatus().compareToIgnoreCase("TERMINATED") == 0){
leaveRecordEntity.setProcessStatus(2);
}
if(result.getStatus().compareToIgnoreCase("NEW") == 0 || result.getStatus().compareToIgnoreCase("RUNNING") == 0){
leaveRecordEntity.setProcessStatus(1);
}else if(result.getStatus().compareToIgnoreCase("COMPLETED") == 0 || result.getStatus().compareToIgnoreCase("CANCELED") == 0
|| result.getStatus().compareToIgnoreCase("TERMINATED") == 0){
leaveRecordEntity.setProcessStatus(2);
}
if(result.getResult().compareToIgnoreCase("AGREE") == 0){
if(result.getResult().compareToIgnoreCase("AGREE") == 0){
// if(result.getTasks().size() > 1){
// if(result.getTasks().get(1).getStatus().compareToIgnoreCase("CANCELED") == 0){
// leaveRecordEntity.setAuditResult(4); //撤销审批完成
......@@ -291,60 +293,60 @@ public class DingMessageController {
// leaveRecordEntity.setAuditResult(1);
// }
// }
leaveRecordEntity.setAuditResult(AppealResultEnum.通过.getValue());
}
else if(result.equals("")){ //撤销假期审批中result会为空 撤销审批通过后result为AGREE
if(result.getTasks().size() > 1){
log.info("status"+result.getTasks().get(1).getStatus());
if(result.getTasks().get(1).getStatus().compareToIgnoreCase("CANCELED") != 0){
leaveRecordEntity.setAuditResult(AppealResultEnum.撤销审批中.getValue()); //撤销审批中
leaveRecordEntity.setAuditResult(AppealResultEnum.通过.getValue());
}
else if(result.equals("")){ //撤销假期审批中result会为空 撤销审批通过后result为AGREE
if(result.getTasks().size() > 1){
log.info("status"+result.getTasks().get(1).getStatus());
if(result.getTasks().get(1).getStatus().compareToIgnoreCase("CANCELED") != 0){
leaveRecordEntity.setAuditResult(AppealResultEnum.撤销审批中.getValue()); //撤销审批中
}
}
}
}
else {
leaveRecordEntity.setAuditResult(AppealResultEnum.审核中.getValue()); //请假审批中
}
else {
leaveRecordEntity.setAuditResult(AppealResultEnum.审核中.getValue()); //请假审批中
}
log.info("钉钉返回的result:"+result.getResult()+"---auditresult:"+leaveRecordEntity.getAuditResult());
leaveRecordEntity.setAuditDesc(result.getOperationRecords().get(0).getRemark());
leaveRecordEntity.setReason(result.getOperationRecords().get(0).getRemark());
//更新请假记录表
AttendanceLeaveRecordEntity recordEntity = attendanceLeaveRecordService.selectOne(new AttendanceLeaveRecordQuery().remark(processInstanceId));
if(ObjectUtils.isEmpty(recordEntity)){
log.info("钉钉返回的result:"+result.getResult()+"---auditresult:"+leaveRecordEntity.getAuditResult());
leaveRecordEntity.setAuditDesc(result.getOperationRecords().get(0).getRemark());
leaveRecordEntity.setReason(result.getOperationRecords().get(0).getRemark());
//更新请假记录表
AttendanceLeaveRecordEntity recordEntity = attendanceLeaveRecordService.selectOne(new AttendanceLeaveRecordQuery().remark(processInstanceId));
if(ObjectUtils.isEmpty(recordEntity)){
leaveRecordEntity.setCreateTime(new Date());
leaveRecordEntity.setCreateUserId(1L);
attendanceLeaveRecordService.save(leaveRecordEntity);
}else{
leaveRecordEntity.setId(recordEntity.getId());
leaveRecordEntity.setCreateTime(new Date());
leaveRecordEntity.setCreateUserId(1L);
attendanceLeaveRecordService.save(leaveRecordEntity);
}else{
leaveRecordEntity.setId(recordEntity.getId());
leaveRecordEntity.setUpdateUserId(1L);
leaveRecordEntity.setUpdateTime(new Date());
leaveRecordEntity.setUpdateUserId(1L);
leaveRecordEntity.setUpdateTime(new Date());
attendanceLeaveRecordService.update(leaveRecordEntity);
}
attendanceLeaveRecordService.update(leaveRecordEntity);
}
//假期余额
AttendanceVacationBalanceEntity attendanceVacationBalanceEntity = new AttendanceVacationBalanceEntity();
//查询假期余额
Rest<OapiAttendanceVacationQuotaListResponse.OapiLeaveQuotaUserListVo> leaveRecordsResponseBodyResultRest =
dingPersonService.getLeaveRecordByUserId(result.getOriginatorUserId(),leave_code);
AttendanceVacationBalanceEntity balanceEntity = balanceService.selectOne(new AttendanceVacationBalanceQuery().staffId(staffEntity.getId()));
if(ObjectUtils.isEmpty(balanceEntity)){ //先判断数据库里没有这个人的请假记录就初始化对象
attendanceVacationBalanceEntity.initAttrValue();
}
attendanceVacationBalanceEntity.setRemark(processInstanceId); // 将钉钉的事物id存入假期余额 用于判断是否为同一条请假数据
attendanceVacationBalanceEntity.setStaffId(staffEntity.getId());
attendanceVacationBalanceEntity.setStaffName(staffEntity.getName());
attendanceVacationBalanceEntity.setDeptId(staffEntity.getDeptId());
attendanceVacationBalanceEntity.setDeptName(staffEntity.getDeptName());
attendanceVacationBalanceEntity.setEntryTime(staffEntity.getEntryDate());
if(leaveRecordsResponseBodyResultRest.getCode() == Rest.SUCCESS){
OapiAttendanceVacationQuotaListResponse.OapiLeaveQuotaUserListVo result1 = leaveRecordsResponseBodyResultRest.getData();
double leaveBlance = 0;
//假期余额
AttendanceVacationBalanceEntity attendanceVacationBalanceEntity = new AttendanceVacationBalanceEntity();
//查询假期余额
Rest<OapiAttendanceVacationQuotaListResponse.OapiLeaveQuotaUserListVo> leaveRecordsResponseBodyResultRest =
dingPersonService.getLeaveRecordByUserId(result.getOriginatorUserId(),leave_code);
AttendanceVacationBalanceEntity balanceEntity = balanceService.selectOne(new AttendanceVacationBalanceQuery().staffId(staffEntity.getId()));
if(ObjectUtils.isEmpty(balanceEntity)){ //先判断数据库里没有这个人的请假记录就初始化对象
attendanceVacationBalanceEntity.initAttrValue();
}
attendanceVacationBalanceEntity.setRemark(processInstanceId); // 将钉钉的事物id存入假期余额 用于判断是否为同一条请假数据
attendanceVacationBalanceEntity.setStaffId(staffEntity.getId());
attendanceVacationBalanceEntity.setStaffName(staffEntity.getName());
attendanceVacationBalanceEntity.setDeptId(staffEntity.getDeptId());
attendanceVacationBalanceEntity.setDeptName(staffEntity.getDeptName());
attendanceVacationBalanceEntity.setEntryTime(staffEntity.getEntryDate());
if(leaveRecordsResponseBodyResultRest.getCode() == Rest.SUCCESS){
OapiAttendanceVacationQuotaListResponse.OapiLeaveQuotaUserListVo result1 = leaveRecordsResponseBodyResultRest.getData();
double leaveBlance = 0;
// //如果钉钉有假期余额就写入钉钉返回的余额 否则用数据库表数据减去当前请假的天数
// if(result1.getLeaveQuotas() != null && result1.getLeaveQuotas().size() > 0){
// if(leaveRecordEntity.getAuditResult() == 4) { //撤销休假 要把已经扣除的假期加回来
......@@ -362,250 +364,251 @@ public class DingMessageController {
// }
// }
switch (leave_name) {
case "调休":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getCompensatedLeaveDays() != null){
leaveBlance = balanceEntity.getCompensatedLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
switch (leave_name) {
case "调休":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getCompensatedLeaveDays() != null){
leaveBlance = balanceEntity.getCompensatedLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setCompensatedLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "病假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getSickLeaveDays() != null){
leaveBlance = balanceEntity.getSickLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setCompensatedLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "病假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getSickLeaveDays() != null){
leaveBlance = balanceEntity.getSickLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setSickLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "年假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getAnnualLeaveDays() != null){
leaveBlance = balanceEntity.getAnnualLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setSickLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "年假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getAnnualLeaveDays() != null){
leaveBlance = balanceEntity.getAnnualLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setAnnualLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "产假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getMaternityLeaveDays() != null){
leaveBlance = balanceEntity.getMaternityLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setAnnualLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "产假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getMaternityLeaveDays() != null){
leaveBlance = balanceEntity.getMaternityLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setMaternityLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "陪产假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPaternityLeaveDays() != null){
leaveBlance = balanceEntity.getPaternityLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setMaternityLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "陪产假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPaternityLeaveDays() != null){
leaveBlance = balanceEntity.getPaternityLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setPaternityLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "婚假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getMarriageLeaveDays() != null){
leaveBlance = balanceEntity.getMarriageLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setPaternityLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "婚假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getMarriageLeaveDays() != null){
leaveBlance = balanceEntity.getMarriageLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setMarriageLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "例假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getMenstrualLeaveDays() != null){
leaveBlance = balanceEntity.getMenstrualLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setMarriageLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "例假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getMenstrualLeaveDays() != null){
leaveBlance = balanceEntity.getMenstrualLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setMenstrualLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "哺乳假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBreastfeedingLeaveDays() != null){
leaveBlance = balanceEntity.getBreastfeedingLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setMenstrualLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "哺乳假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBreastfeedingLeaveDays() != null){
leaveBlance = balanceEntity.getBreastfeedingLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setBreastfeedingLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "丧假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBereavementLeaveDays() != null){
leaveBlance = balanceEntity.getBereavementLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setBreastfeedingLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "丧假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBereavementLeaveDays() != null){
leaveBlance = balanceEntity.getBereavementLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setBereavementLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "回单位":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBackToUnit() != null){
leaveBlance = balanceEntity.getBackToUnit().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setBereavementLeaveDays(BigDecimal.valueOf(leaveBlance));
break;
case "回单位":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBackToUnit() != null){
leaveBlance = balanceEntity.getBackToUnit().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setBackToUnit(BigDecimal.valueOf(leaveBlance));
break;
case "因公请假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getOnDutyLeave() != null){
leaveBlance = balanceEntity.getOnDutyLeave().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setBackToUnit(BigDecimal.valueOf(leaveBlance));
break;
case "因公请假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getOnDutyLeave() != null){
leaveBlance = balanceEntity.getOnDutyLeave().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setOnDutyLeave(BigDecimal.valueOf(leaveBlance));
break;
case "外出勘验":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getOutOfOffice() != null){
leaveBlance = balanceEntity.getOutOfOffice().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setOnDutyLeave(BigDecimal.valueOf(leaveBlance));
break;
case "外出勘验":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getOutOfOffice() != null){
leaveBlance = balanceEntity.getOutOfOffice().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setOutOfOffice(BigDecimal.valueOf(leaveBlance));
break;
case "值班补班":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getShiftCompensation() != null){
leaveBlance = balanceEntity.getShiftCompensation().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setOutOfOffice(BigDecimal.valueOf(leaveBlance));
break;
case "值班补班":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getShiftCompensation() != null){
leaveBlance = balanceEntity.getShiftCompensation().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setShiftCompensation(BigDecimal.valueOf(leaveBlance));
break;
case "体检":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPhysicalExamination() != null){
leaveBlance = balanceEntity.getPhysicalExamination().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setShiftCompensation(BigDecimal.valueOf(leaveBlance));
break;
case "体检":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPhysicalExamination() != null){
leaveBlance = balanceEntity.getPhysicalExamination().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setPhysicalExamination(BigDecimal.valueOf(leaveBlance));
break;
case "隔离":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getQuarantine() != null){
leaveBlance = balanceEntity.getQuarantine().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setPhysicalExamination(BigDecimal.valueOf(leaveBlance));
break;
case "隔离":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getQuarantine() != null){
leaveBlance = balanceEntity.getQuarantine().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setQuarantine(BigDecimal.valueOf(leaveBlance));
break;
case "因公外出":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBusinessTrip() != null){
leaveBlance = balanceEntity.getBusinessTrip().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setQuarantine(BigDecimal.valueOf(leaveBlance));
break;
case "因公外出":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getBusinessTrip() != null){
leaveBlance = balanceEntity.getBusinessTrip().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setBusinessTrip(BigDecimal.valueOf(leaveBlance));
break;
case "公休":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPublicHoliday() != null){
leaveBlance = balanceEntity.getPublicHoliday().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setBusinessTrip(BigDecimal.valueOf(leaveBlance));
break;
case "公休":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPublicHoliday() != null){
leaveBlance = balanceEntity.getPublicHoliday().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setPublicHoliday(BigDecimal.valueOf(leaveBlance));
break;
case "育儿假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getChildRearingLeave() != null){
leaveBlance = balanceEntity.getChildRearingLeave().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setPublicHoliday(BigDecimal.valueOf(leaveBlance));
break;
case "育儿假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getChildRearingLeave() != null){
leaveBlance = balanceEntity.getChildRearingLeave().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setChildRearingLeave(BigDecimal.valueOf(leaveBlance));
break;
case "调回单位":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getTransferBack() != null){
leaveBlance = balanceEntity.getTransferBack().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setChildRearingLeave(BigDecimal.valueOf(leaveBlance));
break;
case "调回单位":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getTransferBack() != null){
leaveBlance = balanceEntity.getTransferBack().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setTransferBack(BigDecimal.valueOf(leaveBlance));
break;
case "探亲假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getHomeLeave() != null){
leaveBlance = balanceEntity.getHomeLeave().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setTransferBack(BigDecimal.valueOf(leaveBlance));
break;
case "探亲假":
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getHomeLeave() != null){
leaveBlance = balanceEntity.getHomeLeave().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setHomeLeave(BigDecimal.valueOf(leaveBlance));
break;
default:
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPersonalLeaveDays() != null){
leaveBlance = balanceEntity.getPersonalLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
attendanceVacationBalanceEntity.setHomeLeave(BigDecimal.valueOf(leaveBlance));
break;
default:
if(leaveBlance == 0){
if(!ObjectUtils.isEmpty(balanceEntity) && balanceEntity.getPersonalLeaveDays() != null){
leaveBlance = balanceEntity.getPersonalLeaveDays().floatValue() - converMillsToDays(leaveRecordEntity.getDuration());
}else {
leaveBlance = - converMillsToDays(leaveRecordEntity.getDuration()); //秒转换为天
}
}
}
attendanceVacationBalanceEntity.setPersonalLeaveDays(BigDecimal.valueOf(leaveBlance)); //默认事假
break;
attendanceVacationBalanceEntity.setPersonalLeaveDays(BigDecimal.valueOf(leaveBlance)); //默认事假
break;
}
}
}
//审批状态为同意过后再修改假期余额
if(result.getResult().compareToIgnoreCase("AGREE") == 0){
AttendanceVacationBalanceEntity entity = balanceService.selectOne(new AttendanceVacationBalanceQuery().remark(processInstanceId));
if(ObjectUtils.isEmpty(entity)){ //当表中没有这条processInstanceId关联的数据表示没有扣除假期(钉钉会推送两条余额数据过来 需要加这个判断)
//更新假期余额表
if(ObjectUtils.isEmpty(balanceEntity)){
attendanceVacationBalanceEntity.setCreateUserId(1L);
attendanceVacationBalanceEntity.setCreateTime(new Date());
balanceService.save(attendanceVacationBalanceEntity);
}else{
//更新对象必须传入id
attendanceVacationBalanceEntity.setId(balanceEntity.getId());
attendanceVacationBalanceEntity.setUpdateUserId(1L);
attendanceVacationBalanceEntity.setUpdateTime(new Date());
balanceService.update(attendanceVacationBalanceEntity);
//审批状态为同意过后再修改假期余额
if(result.getResult().compareToIgnoreCase("AGREE") == 0){
AttendanceVacationBalanceEntity entity = balanceService.selectOne(new AttendanceVacationBalanceQuery().remark(processInstanceId));
if(ObjectUtils.isEmpty(entity)){ //当表中没有这条processInstanceId关联的数据表示没有扣除假期(钉钉会推送两条余额数据过来 需要加这个判断)
//更新假期余额表
if(ObjectUtils.isEmpty(balanceEntity)){
attendanceVacationBalanceEntity.setCreateUserId(1L);
attendanceVacationBalanceEntity.setCreateTime(new Date());
balanceService.save(attendanceVacationBalanceEntity);
}else{
//更新对象必须传入id
attendanceVacationBalanceEntity.setId(balanceEntity.getId());
attendanceVacationBalanceEntity.setUpdateUserId(1L);
attendanceVacationBalanceEntity.setUpdateTime(new Date());
balanceService.update(attendanceVacationBalanceEntity);
}
}
}
}
}else {
log.info("该号码("+mobile +")未在本系统绑定");
}
}else {
log.info("该号码("+mobile +")未在本系统绑定");
log.info("根据id在钉钉平台查询电话失败"+mobileRest.getMsg());
}
}else {
log.info("根据id在钉钉平台查询电话失败"+mobileRest.getMsg());
}
......
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