瀏覽代碼

修改融资开立负数问题

cuixq 3 年之前
父節點
當前提交
95be0cee62

+ 18 - 9
sc-service/src/main/java/com/huyi/service/common/financeInf/controller/FinanceInfController.java

@@ -82,12 +82,17 @@ public class FinanceInfController extends BaseController {
             term = AmtUtil.add(term,"1",0);
             /*预计融资成本:融资金额*融资费率*预计融资期限 / 365 + 融资金额 * 服务费率*/
             //融资金额 * 服务费率
-            String money  = AmtUtil.multiply(zfiAmount,zfpcrChargeRate,2);
+            String money  = AmtUtil.multiply(zfiAmount,zfpcrChargeRate,4);
+            System.out.println("money==========>"+money);
             //预计融资成本
-            String cost = AmtUtil.multiply(zfiAmount,zfpcrRate);
-            cost = AmtUtil.multiply(cost,term);
-            cost = AmtUtil.divide(cost,"360");
+            String cost = AmtUtil.multiply(zfiAmount,zfpcrRate,4);
+            System.out.println("cost1==========>"+cost);
+            cost = AmtUtil.multiply(cost,term,4);
+            System.out.println("cost2==========>"+cost);
+            cost = AmtUtil.divide(cost,"360",4);
+            System.out.println("cost3==========>"+cost);
             cost = AmtUtil.add(cost,money,2);
+            System.out.println("cost4==========>"+cost);
             /*预计净融资额:融资金额 – 预计融资成本*/
             String amount = AmtUtil.subtract(zfiAmount,cost,2);
             /*融资放款后:三个预计值,改为实际值*/
@@ -102,10 +107,14 @@ public class FinanceInfController extends BaseController {
                 }
                 termIng = AmtUtil.add(termIng,"1",0);
                 /*融资成本:融资金额*融资费率*融资期限 / 365 + 融资金额 * 服务费率*/
-                String costIng = AmtUtil.multiply(zfiAmount,zfpcrRate);
-                costIng = AmtUtil.multiply(costIng,termIng);
-                costIng = AmtUtil.divide(costIng,"360");
+                String costIng = AmtUtil.multiply(zfiAmount,zfpcrRate,4);
+                System.out.println("costIng1==========>"+costIng);
+                costIng = AmtUtil.multiply(costIng,termIng,4);
+                System.out.println("costIng2==========>"+costIng);
+                costIng = AmtUtil.divide(costIng,"360",4);
+                System.out.println("costIng3==========>"+costIng);
                 costIng = AmtUtil.add(costIng,money,2);
+                System.out.println("costIng4==========>"+costIng);
                 /*净融资额:融资金额 – 融资成本*/
                 String amountIng = AmtUtil.subtract(zfiAmount,costIng,2);
                 //融资期限
@@ -114,7 +123,7 @@ public class FinanceInfController extends BaseController {
                 m.put("costIng",costIng);
                 //净融资额
                 m.put("amountIng",amountIng);
-                System.out.println("融资期限:"+termIng+"----融资成本:"+costIng+"----净融资额:"+amountIng);
+                System.out.println("融资期限1:"+termIng+"----融资成本:"+costIng+"----净融资额:"+amountIng);
             }
             //预计融资期限
             m.put("term",term);
@@ -122,7 +131,7 @@ public class FinanceInfController extends BaseController {
             m.put("cost",cost);
             //预计净融资额
             m.put("amount",amount);
-            System.out.println("预计融资期限:"+term+"----预计融资成本:"+cost+"----预计净融资额:"+amount);
+            System.out.println("预计融资期限1:"+term+"----预计融资成本:"+cost+"----预计净融资额:"+amount);
         }
 //        LambdaQueryWrapper<ZcFinanceInf> queryWrapper = new LambdaQueryWrapper<>();
 //        queryWrapper.eq(ZcFinanceInf::getZfiSupplierId,companyId);

+ 3 - 7
sc-service/src/main/java/com/huyi/service/common/flowable/service/impl/ApprovalServiceImpl.java

@@ -270,15 +270,11 @@ public class ApprovalServiceImpl implements ApprovalService {
                 //financeLog.addFinanceLog(CommonUtil.objToString(map.get("zfiId")), "融信确权生效【审批中】融信资料提交于《"+coreName+"》确权", null, FinanceLog.STATUS_ONE);
             }
             // TODO 不管什么类型都给 核心企业经办人 确权待办
-            //标题
-            String titles ="";
-            if("1".equals(zfiCreateType)){
-                titles = "【融信确权】由【"+coreName+"】发起的融信【"+zfiNumber+"】资料待确权";
-            }else{
-                titles = "【融信确权】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待确权";
+            if(!"1".equals(zfiCreateType)){
+                String titles = "【融信确权】由【"+supplierName+"】发起的融信【"+zfiNumber+"】资料待确权";
+                remoteSystemService.sendNotice(zfiCoreId, zfiId,titles,"00","","02","0",coreUserId.toString(),"", "01", "/credit/confirmationAudit/"+zfiId);
             }
 
-            remoteSystemService.sendNotice(zfiCoreId, zfiId,titles,"00","","02","0",coreUserId.toString(),"", "01", "/credit/confirmationAudit/"+zfiId);
             zcFinanceInfService.updateById(zcFinanceInf);
         }else if (!"200".equals(resMap.get("code"))) {
             throw new Exception(resMap.get("message").toString());

+ 38 - 16
sc-service/src/main/java/com/huyi/service/cost/controller/OwnCostManageController.java

@@ -30,6 +30,7 @@ import com.tianhu.common.redis.common.RedisUtils;
 import com.tianhu.common.redis.domain.SysDictData;
 import com.tianhu.common.security.annotation.PreAuthorize;
 import com.tianhu.common.security.service.TokenService;
+import com.tianhu.system.api.RemoteZxBankService;
 import com.tianhu.system.api.model.LoginUser;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -50,7 +51,7 @@ import java.util.regex.Pattern;
 
 /**
  * 费用Controller
- * 
+ *
  * @author keao
  * @date 2020-12-16
  */
@@ -80,6 +81,8 @@ public class OwnCostManageController extends BaseController
 
     @Autowired
     private IPayAccInfService iPayAccInfService;
+    @Autowired
+    private RemoteZxBankService remoteZxBankService;
     /**
      * 申请开票
      */
@@ -466,29 +469,48 @@ public R list(String zfrNumber, String zciStatus, String zciInvoiceStatus,
 
     /**
      * 缴费
-     * @param zciId
+     * @param map
      * @return
      */
     @PreAuthorize(hasPermi = "service:cost:pay")
     @Log(title = "缴费", businessType = BusinessType.UPDATE)
-    @PutMapping("/changeZfiStatus/{zciId}")
-    public R changezfiStatus(@PathVariable String zciId) throws Exception
+    @PutMapping("/changeZfiStatus")
+    public R changezfiStatus(@RequestBody Map<String, Object> map) throws Exception
     {
         //获取当前操作员
         LoginUser user = tokenService.getLoginUser();
         String userId = String.valueOf(user.getSysUser().getUserId());
-        //修改信息
-        ZcChargeInf zcChargeInf = new ZcChargeInf();
-        //主键
-        zcChargeInf.setZciId(zciId);
-        //已缴费
-        zcChargeInf.setZciStatus("02");
-        //修改人
-        zcChargeInf.setUpdateBy(userId);
-        //修改时间
-        zcChargeInf.setUpdateTime(DateUtils.getNowDate());
-        //执行修改
-        iZcChargeInfService.updateById(zcChargeInf);
+        String tranAmt = CommonUtil.objToString(map.get("tranAmt"));
+        String type = CommonUtil.objToString(map.get("type"));
+        String businessId = CommonUtil.objToString(map.get("businessId"));
+        //调用缴费接口
+        R bank = remoteZxBankService.transferPay("", "", tranAmt, businessId, type);
+        System.out.println("bank========>"+bank);
+        Map maps = (Map) bank.getData();
+        System.out.println("maps========>"+maps);
+        if(maps!=null&&maps.containsKey("status")) {
+            //状态 0 交易中 1 成功 2  失败
+            String status = maps.get("status").toString();
+            //退款成功费用列表改为退款成功
+            if ("1".equals(status)) {
+                //修改信息
+                ZcChargeInf zcChargeInf = new ZcChargeInf();
+                //主键
+                zcChargeInf.setZciId(businessId);
+                //已缴费
+                zcChargeInf.setZciStatus("02");
+                //修改人
+                zcChargeInf.setUpdateBy(userId);
+                //修改时间
+                zcChargeInf.setUpdateTime(DateUtils.getNowDate());
+                //执行修改
+                iZcChargeInfService.updateById(zcChargeInf);
+            } else if ("2".equals(status)) {
+                throw new Exception("交易失败");
+            }
+        }else{
+            throw new Exception("交易失败");
+        }
         return R.ok();
     }
 

+ 8 - 0
sc-service/src/main/java/com/huyi/service/credit/controller/OwnCreditController.java

@@ -394,13 +394,18 @@ public class OwnCreditController extends BaseController {
         String zfpAuthType = "";
         //最短账期
         String zfpShortestPeriod = "";
+        //最小融资金额
+        String zfpMinimumAmount = "";
         if(product != null){
             zfpShortestPeriod = product.getZfpShortestPeriod();
             zfpName = product.getZfpName();
             zfpAuthType = product.getZfpAuthType();
+            zfpMinimumAmount = product.getZfpMinimumAmount();
         }
         System.out.println("产品展示=========>"+product);
         System.out.println("最短账期=========>"+zfpShortestPeriod);
+        System.out.println("最小融资金额=========>"+zfpMinimumAmount);
+        map.put("zfpMinimumAmount",zfpMinimumAmount);
         map.put("zfpShortestPeriod",zfpShortestPeriod);
         map.put("zfpName",zfpName);
         map.put("zfpAuthType",zfpAuthType);
@@ -443,14 +448,17 @@ public class OwnCreditController extends BaseController {
         //查询融信开立方的盖章日期
         LambdaQueryWrapper<ZcFinanceFileRel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.eq(ZcFinanceFileRel::getZffrFinanceId,zfiId);
+        lambdaQueryWrapper.isNotNull(ZcFinanceFileRel::getZffrCoreId);
         List<ZcFinanceFileRel> financeFileRelList = financeFileRelService.findZcFinanceFileRels(lambdaQueryWrapper);
         //核心企业盖章日期
         String openDate = "";
         if(financeFileRelList.size() > 0){
+            System.out.println("financeFileRelList=========>"+financeFileRelList);
             if(CommonUtil.isNotEmpty(CommonUtil.objToString(financeFileRelList.get(0).getZffrCoreTime()))){
                 openDate = DateUtils.parseDateToStr("yyyy年MM月dd日",financeFileRelList.get(0).getZffrCoreTime());
             }
         }
+        System.out.println("openDate=========>"+openDate);
         map.put("openDate",openDate);
         return AjaxResult.success(map);
     }

+ 38 - 14
sc-service/src/main/java/com/huyi/service/financeRecord/controller/RecordSealController.java

@@ -23,6 +23,7 @@ import com.tianhu.common.security.annotation.PreAuthorize;
 import com.tianhu.common.security.service.TokenService;
 import com.tianhu.system.api.RemoteConfigService;
 import com.tianhu.system.api.RemoteFileService;
+import com.tianhu.system.api.RemoteZxBankService;
 import com.tianhu.system.api.domain.SysUser;
 import com.tianhu.system.api.model.LoginUser;
 import org.apache.commons.io.IOUtils;
@@ -101,6 +102,8 @@ public class RecordSealController extends BaseController {
     private ISysUserCompanyRelService iSysUserCompanyRelService;
     @Autowired
     private IPayAccInfService iPayAccInfService;
+    @Autowired
+    private RemoteZxBankService remoteZxBankService;
     //待办服务类
     @Autowired
     private  ISysNoticeService      sysNoticeService;
@@ -796,23 +799,44 @@ public class RecordSealController extends BaseController {
     }
     /**
      * 缴费状态修改
-     * @param zfrId 融资id
+     * @param map 融资id
      * @return
      * @throws Exception
      */
-    @PostMapping("/updateChargeStatus/{zfrId}/{zciStatus}")
-    public AjaxResult updateChargeStatus(@PathVariable String zfrId,@PathVariable String zciStatus) throws Exception {
-        //获取此操作员
-        LoginUser userInfo = tokenService.getLoginUser();
-        SysUser user = userInfo.getSysUser();
-        String userId = user.getUserId()+"";
-        LambdaQueryWrapper<ZcChargeInf> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(ZcChargeInf::getZciFinanceId,zfrId);
-        ZcChargeInf zcChargeInf = new ZcChargeInf();
-        zcChargeInf.setZciStatus(zciStatus);
-        zcChargeInf.setUpdateBy(userId);
-        zcChargeInf.setUpdateTime(DateUtils.getNowDate());
-        iZcChargeInfService.update(zcChargeInf,queryWrapper);
+    @PostMapping("/updateChargeStatus")
+    public AjaxResult updateChargeStatus(@RequestBody Map<String, Object> map) throws Exception {
+        String tranAmt = CommonUtil.objToString(map.get("tranAmt"));
+        String type = CommonUtil.objToString(map.get("type"));
+        String businessId = CommonUtil.objToString(map.get("businessId"));
+        String zciStatus = CommonUtil.objToString(map.get("zciStatus"));
+        String zfrId = CommonUtil.objToString(map.get("zfrId"));
+        //调用缴费接口
+        R bank = remoteZxBankService.transferPay("", "", tranAmt, businessId, type);
+        System.out.println("bank========>"+bank);
+        Map maps = (Map) bank.getData();
+        System.out.println("maps========>"+maps);
+        if(maps!=null&&maps.containsKey("status")) {
+            //状态 0 交易中 1 成功 2  失败
+            String status = maps.get("status").toString();
+            //退款成功费用列表改为退款成功
+            if ("1".equals(status)) {
+                //获取此操作员
+                LoginUser userInfo = tokenService.getLoginUser();
+                SysUser user = userInfo.getSysUser();
+                String userId = user.getUserId()+"";
+                LambdaQueryWrapper<ZcChargeInf> queryWrapper = new LambdaQueryWrapper<>();
+                queryWrapper.eq(ZcChargeInf::getZciFinanceId,zfrId);
+                ZcChargeInf zcChargeInf = new ZcChargeInf();
+                zcChargeInf.setZciStatus(zciStatus);
+                zcChargeInf.setUpdateBy(userId);
+                zcChargeInf.setUpdateTime(DateUtils.getNowDate());
+                iZcChargeInfService.update(zcChargeInf,queryWrapper);
+            } else if ("2".equals(status)) {
+                throw new Exception("缴费失败,前去费用管理再次缴费");
+            }
+        }else{
+            throw new Exception("缴费失败,前去费用管理再次缴费");
+        }
         return AjaxResult.success();
     }
 

+ 1 - 2
sc-service/src/main/resources/mapper/common/FinanceInfMapper.xml

@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN zc_finance_pro_com_rel
         ON zfi_core_quota_id = zfpcr_id
         LEFT JOIN zc_finance_record
-        ON zfi_id = zfr_finance_id
+        ON zfi_id = zfr_finance_id AND (zfr_status != '02' OR zfr_status IS NULL)
         WHERE 1=1
         <if test="paramMap.companyId != null  and paramMap.companyId != ''">
             AND zfi_supplier_id = #{paramMap.companyId}
@@ -49,7 +49,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="paramMap.zfiId == null  or paramMap.zfiId == ''">
             and zfi_status = '02'
         </if>
-        group by zfi_id
         order by flag asc , zc_finance_inf.create_time desc
     </select>
 </mapper>