Commit a5438d12 authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_dl_3.7.1.0' into develop_dl_3.7.1.0

parents 49193807 e4967cd1
...@@ -1044,4 +1044,25 @@ public class DateUtils { ...@@ -1044,4 +1044,25 @@ public class DateUtils {
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern)); final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toDays(); return Duration.between(start, end).toDays();
} }
public static Map<String,Object> dayComparePrecise(Date fromDate, Date toDate){
Map<String,Object> param = new LinkedHashMap<>();
Calendar from = Calendar.getInstance();
from.setTime(fromDate);
Calendar to = Calendar.getInstance();
to.setTime(toDate);
int fromYear = from.get(Calendar.YEAR);
int fromDay = from.get(Calendar.DAY_OF_YEAR);
int toYear = to.get(Calendar.YEAR);
int toDay = to.get(Calendar.DAY_OF_YEAR);
int year = toYear - fromYear;
int day = toDay - fromDay;
if(day < 0){
day +=365;
year -=1;
}
param.put("year", year);
param.put("day", day);
return param;
}
} }
...@@ -38,4 +38,7 @@ public interface OrganizationService { ...@@ -38,4 +38,7 @@ public interface OrganizationService {
Organization getDetailsById(Long id); Organization getDetailsById(Long id);
int deleteById(Long id); int deleteById(Long id);
Map<String, Object> getSystemOnlineDate(String orgCode);
} }
...@@ -252,4 +252,14 @@ public class OrganizationController extends BaseController { ...@@ -252,4 +252,14 @@ public class OrganizationController extends BaseController {
public ResponseModel deleteById(@RequestParam() Long id) { public ResponseModel deleteById(@RequestParam() Long id) {
return ResponseHelper.buildResponse(organizationService.deleteById(id)); return ResponseHelper.buildResponse(organizationService.deleteById(id));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询上线的年日",notes = "查询上线年日")
@GetMapping(value = "/online/date")
@PersonIdentify
public ResponseModel<Map<String, Object>> getSystemOnlineDate(){
ReginParams reginParams =getSelectedOrgInfo();
String companyId = reginParams.getPersonIdentity().getCompanyId();
return ResponseHelper.buildResponse(organizationService.getSystemOnlineDate(companyId));
}
} }
...@@ -3,7 +3,11 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl; ...@@ -3,7 +3,11 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto; import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto; import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Organization; import com.yeejoin.amos.boot.module.jcs.api.entity.Organization;
...@@ -11,6 +15,8 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser; ...@@ -11,6 +15,8 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationUserMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationUserMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService; import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import freemarker.template.utility.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,11 +26,14 @@ import org.springframework.util.CollectionUtils; ...@@ -20,11 +26,14 @@ import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@Slf4j
public class OrganizationImpl extends BaseService<Organization, Organization, OrganizationMapper> implements OrganizationService { public class OrganizationImpl extends BaseService<Organization, Organization, OrganizationMapper> implements OrganizationService {
@Autowired @Autowired
...@@ -34,6 +43,8 @@ public class OrganizationImpl extends BaseService<Organization, Organization, Or ...@@ -34,6 +43,8 @@ public class OrganizationImpl extends BaseService<Organization, Organization, Or
private OrganizationUserMapper organizationUserMapper; private OrganizationUserMapper organizationUserMapper;
private static String NAME = "组员信息表第"; private static String NAME = "组员信息表第";
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Override @Override
public Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, String bizOrgCode) { public Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, String bizOrgCode) {
...@@ -270,4 +281,21 @@ public class OrganizationImpl extends BaseService<Organization, Organization, Or ...@@ -270,4 +281,21 @@ public class OrganizationImpl extends BaseService<Organization, Organization, Or
} }
return this.baseMapper.deleteById(id); return this.baseMapper.deleteById(id);
} }
@Override
public Map<String, Object> getSystemOnlineDate(String id) {
try {
OrgUsrFormDto orgUsrFormDto = iOrgUsrService.selectCompanyById(Long.parseLong(id));
if (ObjectUtils.isNotEmpty(orgUsrFormDto)) {
String operationDate = String.valueOf(orgUsrFormDto.getMap().get("operationDate"));
Date beginDate = DateUtils.convertStrToDate(operationDate, DateUtils.DATE_PATTERN);
Date now = DateUtils.getDateNow();
return DateUtils.dayComparePrecise(beginDate, now);
}
} catch (Exception e) {
e.printStackTrace();
log.error("获取系统上线时间失败:{}", e.getMessage());
}
return new HashMap<>(1);
}
} }
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