Explorar el Código

feat:“优化汇付图片上传接口”

soobin hace 1 año
padre
commit
4826992d28

+ 1 - 1
src/main/java/com/szwl/aspect/MyWebMvcConfigurer.java

@@ -22,7 +22,7 @@ public class MyWebMvcConfigurer extends WebMvcConfigurationSupport {
         String[] myExcludes= {"/tAdmin/login","/tAdmin/save","/tAdmin/**","/tAdmin/updatePassword","/tMessageCode/**","/tJoinpayMch/**","/tLogo/**",
                 "/tProportion/**","/tProduct/**","/tPromoCode/**", "/tApkInfo/**", "/tProduct/selectProductList",  "/tApkInfo/**","/tJoinpayMchCheck/**","/tTimeRule/**","/sysRoleMenu/**",
                 "/tEquipmentApply/**","/tEquipment/**","/api/**","/tOrder/**","/tAlarmClock/**","/tNotice/**","/tParameters/**","/tAdmin/setRole",
-                "/tLabel/**","/tArea/**","/error","/tEquipmentDeleted/delOneDevice","/tWechat/**","/wxLogin/**"};
+                "/tLabel/**","/tArea/**","/error","/tWechat/**","/wxLogin/**"};
         registry.addInterceptor(headTokenInterceptor).addPathPatterns("/**")
                 // swagger
                 .excludePathPatterns(swaggerExcludes)

+ 9 - 5
src/main/java/com/szwl/constant/HuifuConstant.java

