Jelajahi Sumber

账户管理-我的账户状态同步

yangzian 3 tahun lalu
induk
melakukan
46654eecd9

+ 7 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/SettlementInfoMapper.java

@@ -34,6 +34,13 @@ public interface SettlementInfoMapper extends BaseMapper<CtopCwjsSettlementInfo>
     void updSettlementStatusById(@Param("id") Long id, @Param("status") Integer status);
 
     /**
+     * 根据账户id 查看财务账户
+     * @param accountId
+     * @return
+     */
+   CtopCwjsSettlementInfo getSettlementByAccountId(String accountId);
+
+    /**
      * 删除财务结算账户
      * @param id
      */

+ 8 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/SettlementInfoMapper.xml

@@ -73,6 +73,14 @@
     </update>
 
 
+    <!-- 根据账户id 查看财务账户 -->
+    <select id="getSettlementByAccountId" resultType="org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo">
+        select * from ctop_cwjs_settlement_info
+        WHERE del_flag = 0
+          and account_id = #{accountId}
+    </select>
+
+
     <!-- 删除财务结算账户 -->
     <update id="deleteSettlementById">
         UPDATE ctop_cwjs_settlement_info

+ 16 - 3
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementInfoServiceImpl.java

@@ -189,10 +189,23 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
                 if (importResult.getList().size() < 1){
                     return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入。");
                 }
-                importResult.getList().forEach(importVo -> {
+
+                for (AccountImportVo importVo : importResult.getList()) {
                     BeanUtils.copyProperties(importVo,settlementInfo);
-                    settlementInfoMapper.insert(settlementInfo);
-                });
+                    //根据账户id 查看
+                    CtopCwjsSettlementInfo cwjs = settlementInfoMapper.getSettlementByAccountId(importVo.getAccountId());
+                    if (Check.isNull(cwjs)){
+                       // BeanUtils.copyProperties(importVo,settlementInfo);
+                        settlementInfoMapper.insert(settlementInfo);
+                    }else {
+                        settlementInfo.setId(cwjs.getId());
+                        settlementInfoMapper.updateById(settlementInfo);
+                    }
+
+                }
+
+
+
 
             }catch (Exception e){
                 e.printStackTrace();

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 用户分配
@@ -60,4 +61,9 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     int updateProjectStrategyStatus(@Param("accountId") Long accountId,@Param("projectStrategy") Integer projectStrategy);
 
     List<Long> queryAutomaticAccounts(@Param("projectId") Long projectId);
+
+
+
+    Map<String,Object>getCwjsSettlementByAccountId(String accountId);
+    void updCwjsSettlementStatus(@Param("id") String id, @Param("status") Integer status);
 }

+ 21 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -239,4 +239,25 @@
         AND auto_delivery = 1
     </select>
 
+
+
+
+    <!-- 根据账户id 查看财务账户 -->
+    <select id="getCwjsSettlementByAccountId" resultType="java.util.LinkedHashMap">
+        select * from ctop_cwjs_settlement_info
+        WHERE del_flag = 0
+          and account_id = #{accountId}
+    </select>
+<!-- 修改状态 -->
+    <update id="updCwjsSettlementStatus">
+        UPDATE ctop_cwjs_settlement_info
+        SET STATUS = #{status}
+        WHERE
+            id = #{id}
+
+    </update>
+
+
+
+
 </mapper>

+ 9 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -236,6 +236,8 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
 
     @Autowired
     ProjectMemberMapper memberMapper;
+
+
     @Override
     public Result<UserAllocation> editUserAlloCation(UserAllocation userAllocation) {
         Result<UserAllocation> result = new Result<>();
@@ -276,7 +278,14 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
             if (ok == 1) {
                 result.success("修改成功!");
             }
+
+            //同步 财务结算 状态
+            Map<String,Object> cwjs = userAllocationMapper.getCwjsSettlementByAccountId(String.valueOf(userAllocationEntity.getAccountId()));
+            if (!Check.isNull(cwjs)){
+                userAllocationMapper.updCwjsSettlementStatus(cwjs.get("id").toString(),accountStatus);
+            }
         }
+
         return result;
     }