Browse Source

考勤打卡时长四舍五入到整数位
修改企业微信新客户授权时的名称检查,改成按照corpid检查

seyason 2 years ago
parent
commit
1319d6e14f

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -1362,7 +1362,7 @@ public class ReportController {
                 LocalDate localEndDate = LocalDate.parse(endDate, dateTimeFormatter);
                 TimeType timeType = timeTypeMapper.selectById(byId.getCompanyId());
                 //时间间隔不得超过365天
-                long until = localStartDate.until(localEndDate, ChronoUnit.DAYS);
+                long until = localStartDate.until(localEndDate, ChronoUnit.DAYS) + 1;
                 if (until > 365) {
                     //msg.setError("日期间隔不得超过365天");
                     msg.setError(MessageUtils.message("date.dateThan365"));

+ 5 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -912,12 +912,13 @@ public class WeiXinCorpController {
                     data.setAuthUsername(authUserInfo.getString("name"));
                     String userId = authUserInfo.getString("userid");//授权人的userid
 
-                    //检查公司名称是否存在
-                    List<Company> cpList = companyMapper.selectList(new QueryWrapper<Company>().eq("company_name", corpName).or().eq("company_name", data.getCorpFullName()));
+                    //检查公司名称是否存在,按照corpid比对
+                    WxCorpInfo findCorp = wxCorpInfoMapper.selectById(corpId);
+
                     Company company = null;
                     SysRole managerRole = null;
-                    if (cpList.size() > 0) {
-                        company = cpList.get(0);
+                    if (findCorp != null) {
+                        company = companyMapper.selectById(findCorp.getCompanyId());
                         managerRole = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", company.getId()).eq("rolename", com.management.platform.constant.Constant.ROLE_SUPER_MANAGER));
                     } else {
                         //首先生成一个新公司,增加会员的试用一个月
@@ -1010,7 +1011,6 @@ public class WeiXinCorpController {
                     data.setSaasSyncContact(enableNewVersion?1:0);
                     wxCorpInfoMapper.insert(data);
                     //默认普通员工的角色
-                    SysRole defaultUserRole = sysRoleService.getOne(new QueryWrapper<SysRole>().eq("company_id", company.getId()).eq("is_default", 1));
                     JSONObject userDetail = getUserInfo(curCorpAccessToken, userId);
                     //检查授权人是否存在
                     int cnt = userMapper.selectCount(new QueryWrapper<User>().eq("corpwx_userid", userId));

+ 7 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -602,7 +602,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     }
                     userCorpwxTime.setWeekDayTxt(DateTimeUtil.getWeekDayTxt(userCorpwxTime.getWeekDay()));
                     BigDecimal bigDecimal=new BigDecimal(Duration.between(LocalTime.parse(minTime,df).plusHours(8),LocalTime.parse(maxTime,df).plusHours(8)).toMinutes());
-                    bigDecimal=bigDecimal.divide(BigDecimal.valueOf(60),1,BigDecimal.ROUND_HALF_UP).subtract(new BigDecimal(restTime));
+                    bigDecimal=bigDecimal.divide(BigDecimal.valueOf(60),0,BigDecimal.ROUND_HALF_UP).subtract(new BigDecimal(restTime));
                     userCorpwxTime.setWorkHours(bigDecimal.doubleValue());
                     System.out.println(userCorpwxTime);
                     UserCorpwxTime item;
@@ -1118,8 +1118,12 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                             .eq("create_date", localDate));
                     if (item != null) {
                         ct.setId(item.getId());
-                        //已存在记录,进行更新
-                        userCorpwxTimeMapper.updateById(ct);
+                        //已存在记录,但是如果老记录有工作时长,新记录无工作时长,也没有请假外出和打卡时长,说明新的记录是没有取到考勤的。 老记录是通过当天打卡数据获取到的,包含外出的时间
+                        if (item.getWorkHours() > 0 && ct.getWorkHours() == 0 && ct.getCardTime() == 0 && ct.getAskLeaveTime() == 0 && ct.getOutdoorTime() == 0) {
+                            //不处理
+                        } else {
+                            userCorpwxTimeMapper.updateById(ct);
+                        }
                     } else {
                         userCorpwxTimeMapper.insert(ct);
                     }