PiccErrOrderController.java 22.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530
package com.lhcredit.project.business.piccErrOrder.controller;

import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Date;
import java.util.UUID;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lhcredit.common.utils.HolidayOrWork;
import com.lhcredit.common.utils.StringUtils;
import com.lhcredit.common.utils.security.ShiroUtils;
import com.lhcredit.project.business.HolidayWorkday.domain.HolidayWorkday;
import com.lhcredit.project.business.HolidayWorkday.mapper.HolidayWorkdayMapper;
import com.lhcredit.project.business.bCreditReport.domain.BCreditReport;
import com.lhcredit.project.business.bCreditReport.service.IBCreditReportService;
import com.lhcredit.project.business.country.domain.CountryName;
import com.lhcredit.project.business.country.service.ICountryNameService;
import com.lhcredit.project.business.frontDept.domain.FrontDept;
import com.lhcredit.project.business.frontDept.service.IFrontDeptService;
import com.lhcredit.project.business.frontUser.domain.FrontUser;
import com.lhcredit.project.business.frontUser.service.IFrontUserService;
import com.lhcredit.project.business.overseasreportedprices.domain.Overseasreportedprices;
import com.lhcredit.project.business.overseasreportedprices.mapper.OverseasreportedpricesMapper;
import com.lhcredit.project.business.templateConfiguration.domain.TemplateConfiguration;
import com.lhcredit.project.business.worldboxlog.domain.Worldboxlog;
import com.lhcredit.project.webbusiness.controller.PiccOverseasController;
import com.lhcredit.project.worldbox.EasyAPI;
import com.lhcredit.project.worldbox.WorldBoxAPI;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lhcredit.framework.aspectj.lang.annotation.Log;
import com.lhcredit.framework.aspectj.lang.enums.BusinessType;
import com.lhcredit.project.business.piccErrOrder.domain.PiccErrOrder;
import com.lhcredit.project.business.piccErrOrder.service.IPiccErrOrderService;
import com.lhcredit.framework.web.controller.BaseController;
import com.lhcredit.framework.web.page.TableDataInfo;
import com.lhcredit.framework.web.domain.AjaxResult;
import com.lhcredit.common.utils.poi.ExcelUtil;

/**
 * 人保海外下单异常信息操作处理
 *
 * @author lhcredit
 * @date 2025-05-08
 */
