Commit 47a938ac authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents b90482ad 14453f52
......@@ -27,6 +27,11 @@ import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
import com.mortals.xhx.module.window.model.WindowOwnerEntity;
import com.mortals.xhx.module.window.model.WindowOwnerQuery;
import com.mortals.xhx.module.window.service.WindowOwnerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -36,10 +41,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.ErrorCode.*;
......@@ -55,6 +58,10 @@ public class ApiLoginController extends BaseJsonBodyController {
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Autowired
private WindowOwnerService windowOwnerService;
@RequestMapping("login")
......@@ -88,15 +95,40 @@ public class ApiLoginController extends BaseJsonBodyController {
userEntity.setDingUserId(loginForm.getCode());
userService.getUserDao().update(userEntity);
}
HashSet<Integer> set = new HashSet<>();
set.add(0);
set.add(2);
set.add(3);
if (ObjectUtils.isEmpty(userEntity.getUserType()) || !set.contains(userEntity.getUserType())) {
StaffEntity staffEntity = null;
if(userEntity.getCustomerId()!=null){
staffEntity = staffService.getCache(userEntity.getCustomerId().toString());
}
if(staffEntity!=null){
WindowOwnerEntity windowOwnerEntity = windowOwnerService.selectOne(new WindowOwnerQuery().staffId(staffEntity.getId()));
if(windowOwnerEntity == null){
userEntity.setUserType(1); //工作人员
}else {
if(windowOwnerEntity.getInspect()==1){
userEntity.setUserType(3); //具有巡检的窗口负责人
}else {
userEntity.setUserType(2); //普通窗口负责人
}
if(StringUtils.isNotEmpty(windowOwnerEntity.getStaffIds())){
List<Long> staffIdList = Arrays.asList(windowOwnerEntity.getStaffIds().split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
windowOwnerEntity.setStaffCount(staffIdList.size());
}else {
windowOwnerEntity.setStaffCount(0);
}
windowOwnerEntity.setWindowOwnerDetailList(null);
data.put("windowOwner", windowOwnerEntity);
}
}else {
throw new AppException("当前用户不支持H5登录!");
}
// HashSet<Integer> set = new HashSet<>();
// set.add(0);
// set.add(2);
// set.add(3);
//
// if (ObjectUtils.isEmpty(userEntity.getUserType()) || !set.contains(userEntity.getUserType())) {
// throw new AppException("当前用户不支持H5登录!");
// }
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
......
......@@ -41,6 +41,9 @@ import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import com.mortals.xhx.module.window.model.WindowOwnerEntity;
import com.mortals.xhx.module.window.model.WindowOwnerQuery;
import com.mortals.xhx.module.window.service.WindowOwnerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -52,6 +55,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.ErrorCode.*;
......@@ -77,6 +81,8 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private WindowOwnerService windowOwnerService;
@RequestMapping("authlogin")
......@@ -107,6 +113,32 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
}
data.put("id", userEntity.getId());
if(userEntity!=null) {
StaffEntity staffEntity = null;
if (userEntity.getCustomerId() != null) {
staffEntity = staffService.getCache(userEntity.getCustomerId().toString());
}
if (staffEntity != null) {
WindowOwnerEntity windowOwnerEntity = windowOwnerService.selectOne(new WindowOwnerQuery().staffId(staffEntity.getId()));
if (windowOwnerEntity == null) {
userEntity.setUserType(1); //工作人员
} else {
if (windowOwnerEntity.getInspect() == 1) {
userEntity.setUserType(3); //具有巡检的窗口负责人
} else {
userEntity.setUserType(2); //普通窗口负责人
}
if (StringUtils.isNotEmpty(windowOwnerEntity.getStaffIds())) {
List<Long> staffIdList = Arrays.asList(windowOwnerEntity.getStaffIds().split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
windowOwnerEntity.setStaffCount(staffIdList.size());
} else {
windowOwnerEntity.setStaffCount(0);
}
windowOwnerEntity.setWindowOwnerDetailList(null);
data.put("windowOwner", windowOwnerEntity);
}
}
}
data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
......@@ -206,6 +238,32 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
String token = authTokenService.getToken(request);
data.put("id", user.getId());
data.put("token", token);
if(userEntity!=null) {
StaffEntity staffEntity = null;
if (userEntity.getCustomerId() != null) {
staffEntity = staffService.getCache(userEntity.getCustomerId().toString());
}
if (staffEntity != null) {
WindowOwnerEntity windowOwnerEntity = windowOwnerService.selectOne(new WindowOwnerQuery().staffId(staffEntity.getId()));
if (windowOwnerEntity == null) {
userEntity.setUserType(1); //工作人员
} else {
if (windowOwnerEntity.getInspect() == 1) {
userEntity.setUserType(3); //具有巡检的窗口负责人
} else {
userEntity.setUserType(2); //普通窗口负责人
}
if (StringUtils.isNotEmpty(windowOwnerEntity.getStaffIds())) {
List<Long> staffIdList = Arrays.asList(windowOwnerEntity.getStaffIds().split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
windowOwnerEntity.setStaffCount(staffIdList.size());
} else {
windowOwnerEntity.setStaffCount(0);
}
windowOwnerEntity.setWindowOwnerDetailList(null);
data.put("windowOwner", windowOwnerEntity);
}
}
}
data.put("userType", userEntity.getUserType());
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
......
......@@ -46,4 +46,11 @@ public interface WindowOwnerService extends ICRUDService<WindowOwnerEntity, Long
Rest<List<String>> getPerformMonthList(Context context);
/**
* 获取负责人管辖的工作人员
* @param id
* @return
*/
List<StaffEntity> getStaffList(Long id);
}
\ No newline at end of file
......@@ -247,7 +247,7 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
Set<String> performMonthSet = collect.keySet();
collectSet.addAll(performMonthSet);
//查询所有窗口人员汇总表
//查询所有窗口人员汇总表
WindowWorkmanPerformQuery windowWorkmanPerformQuery = new WindowWorkmanPerformQuery();
windowWorkmanPerformQuery.setOwnerId(context.getUser().getCustomerId());
Map<String, List<WindowWorkmanPerformEntity>> workmanMonthSet = windowWorkmanPerformService.find(windowWorkmanPerformQuery).stream().collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth()));
......@@ -317,4 +317,20 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
}
return entity;
}
@Override
public List<StaffEntity> getStaffList(Long key) {
WindowOwnerEntity entity = this.dao.get(key);
if(entity!=null){
if(StringUtils.isNotEmpty(entity.getStaffIds())){
List<Long> staffIdList = Arrays.asList(entity.getStaffIds().split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
List<StaffEntity> staffEntityList = staffService.find(new StaffQuery().idList(staffIdList));
return staffEntityList;
}else {
return Collections.emptyList();
}
}else {
return Collections.emptyList();
}
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package com.mortals.xhx.module.window.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.site.model.SiteQuery;
......@@ -200,5 +202,28 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
return jsonObject.toJSONString();
}
/**
* 查询窗口负责人下属列表
*/
@PostMapping(value = "staffList")
@UnAuth
public Rest<List<StaffEntity>> staffList(@RequestBody WindowOwnerEntity query){
Rest<List<StaffEntity>> ret = new Rest();
String busiDesc = "查询当前负责人负责的人员列表" + this.getModuleDesc();
Context context = this.getContext();
Map<String, Object> model = new HashMap();
int code = 1;
try {
List<StaffEntity> result = this.getService().getStaffList(query.getId());
ret.setData(result);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
code = -1;
this.doException(this.request, busiDesc, model, e);
}
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND happenTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,checkStatus,checkResult,auditStatus,createTime,score,subMethod,checkTime, deductTime,6 AS checkType ,'complain' AS performType,updateTime FROM mortals_xhx_check_complain_record WHERE 1=1
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,checkStatus,checkResult,auditStatus,createTime,score,subMethod,checkTime, deductTime,2 AS checkType ,'complain' AS performType,updateTime FROM mortals_xhx_check_complain_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
......
......@@ -15,8 +15,8 @@
p.recordId = w.id
AND d.performId = w.id
AND s.id = d.staffId
AND checkStatus = 2
AND manageCheckResult = 1
AND p.checkStatus = 2
AND p.manageCheckResult = 1
<if test="recordId != null and recordId!=''"> AND p.recordId = #{recordId} </if>
<if test="year != null and year!=''"> AND p.`year` = #{year} </if>
<if test="month != null and month!=''"> AND p.`month` = #{month} </if>
......
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