|
@@ -30,6 +30,7 @@ import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
|
|
|
import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
|
|
|
import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
|
|
|
import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
|
|
|
+import org.jeecg.ctop.finance.policy.service.impl.CwjsSaleAssistantInfoServiceImpl;
|
|
|
import org.jeecg.ctop.finance.policy.utils.Check;
|
|
|
import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
|
|
|
import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSlettementReport;
|
|
@@ -82,6 +83,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
@Resource
|
|
|
private SysLogMapper sysLogMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CwjsSaleAssistantInfoServiceImpl cwjsSaleAssistantInfoService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
|
|
@@ -276,30 +280,30 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
String uploadYears = paramsVo.getUploadYears();
|
|
|
//1:区分媒体(头条:1 快手:2)
|
|
|
Integer mediaId = paramsVo.getMediaId();
|
|
|
-
|
|
|
String roleCode = roleMapper.getRoleCodeByUserId(user.getId());
|
|
|
Set<String>sales = new HashSet<>();
|
|
|
+ List<String> userIds = new ArrayList<>();
|
|
|
List<UserAllocation>allocations ;
|
|
|
if("admin".equals(roleCode)|| "finance".equals(roleCode)){
|
|
|
//查询所有可用的账户
|
|
|
- }else if("saleDirector".equals(roleCode)){
|
|
|
- //查询自己下辖的所有销售绑定的账户
|
|
|
- sales = materialReportOverViewService.recursiveQuerySubordinate(paramsVo.getCreateUserId());
|
|
|
- }else if("saleAssistant".equals(roleCode)|| "sale".equals(roleCode)|| "saleAm".equals(roleCode)){
|
|
|
- //查询自己名绑定下的账户
|
|
|
- sales.add(user.getId());
|
|
|
- }
|
|
|
- if(sales.isEmpty()){
|
|
|
sales = null;
|
|
|
+ }else {
|
|
|
+ //查询 销售及助理 关联对应的人员
|
|
|
+ userIds = cwjsSaleAssistantInfoService.getCwSaleAndAssistantListStr(user.getId());
|
|
|
+ sales.addAll(new HashSet<>(userIds));
|
|
|
}
|
|
|
- List<String> settlementAccountList = reportSettlementMapper.getAccountIdBytedance(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId());
|
|
|
- allocations = userAllocationMapper.getAccountInfoBySalesId(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId());
|
|
|
+ //查询财务模块中已上传的账户
|
|
|
+ List<String> settlementAccountList = reportSettlementMapper.getAccountIdBytedance(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId(),paramsVo.getProjectId());
|
|
|
+ //查询已绑定账户
|
|
|
+ allocations = userAllocationMapper.getAccountInfoBySalesId(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId(),paramsVo.getProjectId());
|
|
|
return mergeAccountId(settlementAccountList,allocations,uploadYears);
|
|
|
}
|
|
|
|
|
|
+ //账户处理
|
|
|
private List<String> mergeAccountId(List<String> settlementAccountList, List<UserAllocation> allocations,String downloadYear) {
|
|
|
List<String>salesAccount = new ArrayList<>();
|
|
|
- for(UserAllocation allocation:allocations){
|
|
|
+ // 账户状态 0 启动 1 禁用
|
|
|
+ for(UserAllocation allocation : allocations){
|
|
|
if(allocation.getAccountStatus() == 0){
|
|
|
salesAccount.add(allocation.getAccountId()+"");
|
|
|
}
|
|
@@ -313,6 +317,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //去重
|
|
|
settlementAccountList.removeAll(salesAccount);
|
|
|
settlementAccountList.addAll(salesAccount);
|
|
|
return settlementAccountList;
|