Commit 323edcd4 authored by 周健威's avatar 周健威

修改我的接单状态

parent ae0e72d1
......@@ -53,6 +53,9 @@ public class DefaultKeyGenerator extends IKeyGenerator {
if (express.length > 1) {
String field = express[1];
value = ReflectionUtils.getFieldValue(value, field);
if (value == null || value.equals("null")) {
value = "";
}
}
if (isFirst) {
......
......@@ -102,6 +102,9 @@ public class User {
@Column(name = "biz_type")
private Integer bizType;
@Column(name = "is_del")
private Integer isDel;
private String attr1;
private String attr2;
......@@ -121,5 +124,4 @@ public class User {
@Transient
private List<Integer> companyIds;
}
\ No newline at end of file
......@@ -51,6 +51,10 @@ public interface UserRestInterface {
}
}
default UserDTO getAdminUserInfoV2() {
return getAdminUserInfoV2(Boolean.TRUE);
}
default void checkAdminUser(){
if(null == getAdminUserInfo()) {
throw new BaseException(ResultCode.NOTEXIST_CODE);
......
......@@ -169,6 +169,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
user.setPassword(password);
user.setStatus(1);
user.setCorporationId(branchId);
user.setCompanyId(companyInfo.getId().intValue());
user.setDataAll(2);
user.setDataCorporation(branchId+"");
user.setAppUserId(appUserId);
......
package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.github.pagehelper.Page;
......@@ -33,6 +35,8 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_TRUE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
/**
* ${DESCRIPTION}
......@@ -85,9 +89,20 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
public User getUserByUsername(String username){
User user = new User();
user.setUsername(username);
user.setIsDel(SYS_FALSE);
return mapper.selectOne(user);
}
// /**
// * 根据用户名获取用户信息
// * @param userId
// * @return
// */
// @Cache(key="user{1}")
// public User getUserByUserId(Integer userId){
// return mapper.selectByPrimaryKey(userId);
// }
public TableResultResponse<BaseUserVo> selectPage(Query query, User currentUser) {
List<BaseUserVo> userVos=new ArrayList<>();
List<User> list =new ArrayList<>();
......@@ -180,11 +195,23 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
return mapper.select(user);
}
public List<User> getCountByUsernameBiz(String username, Integer bizType){
User user = new User();
user.setUsername(username);
user.setBizType(bizType);
return mapper.select(user);
public List<User> getCountByUsernameBiz(String username, Integer bizType, String mobilePhone){
// User user = new User();
// user.setUsername(username);
// user.setBizType(bizType);
// user.setStatus(SYS_TRUE);
// user.setIsDel(SYS_FALSE);
// return mapper.select(user);
return selectByWeekend(w -> {
w.andEqualTo(User::getUsername, username);
w.andEqualTo(User::getBizType, bizType);
w.andEqualTo(User::getIsDel, SYS_FALSE);
w.andEqualTo(User::getStatus, SYS_TRUE);
if(StrUtil.isNotBlank(mobilePhone)) {
w.andEqualTo(User::getMobilePhone, mobilePhone);
}
return w;
});
}
public User getUserByUid(Integer userId){
......
......@@ -46,6 +46,7 @@ public class CurrentController {
public @ResponseBody
BaseResponse getGroups() throws Exception {
String username = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getUniqueName();
//String userIdStr = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId();
if (username == null) {
throw new Exception();
}
......
......@@ -46,7 +46,7 @@ public class ElementController extends BaseController<ElementBiz, Element> {
@RequestMapping(value = "/user", method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<Element> getAuthorityElement(String menuId) {
int userId = userBiz.getUserByUsername(getCurrentUserName()).getId();
int userId = getCurrentUserIdInt();
List<Element> elements = baseBiz.getAuthorityElementByUserId(userId + "",menuId);
return new ObjectRestResponse<List<Element>>().data(elements);
}
......@@ -54,7 +54,7 @@ public class ElementController extends BaseController<ElementBiz, Element> {
@RequestMapping(value = "/user/menu", method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<Element> getAuthorityElement() {
int userId = userBiz.getUserByUsername(getCurrentUserName()).getId();
int userId = getCurrentUserIdInt();
List<Element> elements = baseBiz.getAuthorityElementByUserId(userId + "");
return new ObjectRestResponse<List<Element>>().data(elements);
}
......
......@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.admin.biz.MenuBiz;
import com.github.wxiaoqi.security.admin.biz.UserBiz;
import com.github.wxiaoqi.security.admin.entity.Element;
import com.github.wxiaoqi.security.admin.entity.Menu;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.admin.vo.AuthorityMenuTree;
import com.github.wxiaoqi.security.admin.vo.MenuTree;
import com.github.wxiaoqi.security.common.rest.BaseController;
......@@ -102,7 +103,8 @@ public class MenuController extends BaseController<MenuBiz, Menu> {
@RequestMapping(value = "/user/authorityTree", method = RequestMethod.GET)
@ResponseBody
public List<MenuTree> listUserAuthorityMenu(Integer parentId){
int userId = userBiz.getUserByUsername(getCurrentUserName()).getId();
int userId = getCurrentUserIdInt();
try {
if (parentId == null) {
parentId = this.getSystem().get(0).getId();
......@@ -116,7 +118,7 @@ public class MenuController extends BaseController<MenuBiz, Menu> {
@RequestMapping(value = "/user/system", method = RequestMethod.GET)
@ResponseBody
public List<Menu> listUserAuthoritySystem() {
int userId = userBiz.getUserByUsername(getCurrentUserName()).getId();
int userId = getCurrentUserIdInt();
return baseBiz.getUserAuthoritySystemByUserId(userId);
}
......
......@@ -66,6 +66,7 @@ public class PublicController {
public @ResponseBody
ObjectRestResponse userinfoByToken(String token) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
//String userIdStr = userAuthUtil.getInfoFromToken(token).getId();
if (username == null) {
return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
}
......@@ -80,6 +81,7 @@ public class PublicController {
public @ResponseBody
ObjectRestResponse userinfoByTokenV2(String token,boolean flag) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
//String userIdStr = userAuthUtil.getInfoFromToken(token).getId();
if (username == null) {
return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
}
......
......@@ -16,9 +16,13 @@ import com.github.wxiaoqi.security.admin.vo.MenuTree;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.ReflectionUtils;
import com.github.wxiaoqi.security.common.vo.DataInterBean;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -26,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.util.List;
import static com.github.wxiaoqi.security.admin.entity.User.BIZ_TYPE_BUSINESS;
......@@ -33,6 +38,7 @@ import static com.github.wxiaoqi.security.admin.entity.User.BIZ_TYPE_OPERATE;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_TRUE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.github.wxiaoqi.security.common.util.process.ResultCode.PARAM_ILLEGAL_CODE;
/**
* ${DESCRIPTION}
......@@ -103,7 +109,7 @@ public class ChwUserController extends CommonBaseController implements UserRestI
vo.setBizType(BIZ_TYPE_OPERATE);
vo.setStatus(SYS_TRUE);
if (StringUtils.isNotBlank(username)) {
List<User> list = userBiz.getCountByUsernameBiz(username, BIZ_TYPE_OPERATE);
List<User> list = userBiz.getCountByUsernameBiz(username, BIZ_TYPE_OPERATE, null);
if (list.size() > 0) {
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
......@@ -120,11 +126,16 @@ public class ChwUserController extends CommonBaseController implements UserRestI
String username = vo.getUsername();
vo.setBizType(BIZ_TYPE_BUSINESS);
vo.setStatus(SYS_TRUE);
vo.setCorporationId(getAdminUserInfoV2().getCorporationId());
vo.setCompanyId(getAdminUserInfoV2().getCompanyId());
if (StringUtils.isNotBlank(username)) {
List<User> list = userBiz.getCountByUsernameBiz(username, BIZ_TYPE_BUSINESS);
List<User> list = userBiz.getCountByUsernameBiz(username, BIZ_TYPE_BUSINESS, vo.getMobilePhone());
if (list.size() > 0) {
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
}else {
throw new BaseException("手机号已被使用", PARAM_ILLEGAL_CODE);
}
userBiz.insertSelective(vo);
//添加权限关系
......@@ -162,6 +173,15 @@ public class ChwUserController extends CommonBaseController implements UserRestI
return new ObjectRestResponse<User>();
}
@RequestMapping(value = "/business/{id}", method = RequestMethod.DELETE)
@ResponseBody
public ObjectRestResponse businessRemove(@PathVariable int id) {
del(new User(){{
setId(id);
}});
return new ObjectRestResponse<User>();
}
private void handleDataLimit(@RequestBody UserController.UserVO dto) {
if (null != dto.getDataLimit()) {
dto.setDataCompany("");
......@@ -179,4 +199,18 @@ public class ChwUserController extends CommonBaseController implements UserRestI
}
}
}
private void del(User entity) {
Field field = ReflectionUtils.getAccessibleField(entity, "isDel");
Field field2 = ReflectionUtils.getAccessibleField(entity, "delete");
if(null != field) {
ReflectionUtils.setFieldValue(entity,"isDel",1);
}
if(null != field2) {
ReflectionUtils.setFieldValue(entity,"delete",1);
}
userBiz.updateSelectiveById(entity);
}
}
......@@ -73,6 +73,7 @@ public class PermissionService {
User user = userBiz.selectOne(new User(){{
setUsername(username);
setBizType(bizType);
setIsDel(0);
}});
if (user!=null){
if (encoder.matches(password, user.getPassword())) {
......@@ -170,9 +171,11 @@ public class PermissionService {
public FrontUser getUserInfo(String token) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
//String userIdStr = userAuthUtil.getInfoFromToken(token).getId();
if (username == null) {
return null;
}
// Integer userId = Integer.valueOf(userIdStr);
UserInfo user = this.getUserByUsername(username);
FrontUser frontUser = new FrontUser();
BeanUtils.copyProperties(user, frontUser);
......@@ -190,6 +193,7 @@ public class PermissionService {
public List<MenuTree> getMenusByUsername(String token,String state) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
//String userIdStr = userAuthUtil.getInfoFromToken(token).getId();
if (username == null) {
return null;
}
......
......@@ -71,6 +71,7 @@
LEFT JOIN company_info i ON c.company_id=i.id
LEFT JOIN company_info ci ON u.corporation_id=ci.id
<where>
u.is_del = 0
<if test="bizType != null">
and u.biz_type = #{bizType}
</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