use of com.itrus.portal.db.Project in project portal by ixinportal.
the class DownloadConfigController method update.
// 修改处理
@RequestMapping(params = "update", produces = "text/html")
public String update(@Valid FileConfig fileConfig, @RequestParam(value = "upFile", required = false) MultipartFile upFile, @RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "fileIdArr", required = false) String fileIdArr, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
return updateForm(fileConfig.getId(), status, uiModel);
}
if (status == 1) {
FileConfig fileConfig0 = configServiceImpl.getFileConfigById(fileConfig.getId());
if (!(upFile == null || upFile.isEmpty())) {
try {
// 保存新文件
Map<String, Object> retMap = null;
if (upFile != null) {
// 上传文件
retMap = saveFile(upFile);
if (retMap == null || (int) retMap.get("retCode") != 1) {
return updateForm(fileConfig.getId(), 3, uiModel);
}
fileConfig.setFileSize(retMap.get("fileSize").toString());
fileConfig.setFile(retMap.get("name").toString());
fileConfig.setHash(retMap.get("hash").toString());
}
// 删除旧文件
if (StringUtils.isNotEmpty(fileConfig0.getFile())) {
FileUtils.deleteQuietly(new File(systemConfigService.getSoftDir(), fileConfig0.getFile()));
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
} else if (StringUtils.isNotEmpty(fileConfig.getDownloadUrl()) && StringUtils.isNotEmpty(fileConfig0.getFile())) {
// 删除旧文件
if (StringUtils.isNotEmpty(fileConfig0.getFile())) {
try {
FileUtils.deleteQuietly(new File(systemConfigService.getSoftDir(), fileConfig0.getFile()));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} else if (StringUtils.isNotEmpty(fileConfig0.getFile())) {
fileConfig.setFile(fileConfig0.getFile());
fileConfig.setFileSize(fileConfig0.getFileSize());
fileConfig.setHash(fileConfig0.getHash());
}
fileConfig.setCreator(fileConfig0.getCreator());
fileConfig.setCreateTime(fileConfig0.getCreateTime());
fileConfig.setModifier(getAdmin().getId());
fileConfig.setModifyTime(new Date());
configServiceImpl.updateFileConfig(fileConfig);
String oper = "修改文件管理信息";
String info = "文件名称: " + fileConfig.getName();
LogUtil.adminlog(sqlSession, oper, info);
return "redirect:/downloadconfig/" + fileConfig.getId() + "/" + status;
} else {
Long FileIssueId = 0L;
// 修改删除的发布文件信息
FileIssueExample issueExample = new FileIssueExample();
FileIssueExample.Criteria fec = issueExample.createCriteria();
fec.andProjectEqualTo(projectId);
List<FileIssue> issues = configServiceImpl.getList(issueExample);
for (FileIssue fileIssue : issues) {
if (!fileIdArr.contains(fileIssue.getFileConfig().toString())) {
configServiceImpl.deleteFileIssueById(fileIssue.getId());
}
}
// 修改发布文件信息 没有的信息则添加
String[] idArr = fileIdArr.split(",");
String nameAll = null;
for (int i = 0; i < idArr.length; i++) {
FileIssue fileIssue = configServiceImpl.selectFileIssue(Long.parseLong(idArr[i]), projectId);
if (fileIssue != null) {
fileIssue.setPriority(i + 1);
fileIssue.setModifier(getAdmin().getId());
fileIssue.setModifyTime(new Date());
configServiceImpl.updateFileIssue(fileIssue);
if (i == 0) {
FileIssueId = fileIssue.getId();
}
} else {
FileIssue fileIssue2 = new FileIssue();
fileIssue2.setCreator(getAdmin().getId());
fileIssue2.setCreateTime(new Date());
fileIssue2.setFileConfig(Long.parseLong(idArr[i]));
fileIssue2.setProject(projectId);
fileIssue2.setPriority(i + 1);
configServiceImpl.insertFileIssue(fileIssue2, null, null);
if (i == 0) {
FileIssueId = fileIssue2.getId();
}
}
FileConfig config = configServiceImpl.getFileConfigById(Long.parseLong(idArr[i]));
if (nameAll == null) {
nameAll = config.getName();
} else {
nameAll = nameAll + "," + config.getName();
}
}
Project project = projectServiceImpl.selectByPrimaryKey(projectId);
String oper = "修改文件发布信息";
String info = project.getName() + "项目下发布文件: " + nameAll;
LogUtil.adminlog(sqlSession, oper, info);
return "redirect:/downloadconfig/" + FileIssueId + "/" + status;
}
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class DownloadConfigController method delete.
// 删除
@RequestMapping(value = "/{id}/{status}", method = RequestMethod.DELETE, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id, @PathVariable("status") Integer status, HttpServletRequest request, Model uiModel) {
if (status == 2) {
FileIssue fileIssue = configServiceImpl.getFileIssueById(id);
if (fileIssue == null) {
// uiModel.addAttribute("message", "未找到要删除快递");
return "未找到要删除文件发布信息";
} else {
Project project = null;
FileConfig config = null;
try {
configServiceImpl.deleteFileIssueById(id);
project = projectServiceImpl.selectByPrimaryKey(fileIssue.getProject());
config = configServiceImpl.getFileConfigById(fileIssue.getFileConfig());
String oper = "删除文件发布信息";
String info = "所属项目" + project.getName() + "的" + config.getName() + "文件发布信息";
LogUtil.adminlog(sqlSession, oper, info);
} catch (Exception e) {
// + "】存在关联,无法删除");
return "要删除文件发表信息【" + "所属项目" + project.getName() + "的" + config.getName() + "信息" + "】存在关联,无法删除";
}
}
} else {
FileConfig fileConfig = configServiceImpl.getFileConfigById(id);
if (fileConfig == null) {
// uiModel.addAttribute("message", "未找到要删除快递");
return "未找到要删除的文件信息";
} else {
try {
if (StringUtils.isNotEmpty(fileConfig.getFile())) {
FileUtils.deleteQuietly(new File(systemConfigService.getSoftDir(), fileConfig.getFile()));
}
configServiceImpl.deleteFileConfigById(id);
String oper = "删除文件管理信息";
String info = "文件名称: " + fileConfig.getName();
LogUtil.adminlog(sqlSession, oper, info);
} catch (Exception e) {
// + "】存在关联,无法删除");
return "要删除文件信息【" + fileConfig.getName() + "】存在关联,无法删除";
}
}
}
return null;
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class EnterpriseController method detail.
@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", id);
if (null == enterprise) {
return "status403";
}
uiModel.addAttribute("enterprise", enterprise);
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 10;
}
// 总记录数
Integer count = 0;
// 当前页记录数
Integer itemcount = 0;
// ===0认证信息、1关联用户、2订单列表
if (null == item || 0 == item) {
item = 0;
// 认证信息
BusinessLicense businessLicense = null;
OrgCode orgCode = null;
TaxRegisterCert taxRegisterCert = null;
IdentityCard identityCard = null;
if (null != enterprise.getAuthenticationLevel()) {
// 审核通过:
// 获取企业的认证等级
Certification certification = sqlSession.selectOne("com.itrus.portal.db.CertificationMapper.selectByPrimaryKey", enterprise.getAuthenticationLevel());
uiModel.addAttribute("certification", certification);
}
if (null != enterprise.getHasBl()) {
businessLicense = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByPrimaryKey", enterprise.getHasBl());
}
if (null != enterprise.getHasOrgCode()) {
orgCode = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByPrimaryKey", enterprise.getHasOrgCode());
}
if (null != enterprise.getHasTaxCert()) {
taxRegisterCert = sqlSession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByPrimaryKey", enterprise.getHasTaxCert());
}
if (null != enterprise.getHasIdCard()) {
identityCard = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByPrimaryKey", enterprise.getHasIdCard());
}
uiModel.addAttribute("businessLicense", businessLicense);
uiModel.addAttribute("orgCode", orgCode);
uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
uiModel.addAttribute("identityCard", identityCard);
// 查询增值订单中开户行信息
OpenBankInfoExample obie = new OpenBankInfoExample();
Criteria obiec = obie.createCriteria();
obiec.andEnterpriseEqualTo(enterprise.getId());
obie.setOrderByClause("create_time desc");
List<OpenBankInfo> openBankInfos = sqlSession.selectList("com.itrus.portal.db.OpenBankInfoMapper.selectByExample", obie);
if (openBankInfos != null && openBankInfos.size() > 0) {
uiModel.addAttribute("openBankInfos", openBankInfos);
}
} else if (1 == item) {
item = 1;
// 关联用户
List<UserInfo> userInfos = new ArrayList<UserInfo>();
List<Long> userInfoIds = userInfoEnterpriseService.getUserInfoByEnterprise(enterprise.getId());
if (null != userInfoIds && !userInfoIds.isEmpty()) {
count = userInfoIds.size();
UserInfoExample userInfoExample = new UserInfoExample();
UserInfoExample.Criteria criteria = userInfoExample.or();
criteria.andIdIn(userInfoIds);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
userInfoExample.setOffset(offset);
userInfoExample.setLimit(size);
userInfoExample.setOrderByClause("create_time desc");
userInfos = sqlSession.selectList("com.itrus.portal.db.UserInfoMapper.selectByExample", userInfoExample);
}
itemcount = userInfos.size();
uiModel.addAttribute("userInfos", userInfos);
} else if (2 == item) {
item = 2;
// 订单列表
BillExample billExample = new BillExample();
BillExample.Criteria criteria = billExample.or();
criteria.andEnterpriseEqualTo(enterprise.getId());
criteria.andIsDeleteEqualTo(false);
count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExample);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
billExample.setOffset(offset);
billExample.setLimit(size);
billExample.setOrderByClause("create_time desc");
List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
itemcount = billList.size();
uiModel.addAttribute("billList", billList);
Map<Long, Project> projectMap = billService.getProjectMapByEnterpriseId(enterprise.getId());
uiModel.addAttribute("projectMap", projectMap);
Map<Long, Product> productMap = billService.getProductMapByEnterpriseId(enterprise.getId());
uiModel.addAttribute("productMap", productMap);
Map<Long, UserInfo> userInfoMap = billService.getUserInfoMapByEnterpriseId(enterprise.getId());
uiModel.addAttribute("userInfoMap", userInfoMap);
} else if (3 == item) {
item = 3;
// 增值订单列表
ExtraBillExample extraBillExample = new ExtraBillExample();
ExtraBillExample.Criteria criteria = extraBillExample.or();
criteria.andEnterpriseEqualTo(enterprise.getId());
criteria.andIsDeleteEqualTo(false);
count = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.countByExample", extraBillExample);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
extraBillExample.setOffset(offset);
extraBillExample.setLimit(size);
extraBillExample.setOrderByClause("create_time desc");
List<ExtraBill> extraBillList = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectByExample", extraBillExample);
itemcount = extraBillList.size();
uiModel.addAttribute("billList", extraBillList);
Map<Long, Project> projectMap = extraBillService.getProjectMapByEnterpriseId(enterprise.getId());
uiModel.addAttribute("projectMap", projectMap);
Map<Long, ExtraProduct> productMap = extraBillService.getProductMapByEnterpriseId(enterprise.getId());
uiModel.addAttribute("productMap", productMap);
Map<Long, UserInfo> userInfoMap = extraBillService.getUserInfoMapByEnterpriseId(enterprise.getId());
uiModel.addAttribute("userInfoMap", userInfoMap);
}
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("itemcount", itemcount);
uiModel.addAttribute("item", item);
return "enterprise/detail";
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class ExtraBillPayController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel, @RequestParam(value = "payStatus", required = false) Integer payStatus) {
uiModel.addAttribute("payStatus", payStatus);
// 管理员项目权限
Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
ExtraBillExample billExample = new ExtraBillExample();
ExtraBillExample.Criteria criteria = billExample.or();
criteria.andIdEqualTo(id);
criteria.andProjectIn(projectsOfAdminList);
ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
// 项目
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
uiModel.addAttribute("project", project);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
uiModel.addAttribute("enterprise", enterprise);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 规格
ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
uiModel.addAttribute("productSpec", productSpec);
// 服务商
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
uiModel.addAttribute("serviceProvider", serviceProvider);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 第三方支付信息
OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
uiModel.addAttribute("onPayInfo", onPayInfo);
if (onPayInfo != null && onPayInfo.getOnlinePay() != null) {
// 在线支付
OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onPayInfo.getOnlinePay());
uiModel.addAttribute("onlinePay", onlinePay);
}
// 电子发票
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
uiModel.addAttribute("einvoice", einvoice);
// 其他附加信息
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
uiModel.addAttribute("businessLicense", businessLicense);
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
uiModel.addAttribute("orgCode", orgCode);
// 代理人
Agent agent = agentService.getAgentByExtraBillId(id, null);
uiModel.addAttribute("agent", agent);
// 开户行信息
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
uiModel.addAttribute("openBankInfo", openBankInfo);
// 法人信息
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
uiModel.addAttribute("identityCard", identityCard);
// TODO 还需要补充订单对应的附加信息和第三方回调信息
return "extrabillpay/show";
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class SignRecordController method list.
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "userId", required = false) Long userId, @RequestParam(value = "projectName", required = false) Long projectName, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, Model uiModel) throws Exception {
if (queryDate1 == null && queryDate2 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate2 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.WEEK_OF_MONTH, -1);
queryDate1 = calendar.getTime();
}
Map param = new HashMap();
// page,size
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
Integer offset = size * (page - 1);
param.put("offset", offset);
param.put("limit", size);
param.put("userId", userId);
param.put("queryDate1", queryDate1);
param.put("queryDate2", queryDate2);
String projectName1 = null;
if (projectName != null && projectName != 0) {
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
projectName1 = project.getName();
param.put("projectName", projectName);
}
if (StringUtils.isNotEmpty(enterpriseName)) {
param.put("enterpriseName", "%" + enterpriseName + "%");
}
List srexall = sqlSession.selectList("com.itrus.portal.db.SignRecordMapper.selectBySR", param);
uiModel.addAttribute("list", srexall);
Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountBySR", param);
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
// page, size
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
// itemcount
Map<Long, Project> projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", "id");
uiModel.addAttribute("projectMap", projectMap);
uiModel.addAttribute("userId", userId);
uiModel.addAttribute("queryDate1", queryDate1);
uiModel.addAttribute("queryDate2", queryDate2);
uiModel.addAttribute("projectName", projectName);
uiModel.addAttribute("projects", getProjectMapOfAdmin());
uiModel.addAttribute("enterpriseName", enterpriseName);
return "signrecord/list";
}
Aggregations