ch 3 rokov pred
rodič
commit
7e0d9c2c07

+ 13 - 0
sc-service/src/main/java/com/huyi/service/contract/controller/ContractControllers.java

@@ -54,6 +54,15 @@ public class ContractControllers extends BaseController {
     @Autowired
     private IPubFileInfService pubFileInfService;
 
+    /**
+     * 合同列表查询
+     * @param zfcName 合同名称
+     * @param scyName 资方
+     * @param zfcSubject 签署主体
+     * @param zfcStatus 状态
+     * @param request
+     * @return
+     */
     @GetMapping("/list")
     public AjaxResult list(String zfcName, String scyName,String zfcSubject , String zfcStatus, QueryRequest request) {
         //查询当前操作员
@@ -94,10 +103,13 @@ public class ContractControllers extends BaseController {
     @GetMapping(value = "/{zfcId}")
     public AjaxResult getInfo(@PathVariable("zfcId") String zfcId)
     {
+        //查询合同详情
         ZcFinanceContract zcFinanceContract = zcFinanceContractService.getById(zfcId);
         Map map = new HashMap(16);
         map.put("zcFinanceContract",zcFinanceContract);
+        //合同附件ID
         String zfcFile = zcFinanceContract.getZfcFile();
+        //查询文件信息
         PubFileInf pubFileInf = pubFileInfService.getById(zfcFile);
         if(pubFileInf !=null){
             String fileUrl = pubFileInf.getPfiUrl();
@@ -220,6 +232,7 @@ public class ContractControllers extends BaseController {
      */
     @PreAuthorize(hasPermi = "service:contract:edit")
     @Log(title = "合同信息", businessType = BusinessType.UPDATE)
+    @Transactional(rollbackFor=Exception.class)
     @PutMapping
     public AjaxResult edit(@RequestBody Map map)throws Exception {
         //获取当前用户

+ 32 - 4
sc-service/src/main/java/com/huyi/service/financeProduct/controller/FinanceProductControllers.java

@@ -31,6 +31,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 /**
  * 融资产品controller
@@ -55,6 +56,17 @@ public class FinanceProductControllers extends BaseController {
     @Autowired
     private IZcFinanceContractService zcFinanceContractService;
 
+    private static final String REGEX = "^([1-9][0-9]*)+(\\.[0-9]{1,2})?$";
+
+    /**
+     * 查询融资产品列表
+     * @param zfpName 产品名称
+     * @param scyName 资方
+     * @param begin 最短账期
+     * @param end 最短账期
+     * @param request
+     * @return
+     */
     @GetMapping("/list")
     public AjaxResult list(String zfpName, String scyName, String begin,String end, QueryRequest request) {
         //查询当前操作员
@@ -98,20 +110,25 @@ public class FinanceProductControllers extends BaseController {
     @GetMapping(value = "/{zfpId}")
     public AjaxResult getInfo(@PathVariable("zfpId") String zfpId)
     {
+        //查询融资产品详情
         Map map = new HashMap();
+        //融资产品主键
         map.put("zfpId",zfpId);
+        //查询用户名称
         Map resultMap = ownFinanceProductService.selectUserName(map);
         ZcFinanceProduct zcFinanceProduct = zcFinanceProductService.getById(zfpId);
         resultMap.put("zcFinanceProduct",zcFinanceProduct);
-        //授信合同信息
+        //查询融资产品关联合同
         LambdaQueryWrapper<ZcFinanceProConRel> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ZcFinanceProConRel::getZfpcrProductId,zfpId);
         List<ZcFinanceProConRel> zcFinanceProConRel = zcFinanceProConRelService.findZcFinanceProConRels(queryWrapper);
+        //获取关联的合同ID
         List id = new ArrayList();
         for (int i = 0; i < zcFinanceProConRel.size(); i++) {
             String contractId = zcFinanceProConRel.get(i).getZfpcrContractId();
             id.add(contractId);
         }
+        //查询合同信息
         if (id.size() > 0) {
             LambdaQueryWrapper<ZcFinanceContract> contractWrapper = new LambdaQueryWrapper<>();
             contractWrapper.in(ZcFinanceContract::getZfcId, id);
@@ -154,7 +171,7 @@ public class FinanceProductControllers extends BaseController {
         //是否可拆转融
         String zfpSplit = CommonUtil.objToString(map.get("zfpSplit"));
         if(CommonUtil.isEmpty(zfpSplit)){
-            return AjaxResult.error("请选择是否可拆转融(二期处理)");
+            return AjaxResult.error("请选择是否可拆转融");
         }
         //最小融资金额
         String zfpMinimumAmount = CommonUtil.objToString(map.get("zfpMinimumAmount"));
@@ -209,6 +226,11 @@ public class FinanceProductControllers extends BaseController {
         String zfpExpire = CommonUtil.objToString(map.get("zfpExpire"));
         //资方融资费率
         String zfpRate = CommonUtil.objToString(map.get("zfpRate"));
+        if(CommonUtil.isNotEmpty(zfpRate)){
+            if(!Pattern.matches(REGEX,zfpRate)){
+                return AjaxResult.error("请选择正确德资方融资费率");
+            }
+        }
         //资方是否支持返佣
         String zfpProfit = CommonUtil.objToString(map.get("zfpProfit"));
         //资方返佣方式
@@ -221,7 +243,7 @@ public class FinanceProductControllers extends BaseController {
         String zfpId = IdUtils.fastUUID();
         //创建时间
         String createTime = DateUtils.dateTimeNow();
-        //产品编号
+        //产品编号 融资产品类型(核心企业 L 、 供应商 F)+ 是否需要平台审批(否:P 是:A )+ 时间戳
         String zfpNumber = "";
         if("0".equals(zfpType)){
             zfpNumber += "F";
@@ -283,6 +305,7 @@ public class FinanceProductControllers extends BaseController {
      */
     @PreAuthorize(hasPermi = "service:financeProduct:edit")
     @Log(title = "融资产品信息", businessType = BusinessType.UPDATE)
+    @Transactional(rollbackFor=Exception.class)
     @PutMapping
     public AjaxResult edit(@RequestBody Map map)throws Exception
     {
@@ -368,6 +391,11 @@ public class FinanceProductControllers extends BaseController {
         String zfpExpire = CommonUtil.objToString(map.get("zfpExpire"));
         //资方融资费率
         String zfpRate = CommonUtil.objToString(map.get("zfpRate"));
+        if(CommonUtil.isNotEmpty(zfpRate)){
+            if(!Pattern.matches(REGEX,zfpRate)){
+                return AjaxResult.error("请选择正确德资方融资费率");
+            }
+        }
         //资方是否支持返佣
         String zfpProfit = CommonUtil.objToString(map.get("zfpProfit"));
         //资方返佣方式
@@ -402,7 +430,7 @@ public class FinanceProductControllers extends BaseController {
         //合同信息
         List<Map<String, String>> tableData = (List<Map<String, String>>) map.get("contractList1");
         if (tableData.size() == 0 ){
-            return AjaxResult.error("请选择合同");
+            throw new Exception("请选择合同");
         }
         //新增融资产品合同关联表
         for (int i = 0; i < tableData.size(); i++) {

+ 38 - 6
sc-service/src/main/java/com/huyi/service/repayment/controller/repaymentController.java

@@ -20,7 +20,9 @@ import com.tianhu.common.log.enums.BusinessType;
 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.RemoteConfigService;
+import com.tianhu.system.api.domain.SysUser;
 import org.apache.commons.io.FileUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.slf4j.Logger;
@@ -32,10 +34,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 还款controller
@@ -56,6 +55,8 @@ public class repaymentController extends BaseController {
     private IZcFinanceRecordService zcFinanceRecordService;
     @Autowired
     private IZcFinanceInfService zcFinanceInfService;
+    @Autowired
+    private TokenService tokenService;
     /**
      * 查询全部还款列表
      * @param type
@@ -68,15 +69,28 @@ public class repaymentController extends BaseController {
     public AjaxResult list(String type, String value,
                            @RequestParam(required = false) Map repaymentDate,
                            String status, QueryRequest request) {
+        //TODO 根据企业类型展示自己的还款记录信息
+        //当前用户
+        SysUser user = tokenService.getLoginUser().getSysUser();
+        //企业Id
+        String company = user.getCompanyId();
+        //企业类型
+        String companyType = user.getCompanyType();
         Map map = new HashMap(16);
+        // 企业类型 00:平台,01:核心企业,02:供应商,03:资方
+        if("02".equals(companyType)){
+            map.put("supplierId",company);
+        }else if("01".equals(companyType)){
+            map.put("coreId",company);
+        }
         if(CommonUtil.isNotEmpty(type)){
             if("00".equals(type)){
                 //资金方
                 map.put("scyName",value);
-            }else if("01".equals(type)){
+            }else if("02".equals(type)){
                 //融信编号
                 map.put("zfiNumber",value);
-            }else if("02".equals(type)){
+            }else if("01".equals(type)){
                 //融资编号
                 map.put("zfrNumber",value);
             }else {
@@ -362,4 +376,22 @@ public class repaymentController extends BaseController {
         zcFinanceInfService.updateZcFinanceInf(zcFinanceInf);
         return null;
     }
+
+    /**
+     * 查询代还款金额
+     * @param day 天数
+     * @return
+     */
+    @GetMapping("/repaymentAmount")
+    public AjaxResult repaymentAmount(String day){
+        Map map = new HashMap();
+        if(CommonUtil.isNotEmpty(day)){
+            int days = Integer.parseInt(day);
+            //当前日期
+            String date = DateUtils.getFetureDate(days);
+            map.put("day",date);
+        }
+
+        return AjaxResult.success(map);
+    }
 }

+ 17 - 0
sc-service/src/main/resources/mapper/repayment/OwnRepaymentMapper.xml

@@ -31,6 +31,12 @@
             on i.zfi_core_id = y.scy_id
             where 1=1
             AND r.zfr_status = '01'
+            <if test="paramMap.supplierId != null  and paramMap.supplierId != ''">
+                and i.zfi_supplier_id = #{paramMap.supplierId}
+            </if>
+            <if test="paramMap.coreId != null  and paramMap.coreId != ''">
+                and i.zfi_core_id = #{paramMap.coreId}
+            </if>
             <if test="paramMap.zfrApplyStatus != null  and paramMap.zfrApplyStatus != ''">
                 AND r.zfr_apply_status = #{paramMap.zfrApplyStatus}
             </if>
@@ -112,5 +118,16 @@
         AND r.zfr_apply_status != '01'
         order by r.create_time desc
     </select>
+    <select id="selectRepaymentAmount" parameterType="map" resultType="map">
+        select
+            zfr_loan_amount 'zfrLoanAmount'
+        from zc_finance_record
+        where zfr_apply_status = '00'
+        <if test="day != null  and day != ''">
+            <![CDATA[
+                and zfr_repayment_date <= #{day}
+            ]]>
+        </if>
+    </select>
 
 </mapper>