修改了企业管理员的问题

This commit is contained in:
chenze 2025-05-07 09:59:27 +08:00
parent fa4a9d311b
commit 9db76e7dcc
6 changed files with 15 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.wf.jwtp.annotation.RequiresPermissions;
import org.wf.jwtp.util.SubjectUtil;
import java.util.ArrayList;
import java.util.Collections;
@ -131,7 +132,15 @@ public class CustomerController extends BaseController {
public R list(Customer customer) {
startPage();
customer.setDeleteFlag(0);
System.out.println(this.getLoginCustomerId());
// this.get
boolean isAdmin = SubjectUtil.hasRole(getRequest(),"admin");
if (isAdmin){
customer.setCustomerId(Long.valueOf(this.getLoginCustomerId()));
}
List<Customer> customers = customerService.selectCustomerList(customer);
for (Customer customer1 : customers) {
Long tenantId = customer1.getTenantId();
Tenant tenant = tenantService.selectTenantById(tenantId);

View File

@ -137,7 +137,6 @@ public class CustomerStaffController extends BaseController {
if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
}
icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
}

View File

@ -435,5 +435,7 @@ public class Customer extends BaseEntity<Customer> {
@TableField(exist = false)
private String buildingName;
private Long customerId;
}

View File

@ -28,6 +28,7 @@ public interface CustomerMapper extends BaseMapper<Customer> {
* @param customer 客户管理
* @return 客户管理集合
*/
List<Customer> selectCustomerList(Customer customer);

View File

@ -113,6 +113,7 @@
<if test="deleteFlag != null"> and ic.delete_flag = #{deleteFlag} </if>
<if test="parkId != null and parkId != '' "> and ic.park_id = #{parkId} </if>
<if test="tenantId != null and tenantId != '' "> and ic.tenant_id = #{tenantId} </if>
<if test="customerId != null and customerId != '' "> and ic.id = #{customerId} </if>
</where>
order by ic.create_time desc
</select>

View File

@ -131,12 +131,12 @@ public class BaseController {
* 获取企业id
* @return
*/
public Long getLoginCustomerId() {
public Integer getLoginCustomerId() {
Token token = SubjectUtil.getToken(getRequest());
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
if (jo != null && jo.containsKey("customerId")) {
return (Long)jo.get("customerId");
return (Integer)jo.get("customerId");
}
return null;
}