|
@@ -1233,6 +1233,36 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
ArrayList<String> clientList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(listA)){
|
|
|
for (CwFinanceImportDTO cwFinanceImportDTO : listA) {
|
|
|
+ // 1. 报告号和项目编号校验
|
|
|
+ if (StringUtils.isBlank(cwFinanceImportDTO.getReportNo()) && StringUtils.isBlank(cwFinanceImportDTO.getProjectNo())) {
|
|
|
+ return "报告号和项目编号不能同时为空";
|
|
|
+ }
|
|
|
+ // 4. 开票内容必填
|
|
|
+ if (StringUtils.isBlank(cwFinanceImportDTO.getBillingContent())) {
|
|
|
+ return "开票内容不能为空";
|
|
|
+ }
|
|
|
+ // 5. 邮箱校验
|
|
|
+ if (StringUtils.isNotBlank(cwFinanceImportDTO.getActualDrawerEmailAddress()) &&
|
|
|
+ !EMAIL_PATTERN.matcher(cwFinanceImportDTO.getActualDrawerEmailAddress()).matches()) {
|
|
|
+ return "接收邮箱格式不正确";
|
|
|
+ }
|
|
|
+ // 6.单位名称校验
|
|
|
+ if (StringUtils.isBlank(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
+ return "单位名称不能为空";
|
|
|
+ }
|
|
|
+ //发票类型校验
|
|
|
+ if (StringUtils.isBlank(cwFinanceImportDTO.getType())){
|
|
|
+ return "发票类型不能为空";
|
|
|
+ }
|
|
|
+ //开票类型校验
|
|
|
+ if (StringUtils.isBlank(cwFinanceImportDTO.getBillingType())){
|
|
|
+ return "开票类型不能为空";
|
|
|
+ }
|
|
|
+ //银行名称校验
|
|
|
+ if ("专票".equals(cwFinanceImportDTO.getType()) && "企业开票".equals(cwFinanceImportDTO.getBillingType()) && StringUtils.isBlank(cwFinanceImportDTO.getOpenBank())){
|
|
|
+ return "发票类型为专票且开票类型为企业开票下的开户银行名称不能为空";
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(cwFinanceImportDTO.getProjectNo())){
|
|
|
projectNoList.add(cwFinanceImportDTO.getProjectNo());
|
|
|
}
|
|
@@ -1258,10 +1288,6 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(listA)){
|
|
|
for (CwFinanceImportDTO cwFinanceImportDTO : listA) {
|
|
|
- // 1. 报告号和项目编号校验
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getReportNo()) && StringUtils.isBlank(cwFinanceImportDTO.getProjectNo())) {
|
|
|
- return "报告号和项目编号不能同时为空";
|
|
|
- }
|
|
|
|
|
|
// 2. 项目开票金额校验
|
|
|
if (StringUtils.isNotBlank(cwFinanceImportDTO.getBaseAccount())){
|
|
@@ -1281,46 +1307,21 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
if (StringUtils.isNotBlank(cwFinanceInvoiceDTO.getAccount())){
|
|
|
double parseDouble = Double.parseDouble(cwFinanceInvoiceDTO.getAccount());
|
|
|
if (parseDouble < 0){
|
|
|
- return "关联红字发票编号——"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+"的开票金额为负,请重新填写关联红字发票编号";
|
|
|
+ return "关联红字发票编号:"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+" 的开票金额为负,请重新填写关联红字发票编号";
|
|
|
}
|
|
|
}else {
|
|
|
- return "关联红字发票编号——"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+"的开票金额为空,请重新填写关联红字发票编号";
|
|
|
+ return "关联红字发票编号:"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+" 的开票金额为空,请重新填写关联红字发票编号";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- return "关联红字发票编号——"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+"不是当前登录人所创建,请重新填写";
|
|
|
+ return "关联红字发票编号:"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+" 不是当前登录人所创建,请重新填写";
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
return "项目开票金额不能为空";
|
|
|
}
|
|
|
|
|
|
- // 4. 开票内容必填
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getBillingContent())) {
|
|
|
- return "开票内容不能为空";
|
|
|
- }
|
|
|
- // 5. 邮箱校验
|
|
|
- if (StringUtils.isNotBlank(cwFinanceImportDTO.getActualDrawerEmailAddress()) &&
|
|
|
- !EMAIL_PATTERN.matcher(cwFinanceImportDTO.getActualDrawerEmailAddress()).matches()) {
|
|
|
- return "接收邮箱格式不正确";
|
|
|
- }
|
|
|
- // 6.单位名称校验
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
- return "单位名称不能为空";
|
|
|
- }
|
|
|
- //发票类型校验
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getType())){
|
|
|
- return "发票类型不能为空";
|
|
|
- }
|
|
|
- //开票类型校验
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getBillingType())){
|
|
|
- return "开票类型不能为空";
|
|
|
- }
|
|
|
- //银行名称校验
|
|
|
- if ("专票".equals(cwFinanceImportDTO.getType()) && "企业开票".equals(cwFinanceImportDTO.getBillingType()) && StringUtils.isBlank(cwFinanceImportDTO.getOpenBank())){
|
|
|
- return "发票类型为专票且开票类型为企业开票下的开户银行名称不能为空";
|
|
|
- }
|
|
|
//发票类型校验
|
|
|
// if ("专票".equals(cwFinanceImportDTO.getType()) && "企业开票".equals(cwFinanceImportDTO.getBillingType()) && StringUtils.isNotBlank(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
// //根据单位查询客户信息
|
|
@@ -1382,8 +1383,8 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
String invoiceBillingContentDatas = SpringUtil.getBean ( IDictApi.class ).getDictValueListMapByDict ("invoice_billing_content");
|
|
|
Map<String,Object> invoiceBillingContentValueDTOs = JSON.parseObject(invoiceBillingContentDatas, new TypeReference<Map<String,Object>>() {});
|
|
|
|
|
|
- //获取所有人信息
|
|
|
- List<UserDTO> allUserInfo = SpringUtil.getBean(IUserApi.class).getAllUserInfo();
|
|
|
+ //根据当前登录人所属部门查询不同的人员信息
|
|
|
+ List<UserDTO> allUserInfo = findUserByTenantId(userDTO);
|
|
|
//区域
|
|
|
List<AreaDTO> areaDTOList = cwFinanceInvoiceMapper.getAllArea();
|
|
|
List<AreaDTO> buildTree = buildTree(areaDTOList);
|
|
@@ -1415,7 +1416,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- return "项目编号——"+cwFinanceImportDTO.getProjectNo()+"不是当前登录人所创建或该项目下存在报告,请重新填写";
|
|
|
+ return "项目编号:"+cwFinanceImportDTO.getProjectNo()+" 不是当前登录人所创建或该项目下存在报告,请重新填写";
|
|
|
}
|
|
|
}
|
|
|
if ((StringUtils.isNotBlank(cwFinanceImportDTO.getReportNo()) && StringUtils.isBlank(cwFinanceImportDTO.getProjectNo())) ||(StringUtils.isNotBlank(cwFinanceImportDTO.getReportNo()) && StringUtils.isNotBlank(cwFinanceImportDTO.getProjectNo()))){
|
|
@@ -1432,7 +1433,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- return "报告号——"+cwFinanceImportDTO.getReportNo()+"不是当前登录人所创建,请重新填写";
|
|
|
+ return "报告号:"+cwFinanceImportDTO.getReportNo()+" 不是当前登录人所创建,请重新填写";
|
|
|
}
|
|
|
}
|
|
|
//开票金额
|
|
@@ -1561,7 +1562,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
.findFirst();
|
|
|
cwFinanceInvoice.setBillingPeopleReal(matchedUser.get());
|
|
|
}else {
|
|
|
- return "实际开票人——"+cwFinanceImportDTO.getBillingPeopleRealName()+"不存在,请重新填写";
|
|
|
+ return "实际开票人:"+cwFinanceImportDTO.getBillingPeopleRealName()+" 不存在或不在可选择的人员列表中,请重新填写";
|
|
|
}
|
|
|
}else {
|
|
|
cwFinanceInvoice.setBillingPeopleReal(userDTO.getId());
|
|
@@ -1576,7 +1577,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
.findFirst();
|
|
|
cwFinanceInvoice.setReconciliationPeople(matchedUser.get());
|
|
|
}else {
|
|
|
- return "对账人——"+cwFinanceImportDTO.getReconciliationPeopleName()+"不存在,请重新填写";
|
|
|
+ return "对账人:"+cwFinanceImportDTO.getReconciliationPeopleName()+" 不存在或不在可选择的人员列表中,请重新填写";
|
|
|
}
|
|
|
}else {
|
|
|
cwFinanceInvoice.setReconciliationPeople(userDTO.getId());
|
|
@@ -1587,7 +1588,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
if (StringUtils.isNotBlank(lastLevelCode)){
|
|
|
cwFinanceInvoice.setReconciliationArea(lastLevelCode);
|
|
|
}else {
|
|
|
- return "对账地区——"+cwFinanceImportDTO.getReconciliationArea()+"不正确,请重新填写";
|
|
|
+ return "对账地区:"+cwFinanceImportDTO.getReconciliationArea()+" 不正确,请重新填写";
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1649,15 +1650,9 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public String findLastLevelCode(List<AreaDTO> areaDTOList, String reconciliationArea) {
|
|
|
// 按 "-" 拆分层级
|
|
|
String[] split = reconciliationArea.split("-");
|
|
@@ -1705,4 +1700,75 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
return rootList;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据当前登录人的公司查询对应的人员信息
|
|
|
+ * @param userDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<UserDTO> findUserByTenantId(UserDTO userDTO) {
|
|
|
+
|
|
|
+ //查询综合管理公司用户信息
|
|
|
+ List<UserDTO> userList1=cwFinanceInvoiceMapper.findZhglgsUserList();
|
|
|
+ //获取当前登录人所属公司的人员
|
|
|
+ List<UserDTO> dtoList=cwFinanceInvoiceMapper.findDtoList(userDTO.getTenantDTO().getId());
|
|
|
+
|
|
|
+ ArrayList<UserDTO> treeUserDtos = new ArrayList<>();
|
|
|
+ treeUserDtos.addAll(userList1);
|
|
|
+ treeUserDtos.addAll(dtoList);
|
|
|
+
|
|
|
+ String zsOfficeName = "";
|
|
|
+ if (userDTO != null && userDTO.getOfficeDTO() != null && StringUtils.isNotBlank(userDTO.getOfficeDTO().getName())){
|
|
|
+ if (userDTO.getOfficeDTO().getName().contains("审计一部")){
|
|
|
+ //获取中审公司的张宁部门
|
|
|
+ zsOfficeName = "张宁部门";
|
|
|
+ }else if (userDTO.getOfficeDTO().getName().contains("审计二部") ){
|
|
|
+ //获取中审公司的孙文宝部门
|
|
|
+ zsOfficeName = "孙文宝部门";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询中审公司用户信息
|
|
|
+ if (null != userDTO && null != userDTO.getOfficeDTO() && StringUtils.isNotBlank(userDTO.getOfficeDTO().getName()) && (userDTO.getOfficeDTO().getName().contains("审计一部") || userDTO.getOfficeDTO().getName().contains("审计二部"))){
|
|
|
+ List<UserDTO> zsUserList=cwFinanceInvoiceMapper.findZsUserList(zsOfficeName);
|
|
|
+ treeUserDtos.addAll(zsUserList);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null != userDTO && null != userDTO.getOfficeDTO() && StringUtils.isNotBlank(userDTO.getOfficeDTO().getId()) && ("1826176524081065985".equals(userDTO.getOfficeDTO().getId()) || "1826176609011527681".equals(userDTO.getOfficeDTO().getId()))) {
|
|
|
+ //查询会计公司用户信息
|
|
|
+ List<UserDTO> userList2 = cwFinanceInvoiceMapper.findCwglgsUserList();
|
|
|
+ treeUserDtos.addAll(userList2);
|
|
|
+ }
|
|
|
+
|
|
|
+ ArrayList<UserDTO> treeUsers = new ArrayList<>();
|
|
|
+ //如果当前登录人角色是多公司报销则查询全部公司
|
|
|
+ if (CollectionUtil.isNotEmpty(userDTO.getRoleDTOList())){
|
|
|
+ for (RoleDTO roleDTO : userDTO.getRoleDTOList()) {
|
|
|
+ RoleDTO roleDTOById = SpringUtil.getBean(IRoleApi.class).getRoleDTOById(roleDTO.getId());
|
|
|
+ if (null != roleDTOById && (roleDTOById.getEnName().equals("dgsbx")|| roleDTOById.getEnName().equals("zjbry"))){
|
|
|
+ List<UserDTO> users=cwFinanceInvoiceMapper.finduserAllList();
|
|
|
+ treeUsers.addAll(users);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //管理员则查询全部人员
|
|
|
+ if (userDTO.isAdmin()){
|
|
|
+ List<UserDTO> users=cwFinanceInvoiceMapper.finduserAllList();
|
|
|
+ treeUsers.addAll(users);
|
|
|
+ }
|
|
|
+
|
|
|
+ treeUserDtos.addAll(treeUsers);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //去重
|
|
|
+ List<UserDTO> newList = treeUserDtos.stream().filter(new HashSet<>()::add)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return newList;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|