From ddc74d3f52313cd56ece8277d6fc62b5ad1415cc Mon Sep 17 00:00:00 2001 From: yefei Date: Fri, 30 Jun 2023 16:01:14 +0800 Subject: [PATCH] =?UTF-8?q?ariesy=20=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BaseInvoiceController.java | 39 +++--- .../java/com/dxhy/base/dao/SysDeptDao.java | 111 ++++++++++++++++++ .../com/dxhy/base/entity/SysDeptEntity.java | 109 +++++++++++++++++ .../BaseInvoiceManualCheckService.java | 2 + .../BaseInvoiceManualCheckServiceImpl.java | 44 ++++++- .../src/main/resources/mapper/SysDeptDao.xml | 97 +++++++++++++++ 6 files changed, 378 insertions(+), 24 deletions(-) create mode 100644 dxhy-base/src/main/java/com/dxhy/base/dao/SysDeptDao.java create mode 100644 dxhy-base/src/main/java/com/dxhy/base/entity/SysDeptEntity.java create mode 100644 dxhy-base/src/main/resources/mapper/SysDeptDao.xml diff --git a/dxhy-base/src/main/java/com/dxhy/base/controller/BaseInvoiceController.java b/dxhy-base/src/main/java/com/dxhy/base/controller/BaseInvoiceController.java index f4c500de..ee76a75d 100644 --- a/dxhy-base/src/main/java/com/dxhy/base/controller/BaseInvoiceController.java +++ b/dxhy-base/src/main/java/com/dxhy/base/controller/BaseInvoiceController.java @@ -581,24 +581,6 @@ public class BaseInvoiceController extends AbstractController { // rates = convertRates(taxRate,rates); pramsMap.put("taxRate",taxRate); } - List gfshList = new ArrayList<>(); - if (!"99".equals(gfsh) && StringUtils.isNotBlank(gfsh)) { - gfshList.add(gfsh); - log.info("手工认证有税号"); - } else { - gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg()); - - log.info("手工认证无税号{}",UserInfoUtil.getGfshAll(getUserInfo().getOrg())); - } - pramsMap.put("gfsh", gfshList); - - boolean flag = checkList(gfshList); - - log.info("gfshList.size(){}",gfshList.size()); - if (flag){ - pramsMap.put("sign","88"); - log.info("登陆账号无税号"); - } //所属组织 // List companyCodeList = new ArrayList<>(); @@ -608,8 +590,10 @@ public class BaseInvoiceController extends AbstractController { // companyCodeList = getUserInfo().getCompanyCodes(); // log.info("获取到的组织信息{}",companyCodeList); // } + List companyCodes = getUserInfo().getCompanyCodes(); + if (StringHelper.isNotBlank(companyCode) && "99".equals(companyCode)){ - pramsMap.put("companyCodes",getUserInfo().getCompanyCodes()); + pramsMap.put("companyCodes",companyCodes); log.info("组织机构====>{}",pramsMap.get("companyCodes")); } if (StringUtils.isNotBlank(companyCode)){ @@ -617,6 +601,18 @@ public class BaseInvoiceController extends AbstractController { } + List gfshList = new ArrayList<>(); + if (!"99".equals(gfsh) && StringUtils.isNotBlank(gfsh)) { + gfshList.add(gfsh); + log.info("手工认证有税号"); + } else { + gfshList = getGfshList(gfshList,companyCodes); + + log.info("手工认证无税号{}",gfshList); + } + pramsMap.put("gfsh", gfshList); + + if (!StringUtils.isBlank(invoiceType)) { if (!"99".equals(invoiceType)) { @@ -709,6 +705,11 @@ public class BaseInvoiceController extends AbstractController { } + private List getGfshList(List gfshList, List companyCodes) { + gfshList = baseInvoiceManualCheckService.getGfshList(gfshList,companyCodes); + return gfshList; + } + private List convertRates(String taxRate,List rates) { switch (taxRate) { case "0": diff --git a/dxhy-base/src/main/java/com/dxhy/base/dao/SysDeptDao.java b/dxhy-base/src/main/java/com/dxhy/base/dao/SysDeptDao.java new file mode 100644 index 00000000..afb546ed --- /dev/null +++ b/dxhy-base/src/main/java/com/dxhy/base/dao/SysDeptDao.java @@ -0,0 +1,111 @@ +package com.dxhy.base.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dxhy.base.entity.SysDeptEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 部门管理 + * + * @author jiaohongyang + */ +@Mapper +public interface SysDeptDao 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-base/src/main/java/com/dxhy/base/entity/SysDeptEntity.java b/dxhy-base/src/main/java/com/dxhy/base/entity/SysDeptEntity.java new file mode 100644 index 00000000..e94c0007 --- /dev/null +++ b/dxhy-base/src/main/java/com/dxhy/base/entity/SysDeptEntity.java @@ -0,0 +1,109 @@ +package com.dxhy.base.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-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckService.java b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckService.java index 603085d3..0d97a656 100644 --- a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckService.java +++ b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckService.java @@ -63,4 +63,6 @@ public interface BaseInvoiceManualCheckService extends MpBaseService pramsMap); + List getGfshList(List gfshList,List companyCode); + } diff --git a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java index de7cc019..3174ef5b 100644 --- a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java +++ b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java @@ -9,12 +9,12 @@ import java.util.stream.Collectors; import javax.annotation.Resource; +import com.dxhy.base.dao.SysDeptDao; +import com.dxhy.base.entity.SysDeptEntity; import com.dxhy.common.constant.DictConstant; -import com.dxhy.common.utils.DateUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSONObject; @@ -28,8 +28,6 @@ import com.dxhy.base.model.BaseBeforegxRespVO; import com.dxhy.base.model.BaseSggxCxRespVO; import com.dxhy.common.constant.DbConstant; import com.dxhy.common.datasource.config.DynamicContextHolder; -import com.dxhy.common.enums.FpqsjgEnum; -import com.dxhy.common.enums.QsfsEnum; import com.dxhy.common.service.DictdetaServcice; import com.dxhy.common.service.TabulateRedisService; import com.dxhy.common.service.impl.MpBaseServiceImpl; @@ -37,7 +35,6 @@ import com.dxhy.common.util.AmountFormatUtil; import com.dxhy.common.util.MathUtil; import com.dxhy.common.util.StringHelper; import com.dxhy.common.vo.Business; -import com.dxhy.common.vo.DictdetaModel; import com.dxhy.common.vo.Tax; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -59,6 +56,8 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl getGfshList(List gfshList, List companyCodes) { + DynamicContextHolder.push(DbConstant.BASICS_READ); + List taxnoList = sysDeptDao.queryTaxnoList(); + List parentIdList = sysDeptDao.queryParentIdList(); + + Map taxnoMap = taxnoList.stream().collect(Collectors.toMap(SysDeptEntity::getDeptId, SysDeptEntity::getTaxno)); + Map parentIdMap = parentIdList.stream().collect(Collectors.toMap(SysDeptEntity::getDeptId, SysDeptEntity::getParentId)); + + String gfsh = ""; + for(String companyCode : companyCodes){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("org_code",companyCode); + SysDeptEntity sysDeptEntity = sysDeptDao.selectOne(wrapper); + String dId = sysDeptEntity.getDeptId(); + + gfsh = getGfsh(dId,taxnoMap,parentIdMap); + } + log.info("购方税号为:{}",gfsh); + gfshList.add(gfsh); + + return gfshList; + } + + private String getGfsh(String deptId,Map taxnoMap,Map parentIdMap) { + + String taxno = taxnoMap.get(deptId); + + if(StringUtils.isEmpty(taxno)){ + deptId = parentIdMap.get(deptId); + getGfsh(deptId,taxnoMap,parentIdMap); + } + return taxno; + } + public BaseSggxCxRespVO getBaseSggxCxRespVO(BaseTDxRecordInvoice baseTDxRecordInvoice, int count, List taxnoList, List businessList) { BaseSggxCxRespVO vo = new BaseSggxCxRespVO(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); diff --git a/dxhy-base/src/main/resources/mapper/SysDeptDao.xml b/dxhy-base/src/main/resources/mapper/SysDeptDao.xml new file mode 100644 index 00000000..d06d0653 --- /dev/null +++ b/dxhy-base/src/main/resources/mapper/SysDeptDao.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' + + + + + + + + + + + +