修改代码,实现功能

master
sikadi 2023-11-24 21:29:13 +08:00
parent b5fa451e12
commit b65ccfd315
3 changed files with 124 additions and 13 deletions

View File

@ -95,7 +95,7 @@ public class FirmController extends BaseController {
}
/**
*
*
* @author: ZhuoXin
* @date: 2023/11/20 10:24
* @param: []
@ -103,9 +103,7 @@ public class FirmController extends BaseController {
**/
@GetMapping("/listAll")
public Result<List<Firm>> listAll() {
LoginUser roleId = SecurityUtils.getLoginUser();
log.info("{}", JSON.toJSONString(roleId));
List<Firm> list = firmService.list();
List<Firm> list = firmService.listAll();
return Result.success(list);
}
@ -138,11 +136,5 @@ public class FirmController extends BaseController {
return result;
}
@GetMapping("/xshen")
private Result xshen(){
Long roleId = SecurityUtils.getLoginUser().getSysUser().getRoleId();
return Result.success(roleId);
}
}

View File

@ -76,4 +76,12 @@ public interface FirmService extends IService<Firm> {
**/
Result manage(Firm firm);
/**
*
* @author: ZhuoXin
* @date: 2023/11/24 20:54
* @param: []
* @return: java.util.List<com.fate.firm.domain.Firm>
**/
List<Firm> listAll();
}

View File

@ -8,11 +8,13 @@ import com.fate.common.core.utils.StringUtils;
import com.fate.common.datasource.annotation.Master;
import com.fate.common.security.utils.SecurityUtils;
import com.fate.common.system.domain.LoginUser;
import com.fate.common.system.domain.SysRole;
import com.fate.firm.domain.Firm;
import com.fate.firm.domain.FirmType;
import com.fate.firm.mapper.FirmMapper;
import com.fate.firm.service.FirmService;
import io.swagger.models.auth.In;
import jdk.jpackage.internal.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
@ -45,7 +47,6 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
**/
@Override
public Result addFirm(Firm firm) {
firm.setCreateBy("1");
if(StringUtils.isEmpty(firm.getFirmName())){
throw new RuntimeException("企业的公司名不能为空");
}
@ -61,16 +62,43 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
if(0 == firm.getFirmType()){
throw new RuntimeException("没有添加类型");
}
//存储用户的id
Long userid = SecurityUtils.getLoginUser().getUserid();
firm.setCreateBy(String.valueOf(userid));
// 创建企业的时间需要进行一个
firm.setCreateTime(new Date());
firm.setFirmStaus(1); // 1提交中 2 审核 3通过 4驳回
// 默认为一
firm.setFirmStaus(1); // 1提交 2 审核 3通过 4驳回
int insert = firmMapper.insert(firm);
return insert > 0 ? Result.success("成功") : Result.error("失败");
}
/**
*
* @author: ZhuoXin
* @date: 2023/11/24 20:50
* @param: [firm]
* @return: com.fate.common.core.domain.Result
**/
@Override
public Result updateFirm(Firm firm) {
firm.setUpdateBy("1");
if(StringUtils.isEmpty(firm.getFirmName())){
throw new RuntimeException("企业的公司名不能为空");
}
if(StringUtils.isEmpty(firm.getFirmAddress())){
throw new RuntimeException("企业的地址不能为空");
}
if(StringUtils.isEmpty(firm.getFirmPhone())){
throw new RuntimeException("企业的电话不能为空");
}
if(StringUtils.isEmpty(firm.getFirmHead())){
throw new RuntimeException("企业的否则人不能为空");
}
if(0 == firm.getFirmType()){
throw new RuntimeException("没有添加类型");
}
Long userid = SecurityUtils.getLoginUser().getUserid();
firm.setUpdateBy(userid.toString());
firm.setUpdateTime(new Date());
firm.setFirmStaus(2);
int i = firmMapper.updateById(firm);
@ -141,5 +169,88 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
return Result.success(roleId);
}
/**
*
*
* @author: ZhuoXin
* @date: 2023/11/24 20:54
* @param: []
* @return: java.util.List<com.fate.firm.domain.Firm>
**/
@Override
public List<Firm> listAll() {
// 所用的roles的角色获取到
List<SysRole> roles = SecurityUtils.getLoginUser().getSysUser().getRoles();
Long role = 0L;
roles.forEach(item -> {
});
return null;
}
/**
{
"expireTime": 1700871913350,
"ipaddr": "10.100.1.1",
"loginTime": 1700828713350,
"permissions": ["*:*:*"],
"roles": ["admin"],
"sysUser": {
"admin": true,
"avatar": "",
"createBy": "admin",
"createTime": 1700071949000,
"delFlag": "0",
"dept": {
"ancestors": "0,100,101",
"children": [],
"deptId": 103,
"deptName": "研发部门",
"leader": "若依",
"orderNum": 1,
"params": {
"@type": "java.util.HashMap"
},
"parentId": 101,
"status": "0"
},
"deptId": 103,
"email": "ry@163.com",
"loginDate": 1700071949000,
"loginIp": "127.0.0.1",
"nickName": "若依",
"params": {
"@type": "java.util.HashMap"
},
"password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
"phonenumber": "15888888888",
"remark": "管理员",
"roles": [{
"admin": true,
"dataScope": "1",
"deptCheckStrictly": false,
"flag": false,
"menuCheckStrictly": false,
"params": {
"@type": "java.util.HashMap"
},
"roleId": 1,
"roleKey": "admin",
"roleName": "超级管理员",
"roleSort": 1,
"status": "0"
}],
"sex": "1",
"status": "0",
"userId": 1,
"userName": "admin"
},
"token": "55383811-9acb-4161-9303-85b17ee270b2",
"userid": 1,
"username": "admin"
}
**/
}