| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- package com.dk.mdm.service.mst;
- import com.alibaba.fastjson.JSONObject;
- import com.dk.common.exception.BaseBusinessException;
- import com.dk.common.infrastructure.annotaiton.Pagination;
- import com.dk.common.infrastructure.constant.Constant;
- import com.dk.common.infrastructure.enums.ErrorCodeEnum;
- import com.dk.common.model.pojo.PageList;
- import com.dk.common.model.pojo.mst.StaffPurview;
- import com.dk.common.model.pojo.mst.StaffRight;
- import com.dk.common.model.vo.core.StaffEntity;
- import com.dk.common.response.ResponseCodeEnum;
- import com.dk.common.response.ResponseResultUtil;
- import com.dk.common.response.ResponseResultVO;
- import com.dk.mdm.feign.CompanyFeign;
- import com.dk.mdm.feign.UserFeign;
- import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
- import com.dk.mdm.infrastructure.util.AuthUtils;
- import com.dk.mdm.mapper.common.CommonMapper;
- import com.dk.mdm.mapper.mst.*;
- import com.dk.mdm.model.pojo.mst.*;
- import com.dk.common.service.BaseService;
- import com.dk.common.mapper.BaseMapper;
- import com.dk.mdm.model.query.mst.ComMenuQuery;
- import com.dk.mdm.model.query.mst.StaffQuery;
- import com.dk.common.model.response.mst.StaffResponse;
- import com.dk.common.model.vo.mst.StaffVO;
- import com.dk.mdm.model.vo.mst.ComMenuVO;
- import com.dk.mdm.service.common.CommonService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.stereotype.Service;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.util.CollectionUtils;
- import javax.annotation.Resource;
- import java.util.*;
- /**
- * @author : 姜永辉
- * @desc : 员工API接口
- * @date : 2023/1/4 9:25
- */
- @Service
- @Slf4j
- public class StaffService extends BaseService<Staff> {
- @Resource
- private CompanyFeign companyFeign;
- @Resource
- private UserFeign userFeign;
- @Override
- public BaseMapper<Staff> getRepository() {
- return staffMapper;
- }
- /**
- * @desc : 重写主键
- * @author : 姜永辉
- * @date : 2023/1/9 10:39
- */
- @Override
- public String getPrimaryKey() {
- return "staff_id";
- }
- @Autowired
- private StaffMapper staffMapper;
- @Autowired
- private StaffConvert staffConvert;
- @Autowired
- private StaffRightService staffRightService;
- @Autowired
- private StaffPurviewService staffPurviewService;
- @Autowired
- private CommonService commonService;
- @Autowired
- private CommonMapper commonMapper;
- @Autowired
- private ComMenuService comMenuService;
- @Autowired
- private ComMenuMapper comMenuMapper;
- @Autowired
- private SettingValueMapper settingValueMapper;
- @Autowired
- private AuthUtils authUtils;
- @Autowired
- DictionaryDataMapper dictionaryDataMapper;
- @Autowired
- GoodsCategoryMapper goodsCategoryMapper;
- @Autowired
- RoleMapper roleMapper;
- @Autowired
- RoleFunMapper roleFunMapper;
- @Autowired
- UnitMapper unitMapper;
- @Autowired
- SaleChannelMapper saleChannelMapper;
- @Autowired
- WarehouseMapper warehouseMapper;
- @Autowired
- PrintLayoutMapper printLayoutMapper;
- /**
- * @desc : 条件查询
- * @author : 姜永辉
- * @date : 2023/1/9 10:40
- */
- @Pagination
- public ResponseResultVO<PageList<StaffResponse>> selectByCond(StaffQuery staffQuery) {
- // 获取当前公司的cpId
- if (staffQuery.getCpId() == null) {
- Integer cpId = authUtils.getStaff().getCpId();
- staffQuery.setCpId(cpId);
- }
- return super.mergeListWithCount(staffQuery, staffMapper.selectByCond(staffQuery),
- staffMapper.countByCond(staffQuery));
- }
- /**
- * @desc : 保存方法
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<?> insert(StaffVO staffVO) {
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- // 获取当前公司的cpId
- Integer cpId = authUtils.getStaff().getCpId();
- // 校验同一个公司的电话不能重复
- StaffQuery staffQuery = new StaffQuery();
- staffQuery.setStaffPhone(staff.getStaffPhone());
- staffQuery.setCpId(cpId);
- staff.setCpId(cpId);
- List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
- if (staffResponses != null && staffResponses.size() > 0) {
- return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
- }
- staffQuery.setStaffPhone(null);
- staffQuery.setStaffCode(staff.getStaffCode());
- staffResponses = staffMapper.selectByCondByCode(staffQuery);
- if (staffResponses != null && staffResponses.size() > 0) {
- return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_CODE_EXIST);
- }
- // 获取编码和主键UuId
- Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.STAFF.getName(), false);
- staff.setStaffId(codeMap.get("outId").toString());
- // staff.setStaffCode(codeMap.get("outNote").toString());
- super.insert(staff);
- // 讲电话和名称插入微信用户表里
- Map<String, Object> collectQuery = new HashMap<>();
- collectQuery.put("currentCp", staff.getCpId());
- collectQuery.put("userName", staff.getStaffName());
- collectQuery.put("userPhone", staff.getStaffPhone());
- ResponseResultVO<?> resultVO = userFeign.registerFeign(collectQuery);
- Map<String, Object> m = new HashMap<>();
- // 如果没有成功返回,状态设置为待审
- if (resultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
- // 无用户
- throw new BaseBusinessException(ErrorCodeEnum.USER_REGISTER_ERROR.getCode(),
- ErrorCodeEnum.USER_REGISTER_ERROR.getMessage());
- } else {
- m = (Map<String, Object>) resultVO.getData();
- }
- staff.setWxUserId(m.get("userId").toString());
- super.updateByUuid(staff);
- return ResponseResultUtil.success(staff);
- }
- /**
- * @desc : 保存方法
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<?> insertFeignStaff(StaffVO staffVO) {
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- // 校验同一个公司的电话不能重复
- StaffQuery staffQuery = new StaffQuery();
- staffQuery.setCpId(staff.getCpId());
- staffQuery.setStaffPhone(staff.getStaffPhone());
- List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
- if (staffResponses != null && staffResponses.size() > 0) {
- return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
- }
- // 获取编码和主键UuId
- Map<String, Object> codeMap = commonService.getUniqueNoteCode(
- Constant.docNameConstant.STAFF.getName(), staff.getCpId(), true);
- staff.setStaffId(codeMap.get("outId").toString());
- staff.setStaffCode(codeMap.get("outNote").toString());
- super.insert(staff);
- return ResponseResultUtil.success(staff);
- }
- /**
- * @desc : 注册商户时候插入 角色 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因) 计量单位 种类 打印票据 等等。
- * 返回角色的数据
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(rollbackFor = {Exception.class})
- public ResponseResultVO<?> insertFeignCompanyData(Map<String, List<Map<String, Object>>> map) {
- // 公司
- List<Map<String, Object>> listCom = map.get("company");
- // 版本
- String gradeCode = listCom.get(0).get("gradeCode").toString();
- // 角色
- List<Map<String, Object>> listRoles = map.get("roles");
- List<Role> listR = new ArrayList<>();
- String roleid = "";
- Integer cpId = Integer.parseInt(listCom.get(0).get("cpId").toString()) ;
- String staffId = listCom.get(0).get("staffId").toString();
- // 插入常用功能 标准版 插入 销售出库 库存查询 商品档案
- if(Constant.STD.equals(gradeCode)){
- List<String> objectCodeList = new ArrayList<>();
- // 销售出库
- objectCodeList.add("order-out");
- // 库存查询
- objectCodeList.add("ivt-detail-report");
- // 商品档案
- objectCodeList.add("goods");
- ComMenuVO comMenuVO = new ComMenuVO();
- comMenuVO.setCpId(cpId).setStaffId(staffId).setAppCode(Constant.AppCode.WEIXIN.getCode())
- .setObjectCodeList(objectCodeList);
- comMenuMapper.saveByCompany(comMenuVO);
- // 系统参数
- List<SettingValue> settingValueList = new ArrayList<>();
- // 自动办理
- settingValueList.add(new SettingValue().setCpId(cpId).setSettingCode(Constant.SystemConstant.IVT_001.getValue())
- .setSettingValue("true"));
- // 欠货销售
- settingValueList.add(new SettingValue().setCpId(cpId).setSettingCode(Constant.SystemConstant.IVT_002.getValue())
- .setSettingValue("true"));
- settingValueMapper.insertBatch(settingValueList);
- }
- for (int i = 0; i < listRoles.size(); i++) {
- Map<String, Object> m = listRoles.get(i);
- Role role = new Role();
- //设置编码
- Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.ROLE.getName(),cpId, false);
- if (Constant.ROLE_DATA.equals(m.get("roleCode").toString())) {
- roleid = uniqueNoteCode.get("outId").toString();
- }
- role.setRoleId(uniqueNoteCode.get("outId").toString());
- role.setRoleCode(m.get("roleCode").toString());
- role.setRoleName(m.get("roleName").toString());
- role.setDisplayNo((Integer) m.get("displayNo"));
- role.setCpId(cpId);
- role.setOpCreateUserId(m.get("opCreateUserId").toString());
- listR.add(role);
- }
- roleMapper.insertBatch(listR);
- // 更新用户的角色ids-
- List<String> roleids = new ArrayList<>();
- roleids.add(roleid);
- this.updateByUuid(new Staff().setStaffId(staffId).setRoleIds(roleids));
- // 角色权限
- RoleFun roleFun = new RoleFun();
- roleFun.setRoleId(roleid);
- roleFun.setCpId(cpId);
- roleFun.setOpCreateUserId(staffId);
- roleFunMapper.insertRoleFunFeign(roleFun);
- // 仓库
- List<Map<String, Object>> listWarehouses = map.get("warehouses");
- List<Warehouse> listW = new ArrayList<>();
- for (int i = 0; i < listWarehouses.size(); i++) {
- Map<String, Object> m = listWarehouses.get(i);
- Warehouse warehouse = new Warehouse();
- warehouse.setWhCode(m.get("whCode").toString());
- warehouse.setWhName(m.get("whName").toString());
- warehouse.setDisplayNo((Integer) m.get("displayNo"));
- warehouse.setFlgDefault((Boolean) m.get("flgDefault"));
- warehouse.setCpId(cpId);
- warehouse.setOpCreateUserId(m.get("opCreateUserId").toString());
- listW.add(warehouse);
- }
- warehouseMapper.insertBatch(listW);
- // 渠道
- List<Map<String, Object>> listSaleChannels = map.get("saleChannels");
- List<SaleChannel> listSc = new ArrayList<>();
- for (int i = 0; i < listSaleChannels.size(); i++) {
- Map<String, Object> m = listSaleChannels.get(i);
- SaleChannel saleChannel = new SaleChannel();
- saleChannel.setChannelCode(m.get("channelCode").toString());
- saleChannel.setChannelName(m.get("channelName").toString());
- saleChannel.setDisplayNo((Integer) m.get("displayNo"));
- saleChannel.setFlgDefault((Boolean) m.get("flgDefault"));
- saleChannel.setCpId(cpId);
- saleChannel.setOpCreateUserId(m.get("opCreateUserId").toString());
- listSc.add(saleChannel);
- }
- saleChannelMapper.insertBatch(listSc);
- // 基础资料
- List<Map<String, Object>> listDictionaryDatas = map.get("dictionaryDatas");
- List<DictionaryData> listDD = new ArrayList<>();
- for (int i = 0; i < listDictionaryDatas.size(); i++) {
- Map<String, Object> m = listDictionaryDatas.get(i);
- DictionaryData dictionaryData = new DictionaryData();
- dictionaryData.setDictCode(m.get("dictCode").toString());
- dictionaryData.setDataCode(m.get("dataCode").toString());
- dictionaryData.setDataValue(m.get("dataValue").toString());
- dictionaryData.setDisplayNo((Integer) m.get("displayNo"));
- dictionaryData.setFlgDefault((Boolean) m.get("flgDefault"));
- dictionaryData.setCpId(cpId);
- dictionaryData.setOpCreateUserId(m.get("opCreateUserId").toString());
- listDD.add(dictionaryData);
- }
- dictionaryDataMapper.insertBatch(listDD);
- // 计量单位
- List<Map<String, Object>> listUnits = map.get("units");
- List<Unit> listU = new ArrayList<>();
- for (int i = 0; i < listUnits.size(); i++) {
- Map<String, Object> m = listUnits.get(i);
- Unit unit = new Unit();
- unit.setUnitCode(m.get("unitCode").toString());
- unit.setUnitName(m.get("unitName").toString());
- unit.setDecimalPlaces((Integer) m.get("decimalPlaces"));
- unit.setDisplayNo((Integer) m.get("displayNo"));
- unit.setCpId(cpId);
- unit.setOpCreateUserId(m.get("opCreateUserId").toString());
- listU.add(unit);
- }
- unitMapper.insertBatch(listU);
- // 种类
- List<Map<String, Object>> listGoodsCategorys = map.get("goodsCategorys");
- List<GoodsCategory> listG = new ArrayList<>();
- for (int i = 0; i < listGoodsCategorys.size(); i++) {
- Map<String, Object> m = listGoodsCategorys.get(i);
- GoodsCategory goodsCategory = new GoodsCategory();
- goodsCategory.setCatCode(m.get("catCode")+ "");
- goodsCategory.setCatName(m.get("catName")+ "");
- if (m.get("parentId")!=null){
- goodsCategory.setParentId(m.get("parentId")+ "");
- }
- if (m.get("topId")!=null){
- goodsCategory.setTopId(m.get("topId")+ "");
- }
- if (m.get("levelUpper")!=null){
- goodsCategory.setLevelUpper(m.get("levelUpper")+ "");
- }
- if (m.get("levelLower")!=null){
- goodsCategory.setLevelLower(m.get("levelLower")+ "");
- }
- goodsCategory.setLevelLeaf((Boolean) m.get("levelLeaf"));
- goodsCategory.setLevelNo((Integer) m.get("levelNo"));
- goodsCategory.setLevelCode(m.get("levelCode") + "");
- goodsCategory.setLevelName(m.get("levelName") + "");
- goodsCategory.setDisplayNo((Integer) m.get("displayNo"));
- goodsCategory.setCpId(cpId);
- goodsCategory.setOpCreateUserId(m.get("opCreateUserId").toString());
- listG.add(goodsCategory);
- }
- goodsCategoryMapper.insertBatch(listG);
- // 打印票据
- List<Map<String, Object>> listPrintLayout = map.get("printLayout");
- List<PrintLayout> listP = new ArrayList<>();
- for (int i = 0; i < listPrintLayout.size(); i++) {
- Map<String, Object> m = listPrintLayout.get(i);
- PrintLayout printLayout = new PrintLayout();
- printLayout.setLayoutName(m.get("layoutName") + "");
- printLayout.setLayoutData(JSONObject.parseObject(JSONObject.toJSONString(m.get("layoutData"))));
- printLayout.setDisplayNo((Integer) m.get("displayNo"));
- printLayout.setDocName(m.get("docName")+ "" );
- printLayout.setCpId(cpId);
- printLayout.setOpCreateUserId(m.get("opCreateUserId").toString());
- listP.add(printLayout);
- }
- printLayoutMapper.insertBatch(listP);
- return ResponseResultUtil.success();
- }
- /**
- * @desc : 保存方法-邀请员工的确定
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(rollbackFor = {Exception.class})
- public ResponseResultVO<?> insertRequestStaff(StaffVO staffVO) {
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- // 校验同一个公司的电话不能重复
- StaffQuery staffQuery = new StaffQuery();
- staffQuery.setCpId(staff.getCpId());
- staffQuery.setStaffPhone(staff.getStaffPhone());
- List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
- if (staffResponses != null && staffResponses.size() > 0) {
- return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
- }
- // 获取编码和主键UuId
- Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.STAFF.getName(), true);
- staff.setStaffId(codeMap.get("outId").toString());
- staff.setStaffCode(codeMap.get("outNote").toString());
- // 更新 被邀人员的cpid
- if (staff.getWxUserId() != null) {
- // 更新 被邀请人员的微信用户的cpid 加入公司
- Map<String, Object> collectQuery = new HashMap<>();
- collectQuery.put("cpId", staff.getCpId());
- collectQuery.put("userId", staff.getWxUserId());
- companyFeign.updateWxUserCompany(collectQuery);
- }
- // 插入员工
- super.insert(staff);
- return ResponseResultUtil.success(staff);
- }
- /**
- * @desc : 编辑方法
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<Boolean> update(StaffVO staffVO) {
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- return super.updateByUuid(staff);
- }
- /**
- * @desc : 保存权限方法
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<?> saveStaffRight(StaffVO staffVO) {
- // 获取当前公司的cpId
- Integer cpId = authUtils.getStaff().getCpId();
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- staffRightService.delete(staffVO.getStaffId());
- for (StaffRight staffRight : staffVO.getStaffRightList()) {
- staffRight.setStaffId(staff.getStaffId());
- staffRight.setRightType(1);
- staffRight.setCpId(cpId);
- }
- if (staffVO.getStaffRightList() != null && staffVO.getStaffRightList().size() > 0) {
- staffRightService.saveStaffRight(staffVO.getStaffRightList());
- }
- return ResponseResultUtil.success();
- }
- /**
- * @desc : 保存权限方法
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<?> saveStaffPurview(StaffVO staffVO) {
- // 获取当前公司的cpId
- Integer cpId = authUtils.getStaff().getCpId();
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- for (StaffPurview staffRight : staffVO.getStaffPurviewList()) {
- staffRight.setStaffId(staff.getStaffId());
- staffRight.setCpId(cpId);
- }
- staffPurviewService.saveStaffPurview(staffVO.getStaffPurviewList());
- return ResponseResultUtil.success();
- }
- /**
- * @desc : 员工离职
- * @author : 姜永辉
- * @date : 2023/2/13 13:45
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<Boolean> dimission(StaffVO staffVO) {
- // 将微信的用户的信息 openid current_cp , "joined_cps" 缩减相应的cpid
- // 更新 被邀请人员的微信用户的cpid 加入公司
- Map<String, Object> collectQuery = new HashMap<>();
- // 获取当前公司的cpId
- Integer cpId = authUtils.getStaff().getCpId();
- collectQuery.put("cpId", cpId);
- collectQuery.put("userId", staffVO.getWxUserId());
- ResponseResultVO<?> resultVO = userFeign.updateClearOpenidFeign(collectQuery);
- // 如果没有成功返回,状态设置为待审
- if (resultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
- // 无用户
- throw new BaseBusinessException(ErrorCodeEnum.STAFF_UPDATE_ERROR.getCode(),
- ErrorCodeEnum.STAFF_UPDATE_ERROR.getMessage());
- }
- // 转化实体
- Staff staff = staffConvert.convertToPo(staffVO);
- super.updateByUuid(staff);
- return ResponseResultUtil.success();
- }
- /**
- * @desc : 导入员工
- * @author : 姜永辉
- * @date : 2023/3/1 14:40
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<Boolean> importStaffList(List<StaffVO> list) {
- if (CollectionUtils.isEmpty(list) || list.size() == 0) {
- return ResponseResultUtil.error(ResponseCodeEnum.INSERT_FAIL);
- }
- return ResponseResultUtil.success();
- }
- /**
- * @desc : 登录后获取信息
- * @author : 周兴
- * @date : 2024/3/4 11:41
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<Dictionary<String, Object>> getInfoAfterLogin(Map<String, Object> param) {
- // 先根据userId查询当前企业的员工信息
- StaffResponse staff = staffMapper.selectByUserId(param.get("userId").toString(), Integer.parseInt(param.get("cpId").toString()));
- if (staff != null) {
- // 提示不允许登录
- if(staff.getFlgCanLogin() == null || !staff.getFlgCanLogin()){
- return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.STAFF_CAN_NOT_LOGIN.getMessage());
- }
- // 离职状态不允许登录
- if(staff.getHrStatus() != 1){
- return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.STAFF_OUT_NOT_LOGIN.getMessage());
- }
- // 存Redis
- authUtils.saveStaff(new StaffEntity().setStaffId(staff.getStaffId())
- .setWxUserId(staff.getWxUserId())
- .setStaffCode(staff.getStaffCode())
- .setStaffName(staff.getStaffName())
- .setCpId(Integer.parseInt(param.get("cpId").toString()))
- .setAppCode(param.get("appCode").toString()));
- // 更新员工登录状态
- this.updateByUuid(new Staff().setStaffId(staff.getStaffId()).setFlgCanLogin(true));
- } else {
- return ResponseResultUtil.error(ErrorCodeEnum.STAFF_NOT_EXIST.getCode(), ErrorCodeEnum.STAFF_NOT_EXIST.getMessage());
- }
- // 获取菜单
- List menuList = commonMapper.getMenuByUser(param);
- // 获取常用菜单
- ResponseResultVO<?> comMenuList = comMenuService.selectMenu(new ComMenuQuery().setStaffId(staff.getStaffId())
- .setAppCode(param.get("appCode").toString()));
- // 获取所有参数
- Map<String, Object> allSettingValue = commonMapper.getAllSettingValue();
- Dictionary<String, Object> dic = new Hashtable<>();
- dic.put("menuList", menuList);
- dic.put("comMenuList", comMenuList.getData());
- dic.put("dataKindList", commonMapper.getDataKind(param));
- dic.put("settingValue", allSettingValue);
- dic.put("staff", staff);
- return ResponseResultUtil.success(dic);
- }
- /**
- * @desc : 退出登录
- * @author : 周兴
- * @date : 2024-03-18 09:03
- */
- @Transactional(
- rollbackFor = {Exception.class}
- )
- public ResponseResultVO<Boolean> logout(Map<String, Object> param) {
- // 更新员工登录状态
- this.updateByUuid(new Staff().setStaffId(param.get("staffId").toString()).setFlgCanLogin(false));
- return ResponseResultUtil.success(true);
- }
- }
|