Browse Source

Merge branch 'test' of jishutao/kede-server into prod

anderx 2 years ago
parent
commit
903a5925a8

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

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

+ 1 - 1
src/main/java/com/goafanti/common/dao/ExpenseAccountPrivateMapper.java

@@ -22,7 +22,7 @@ public interface ExpenseAccountPrivateMapper {
 
     void updateStatusByAid(InputExpenseAccountPrivate in);
 
-    ExpenseAccountPrivate selectByAccount(String accounts);
+    ExpenseAccountPrivate selectByAccount(InputExpenseAccountPrivate in);
 
     OutExpenseAccountPrivate selectById(Integer id);
 

+ 23 - 6
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -453,10 +453,11 @@
       eae.type eaeType,
     </if>
     <if test="expenseMain ==0">
-      mea.examine_name examineName,mea.check_no checkNo,mea.id mainId, mea.target_type targetType,
+      mea.examine_name examineName,mea.check_no checkNo,mea.id mainId, a.target_type targetType,
+
     </if>
     <if test="expenseMain ==1">
-       a.examine_name examineName,a.check_no checkNo,a.target_type targetType,
+       a.examine_name examineName,a.check_no checkNo,a.target_type targetType,a.order_remarks orderRemarks,
     </if>
     f.name depName,d2.name financeName, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,a.aname,
     b.name applyDepName, c.name payDepName
@@ -471,7 +472,7 @@
     <if test="expenseMain ==0">
       left join expense_relationship er on a.id=er.ea_id
       left join expense_account mea on  er.id=mea.id
-      left join t_order_new e on mea.order_no =e.order_no
+      left join t_order_new e on a.order_no =e.order_no
       left join department b on mea.apply_dep =b.id left join department c on mea.pay_dep =c.id
       left join admin d2 on b.expense_finance_id =d2.id
     </if>
@@ -627,7 +628,7 @@
   <select id="selectByaidAndPrid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
     SELECT
     <include refid="selectDtailsSql"/>
-    WHERE 1=1
+    WHERE 1=1 and a.status &lt; 4
     <if test="status !=null">
     and a.status= #{status}
     </if>
@@ -851,9 +852,19 @@
         set c.status =b.status ,c.process_status =b.process_status
       where a.id= #{id}
     </update>
+  <update id="updateByOrderRemarks">
+    update expense_account x ,(select a.id,GROUP_CONCAT('【',e.buyer_name ,',',d.contract_no,'】') orderRemarks
+      from expense_account a left join expense_relationship b on a.id=b.id
+      left join expense_account c on b.ea_id =c.id left join t_order_new d on c.order_no =d.order_no
+      left join t_order_mid e on c.order_no =e.order_no  and a.id= #{id}
+      group by a.id)y
+    set x.order_remarks=y.orderRemarks
+    where x.id=y.id
+  </update>
+
 
 
-    <select id="ExpenseMainList" resultMap="MainMap">
+  <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,
       dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid
@@ -1041,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
@@ -1050,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>

+ 13 - 1
src/main/java/com/goafanti/common/mapper/ExpenseAccountPrivateMapper.xml

@@ -164,7 +164,19 @@
       select
       <include refid="Base_Column_List" />
       from expense_account_private
-      where accounts = #{accounts}
+      where 1=1
+      <if test="status !=null">
+        and status= #{status}
+      </if>
+      <if test="aid !=null">
+        and aid =#{aid}
+      </if>
+      <if test="accounts !=null">
+        and accounts =#{accounts}
+      </if>
+      <if test="name !=null">
+        and name =#{name}
+      </if>
     </select>
 
     <update id="updateStatusByAid">

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

@@ -490,7 +490,7 @@
     a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
     ea.total_amount expenseAmount ,a.clock_in clockIn
     from public_release a  left join admin c on a.aid =c.id
-    left join expense_account ea on a.id =ea.prid
+    left join (select * from expense_account where status in (0,1,2,3)) ea on a.id =ea.prid
     <if test="type==2">
       left join department d on c.department_id =d.id
     </if>

+ 2 - 1
src/main/java/com/goafanti/common/utils/WeChatUtils.java

@@ -114,7 +114,7 @@ public class WeChatUtils {
 		map.put("access_token", accessToken);
 		map.put("touser", openid);
 		//这里要替换成当前的
-		map.put("page", "pages/egressDetails/index?id="+id);
+		map.put("page", "/pages/mergedetail/index?id="+id);
 		map.put("miniprogram_state", wxState);
 		if (type==1) {
 			map.put("template_id", EXPENSE_RELEASE_EXAMINE);
@@ -123,6 +123,7 @@ public class WeChatUtils {
 			map.put("template_id", EXPENSE_RELEASE_EXAMINE_RESULT);
 			map.put("data",getExpenseData(type,date, aname,remarks));
 		}
+		LoggerUtils.debug(this.getClass(),"发送微信模版的参数为:"+map.get("data"));
 		return SendHttpPost(map, url);
 	}
 

+ 5 - 5
src/main/java/com/goafanti/expenseAccount/bo/OutExpenseAccountBo.java

@@ -17,7 +17,7 @@ public class OutExpenseAccountBo {
     @Excel(name = "报销编号")
     private String checkNo;
     @Excel(name = "报销至订单")
-    private String targetName;
+    private String orderRemarks;
     private String depName;
     private Integer secondaryType;
     private String secondaryTypeOther;
@@ -48,12 +48,12 @@ public class OutExpenseAccountBo {
     private String attachmentUrl;
     private Integer examine;
 
-    public String getTargetName() {
-        return targetName;
+    public String getOrderRemarks() {
+        return orderRemarks;
     }
 
-    public void setTargetName(String targetName) {
-        this.targetName = targetName;
+    public void setOrderRemarks(String orderRemarks) {
+        this.orderRemarks = orderRemarks;
     }
 
     public BigDecimal getAmount() {

+ 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);
 }

+ 7 - 2
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountPrivateServiceImpl.java

@@ -106,10 +106,15 @@ public class ExpenseAccountPrivateServiceImpl extends BaseMybatisDao<ExpenseAcco
         return expenseAccountPrivateMapper.updateByPrimaryKeySelective(in);
     }
 
+
     @Override
     public boolean updateCheckAccounts(InputExpenseAccountPrivate in) {
-        ExpenseAccountPrivate accountPrivate = expenseAccountPrivateMapper.selectByAccount(in.getAccounts());
-        if (accountPrivate==null||accountPrivate.getAid().equals(in.getAid())){
+        InputExpenseAccountPrivate checkParam=new InputExpenseAccountPrivate();
+        checkParam.setAid(in.getAid());
+        checkParam.setAccounts(in.getAccounts());
+        checkParam.setName(in.getName());
+        ExpenseAccountPrivate accountPrivate = expenseAccountPrivateMapper.selectByAccount(checkParam);
+        if (accountPrivate==null||accountPrivate.getId().equals(in.getId())){
             return false;
         }else {
             return true;

+ 37 - 9
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -277,8 +277,13 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             realAmount=realAmount.add(e.getRealAmount());
         }
         in.setTotalAmount(totalAmount);
-        in.setAmount(realAmount.subtract(useEA.getSettlementAmount()));
+        if (useEA==null||useEA.getSettlementAmount()==null){
+            in.setAmount(realAmount);
+        }else {
+            in.setAmount(realAmount.subtract(useEA.getSettlementAmount()));
+        }
         in.setRealAmount(in.getAmount());
+
     }
 
     @Override
@@ -315,13 +320,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     public Object pageListExport(InputPageListBo in) {
         List<OutExpenseAccountBo> list = (List<OutExpenseAccountBo>) pageList(in).getList();
         for (OutExpenseAccountBo e : list) {
-            if (e.getTargetType()!=null){
-                if (e.getTargetType()==0){
-                    e.setTargetName("固定费用");
-                }else {
-                    e.setTargetName(e.getContractNo()+"-"+e.getBuyerName());
-                }
-            }
             if (e.getType()!=0){
                 e.setTypeOther(EATypes.getDescByCode(e.getType()));
             }else{
@@ -340,7 +338,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 if (e.getTargetType()==0){
                     e.setTargetName("固定费用");
                 }else {
-                    e.setTargetName(e.getContractNo()+"-"+e.getBuyerName());
+                    e.setTargetName(e.getContractNo()+"/"+e.getBuyerName());
                 }
             }
             if (e.getType()!=0){
@@ -369,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);
@@ -945,6 +971,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         Integer noticeStatus=NoticeStatus.EXPENSE_NOTICE.getCode();
         if (status==2){
             noticeStatus=NoticeStatus.EXPENSE_COMPLETE.getCode();
+            str="您提交的费用报销单已通过审核,请及时查看。";
         }
         List<Notice> list=new ArrayList<>();
         if (aids!=null){
@@ -1118,6 +1145,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             update.setId(in.getId());
             update.setExamineName(outExpenseAccount.getExamineName());
             expenseAccountMapper.updateByPrimaryKeySelective(update);
+//            expenseAccountMapper.updateByOrderRemarks(in.getId());
         }else if (in.getStatus()==4){
             expenseAccountMapper.updateByMainId(in.getId(),0);
             addExpenseAccountLog(in.getId(),4,0,TokenManager.getAdminId(),"撤销报销审核");