Bladeren bron

功能调整

wangqiang 1 jaar geleden
bovenliggende
commit
7e978da2da

+ 2 - 2
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/service/WorkContractService.java

@@ -115,12 +115,12 @@ public class WorkContractService {
         //获取当前登录人信息
         UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(currentToken);
         //合同编号生成
-        String serialNum = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), WorkContractInfoDto.BIZ_CODE,currentToken);
+//        String serialNum = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), WorkContractInfoDto.BIZ_CODE,currentToken);
         String id = UUID.randomUUID().toString().replace("-", "");
         WorkContractInfo info = new WorkContractInfo();
         BeanUtils.copyProperties(workContractInfoDto, info);
         info.setId(id);
-        info.setNo(serialNum);
+//        info.setNo(serialNum);
         info.setCreateById(userDTO.getId());
         info.setCreateTime(new Date());
         info.setUpdateById(userDTO.getId());

+ 2 - 2
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/purchase/mapper/xml/MaterialDetailedMapper.xml

@@ -32,10 +32,10 @@
             id,
             trade_name
         FROM
-            material_management_pruchase_request_detailed
+            material_management_warehouse_detailed
         WHERE
             del_flag = '0'
-            AND procurement_type = #{typeId}
+            AND ware_house_type = #{typeId}
         GROUP BY
             trade_name
         ORDER BY

+ 31 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -6,6 +6,7 @@ package com.jeeplus.sys.controller;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -15,6 +16,7 @@ import com.google.common.collect.Lists;
 import com.google.gson.Gson;
 import com.jeeplus.aop.demo.annotation.DemoMode;
 import com.jeeplus.common.SecurityUtils;
+import com.jeeplus.common.TokenProvider;
 import com.jeeplus.common.constant.CommonConstants;
 import com.jeeplus.common.excel.ExcelOptions;
 import com.jeeplus.common.excel.annotation.ExportMode;
@@ -24,6 +26,7 @@ import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.logging.annotation.ApiLog;
 import com.jeeplus.sys.domain.Office;
 import com.jeeplus.sys.domain.User;
+import com.jeeplus.sys.feign.IUserApi;
 import com.jeeplus.sys.service.OfficeService;
 import com.jeeplus.sys.service.UserService;
 import com.jeeplus.sys.service.dto.OfficeDTO;
@@ -640,6 +643,34 @@ public class UserController {
     }
 
     /**
+     * 获取财务机构JSON数据。
+     *
+     * @param officeName 部门名称
+     * @param extId 排除的ID
+     * @param type  类型(1:公司;2:部门)
+     * @param showAll 是否显示不可用数据 1 显示 0 隐藏
+     * @return
+     */
+    @ApiLog("获取财务部门用户数据")
+    @GetMapping("treeUserDataFinanceOffice")
+    public ResponseEntity treeUserDataFinanceOffice(@RequestParam(required = false) String officeName,@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
+        officeName = "兴光会计师事务所";
+        List<OfficeDTO> list = officeService.getOfficeAllByOfficeName (officeName);
+        if(list.size()>0){
+            List<String> officeIds = Lists.newArrayList();
+            for (OfficeDTO info : list) {
+                info.setTypeFlag(true);
+                officeIds.add(info.getId());
+            }
+            //根据部门查询对应部门下的所有数据
+            List<OfficeDTO> officeDTOList = userService.getUserByOffice(officeIds,type);
+            list.addAll(officeDTOList);
+        }
+        List rootTree = officeService.getFinanceRootTree (list, extId, type, showAll, "1");
+        return ResponseEntity.ok (rootTree);
+    }
+
+    /**
      * 判断当前用户是否是管理员
      *
      * @return

+ 15 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java

@@ -47,7 +47,6 @@ public interface OfficeMapper extends TreeMapper <Office> {
      */
     @InterceptorIgnore(tenantLine = "true")
     public List <OfficeDTO> findList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
-
     /**
      * 根据签字注师2获取列表
      *
@@ -67,6 +66,14 @@ public interface OfficeMapper extends TreeMapper <Office> {
     List<OfficeDTO> getOfficeAllByOfficeName(@Param("officeName") String officeName);
 
     /**
+     * 根据部门名称 查询部门及所有子部门信息
+     * @param officeName
+     * @return
+     */
+    @InterceptorIgnore(tenantLine = "true")
+    List<OfficeDTO> getOfficeAllByFinanceOfficeName(@Param("officeName") String officeName);
+
+    /**
      * 根据父级id查询组织信息
      * @param parentId
      * @return
@@ -95,4 +102,11 @@ public interface OfficeMapper extends TreeMapper <Office> {
      */
     @InterceptorIgnore(tenantLine = "true")
     List<Office> getAccessChildren(@Param("rootId")String rootId);
+    /**
+     * 获取到所有parent_id为‘0’的会计部门数据
+     * @param rootId
+     * @return
+     */
+    @InterceptorIgnore(tenantLine = "true")
+    List<Office> getFinanceChildren(@Param("rootId")String rootId);
 }

+ 70 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml

