use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.
the class AgentServiceImpl method updateAgentExtraBill.
/**
* 增值订单重新提交代理人
* @param enterpriseId
* @param enterpriseSn
* @param billId
* @param userInfoId
* @param agent
* @param itemStatus
* @param old
* @return
* @throws Exception
*/
public Agent updateAgentExtraBill(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, Agent agent, Integer itemStatus, Agent old) throws Exception {
File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
if (null == agent || StringUtils.isBlank(agent.getEnterpriseName()) || StringUtils.isBlank(agent.getName()) || StringUtils.isBlank(agent.getIdCode()) || StringUtils.isBlank(agent.getFrontImg())) {
throw new UserInfoServiceException("请提交完整的代理人信息");
}
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));
}
}
sqlSession.update("com.itrus.portal.db.AgentMapper.updateByPrimaryKeySelective", agent);
sqlSession.flushStatements();
return agent;
}
use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.
the class PersonalReviewServiceImpl method audit.
/**
* 送审
*
* @param bill
* @return
* @throws Exception
*/
public boolean audit(Bill bill) throws Exception {
AuditSystemConfig auditSystemConfig = auditSystemConfigService.getAuditSystemConfig(new AuditSystemConfigExample());
if (null == auditSystemConfig) {
// 未配置第三方鉴证信息
return false;
}
String jsonString = submitReviewService.getAuditJsonParam(bill);
String appsecret = submitReviewService.getProductAppsecret(bill.getProduct());
String result = RequestUtils.post(auditSystemConfig.getAuditSystemUrl() + ComNames.APIS, jsonString, appsecret);
// 将返回信息同步至订单状态
JsonNode respNode = jsonTool.readTree(result);
if (200 == respNode.get("status").asInt()) {
String dataId = respNode.get("result").get("dataid").getTextValue();
// 提交成功
// 设置为送审中的状态
bill.setBillStatus(ComNames.BILL_STATUS_10);
bill.setCheckTime(new Date());
// 设置送审系统中返回的企业的唯一标识
bill.setDataId(dataId);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
// 添加系统日志
LogUtil.syslog(sqlSession, "单条送审", "产品ID" + bill.getProduct() + "企业ID:" + bill.getEnterprise());
return true;
} else if (201 == respNode.get("status").asInt()) {
String message = respNode.get("message").getTextValue();
throw new UserInfoServiceException(message);
}
return false;
}
use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.
the class OrgCodeServiceImpl method updateOrgCodeExtraBill.
/**
* 增值订单重新提交组织机构代码
* @param enterPriseId
* @param enterpriseSn
* @param billId
* @param userInfoId
* @param orgCode
* @param itemStatus
* @param old
* @return
* @throws Exception
*/
public OrgCode updateOrgCodeExtraBill(Long enterPriseId, String enterpriseSn, Long billId, Long userInfoId, OrgCode orgCode, Integer itemStatus, OrgCode old) throws Exception {
File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
Enterprise ent = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", enterPriseId);
if ((null == orgCode || StringUtils.isBlank(orgCode.getEnterpriseName()) || StringUtils.isBlank(orgCode.getOrgCode())) && ent.getEnterpriseNature() != 2) {
throw new UserInfoServiceException("请提交完整的组织机构代码信息");
}
orgCode.setLastModify(new Date());
orgCode.setEnterprise(enterPriseId);
orgCode.setExtraBill(billId);
orgCode.setUserInfo(userInfoId);
// 审核状态:1未审核,2已审核,3已拒绝
orgCode.setItemStatus(itemStatus);
if (StringUtils.isNotBlank(orgCode.getImgFile()) && !ComNames.USE_OLD_IMG.equals(orgCode.getImgFile())) {
File liceImg = filePathUtils.saveImg(imgDir, null, orgCode.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_ORG);
if (liceImg != null && liceImg.isFile()) {
orgCode.setImgFile(liceImg.getName());
orgCode.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
}
}
sqlSession.update("com.itrus.portal.db.OrgCodeMapper.updateByPrimaryKeySelective", orgCode);
sqlSession.flushStatements();
return orgCode;
}
use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.
the class OrgCodeServiceImpl method saveOrgCodeExtraBill.
/**
* 增值订单保存组织机构代码
* @param enterPriseId
* @param enterpriseSn
* @param billId
* @param userInfoId
* @param orgCode
* @param itemStatus
* @param old
* @return
* @throws Exception
*/
public OrgCode saveOrgCodeExtraBill(Long enterPriseId, String enterpriseSn, Long billId, Long userInfoId, OrgCode orgCode, Integer itemStatus, OrgCode old) throws Exception {
File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
Enterprise ent = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", enterPriseId);
// 判断组织机构代码图片是否重新上传了,没有重新上传,则会提交组织机构代码的id,重新上传,还是按照下面的方法处理
if (null != orgCode.getId()) {
OrgCode newOrgCode = new OrgCode();
OrgCode oldOrgCode = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByPrimaryKey", orgCode.getId());
newOrgCode.setEnterpriseName(orgCode.getEnterpriseName());
newOrgCode.setOrgCode(orgCode.getOrgCode());
newOrgCode.setCreateTime(new Date());
newOrgCode.setLastModify(new Date());
newOrgCode.setEnterprise(enterPriseId);
newOrgCode.setExtraBill(billId);
newOrgCode.setUserInfo(userInfoId);
// 审核状态:1未审核,2已审核,3已拒绝
newOrgCode.setItemStatus(oldOrgCode.getItemStatus());
if (null != orgCode.getOrgCodeType())
newOrgCode.setOrgCodeType(orgCode.getOrgCodeType());
if (StringUtils.isNotBlank(orgCode.getImgFile())) {
File liceImg = filePathUtils.saveImg(imgDir, null, orgCode.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_ORG);
if (liceImg != null && liceImg.isFile()) {
newOrgCode.setImgFile(liceImg.getName());
newOrgCode.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
}
} else {
newOrgCode.setImgFile(oldOrgCode.getImgFile());
newOrgCode.setImgFileHash(oldOrgCode.getImgFileHash());
}
sqlSession.insert("com.itrus.portal.db.OrgCodeMapper.insert", newOrgCode);
sqlSession.flushStatements();
return newOrgCode;
}
if ((null == orgCode || StringUtils.isBlank(orgCode.getEnterpriseName()) || StringUtils.isBlank(orgCode.getOrgCode())) && ent.getEnterpriseNature() != 2) {
throw new UserInfoServiceException("请提交完整的组织机构代码信息");
}
orgCode.setCreateTime(new Date());
orgCode.setLastModify(new Date());
orgCode.setEnterprise(enterPriseId);
orgCode.setExtraBill(billId);
orgCode.setUserInfo(userInfoId);
// 审核状态:1未审核,2已审核,3已拒绝
orgCode.setItemStatus(itemStatus);
if (StringUtils.isNotBlank(orgCode.getImgFile()) && !ComNames.USE_OLD_IMG.equals(orgCode.getImgFile())) {
File liceImg = filePathUtils.saveImg(imgDir, null, orgCode.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_ORG);
if (liceImg != null && liceImg.isFile()) {
orgCode.setImgFile(liceImg.getName());
orgCode.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
}
}
if (old == null) {
sqlSession.insert("com.itrus.portal.db.OrgCodeMapper.insert", orgCode);
} else {
orgCode.setId(old.getId());
sqlSession.update("com.itrus.portal.db.OrgCodeMapper.updateByPrimaryKeySelective", orgCode);
}
sqlSession.flushStatements();
return orgCode;
}
use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.
the class BillWebController method register.
/**
* 审核拒绝后,重新提交订单
*
* @param enterpriseName
* 企业名称
* @param enterpriseNature
* 企业性质
* @param billId
* 订单id
* @param businessLicense
* @param orgCode
* @param taxregisterCert
* @param identityCard
* @param agent
* @param proxy
* @param session
* @return
*/
@RequestMapping("/register")
@ResponseBody
public Map<String, Object> register(@RequestParam(value = "enterpriseName", required = true) String enterpriseName, @RequestParam(value = "enterprise_nature", required = false) Integer enterpriseNature, @RequestParam(value = "bill_id", required = true) Long billId, @RequestParam(value = "uid", required = true) String uid, @RequestParam(value = "uid1", required = false) String uid1, @RequestParam(value = "uid2", required = false) String uid2, @RequestParam(value = "uid3", required = false) String uid3, @ModelAttribute("businessLicense") BusinessLicense businessLicense, @ModelAttribute("orgCode") OrgCode orgCode, @ModelAttribute("taxregisterCert") TaxRegisterCert taxregisterCert, @ModelAttribute("identityCard") IdentityCard identityCard, @ModelAttribute("agent") Agent agent, @ModelAttribute("proxy") Proxy proxy, HttpSession session) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识失败,1标识成功
retMap.put("retCode", 0);
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == webuserInfo || null == webenterprise) {
// 登录状态失效,跳转到注册页面
// 2表示登录失效
retMap.put("retCode", 2);
retMap.put("retMsg", "登录已经失效,请重新登录");
return retMap;
}
// 验证参数完整性
if (null == enterpriseNature || 0 == enterpriseNature || null == billId) {
retMap.put("retMsg", "提交参数信息不完整");
return retMap;
}
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billId);
if (null == bill) {
retMap.put("retMsg", "该订单不存在");
return retMap;
}
if (!webuserInfo.getId().equals(bill.getUniqueId())) {
retMap.put("retMsg", "您不能修改该订单");
return retMap;
}
if (bill.getBillStatus() != ComNames.BILL_STATUS_4) {
retMap.put("retMsg", "该订单未审核拒绝");
return retMap;
}
// 根据订单id获取产品需要认证项,
List<String> certItems = sqlSession.selectList("com.itrus.portal.db.CertificationMapper.selectCertItemsByBillId", billId);
if (null == certItems || certItems.isEmpty()) {
retMap.put("retMsg", "服务端出现异常,请联系管理员");
log.error("获取订单对应产品的认证项失败:订单Id=" + billId + ".");
return retMap;
}
// 记录旧的企业唯一标识:
String oldEnterpriseSn = webenterprise.getEnterpriseSn();
// 设置企业唯一标识
if (enterpriseNature.equals(1) || enterpriseNature.equals(2)) {
// 类型为企业和个体工商户:当三证合一时,企业标识为统一社会信用代码;当非三证合一时,企业标识为营业执照注册号;
webenterprise.setEnterpriseSn(businessLicense.getLicenseNo());
}
if (enterpriseNature.equals(3)) {
// 类型为政府机关/事业单位:企业标识为组织机构代码
webenterprise.setEnterpriseSn(orgCode.getOrgCode());
}
// 修改企业名称
webenterprise.setEnterpriseName(enterpriseName.trim());
// 修改企业性质
webenterprise.setEnterpriseNature(enterpriseNature);
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(def);
try {
// 删除订单关联的旧认证项,新增订单对应的新认证项
billWebService.saveBillAuthenticationItems(certItems.get(0), enterpriseNature, billId, businessLicense, orgCode, taxregisterCert, identityCard, agent, proxy, webenterprise, webuserInfo);
// 3、判断该订单对应的企业的认证项是否为通过,若是通过,则重新设置为不通过
if (null != webenterprise.getAuthenticationLevel())
webenterprise.setAuthenticationLevel(null);
if (null != webenterprise.getHasBl())
webenterprise.setHasBl(null);
if (null != webenterprise.getHasOrgCode())
webenterprise.setHasOrgCode(null);
if (null != webenterprise.getHasTaxCert())
webenterprise.setHasTaxCert(null);
if (null != webenterprise.getHasIdCard())
webenterprise.setHasIdCard(null);
if (null != webenterprise.getHasAgent())
webenterprise.setHasAgent(null);
sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey", webenterprise);
// 修改发票
if (bill.getInvoice() != null && bill.getIsInvoiced() == null) {
Invoice invoice = sqlSession.selectOne("com.itrus.portal.db.InvoiceMapper.selectByPrimaryKey", bill.getInvoice());
invoice.setName(webenterprise.getEnterpriseName());
sqlSession.update("com.itrus.portal.db.InvoiceMapper.updateByPrimaryKey", invoice);
}
if (bill.geteInvoice() != null && bill.getIsInvoiced() == null) {
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
einvoice.setName(webenterprise.getEnterpriseName());
sqlSession.update("com.itrus.portal.db.EinvoiceMapper.updateByPrimaryKey", einvoice);
}
if (StringUtils.isNotEmpty(uid) && !uid.equals("{}")) {
bill.setUid(uid);
}
if (StringUtils.isNotEmpty(uid1) && !uid1.equals("{}")) {
bill.setUid1(uid1);
}
if (StringUtils.isNotEmpty(uid2) && !uid2.equals("{}")) {
bill.setUid2(uid2);
}
if (StringUtils.isNotEmpty(uid3) && !uid3.equals("{}")) {
bill.setUid3(uid3);
}
// 设置订单为待审核状态
bill.setBillStatus(ComNames.BILL_STATUS_3);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
transactionManager.commit(status);
session.setAttribute("webenterprise", webenterprise);
// 企业标识改变后,将旧目录中的图片复制到新目录中
if (!oldEnterpriseSn.equals(webenterprise.getEnterpriseSn())) {
CopyFile.copyFile(systemConfigService.getTrustDir().getPath() + File.separator + oldEnterpriseSn, systemConfigService.getTrustDir().getPath() + File.separator + webenterprise.getEnterpriseSn());
}
retMap.put("retCode", 1);
} catch (UserInfoServiceException e) {
if (!status.isCompleted())
transactionManager.rollback(status);
retMap.put("retMsg", e.getMessage());
return retMap;
} catch (Exception e) {
if (!status.isCompleted())
transactionManager.rollback(status);
UserLog userlog = new UserLog();
userlog.setType("重新提交订单");
userlog.setInfo("url:register,详细错误:" + e.getMessage());
userlog.setHostId("未知");
userlog.setProject(webuserInfo.getProject());
LogUtil.userlog(sqlSession, userlog);
retMap.put("retMsg", "服务端出现未知错误,请联系管理员");
log.error(e.getMessage());
return retMap;
} finally {
if (!status.isCompleted())
transactionManager.rollback(status);
}
return retMap;
}
Aggregations