Kaynağa Gözat

社保分部

zouxuan 3 yıl önce
ebeveyn
işleme
dacce1d557

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/FinancialExpenditureDao.java

@@ -82,4 +82,13 @@ public interface FinancialExpenditureDao extends BaseDAO<Long, FinancialExpendit
     * @date 2021/11/29 16:48
     */
     Integer findByBatchNoAndProcessNo(Integer workOrderId);
+
+    /**
+    * @description: 获取社保分部
+     * @param deptId
+    * @return java.lang.Integer
+    * @author zx
+    * @date 2021/11/30 14:40
+    */
+    Integer getDeptId(Integer deptId);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PWorkOrderInfo.java

@@ -17,6 +17,16 @@ public class PWorkOrderInfo {
 
     private String title;
 
+    private Integer deptId;
+
+    public Integer getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Integer deptId) {
+        this.deptId = deptId;
+    }
+
     public String getTitle() {
         return title;
     }

+ 6 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -379,12 +379,13 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                 financialExpenditure.setBatchNo(workOrderId.toString());
                 financialExpenditure.setFinancialProcessNo(workOrderId.toString());
                 Employee employee = employeeDao.get(pWorkOrderInfo.getCreator());
+                Integer organId = financialExpenditureDao.getDeptId(pWorkOrderInfo.getDeptId());
+                Organization organization = organizationDao.get(organId);
+                if(organization != null){
+                    financialExpenditure.setOrganId(organization.getId());
+                    financialExpenditure.setOrganName(organization.getName());
+                }
                 if(employee != null){
-                    Organization organization = organizationDao.get(employee.getDeptId());
-                    if(organization != null){
-                        financialExpenditure.setOrganId(organization.getId());
-                        financialExpenditure.setOrganName(organization.getName());
-                    }
                     List<Integer> userIds = new ArrayList<>();
                     userIds.add(employee.getUserId());
                     List<SimpleUserDto> byIds = employeeDao.findByIds(userIds);

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/FinancialExpenditureMapper.xml

@@ -225,6 +225,7 @@
         <result property="creator" column="mec_user_id"/>
         <result property="process" column="process"/>
         <result property="title" column="title"/>
+        <result property="deptId" column="dept_id"/>
     </resultMap>
     <select id="getWorkOrderInfo" resultMap="PWorkOrderInfo">
         SELECT woi.*,su.mec_user_id FROM mec_dev_api.p_work_order_info woi
@@ -246,4 +247,7 @@
     <select id="findByBatchNoAndProcessNo" resultType="integer">
         SELECT id_ FROM financial_expenditure WHERE batch_no_ = #{workOrderId} AND financial_process_no_ = #{workOrderId} LIMIT 1
     </select>
+    <select id="getDeptId" resultType="java.lang.Integer">
+        SELECT organ_id FROM mec_dev_api.sys_dept WHERE dept_id = #{deptId}
+    </select>
 </mapper>