Commit e4ab355e by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-auth into developer
parents 4c039c6b ca176f3e
......@@ -30,6 +30,13 @@ public interface UserApiService {
ServiceResponse editUser(UserDTO userDTO);
/**
* 编辑超级管理员
* @param userDTO
* @return
*/
ServiceResponse<Void> editAdmin(UserDTO userDTO);
/**
* 用户详情
* @Title: getUserById

* @Description:
......
......@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
......@@ -37,6 +38,7 @@ public class UserServiceImpl implements UserService {
@Override
public void editUser(UserDTO userDTO) {
TabSysUser tabUser = EntityUtil.changeEntityNew(TabSysUser.class, userDTO);
tabUser.setUpdateTime(new Date());
tabSysUserMapper.updateByPrimaryKeySelective(tabUser);
}
......
......@@ -3,12 +3,16 @@ package com.gic.auth.service.outer.impl;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.entity.*;
import com.gic.auth.entity.TabAuditor;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.AuditorListQO;
import com.gic.auth.service.*;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.dto.ProjectItemDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.qo.ProjectItemQO;
......@@ -59,7 +63,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
private ServiceUserApiService serviceUserApiService;
@Autowired
private UserService userService;
// 服务号APPKEY
public static final String APPKEY = "wxc6fd9beaf9a9dbe9";
@Override
......@@ -249,15 +253,34 @@ public class AuditorApiServiceImpl implements AuditorApiService {
@Override
public ServiceResponse<Void> genAuditProject(Integer projectItemId, Integer userId, Integer enterpriseId) {
ServiceResponse<List<AuditorDTO>> serviceResponse = this.listAuditorByProject(projectItemId, userId, enterpriseId);
if (serviceResponse.isSuccess()) {
List<AuditorDTO> auditorList = serviceResponse.getResult();
ServiceResponse<List<AuditorDTO>> auditorServiceResponse = this.listAuditorByProject(projectItemId, userId, enterpriseId);
if (!auditorServiceResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorServiceResponse.getCode(), auditorServiceResponse.getMessage());
}
ServiceResponse<ProjectItemDTO> projectItemService = projectItemApiService.getById(projectItemId);
if (!projectItemService.isSuccess()) {
return EnterpriseServiceResponse.failure(projectItemService.getCode(), projectItemService.getMessage());
}
List<AuditorDTO> auditorList = auditorServiceResponse.getResult();
for (AuditorDTO auditorDTO : auditorList) {
// todo 发送微信模板消息
// todo 如果审核员是管理员 插入后台待办事项
return ServiceResponse.success();
} else {
return EnterpriseServiceResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
// sendWxMessage();
if (auditorDTO.getUserId() != null) {
TabSysUser user = userService.getUserById(auditorDTO.getUserId());
if (user != null) {
// todo 如果审核员是管理员 插入后台待办事项
// saveToDoList();
}
}
}
ProjectItemDTO projectItemDTO = projectItemService.getResult();
if (Constants.NORMAL_STATUS.equals(projectItemDTO.getIsPlatform())) {
// todo 如果是平台审批项, 还要发送给实施
// sendWxMessage();
}
return ServiceResponse.success();
}
private String getTempQrCodeUrl(Integer auditorId) {
......@@ -289,4 +312,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
}
}
public static void main(String[] args) {
System.out.println(1);
}
}
......@@ -17,6 +17,7 @@ import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.UserDetail;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.redis.data.util.RedisUtil;
import com.gic.store.utils.valid.ValidUtil;
import org.apache.commons.collections.CollectionUtils;
......@@ -139,7 +140,6 @@ public class UserApiServiceImpl implements UserApiService {
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("86");
}
userDTO.setUpdateTime(new Date());
userService.editUser(userDTO);
userRoleService.deleteByUserId(userDTO.getUserId());
......@@ -157,6 +157,25 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public ServiceResponse<Void> editAdmin(UserDTO userDTO) {
//超级官员
TabSysUser adminUser = userService
.getUserByEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseId());
if (adminUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "超级管理员不存在,操作有误");
}
if (userDTO.getPasswordType().intValue() == 2) {
//如果是自定义密码
if (StringUtils.isBlank(userDTO.getPassword())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "密码为空,操作有误");
}
}
userDTO.setUserId(adminUser.getUserId());
userService.editUser(userDTO);
return ServiceResponse.success();
}
@Override
public ServiceResponse<UserDTO> getUserById(Integer userId) {
TabSysUser tabUser = userService.getUserById(userId);
if (tabUser == null) {
......@@ -271,7 +290,7 @@ public class UserApiServiceImpl implements UserApiService {
public ServiceResponse<UserDetail> getUserDetail(String token) {
String key = Constants.TOKEN_KEY + token;
Object cache = RedisUtil.getCache(key);
if(cache == null){
if (cache == null) {
return ServiceResponse.success();
}
return ServiceResponse.success((UserDetail) cache);
......
......@@ -23,6 +23,7 @@ import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.store.dto.StoreWidgetDTO;
import com.gic.store.service.StoreWidgetApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -55,25 +56,29 @@ public class ResourceController {
if(storeWidgetResponse.isSuccess()){
resourceDTO.setStoreResource(storeWidgetResponse.getResult().longValue());
// 订单资源
List<OrderResourceQO> orderResource = resourceQO.getOrderResourceJSON();
JSONArray orderResourceArray = new JSONArray();
for (OrderResourceQO orderResourceQO : orderResource) {
List<Integer> storeIds;
if (OrderResourceChannelEnum.OFFLINE.getCode().equals(orderResourceQO.getChannel())) {
ServiceResponse<Integer> widgetResponse = saveStoreWidget(orderResourceQO.getStoreResouceJSON());
Integer storeId = widgetResponse.getResult();
storeIds = Collections.singletonList(storeId);
} else {
storeIds = orderResourceQO.getStoreContent();
if (CollectionUtils.isNotEmpty(resourceQO.getOrderResourceJSON())) {
List<OrderResourceQO> orderResource = resourceQO.getOrderResourceJSON();
JSONArray orderResourceArray = new JSONArray();
for (OrderResourceQO orderResourceQO : orderResource) {
List<Integer> storeIds;
if (OrderResourceChannelEnum.OFFLINE.getCode().equals(orderResourceQO.getChannel())) {
ServiceResponse<Integer> widgetResponse = saveStoreWidget(orderResourceQO.getStoreResouceJSON());
Integer storeId = widgetResponse.getResult();
storeIds = Collections.singletonList(storeId);
} else {
storeIds = orderResourceQO.getStoreContent();
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("channel", orderResourceQO.getChannel());
jsonObject.put("storeContent", storeIds);
orderResourceArray.add(jsonObject);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("channel", orderResourceQO.getChannel());
jsonObject.put("storeContent", storeIds);
orderResourceArray.add(jsonObject);
resourceDTO.setOrderResourceJson(JSON.toJSONString(orderResourceArray));
}
resourceDTO.setOrderResourceJson(JSON.toJSONString(orderResourceArray));
// 应用资源
resourceDTO.setAppResourceJson(JSON.toJSONString(resourceQO.getAppResourceJSON()));
if (CollectionUtils.isNotEmpty(resourceQO.getAppResourceJSON())) {
resourceDTO.setAppResourceJson(JSON.toJSONString(resourceQO.getAppResourceJSON()));
}
ServiceResponse<Integer> response = resourceApiService.saveOrUpdateResource(resourceDTO);
if(response.isSuccess()){
......
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