提交 7a235d24 authored 作者: 李秋林's avatar 李秋林

关于计划接口,由用户ID判断权限改为由用户工号判断;根据工号获取人员数据进行补充参数信息

上级 0923f2be
...@@ -4,6 +4,8 @@ import com.wangxiaolu.promotion.common.excel.FileUtils; ...@@ -4,6 +4,8 @@ import com.wangxiaolu.promotion.common.excel.FileUtils;
import com.wangxiaolu.promotion.exception.DataException; import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.exception.ParamException; import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo; import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ManageEmployeeVo;
import com.wangxiaolu.promotion.pojo.user.dto.ManageEmployeeInfoDto;
import com.wangxiaolu.promotion.result.basedata.R; import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode; import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanCoreService; import com.wangxiaolu.promotion.service.activityplanv2.PromPlanCoreService;
...@@ -36,9 +38,15 @@ public class PromPlanCoreController { ...@@ -36,9 +38,15 @@ public class PromPlanCoreController {
@PostMapping("/self/upload") @PostMapping("/self/upload")
public R selfPlan(@RequestBody ActivityPlanVo activityPlanVo) { public R selfPlan(@RequestBody ActivityPlanVo activityPlanVo) {
// 判断当前账号是否是城市经理 // 判断当前账号是否是城市经理
boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeId()); boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeNo());
if (!isSelf) { if (!isSelf) {
throw new DataException(RCode.EMP_PRIVILEGE_ERROR); throw new DataException(RCode.EMP_PRIVILEGE_ERROR);
}else {
ManageEmployeeInfoDto one = manageEmployeeQueryService.findOne(new ManageEmployeeVo().setEmployeeNo(activityPlanVo.getEmployeeNo()));
activityPlanVo.setEmployeeId(one.getId())
.setEmployeeName(one.getName())
.setDeptQcId(one.getDeptQcId())
.setDeptQcName(one.getDeptQcName());
} }
try { try {
...@@ -64,9 +72,15 @@ public class PromPlanCoreController { ...@@ -64,9 +72,15 @@ public class PromPlanCoreController {
@PutMapping("/self/put") @PutMapping("/self/put")
public R selfPlanPut(@RequestBody ActivityPlanVo activityPlanVo) { public R selfPlanPut(@RequestBody ActivityPlanVo activityPlanVo) {
// 判断当前账号是否是城市经理 // 判断当前账号是否是城市经理
boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeId()); boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeNo());
if (!isSelf) { if (!isSelf) {
throw new DataException(RCode.EMP_PRIVILEGE_ERROR); throw new DataException(RCode.EMP_PRIVILEGE_ERROR);
}else {
ManageEmployeeInfoDto one = manageEmployeeQueryService.findOne(new ManageEmployeeVo().setEmployeeNo(activityPlanVo.getEmployeeNo()));
activityPlanVo.setEmployeeId(one.getId())
.setEmployeeName(one.getName())
.setDeptQcId(one.getDeptQcId())
.setDeptQcName(one.getDeptQcName());
} }
try { try {
...@@ -101,9 +115,15 @@ public class PromPlanCoreController { ...@@ -101,9 +115,15 @@ public class PromPlanCoreController {
@PostMapping("/auth/upload") @PostMapping("/auth/upload")
public R authPlan(@RequestBody ActivityPlanVo activityPlanVo) { public R authPlan(@RequestBody ActivityPlanVo activityPlanVo) {
// 判断当前账号是否是城市经理 // 判断当前账号是否是城市经理
boolean isAuth = manageEmployeeQueryService.isAuth(activityPlanVo.getEmployeeId()); boolean isAuth = manageEmployeeQueryService.isAuth(activityPlanVo.getEmployeeNo());
if (!isAuth) { if (!isAuth) {
throw new DataException(RCode.EMP_PRIVILEGE_ERROR); throw new DataException(RCode.EMP_PRIVILEGE_ERROR);
}else {
ManageEmployeeInfoDto one = manageEmployeeQueryService.findOne(new ManageEmployeeVo().setEmployeeNo(activityPlanVo.getEmployeeNo()));
activityPlanVo.setEmployeeId(one.getId())
.setEmployeeName(one.getName())
.setDeptQcId(one.getDeptQcId())
.setDeptQcName(one.getDeptQcName());
} }
try { try {
String[] urlArr = activityPlanVo.getExcelUrl().split("weda-uploader/"); String[] urlArr = activityPlanVo.getExcelUrl().split("weda-uploader/");
......
...@@ -25,7 +25,7 @@ public interface ManageEmployeeInfoDao { ...@@ -25,7 +25,7 @@ public interface ManageEmployeeInfoDao {
void updateAccount(String employeeNo, Integer privilegeId, String status); void updateAccount(String employeeNo, Integer privilegeId, String status);
boolean isOneSelf(Integer employeeId); boolean isOneSelf(String employeeNo);
boolean isAuth(Integer employeeId); boolean isAuth(String employeeNo);
} }
...@@ -88,13 +88,13 @@ public class ManageEmployeeInfoInfoDaoImpl implements ManageEmployeeInfoDao { ...@@ -88,13 +88,13 @@ public class ManageEmployeeInfoInfoDaoImpl implements ManageEmployeeInfoDao {
} }
@Override @Override
public boolean isOneSelf(Integer employeeId) { public boolean isOneSelf(String employeeNo) {
return manageEmployeeInfoMapper.isOneSelf(employeeId); return manageEmployeeInfoMapper.isOneSelf(employeeNo);
} }
@Override @Override
public boolean isAuth(Integer employeeId) { public boolean isAuth(String employeeNo) {
return manageEmployeeInfoMapper.isAuth(employeeId); return manageEmployeeInfoMapper.isAuth(employeeNo);
} }
/** /**
......
...@@ -28,8 +28,8 @@ public interface ManageEmployeeInfoMapper extends BaseMapper<ManageEmployeeInfoD ...@@ -28,8 +28,8 @@ public interface ManageEmployeeInfoMapper extends BaseMapper<ManageEmployeeInfoD
void updatePrivilege(@Param("employeeNo") String employeeNo,@Param("privilegeId") Integer privilegeId); void updatePrivilege(@Param("employeeNo") String employeeNo,@Param("privilegeId") Integer privilegeId);
boolean isOneSelf(Integer employeeId); boolean isOneSelf(@Param("employeeNo") String employeeNo);
boolean isAuth(Integer employeeId); boolean isAuth(@Param("employeeNo") String employeeNo);
} }
......
...@@ -22,7 +22,7 @@ public interface ManageEmployeeQueryService { ...@@ -22,7 +22,7 @@ public interface ManageEmployeeQueryService {
boolean hasByEmpNo(String employeeNo); boolean hasByEmpNo(String employeeNo);
boolean isOneSelf(Integer employeeId); boolean isOneSelf(String employeeNo);
boolean isAuth(Integer employeeId); boolean isAuth(String employeeNo);
} }
...@@ -59,12 +59,12 @@ public class ManageEmployeeQueryServiceImpl implements ManageEmployeeQueryServic ...@@ -59,12 +59,12 @@ public class ManageEmployeeQueryServiceImpl implements ManageEmployeeQueryServic
} }
@Override @Override
public boolean isOneSelf(Integer employeeId) { public boolean isOneSelf(String employeeNo) {
return manageEmployeeInfoDao.isOneSelf(employeeId); return manageEmployeeInfoDao.isOneSelf(employeeNo);
} }
@Override @Override
public boolean isAuth(Integer employeeId) { public boolean isAuth(String employeeNo) {
return manageEmployeeInfoDao.isAuth(employeeId); return manageEmployeeInfoDao.isAuth(employeeNo);
} }
} }
...@@ -70,12 +70,16 @@ ...@@ -70,12 +70,16 @@
<!-- 权限(1:oneself,2:admin)--> <!-- 权限(1:oneself,2:admin)-->
<select id="isOneSelf" resultType="boolean"> <select id="isOneSelf" resultType="boolean">
select count(*) > 0 select count(*) > 0
from manage_employee_ref_privilege where employee_id = #{employeeId} and privilege_id = 1; from manage_employee_info ei
inner join manage_employee_ref_privilege er
on ei.id = er.employee_id and ei.employee_no = #{employeeNo} and ei.status = 0 and er.privilege_id = 1;
</select> </select>
<!-- 权限(1:oneself,2:admin)--> <!-- 权限(1:oneself,2:admin)-->
<select id="isAuth" resultType="boolean"> <select id="isAuth" resultType="boolean">
select count(*) > 0 select count(*) > 0
from manage_employee_ref_privilege where employee_id = #{employeeId} and privilege_id = 2; from manage_employee_info ei
inner join manage_employee_ref_privilege er
on ei.id = er.employee_id and ei.employee_no = #{employeeNo} and ei.status = 0 and er.privilege_id = 2;
</select> </select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论