Search in sources :

Example 56 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class AgentServiceImpl method portSaveAgent1.

public Agent portSaveAgent1(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, Agent agent, Integer itemStatus, Agent old) throws Exception {
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    // 判断代理信息图片是否重新上传了,没有重新上传,则会提交代理人信息的id,重新上传,还是按照下面的方法处理
    if (null != agent.getId()) {
        Agent newAt = new Agent();
        Agent oldAt = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectByPrimaryKey", agent.getId());
        newAt.setEnterpriseName(agent.getEnterpriseName());
        newAt.setName(agent.getName());
        newAt.setCardType(agent.getCardType());
        newAt.setIdCode(agent.getIdCode());
        newAt.setCreateTime(new Date());
        newAt.setLastModify(new Date());
        // 审核状态:1未审核,2已审核,3已拒绝
        newAt.setItemStatus(oldAt.getItemStatus());
        newAt.setEnterprise(enterpriseId);
        newAt.setBill(billId);
        newAt.setUserInfo(userInfoId);
        // 正面(或者合成)图片
        if (StringUtils.isNotBlank(agent.getFrontImg())) {
            File frontImg = filePathUtils.saveImg(imgDir, null, agent.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
            if (frontImg != null && frontImg.isFile()) {
                newAt.setFrontImg(frontImg.getName());
                newAt.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
            }
        } else {
            newAt.setFrontImg(oldAt.getFrontImg());
            newAt.setFrontImgHash(oldAt.getFrontImgHash());
        }
        // 反面图片
        if (StringUtils.isNotBlank(agent.getBackImg())) {
            File backImg = filePathUtils.saveImg(imgDir, null, agent.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
            if (backImg != null && backImg.isFile()) {
                newAt.setBackImg(backImg.getName());
                newAt.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
            }
        } else {
            newAt.setBackImg(oldAt.getBackImg());
            newAt.setBackImgHash(oldAt.getBackImgHash());
        }
        sqlSession.insert("com.itrus.portal.db.AgentMapper.insert", newAt);
        sqlSession.flushStatements();
        return newAt;
    }
    if (null == agent || StringUtils.isBlank(agent.getEnterpriseName()) || StringUtils.isBlank(agent.getName()) || StringUtils.isBlank(agent.getIdCode())) {
        throw new UserInfoServiceException("请提交完整的代理人信息");
    }
    agent.setCreateTime(new Date());
    agent.setLastModify(new Date());
    // 审核状态:1未审核,2已审核,3已拒绝
    agent.setItemStatus(itemStatus);
    agent.setEnterprise(enterpriseId);
    agent.setBill(billId);
    agent.setUserInfo(userInfoId);
    // 正面(或者合成)图片
    if (StringUtils.isNotBlank(agent.getFrontImg()) && !agent.getFrontImg().equals(ComNames.USE_OLD_IMG)) {
        File frontImg = filePathUtils.saveImg(imgDir, null, agent.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
        if (frontImg != null && frontImg.isFile()) {
            agent.setFrontImg(frontImg.getName());
            agent.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
        }
    }
    // 反面图片
    if (StringUtils.isNotBlank(agent.getBackImg()) && !agent.getBackImg().equals(ComNames.USE_OLD_IMG)) {
        File backImg = filePathUtils.saveImg(imgDir, null, agent.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
        if (backImg != null && backImg.isFile()) {
            agent.setBackImg(backImg.getName());
            agent.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
        }
    }
    if (old == null)
        sqlSession.insert("com.itrus.portal.db.AgentMapper.insert", agent);
    else {
        agent.setId(old.getId());
        sqlSession.update("com.itrus.portal.db.AgentMapper.updateByPrimaryKey", agent);
    }
    sqlSession.flushStatements();
    return agent;
}
Also used : Agent(com.itrus.portal.db.Agent) File(java.io.File) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Example 57 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class AgentServiceImpl method saveAgentExtraBill.

/**
 * 增值订单保存代理人信息
 * @param enterpriseId
 * @param enterpriseSn
 * @param billId
 * @param userInfoId
 * @param agent
 * @param itemStatus
 * @param old
 * @return
 * @throws Exception
 */
public Agent saveAgentExtraBill(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, Agent agent, Integer itemStatus, Agent old) throws Exception {
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    // 判断代理信息图片是否重新上传了,没有重新上传,则会提交代理人信息的id,重新上传,还是按照下面的方法处理
    if (null != agent.getId()) {
        Agent newAt = new Agent();
        Agent oldAt = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectByPrimaryKey", agent.getId());
        newAt.setEnterpriseName(agent.getEnterpriseName());
        newAt.setName(agent.getName());
        newAt.setCardType(agent.getCardType());
        newAt.setIdCode(agent.getIdCode());
        newAt.setCreateTime(new Date());
        newAt.setLastModify(new Date());
        // 审核状态:1未审核,2已审核,3已拒绝
        newAt.setItemStatus(oldAt.getItemStatus());
        newAt.setEnterprise(enterpriseId);
        newAt.setExtraBill(billId);
        newAt.setUserInfo(userInfoId);
        // 正面(或者合成)图片
        if (StringUtils.isNotBlank(agent.getFrontImg())) {
            File frontImg = filePathUtils.saveImg(imgDir, null, agent.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
            if (frontImg != null && frontImg.isFile()) {
                newAt.setFrontImg(frontImg.getName());
                newAt.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
            }
        } else {
            newAt.setFrontImg(oldAt.getFrontImg());
            newAt.setFrontImgHash(oldAt.getFrontImgHash());
        }
        // 反面图片
        if (StringUtils.isNotBlank(agent.getBackImg())) {
            File backImg = filePathUtils.saveImg(imgDir, null, agent.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
            if (backImg != null && backImg.isFile()) {
                newAt.setBackImg(backImg.getName());
                newAt.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
            }
        } else {
            newAt.setBackImg(oldAt.getBackImg());
            newAt.setBackImgHash(oldAt.getBackImgHash());
        }
        sqlSession.insert("com.itrus.portal.db.AgentMapper.insert", newAt);
        sqlSession.flushStatements();
        return newAt;
    }
    if (null == agent || StringUtils.isBlank(agent.getEnterpriseName()) || StringUtils.isBlank(agent.getName()) || StringUtils.isBlank(agent.getIdCode()) || StringUtils.isBlank(agent.getFrontImg())) {
        throw new UserInfoServiceException("请提交完整的代理人信息");
    }
    agent.setCreateTime(new Date());
    agent.setLastModify(new Date());
    // 审核状态:1未审核,2已审核,3已拒绝
    agent.setItemStatus(itemStatus);
    agent.setEnterprise(enterpriseId);
    agent.setExtraBill(billId);
    agent.setUserInfo(userInfoId);
    // 正面(或者合成)图片
    if (StringUtils.isNotBlank(agent.getFrontImg()) && !agent.getFrontImg().equals(ComNames.USE_OLD_IMG)) {
        File frontImg = filePathUtils.saveImg(imgDir, null, agent.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
        if (frontImg != null && frontImg.isFile()) {
            agent.setFrontImg(frontImg.getName());
            agent.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
        }
    }
    // 反面图片
    if (StringUtils.isNotBlank(agent.getBackImg()) && !agent.getBackImg().equals(ComNames.USE_OLD_IMG)) {
        File backImg = filePathUtils.saveImg(imgDir, null, agent.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
        if (backImg != null && backImg.isFile()) {
            agent.setBackImg(backImg.getName());
            agent.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
        }
    }
    if (old == null)
        sqlSession.insert("com.itrus.portal.db.AgentMapper.insert", agent);
    else {
        agent.setId(old.getId());
        sqlSession.update("com.itrus.portal.db.AgentMapper.updateByPrimaryKeySelective", agent);
    }
    sqlSession.flushStatements();
    return agent;
}
Also used : Agent(com.itrus.portal.db.Agent) File(java.io.File) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Example 58 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class AgentServiceImpl method saveAgent1.

public Agent saveAgent1(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, Agent agent, Integer itemStatus, Agent old) throws Exception {
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    // 判断代理信息图片是否重新上传了,没有重新上传,则会提交代理人信息的id,重新上传,还是按照下面的方法处理
    if (null != agent.getId()) {
        Agent newAt = new Agent();
        Agent oldAt = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectByPrimaryKey", agent.getId());
        newAt.setEnterpriseName(agent.getEnterpriseName());
        newAt.setName(agent.getName());
        newAt.setCardType(agent.getCardType());
        newAt.setIdCode(agent.getIdCode());
        newAt.setCreateTime(new Date());
        newAt.setLastModify(new Date());
        // 审核状态:1未审核,2已审核,3已拒绝
        newAt.setItemStatus(oldAt.getItemStatus());
        newAt.setEnterprise(enterpriseId);
        newAt.setBill(billId);
        newAt.setUserInfo(userInfoId);
        // 正面(或者合成)图片
        if (StringUtils.isNotBlank(agent.getFrontImg())) {
            File frontImg = filePathUtils.saveImg(imgDir, null, agent.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
            if (frontImg != null && frontImg.isFile()) {
                newAt.setFrontImg(frontImg.getName());
                newAt.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
            }
        } else {
            newAt.setFrontImg(oldAt.getFrontImg());
            newAt.setFrontImgHash(oldAt.getFrontImgHash());
        }
        // 反面图片
        if (StringUtils.isNotBlank(agent.getBackImg())) {
            File backImg = filePathUtils.saveImg(imgDir, null, agent.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
            if (backImg != null && backImg.isFile()) {
                newAt.setBackImg(backImg.getName());
                newAt.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
            }
        } else {
            newAt.setBackImg(oldAt.getBackImg());
            newAt.setBackImgHash(oldAt.getBackImgHash());
        }
        sqlSession.insert("com.itrus.portal.db.AgentMapper.insert", newAt);
        sqlSession.flushStatements();
        return newAt;
    }
    if (null == agent || StringUtils.isBlank(agent.getEnterpriseName()) || StringUtils.isBlank(agent.getName()) || StringUtils.isBlank(agent.getIdCode()) || StringUtils.isBlank(agent.getFrontImg())) {
        throw new UserInfoServiceException("请提交完整的代理人信息");
    }
    agent.setCreateTime(new Date());
    agent.setLastModify(new Date());
    // 审核状态:1未审核,2已审核,3已拒绝
    agent.setItemStatus(itemStatus);
    agent.setEnterprise(enterpriseId);
    agent.setBill(billId);
    agent.setUserInfo(userInfoId);
    // 正面(或者合成)图片
    if (StringUtils.isNotBlank(agent.getFrontImg()) && !agent.getFrontImg().equals(ComNames.USE_OLD_IMG)) {
        File frontImg = filePathUtils.saveImg(imgDir, null, agent.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
        if (frontImg != null && frontImg.isFile()) {
            agent.setFrontImg(frontImg.getName());
            agent.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
        }
    }
    // 反面图片
    if (StringUtils.isNotBlank(agent.getBackImg()) && !agent.getBackImg().equals(ComNames.USE_OLD_IMG)) {
        File backImg = filePathUtils.saveImg(imgDir, null, agent.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
        if (backImg != null && backImg.isFile()) {
            agent.setBackImg(backImg.getName());
            agent.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
        }
    }
    if (old == null)
        sqlSession.insert("com.itrus.portal.db.AgentMapper.insert", agent);
    else {
        agent.setId(old.getId());
        sqlSession.update("com.itrus.portal.db.AgentMapper.updateByPrimaryKey", agent);
    }
    sqlSession.flushStatements();
    return agent;
}
Also used : Agent(com.itrus.portal.db.Agent) File(java.io.File) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Example 59 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class DynamicCodeServiceImpl method sendCodeZSJS.

public boolean sendCodeZSJS(String mPhone, Long project, String smsType) throws UserInfoServiceException {
    // 同一手机号指定时间内不能重发
    DynamicCodeExample dynamicCodeExample = new DynamicCodeExample();
    DynamicCodeExample.Criteria criteria = dynamicCodeExample.or();
    Calendar c = Calendar.getInstance();
    c.add(Calendar.SECOND, -RESEND_TIME);
    criteria.andMPhoneEqualTo(mPhone);
    // 发送时间大于等于当前时间减去1分钟
    criteria.andSendTimeGreaterThanOrEqualTo(c.getTime());
    List<DynamicCode> dynamicCodes = sqlSession.selectList("com.itrus.portal.db.DynamicCodeMapper.selectByExample", dynamicCodeExample);
    if (null != dynamicCodes && !dynamicCodes.isEmpty()) {
        throw new UserInfoServiceException("此手机号" + RESEND_TIME + "秒内不能连续发送,请稍后重试");
    }
    // 产生动态码
    DynamicCode code = genCode();
    if (null == code) {
        throw new UserInfoServiceException("发送动态码失败,请稍后重试");
    }
    // 发送动态码,获取发送的短信内容
    MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(project, smsType);
    if (null == messageTemplate) {
        throw new UserInfoServiceException("未找到对应的短信模版,请联系管理员配置");
    }
    String content = messageTemplate.getMessageContent();
    content = content.replaceAll("code", code.getCode());
    if (smsType.equals("ZSJS")) {
        smsType = "证书解锁";
    }
    if (!smsSendService.sendDynamicCodeSms(mPhone, content, smsType, project)) {
        // 发送失败
        throw new UserInfoServiceException("动态码发送失败,请联系管理员查看原因");
    } else {
        // 记录动态码之前将该手机号关联的有效验证码设置为无效
        dynamicCodeExample.clear();
        criteria = dynamicCodeExample.createCriteria();
        criteria.andMPhoneEqualTo(mPhone);
        criteria.andCodeStatusEqualTo(ComNames.DYNAMIC_CODE_ENROLL);
        DynamicCode updateCode = new DynamicCode();
        updateCode.setCodeStatus(ComNames.DYNAMIC_CODE_USED);
        updateCode.setFailTime(new Date());
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("record", updateCode);
        map.put("example", dynamicCodeExample);
        sqlSession.update("com.itrus.portal.db.DynamicCodeMapper.updateByExampleSelective", map);
        // 发送成功: 记录动态码
        Calendar calendar = Calendar.getInstance();
        code.setSendTime(calendar.getTime());
        // 失效时间为7天后
        calendar.add(Calendar.DATE, FAIL_TIME_ZSJS);
        // 设置失效时间
        code.setFailTime(calendar.getTime());
        code.setmPhone(mPhone);
        if (code.getId() == null) {
            sqlSession.insert("com.itrus.portal.db.DynamicCodeMapper.insert", code);
        } else {
            sqlSession.update("com.itrus.portal.db.DynamicCodeMapper.updateByPrimaryKey", code);
        }
    }
    return true;
}
Also used : MessageTemplate(com.itrus.portal.db.MessageTemplate) DynamicCodeExample(com.itrus.portal.db.DynamicCodeExample) HashMap(java.util.HashMap) Calendar(java.util.Calendar) DynamicCode(com.itrus.portal.db.DynamicCode) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Date(java.util.Date)

Example 60 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class EditBillServiceImpl method saveEditBill.

/**
 * 新增或修改
 *
 * @param prImgFile
 * @param icbImgFile
 * @param icfImgFile
 * @param atbImgFile
 * @param atfImgFile
 * @param trImgFile
 * @param ocImgFile
 * @param blImgFile
 * @param userSn
 *
 * @return
 * @throws Exception
 */
public EditBill saveEditBill(Long editBillId, Long productId, String productName, Integer productNum, String editBillstr, Long userInfoId, Long projectId, String blImgFile, String ocImgFile, String trImgFile, String icfImgFile, String icbImgFile, String atfImgFile, String atbImgFile, String prImgFile, String userSn, Long enterpriseId, Long productSpecId, Double billSum) throws Exception {
    File imgDir = filePathUtils.getDir(null, userSn);
    EditBill editBill = null;
    if (null != editBillId && !editBillId.equals(0)) {
        // 修改
        editBill = getEditBillById(editBillId);
        if (null == editBill)
            throw new UserInfoServiceException("未找到之前填写中的订单");
        editBill.setModifyTime(new Date());
        if (null != enterpriseId && !enterpriseId.equals(0)) {
            editBill.setEnterpriseId(enterpriseId);
        }
        editBill.setBillSum(billSum);
        editBill.setProductSpec(productSpecId);
        editBill.setProductId(productId);
        editBill.setProductName(productName);
        editBill.setProductNum(productNum);
        editBill.setProjectId(projectId);
        editBill.setUserInfoId(userInfoId);
        editBill.setEditInfo(editBillstr.getBytes("UTF-8"));
        if (StringUtils.isNotBlank(blImgFile) && blImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, blImgFile, ".jpg", "bl");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setBlImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(ocImgFile) && ocImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, ocImgFile, ".jpg", "oc");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setOcImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(trImgFile) && trImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, trImgFile, ".jpg", "tr");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setTrImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(icfImgFile) && icfImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, icfImgFile, ".jpg", "icf");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setIcfImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(icbImgFile) && icbImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, icbImgFile, ".jpg", "icb");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setIcbImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(atfImgFile) && atfImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, atfImgFile, ".jpg", "icf");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setAtfImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(atbImgFile) && atbImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, atbImgFile, ".jpg", "icb");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setAtbImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(prImgFile) && prImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, prImgFile, ".jpg", "pr");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setPrImgFile(liceImg.getName());
            }
        }
        sqlSession.update("com.itrus.portal.db.EditBillMapper.updateByPrimaryKeySelective", editBill);
        sqlSession.flushStatements();
        return editBill;
    } else {
        // 新增
        editBill = new EditBill();
        if (null != enterpriseId && !enterpriseId.equals(0)) {
            editBill.setEnterpriseId(enterpriseId);
        }
        editBill.setBillSum(billSum);
        editBill.setProductSpec(productSpecId);
        editBill.setCreateTime(new Date());
        editBill.setModifyTime(new Date());
        editBill.setProductId(productId);
        editBill.setProductName(productName);
        editBill.setProductNum(productNum);
        editBill.setProjectId(projectId);
        editBill.setUserInfoId(userInfoId);
        editBill.setEditInfo(editBillstr.getBytes("UTF-8"));
        Enterprise ent = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", enterpriseId);
        if (ent != null && ent.getEnterpriseNature() != 3) {
            if (StringUtils.isNotBlank(blImgFile) && blImgFile.indexOf("/editbillImg/") == -1) {
                File liceImg = filePathUtils.saveImg(imgDir, null, blImgFile, ".jpg", "bl");
                if (liceImg != null && liceImg.isFile()) {
                    editBill.setBlImgFile(liceImg.getName());
                }
            }
        }
        if (StringUtils.isNotBlank(ocImgFile) && ocImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, ocImgFile, ".jpg", "oc");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setOcImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(trImgFile) && trImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, trImgFile, ".jpg", "tr");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setTrImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(icfImgFile) && icfImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, icfImgFile, ".jpg", "icf");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setIcfImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(icbImgFile) && icbImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, icbImgFile, ".jpg", "icb");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setIcbImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(atfImgFile) && atfImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, atfImgFile, ".jpg", "icf");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setAtfImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(atbImgFile) && atbImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, atbImgFile, ".jpg", "icb");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setAtbImgFile(liceImg.getName());
            }
        }
        if (StringUtils.isNotBlank(prImgFile) && prImgFile.indexOf("/editbillImg/") == -1) {
            File liceImg = filePathUtils.saveImg(imgDir, null, prImgFile, ".jpg", "pr");
            if (liceImg != null && liceImg.isFile()) {
                editBill.setPrImgFile(liceImg.getName());
            }
        }
        sqlSession.insert("com.itrus.portal.db.EditBillMapper.insert", editBill);
        sqlSession.flushStatements();
        return editBill;
    }
}
Also used : File(java.io.File) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Date(java.util.Date)

Aggregations

UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)73 Date (java.util.Date)39 HashMap (java.util.HashMap)31 File (java.io.File)26 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)22 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)21 Enterprise (com.itrus.portal.db.Enterprise)19 IOException (java.io.IOException)19 UserInfo (com.itrus.portal.db.UserInfo)17 TransactionStatus (org.springframework.transaction.TransactionStatus)14 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)14 SigningServerException (com.itrus.cryptorole.SigningServerException)11 IdentityCard (com.itrus.portal.db.IdentityCard)11 CertificateException (java.security.cert.CertificateException)11 BusinessLicense (com.itrus.portal.db.BusinessLicense)10 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)10 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)10 Agent (com.itrus.portal.db.Agent)9 OrgCode (com.itrus.portal.db.OrgCode)9 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)9