Explorar o código

企业信息项目授权短信激活,往来账款查询条件修改

ch %!s(int64=3) %!d(string=hai) anos
pai
achega
a8e0b58f14

+ 42 - 27
sc-service/src/main/java/com/huyi/service/bill/controller/OwnBillController.java

@@ -82,22 +82,22 @@ public class OwnBillController extends BaseController {
     /**
      * 往来账款列表
      *
-     * @param zbiName           账款名称
-     * @param zbiNumber         账款编号
-     * @param payerName         应付方
-     * @param payeeName         应收方
-     * @param zbiType           账款类型
-     * @param zbiStatus         账款状态
+     * @param value  查询字段  00:账款名称 01:账款编号 02:账款类型 03:应收方 04:应付方
+     * @param queryValue  查询字段值
+     * @param expireDate  预计还款日
      * @return
      */
     @GetMapping("/billList")
     public R list(
-            @RequestParam(required=false) String zbiName,
-            @RequestParam(required=false) String zbiNumber,
-            @RequestParam(required=false) String payerName,
-            @RequestParam(required=false) String payeeName,
-            @RequestParam(required=false) String zbiType,
-            @RequestParam(required=false) String zbiStatus,
+//            @RequestParam(required=false) String zbiName,
+//            @RequestParam(required=false) String zbiNumber,
+//            @RequestParam(required=false) String payerName,
+//            @RequestParam(required=false) String payeeName,
+//            @RequestParam(required=false) String zbiType,
+//            @RequestParam(required=false) String zbiStatus,
+            @RequestParam(required=false) String value,
+            @RequestParam(required=false) String queryValue,
+            @RequestParam(required = false) Map expireDate,
             QueryRequest request) {
         //查询当前操作员
         LoginUser userInfo = tokenService.getLoginUser();
@@ -108,24 +108,39 @@ public class OwnBillController extends BaseController {
         String companyType = user.getCompanyType();
         Map map = new HashMap();
         //账款类型
-        if("00".equals(zbiType)){
-            map.put("payerId", companyId);
-        }else if ("01".equals(zbiType)){
-            map.put("payeeId", companyId);
-        }
+//        if("00".equals(zbiType)){
+//            map.put("payerId", companyId);
+//        }else if ("01".equals(zbiType)){
+//            map.put("payeeId", companyId);
+//        }
         if (!"00".equals(companyType)) {
             map.put("companyId", companyId);
         }
-        //账款名称
-        map.put("zbiName", zbiName);
-        //账款编号
-        map.put("zbiNumber", zbiNumber);
-        //应付方
-        map.put("payerName", payerName);
-        //应收方
-        map.put("payeeName", payeeName);
-        //账款状态
-        map.put("zbiStatus", zbiStatus);
+        if("00".equals(value)){
+            //账款名称
+            map.put("zbiName", queryValue);
+        }else if("01".equals(value)){
+            //账款编号
+            map.put("zbiNumber", queryValue);
+        }else if("03".equals(value)){
+            //应收方
+            map.put("payeeName", queryValue);
+        }else if("04".equals(value)){
+            //应付方
+            map.put("payerName", queryValue);
+        }else if("02".equals(value)){
+            //账款类型 00:应收账款 01:应付账款
+            if("01".equals(queryValue)){
+                map.put("payerId", companyId);
+            }else if ("00".equals(queryValue)){
+                map.put("payeeId", companyId);
+            }
+        }
+//        //账款状态
+//        map.put("zbiStatus", zbiStatus);
+        //承诺还款日期
+        map.put("start",expireDate.get("expireDate[0]"));
+        map.put("end",expireDate.get("expireDate[1]"));
         IPage<Map> list = iOwnBillService.selectBillInfList(map,request);
         return R.ok(list);
     }

+ 166 - 0
sc-service/src/main/java/com/huyi/service/conmany/controller/CompanyInformationController.java

@@ -3,21 +3,30 @@ package com.huyi.service.conmany.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.huyi.service.base.entity.SysCompany;
+import com.huyi.service.base.entity.SysConfig;
 import com.huyi.service.base.entity.SysUser;
 import com.huyi.service.base.entity.SysUserCompanyRel;
 import com.huyi.service.base.service.ISysCompanyService;
+import com.huyi.service.base.service.ISysConfigService;
 import com.huyi.service.base.service.ISysUserCompanyRelService;
 import com.huyi.service.base.service.ISysUserService;
 import com.huyi.service.conmany.service.IOwnCompanyManageService;
 import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
+import com.tianhu.common.core.cfca.AxqCommonUtil;
+import com.tianhu.common.core.cfca.connector.HttpConnector;
 import com.tianhu.common.core.domain.R;
 import com.tianhu.common.core.utils.CommonUtil;
+import com.tianhu.common.core.utils.DateUtils;
 import com.tianhu.common.core.web.controller.BaseController;
+import com.tianhu.common.core.web.domain.AjaxResult;
 import com.tianhu.common.security.service.TokenService;
+import com.tianhu.system.api.RemoteConfigService;
 import com.tianhu.system.api.model.LoginUser;
+import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.lang.reflect.Method;
@@ -50,6 +59,15 @@ public class CompanyInformationController extends BaseController {
     @Autowired
     private TokenService tokenService;
 
+    //系统参数服务类
+    @Autowired
+    private RemoteConfigService configService;
+
+    @Autowired
+    private ISysConfigService sysConfigService;
+    @Autowired
+    private ISysUserCompanyRelService relService;
+
     /**
      * 企业四要素认证状态;未认证
      */
@@ -221,4 +239,152 @@ public class CompanyInformationController extends BaseController {
         }
         return l;
     }
+    /**
+     * 发送短信
+     * @param
+     * @return
+     */
+    @GetMapping("/sendMessage")
+    public R sendMessage() throws Exception{
+        //查询当前操作员
+        LoginUser userInfo = tokenService.getLoginUser();
+        //企业Id
+        String companyId = userInfo.getSysUser().getCompanyId();
+        //查询该企业的经办人信息
+        LambdaQueryWrapper<SysUserCompanyRel> relLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        //该企业
+        relLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,companyId);
+        //经办人
+        relLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
+        List<SysUserCompanyRel> relList =  relService.findSysUserCompanyRels(relLambdaQueryWrapper);
+        if(relList.size() != 1){
+            throw  new Exception("该企业经办人信息存在错误");
+        }
+        //经办人
+        String handler = CommonUtil.objToString(relList.get(0).getSucrUserId());
+        LambdaQueryWrapper<com.huyi.service.base.entity.SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        //非删除
+        sysUserLambdaQueryWrapper.eq(com.huyi.service.base.entity.SysUser::getDelFlag,"0");
+        //用户编号
+        sysUserLambdaQueryWrapper.eq(com.huyi.service.base.entity.SysUser::getUserId,handler);
+        //正常
+        sysUserLambdaQueryWrapper.eq(com.huyi.service.base.entity.SysUser::getStatus,"0");
+        List<com.huyi.service.base.entity.SysUser>   userList =  iSysUserService.findSysUsers(sysUserLambdaQueryWrapper);
+        if(userList.size() < 1){
+            throw  new Exception("获取经办人信息失败");
+        }
+        //获取手机号
+        String iphone = userList.get(0).getUserName();
+        if(CommonUtil.isEmpty(iphone)){
+            throw  new Exception("获取经办人手机号失败");
+        }
+        //CFCA电子签章用户id
+        SysCompany sysCompany = iSysCompanyService.getById(companyId);
+        String userId = sysCompany.getScyCfcaUserId();
+        //生成CFCA授权编号
+        String cfcaNumber = configService.selectConfigByKey("ZCYL-CFCA").getMsg();
+        cfcaNumber = "ZCYL-CFCA-" + cfcaNumber ;
+        //jks路径
+        String jksPath = configService.selectConfigByKey("jks_path").getMsg();
+        //密码
+        String keyStorePassword = configService.selectConfigByKey("cfca_key_store_password").getMsg();
+        //渠道
+        String channel = configService.selectConfigByKey("cfca_channel").getMsg();
+        //platId
+        String platId = configService.selectConfigByKey("cfca_platId").getMsg();
+        //发送短信验证码
+        JSONObject jsonObject = AxqCommonUtil.sendSms(userId,cfcaNumber,new HttpConnector(jksPath,keyStorePassword, channel,platId));
+        Boolean  isHave = jsonObject.has("head");
+        if(isHave){
+            JSONObject jsonObjects = jsonObject.getJSONObject("head");
+            Boolean  have = jsonObjects.has("retCode");
+            if(have){
+                String retCode =CommonUtil.objToString(jsonObjects.get("retCode"));
+                if ("60000000".equals(retCode)) {
+                    //手机号掩码
+                    String newIphone = iphone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
+                    Map<String,String > map = new HashMap<>();
+                    map.put("result",retCode);
+                    map.put("newIphone",newIphone);
+                    map.put("cfcaNumber",cfcaNumber);
+                    return R.ok(map);
+                }else{
+                    return R.fail(jsonObject.getString("retMessage"));
+                }
+            }else {
+                return R.fail(jsonObject.getString("retMessage"));
+            }
+        }else {
+            return R.fail(jsonObject.getString("errorMessage"));
+        }
+    }
+    /**
+     * 校验验证码
+     * @param validCode
+     * @return
+     */
+    @GetMapping("/checkCode")
+    public AjaxResult checkCode(@RequestParam(required=false) String validCode,@RequestParam(required=false)String cfcaNumber) throws Exception {
+
+        if(CommonUtil.isEmpty(validCode)){
+            throw  new Exception("请输入验证码");
+        }
+        if(CommonUtil.isEmpty(cfcaNumber)){
+            throw  new Exception("项目授权编号不为空");
+        }
+        //查询当前操作员
+        LoginUser userInfo = tokenService.getLoginUser();
+        com.tianhu.system.api.domain.SysUser use = userInfo.getSysUser();
+        //获取企业
+        String companyId = use.getCompanyId();
+        //CFCA电子签章用户id
+        SysCompany sysCompany = iSysCompanyService.getById(companyId);
+        String userId = sysCompany.getScyCfcaUserId();
+        //jks路径
+        String jksPath = configService.selectConfigByKey("jks_path").getMsg();
+        //密码
+        String keyStorePassword = configService.selectConfigByKey("cfca_key_store_password").getMsg();
+        //渠道
+        String channel = configService.selectConfigByKey("cfca_channel").getMsg();
+        //platId
+        String platId = configService.selectConfigByKey("cfca_platId").getMsg();
+        //校验短信验证码
+        JSONObject jsonObject = AxqCommonUtil.checkSmsCode(userId,cfcaNumber,validCode,new HttpConnector(jksPath,keyStorePassword, channel,platId));
+        Boolean  isHave = jsonObject.has("head");
+        if(isHave){
+            JSONObject jsonObjects = jsonObject.getJSONObject("head");
+            Boolean  have = jsonObjects.has("retCode");
+            if(have){
+                String retCode =CommonUtil.objToString(jsonObjects.get("retCode"));
+                if ("60000000".equals(retCode)) {
+                    String number = cfcaNumber.substring(cfcaNumber.lastIndexOf("-")+1);
+                    int num = Integer.parseInt(number) + 1;
+                    SysConfig sysConfig = new SysConfig();
+                    sysConfig.setConfigKey("ZCYL-CFCA");
+                    List<SysConfig> list = sysConfigService.selectConfigList(sysConfig);
+                    SysConfig config = list.get(0);
+                    config.setConfigValue(num+"");
+                    sysConfigService.updateConfig(config);
+                    //项目授权编号
+                    sysCompany.setScyCfcaAuthNumber(cfcaNumber);
+                    //修改时间
+                    sysCompany.setUpdateTime(DateUtils.getNowDate());
+                    //修改人
+                    sysCompany.setUpdateBy(CommonUtil.objToString(use.getUserId()));
+                    iSysCompanyService.updateSysCompany(sysCompany);
+                    Map<String,String> map = new HashMap<>();
+                    //获取结果
+                    map.put("verification",retCode);
+                    return AjaxResult.success(map);
+                } else {
+                    return AjaxResult.error(jsonObject.getString("retMessage"));
+                }
+            }else {
+                return AjaxResult.error(jsonObject.getString("retMessage"));
+            }
+        }else {
+            return AjaxResult.error(jsonObject.getString("errorMessage"));
+        }
+    }
+
 }

+ 4 - 0
sc-service/src/main/resources/mapper/bill/OwnBillMapper.xml

@@ -57,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="paramMap.zbiStatus != null  and paramMap.zbiStatus != ''">
             and b.zbi_status = #{paramMap.zbiStatus}
         </if>
+        <if test="paramMap.end != null  and paramMap.end != ''">
+            and b.zbi_pay_date between
+            #{paramMap.start} and #{paramMap.end}
+        </if>
         order by b.create_time desc
 
     </select>