|
@@ -34,6 +34,8 @@ import org.jeecg.modules.openapi4j.service.DepartmentService;
|
|
|
import org.jeecg.modules.openapi4j.service.PersonService;
|
|
|
import org.jeecg.modules.openapi4j.service.SalaryService;
|
|
|
import org.jeecg.modules.openapi4j.util.PropUtil;
|
|
|
+import org.jeecg.modules.schedulingInformation.entity.BdAnnualLeave;
|
|
|
+import org.jeecg.modules.schedulingInformation.mapper.BdAnnualLeaveMapper;
|
|
|
import org.jeecg.modules.system.entity.*;
|
|
|
import org.jeecg.modules.system.mapper.SysPositionMapper;
|
|
|
import org.jeecg.modules.system.service.*;
|
|
@@ -101,6 +103,9 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BdAnnualLeaveMapper bdAnnualLeaveMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IMakeUpCardService makeUpCardService;
|
|
|
|
|
@@ -656,33 +661,51 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public int getYear(Date start,Date end,SysUser user){
|
|
|
+ int yearCount=0;
|
|
|
+ double seconds = Math.floor((end.getTime() - start.getTime()) / 1000);
|
|
|
+ double minutes = Math.floor(seconds / 60);
|
|
|
+ double hours = Math.floor(minutes / 60);
|
|
|
+ double days = Math.floor(hours / 24);
|
|
|
+ double months = Math.floor(days / 30);
|
|
|
+ double diffValue = 0;
|
|
|
+ double workMoth=0;
|
|
|
+ double year=0;
|
|
|
+ if (months > 0) {
|
|
|
+ diffValue = months;
|
|
|
+ }if (user.getWorkMoth()!=null&&!user.getWorkMoth().equals("")){
|
|
|
+ workMoth=Double.parseDouble(user.getWorkMoth());
|
|
|
+ }
|
|
|
+ year=diffValue+workMoth;
|
|
|
+ if (year>=12&&year<24){
|
|
|
+ yearCount=5;
|
|
|
+ }else if (year>=120&&year<240){
|
|
|
+ yearCount=10;
|
|
|
+ }else if (year>=240){
|
|
|
+ yearCount=15;
|
|
|
+ }
|
|
|
+
|
|
|
+ return yearCount;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> U8Vacation(String id) {
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");//日期格式化
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//日期格式化
|
|
|
SysUser userByid = sysUserService.getUserByid(id);
|
|
|
- Date entryDate = null;
|
|
|
- if (userByid!=null){
|
|
|
- entryDate=userByid.getEntryDate();
|
|
|
- }
|
|
|
- Date newDate=new Date();
|
|
|
- int year=0;
|
|
|
- if (entryDate!=null){
|
|
|
- year= newDate.getYear()-entryDate.getYear();
|
|
|
+ List<Vacation> vacationsBody=new ArrayList<>();
|
|
|
+ Date newDate = new Date();
|
|
|
+ int yearCount=0;
|
|
|
+ List<BdAnnualLeave> years = bdAnnualLeaveMapper.getYear(simpleDateFormat.format(newDate));
|
|
|
+ if (years!=null&&years.size()>0&&userByid.getEntryDate()!=null){
|
|
|
+ for (BdAnnualLeave ls:years){
|
|
|
+ yearCount+= getYear(userByid.getEntryDate(), ls.getBeginDate(), userByid);
|
|
|
+ vacationsBody.addAll(vacationMapper.queryListBody(id,ls.getYearName()));
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- String yearCount="0";
|
|
|
+ int moths=3;
|
|
|
String syYearCount="0";
|
|
|
String txCount="0";
|
|
|
- if ((year==1&&newDate.getMonth()>=entryDate.getMonth()&&newDate.getDate()>=entryDate.getDate())||(year>1&&year<10)){
|
|
|
- yearCount="5";
|
|
|
- }else if ((year==10&&newDate.getMonth()>=entryDate.getMonth()&&newDate.getDate()>=entryDate.getDate())||(year>10&&year<20)){
|
|
|
- yearCount="10";
|
|
|
- }else if ((year==20&&newDate.getMonth()>=entryDate.getMonth()&&newDate.getDate()>=entryDate.getDate())||year>20){
|
|
|
- yearCount="15";
|
|
|
- }
|
|
|
-
|
|
|
- List<Vacation> vacationsBody= vacationMapper.queryListBody(id,simpleDateFormat.format(newDate) );
|
|
|
if (vacationsBody!=null&&vacationsBody.size()>0){
|
|
|
for (Vacation vs:vacationsBody){
|
|
|
syYearCount=new BigDecimal(syYearCount).add(new BigDecimal(vs.getHolidayCount())).toString();
|
|
@@ -690,13 +713,16 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
syYearCount=new BigDecimal(syYearCount).divide(new BigDecimal("24"),1,BigDecimal.ROUND_DOWN).toString();
|
|
|
syYearCount=new BigDecimal(yearCount).subtract(new BigDecimal(syYearCount)).toString();
|
|
|
} else {
|
|
|
- syYearCount=yearCount;
|
|
|
+ syYearCount=String.valueOf(yearCount);
|
|
|
+ }
|
|
|
+ String moth = vacationMapper.getMoth();
|
|
|
+ if (moth!=null&&!"".equals(moth)){
|
|
|
+ moths=Integer.parseInt(moth);
|
|
|
}
|
|
|
-
|
|
|
Date dBefore = new Date();
|
|
|
Calendar calendar = Calendar.getInstance(); //得到日历
|
|
|
calendar.setTime(newDate);//把当前时间赋给日历
|
|
|
- calendar.add(calendar.MONTH, -3); //设置为前3月
|
|
|
+ calendar.add(calendar.MONTH, -moths); //设置为前几个月
|
|
|
dBefore = calendar.getTime(); //得到前3月的时间
|
|
|
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置时间格式
|
|
|
String defaultStartDate = sdf.format(dBefore); //格式化前3月的时间
|
|
@@ -812,6 +838,7 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
SysUser user =new SysUser();
|
|
|
user.setId(str.getUserId());
|
|
|
user.setEmploymentStatus(30);
|
|
|
+ user.setTermDate(str.getNewDate());
|
|
|
sysUserService.updateById(user);
|
|
|
userids.add(str.getUserId());
|
|
|
});
|