diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtInvoicePoolController.java b/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtInvoicePoolController.java index d82b57e1..50de9d91 100644 --- a/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtInvoicePoolController.java +++ b/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtInvoicePoolController.java @@ -109,10 +109,14 @@ public class ExtInvoicePoolController extends AbstractController { int curr = (int)pramsMap.get("curr"); int size = (int)pramsMap.get("size"); String companyCode = (String) pramsMap.get("companyCode"); + List companyCodes = getUserInfo().getCompanyCodes(); if (StringHelper.isNotBlank(companyCode) && "99".equals(companyCode)){ - pramsMap.put("companyCodes",getUserInfo().getCompanyCodes()); - log.info("组织机构====>{}",pramsMap.get("companyCodes")); + pramsMap.put("companyCodes",companyCodes); + log.info("组织机构====>{}",companyCodes); } + + gfshList = extInvoicePoolService.getGfshList(gfshList,companyCodes); + pramsMap.put("gfsh", gfshList); try { return ResponseEntity.ok(R.ok().put("data", extInvoicePoolService.listAddTax(pramsMap, curr, size))); } catch (Exception e) { diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/dao/SysAuthDao.java b/dxhy-extend/src/main/java/com/dxhy/extend/dao/SysAuthDao.java new file mode 100644 index 00000000..67acde68 --- /dev/null +++ b/dxhy-extend/src/main/java/com/dxhy/extend/dao/SysAuthDao.java @@ -0,0 +1,112 @@ +package com.dxhy.extend.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dxhy.extend.entity.SysDeptEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 部门管理 + * + * @author jiaohongyang + */ +@Mapper +public interface SysAuthDao extends BaseMapper { + /** + * 根据集团编码查询税号 + * + * @author 陈刚扬 + * @date 2020/12/4 + * @param company + * @param orgType + * @return java.util.List + */ + List selectDeptByCompany(@Param("company") String company, @Param("orgType") String orgType); + + /** + * 根据集团编码查询部门信息 + * + * @param company + * 集团编码 + * @return 部门信息 + */ + List queryList(@Param("company") String company); + + /** + * 根据集团编码查询用户关联部门信息 + * + * @param company + * 集团编码 + * @return 部门信息 + */ + List queryListUser(@Param("company") String company); + + /** + * 根据集团编码查询上级部门信息 + * + * @param company + * 集团编码 + * @return 部门信息 + */ + List queryListParent(@Param("company") String company); + + /** + * 查询子部门ID列表 + * + * @param parentId + * 上级部门ID + * @return 部门信息 + */ + List queryDetpIdList(@Param("parentId") Long parentId); + + /** + * 根据上级ID查询部门信息 + * + * @param parentId + * 集团编码 + * @return 部门信息 + */ + List queryDeptParentId(@Param("parentId") Long parentId); + + /** + * 获取部门信息 + * + * @return 部门信息 + */ + List queryDeptList(); + + /** + * 根据集团编码修改部分信息 + * + * @param company + * 集团编码 + * @param isCollext + * 是否采集 + * @param aceKey + * key + * @param aceId + * id + * @param dbName + * 数据库 + * @param qsStatus + * 签收状态 + */ + void updateDeptCompany(@Param("company") String company, @Param("isCollext") String isCollext, + @Param("aceKey") String aceKey, @Param("aceId") String aceId, @Param("dbName") String dbName, + @Param("qsStatus") String qsStatus); + + List getOrgCodeList(Long userId); + + /** + * 查询id与税号对应list + * + * @return 部门信息 + */ + List queryTaxnoList(); + + List queryParentIdList(); + +} + diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/entity/SysDeptEntity.java b/dxhy-extend/src/main/java/com/dxhy/extend/entity/SysDeptEntity.java new file mode 100644 index 00000000..81ad4c47 --- /dev/null +++ b/dxhy-extend/src/main/java/com/dxhy/extend/entity/SysDeptEntity.java @@ -0,0 +1,109 @@ +package com.dxhy.extend.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 部门管理 + * + * @author jiaohongyang + */ +@Data +@TableName("sys_dept") +public class SysDeptEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 部门ID + */ + @TableId + private String deptId; + /** + * 上级部门ID,一级部门为0 + */ + private String parentId; + /** + * 部门名称 + */ + private String name; + /** + * 上级部门名称 + */ + @TableField(exist = false) + private String parentName; + private Integer orderNum; + + private String taxno; + private String taxname; + private String linkman; + private String phone; + private String address; + private String bank; + private String account; + private String company; + private String orgType; + private String deptType; + private String upgradeStatus; + + /** + * 是否查验 0-- 不查验 1---查验 + */ + private String checkStatus; + /** + * 是否采集状态 0 -- 不采集 1--采集 + */ + private String cjStatus; + /** + * 是否签收认证 0 -- 不签收认证 1 -- 签收认证 + */ + private String qsStatus; + /** + * 所选数据库名称 + */ + private String dbName; + + /** + * 兼容大企业平台添加 + */ + private String aceKey; + /** + * 兼容大企业平台添加 + */ + private String aceId; + /** + * 是否采集全票面 0-- 不采集全票面 1--采集全票面 + */ + private String isCollext; + /** + * 机构编码 + */ + private String orgCode; + /** + * 地区编码 + */ + private String areaCode; + /** + * 是否需要确认密码 + */ + private String isPassword; + /** + * 确认密码 + */ + private String password; + + private Date updateTime; + + private Date createTime; + + private String autoRz; + + private String productType; + @TableField(exist = false) + private List children; +} diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolService.java b/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolService.java index 8365106e..149d2dd6 100644 --- a/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolService.java +++ b/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolService.java @@ -1,5 +1,6 @@ package com.dxhy.extend.service.pool; +import java.util.List; import java.util.Map; import com.dxhy.common.service.MpBaseService; @@ -62,4 +63,6 @@ public interface ExtInvoicePoolService extends MpBaseService { Object incentiveFlagList(String dbName); Object selectPullRecord(PullRecordReq pullRecordReq); + + List getGfshList(List gfshList, List companyCode); } diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java b/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java index e2aab245..834d1aff 100644 --- a/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java +++ b/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java @@ -2,11 +2,15 @@ package com.dxhy.extend.service.pool; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dxhy.common.constant.DictConstant; import com.dxhy.common.service.DictdetaServcice; +import com.dxhy.extend.dao.SysAuthDao; import com.dxhy.extend.entity.*; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -42,6 +46,9 @@ public class ExtInvoicePoolServiceImpl extends MpBaseServiceImpl pramsMap, int curr, int size) { long enter = System.currentTimeMillis(); @@ -508,6 +515,40 @@ public class ExtInvoicePoolServiceImpl extends MpBaseServiceImpl getGfshList(List gfshList, List companyCodes) { + DynamicContextHolder.push(DbConstant.BASICS_READ); + List taxnoList = sysDeptAuthDao.queryTaxnoList(); + List parentIdList = sysDeptAuthDao.queryParentIdList(); + + Map taxnoMap = taxnoList.stream().collect(Collectors.toMap(SysDeptEntity::getDeptId, SysDeptEntity::getTaxno)); + Map parentIdMap = parentIdList.stream().collect(Collectors.toMap(SysDeptEntity::getDeptId, e -> e.getParentId() == null ? "" : e.getParentId())); + + log.info("taxnoMap={},parentIdMap={}", taxnoMap, parentIdMap); + + String gfsh = ""; + for (String companyCode : companyCodes) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("org_code", companyCode); + List sysDeptEntityList = sysDeptAuthDao.selectList(wrapper); + SysDeptEntity sysDeptEntity = sysDeptEntityList.get(0); + if (sysDeptEntity != null) { + String dId = sysDeptEntity.getDeptId(); + log.info("获取deptId为:{}", dId); + if (StringUtils.isNotEmpty(dId)) { + gfsh = getGfsh(dId, taxnoMap, parentIdMap); + if (StringUtils.isNotEmpty(gfsh)) { + gfshList.add(gfsh); + } + } + } + } + log.info("购方税号list为:{}", gfshList); + + + return gfshList; + } + @Override public Object incentiveFlagList(String dbName) { JSONObject json = new JSONObject(); @@ -517,4 +558,21 @@ public class ExtInvoicePoolServiceImpl extends MpBaseServiceImpl taxnoMap, Map parentIdMap) { + String taxno = ""; + if (StringUtils.isNotEmpty(deptId)) { + log.info("deptId={}", deptId); + taxno = taxnoMap.get(deptId); + log.info("taxno={}", taxno); + + if (StringUtils.isEmpty(taxno)) { + deptId = parentIdMap.get(deptId); + log.info("获取map中的deptId:{}", deptId); + taxno = getGfsh(deptId, taxnoMap, parentIdMap); + } + } + return taxno; + } + + } diff --git a/dxhy-extend/src/main/resources/mapper/SysAuthDao.xml b/dxhy-extend/src/main/resources/mapper/SysAuthDao.xml new file mode 100644 index 00000000..ec6385fa --- /dev/null +++ b/dxhy-extend/src/main/resources/mapper/SysAuthDao.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + update + sys_dept + set qs_status = #{qsStatus}, + db_name = #{dbName}, + ace_key = #{aceKey}, + ace_id = #{aceId}, + is_collext = #{isCollext} + where company = #{company} + and org_type != '1' + + + + + + + + + + + +