|
@@ -898,7 +898,19 @@ public class WmDaAgentController {
|
|
Integer mahSettleDeptId = null;
|
|
Integer mahSettleDeptId = null;
|
|
if (Boolean.TRUE.equals(wmDaAgent.getMahSettleFlag())) {
|
|
if (Boolean.TRUE.equals(wmDaAgent.getMahSettleFlag())) {
|
|
// 如果是允许结算,则保存当前药企deptId
|
|
// 如果是允许结算,则保存当前药企deptId
|
|
- mahSettleDeptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
|
|
+ if (SecurityUtils.getUser().getDeptId().equals(1)) {
|
|
|
|
+ // 如果当前企业是平台,则查询上级药企
|
|
|
|
+ WmDaAgent agent = wmDaAgentMapper.selectById(wmDaAgent.getId());
|
|
|
|
+ List<SysDeptRelation> relations = sysDeptRelationMapper.selectList(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
+ .eq(SysDeptRelation::getDescendant, agent.getDeptId())
|
|
|
|
+ .notIn(SysDeptRelation::getAncestor, 1, agent.getDeptId()));
|
|
|
|
+ if (CollUtil.isNotEmpty(relations)) {
|
|
|
|
+ mahSettleDeptId = relations.get(0).getAncestor();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ // 如果当前企业是药企, 则取当前企业deptId
|
|
|
|
+ mahSettleDeptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return R.ok(wmDaAgentService.update(Wrappers.<WmDaAgent>lambdaUpdate()
|
|
return R.ok(wmDaAgentService.update(Wrappers.<WmDaAgent>lambdaUpdate()
|