@Controller
@RequestMapping("/business/piccErrOrder")
public class PiccErrOrderController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(PiccErrOrderController.class);

    private String prefix = "business/piccErrOrder";

    @Autowired
    private IPiccErrOrderService piccErrOrderService;

    @Autowired
    IBCreditReportService bCreditReportService;

    @Autowired
    IFrontUserService frontUserService;

    @Autowired
    ICountryNameService countryNameService;

    @Autowired
    IFrontDeptService frontDeptService;

    @Autowired
    WorldBoxAPI WorldBoxAPI;

    @Autowired
    HolidayWorkdayMapper holidayWorkdayMapper;

    @Autowired
    OverseasreportedpricesMapper overseasreportedpricesMapper;

    @Autowired
    ICountryNameService  countryService;

    @Autowired
    EasyAPI easyAPI;

    @RequiresPermissions("business:piccErrOrder:view")
    @GetMapping()
    public String piccErrOrder() {
        return prefix + "/piccErrOrder";
    }

    /**
     * 查询人保海外下单异常列表
     */
    @RequiresPermissions("business:piccErrOrder:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PiccErrOrder piccErrOrder) {
        startPage();
        List<PiccErrOrder> list = piccErrOrderService.selectPiccErrOrderList(piccErrOrder);
        return getDataTable(list);
    }


    /**
     * 导出人保海外下单异常列表
     */
    @RequiresPermissions("business:piccErrOrder:export")
    @Log(title = "人保海外下单异常", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(PiccErrOrder piccErrOrder) {
        List<PiccErrOrder> list = piccErrOrderService.selectPiccErrOrderList(piccErrOrder);
        ExcelUtil<PiccErrOrder> util = new ExcelUtil<PiccErrOrder>(PiccErrOrder. class);
        return util.exportExcel(list, "piccErrOrder");
    }

    /**
     * 新增人保海外下单异常
     */
    @GetMapping("/add")
    public String add() {
        return prefix + "/add";
    }

    /**
     * 新增保存人保海外下单异常
     */
    @RequiresPermissions("business:piccErrOrder:add")
    @Log(title = "人保海外下单异常", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(PiccErrOrder piccErrOrder) {
        piccErrOrder.setCreateBy(ShiroUtils.getLoginName());
        piccErrOrder.setCreateTime(new Date());
        piccErrOrder.setUpdateBy(ShiroUtils.getLoginName());
        piccErrOrder.setUpdateTime(new Date());
        return toAjax(piccErrOrderService.insertPiccErrOrder(piccErrOrder));
    }

    /**
     * 修改人保海外下单异常
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(id);
        mmap.put("piccErrOrder", piccErrOrder);
        return prefix + "/edit";
    }

    /**
     * 修改信用报告
     */
    @GetMapping("/showRemark/{id}")
    public String showRemark(@PathVariable("id") Integer id, ModelMap mmap) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(id);
        mmap.put("piccErrOrder", piccErrOrder);
        return prefix + "/showRemark";
    }


    /**
     * 标准版下单列表
     */
    @GetMapping("/search/{id}")
    public String search(@PathVariable("id") Integer id, ModelMap mmap) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(id);
        List<CountryName> countryList = countryService.selectCountryList(null);
        mmap.put("countryList", countryList);
        mmap.put("piccErrOrder", piccErrOrder);
        return prefix + "/getHwList";
    }

    /**
     * 简易版下单
     */
    @GetMapping("/searchjy/{id}")
    public String searchjy(@PathVariable("id") Integer id, ModelMap mmap) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(id);
        List<CountryName> countryList = countryService.selectCountryList(null);
        mmap.put("countryList", countryList);
        mmap.put("piccErrOrder", piccErrOrder);
        return prefix + "/getjyHwList";
    }

    /**
     * 下单列表
     */
    @GetMapping("/searchError/{id}")
    public String searchError(@PathVariable("id") Integer id, ModelMap mmap) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(id);
        List<CountryName> countryList = countryService.selectCountryList(null);
        mmap.put("countryList", countryList);
        mmap.put("piccErrOrder", piccErrOrder);
        return prefix + "/errorInfo";
    }

    /**
     * 修改保存人保海外下单异常
     */
    @RequiresPermissions("business:piccErrOrder:edit")
    @Log(title = "人保海外下单异常", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(PiccErrOrder piccErrOrder) {
        piccErrOrder.setUpdateBy(ShiroUtils.getLoginName());
        piccErrOrder.setUpdateTime(new Date());
        return toAjax(piccErrOrderService.updatePiccErrOrder(piccErrOrder));
    }

    /**
     * 删除人保海外下单异常
     */
    @RequiresPermissions("business:piccErrOrder:remove")
    @Log(title = "人保海外下单异常", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    @ResponseBody
    public AjaxResult remove(String ids) {
        return toAjax(piccErrOrderService.deletePiccErrOrderByIds(ids));
    }


    /**
     * 人保海外异常下单
     */
    @Log(title = "人保海外下单异常", businessType = BusinessType.INSERT)
    @PostMapping("/addOrder")
    @ResponseBody
    public AjaxResult addOrder(String win,String name,String id,String country) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(Integer.parseInt(id));
        BCreditReport bCreditReport=new BCreditReport();
        bCreditReport.setOrderNum(piccErrOrder.getOrderNum());
        bCreditReport.setEnterpriseName(name);
        bCreditReport.setAddress(piccErrOrder.getAddress());
        bCreditReport.setCountry(country);
        bCreditReport.setRegNo(piccErrOrder.getRegNo());
        bCreditReport.setTaxNo(piccErrOrder.getTaxNo());
        bCreditReport.setPiccReportType(piccErrOrder.getReportType());

        bCreditReport.setAffiliation(piccErrOrder.getAffiliation());//归属分公司
        bCreditReport.setReportType("-10");//报告类别
        bCreditReport.setEntrustType(piccErrOrder.getOrderType());//委托类型
        bCreditReport.setSource("1");
        bCreditReport.setOrderSource("1");
        //虚拟用户信息,固定
        FrontUser user=new FrontUser();
        user.setLoginName("rbjk");
        List<FrontUser> fuser=frontUserService.selectFrontUserList(user);
        bCreditReport.setUserId(fuser.get(0).getId());
        List<FrontDept> fds=frontDeptService.likeByName(piccErrOrder.getAffiliation());
        if(fds.size()>0){
            bCreditReport.setOrgId(fds.get(0).getId());
            bCreditReport.setContractId(fds.get(0).getContractNum());
        }else {
            bCreditReport.setContractId(6245L);
            bCreditReport.setOrgId(fuser.get(0).getOrgId());
        }
        bCreditReport.setOrgName(piccErrOrder.getAffiliation());//归属分公司
        bCreditReport.setApplicationName(fuser.get(0).getLoginName());

        //记录日志
        Worldboxlog worldboxlog1 = new Worldboxlog();
        worldboxlog1.setName(name);
        worldboxlog1.setCreateBy("人保接口代下单");
        worldboxlog1.setCreateTime(new Date());
        //发送
        Long comontStartDate = System.currentTimeMillis();
        logger.info("提交时间"+comontStartDate);
        String resOrder=WorldBoxAPI.commitOrder("REO125", win, "","",worldboxlog1);
        logger.info("提交返回时间"+(comontStartDate-System.currentTimeMillis()));
        String resOrderNum="";
        if(StringUtils.isNotEmpty(resOrder)) {
            if (resOrder.contains("Validation Failed")) {
                return AjaxResult.error("下单失败!");
            }
            JSONObject resObject = JSON.parseObject(resOrder);
            if (StringUtils.isNotNull(resObject)) {
                resOrderNum=resObject.getString("ordernumber");
            }
        }

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
        HolidayWorkday hw=holidayWorkdayMapper.findholiday(sdfYear.format(new Date()));

        Date dt= HolidayOrWork.getWorkDay(sdf.format(new Date()),4,hw.getWorkday(),hw.getHoliday());
        bCreditReport.setDeliveryTime(dt);//设置交付日期
        bCreditReport.setWin(piccErrOrder.getWin());
        String type="";
        if(piccErrOrder.getReportType().equals("0")){
            type="API简易数据";
        }else {
            type="API标准数据";
        }
        //设置价格
        List<Overseasreportedprices> overseasreportedpricesList=overseasreportedpricesMapper.jgbyjc(type,piccErrOrder.getCountry());
        if(overseasreportedpricesList.size()>0){
            bCreditReport.setProjectPrice(overseasreportedpricesList.get(0).getJg());
        }
        bCreditReport.setId("PICCHW-"+ UUID.randomUUID().toString().replace("-",""));
        bCreditReport.setCreateTime(new Date());
        bCreditReport.setReportProgress("3");//制作状态
        bCreditReport.setReferenceNo(resOrderNum);
        bCreditReport.setBackOrderDeptId(ShiroUtils.getSysUser().getDeptId());
        bCreditReport.setBackOrderUserId(ShiroUtils.getUserId());
        bCreditReport.setApplicationTime(sdf.format(new Date()));
        //根据委托类型计算交付日期
        bCreditReportService.insertBCreditReport(bCreditReport);
        //修改订单状态
        PiccErrOrder peo=new PiccErrOrder();
        peo.setCreateBy(ShiroUtils.getLoginName());
        peo.setCreateTime(new Date());
        peo.setUpdateBy(ShiroUtils.getLoginName());
        peo.setUpdateTime(new Date());
        peo.setStatus("1");
        peo.setId(piccErrOrder.getId());
        return toAjax(piccErrOrderService.updatePiccErrOrder(peo));
    }


    /**
     * 人保海外异常下单
     */
    @Log(title = "人保海外下单异常", businessType = BusinessType.INSERT)
    @PostMapping("/addJyOrder")
    @ResponseBody
    public AjaxResult addJyOrder(String win,String name,String id,String country) {
        PiccErrOrder piccErrOrder =piccErrOrderService.selectPiccErrOrderById(Integer.parseInt(id));
        BCreditReport bCreditReport=new BCreditReport();
        bCreditReport.setOrderNum(piccErrOrder.getOrderNum());
        bCreditReport.setEnterpriseName(name);
        bCreditReport.setAddress(piccErrOrder.getAddress());
        bCreditReport.setCountry(country);
        bCreditReport.setRegNo(piccErrOrder.getRegNo());
        bCreditReport.setTaxNo(piccErrOrder.getTaxNo());
        bCreditReport.setPiccReportType(piccErrOrder.getReportType());

        bCreditReport.setAffiliation(piccErrOrder.getAffiliation());//归属分公司
        bCreditReport.setReportType("-10");//报告类别
        bCreditReport.setEntrustType(piccErrOrder.getOrderType());//委托类型
        bCreditReport.setSource("1");
        bCreditReport.setOrderSource("1");
        bCreditReport.setLimitnum(piccErrOrder.getLimitnum());
        //虚拟用户信息,固定
        FrontUser user=new FrontUser();
        user.setLoginName("rbjk");
        List<FrontUser> fuser=frontUserService.selectFrontUserList(user);
        bCreditReport.setUserId(fuser.get(0).getId());
        List<FrontDept> fds=frontDeptService.likeByName(piccErrOrder.getAffiliation());
        if(fds.size()>0){
            bCreditReport.setOrgId(fds.get(0).getId());
            bCreditReport.setContractId(fds.get(0).getContractNum());
        }else {
            bCreditReport.setContractId(6245L);
            bCreditReport.setOrgId(fuser.get(0).getOrgId());
        }
        bCreditReport.setOrgName(piccErrOrder.getAffiliation());//归属分公司
        bCreditReport.setApplicationName(fuser.get(0).getLoginName());

        //简易报告下单
        String resOrder=easyAPI.addOrder(win,name,"rbjk");
        String resOrderNum="";
        if(StringUtils.isNotEmpty(resOrder)) {
            JSONObject resObject = JSON.parseObject(resOrder);
            if (StringUtils.isNotNull(resObject)) {
                if(resObject.getInteger("code")==200) {
                    resOrderNum = resObject.getString("data");
                }
            }
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
        HolidayWorkday hw=holidayWorkdayMapper.findholiday(sdfYear.format(new Date()));

        Date dt= HolidayOrWork.getWorkDay(sdf.format(new Date()),4,hw.getWorkday(),hw.getHoliday());
        bCreditReport.setDeliveryTime(dt);//设置交付日期
        bCreditReport.setWin(piccErrOrder.getWin());
        String type="";
        if(piccErrOrder.getReportType().equals("0")){
            type="API简易数据";
        }else {
            type="API标准数据";
        }
        //设置价格
        List<Overseasreportedprices> overseasreportedpricesList=overseasreportedpricesMapper.jgbyjc(type,piccErrOrder.getCountry());
        if(overseasreportedpricesList.size()>0){
            bCreditReport.setProjectPrice(overseasreportedpricesList.get(0).getJg());
        }
        bCreditReport.setId("PICCHW-"+ UUID.randomUUID().toString().replace("-",""));
        bCreditReport.setCreateTime(new Date());
        bCreditReport.setReportProgress("3");//制作状态
        bCreditReport.setReferenceNo(resOrderNum);
        bCreditReport.setBackOrderDeptId(ShiroUtils.getSysUser().getDeptId());
        bCreditReport.setBackOrderUserId(ShiroUtils.getUserId());
        bCreditReport.setApplicationTime(sdf.format(new Date()));
        //根据委托类型计算交付日期
        bCreditReportService.insertBCreditReport(bCreditReport);
        //修改订单状态
        PiccErrOrder peo=new PiccErrOrder();
        peo.setCreateBy(ShiroUtils.getLoginName());
        peo.setCreateTime(new Date());
        peo.setUpdateBy(ShiroUtils.getLoginName());
        peo.setUpdateTime(new Date());
        peo.setStatus("1");
        peo.setId(piccErrOrder.getId());
        return toAjax(piccErrOrderService.updatePiccErrOrder(peo));
    }



    /**
     * 人保海外异常下单
     */
    @Log(title = "人保海外下单异常", businessType = BusinessType.INSERT)
    @PostMapping("/addOrderSearch")
    @ResponseBody
    public AjaxResult addOrderSearch(PiccErrOrder piccErrOrder) {
        BCreditReport bCreditReport=new BCreditReport();
        bCreditReport.setOrderNum(piccErrOrder.getOrderNum());
        bCreditReport.setEnterpriseName(piccErrOrder.getEnterpriseName());
        bCreditReport.setAddress(piccErrOrder.getAddress());
        bCreditReport.setCountry(piccErrOrder.getCountry());
        bCreditReport.setRegNo(piccErrOrder.getRegNo());
        bCreditReport.setTaxNo(piccErrOrder.getTaxNo());
        bCreditReport.setPiccReportType(piccErrOrder.getReportType());
        bCreditReport.setCity(piccErrOrder.getCity());
        bCreditReport.setRemark(piccErrOrder.getRemark());

        bCreditReport.setAffiliation(piccErrOrder.getAffiliation());//归属分公司
        bCreditReport.setReportType("-10");//报告类别
        bCreditReport.setEntrustType(piccErrOrder.getOrderType());//委托类型
        bCreditReport.setSource("1");
        bCreditReport.setOrderSource("1");
        //虚拟用户信息,固定
        FrontUser user=new FrontUser();
        user.setLoginName("rbjk");
        List<FrontUser> fuser=frontUserService.selectFrontUserList(user);
        bCreditReport.setUserId(fuser.get(0).getId());
        List<FrontDept> fds=frontDeptService.likeByName(piccErrOrder.getAffiliation());
        if(fds.size()>0){
            bCreditReport.setOrgId(fds.get(0).getId());
            bCreditReport.setContractId(fds.get(0).getContractNum());
        }else {
            bCreditReport.setContractId(6245L);
            bCreditReport.setOrgId(fuser.get(0).getOrgId());
        }
        bCreditReport.setOrgName(piccErrOrder.getAffiliation());//归属分公司
        bCreditReport.setApplicationName(fuser.get(0).getLoginName());

        //记录日志
        Worldboxlog worldboxlog1 = new Worldboxlog();
        worldboxlog1.setName(piccErrOrder.getEnterpriseName());
        worldboxlog1.setCreateBy("人保接口代下单");
        worldboxlog1.setCreateTime(new Date());

        String result = WorldBoxAPI.getCompanyrequestid(piccErrOrder.getEnterpriseName(), piccErrOrder.getAddress(), piccErrOrder.getCity(), piccErrOrder.getCountry(), "USD", worldboxlog1);
        String companyrequestid="";
        String resOrderNum="";
        if(StringUtils.isNotEmpty(result)){
            if(result.contains("Validation Failed")){
                 return AjaxResult.error("下单失败!");
            }
            JSONObject compRes = JSONObject.parseObject(result);
            companyrequestid = compRes.getString("companyrequestid");

            //发送提交订单
            Long comontStartDate = System.currentTimeMillis();
            logger.info("提交时间"+comontStartDate);
            String resOrder=WorldBoxAPI.commitOrder("REO125", "", companyrequestid,piccErrOrder.getRemark(),worldboxlog1);
            logger.info("提交返回时间"+(comontStartDate-System.currentTimeMillis()));
            if(StringUtils.isNotEmpty(resOrder)) {
                if (resOrder.contains("Validation Failed")) {
                    return AjaxResult.error("下单失败!");
                }
                JSONObject resObject = JSON.parseObject(resOrder);
                if (StringUtils.isNotNull(resObject)) {
                    resOrderNum=resObject.getString("ordernumber");
                }
            }
        }

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
        HolidayWorkday hw=holidayWorkdayMapper.findholiday(sdfYear.format(new Date()));

        Date dt= HolidayOrWork.getWorkDay(sdf.format(new Date()),4,hw.getWorkday(),hw.getHoliday());
        bCreditReport.setDeliveryTime(dt);//设置交付日期
        bCreditReport.setWin(piccErrOrder.getWin());
        String type="";
        if(piccErrOrder.getReportType().equals("0")){
            type="API简易数据";
        }else {
            type="API标准数据";
        }
        //设置价格
        List<Overseasreportedprices> overseasreportedpricesList=overseasreportedpricesMapper.jgbyjc(type,piccErrOrder.getCountry());
        if(overseasreportedpricesList.size()>0){
            bCreditReport.setProjectPrice(overseasreportedpricesList.get(0).getJg());
        }
        bCreditReport.setId("PICCHW-"+ UUID.randomUUID().toString().replace("-",""));
        bCreditReport.setCreateTime(new Date());
        bCreditReport.setReportProgress("3");//制作状态
        bCreditReport.setReferenceNo(resOrderNum);
        bCreditReport.setBackOrderDeptId(ShiroUtils.getSysUser().getDeptId());
        bCreditReport.setBackOrderUserId(ShiroUtils.getUserId());
        bCreditReport.setApplicationTime(sdf.format(new Date()));
        //根据委托类型计算交付日期
        bCreditReportService.insertBCreditReport(bCreditReport);
        //修改订单状态
        PiccErrOrder peo=new PiccErrOrder();
        peo.setCreateBy(ShiroUtils.getLoginName());
        peo.setCreateTime(new Date());
        peo.setUpdateBy(ShiroUtils.getLoginName());
        peo.setUpdateTime(new Date());
        peo.setStatus("1");
        peo.setId(piccErrOrder.getId());
        return toAjax(piccErrOrderService.updatePiccErrOrder(peo));
    }




}