数据权限的bug修改
This commit is contained in:
+17
@@ -28,6 +28,8 @@ import javax.annotation.Resource;
|
|||||||
import com.mhd.common.core.web.controller.BaseController;
|
import com.mhd.common.core.web.controller.BaseController;
|
||||||
import com.mhd.common.core.web.domain.AjaxResult;
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
import com.mhd.common.core.web.page.TableDataInfo;
|
import com.mhd.common.core.web.page.TableDataInfo;
|
||||||
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
|
import com.mhd.system.api.model.LoginUser;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,6 +101,21 @@ public class ExpenseAccountApi extends BaseController{
|
|||||||
public AjaxResult selectOtherExpenseAccount(SearchExpenseAccountDTO searchExpenseAccountDTO){
|
public AjaxResult selectOtherExpenseAccount(SearchExpenseAccountDTO searchExpenseAccountDTO){
|
||||||
SearchExpenseAccountDO searchExpenseAccountDO = new SearchExpenseAccountDO();
|
SearchExpenseAccountDO searchExpenseAccountDO = new SearchExpenseAccountDO();
|
||||||
BeanUtils.copyProperties(searchExpenseAccountDTO,searchExpenseAccountDO);
|
BeanUtils.copyProperties(searchExpenseAccountDTO,searchExpenseAccountDO);
|
||||||
|
|
||||||
|
// 数据权限:根据组织ID实现数据隔离
|
||||||
|
// organizationId=2827(南光)时,查询所有组织的数据;其他组织只查询自己的数据
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (loginUser != null && loginUser.getOrganizationPo() != null) {
|
||||||
|
Long loginUserOrganizationId = loginUser.getOrganizationPo().getOrganizationId();
|
||||||
|
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
|
||||||
|
// 南光组织(organizationId=2827):可以查询所有组织的数据,不设置 organizationId 过滤条件
|
||||||
|
searchExpenseAccountDO.setOrganizationId(null);
|
||||||
|
} else {
|
||||||
|
// 其他组织:只查询自己组织的数据
|
||||||
|
searchExpenseAccountDO.setOrganizationId(loginUserOrganizationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return AjaxResult.success(expenseAccountApplicationService.selectOtherExpenseAccount(searchExpenseAccountDO));
|
return AjaxResult.success(expenseAccountApplicationService.selectOtherExpenseAccount(searchExpenseAccountDO));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,15 @@
|
|||||||
<if test="searchExpenseAccountDO.societyStatus != null ">
|
<if test="searchExpenseAccountDO.societyStatus != null ">
|
||||||
and a.society_status = #{searchExpenseAccountDO.societyStatus}
|
and a.society_status = #{searchExpenseAccountDO.societyStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 -->
|
||||||
|
<!-- 如果 organizationId 为 null,表示查询所有组织的数据(不添加组织过滤条件) -->
|
||||||
|
<if test="searchExpenseAccountDO.organizationId != null">
|
||||||
|
<!-- 如果设置了 organizationId,添加 organization_id 条件 -->
|
||||||
|
and a.organization_id = #{searchExpenseAccountDO.organizationId}
|
||||||
|
and a.organization_name IS NOT NULL
|
||||||
|
and a.organization_name != ''
|
||||||
|
and LENGTH(TRIM(a.organization_name)) > 0
|
||||||
|
</if>
|
||||||
and a.del_flag=1
|
and a.del_flag=1
|
||||||
order by show_seq
|
order by show_seq
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
+58
-1
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.linke.finance.domain.accountManage.entity.AccountCashWallet;
|
import com.linke.finance.domain.accountManage.entity.AccountCashWallet;
|
||||||
import com.linke.finance.domain.accountManage.service.AccountCashWalletDomainService;
|
import com.linke.finance.domain.accountManage.service.AccountCashWalletDomainService;
|
||||||
import com.linke.finance.domain.auditConfiguration.repository.todo.AuditConfigurationDO;
|
import com.linke.finance.domain.auditConfiguration.repository.todo.AuditConfigurationDO;
|
||||||
@@ -1406,7 +1407,20 @@ public class BusinessDocumentApplicationService {
|
|||||||
|
|
||||||
BusinessDocumentDetaliDTO detailDto = new BusinessDocumentDetaliDTO();
|
BusinessDocumentDetaliDTO detailDto = new BusinessDocumentDetaliDTO();
|
||||||
BeanUtils.copyProperties(detail,detailDto);
|
BeanUtils.copyProperties(detail,detailDto);
|
||||||
detailDto.setAuditRemark(businessDocumentDetaliDO.getAuditRemark());
|
|
||||||
|
// 确保关键字段的类型正确,避免 TMS 端类型转换错误
|
||||||
|
// 确保 auditRemark 是字符串类型,不为 null(使用最新的审核备注)
|
||||||
|
String auditRemark = businessDocumentDetaliDO.getAuditRemark();
|
||||||
|
if (auditRemark == null) {
|
||||||
|
auditRemark = "";
|
||||||
|
}
|
||||||
|
// 显式设置为字符串类型,确保类型正确
|
||||||
|
detailDto.setAuditRemark(auditRemark);
|
||||||
|
|
||||||
|
// 确保其他关键字段也是正确的类型(虽然已经通过 copyProperties 复制,但显式设置更安全)
|
||||||
|
detailDto.setAuditStatus(detail.getAuditStatus());
|
||||||
|
detailDto.setAuditType(detail.getAuditType());
|
||||||
|
|
||||||
businessDocumentDetailDtoList.add(detailDto);
|
businessDocumentDetailDtoList.add(detailDto);
|
||||||
//车辆维修单同步工时费申请状态
|
//车辆维修单同步工时费申请状态
|
||||||
if(businessDocumentDetaliDO.getAuditStatus()==2||businessDocumentDetaliDO.getAuditStatus()==3){
|
if(businessDocumentDetaliDO.getAuditStatus()==2||businessDocumentDetaliDO.getAuditStatus()==3){
|
||||||
@@ -1443,6 +1457,49 @@ public class BusinessDocumentApplicationService {
|
|||||||
}
|
}
|
||||||
//推送数据到tms:审核通过修改单据状态为【待付款】,审核拒绝修改状态为【已拒绝】并处理相关逻辑
|
//推送数据到tms:审核通过修改单据状态为【待付款】,审核拒绝修改状态为【已拒绝】并处理相关逻辑
|
||||||
if(businessDocumentDetailDtoList.size()>0){
|
if(businessDocumentDetailDtoList.size()>0){
|
||||||
|
// 记录传递给 TMS 的数据,便于调试
|
||||||
|
log.info("准备同步TMS业务单据信息,数据条数:{}", businessDocumentDetailDtoList.size());
|
||||||
|
for (int i = 0; i < Math.min(businessDocumentDetailDtoList.size(), 3); i++) {
|
||||||
|
BusinessDocumentDetaliDTO dto = businessDocumentDetailDtoList.get(i);
|
||||||
|
log.info("同步TMS业务单据信息示例[{}]:businessDocumentDetaliId={}, auditStatus={}, auditStatus类型={}, auditRemark={}, auditRemark类型={}, auditRemark值={}",
|
||||||
|
i, dto.getBusinessDocumentDetaliId(), dto.getAuditStatus(),
|
||||||
|
dto.getAuditStatus() != null ? dto.getAuditStatus().getClass().getName() : "null",
|
||||||
|
dto.getAuditRemark(), dto.getAuditRemark() != null ? dto.getAuditRemark().getClass().getName() : "null",
|
||||||
|
dto.getAuditRemark());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 最后一次验证:确保所有 auditRemark 都是字符串类型
|
||||||
|
for (BusinessDocumentDetaliDTO dto : businessDocumentDetailDtoList) {
|
||||||
|
if (dto.getAuditRemark() == null) {
|
||||||
|
dto.setAuditRemark("");
|
||||||
|
} else if (!(dto.getAuditRemark() instanceof String)) {
|
||||||
|
// 如果不是字符串类型,转换为字符串
|
||||||
|
log.warn("发现 auditRemark 不是字符串类型:{},类型:{},将转换为字符串",
|
||||||
|
dto.getAuditRemark(), dto.getAuditRemark().getClass().getName());
|
||||||
|
dto.setAuditRemark(String.valueOf(dto.getAuditRemark()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过 JSON 序列化和反序列化确保类型正确,避免类型转换问题
|
||||||
|
try {
|
||||||
|
String jsonString = JSON.toJSONString(businessDocumentDetailDtoList);
|
||||||
|
log.debug("同步TMS业务单据信息,JSON序列化结果长度:{}", jsonString.length());
|
||||||
|
List<BusinessDocumentDetaliDTO> deserializedList = JSON.parseArray(jsonString, BusinessDocumentDetaliDTO.class);
|
||||||
|
log.debug("JSON反序列化后,数据条数:{}", deserializedList.size());
|
||||||
|
// 验证反序列化后的 auditRemark 类型
|
||||||
|
for (int i = 0; i < Math.min(deserializedList.size(), 3); i++) {
|
||||||
|
BusinessDocumentDetaliDTO dto = deserializedList.get(i);
|
||||||
|
if (dto.getAuditRemark() != null && !(dto.getAuditRemark() instanceof String)) {
|
||||||
|
log.warn("JSON反序列化后,auditRemark 类型不正确:{},将强制转换为字符串",
|
||||||
|
dto.getAuditRemark().getClass().getName());
|
||||||
|
dto.setAuditRemark(String.valueOf(dto.getAuditRemark()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
businessDocumentDetailDtoList = deserializedList;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("JSON序列化/反序列化失败,使用原始数据:{}", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
AjaxResult ajaxResult = wlhyServiceFeign.syncBusinessDocumentInfo(businessDocumentDetailDtoList);
|
AjaxResult ajaxResult = wlhyServiceFeign.syncBusinessDocumentInfo(businessDocumentDetailDtoList);
|
||||||
if (null != ajaxResult && !"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
if (null != ajaxResult && !"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
log.error("同步TMS业务单据信息失败:" + ajaxResult.get("msg"));
|
log.error("同步TMS业务单据信息失败:" + ajaxResult.get("msg"));
|
||||||
|
|||||||
+38
-1
@@ -111,9 +111,46 @@ public class BusinessDocumentDetaliApplicationService {
|
|||||||
if (StringUtils.isNotBlank(businessDocumentDetaliDO.getWaybillNumbers())){
|
if (StringUtils.isNotBlank(businessDocumentDetaliDO.getWaybillNumbers())){
|
||||||
businessDocumentDetaliDO.setWaybillNumberList(Arrays.asList(businessDocumentDetaliDO.getWaybillNumbers().split(",")));
|
businessDocumentDetaliDO.setWaybillNumberList(Arrays.asList(businessDocumentDetaliDO.getWaybillNumbers().split(",")));
|
||||||
}
|
}
|
||||||
businessDocumentDetaliDO.setOrganizationId(loginUser.getOrganizationPo().getOrganizationId());
|
|
||||||
|
// 数据权限:根据组织ID实现数据隔离
|
||||||
|
// organizationId=2827(南光)时,可以查询所有组织的数据,也可以条件查询特定组织;其他组织只查询自己的数据
|
||||||
|
Long loginUserOrganizationId = loginUser.getOrganizationPo().getOrganizationId();
|
||||||
|
// 保存前端传递的 organizationId(如果有的话)
|
||||||
|
Long frontendOrganizationId = businessDocumentDetaliDO.getOrganizationId();
|
||||||
|
|
||||||
|
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
|
||||||
|
// 南光组织(organizationId=2827):可以查询所有组织的数据
|
||||||
|
// 如果前端传递了 organizationId,使用前端传递的值进行过滤(条件查询特定组织)
|
||||||
|
// 如果前端没有传递 organizationId,设置为 null 查询所有组织的数据
|
||||||
|
if (frontendOrganizationId != null) {
|
||||||
|
// 前端传递了 organizationId,使用前端传递的值进行过滤
|
||||||
|
businessDocumentDetaliDO.setOrganizationId(frontendOrganizationId);
|
||||||
|
} else {
|
||||||
|
// 前端没有传递 organizationId,设置为 null 查询所有组织的数据
|
||||||
|
businessDocumentDetaliDO.setOrganizationId(null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 其他组织:只查询自己组织的数据,忽略前端传递的 organizationId(安全考虑)
|
||||||
|
businessDocumentDetaliDO.setOrganizationId(loginUserOrganizationId);
|
||||||
|
}
|
||||||
|
|
||||||
//businessDocumentDetaliDO.setAuditStatus(0);//查询未审核的
|
//businessDocumentDetaliDO.setAuditStatus(0);//查询未审核的
|
||||||
List<BusinessDocumentDetaliAuditPO> businessDocumentDetaliAuditPOS = businessDocumentDetaliDomainService.auditList(businessDocumentDetaliDO);
|
List<BusinessDocumentDetaliAuditPO> businessDocumentDetaliAuditPOS = businessDocumentDetaliDomainService.auditList(businessDocumentDetaliDO);
|
||||||
|
|
||||||
|
// 前端回显:根据 organizationId 设置对应的 organizationName
|
||||||
|
businessDocumentDetaliAuditPOS.forEach(e -> {
|
||||||
|
if (e.getOrganizationId() != null) {
|
||||||
|
Long orgId = e.getOrganizationId();
|
||||||
|
if (java.util.Objects.equals(orgId, 2827L)) {
|
||||||
|
e.setOrganizationName("南光");
|
||||||
|
} else if (java.util.Objects.equals(orgId, 2830L)) {
|
||||||
|
e.setOrganizationName("通宇");
|
||||||
|
} else if (java.util.Objects.equals(orgId, 2839L)) {
|
||||||
|
e.setOrganizationName("南岐");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// businessDocumentDetaliAuditPOS.forEach(e->{
|
// businessDocumentDetaliAuditPOS.forEach(e->{
|
||||||
// if (e.getService() != null && e.getAmount() != null){
|
// if (e.getService() != null && e.getAmount() != null){
|
||||||
// e.setTotalAmount(e.getAmount().add(e.getService()));
|
// e.setTotalAmount(e.getAmount().add(e.getService()));
|
||||||
|
|||||||
+15
-15
@@ -146,21 +146,21 @@ public class ReconciliationApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<ReconciliationPO> reconciliationPOS = reconciliationDomainService.queryList(reconciliationDO);
|
// List<ReconciliationPO> reconciliationPOS = reconciliationDomainService.queryList(reconciliationDO);
|
||||||
for (ReconciliationPO reconciliationPO : reconciliationPOS) {
|
// for (ReconciliationPO reconciliationPO : reconciliationPOS) {
|
||||||
Long reconciliationId = reconciliationPO.getReconciliationId();
|
// Long reconciliationId = reconciliationPO.getReconciliationId();
|
||||||
AjaxResult tmsOrderSettlementDetails = wlhyServiceFeign.getById(reconciliationId);
|
// AjaxResult tmsOrderSettlementDetails = wlhyServiceFeign.getById(reconciliationId);
|
||||||
Map<String,Object> result = (Map<String,Object>)tmsOrderSettlementDetails.get("result");
|
// Map<String,Object> result = (Map<String,Object>)tmsOrderSettlementDetails.get("result");
|
||||||
if (ObjectUtil.isNotEmpty( result)){
|
// if (ObjectUtil.isNotEmpty( result)){
|
||||||
Integer receiptIdstr = (Integer)result.get("receiptId");
|
// Integer receiptIdstr = (Integer)result.get("receiptId");
|
||||||
Long receiptId = receiptIdstr.longValue();
|
// Long receiptId = receiptIdstr.longValue();
|
||||||
TmsReceipt tmsReceipt = tmsReceiptMapper.selectById(receiptId);
|
// TmsReceipt tmsReceipt = tmsReceiptMapper.selectById(receiptId);
|
||||||
if (tmsReceipt != null) {
|
// if (tmsReceipt != null) {
|
||||||
reconciliationPO.setSettlementCurrency(tmsReceipt.getSettlementCurrency());
|
// reconciliationPO.setSettlementCurrency(tmsReceipt.getSettlementCurrency());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return reconciliationPOS;
|
// return reconciliationPOS;
|
||||||
|
|
||||||
return reconciliationDomainService.queryList(reconciliationDO);
|
return reconciliationDomainService.queryList(reconciliationDO);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user