@@ -329,23 +329,27 @@ public class HuifuConstant {
         F22,
         F24,
         F40,
-        F41;
+        F41,
+        F55,
+        F56;
 
 
         private static Map<String, fileType> map = new HashMap<>();
 
         static {
             map.put("法人身份证正反面", F01);
-            map.put("法人身份证国徽面(人像面)", F02);
-            map.put("法人身份证人像面(国徽面)", F03);
+            map.put("法人身份证面(人像面)", F02);
+            map.put("法人身份证面(国徽面)", F03);
             map.put("营业执照", F07);
             map.put("开户许可证", F08);
             map.put("银行卡正面", F13);
             map.put("银行卡反面", F14);
             map.put("(线下场景)门头照", F22);
             map.put("(线下场景)内景照", F24);
-            map.put("法人身份证人像面", F40);
-            map.put("法人身份证国徽面", F41);
+            map.put("个人信息身份证人像面", F40);
+            map.put("个人信息身份证国徽面", F41);
+            map.put("结算人身份证人像面", F55);
+            map.put("结算人身份证国徽面", F56);
         }
 
         public static fileType forValue(String value) {

+ 35 - 0
src/main/java/com/szwl/controller/IndexController.java

@@ -20,6 +20,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.amqp.core.AmqpAdmin;
+import org.springframework.amqp.core.Binding;
+import org.springframework.amqp.core.Queue;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -57,6 +60,8 @@ public class IndexController { ;
     TPriceService priceService;
     @Autowired
     TPromoCodeService promoCodeService;
+    @Autowired
+    private AmqpAdmin amqpAdmin;
     @ApiOperation(value = "心跳")
 //    @PostMapping("/heart.htm")
     @RequestMapping(value = "/heart.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
@@ -1984,5 +1989,35 @@ public class IndexController { ;
         return "success";
     }
 
+    /**
+     * 修改机型
+     * @param clientId
+     * @param equipmentType
+     * @return
+     */
+    @GetMapping(value = "/updateEquipmentType")
+    @ResponseBody
+    public String updateEquipmentType(String clientId,String equipmentType){
+        if(StringUtils.isNotEmpty(clientId)&&StringUtils.isNotEmpty(equipmentType)){
+            // 删除MQ队列
+            amqpAdmin.deleteQueue(clientId);
+            // 重新创建队列
+            Map<String,Object> arg = new HashMap<>();
+            arg.put("x-message-ttl",1800000);
+            HashMap<String, Object> objectObjectHashMap = new HashMap<>();
+            amqpAdmin.declareBinding(new Binding(clientId,
+                    Binding.DestinationType.QUEUE,
+                    equipmentType, clientId, objectObjectHashMap));
+            LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+            query.eq(TEquipment::getClientId,clientId);
+            TEquipment equipment = equipmentService.getOne(query);
+            equipment.setEquimentType(equipmentType);
+            equipmentService.updateById(equipment);
+            return "success";
+        }
+        return "error";
+    }
+
+
 }
 

+ 5 - 15
src/main/java/com/szwl/controller/TEquipmentApplyController.java

@@ -148,9 +148,6 @@ public class TEquipmentApplyController {
                             return R.fail(ResponseCodesEnum.A0001,"已生成机器");
                         }
                         String old = "";
-//                        ArrayList<Filter> filters = new ArrayList<>();
-//                        filters.add(Filter.eq("clientId", clientId + "xxx"));
-//                        List<Equipment> list = equipmentService.findList(null, filters, null);
                         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
                         query.like(TEquipment::getClientId,clientId+"xxx");
                         List<TEquipment> list = equipmentService.list(query);
@@ -168,13 +165,12 @@ public class TEquipmentApplyController {
                             equipment.setAdminLevel(adminLevel);
                             equipment.setAdminUserName(adminUserName);
                             equipment.setType(type);
-                            equipment.setCompanyType(companyType); // 公司平台
-                            equipment.setMachineType(machineType); // 设备类型
+                            // 公司平台
+                            equipment.setCompanyType(companyType);
+                            // 设备类型
+                            equipment.setMachineType(machineType);
                             if(equimentType.equals("MG320-1")){
                                 if(!equipmentApply.getEquimentType().equals(equipment.getEquimentType())&&equipment.getEquimentType().equals("MG320")){
-//                                    List<Filter> filter = new ArrayList<>();
-//                                    filter.add(Filter.eq("equipmentId",  equipment.getId()));
-//                                    List<Product> productList = productService.findList(null, filter, null);
                                     LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
                                     queryProduct.eq(TProduct::getEquipmentId,equipment.getId());
                                     List<TProduct> productList = productService.list(queryProduct);
@@ -204,7 +200,6 @@ public class TEquipmentApplyController {
                                     proportionService.removeById(proportion.getId());
                                 }
                             }
-//                            String data = com.alibaba.fastjson.JSON.toJSONString(equipment);
                             try {
                                 esTEquipmentService.updateDataById(equipment);
                             }catch (Exception e) {
@@ -253,7 +248,7 @@ public class TEquipmentApplyController {
 //                        }
                         if(!StringUtils.isEmpty(equimentType)&&equimentType.equals("MG280")){
                             Long monthBegin = getMonthBegin(new Date());
-                            long time = new Date().getTime();
+                            long time = System.currentTimeMillis();
                             if(time<monthBegin){
                                 equipment.setEndDate(new Date(monthBegin));
                             }else{
@@ -285,13 +280,8 @@ public class TEquipmentApplyController {
                         }
                         LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
                         query1.eq(TEquipment::getClientId,clientId);
-//                        List<TEquipment> list1 = equipmentService.list(query1);
                         TEquipment tEquipment = equipmentService.getOne(query1);
                         try {
-//                            if(list1.size()>0){
-//                                TEquipment tEquipment = list1.get(0);
-//                                esTEquipmentService.insertData(tEquipment);
-//                            }
                             if(tEquipment != null) {
                                 esTEquipmentService.insertData(tEquipment);
                             }

+ 1 - 27
src/main/java/com/szwl/controller/TEquipmentController.java

@@ -522,14 +522,10 @@ public class TEquipmentController {
         List<TAdminDTO> resultList = new ArrayList<>();
 
         if ("admin".equals(param.getUsername())) { // 管理员查所有商家
-//            List<TAdmin> adminList = tAdminService.selectByOption(null);
             List<TAdmin> adminList = tAdminService.list();
-//            List<TEquipment> equipmentList = tEquipmentService.selectByOption(null);
             List<TEquipment> equipmentList = tEquipmentService.list();
-//            List<TAlarmRecord> alarmRecordList = tAlarmRecordService.getLastAlarmRecord(null);
             List<TAlarmRecord> alarmRecordList = tAlarmRecordService.list();
             //获取当前用户今天所有机器的所以警报信息
-//            List<TAlarmRecord> alarmList = tAlarmRecordService.getAlarmList(null);
             List<TAlarmRecord> alarmList = tAlarmRecordService.getAlarmList(null);
 
             resultList = adminList.stream().map(e -> {
@@ -572,10 +568,6 @@ public class TEquipmentController {
         } else { // 只查当前商家的设备列表
             TAdminDTO dto = new TAdminDTO();
             BeanUtils.copyPropertiesIgnoreNull(param, dto, true);
-//            TEquipmentExample example = new TEquipmentExample();
-//            TEquipmentExample.Criteria criteria = example.createCriteria();
-//            criteria.andAdminIdEqualTo(param.getId());
-//            List<TEquipment> equipmentList = tEquipmentService.selectByOption(example);
             // 需要区分是否商家子账户
             LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
             query.eq(TEquipment::getAdminId, param.getId());
@@ -595,7 +587,6 @@ public class TEquipmentController {
                 //获取该机器的所有警报信息
                 List<TAlarmRecord> eqAlarmList = alarmList.stream().filter(alarm -> equipment.getClientId().equals(alarm.getClientId())).collect(Collectors.toList());
                 equipmentDTO.setAlarmList(eqAlarmList);
-//                if(DateUtils.isSameDay(new Date(),op.get().getOccurrenceTime())){
                 if (eqAlarmList.size() > 0) {
                     int i = 0;
                     for (TAlarmRecord alarmRecord : eqAlarmList) {
@@ -717,10 +708,6 @@ public class TEquipmentController {
             return ResponseEntity.status(HttpStatus.OK)
                     .body(new ResultMessage().setCode(false).setData("").setMessage("设备编号为空"));
         }
-//        TEquipmentExample example = new TEquipmentExample();
-//        TEquipmentExample.Criteria criteria = example.createCriteria();
-//        criteria.andClientIdLike(equipment.getClientId());
-//        List<TEquipment> list = tEquipmentService.selectByOption(example);
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.like(TEquipment::getClientId, equipment.getClientId());
         List<TEquipment> list = tEquipmentService.list(query);
@@ -1052,10 +1039,6 @@ public class TEquipmentController {
                             .setData("SUCCESS")
                             .setMessage("SUCCESS"));
         }
-//        TEquipmentExample example = new TEquipmentExample();
-//        TEquipmentExample.Criteria criteria = example.createCriteria();
-//        criteria.andAdminIdEqualTo(Long.valueOf(adminId));
-//        List<TEquipment> equipmentList = tEquipmentService.selectByOption(example);
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getAdminId, Long.valueOf(adminId));
         List<TEquipment> equipmentList = tEquipmentService.list(query);
@@ -1078,10 +1061,6 @@ public class TEquipmentController {
     @PostMapping("/checkEquipmentStatus")
     public ResponseEntity<?> checkEquipmentStatus(@RequestBody StatisticsParam param) {
         String adminId = param.getAdminId();
-//        TEquipmentExample example = new TEquipmentExample();
-//        TEquipmentExample.Criteria criteria = example.createCriteria();
-//        criteria.andAdminIdEqualTo(Long.valueOf(adminId));
-//        List<TEquipment> equipmentList = tEquipmentService.selectByOption(example);
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getAdminId, Long.valueOf(adminId));
         List<TEquipment> equipmentList = tEquipmentService.list(query);
@@ -1090,9 +1069,6 @@ public class TEquipmentController {
             for (TEquipment equipment : equipmentList) {
                 long modifyTime = equipment.getModifyDate().getTime();
                 if (nowTime > modifyTime && (nowTime - modifyTime) > 310000) {
-//                    if((nowTime-modifyTime)>310000){
-//                        equipment.setEqeStatus(0);
-//                    }
                     equipment.setCabinetTm("");
                     equipment.setCabinetHd("");
                     equipment.setFurnaceTm("");
@@ -1141,13 +1117,11 @@ public class TEquipmentController {
             equipment.setEqeStatus(1);
         }
         Long time = getNetworkTime();
-//        long time = new Date().getTime();
-//        PushUtils.push(equipment.getGtClientId(), String.valueOf(time), "", PushUtils.buildJson("eqeStatus", eqeStatus).toString());
         if (time == null) {
             time = getNetworkTime();
         }
         if (time == null) {
-            time = new Date().getTime();
+            time = System.currentTimeMillis();
         }
         if (time != null) {
 //            System.out.println("time=="+time);

+ 65 - 0
src/main/java/com/szwl/controller/THuifuMchController.java

@@ -11,10 +11,12 @@ import com.szwl.model.bo.R;
 import com.szwl.model.bo.ResponseModel;
 import com.szwl.model.entity.THuifuMch;
 import com.szwl.model.entity.THuifuMchCheck;
+import com.szwl.model.param.UploadParms;
 import com.szwl.service.THuifuMchCheckService;
 import com.szwl.service.THuifuMchService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -263,5 +265,68 @@ public class THuifuMchController {
         }
     }
 
+    @ApiOperation(value = "上传材料图片")
+    @PostMapping("/newUploadPic")
+    public ResponseModel<?> newUploadPic(@RequestBody UploadParms uploadParms){
+        Long adminId = uploadParms.getAdminId();
+        String base64Str = uploadParms.getBase64Str();
+        String fileType = uploadParms.getFileType();
+        if (adminId == null) {
+            return R.fail(ResponseCodesEnum.A0001);
+        }
+        // 找到用户id对应的审核信息
+        LambdaQueryWrapper<THuifuMchCheck> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(THuifuMchCheck::getAdminId,adminId);
+        THuifuMchCheck tHuifuMchCheck = tHuifuMchCheckService.getOne(queryWrapper);
+        if(tHuifuMchCheck == null) {
+            return R.fail(ResponseCodesEnum.A0206,"还未填写个人资料");
+        }
+        String result = "";
+        String huifuId = null;
+        if(StringUtils.isNotEmpty(tHuifuMchCheck.getHuifuId())) {
+            huifuId = tHuifuMchCheck.getHuifuId();
+        }
+        if(StringUtils.isNotEmpty(base64Str)) {
+            try{
+                if(fileType.equals(HuifuConstant.fileType.F02.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F02, huifuId);
+                    tHuifuMchCheck.setLegalCertFrontPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F03.toString())){
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F03, huifuId);
+                    tHuifuMchCheck.setLegalCertBackPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F13.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F13, huifuId);
+                    tHuifuMchCheck.setCardFrontPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F07.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F07, huifuId);
+                    tHuifuMchCheck.setLicensePic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F08.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F08, huifuId);
+                    tHuifuMchCheck.setRegAcctPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F40.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F40, huifuId);
+                    tHuifuMchCheck.setLegalCertFrontPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F41.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F41, huifuId);
+                    tHuifuMchCheck.setLegalCertBackPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F55.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F55, huifuId);
+                    tHuifuMchCheck.setCertFrontPic(result);
+                } else if (fileType.equals(HuifuConstant.fileType.F56.toString())) {
+                    result = tHuifuMchService.newUploadPic(base64Str, HuifuConstant.fileType.F56, huifuId);
+                    tHuifuMchCheck.setCertBackPic(result);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        if(StrUtil.isNotEmpty(result)) {
+            tHuifuMchCheckService.updateById(tHuifuMchCheck);
+            return R.ok("上传成功").setData(result);
+        } else {
+            return R.fail(ResponseCodesEnum.F0000,"上传失败");
+        }
+    }
+
 }
 

+ 11 - 9
src/main/java/com/szwl/controller/TJoinpayMchController.java

@@ -109,15 +109,17 @@ public class TJoinpayMchController {
             //取消审核步骤
 //            ResponseModel<?> checkMch = createCheckMch(mch, tJoinpayMch);
             //提交并修改
-            if(!mch.getApproveStatus().equals("审核通过")){
-                if (!StringUtils.isEmpty(tJoinpayMch.getLegalPerson())) {
-                    mch.setLegalPerson(tJoinpayMch.getLegalPerson());
-                }
-                if (tJoinpayMch.getIdCardNo()!=null) {
-                    mch.setIdCardNo(tJoinpayMch.getIdCardNo());
-                }
-                if (!StringUtils.isEmpty(tJoinpayMch.getLicenseNo())) {
-                    mch.setLicenseNo(tJoinpayMch.getLicenseNo());
+            if(StringUtils.isNotEmpty(mch.getApproveStatus())) {
+                if(!mch.getApproveStatus().equals("审核通过")){
+                    if (!StringUtils.isEmpty(tJoinpayMch.getLegalPerson())) {
+                        mch.setLegalPerson(tJoinpayMch.getLegalPerson());
+                    }
+                    if (tJoinpayMch.getIdCardNo()!=null) {
+                        mch.setIdCardNo(tJoinpayMch.getIdCardNo());
+                    }
+                    if (!StringUtils.isEmpty(tJoinpayMch.getLicenseNo())) {
+                        mch.setLicenseNo(tJoinpayMch.getLicenseNo());
+                    }
                 }
             }
 

+ 18 - 0
src/main/java/com/szwl/model/param/UploadParms.java

@@ -0,0 +1,18 @@
+package com.szwl.model.param;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Accessors(chain = true)
+@ApiModel(description = "")
+@Data
+public class UploadParms {
+
+    private String base64Str;
+
+    private Long adminId;
+
+    private String fileType;
+
+}

+ 8 - 0
src/main/java/com/szwl/service/THuifuMchService.java

@@ -67,4 +67,12 @@ public interface THuifuMchService extends IService<THuifuMch> {
      * @return
      */
     String sendSms(THuifuMch tHuifuMch) throws Exception;
+
+    /**
+     * 汇付上传图片
+     * @param base64Str
+     * @param fileType
+     * @return
+     */
+    String newUploadPic(String base64Str, HuifuConstant.fileType fileType, String huifuId);
 }

+ 69 - 9
src/main/java/com/szwl/service/impl/THuifuMchServiceImpl.java

@@ -22,6 +22,7 @@ import com.szwl.service.THuifuMchService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.szwl.util.HuifuUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpStatus;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -43,6 +44,8 @@ import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 
+import static com.szwl.util.HuifuUtils.base64ToTempImage;
+
 /**
  * <p>
  *  服务实现类
@@ -109,9 +112,9 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
         request.put("legal_cert_no", tHuifuMchCheck.getCertNo());
         // 结算卡正面
         request.put("settle_card_front_pic", tHuifuMchCheck.getCardFrontPic());
-        // 法人身份证人像面
-        request.put("legal_cert_back_pic", tHuifuMchCheck.getLegalCertBackPic());
         // 法人身份证国徽面
+        request.put("legal_cert_back_pic", tHuifuMchCheck.getLegalCertBackPic());
+        // 法人身份证人像面
         request.put("legal_cert_front_pic", tHuifuMchCheck.getLegalCertFrontPic());
         // 结算卡信息配置
         JSONObject cardInfo = new JSONObject();
@@ -444,16 +447,14 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
             cardInfo.put("mp", huifuMchCheck.getMp());
         }
         cardInfo.put("settle_card_front_pic", huifuMchCheck.getCardFrontPic());
-        cardInfo.put("settle_cert_front_pic", huifuMchCheck.getCertBackPic());
-        cardInfo.put("settle_cert_back_pic", huifuMchCheck.getCertFrontPic());
-        cardInfo.put("legal_cert_front_pic", huifuMchCheck.getCertBackPic());
-        cardInfo.put("legal_cert_back_pic", huifuMchCheck.getCertFrontPic());
+        cardInfo.put("settle_cert_front_pic", huifuMchCheck.getCertFrontPic());
+        cardInfo.put("settle_cert_back_pic", huifuMchCheck.getCertBackPic());
+        cardInfo.put("legal_cert_front_pic", huifuMchCheck.getLegalCertFrontPic());
+        cardInfo.put("legal_cert_back_pic", huifuMchCheck.getLegalCertBackPic());
         if(StrUtil.isNotEmpty(huifuMchCheck.getSms())) {
             cardInfo.put("verify_code", huifuMchCheck.getSms());
         }
         request.put("card_info", cardInfo);
-//        request.put("legal_cert_front_pic", huifuMchCheck.getCertBackPic());
-//        request.put("legal_cert_back_pic", huifuMchCheck.getCertFrontPic());
         // 签名:sign
         String s = JSON.toJSONString(request);
         String s1 = JSON.toJSONString(JSONObject.parseObject(s, TreeMap.class));
@@ -558,7 +559,6 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
             e.printStackTrace();
         }
         return result;
-
     }
 
     @Override
@@ -610,6 +610,12 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
         }
     }
 
+    /**
+     * 汇付发送验证码
+     * @param tHuifuMch
+     * @return
+     * @throws Exception
+     */
     @Override
     public String sendSms(THuifuMch tHuifuMch) throws Exception {
         String url = "https://api.huifu.com/v2/merchant/basicdata/sms/send";
@@ -645,4 +651,58 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
         String respCode = data.getString("resp_code");
         return respCode;
     }
+
+    /**
+     * 汇付上传图片
+     * @param base64Str
+     * @return
+     */
+    @Override
+    public String newUploadPic(String base64Str, HuifuConstant.fileType fileType, String huifuId) {
+        String url = "https://api.huifu.com/v2/supplementary/picture";
+        // 请求参数
+        Map<String, Object> params = new HashMap<String, Object>();
+        // 请求流水号,需保证当天商户下唯一,推荐采用日期时间+几位流水号的形式
+        params.put("req_seq_id", SequenceTools.getReqSeqId32());
+        params.put("req_date", DateTools.getCurrentDateYYYYMMDD());
+        params.put("file_type", fileType);
+        if(StringUtils.isNotEmpty(huifuId)) {
+        params.put("huifu_id", huifuId);
+        }
+        String data = JSON.toJSONString(params);
+
+
+        CloseableHttpClient httpclient1 = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String result = null;
+        File tempFile = new File("");
+        try {
+            tempFile = base64ToTempImage(base64Str);
+
+            HttpPost httpPost = new HttpPost(url);
+            ContentType contentType = ContentType.create("text/plain", Charset.forName("UTF-8"));
+            MultipartEntityBuilder mEntityBuilder = MultipartEntityBuilder.create();
+            mEntityBuilder.addTextBody("sys_id", HuifuConstant.SYS_ID, contentType);
+            mEntityBuilder.addTextBody("product_id", HuifuConstant.PRODUCT_ID, contentType);
+            mEntityBuilder.addTextBody("data", data, contentType);
+            mEntityBuilder.addBinaryBody("file", tempFile);
+
+            httpPost.setEntity(mEntityBuilder.build());
+            response = httpclient1.execute(httpPost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_OK) {
+                HttpEntity resEntity = response.getEntity();
+                result = EntityUtils.toString(resEntity);
+                System.out.print(result);
+                JSONObject jsonObject = JSONObject.parseObject(result);
+                JSONObject dataObject = jsonObject.getJSONObject("data");
+                result = dataObject.getString("file_id");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally{
+            tempFile.delete();
+        }
+        return result;
+    }
 }

+ 6 - 10
src/main/java/com/szwl/service/impl/TJoinpayMchServiceImpl.java

@@ -56,16 +56,11 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
         JSONObject requestData = new JSONObject(new LinkedHashMap());
 
         String login_name = "test1_" + adminId + "@mianhuatang.com";
-//        String login_name = mch.getLegal_person();
         mch.setLoginName(login_name);
-
-//        String alt_mch_name = "test1_" + adminId  + "@mianhuatang.com";
-//        String alt_mch_name = mch.getLegal_person();
-
         String alt_mch_name = mch.getBankAccountName();
         mch.setAltMchName(alt_mch_name);
         mch.setAltMchShortName("");
-//        mch.setAlt_mch_short_name("");
+
 
         // 格式为16 位随机字符串:16 位随机字符串
         String aes_key1 = getRandomString(16);
@@ -216,10 +211,11 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
         String aes_key2 = getRandomString(16);
 
         requestData.put("alt_mch_no", mch.getAltMchNo());
-        if(!mch.getApproveStatus().equals("审核通过")){
-            requestData.put("legal_person", mch.getLegalPerson());
-            requestData.put("id_card_no",  mch.getIdCardNo());
-
+        if(StringUtils.isNotEmpty(mch.getApproveStatus())) {
+            if(!mch.getApproveStatus().equals("审核通过")){
+                requestData.put("legal_person", mch.getLegalPerson());
+                requestData.put("id_card_no",  mch.getIdCardNo());
+            }
         }
 //        requestData.put("legal_person", AESUtil.encrypt(legal_person, aes_key1 ,  aes_key2 ));
 //        requestData.put("legal_person", mch.getLegalPerson());

+ 25 - 2
src/main/java/com/szwl/util/HuifuUtils.java

@@ -2,10 +2,11 @@ package com.szwl.util;
 
 import cn.hutool.core.util.RandomUtil;
 import com.huifu.bspay.sdk.opps.core.utils.DateTools;
-import com.huifu.bspay.sdk.opps.core.utils.RandomTools;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
 import java.security.PublicKey;
@@ -77,4 +78,26 @@ public class HuifuUtils {
         String numbers = RandomUtil.randomNumbers(10);
         return new StringBuilder(DateTools.getCurrentDateTimeYYYYMMDDHHMMSSSSS()).append(numbers).toString();
     }
+
+    /**
+     * 转base64为图片
+     * @param base64Str
+     * @return
+     * @throws IOException
+     */
+    public static File base64ToTempImage(String base64Str) throws IOException {
+        // 解码base64字符串
+        byte[] imageBytes = Base64.getDecoder().decode(base64Str.split(",")[1]);
+
+        // 创建一个临时文件
+        File tempFile = File.createTempFile("temp_image", ".jpg");
+
+        // 将解码后的数据写入临时文件
+        try (FileOutputStream fos = new FileOutputStream(tempFile)) {
+            fos.write(imageBytes);
+        }
+
+        // 返回临时文件
+        return tempFile;
+    }
 }