k94314517
2025-07-01 520433f6d88c1f4c1a2d31ca950f2309da2d4a9a
server/service/src/main/java/com/doumee/api/common/PublicController.java
@@ -4,16 +4,23 @@
import com.doumee.api.BaseController;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.aliyun.ALiYunUtil;
import com.doumee.core.utils.aliyun.ProgressModel;
import com.doumee.dao.business.model.InterfaceLog;
import com.doumee.service.business.InsuranceApplyService;
import com.doumee.service.business.InterfaceLogService;
import com.jzq.common.bean.sign.NotifyDataReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,10 +34,7 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
 * @author Eva.Caesar Liu
@@ -46,6 +50,49 @@
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private InsuranceApplyService insuranceApplyService;
    @Autowired
    public InterfaceLogService interfaceLogService = null;
    @ApiOperation("君子签签约回调通知")
    @PostMapping("/signNotify")
    public void updateStatus(@RequestParam Map<String,String> req, HttpServletResponse response) {
        Map<String, Object> context = new HashMap<>();
        context.put("success",true);
        InterfaceLog log=new InterfaceLog();
        log.setType(1);
        log.setCreateDate(new Date());
        log.setIsdeleted(0);
        log.setRequest(JSONObject.toJSONString(req));
        log.setName("君子签签约回调通知");
        log.setUrl(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode());
        try {
            String appKey = systemDictDataBiz.queryByCode(Constants.SIGN,Constants.SIGN_APPKEY).getCode();
            String appSecret  = systemDictDataBiz.queryByCode(Constants.SIGN,Constants.SIGN_APPSECRET).getCode();
            if(!StringUtils.equals(appKey,req.get("appkey"))){
                throw  new BusinessException(com.doumee.core.constants.ResponseStatus.BAD_REQUEST.getCode(),"appkey不匹配");
            }
            String sign = DigestUtils.sha1Hex("data"+ req.get("data")+"method"+req.get("method")+"version"+req.get("version")+"timestamp"+req.get("timestamp")
                    +"appKey"+appKey+"appSecret"+appSecret);
            if(!StringUtils.equals(sign,req.get("sign"))){
                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"验签不通过");
            }
            NotifyDataReq data   = JSONObject.parseObject(req.get("data"), NotifyDataReq.class);
            String r =  insuranceApplyService.dealSignResult(data);
            log.setRepose(r);
        }catch (Exception e){
            log.setRepose("处理异常;"+e.getMessage());
            context.put("success",false);
            context.put("msg","处理发生异常");
            throw  e;
        }finally {
            interfaceLogService.create(log);
        }
        writerJson(response, context);
    }
    @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6)
    @ApiImplicitParams({
@@ -340,4 +387,5 @@
        writerJson(response, context);
        return;
    }
}