Przeglądaj źródła

新增修改其他说明

anderx 1 rok temu
rodzic
commit
3fc89f7043

+ 2 - 0
src/main/java/com/goafanti/common/dao/ExpenseAccountMapper.java

@@ -72,4 +72,6 @@ public interface ExpenseAccountMapper {
     Integer selectDeleteIdBySonId(Integer integer);
 
     void updateByOrderRemarks(Integer id);
+
+    void updateSonTypeOther(@Param("id") Integer id, @Param("types") String types);
 }

+ 8 - 1
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -863,6 +863,7 @@
   </update>
 
 
+
   <select id="ExpenseMainList" resultMap="MainMap">
       select b.id,b.check_no,b.total_amount,b.real_amount ,b.order_no,o.contract_no ,b.aname,b.apply_dep,b.pay_dep,b.amount,
       date_format(b.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,b.examine_name,
@@ -1051,8 +1052,9 @@
   left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
   left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
   left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
-  where c.id in (#{id})
+  where b.id  in (select id from expense_relationship where ea_id = #{id} )
   </select>
+
   <select id="selectDeleteIdBySonId" resultType="java.lang.Integer">
     select b.id
     from expense_account a left join expense_relationship b on a.id =b.ea_id
@@ -1060,4 +1062,9 @@
     where a.id= #{id} and c.id is null
   </select>
 
+  <update id="updateSonTypeOther">
+    update expense_account a
+    set a.type_other = #{types}
+    where a.id in (select id from expense_relationship where ea_id = #{id} )
+  </update>
 </mapper>

+ 16 - 0
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -423,6 +423,22 @@ public class ExpenseAccountController extends CertifyApiController {
     }
 
     /**
+     *  修改报销类型说明
+     * @param id
+     * @param typeOther
+     * @return
+     */
+    @RequestMapping(value = "/updateTypeOther",method = RequestMethod.POST)
+    public Result updateTypeOther(Integer id ,String typeOther){
+        Result res =new Result();
+        if (id==null){
+            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号"));
+            return  res;
+        }
+        return res.data(expenseAccountService.updateTypeOther(   id, typeOther));
+    }
+
+    /**
      * 主类分类说明
      * @return
      */

+ 2 - 0
src/main/java/com/goafanti/expenseAccount/service/ExpenseAccountService.java

@@ -70,4 +70,6 @@ public interface ExpenseAccountService {
     Object detailsListExport(InputDetailsListBo in);
 
     Object getDepDetails(Integer id);
+
+    Object updateTypeOther(Integer id, String typeOther);
 }

+ 28 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -367,6 +367,34 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         return organizationListOut;
     }
 
+    @Override
+    public Object updateTypeOther(Integer id, String typeOther) {
+        ExpenseAccount ea = new ExpenseAccount();
+        ea.setId(id);
+        ea.setTypeOther(typeOther);
+        expenseAccountMapper.updateByPrimaryKeySelective(ea);
+        MainExpenseAccount mainExpenseAccount = expenseAccountMapper.selectbySonId(id);
+        StringBuffer types=new StringBuffer();
+        for (SonExpenseAccount e : mainExpenseAccount.getSonList()) {
+            if (e.getType()!=0){
+                types=types.append(EATypes.getDescByCode(e.getType()));
+            }else {
+                types=types.append(e.getTypeOther());
+            }
+            if (e.getType()==2){
+                if (e.getSecondaryType()==0){
+                    types=types.append("-").append(e.getSecondaryTypeOther());
+                }else{
+                    String descByCode = EAsecondaryTypes.getDescByCode(e.getSecondaryType());
+                    types=types.append("-").append(descByCode);
+                }
+            }
+            types=types.append(",");
+        }
+        expenseAccountMapper.updateSonTypeOther(id,types.substring(0,types.length()-1));
+        return 1;
+    }
+
 
     private void pushResettingDebit(InputExpenseAccount in, Integer debitId) {
         ExpenseAccount debit = expenseAccountMapper.selectByPrimaryKey(debitId);