|
@@ -17,6 +17,7 @@ import com.pj.project.tb_district.TbDistrictService;
|
|
import com.pj.project4sp.SP;
|
|
import com.pj.project4sp.SP;
|
|
import com.pj.project4sp.admin.SpAdmin;
|
|
import com.pj.project4sp.admin.SpAdmin;
|
|
import com.pj.project4sp.admin.SpAdminMapper;
|
|
import com.pj.project4sp.admin.SpAdminMapper;
|
|
|
|
+import com.pj.project4sp.admin.SpAdminService;
|
|
import com.pj.project4sp.role.SpRole;
|
|
import com.pj.project4sp.role.SpRole;
|
|
import com.pj.project4sp.role.SpRoleMapper;
|
|
import com.pj.project4sp.role.SpRoleMapper;
|
|
import com.pj.project4sp.role4permission.SpRolePermissionMapper;
|
|
import com.pj.project4sp.role4permission.SpRolePermissionMapper;
|
|
@@ -51,6 +52,8 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
|
|
private TbDistrictService tbDistrictService;
|
|
private TbDistrictService tbDistrictService;
|
|
@Resource
|
|
@Resource
|
|
private SpAdminMapper spAdminMapper;
|
|
private SpAdminMapper spAdminMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private SpAdminService spAdminService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 增
|
|
* 增
|
|
@@ -144,16 +147,32 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
|
|
|
|
|
|
//审核不通过禁用用户
|
|
//审核不通过禁用用户
|
|
int isBan = status == 3 ? 2 : 1;//账号状态(1=正常, 2=禁用)
|
|
int isBan = status == 3 ? 2 : 1;//账号状态(1=正常, 2=禁用)
|
|
- SpAdmin spAdmin = spAdminMapper.getByCostomerId(costomer.getId());
|
|
|
|
- if(spAdmin != null) {
|
|
|
|
- spAdmin.setStatus(isBan);
|
|
|
|
- spAdminMapper.updateCustomerAdmin(costomer.getId(), isBan);
|
|
|
|
|
|
+ List<SpAdmin> spAdminList = spAdminMapper.getByCostomerId(costomer.getId());
|
|
|
|
+ for (SpAdmin spAdmin : spAdminList) {
|
|
|
|
+ if(spAdmin != null) {
|
|
|
|
+ spAdmin.setStatus(isBan);
|
|
|
|
+ spAdminMapper.updateCustomerAdmin(costomer.getId(), isBan);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void register(TbCostomer costomer) {
|
|
public void register(TbCostomer costomer) {
|
|
costomer.setJudgeStatus(1).setStatus(1);
|
|
costomer.setJudgeStatus(1).setStatus(1);
|
|
this.add(costomer);
|
|
this.add(costomer);
|
|
|
|
+
|
|
|
|
+ //新增一个默认用户账号 账号:联系人/密码:手机号后六位
|
|
|
|
+ SpAdmin spAdmin = new SpAdmin();
|
|
|
|
+ spAdmin.setId(0L);
|
|
|
|
+ spAdmin.setCustomerId(costomer.getId());
|
|
|
|
+ spAdmin.setName(costomer.getDutyPeople());
|
|
|
|
+ spAdmin.setPassword(costomer.getPhone().substring(costomer.getPhone().length()-6));
|
|
|
|
+ SoMap so = new SoMap();
|
|
|
|
+ so.put("customerId", costomer.getId());
|
|
|
|
+ List<SpRole> roleList = spRoleMapper.getList(so);
|
|
|
|
+ List<Long> roleIdList = roleList.stream().map(role -> role.getId()).collect(Collectors.toList());
|
|
|
|
+ String roleId = roleIdList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
+ spAdmin.setRoleId(roleId);
|
|
|
|
+ spAdminService.addWhenRegister(spAdmin);
|
|
|
|
+ spAdminMapper.updateCustomerAdmin(costomer.getId(), 2);
|
|
}
|
|
}
|
|
}
|
|
}
|