Commit 34d0dab6 authored by 姬鋆屾's avatar 姬鋆屾
parents f917cb3d 3dd6e2e1
...@@ -91,7 +91,18 @@ public class UserEntity extends UserVo implements IUser { ...@@ -91,7 +91,18 @@ public class UserEntity extends UserVo implements IUser {
*/ */
private Long customerId; private Long customerId;
/**
* 钉钉userId
*/
private String dingUserId;
public String getDingUserId() {
return dingUserId;
}
public void setDingUserId(String dingUserId) {
this.dingUserId = dingUserId;
}
public UserEntity(){} public UserEntity(){}
/** /**
......
...@@ -162,6 +162,14 @@ public class UserQuery extends UserEntity { ...@@ -162,6 +162,14 @@ public class UserQuery extends UserEntity {
/** 最后一次登录地址排除列表 */ /** 最后一次登录地址排除列表 */
private List <String> lastLoginAddressNotList; private List <String> lastLoginAddressNotList;
/** 钉钉userId */
private List<String> dingUserIdList;
/** 钉钉userId排除列表 */
private List <String> dingUserIdNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<UserQuery> orConditionList; private List<UserQuery> orConditionList;
...@@ -1606,4 +1614,23 @@ public class UserQuery extends UserEntity { ...@@ -1606,4 +1614,23 @@ public class UserQuery extends UserEntity {
this.andConditionList = andConditionList; this.andConditionList = andConditionList;
} }
/**
* 设置 钉钉userId
* @param dingUserId
*/
public UserQuery dingUserId(String dingUserId){
setDingUserId(dingUserId);
return this;
}
/**
* 设置 钉钉userId
* @param dingUserIdList
*/
public UserQuery dingUserIdList(List<String> dingUserIdList){
this.dingUserIdList = dingUserIdList;
return this;
}
} }
\ No newline at end of file
package com.mortals.xhx.busiz.h5.req;
import com.mortals.xhx.busiz.BaseReq;
import lombok.Data;
@Data
public class DingTalkReq extends BaseReq {
/**
* 授权码
*/
private String code;
}
package com.mortals.xhx.busiz.h5.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.CookieService;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.login.web.LoginForm;
import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.menu.service.MenuService;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.busiz.h5.req.DingTalkReq;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.HomeStatInfo;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.dingding.IDingTalkService;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
/**
* 钉钉授权登录
*
* @author:
* @date: 2023/7/15 10:26
*/
@RestController
@Slf4j
@RequestMapping("dingtalk")
public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> {
@Autowired
private UserService userService;
@Autowired
private ValidCodeService validCodeService;
@Autowired
private ResourceService resourceService;
@Autowired
private MenuService menuService;
@Autowired
private ICacheService cacheService;
@Autowired
private IAuthTokenService authTokenService;
@Autowired
private StaffService staffService;
@Autowired
private DeptService deptService;
@Autowired
private IDingPersonService dingPersonService;
@RequestMapping("authlogin")
public String login(@RequestBody DingTalkReq req) throws Exception {
JSONObject ret = new JSONObject();
UserEntity userEntity = null;
try {
if (ObjectUtils.isEmpty(req.getCode())) {
throw new AppException("钉钉 code 不能为空!");
}
//根据code 查询钉钉用户id
Rest<String> personRest = dingPersonService.getPersonByCode(req.getCode());
if (personRest.getCode() == YesNoEnum.NO.getValue()) {
throw new AppException(String.format("获取钉钉用户异常,{}", personRest.getMsg()));
}
//根据钉钉的用户查询系统绑定的用户
recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
JSONObject data = new JSONObject();
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
// userEntity.setMenuUrl(generateMenuUrlCode(urls));
String token = authTokenService.createToken(userEntity);
data.put("token", token);
//设置token 和过期时间
//data.put("expiresTime", DateUtils.addCurrDate(7).getTime());
//this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
} catch (Exception e) {
log.error("dinding login error ", e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
@RequestMapping("logout")
public void logout(HttpServletRequest request, HttpServletResponse response) throws Exception {
recordSysLog(request, "退出登录");
super.removeCurrUser(request);
this.deleteBlackCookie(request, response);
}
protected void deleteBlackCookie(HttpServletRequest request, HttpServletResponse response) {
try {
CookieService.deleteCookieForAuth(request, response);
} catch (Throwable e) {
}
}
@RequestMapping("parseToken")
public IUser parseToken() throws Exception {
IUser userEntity = authTokenService.getLoginUser(request);
if (!ObjectUtils.isEmpty(userEntity)) {
authTokenService.verifyToken(userEntity);
return userEntity;
}
return null;
}
}
...@@ -7,6 +7,7 @@ import com.mortals.framework.common.Rest; ...@@ -7,6 +7,7 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.busiz.h5.req.FeedbackReq; import com.mortals.xhx.busiz.h5.req.FeedbackReq;
import com.mortals.xhx.busiz.h5.req.FeedbackSaveReq; import com.mortals.xhx.busiz.h5.req.FeedbackSaveReq;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
...@@ -75,17 +76,20 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> { ...@@ -75,17 +76,20 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> {
feedbackReq.setFeedBackEndDate(DateUtil.endOfMonth(DateUtil.parse(feedbackReq.getFeedBackStartDate()).toJdkDate()).toDateStr()); feedbackReq.setFeedBackEndDate(DateUtil.endOfMonth(DateUtil.parse(feedbackReq.getFeedBackStartDate()).toJdkDate()).toDateStr());
} }
//PageInfo pageInfo = buildPageInfo(feedbackReq); //PageInfo pageInfo = buildPageInfo(feedbackReq);
//todo PageInfo pageAllInfo = buildPageInfo(feedbackReq);
PageInfo pageAllInfo = new PageInfo();
if (YesNoEnum.YES.getValue() == feedbackReq.getFeedbackStatus()) { if (YesNoEnum.YES.getValue() == feedbackReq.getFeedbackStatus()) {
//已反馈 //已反馈
//查询我已经回答过的 //查询我已经回答过的
List<Long> feedbackIdList = answerService.find(new FeedbackAnswerQuery().staffId(context.getUser().getCustomerId())).stream().map(i -> i.getFeedbackId()).distinct().collect(Collectors.toList()); List<Long> feedbackIdList = answerService.find(new FeedbackAnswerQuery().staffId(context.getUser().getCustomerId())).stream().map(i -> i.getFeedbackId()).distinct().collect(Collectors.toList());
FeedbackQuery feedbackQuery = new FeedbackQuery(); FeedbackQuery feedbackQuery = new FeedbackQuery();
feedbackQuery.setIdList(feedbackIdList); feedbackQuery.setIdList(feedbackIdList);
List<FeedbackEntity> feedbackEntities = feedbackService.find(feedbackQuery);
model.put(KEY_RESULT_DATA, feedbackEntities); Result<FeedbackEntity> result = feedbackService.find(feedbackQuery, pageAllInfo, null);
pageAllInfo.setTotalResult(feedbackEntities.size());
model.put(PAGEINFO_KEY, result.getPageInfo());
model.put(KEY_RESULT_DATA, result.getList());
parsePageInfo(model, result.getPageInfo());
} else { } else {
//未反馈 //未反馈
//查询我的反馈 但是还未回答的 //查询我的反馈 但是还未回答的
...@@ -96,17 +100,16 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> { ...@@ -96,17 +100,16 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> {
feedbackStaffQuery.setStaffId(context.getUser().getCustomerId()); feedbackStaffQuery.setStaffId(context.getUser().getCustomerId());
List<Long> unfinFeedbackList = feedbackStaffService.find(feedbackStaffQuery).stream().map(i -> i.getFeedbackId()).distinct().collect(Collectors.toList()); List<Long> unfinFeedbackList = feedbackStaffService.find(feedbackStaffQuery).stream().map(i -> i.getFeedbackId()).distinct().collect(Collectors.toList());
model.put(KEY_RESULT_DATA, unfinFeedbackList); FeedbackQuery feedbackQuery = new FeedbackQuery();
pageAllInfo.setTotalResult(unfinFeedbackList.size()); feedbackQuery.setIdList(unfinFeedbackList);
} Result<FeedbackEntity> result = feedbackService.find(feedbackQuery, pageAllInfo, null);
pageAllInfo.setCurrPage(1);
pageAllInfo.setPrePageResult(-1);
model.put(PAGEINFO_KEY, pageAllInfo);
parsePageInfo(model, pageAllInfo);
model.put(PAGEINFO_KEY, result.getPageInfo());
model.put(KEY_RESULT_DATA, result.getList());
parsePageInfo(model, result.getPageInfo());
}
rest.setData(model); rest.setData(model);
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e);
......
...@@ -186,16 +186,13 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -186,16 +186,13 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
PageInfo pageAllInfo = new PageInfo(); PageInfo pageAllInfo = new PageInfo();
pageAllInfo.setTotalResult(collect.size()); pageAllInfo.setTotalResult(collect.size());
pageAllInfo.setCurrPage(1); pageAllInfo.setCurrPage(1);
pageAllInfo.setPrePageResult(-1); pageAllInfo.setPrePageResult(10);
model.put(PAGEINFO_KEY, pageAllInfo); model.put(PAGEINFO_KEY, pageAllInfo);
parsePageInfo(model, pageAllInfo); parsePageInfo(model, pageAllInfo);
} }
// model.put(KEY_RESULT_DATA, result.getList()); // model.put(KEY_RESULT_DATA, result.getList());
// model.put(PAGEINFO_KEY, result.getPageInfo()); // model.put(PAGEINFO_KEY, result.getPageInfo());
// parsePageInfo(model, result.getPageInfo()); // parsePageInfo(model, result.getPageInfo());
rest.setData(model); rest.setData(model);
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -9,18 +9,11 @@ public class RedisKey { ...@@ -9,18 +9,11 @@ public class RedisKey {
* 登录 key * 登录 key
*/ */
public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:"; public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:";
/**
* 设备心跳上报
*/
public static final String KEY_DEVICE_ONLINE_CACHE = "device:online:";
public static final String KEY_SITE_CACHE = "siteDict";
public static final String KEY_PLATFORM_CACHE = "platformDict"; /**
* 钉钉 访问token
public static final String KEY_PRODUCT_CACHE = "productDict"; */
public static final String KEY_DINGTALK_ACCESSTOKEN_CACHE = "dingtalk:token:";
public static final String KEY_TOKEN_API_CACHE = "token:api:";
} }
package com.mortals.xhx.module.check.dao; package com.mortals.xhx.module.check.dao;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery; import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo; import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
...@@ -10,5 +12,5 @@ import java.util.List; ...@@ -10,5 +12,5 @@ import java.util.List;
*/ */
public interface CheckAllRecordDao { public interface CheckAllRecordDao {
List<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query); Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query, PageInfo pageInfo);
} }
package com.mortals.xhx.module.check.dao.ibatis; package com.mortals.xhx.module.check.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.check.dao.CheckAllRecordDao; import com.mortals.xhx.module.check.dao.CheckAllRecordDao;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery; import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo; import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport; import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -30,8 +35,39 @@ public class CheckAllRecordDaoImpl extends SqlSessionDaoSupport implements Check ...@@ -30,8 +35,39 @@ public class CheckAllRecordDaoImpl extends SqlSessionDaoSupport implements Check
} }
@Override @Override
public List<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery checkAllRecordQuery) { public Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery checkAllRecordQuery, PageInfo pageInfo) {
Result result = new Result();
List list = null;
if (pageInfo.isCountPage()) {
int count = this.getCount(checkAllRecordQuery);
if (count == 0) {
list = new ArrayList();
} else if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId("getList"), checkAllRecordQuery);
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId("getList"), checkAllRecordQuery, rowBounds);
}
return this.getSqlSession().selectList(this.getSqlId("getList"), checkAllRecordQuery); pageInfo.setTotalResult(count);
result.setPageInfo(pageInfo);
result.setList((List)list);
} else {
if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId("getList"), checkAllRecordQuery);
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId("getList"), checkAllRecordQuery, rowBounds);
}
pageInfo.setTotalResult(-1);
result.setPageInfo(pageInfo);
result.setList(list);
}
return result;
}
public int getCount(CheckAllRecordQuery checkAllRecordQuery) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getListCount"), checkAllRecordQuery);
} }
} }
package com.mortals.xhx.module.check.service; package com.mortals.xhx.module.check.service;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery; import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo; import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
...@@ -10,5 +12,5 @@ import java.util.List; ...@@ -10,5 +12,5 @@ import java.util.List;
*/ */
public interface CheckAllRecordService { public interface CheckAllRecordService {
List<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query); Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query, PageInfo pageInfo);
} }
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.check.dao.CheckAllRecordDao; import com.mortals.xhx.module.check.dao.CheckAllRecordDao;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery; import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
...@@ -21,7 +23,7 @@ public class CheckAllRecordServiceImpl implements CheckAllRecordService { ...@@ -21,7 +23,7 @@ public class CheckAllRecordServiceImpl implements CheckAllRecordService {
private CheckAllRecordDao checkAllRecordDao; private CheckAllRecordDao checkAllRecordDao;
@Override @Override
public List<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query) { public Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query,PageInfo pageInfo) {
if(StringUtils.isEmpty(query.getCheckTimeStart())||StringUtils.isEmpty(query.getCheckTimeStart())){ if(StringUtils.isEmpty(query.getCheckTimeStart())||StringUtils.isEmpty(query.getCheckTimeStart())){
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance(); Calendar calendar=Calendar.getInstance();
...@@ -32,6 +34,6 @@ public class CheckAllRecordServiceImpl implements CheckAllRecordService { ...@@ -32,6 +34,6 @@ public class CheckAllRecordServiceImpl implements CheckAllRecordService {
query.setCheckTimeStart(startTime); query.setCheckTimeStart(startTime);
query.setCheckTimeEnd(endTime); query.setCheckTimeEnd(endTime);
} }
return checkAllRecordDao.getAllCheckRecord(query); return checkAllRecordDao.getAllCheckRecord(query,pageInfo);
} }
} }
...@@ -83,9 +83,9 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR ...@@ -83,9 +83,9 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
msg.setMsgtype("link"); msg.setMsgtype("link");
Link link = new Link(); Link link = new Link();
link.setPicUrl("测试图片链接"); link.setPicUrl("测试图片链接");
link.setMessageUrl("测试消息链接"); link.setMessageUrl("http://www.baidu.com");
link.setText("测试文本"); link.setText("你有一条绩效考核核查通知,请及时查看!");
link.setTitle("测试标题"); link.setTitle("绩效考核核查通知");
msg.setLink(link); msg.setLink(link);
workMsgReq.setUseridList(personRest.getMsg()); workMsgReq.setUseridList(personRest.getMsg());
......
...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.check.web; ...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.check.web;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseJsonBodyController; import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.code.CheckStatusEnum; import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.CheckTypeEnum; import com.mortals.xhx.common.code.CheckTypeEnum;
...@@ -45,14 +47,14 @@ public class CheckAllRecordController extends BaseJsonBodyController { ...@@ -45,14 +47,14 @@ public class CheckAllRecordController extends BaseJsonBodyController {
Rest<Object> ret = new Rest(); Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Context context = this.getContext(); Context context = this.getContext();
String busiDesc = "查询所类型绩效核查信息"; String busiDesc = "查询所类型绩效核查信息";
int code=1; int code=1;
try { try {
PageInfo pageInfo = new PageInfo(-1);
Result<CheckAllRecordVo> result = checkAllRecordService.getAllCheckRecord(query,pageInfo);
List<CheckAllRecordVo> result = checkAllRecordService.getAllCheckRecord(query); model.put("data", result.getList());
model.put("data", result);
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) { if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
......
...@@ -7,9 +7,12 @@ import com.dingtalk.api.response.OapiGettokenResponse; ...@@ -7,9 +7,12 @@ import com.dingtalk.api.response.OapiGettokenResponse;
import com.hikvision.artemis.sdk.config.ArtemisConfig; import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.ApiRespPdu; import com.mortals.xhx.common.pdu.ApiRespPdu;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService; import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -32,7 +35,7 @@ public abstract class AbstractDingTalkService implements IDingPersonService { ...@@ -32,7 +35,7 @@ public abstract class AbstractDingTalkService implements IDingPersonService {
protected Long agentId; protected Long agentId;
/** /**
* AgentId * domain
*/ */
@Value("${dingtalk.domain:https://oapi.dingtalk.com}") @Value("${dingtalk.domain:https://oapi.dingtalk.com}")
protected String domain; protected String domain;
...@@ -49,43 +52,38 @@ public abstract class AbstractDingTalkService implements IDingPersonService { ...@@ -49,43 +52,38 @@ public abstract class AbstractDingTalkService implements IDingPersonService {
@Value("${dingtalk.AppSecret:''}") @Value("${dingtalk.AppSecret:''}")
protected String appSecret; protected String appSecret;
/** @Autowired
* getToken private ICacheService cacheService;
*/
@Value("${dingtalk.gettoken:https://oapi.dingtalk.com/gettoken}")
protected String getTokneUrl;
protected String dingToken;
protected DingTalkClient getDingTalkClient(String path) { protected DingTalkClient getDingTalkClient(String path) {
DingTalkClient client = new DefaultDingTalkClient(domain + path); DingTalkClient client = new DefaultDingTalkClient(domain + path);
return client; return client;
} }
protected void checkToken() {
if (ObjectUtils.isEmpty(dingToken)) {
dingToken = getToken().getData();
}
}
@Override @Override
public Rest<String> getToken() { public String getToken() {
try { try {
DingTalkClient client = getDingTalkClient("/gettoken"); String dingToken = cacheService.get(RedisKey.KEY_DINGTALK_ACCESSTOKEN_CACHE);
OapiGettokenRequest req = new OapiGettokenRequest(); if (ObjectUtils.isEmpty(dingToken)) {
req.setAppkey(appKey); DingTalkClient client = getDingTalkClient("/gettoken");
req.setAppsecret(appSecret); OapiGettokenRequest req = new OapiGettokenRequest();
OapiGettokenResponse rsp = client.execute(req); req.setAppkey(appKey);
log.info("OapiGettokenResponse:{}",rsp.getBody()); req.setAppsecret(appSecret);
if (rsp.getErrcode() == 0) { OapiGettokenResponse rsp = client.execute(req);
return Rest.ok(rsp.getAccessToken()); log.info("OapiGettokenResponse:{}", rsp.getBody());
if (rsp.getErrcode() == 0) {
cacheService.setex(RedisKey.KEY_DINGTALK_ACCESSTOKEN_CACHE, rsp.getAccessToken(), 4800);
return rsp.getAccessToken();
} else {
throw new AppException(String.format("code:{},errorMsg:{}", rsp.getErrcode(), rsp.getErrmsg()));
}
} else { } else {
throw new AppException(rsp.getMessage()); return dingToken;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("获取TOKEN异常", e); log.error("获取TOKEN异常", e);
return Rest.fail(e.getMessage()); throw new AppException(e.getMessage());
} }
} }
......
...@@ -3,5 +3,5 @@ package com.mortals.xhx.module.dingding; ...@@ -3,5 +3,5 @@ package com.mortals.xhx.module.dingding;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
public interface IDingTalkService { public interface IDingTalkService {
Rest<String> getToken(); String getToken();
} }
...@@ -25,6 +25,14 @@ public interface IDingPersonService extends IDingTalkService { ...@@ -25,6 +25,14 @@ public interface IDingPersonService extends IDingTalkService {
*/ */
Rest<String> getPersonByMobile(String mobile); Rest<String> getPersonByMobile(String mobile);
/**
* 根据code获取钉钉用户id
*
* @param code
* @return
*/
Rest<String> getPersonByCode(String code);
/** /**
* 发送工作消息 * 发送工作消息
......
...@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON; ...@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request; import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
import com.dingtalk.api.request.OapiV2UserGetbymobileRequest; import com.dingtalk.api.request.OapiV2UserGetbymobileRequest;
import com.dingtalk.api.request.OapiV2UserGetuserinfoRequest;
import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response; import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
import com.dingtalk.api.response.OapiV2UserGetbymobileResponse; import com.dingtalk.api.response.OapiV2UserGetbymobileResponse;
import com.dingtalk.api.response.OapiV2UserGetuserinfoResponse;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.dingding.AbstractDingTalkService; import com.mortals.xhx.module.dingding.AbstractDingTalkService;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq; import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq;
...@@ -24,12 +26,11 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -24,12 +26,11 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
public Rest<String> getPersonByMobile(String mobile) { public Rest<String> getPersonByMobile(String mobile) {
try { try {
DingTalkClient client = getDingTalkClient("/topapi/v2/user/getbymobile"); DingTalkClient client = getDingTalkClient("/topapi/v2/user/getbymobile");
checkToken();
OapiV2UserGetbymobileRequest req = new OapiV2UserGetbymobileRequest(); OapiV2UserGetbymobileRequest req = new OapiV2UserGetbymobileRequest();
req.setMobile(mobile); req.setMobile(mobile);
log.info("getPersonByMobile:{}",mobile); log.info("getPersonByMobile:{}", mobile);
OapiV2UserGetbymobileResponse rsp = client.execute(req, dingToken); OapiV2UserGetbymobileResponse rsp = client.execute(req, getToken());
log.info("OapiV2UserGetbymobileResponse:{}",rsp.getBody()); log.info("OapiV2UserGetbymobileResponse:{}", rsp.getBody());
if (rsp.getErrcode() == 0) { if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getResult().getUserid()); return Rest.ok(rsp.getResult().getUserid());
} else { } else {
...@@ -41,18 +42,38 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -41,18 +42,38 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
} }
} }
@Override
public Rest<String> getPersonByCode(String code) {
try {
DingTalkClient client = getDingTalkClient("/topapi/v2/user/getuserinfo");
OapiV2UserGetuserinfoRequest req = new OapiV2UserGetuserinfoRequest();
req.setCode(code);
log.info("getPersonByCode:{}", code);
OapiV2UserGetuserinfoResponse rsp = client.execute(req, getToken());
log.info("OapiV2UserGetuserinfoResponse:{}", rsp.getBody());
if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getResult().getUserid());
} else {
return Rest.fail(String.format("code:%s,msg:%s", rsp.getErrcode(), rsp.getErrmsg()));
}
} catch (ApiException e) {
log.info("根据code查询人员异常", e);
return Rest.fail(e.getMessage());
}
}
@Override @Override
public Rest<String> sendWorkMsg(WorkMsgReq workMsgReq) { public Rest<String> sendWorkMsg(WorkMsgReq workMsgReq) {
try { try {
DingTalkClient client = getDingTalkClient("/topapi/message/corpconversation/asyncsend_v2"); DingTalkClient client = getDingTalkClient("/topapi/message/corpconversation/asyncsend_v2");
checkToken();
OapiMessageCorpconversationAsyncsendV2Request req = new OapiMessageCorpconversationAsyncsendV2Request(); OapiMessageCorpconversationAsyncsendV2Request req = new OapiMessageCorpconversationAsyncsendV2Request();
req.setAgentId(agentId); req.setAgentId(agentId);
req.setUseridList(workMsgReq.getUseridList()); req.setUseridList(workMsgReq.getUseridList());
req.setMsg(JSON.toJSONString(workMsgReq.getMsg())); req.setMsg(JSON.toJSONString(workMsgReq.getMsg()));
log.info("sendWorkMsg:{}", JSON.toJSONString(workMsgReq)); log.info("sendWorkMsg:{}", JSON.toJSONString(workMsgReq));
OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(req, dingToken); OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(req, getToken());
log.info("OapiMessageResponse:{}",rsp.getBody()); log.info("OapiMessageResponse:{}", rsp.getBody());
if (rsp.getErrcode() == 0) { if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getMsg(), rsp.getRequestId()); return Rest.ok(rsp.getMsg(), rsp.getRequestId());
} else { } else {
......
package com.mortals.xhx.module.window.service.impl; package com.mortals.xhx.module.window.service.impl;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -13,17 +14,20 @@ import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity; ...@@ -13,17 +14,20 @@ import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.model.WindowOwnerDetailQuery; import com.mortals.xhx.module.window.model.WindowOwnerDetailQuery;
import com.mortals.xhx.module.window.service.WindowOwnerDetailService; import com.mortals.xhx.module.window.service.WindowOwnerDetailService;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
* WindowOwnerService * WindowOwnerService
* 窗口负责人 service实现 * 窗口负责人 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-07-12 * @date 2023-07-12
*/ */
@Service("windowOwnerService") @Service("windowOwnerService")
@Slf4j @Slf4j
public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerDao, WindowOwnerEntity, Long> implements WindowOwnerService { public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerDao, WindowOwnerEntity, Long> implements WindowOwnerService {
...@@ -31,37 +35,54 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD ...@@ -31,37 +35,54 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
private WindowOwnerDetailService windowOwnerDetailService; private WindowOwnerDetailService windowOwnerDetailService;
@Autowired @Autowired
private DeptService deptService; private DeptService deptService;
@Override
protected void saveBefore(WindowOwnerEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
entity.setWindowCount(entity.getWindowOwnerDetailList().size());
}
}
@Override
protected void updateBefore(WindowOwnerEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
entity.setWindowCount(entity.getWindowOwnerDetailList().size());
}
}
@Override @Override
protected void saveAfter(WindowOwnerEntity entity, Context context) throws AppException { protected void saveAfter(WindowOwnerEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())){ if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
entity.getWindowOwnerDetailList().stream().peek(item->{ entity.getWindowOwnerDetailList().stream().peek(item -> {
item.setOwnerId(entity.getId()); item.setOwnerId(entity.getId());
item.setCreateUserId(this.getContextUserId(context)); item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date()); item.setCreateTime(new Date());
}).count(); }).count();
DeptEntity deptEntity = deptService.get(entity.getId()); DeptEntity deptEntity = deptService.get(entity.getId());
entity.setDeptName(deptEntity==null?"":deptEntity.getDeptName()); entity.setDeptName(deptEntity == null ? "" : deptEntity.getDeptName());
entity.setNumber(entity.getWindowOwnerDetailList().size()+""); entity.setNumber(entity.getWindowOwnerDetailList().size() + "");
windowOwnerDetailService.save(entity.getWindowOwnerDetailList()); windowOwnerDetailService.save(entity.getWindowOwnerDetailList());
} }
super.saveAfter(entity, context); super.saveAfter(entity, context);
} }
@Override @Override
protected void updateAfter(WindowOwnerEntity entity, Context context) throws AppException { protected void updateAfter(WindowOwnerEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())){ if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
Long[] windowOwnerDetailIds = windowOwnerDetailService.find(new WindowOwnerDetailQuery().ownerId(entity.getId())).stream().map(WindowOwnerDetailEntity::getId).toArray(Long[]::new); Long[] windowOwnerDetailIds = windowOwnerDetailService.find(new WindowOwnerDetailQuery().ownerId(entity.getId())).stream().map(WindowOwnerDetailEntity::getId).toArray(Long[]::new);
windowOwnerDetailService.remove(windowOwnerDetailIds,context); windowOwnerDetailService.remove(windowOwnerDetailIds, context);
entity.getWindowOwnerDetailList().stream().peek(item ->{ entity.getWindowOwnerDetailList().stream().peek(item -> {
item.setOwnerId(entity.getId()); item.setOwnerId(entity.getId());
item.setCreateUserId(this.getContextUserId(context)); item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date()); item.setCreateTime(new Date());
item.setUpdateUserId(this.getContextUserId(context)); item.setUpdateUserId(this.getContextUserId(context));
item.setUpdateTime(new Date()); item.setUpdateTime(new Date());
}).count(); }).count();
entity.setNumber(entity.getWindowOwnerDetailList().size()+""); entity.setNumber(entity.getWindowOwnerDetailList().size() + "");
windowOwnerDetailService.save(entity.getWindowOwnerDetailList()); windowOwnerDetailService.save(entity.getWindowOwnerDetailList());
} }
super.updateAfter(entity, context); super.updateAfter(entity, context);
...@@ -70,7 +91,7 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD ...@@ -70,7 +91,7 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
@Override @Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException { protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
List<WindowOwnerDetailEntity> windowOwnerDetaillist = windowOwnerDetailService.find(new WindowOwnerDetailQuery().ownerIdList(Arrays.asList(ids))); List<WindowOwnerDetailEntity> windowOwnerDetaillist = windowOwnerDetailService.find(new WindowOwnerDetailQuery().ownerIdList(Arrays.asList(ids)));
windowOwnerDetailService.removeList(windowOwnerDetaillist,context); windowOwnerDetailService.removeList(windowOwnerDetaillist, context);
super.removeAfter(ids, context, result); super.removeAfter(ids, context, result);
} }
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<mapper namespace="com.mortals.xhx.module.check.dao.ibatis.CheckAllRecordDaoImpl"> <mapper namespace="com.mortals.xhx.module.check.dao.ibatis.CheckAllRecordDaoImpl">
<select id="getList" parameterType="com.mortals.xhx.module.check.model.CheckAllRecordQuery" resultType="com.mortals.xhx.module.check.model.vo.CheckAllRecordVo"> <select id="getList" parameterType="com.mortals.xhx.module.check.model.CheckAllRecordQuery" resultType="com.mortals.xhx.module.check.model.vo.CheckAllRecordVo">
SELECT * FROM (
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1 SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
...@@ -57,5 +58,64 @@ ...@@ -57,5 +58,64 @@
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if>
) AS a
</select>
<select id="getListCount" parameterType="com.mortals.xhx.module.check.model.CheckAllRecordQuery" resultType="int">
SELECT count(1) FROM (
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_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>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,4 AS checkType ,'effect' AS performType FROM mortals_xhx_check_effect_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>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,6 AS checkType ,'complain' AS performType 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>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,3 AS checkType ,'gowork' AS performType FROM mortals_xhx_check_gowork_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>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,2 AS checkType ,'review' AS performType FROM mortals_xhx_check_review_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>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,5 AS checkType ,'other' AS performType FROM mortals_xhx_check_other_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>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![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>
) AS a
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -641,3 +641,13 @@ CREATE TABLE mortals_xhx_staff_perform_summary( ...@@ -641,3 +641,13 @@ CREATE TABLE mortals_xhx_staff_perform_summary(
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工绩效统计'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工绩效统计';
-- ----------------------------
2023-7-15
-- ----------------------------
ALTER TABLE mortals_xhx_perform_attend_appeal ADD COLUMN `deductPerson` varchar(128) DEFAULT '' COMMENT '扣分人员' AFTER subMethod;
ALTER TABLE mortals_xhx_perform_attend_appeal ADD COLUMN `deductTime` datetime COMMENT '扣分时间' AFTER deductPerson;
ALTER TABLE mortals_xhx_user ADD COLUMN `dingUserId` varchar(64) DEFAULT '' COMMENT '钉钉userId' AFTER customerId;
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