@@ -257,5 +257,75 @@
 	             LEFT JOIN sys_post AS post on user_post.post_id = post.id
             ${ew.customSqlSegment}
     </select>
+    <select id="getOfficeAllByFinanceOfficeName" resultType="com.jeeplus.sys.service.dto.OfficeDTO">
+        select
+        a.id,
+        a.parent_id AS "parent.id",
+        a.parent_ids,
+        a.area,
+        a.code,
+        a.name,
+        a.sort,
+        a.type,
+        a.grade,
+        a.address,
+        a.zip_code,
+        a.master,
+        a.phone,
+        a.fax,
+        a.email,
+        a.remarks,
+        a.create_by_id AS "createBy.id",
+        a.create_time,
+        a.update_by_id AS "updateBy.id",
+        a.update_time,
+        a.del_flag,
+        a.useable      AS useable,
+        a.tenant_id    AS "tenantDTO.id",
+        p.name         AS "parent.name"
+        from sys_office a
+        LEFT JOIN sys_office p ON p.id = a.parent_id
+        <where>
+            a.del_flag = 0
+            <if test="officeName != null and officeName != ''">
+                and (
+                a.parent_ids like concat('%',(select id from sys_office where name = #{officeName}),'%')
+                )
+            </if>
+        </where>
+    </select>
+    <select id="getFinanceChildren" resultType="com.jeeplus.sys.domain.Office">
+        SELECT
+            id,
+            is_public,
+            area,
+            CODE,
+            type,
+            grade,
+            address,
+            zip_code,
+            MASTER,
+            phone,
+            fax,
+            email,
+            useable,
+            remarks,
+            parent_id,
+            parent_ids,
+            NAME,
+            sort,
+            create_time,
+            create_by_id,
+            update_time,
+            update_by_id,
+            del_flag,
+            tenant_id
+        FROM
+            sys_office
+        WHERE
+            del_flag = 0
+            and parent_id = #{rootId}
+            and NAME LIKE concat('%','会计','%')
+    </select>
 
 </mapper>

+ 52 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/OfficeService.java

@@ -129,6 +129,47 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
         return offices;
     }
 
+    public List <OfficeDTO> getFinanceRootTree(List<OfficeDTO> list, String extId, String type, String showAll, String showMyOffice) {
+        List<OfficeDTO> offices = Lists.newArrayList ();
+        // 获取到所有parent_id为‘0’的部门数据
+        List<Office> children = officeMapper.getFinanceChildren(OfficeDTO.getRootId());
+//        List<Office> children = super.getChildren(new Office(OfficeDTO.getRootId()));
+        List<OfficeDTO> rootTrees = OfficeWrapper.INSTANCE.toDTO (children);
+        for (OfficeDTO root : rootTrees) {
+            if (this.isUseAble ( extId, type,root, showAll )){
+                // 不是被排除节点的子节点
+                List<OfficeDTO> officeList = formatListToTree (root, list, extId, type, showAll);
+                offices.addAll (officeList);
+            }
+        }
+        if (StringUtils.isNotBlank(showMyOffice)) {
+            OfficeDTO officeDTO = UserUtils.getCurrentUserDTO().getOfficeDTO();
+            // 排除管理员
+            if (!UserUtils.getCurrentUserDTO().isAdmin()){
+                if (org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())) {
+                    String[] split = officeDTO.getParentIds().split(",");
+                    if (split.length > 2) {
+                        Office office = officeMapper.selectById(split[2]);
+                        if ("0".equals(office.getIsPublic())) {
+                            // isPublic为“0”,当前用户的公司为私有,查询的部门包含自己所属公司全部部门和其他的公有部门
+                            if(null != officeDTO && org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())){
+                                offices = this.getCompanyFromTree(offices);
+                            }
+                        }
+                    } else {
+                        if ("0".equals(officeDTO.getIsPublic())) {
+                            // isPublic为“0”,当前用户的公司为私有,查询的部门包含自己所属公司全部部门和其他的公有部门
+                            if(null != officeDTO && org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())){
+                                offices = this.getCompanyFromTree(offices);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return offices;
+    }
+
     public List <OfficeDTO> getRootTree(List<OfficeDTO> list, String extId, String type, String showAll, String showMyOffice) {
         List<OfficeDTO> offices = Lists.newArrayList ();
         // 获取到所有parent_id为‘0’的部门数据
@@ -337,6 +378,17 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
         return officeList;
     }
 
+    /**
+     * 根据部门名称查询部门信息
+     * @param officeName
+     * @return
+     */
+    public List<OfficeDTO> getOfficeAllByFinanceOfficeName(String officeName){
+        List<OfficeDTO> officeList = officeMapper.getOfficeAllByFinanceOfficeName(officeName);
+
+        return officeList;
+    }
+
     public List <OfficeDTO> getRootTree2(List<OfficeDTO> list, String extId, String type, String showAll) {
         List<OfficeDTO> offices = Lists.newArrayList ();
         List<OfficeDTO> rootTrees = officeWrapper.toDTO (super.getChildren (new Office (OfficeDTO.getRootId ())));